@loaders.gl/flatgeobuf 3.0.10 → 3.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.min.js CHANGED
@@ -1,2 +1,2 @@
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 s=e();for(var r in s)("object"==typeof exports?exports:t)[r]=s[r]}}(window,(function(){return function(t){var e={};function s(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,r){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(s.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(r,i,function(e){return t[e]}.bind(null,i));return r},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=1)}([function(t,e,s){!function(t){"use strict";class e{constructor(t,e,s,r,i,n,o,a,b,h){this.name=t,this.type=e,this.title=s,this.description=r,this.width=i,this.precision=n,this.scale=o,this.nullable=a,this.unique=b,this.primary_key=h}}var 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"}(s||(s={}));class r{constructor(t,e,s,r,i,n){this.org=t,this.code=e,this.name=s,this.description=r,this.wkt=i,this.code_string=n}}const i=new Int32Array(2),n=new Float32Array(i.buffer),o=new Float64Array(i.buffer),a=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];class b{constructor(t,e){this.low=0|t,this.high=0|e}static create(t,e){return 0==t&&0==e?b.ZERO:new b(t,e)}toFloat64(){return(this.low>>>0)+4294967296*this.high}equals(t){return this.low==t.low&&this.high==t.high}}var h,c;b.ZERO=new b(0,0),function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(h||(h={}));class d{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new d(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return new b(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new b(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return i[0]=this.readInt32(t),n[0]}readFloat64(t){return i[a?0:1]=this.readInt32(t),i[a?1:0]=this.readInt32(t+4),o[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)}writeUint64(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)}writeFloat32(t,e){n[0]=e,this.writeInt32(t,i[0])}writeFloat64(t,e){o[0]=e,this.writeInt32(t,i[a?0:1]),this.writeInt32(t+4,i[a?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){const s=t-this.readInt32(t);return e<this.readInt16(s)?this.readInt16(s+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);const s=this.readInt32(t);let r="",i=0;if(t+=4,e===h.UTF8_BYTES)return this.bytes_.subarray(t,t+s);for(;i<s;){let e;const s=this.readUint8(t+i++);if(s<192)e=s;else{const r=this.readUint8(t+i++);if(s<224)e=(31&s)<<6|63&r;else{const n=this.readUint8(t+i++);e=s<240?(15&s)<<12|(63&r)<<6|63&n:(7&s)<<18|(63&r)<<12|(63&n)<<6|63&this.readUint8(t+i++)}}e<65536?r+=String.fromCharCode(e):(e-=65536,r+=String.fromCharCode(55296+(e>>10),56320+(1023&e)))}return r}__union_with_string(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createLong(t,e){return b.create(t,e)}createScalarList(t,e){const s=[];for(let r=0;r<e;++r)null!==t(r)&&s.push(t(r));return s}createObjList(t,e){const s=[];for(let r=0;r<e;++r){const e=t(r);null!==e&&s.push(e.unpack())}return s}}class l{constructor(t){let 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,this.string_maps=null,e=t||1024,this.bb=d.allocate(e),this.space=e}clear(){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,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);const s=1+~(this.bb.capacity()-this.space+e)&t-1;for(;this.space<s+t+e;){const t=this.bb.capacity();this.bb=l.growByteBuffer(this.bb),this.space+=this.bb.capacity()-t}this.pad(s)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,s){(this.force_defaults||e!=s)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,s){(this.force_defaults||e!=s)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,s){(this.force_defaults||e!=s)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,s){!this.force_defaults&&e.equals(s)||(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,s){(this.force_defaults||e!=s)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,s){(this.force_defaults||e!=s)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,s){(this.force_defaults||e!=s)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,s){e!=s&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")}slot(t){null!==this.vtable&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){const e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const s=e<<1,r=d.allocate(s);return r.setPosition(s-e),r.bytes().set(t.bytes(),s-e),r}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);const t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&0==this.vtable[e];e--);const s=e+1;for(;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);const r=2*(s+2);this.addInt16(r);let i=0;const n=this.space;t:for(e=0;e<this.vtables.length;e++){const t=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(t)){for(let e=2;e<r;e+=2)if(this.bb.readInt16(n+e)!=this.bb.readInt16(t+e))continue t;i=this.vtables[e];break}}return i?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,i-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,s){const r=s?4:0;if(e){const t=e;if(this.prep(this.minalign,8+r),4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(let e=3;e>=0;e--)this.writeInt8(t.charCodeAt(e))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const s=this.bb.capacity()-t,r=s-this.bb.readInt32(s);if(0==this.bb.readInt16(r+e))throw new Error("FlatBuffers: field "+e+" must be set")}startVector(t,e,s){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(s,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(!t)return 0;let e;if(t instanceof Uint8Array)e=t;else{e=[];let s=0;for(;s<t.length;){let r;const i=t.charCodeAt(s++);r=i<55296||i>=56320?i:(i<<10)+t.charCodeAt(s++)+-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);for(let t=0,s=this.space,r=this.bb.bytes();t<e.length;t++)r[s++]=e[t];return this.endVector()}createLong(t,e){return b.create(t,e)}createObjectOffset(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let s=0;s<t.length;++s){const r=t[s];if(null===r)throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(r))}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t),this.endVector()}}class u{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsColumn(t,e){return(e||new u).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsColumn(t,e){return t.setPosition(t.position()+4),(e||new u).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}type(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):s.Byte}title(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}width(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):-1}precision(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.readInt32(this.bb_pos+t):-1}scale(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):-1}nullable(){const t=this.bb.__offset(this.bb_pos,18);return!t||!!this.bb.readInt8(this.bb_pos+t)}unique(){const t=this.bb.__offset(this.bb_pos,20);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}primaryKey(){const t=this.bb.__offset(this.bb_pos,22);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}metadata(t){const e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null}static startColumn(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 endColumn(t){const e=t.endObject();return t.requiredField(e,4),e}static createColumn(t,e,s,r,i,n,o,a,b,h,c,d){return u.startColumn(t),u.addName(t,e),u.addType(t,s),u.addTitle(t,r),u.addDescription(t,i),u.addWidth(t,n),u.addPrecision(t,o),u.addScale(t,a),u.addNullable(t,b),u.addUnique(t,h),u.addPrimaryKey(t,c),u.addMetadata(t,d),u.endColumn(t)}}class f{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsCrs(t,e){return(e||new f).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsCrs(t,e){return t.setPosition(t.position()+4),(e||new f).__init(t.readInt32(t.position())+t.position(),t)}org(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}code(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}name(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__string(this.bb_pos+e,t):null}wkt(t){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__string(this.bb_pos+e,t):null}codeString(t){const e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__string(this.bb_pos+e,t):null}static startCrs(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 endCrs(t){return t.endObject()}static createCrs(t,e,s,r,i,n,o){return f.startCrs(t),f.addOrg(t,e),f.addCode(t,s),f.addName(t,r),f.addDescription(t,i),f.addWkt(t,n),f.addCodeString(t,o),f.endCrs(t)}}!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={}));class _{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsHeader(t,e){return(e||new _).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsHeader(t,e){return t.setPosition(t.position()+4),(e||new _).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}envelope(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}envelopeLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}envelopeArray(){const 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(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):c.Unknown}hasZ(){const t=this.bb.__offset(this.bb_pos,10);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasM(){const t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasT(){const t=this.bb.__offset(this.bb_pos,14);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}hasTm(){const t=this.bb.__offset(this.bb_pos,16);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}columns(t,e){const s=this.bb.__offset(this.bb_pos,18);return s?(e||new u).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+4*t),this.bb):null}columnsLength(){const t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}featuresCount(){const t=this.bb.__offset(this.bb_pos,20);return t?this.bb.readUint64(this.bb_pos+t):this.bb.createLong(0,0)}indexNodeSize(){const t=this.bb.__offset(this.bb_pos,22);return t?this.bb.readUint16(this.bb_pos+t):16}crs(t){const e=this.bb.__offset(this.bb_pos,24);return e?(t||new f).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}title(t){const e=this.bb.__offset(this.bb_pos,26);return e?this.bb.__string(this.bb_pos+e,t):null}description(t){const e=this.bb.__offset(this.bb_pos,28);return e?this.bb.__string(this.bb_pos+e,t):null}metadata(t){const e=this.bb.__offset(this.bb_pos,30);return e?this.bb.__string(this.bb_pos+e,t):null}static startHeader(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(let s=e.length-1;s>=0;s--)t.addFloat64(e[s]);return t.endVector()}static startEnvelopeVector(t,e){t.startVector(8,e,8)}static addGeometryType(t,e){t.addFieldInt8(2,e,c.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(let s=e.length-1;s>=0;s--)t.addOffset(e[s]);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 endHeader(t){return t.endObject()}static finishHeaderBuffer(t,e){t.finish(e)}static finishSizePrefixedHeaderBuffer(t,e){t.finish(e,void 0,!0)}}class p{constructor(t,e,s,r,i,n,o,a){this.geometryType=t,this.columns=e,this.featuresCount=s,this.indexNodeSize=r,this.crs=i,this.title=n,this.description=o,this.metadata=a}static fromByteBuffer(t){const s=_.getRootAsHeader(t),i=s.featuresCount().toFloat64(),n=s.indexNodeSize(),o=[];for(let t=0;t<s.columnsLength();t++){const r=s.columns(t);if(!r)throw new Error("Column unexpectedly missing");if(!r.name())throw new Error("Column name unexpectedly missing");o.push(new e(r.name(),r.type(),r.title(),r.description(),r.width(),r.precision(),r.scale(),r.nullable(),r.unique(),r.primaryKey()))}const a=s.crs(),b=a?new r(a.org(),a.code(),a.name(),a.description(),a.wkt(),a.codeString()):null;return new p(s.geometryType(),o,i,n,b,s.title(),s.description(),s.metadata())}}class g{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsGeometry(t,e){return(e||new g).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsGeometry(t,e){return t.setPosition(t.position()+4),(e||new g).__init(t.readInt32(t.position())+t.position(),t)}ends(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readUint32(this.bb.__vector(this.bb_pos+e)+4*t):0}endsLength(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0}endsArray(){const 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){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}xyLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}xyArray(){const 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){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}zLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}zArray(){const 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){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}mLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}mArray(){const 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){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.readFloat64(this.bb.__vector(this.bb_pos+e)+8*t):0}tLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}tArray(){const 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){const 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(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}type(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readUint8(this.bb_pos+t):c.Unknown}parts(t,e){const s=this.bb.__offset(this.bb_pos,18);return s?(e||new g).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+4*t),this.bb):null}partsLength(){const t=this.bb.__offset(this.bb_pos,18);return t?this.bb.__vector_len(this.bb_pos+t):0}static startGeometry(t){t.startObject(8)}static addEnds(t,e){t.addFieldOffset(0,e,0)}static createEndsVector(t,e){t.startVector(4,e.length,4);for(let s=e.length-1;s>=0;s--)t.addInt32(e[s]);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(let s=e.length-1;s>=0;s--)t.addFloat64(e[s]);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(let s=e.length-1;s>=0;s--)t.addFloat64(e[s]);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(let s=e.length-1;s>=0;s--)t.addFloat64(e[s]);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(let s=e.length-1;s>=0;s--)t.addFloat64(e[s]);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(let s=e.length-1;s>=0;s--)t.addInt64(e[s]);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(let s=e.length-1;s>=0;s--)t.addOffset(e[s]);return t.endVector()}static startPartsVector(t,e){t.startVector(4,e,4)}static endGeometry(t){return t.endObject()}static createGeometry(t,e,s,r,i,n,o,a,b){return g.startGeometry(t),g.addEnds(t,e),g.addXy(t,s),g.addZ(t,r),g.addM(t,i),g.addT(t,n),g.addTm(t,o),g.addType(t,a),g.addParts(t,b),g.endGeometry(t)}}function y(t,e,s){if(0!==t.length)if(Array.isArray(t[0]))for(const r of t)y(r,e,s);else 2===t.length?e.push(...t):(e.push(t[0],t[1]),s.push(t[2]))}function w(t,e){const s=[];for(let r=0;r<t.length;r+=2){const i=[t[r],t[r+1]];e&&i.push(e[r>>1]),s.push(i)}return s}function m(t){return t?c[t]:c.Unknown}function v(t){const e=t.coordinates,s=[],r=[];let i,n;const o=m(t.type);let a=0;switch(t.type){case"Point":y(e,s,r);break;case"MultiPoint":case"LineString":y(e,s,r);break;case"MultiLineString":case"Polygon":{const t=e;y(t,s,r),t.length>1&&(i=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:s,z:r.length>0?r:void 0,ends:i,type:o,parts:n}}function I(t,e){if(e===c.GeometryCollection){const s=[];for(let e=0;e<t.partsLength();e++){const r=t.parts(e),i=r.type();s.push(I(r,i))}return{type:c[e],geometries:s}}if(e===c.MultiPolygon){const s=[];for(let e=0;e<t.partsLength();e++)s.push(I(t.parts(e),c.Polygon));return{type:c[e],coordinates:s.map(t=>t.coordinates)}}const s=function(t,e){const s=t.xyArray(),r=t.zArray();switch(e){case c.Point:{const t=Array.from(s);return r&&t.push(r[0]),t}case c.MultiPoint:case c.LineString:return w(s,r);case c.MultiLineString:case c.Polygon:return function(t,e,s){if(!s||0===s.length)return[w(t,e)];let r=0;const i=Array.from(s).map(e=>t.slice(r,r=e<<1));let n;return e&&(r=0,n=Array.from(s).map(t=>e.slice(r,r=t))),i.map((t,e)=>w(t,n?n[e]:void 0))}(s,r,t.endsArray())}}(t,e);return{type:c[e],coordinates:s}}class F{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFeature(t,e){return(e||new F).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFeature(t,e){return t.setPosition(t.position()+4),(e||new F).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){const e=this.bb.__offset(this.bb_pos,4);return e?(t||new g).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}properties(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0}propertiesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}propertiesArray(){const 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){const s=this.bb.__offset(this.bb_pos,8);return s?(e||new u).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+4*t),this.bb):null}columnsLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFeature(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(let s=e.length-1;s>=0;s--)t.addInt8(e[s]);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(let s=e.length-1;s>=0;s--)t.addOffset(e[s]);return t.endVector()}static startColumnsVector(t,e){t.startVector(4,e,4)}static endFeature(t){return t.endObject()}static finishFeatureBuffer(t,e){t.finish(e)}static finishSizePrefixedFeatureBuffer(t,e){t.finish(e,void 0,!0)}static createFeature(t,e,s,r){return F.startFeature(t),F.addGeometry(t,e),F.addProperties(t,s),F.addColumns(t,r),F.endFeature(t)}}const U=new TextEncoder,O=new TextDecoder;function S(t,e,r){const i=r.columns,n=new l;let o=0,a=1024,b=new Uint8Array(a),h=new DataView(b.buffer);const c=function(t){if(o+t<a)return;a*=2;const e=new Uint8Array(a);e.set(b),b=e,h=new DataView(b.buffer,o)};if(i)for(let t=0;t<i.length;t++){const r=i[t],n=e[r.name];if(null!==n)switch(h.setUint16(o,t,!0),o+=2,r.type){case s.Bool:c(1),h.setUint8(o,n),o+=1;break;case s.Short:c(2),h.setInt16(o,n,!0),o+=2;break;case s.UShort:c(2),h.setUint16(o,n,!0),o+=2;break;case s.Int:c(4),h.setInt32(o,n,!0),o+=4;break;case s.UInt:c(4),h.setUint32(o,n,!0),o+=4;break;case s.Long:c(8),h.setBigInt64(o,BigInt(n),!0),o+=8;break;case s.Double:c(8),h.setFloat64(o,n,!0),o+=8;break;case s.DateTime:case s.String:{const t=U.encode(n);c(4),h.setUint32(o,t.length,!0),o+=4,c(t.length),b.set(t,o),o+=t.length;break}default:throw new Error("Unknown type "+r.type)}}let d=null;o>0&&(d=F.createPropertiesVector(n,b.slice(0,o)));const u=function t(e,s){const{xy:r,z:i,ends:n,parts:o,type:a}=s;if(o){const s=o.map(s=>t(e,s)),r=g.createPartsVector(e,s);return g.startGeometry(e),g.addParts(e,r),g.endGeometry(e)}const b=g.createXyVector(e,r);let h,c;return i&&(h=g.createZVector(e,i)),n&&(c=g.createEndsVector(e,n)),g.startGeometry(e),c&&g.addEnds(e,c),g.addXy(e,b),h&&g.addZ(e,h),g.addType(e,a),g.endGeometry(e)}(n,t);F.startFeature(n),F.addGeometry(n,u),d&&F.addProperties(n,d);const f=F.endFeature(n);return n.finishSizePrefixed(f),n.asUint8Array()}function C(t,e){const r=e.columns,i={type:"Feature",geometry:I(t.geometry(),e.geometryType)};return r&&r.length>0&&(i.properties=function(t,e){const r={};if(!e||0===e.length)return r;const i=t.propertiesArray();if(!i)return r;const n=new DataView(i.buffer,i.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 s.Bool:r[b]=!!n.getUint8(a),a+=1;break;case s.Byte:r[b]=n.getInt8(a),a+=1;break;case s.UByte:r[b]=n.getUint8(a),a+=1;break;case s.Short:r[b]=n.getInt16(a,!0),a+=2;break;case s.UShort:r[b]=n.getUint16(a,!0),a+=2;break;case s.Int:r[b]=n.getInt32(a,!0),a+=4;break;case s.UInt:r[b]=n.getUint32(a,!0),a+=4;break;case s.Long:r[b]=Number(n.getBigInt64(a,!0)),a+=8;break;case s.ULong:r[b]=Number(n.getBigUint64(a,!0)),a+=8;break;case s.Double:r[b]=n.getFloat64(a,!0),a+=8;break;case s.DateTime:case s.String:{const t=n.getUint32(a,!0);a+=4,r[b]=O.decode(i.subarray(a,a+t)),a+=t;break}default:throw new Error("Unknown type "+o.type)}}return r}(t,r)),i}var A,V=new Uint8Array(0);function P(t,e){if(!t.length)return e;if(!e.length)return t;var s=new Uint8Array(t.length+e.length);return s.set(t),s.set(e,t.length),s}function x(t){this._source=t,this._array=V,this._index=0}x.prototype.read=function(){var t=this,e=t._array.subarray(t._index);return t._source.read().then((function(s){return t._array=V,t._index=0,s.done?e.length>0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:P(e,s.value)}}))},x.prototype.slice=function(t){if((t|=0)<0)throw new Error("invalid length");var e=this,s=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 i(){return e._source.read().then((function(n){return n.done?(e._array=V,e._index=0,s>0?r.subarray(0,s):null):s+n.value.length>=t?(e._array=n.value,e._index=t-s,r.set(n.value.subarray(0,t-s),s),r):(r.set(n.value,s),s+=n.value.length,i())}))}()},x.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"}(A||(A={}));class B{static debug(...t){this.log(A.Debug,...t)}static info(...t){this.log(A.Info,...t)}static warn(...t){this.log(A.Warn,...t)}static error(...t){this.log(A.Error,...t)}static log(t,...e){if(!(this.logLevel>t))switch(t){case A.Debug:console.debug(...e);break;case A.Info:console.info(...e);break;case A.Warn:console.warn(...e);break;case A.Error:console.error(...e)}}}function L(t,e){e=Math.min(Math.max(+e,2),65535);let s=t,r=s;do{s=Math.ceil(s/e),r+=s}while(1!==s);return 40*r}function T(t,e){if(0!=(4293918720&t))throw Error("integer is too large to be safely represented");return e+t*2**32}B.logLevel=A.Info;const k=new Uint8Array([102,103,98,3,102,103,98,0]);class N{constructor(t,e,s,r){this.headerClient=t,this.header=e,this.headerLength=s,this.indexLength=r}static async open(t){const e=new E(t),s=(()=>{let t,e=0;for(t=0;t<3;t++)e+=16**t*40;return e})(),r=2024+s;B.debug(`fetching header. minReqLength: ${r} (assumedHeaderLength: 2024, assumedIndexLength: ${s})`);{const t=new Uint8Array(await e.getRange(0,8,r,"header"));if(!t.every((t,e)=>k[e]===t))throw B.error(`bytes: ${t} != ${k}`),new Error("Not a FlatGeobuf file");B.debug("magic bytes look good")}let i;{const t=await e.getRange(8,4,r,"header");if(i=new DataView(t).getUint32(0,!0),i>10485760||i<8)throw new Error("Invalid header size");B.debug("headerLength: "+i)}const n=await e.getRange(12,i,r,"header"),o=new d(new Uint8Array(n)),a=p.fromByteBuffer(o),b=L(a.featuresCount,a.indexNodeSize);return B.debug("completed: opening http reader"),new N(e,a,i,b)}async*selectBbox(t){const e=this.lengthBeforeTree(),s=this.headerClient;B.debug("starting: selectBbox, traversing index. lengthBeforeTree: "+e),yield*async function*(t,e,s,r){class i{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}=s,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 s=t,r=s;const i=[s];do{s=Math.ceil(s/e),r+=s,i.push(s)}while(1!==s);const n=[];s=r;for(const t of i)n.push(s-t),s-=t;n.reverse(),i.reverse();const o=[];for(let t=0;t<i.length;t++)o.push([n[t],n[t]+i[t]]);return o.reverse(),o}(t,e),c=h[0][0],d=[(()=>{const t=h.length-1;return new i([0,1],t)})()];for(B.debug(`starting stream search with queue: ${d}, numItems: ${t}, nodeSize: ${e}, levelBounds: ${h}`);0!=d.length;){const t=d.shift();B.debug(`popped node: ${t}, queueLength: ${d.length}`);let s=t.startNode();const l=s>=c,[,u]=h[t.level()],f=Math.min(t.endNode()+e,u),_=f-s,p=await r(40*s,40*_),g=new Float64Array(p),y=new Uint32Array(p);for(let e=s;e<f;e++){const r=5*(e-s);if(a<g[r+0])continue;if(b<g[r+1])continue;if(n>g[r+2])continue;if(o>g[r+3])continue;const h=y[8+(r<<1)],u=T(y[9+(r<<1)],h);if(l){B.debug("yielding feature"),yield[u,e-c];continue}const f=6553.6,_=d[d.length-1];if(void 0!==_&&_.level()==t.level()-1&&u<_.endNode()+f){B.debug(`Merging "nodeRange" request into existing range: ${_}, newOffset: ${_.endNode()} -> ${u}`),_.extendEndNodeToNewOffset(u);continue}let p=(()=>{let e=t.level()-1;return new i([u,u+1],e)})();void 0!==_&&_.level()==p.level()?B.debug(`Same level, but too far away. Pushing new request at offset: ${u} rather than merging with distant ${_}`):B.debug(`Pushing new level for ${p} onto queue with nearestNodeRange: ${_} since there's not already a range for this level.`),d.push(p)}}}(this.header.featuresCount,this.header.indexNodeSize,t,(async function(t,r){return s.getRange(e+t,r,0,"index")}))}lengthBeforeTree(){return k.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,s=t+this.lengthBeforeFeatures();let r;{const t=await this.featureClient().getRange(s,4,e,"feature length");r=new DataView(t).getUint32(0,!0)}B.debug(`featureOffset: ${s}, featureLength: ${r}`);const i=await this.featureClient().getRange(s+4,r,e,"feature data"),n=new Uint8Array(i),o=new Uint8Array(r+4);o.set(n,4);const a=new d(o);return a.setPosition(4),F.getRootAsFeature(a)}}class E{constructor(t){this.buffer=new ArrayBuffer(0),this.head=0,this.httpClient="string"==typeof t?new j(t):t}clone(){const t=new E(this.httpClient);return t.buffer=this.buffer.slice(0),t.head=this.head,t}async getRange(t,e,s,r){B.debug(`need Range: ${t}-${t+e-1}`);const i=t-this.head,n=i+e;if(i>=0&&n<this.buffer.byteLength)return B.debug(`slicing existing Range: ${i}-${n-1}`),this.buffer.slice(i,n);const o=Math.max(e,s);return this.buffer=await this.httpClient.getRange(t,o,r),this.head=t,this.buffer.slice(0,e)}}class j{constructor(t){this.requestsEverMade=0,this.bytesEverRequested=0,this.url=t}async getRange(t,e,s){this.requestsEverMade+=1,this.bytesEverRequested+=e;const r=`bytes=${t}-${t+e-1}`;return B.debug(`request: #${this.requestsEverMade}, purpose: ${s}), bytes: (this_request: ${e}, ever: ${this.bytesEverRequested}), Range: ${r}`),(await fetch(this.url,{headers:{Range:r}})).arrayBuffer()}}async function M(t,e,s){let r=new Uint8Array(await t(4,"feature length"));if(0===r.byteLength)return;let i=new d(r);const n=i.readUint32(0);r=new Uint8Array(await t(n,"feature data"));const o=new Uint8Array(n+4);return o.set(r,4),i=new d(o),i.setPosition(4),s(F.getRootAsFeature(i),e)}function R(t){const e=new l;let s=null;t.columns&&(s=_.createColumnsVector(e,t.columns.map(t=>function(t,e){const s=t.createString(e.name);return u.startColumn(t),u.addName(t,s),u.addType(t,e.type),u.endColumn(t)}(e,t))));const r=e.createString("L1");_.startHeader(e),_.addFeaturesCount(e,new b(t.featuresCount,0)),_.addGeometryType(e,t.geometryType),_.addIndexNodeSize(e,0),s&&_.addColumns(e,s),_.addName(e,r);const i=_.endHeader(e);return e.finishSizePrefixed(i),e.asUint8Array()}t.deserialize=function(t,e,s){return t instanceof Uint8Array?function(t,e){return{type:"FeatureCollection",features:function(t,e,s){if(!t.subarray(0,7).every((t,e)=>k[e]===t))throw new Error("Not a FlatGeobuf file");const r=new d(t),i=r.readUint32(k.length);r.setPosition(k.length+4);const n=p.fromByteBuffer(r);s&&s(n);let o=k.length+4+i;const{indexNodeSize:a,featuresCount:b}=n;a>0&&(o+=L(b,a));const h=[];for(;o<r.capacity();){const t=r.readUint32(o);r.setPosition(o+4);const s=F.getRootAsFeature(r);h.push(e(s,n)),o+=4+t}return h}(t,C,e)}}(t,s):t instanceof ReadableStream?function(t,e){return async function*(t,e,s){const r="function"==typeof(i=t).slice?i:new x("function"==typeof i.read?i:i.getReader());var i;const n=async t=>await r.slice(t);let o=new Uint8Array(await n(8));if(!o.every((t,e)=>k[e]===t))throw new Error("Not a FlatGeobuf file");o=new Uint8Array(await n(4));let a=new d(o);const b=a.readUint32(0);o=new Uint8Array(await n(b)),a=new d(o);const h=p.fromByteBuffer(a);s&&s(h);const{indexNodeSize:c,featuresCount:l}=h;if(c>0){const t=L(l,c);await n(t)}let u;for(;u=await M(n,h,e);)yield u}(t,C,e)}(t,s):function(t,e,s){return async function*(t,e,s,r){const i=await N.open(t);B.debug("opened reader"),r&&r(i.header);for await(const t of i.selectBbox(e)){const e=await i.readFeature(t[0]);yield s(e,i.header)}}(t,e,C,s)}(t,e,s)},t.serialize=function(t){return function(t){const r=function(t){const r=t.features[0],i=r.properties;let n=null;return i&&(n=Object.keys(i).map(t=>new e(t,function(t){if("boolean"==typeof t)return s.Bool;if("number"==typeof t)return t%1==0?s.Int:s.Double;if("string"==typeof t)return s.String;if(null===t)return s.String;throw new Error(`Unknown type (value '${t}')`)}(i[t]),null,null,-1,-1,-1,!0,!1,!1))),new p(m(r.geometry.type),n,t.features.length,0,null,null,null,null)}(t),i=R(r),n=t.features.map(t=>S(v(t.geometry),t.properties,r)),o=n.map(t=>t.length).reduce((t,e)=>t+e),a=new Uint8Array(k.length+i.length+o);a.set(i,k.length);let b=k.length+i.length;for(const t of n)a.set(t,b),b+=t.length;return a.set(k),a}(t)},Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(t,e,s){(function(e){const r=s(3),i="undefined"==typeof window?e:window;i.loaders=i.loaders||{},t.exports=Object.assign(i.loaders,r)}).call(this,s(2))},function(t,e){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(t){"object"==typeof window&&(s=window)}t.exports=s},function(t,e,s){"use strict";s.r(e),s.d(e,"FlatGeobufWorkerLoader",(function(){return r})),s.d(e,"FlatGeobufLoader",(function(){return o})),s.d(e,"_typecheckFlatGeobufLoader",(function(){return a}));const r={id:"flatgeobuf",name:"FlatGeobuf",module:"flatgeobuf",version:"3.0.10",worker:!0,extensions:["fgb"],mimeTypes:["application/octet-stream"],category:"geometry",options:{flatgeobuf:{}}};var i=s(0);function n(t,e){if(0===t.byteLength)return[];const s=new Uint8Array(t),{features:r}=Object(i.deserialize)(s);return r}const o={...r,parse:async(t,e)=>n(t),parseSync:n,parseInBatchesFromStream:function(t,e){return Object(i.deserializeStream)(t)},binary:!0},a=o}])}));
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 r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},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 n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},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=1)}([function(t,e,r){!function(t,e){"use strict";class r{constructor(t,e){this.name=t,this.type=e}}var 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"}(n||(n={}));var o=n;class i{constructor(t,e,r){this.geometryType=t,this.columns=e,this.featuresCount=r}}var s,a,u,l,c={SIZEOF_SHORT:2,SIZEOF_INT:4,FILE_IDENTIFIER_LENGTH:4,SIZE_PREFIX_LENGTH:4,Encoding:{UTF8_BYTES:1,UTF16_STRING:2}};c.int32=new Int32Array(2),c.float32=new Float32Array(c.int32.buffer),c.float64=new Float64Array(c.int32.buffer),c.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],c.Long=function(t,e){this.low=0|t,this.high=0|e},c.Long.create=function(t,e){return 0==t&&0==e?c.Long.ZERO:new c.Long(t,e)},c.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},c.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},c.Long.ZERO=new c.Long(0,0),c.Builder=function(t){if(t)e=t;else var e=1024;this.bb=c.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},c.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},c.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},c.Builder.prototype.dataBuffer=function(){return this.bb},c.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},c.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=c.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},c.Builder.prototype.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},c.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},c.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},c.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},c.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},c.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},c.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},c.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},c.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},c.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},c.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},c.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},c.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},c.Builder.prototype.addFieldInt8=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))},c.Builder.prototype.addFieldInt16=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))},c.Builder.prototype.addFieldInt32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))},c.Builder.prototype.addFieldInt64=function(t,e,r){!this.force_defaults&&e.equals(r)||(this.addInt64(e),this.slot(t))},c.Builder.prototype.addFieldFloat32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))},c.Builder.prototype.addFieldFloat64=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))},c.Builder.prototype.addFieldOffset=function(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))},c.Builder.prototype.addFieldStruct=function(t,e,r){e!=r&&(this.nested(e),this.slot(t))},c.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},c.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},c.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},c.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},c.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=c.ByteBuffer.allocate(r);return n.setPosition(r-e),n.bytes().set(t.bytes(),r-e),n},c.Builder.prototype.addOffset=function(t){this.prep(c.SIZEOF_INT,0),this.writeInt32(this.offset()-t+c.SIZEOF_INT)},c.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()},c.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)*c.SIZEOF_SHORT;this.addInt16(n);var o=0,i=this.space;t:for(e=0;e<this.vtables.length;e++){var s=this.bb.capacity()-this.vtables[e];if(n==this.bb.readInt16(s)){for(var a=c.SIZEOF_SHORT;a<n;a+=c.SIZEOF_SHORT)if(this.bb.readInt16(i+a)!=this.bb.readInt16(s+a))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},c.Builder.prototype.finish=function(t,e,r){var n=r?c.SIZE_PREFIX_LENGTH:0;if(e){var o=e;if(this.prep(this.minalign,c.SIZEOF_INT+c.FILE_IDENTIFIER_LENGTH+n),o.length!=c.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+c.FILE_IDENTIFIER_LENGTH);for(var i=c.FILE_IDENTIFIER_LENGTH-1;i>=0;i--)this.writeInt8(o.charCodeAt(i))}this.prep(this.minalign,c.SIZEOF_INT+n),this.addOffset(t),n&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},c.Builder.prototype.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},c.Builder.prototype.requiredField=function(t,e){var r=this.bb.capacity()-t,n=r-this.bb.readInt32(r);if(0==this.bb.readInt16(n+e))throw new Error("FlatBuffers: field "+e+" must be set")},c.Builder.prototype.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(c.SIZEOF_INT,t*e),this.prep(r,t*e)},c.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},c.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var r=0;r<t.length;){var n,o=t.charCodeAt(r++);(n=o<55296||o>=56320?o:(o<<10)+t.charCodeAt(r++)+-56613888)<128?e.push(n):(n<2048?e.push(n>>6&31|192):(n<65536?e.push(n>>12&15|224):e.push(n>>18&7|240,n>>12&63|128),e.push(n>>6&63|128)),e.push(63&n|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),r=0;for(var i=this.space,s=this.bb.bytes();r<e.length;r++)s[i++]=e[r];return this.endVector()},c.Builder.prototype.createLong=function(t,e){return c.Long.create(t,e)},c.ByteBuffer=function(t){this.bytes_=t,this.position_=0},c.ByteBuffer.allocate=function(t){return new c.ByteBuffer(new Uint8Array(t))},c.ByteBuffer.prototype.clear=function(){this.position_=0},c.ByteBuffer.prototype.bytes=function(){return this.bytes_},c.ByteBuffer.prototype.position=function(){return this.position_},c.ByteBuffer.prototype.setPosition=function(t){this.position_=t},c.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},c.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},c.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},c.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},c.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},c.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},c.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},c.ByteBuffer.prototype.readInt64=function(t){return new c.Long(this.readInt32(t),this.readInt32(t+4))},c.ByteBuffer.prototype.readUint64=function(t){return new c.Long(this.readUint32(t),this.readUint32(t+4))},c.ByteBuffer.prototype.readFloat32=function(t){return c.int32[0]=this.readInt32(t),c.float32[0]},c.ByteBuffer.prototype.readFloat64=function(t){return c.int32[c.isLittleEndian?0:1]=this.readInt32(t),c.int32[c.isLittleEndian?1:0]=this.readInt32(t+4),c.float64[0]},c.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},c.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},c.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},c.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},c.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},c.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},c.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},c.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},c.ByteBuffer.prototype.writeFloat32=function(t,e){c.float32[0]=e,this.writeInt32(t,c.int32[0])},c.ByteBuffer.prototype.writeFloat64=function(t,e){c.float64[0]=e,this.writeInt32(t,c.int32[c.isLittleEndian?0:1]),this.writeInt32(t+4,c.int32[c.isLittleEndian?1:0])},c.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+c.SIZEOF_INT+c.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<c.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+c.SIZEOF_INT+e));return t},c.ByteBuffer.prototype.__offset=function(t,e){var r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0},c.ByteBuffer.prototype.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},c.ByteBuffer.prototype.__string=function(t,e){t+=this.readInt32(t);var r=this.readInt32(t),n="",o=0;if(t+=c.SIZEOF_INT,e===c.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+r);for(;o<r;){var i,s=this.readUint8(t+o++);if(s<192)i=s;else{var a=this.readUint8(t+o++);if(s<224)i=(31&s)<<6|63&a;else{var u=this.readUint8(t+o++);i=s<240?(15&s)<<12|(63&a)<<6|63&u:(7&s)<<18|(63&a)<<12|(63&u)<<6|63&this.readUint8(t+o++)}}i<65536?n+=String.fromCharCode(i):(i-=65536,n+=String.fromCharCode(55296+(i>>10),56320+(1023&i)))}return n},c.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},c.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+c.SIZEOF_INT},c.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},c.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=c.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+c.FILE_IDENTIFIER_LENGTH);for(var e=0;e<c.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position_+c.SIZEOF_INT+e))return!1;return!0},c.ByteBuffer.prototype.createLong=function(t,e){return c.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"}(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"}(a||(a={}));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()+c.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):a.Byte}static start(t){t.startObject(2)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,a.Byte)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,r){return f.start(t),f.addName(t,e),f.addType(t,r),f.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()+c.SIZE_PREFIX_LENGTH),(e||new d).__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 r=this.bb.__offset(this.bb_pos,18);return r?(e||new d).__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,s.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,n,o,i,s,a,u){return d.start(t),d.addEnds(t,e),d.addXy(t,r),d.addZ(t,n),d.addM(t,o),d.addT(t,i),d.addTm(t,s),d.addType(t,a),d.addParts(t,u),d.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()+c.SIZE_PREFIX_LENGTH),(e||new b).__init(t.readInt32(t.position())+t.position(),t)}geometry(t){var e=this.bb.__offset(this.bb_pos,4);return e?(t||new d).__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 f).__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,n){return b.start(t),b.addGeometry(t,e),b.addProperties(t,r),b.addColumns(t,n),b.end(t)}}!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"}(u||(u={})),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"}(l||(l={}));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()+c.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):l.Byte}static start(t){t.startObject(2)}static addName(t,e){t.addFieldOffset(0,e,0)}static addType(t,e){t.addFieldInt8(1,e,l.Byte)}static end(t){var e=t.endObject();return t.requiredField(e,4),e}static create(t,e,r){return h.start(t),h.addName(t,e),h.addType(t,r),h.end(t)}}class _{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 _).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+c.SIZE_PREFIX_LENGTH),(e||new _).__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}static start(t){t.startObject(5)}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 end(t){return t.endObject()}static create(t,e,r,n,o,i){return _.start(t),_.addOrg(t,e),_.addCode(t,r),_.addName(t,n),_.addDescription(t,o),_.addWkt(t,i),_.end(t)}}class p{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 p).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRoot(t,e){return t.setPosition(t.position()+c.SIZE_PREFIX_LENGTH),(e||new p).__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):u.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 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,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 _).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static start(t){t.startObject(11)}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,u.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 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,n,o,i,s,a,u,l,c,f){return p.start(t),p.addName(t,e),p.addEnvelope(t,r),p.addGeometryType(t,n),p.addHasZ(t,o),p.addHasM(t,i),p.addHasT(t,s),p.addHasTM(t,a),p.addColumns(t,u),p.addFeaturesCount(t,l),p.addIndexNodeSize(t,c),p.addCrs(t,f),p.end(t)}}function y(t){return t.reduce((t,e)=>Array.isArray(e)?t.concat(y(e)):t.concat(e),[])}function v(t){const e=[];for(let r=0;r<t.length;r+=2)e.push([t[r],t[r+1]]);return e}function m(t){return u[t]}function g(t){const e=t.coordinates;let r=null,n=null,o=null,i=m(t.type),s=0;switch(t.type){case"Point":r=e;break;case"MultiPoint":case"LineString":r=y(e);break;case"MultiLineString":case"Polygon":const i=e;r=y(i),i.length>1&&(n=i.map(t=>s+=t.length));break;case"MultiPolygon":o=e.map(t=>({type:"Polygon",coordinates:t})).map(g);break;case"GeometryCollection":o=t.geometries.map(g)}return{xy:r,ends:n,type:i,parts:o}}function w(t,e){if(e==u.GeometryCollection){const r=[];for(let e=0;e<t.partsLength();e++){const n=t.parts(e),o=n.type();r.push(w(n,o))}return{type:u[e],geometries:r}}if(e==u.MultiPolygon){const r=[];for(let e=0;e<t.partsLength();e++){const n=t.parts(e);r.push(w(n,u.Polygon))}return{type:u[e],coordinates:r.map(t=>t.coordinates)}}const r=function(t,e){const r=t.xyArray();switch(e){case u.Point:return Array.from(r);case u.MultiPoint:case u.LineString:return v(r);case u.MultiLineString:case u.Polygon:return function(t,e){if(!e||0===e.length)return[v(t)];let r=0;return Array.from(e).map(e=>t.slice(r,r=e<<1)).map(t=>v(t))}(r,t.endsArray())}}(t,e);return{type:u[e],coordinates:r}}function S(t,e){const r=e.columns;let n;n=w(t.geometry(),e.geometryType);const i=function(t,e){if(!e||0===e.length)return;const r=t.propertiesArray(),n=new DataView(r.buffer,r.byteOffset),i=t.propertiesLength();let s=0;const a={};for(;s<i;){const t=n.getUint16(s,!0);s+=2;const i=e[t];switch(i.type){case o.Bool:a[i.name]=!!n.getUint8(s),s+=1;break;case o.Byte:a[i.name]=n.getInt8(s),s+=1;break;case o.UByte:a[i.name]=n.getUint8(s),s+=1;break;case o.Short:a[i.name]=n.getInt16(s,!0),s+=2;break;case o.UShort:a[i.name]=n.getUint16(s,!0),s+=2;break;case o.Int:a[i.name]=n.getInt32(s,!0),s+=4;break;case o.UInt:a[i.name]=n.getUint32(s,!0),s+=4;break;case o.Long:a[i.name]=Number(n.getBigInt64(s,!0)),s+=8;break;case o.ULong:a[i.name]=Number(n.getBigUint64(s,!0)),s+=8;break;case o.Double:a[i.name]=n.getFloat64(s,!0),s+=8;break;case o.DateTime:case o.String:{const t=n.getUint32(s,!0);s+=4;const e=new TextDecoder;a[i.name]=e.decode(r.subarray(s,s+t)),s+=t;break}default:throw new Error("Unknown type "+i.type)}}return a}(t,r),s={type:"Feature",geometry:n};return i&&(s.properties=i),s}function I(t){var e;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(e=t[Symbol.asyncIterator]))return e.call(t);if(Symbol.iterator&&null!=(e=t[Symbol.iterator]))return e.call(t)}throw new TypeError("Object is not async iterable")}function B(t){this.wrapped=t}function E(t){var e,r;function n(e,r){try{var i=t[e](r),s=i.value,a=s instanceof B;Promise.resolve(a?s.wrapped:s).then((function(t){a?n("return"===e?"return":"next",t):o(i.done?"return":"normal",t)}),(function(t){n("throw",t)}))}catch(t){o("throw",t)}}function o(t,o){switch(t){case"return":e.resolve({value:o,done:!0});break;case"throw":e.reject(o);break;default:e.resolve({value:o,done:!1})}(e=e.next)?n(e.key,e.arg):r=null}this._invoke=function(t,o){return new Promise((function(i,s){var a={key:t,arg:o,resolve:i,reject:s,next:null};r?r=r.next=a:(e=r=a,n(t,o))}))},"function"!=typeof t.return&&(this.return=void 0)}function T(t){return function(){return new E(t.apply(this,arguments))}}function R(t){return new B(t)}"function"==typeof Symbol&&Symbol.asyncIterator&&(E.prototype[Symbol.asyncIterator]=function(){return this}),E.prototype.next=function(t){return this._invoke("next",t)},E.prototype.throw=function(t){return this._invoke("throw",t)},E.prototype.return=function(t){return this._invoke("return",t)};var P=new Uint8Array(0);function F(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 O(t){this._source=t,this._array=P,this._index=0}function C(t,e){e=Math.min(Math.max(+e,2),65535);let r=t,n=r;do{r=Math.ceil(r/e),n+=r}while(1!==r);return 40*n}function A(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,n=r;const o=[r];do{r=Math.ceil(r/e),n+=r,o.push(r)}while(1!==r);const i=[];r=n;for(let t of o)i.push(r-t),r-=t;i.reverse(),o.reverse();const s=[];for(let t=0;t<o.length;t++)s.push([i[t],i[t]+o[t]]);return s.reverse(),s}function q(t,e,r,n){return L.apply(this,arguments)}function L(){return(L=T((function*(t,e,r,n){const{minX:o,minY:i,maxX:s,maxY:a}=r,u=A(t,e),[[l,c]]=u,f=[];for(f.push([0,u.length-1]);0!==f.length;){const[r,d]=f.pop(),b=r>=c-t,[,h]=u[d],_=Math.min(r+e,h),p=_-r,y=yield R(n(40*r,40*p)),v=new Float64Array(y),m=new Uint32Array(y);for(let t=r;t<_;t++){const e=5*(t-r);if(s<v[e+0])continue;if(a<v[e+1])continue;if(o>v[e+2])continue;if(i>v[e+3])continue;const n=m[8+(e<<1)];b?yield[n,t-l]:f.push([n,d-1])}f.sort((t,e)=>e[0]-t[0])}}))).apply(this,arguments)}O.prototype.read=function(){var t=this,e=t._array.subarray(t._index);return t._source.read().then((function(r){return t._array=P,t._index=0,r.done?e.length>0?{done:!1,value:e}:{done:!0,value:void 0}:{done:!1,value:F(e,r.value)}}))},O.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 n=new Uint8Array(t);return n.set(this._array.subarray(this._index)),function o(){return e._source.read().then((function(i){return i.done?(e._array=P,e._index=0,r>0?n.subarray(0,r):null):r+i.value.length>=t?(e._array=i.value,e._index=t-r,n.set(i.value.subarray(0,t-r),r),n):(n.set(i.value,r),r+=i.value.length,o())}))}()},O.prototype.cancel=function(){return this._source.cancel()};const j=new Uint8Array([102,103,98,3,102,103,98,0]);function k(t,e,r,n){return U.apply(this,arguments)}function U(){return(U=T((function*(t,e,n,o){let s=0,a=new Uint8Array(yield R(t(8)));if(s+=8,!a.every((t,e)=>j[e]===t))throw new Error("Not a FlatGeobuf file");a=new Uint8Array(yield R(t(4))),s+=4;let u=new c.ByteBuffer(a);const l=u.readUint32(0);a=new Uint8Array(yield R(t(l))),s+=l,u=new c.ByteBuffer(a);const f=p.getRoot(u),d=f.featuresCount().toFloat64(),b=[];for(let t=0;t<f.columnsLength();t++){const e=f.columns(t);b.push(new r(e.name(),e.type()))}const h=new i(f.geometryType(),b,d),_=f.indexNodeSize();if(_>0){const r=C(d,_);if(n){const i=async(r,n)=>(await e(s+r),await t(n)),a=[];var y,v=!0,m=!1;try{for(var g,w,S=I(q(d,_,n,i));v=(g=yield R(S.next())).done,w=yield R(g.value),!v;v=!0){let[t]=w;a.push(t)}}catch(t){m=!0,y=t}finally{try{v||null==S.return||(yield R(S.return()))}finally{if(m)throw y}}s+=r;var B,E=!0,T=!1;try{for(var P,F,O=I(a);E=(P=yield R(O.next())).done,F=yield R(P.value),!E;E=!0){let r=F;yield R(e(s+r)),yield z(t,h,o)}}catch(t){T=!0,B=t}finally{try{E||null==O.return||(yield R(O.return()))}finally{if(T)throw B}}return}e?yield R(e(s+r)):yield R(t(r)),s+=r}let A;for(;A=yield R(z(t,h,o));)yield A}))).apply(this,arguments)}async function z(t,e,r){let n=new Uint8Array(await t(4));if(0===n.byteLength)return null;let o=new c.ByteBuffer(n);const i=o.readUint32(0);n=new Uint8Array(await t(i));const s=new Uint8Array(i+4);return s.set(n,4),o=new c.ByteBuffer(s),o.setPosition(4),r(b.getRoot(o),e)}function N(t){const e=function(t){const e=t.features[0],n=e.properties;let s=null;n&&(s=Object.keys(n).map(t=>new r(t,function(t){if("boolean"==typeof t)return o.Bool;if("number"==typeof t)return t%1==0?o.Int:o.Double;if("string"==typeof t)return o.String;if(null===t)return o.String;throw new Error(`Unknown type (value '${t}')`)}(n[t]))));const a=new Set;for(const r of t.features)a.add(e.geometry.type);return new i(m(e.geometry.type),s,t.features.length)}(t),n=function(t){const e=new c.Builder(0);let r=null;t.columns&&(r=p.createColumnsVector(e,t.columns.map(t=>function(t,e){const r=t.createString(e.name);return h.start(t),h.addName(t,r),h.addType(t,e.type),h.end(t)}(e,t))));const n=e.createString("L1");p.start(e),p.addFeaturesCount(e,new c.Long(t.featuresCount,0)),p.addGeometryType(e,t.geometryType),p.addIndexNodeSize(e,0),r&&p.addColumns(e,r),p.addName(e,n);const o=p.end(e);return e.finishSizePrefixed(o),e.asUint8Array()}(e),s=t.features.map(t=>function(t,e){const r=e.columns,n=new c.Builder(0),i=new Uint8Array(1e5);let s=0;if(r){const e=new DataView(i.buffer);for(let n=0;n<r.length;n++){const a=r[n],u=t.properties[a.name];if(null!==u)switch(e.setUint16(s,n,!0),s+=2,a.type){case o.Bool:e.setUint8(s,u),s+=1;break;case o.Short:e.setInt16(s,u,!0),s+=2;break;case o.UShort:e.setUint16(s,u,!0),s+=2;break;case o.Int:e.setInt32(s,u,!0),s+=4;break;case o.UInt:e.setUint32(s,u,!0),s+=4;break;case o.Long:e.setBigInt64(s,BigInt(u),!0),s+=8;break;case o.Long:e.setBigUint64(s,BigInt(u),!0),s+=8;break;case o.Double:e.setFloat64(s,u,!0),s+=8;break;case o.String:const t=u,r=(new TextEncoder).encode(t);e.setUint32(s,r.length,!0),s+=4,i.set(r,s),s+=r.length;break;default:throw new Error("Unknown type")}}}let a=null;s>0&&(a=b.createPropertiesVector(n,i.slice(0,s)));const u=function t(e,r){const{xy:n,ends:o,parts:i,type:s}=r;if(i){const r=i.map(r=>t(e,r)),n=d.createPartsVector(e,r);return d.start(e),d.addParts(e,n),d.end(e)}const a=d.createXyVector(e,n);let u=null;return o&&(u=d.createEndsVector(e,o)),d.start(e),u&&d.addEnds(e,u),d.addXy(e,a),d.addType(e,s),d.end(e)}(n,g(t.geometry));b.start(n),b.addGeometry(n,u),a&&b.addProperties(n,a);const l=b.end(n);return n.finishSizePrefixed(l),n.asUint8Array()}(t,e)),a=s.map(t=>t.length).reduce((t,e)=>t+e),u=new Uint8Array(j.length+n.length+a);u.set(n,j.length);let l=j.length+n.length;for(const t of s)u.set(t,l),l+=t.length;return u.set(j),u}function x(t){return{type:"FeatureCollection",features:function(t,e){if(!t.subarray(0,7).every((t,e)=>j[e]===t))throw new Error("Not a FlatGeobuf file");const n=new c.ByteBuffer(t),o=n.readUint32(j.length);n.setPosition(j.length+4);const s=p.getRoot(n),a=s.featuresCount().toFloat64(),u=[];for(let t=0;t<s.columnsLength();t++){const e=s.columns(t);u.push(new r(e.name(),e.type()))}const l=new i(s.geometryType(),u,0);let f=j.length+4+o;const d=s.indexNodeSize();d>0&&(f+=C(a,d));const h=[];for(;f<n.capacity();){const t=n.readUint32(f);n.setPosition(f+4);const r=b.getRoot(n);h.push(e(r,l)),f+=4+t}return h}(t,(t,e)=>S(t,e))}}function W(t,e){return function(t,e,r){let n=0;return k(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,(t,e)=>S(t,e))}(t,e)}t.deserialize=function(t,r){return t instanceof Uint8Array?x(t):t instanceof e.ReadableStream?function(t,e){const r="function"==typeof(n=t).slice?n:new O("function"==typeof n.read?n:n.getReader());var n;return k(async t=>await r.slice(t),void 0,void 0,e)}(t,(t,e)=>S(t,e)):W(t,r)},t.serialize=function(t){return N(t)},Object.defineProperty(t,"__esModule",{value:!0})}(e,r(3))},function(t,e,r){(function(e){const n=r(4),o="undefined"==typeof window?e:window;o.loaders=o.loaders||{},t.exports=Object.assign(o.loaders,n)}).call(this,r(2))},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";r.r(e),r.d(e,"ByteLengthQueuingStrategy",(function(){return He})),r.d(e,"CountQueuingStrategy",(function(){return Ze})),r.d(e,"ReadableStream",(function(){return Ue})),r.d(e,"TransformStream",(function(){return Xe})),r.d(e,"WritableStream",(function(){return st}));var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:function(t){return"Symbol("+t+")"};function o(){}var i=Number.isNaN||function(t){return t!=t},s=o;function a(t){return"object"==typeof t&&null!==t||"function"==typeof t}function u(t){return t.slice()}function l(t){return!1!==function(t){if("number"!=typeof t)return!1;if(i(t))return!1;if(t<0)return!1;return!0}(t)&&t!==1/0}function c(t,e,r){if("function"!=typeof t)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(t,e,r)}function f(t,e,r,n){var o=t[e];if(void 0!==o){if("function"!=typeof o)throw new TypeError(o+" is not a method");switch(r){case 0:return function(){return b(o,t,n)};case 1:return function(e){var r=[e].concat(n);return b(o,t,r)}}}return function(){return w(void 0)}}function d(t,e,r){var n=t[e];if(void 0!==n)return c(n,t,r)}function b(t,e,r){try{return w(c(t,e,r))}catch(t){return S(t)}}function h(t){if(t=Number(t),i(t)||t<0)throw new RangeError("highWaterMark property of a queuing strategy must be non-negative and non-NaN");return t}function _(t){if(void 0===t)return function(){return 1};if("function"!=typeof t)throw new TypeError("size property of a queuing strategy must be a function");return function(e){return t(e)}}var p=Promise,y=Promise.prototype.then,v=Promise.resolve.bind(p),m=Promise.reject.bind(p);function g(t){return new p(t)}function w(t){return v(t)}function S(t){return m(t)}function I(t,e,r){return y.call(t,e,r)}function B(t,e,r){I(I(t,e,r),void 0,s)}function E(t,e){B(t,e)}function T(t,e){B(t,void 0,e)}function R(t,e,r){return I(t,e,r)}function P(t){I(t,void 0,s)}var F=function(){function t(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}return Object.defineProperty(t.prototype,"length",{get:function(){return this._size},enumerable:!0,configurable:!0}),t.prototype.push=function(t){var e=this._back,r=e;16383===e._elements.length&&(r={_elements:[],_next:void 0}),e._elements.push(t),r!==e&&(this._back=r,e._next=r),++this._size},t.prototype.shift=function(){var t=this._front,e=t,r=this._cursor,n=r+1,o=t._elements,i=o[r];return 16384===n&&(e=t._next,n=0),--this._size,this._cursor=n,t!==e&&(this._front=e),o[r]=void 0,i},t.prototype.forEach=function(t){for(var e=this._cursor,r=this._front,n=r._elements;!(e===n.length&&void 0===r._next||e===n.length&&(e=0,0===(n=(r=r._next)._elements).length));)t(n[e]),++e},t.prototype.peek=function(){var t=this._front,e=this._cursor;return t._elements[e]},t}();function O(t,e,r){var n=null;!0===r&&(n=Object.prototype);var o=Object.create(n);return o.value=t,o.done=e,o}function C(t,e){t._forAuthorCode=!0,t._ownerReadableStream=e,e._reader=t,"readable"===e._state?j(t):"closed"===e._state?function(t){j(t),z(t)}(t):k(t,e._storedError)}function A(t,e){return Ve(t._ownerReadableStream,e)}function q(t){"readable"===t._ownerReadableStream._state?U(t,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(t,e){k(t,e)}(t,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),t._ownerReadableStream._reader=void 0,t._ownerReadableStream=void 0}function L(t){return new TypeError("Cannot "+t+" a stream using a released reader")}function j(t){t._closedPromise=g((function(e,r){t._closedPromise_resolve=e,t._closedPromise_reject=r}))}function k(t,e){j(t),U(t,e)}function U(t,e){P(t._closedPromise),t._closedPromise_reject(e),t._closedPromise_resolve=void 0,t._closedPromise_reject=void 0}function z(t){t._closedPromise_resolve(void 0),t._closedPromise_resolve=void 0,t._closedPromise_reject=void 0}var N=n("[[CancelSteps]]"),x=n("[[PullSteps]]");function W(t,e){void 0===e&&(e=!1);var r=new X(t);return r._forAuthorCode=e,r}function V(t){return g((function(e,r){var n={_resolve:e,_reject:r};t._reader._readRequests.push(n)}))}function M(t,e,r){var n=t._reader;n._readRequests.shift()._resolve(O(e,r,n._forAuthorCode))}function D(t){return t._reader._readRequests.length}function G(t){var e=t._reader;return void 0!==e&&!!Y(e)}var H,Z,X=function(){function t(t){if(!1===xe(t))throw new TypeError("ReadableStreamDefaultReader can only be constructed with a ReadableStream instance");if(!0===We(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");C(this,t),this._readRequests=new F}return Object.defineProperty(t.prototype,"closed",{get:function(){return Y(this)?this._closedPromise:S($("closed"))},enumerable:!0,configurable:!0}),t.prototype.cancel=function(t){return Y(this)?void 0===this._ownerReadableStream?S(L("cancel")):A(this,t):S($("cancel"))},t.prototype.read=function(){return Y(this)?void 0===this._ownerReadableStream?S(L("read from")):J(this):S($("read"))},t.prototype.releaseLock=function(){if(!Y(this))throw $("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");q(this)}},t}();function Y(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_readRequests")}function J(t){var e=t._ownerReadableStream;return e._disturbed=!0,"closed"===e._state?w(O(void 0,!0,t._forAuthorCode)):"errored"===e._state?S(e._storedError):e._readableStreamController[x]()}function $(t){return new TypeError("ReadableStreamDefaultReader.prototype."+t+" can only be used on a ReadableStreamDefaultReader")}"symbol"==typeof n.asyncIterator&&((H={})[n.asyncIterator]=function(){return this},Z=H,Object.defineProperty(Z,n.asyncIterator,{enumerable:!1}));var Q={next:function(){if(!1===K(this))return S(tt("next"));var t=this._asyncIteratorReader;return void 0===t._ownerReadableStream?S(L("iterate")):R(J(t),(function(e){var r=e.done;return r&&q(t),O(e.value,r,!0)}))},return:function(t){if(!1===K(this))return S(tt("next"));var e=this._asyncIteratorReader;if(void 0===e._ownerReadableStream)return S(L("finish iterating"));if(e._readRequests.length>0)return S(new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled"));if(!1===this._preventCancel){var r=A(e,t);return q(e),R(r,(function(){return O(t,!0,!0)}))}return q(e),w(O(t,!0,!0))}};function K(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_asyncIteratorReader")}function tt(t){return new TypeError("ReadableStreamAsyncIterator."+t+" can only be used on a ReadableSteamAsyncIterator")}function et(t){var e=t._queue.shift();return t._queueTotalSize-=e.size,t._queueTotalSize<0&&(t._queueTotalSize=0),e.value}function rt(t,e,r){if(!l(r=Number(r)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");t._queue.push({value:e,size:r}),t._queueTotalSize+=r}function nt(t){t._queue=new F,t._queueTotalSize=0}void 0!==Z&&Object.setPrototypeOf(Q,Z),Object.defineProperty(Q,"next",{enumerable:!1}),Object.defineProperty(Q,"return",{enumerable:!1});var ot=n("[[AbortSteps]]"),it=n("[[ErrorSteps]]"),st=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e={}),ut(this);var r=e.size,n=e.highWaterMark;if(void 0!==t.type)throw new RangeError("Invalid type is specified");var o=_(r);void 0===n&&(n=1),function(t,e,r,n){var o=Object.create(Tt.prototype);var i=f(e,"write",1,[o]),s=f(e,"close",0,[]),a=f(e,"abort",1,[]);Rt(t,o,(function(){return d(e,"start",[o])}),i,s,a,r,n)}(this,t,n=h(n),o)}return Object.defineProperty(t.prototype,"locked",{get:function(){if(!1===lt(this))throw Lt("locked");return ct(this)},enumerable:!0,configurable:!0}),t.prototype.abort=function(t){return!1===lt(this)?S(Lt("abort")):!0===ct(this)?S(new TypeError("Cannot abort a stream that already has a writer")):ft(this,t)},t.prototype.close=function(){return!1===lt(this)?S(Lt("close")):!0===ct(this)?S(new TypeError("Cannot close a stream that already has a writer")):!0===pt(this)?S(new TypeError("Cannot close an already-closing stream")):dt(this)},t.prototype.getWriter=function(){if(!1===lt(this))throw Lt("getWriter");return at(this)},t}();function at(t){return new mt(t)}function ut(t){t._state="writable",t._storedError=void 0,t._writer=void 0,t._writableStreamController=void 0,t._writeRequests=new F,t._inFlightWriteRequest=void 0,t._closeRequest=void 0,t._inFlightCloseRequest=void 0,t._pendingAbortRequest=void 0,t._backpressure=!1}function lt(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_writableStreamController")}function ct(t){return void 0!==t._writer}function ft(t,e){var r=t._state;if("closed"===r||"errored"===r)return w(void 0);if(void 0!==t._pendingAbortRequest)return t._pendingAbortRequest._promise;var n=!1;"erroring"===r&&(n=!0,e=void 0);var o=g((function(r,o){t._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:o,_reason:e,_wasAlreadyErroring:n}}));return t._pendingAbortRequest._promise=o,!1===n&&ht(t,e),o}function dt(t){var e=t._state;if("closed"===e||"errored"===e)return S(new TypeError("The stream (in "+e+" state) is not in the writable state and cannot be closed"));var r,n=g((function(e,r){var n={_resolve:e,_reject:r};t._closeRequest=n})),o=t._writer;return void 0!==o&&!0===t._backpressure&&"writable"===e&&Gt(o),rt(r=t._writableStreamController,"close",0),Ot(r),n}function bt(t,e){"writable"!==t._state?_t(t):ht(t,e)}function ht(t,e){var r=t._writableStreamController;t._state="erroring",t._storedError=e;var n=t._writer;void 0!==n&&It(n,e),!1===function(t){if(void 0===t._inFlightWriteRequest&&void 0===t._inFlightCloseRequest)return!1;return!0}(t)&&!0===r._started&&_t(t)}function _t(t){t._state="errored",t._writableStreamController[it]();var e=t._storedError;if(t._writeRequests.forEach((function(t){t._reject(e)})),t._writeRequests=new F,void 0!==t._pendingAbortRequest){var r=t._pendingAbortRequest;if(t._pendingAbortRequest=void 0,!0===r._wasAlreadyErroring)return r._reject(e),void yt(t);B(t._writableStreamController[ot](r._reason),(function(){r._resolve(),yt(t)}),(function(e){r._reject(e),yt(t)}))}else yt(t)}function pt(t){return void 0!==t._closeRequest||void 0!==t._inFlightCloseRequest}function yt(t){void 0!==t._closeRequest&&(t._closeRequest._reject(t._storedError),t._closeRequest=void 0);var e=t._writer;void 0!==e&&Nt(e,t._storedError)}function vt(t,e){var r=t._writer;void 0!==r&&e!==t._backpressure&&(!0===e?function(t){Wt(t)}(r):Gt(r)),t._backpressure=e}var mt=function(){function t(t){if(!1===lt(t))throw new TypeError("WritableStreamDefaultWriter can only be constructed with a WritableStream instance");if(!0===ct(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;var e,r=t._state;if("writable"===r)!1===pt(t)&&!0===t._backpressure?Wt(this):Mt(this),Ut(this);else if("erroring"===r)Vt(this,t._storedError),Ut(this);else if("closed"===r)Mt(this),Ut(e=this),xt(e);else{var n=t._storedError;Vt(this,n),zt(this,n)}}return Object.defineProperty(t.prototype,"closed",{get:function(){return!1===gt(this)?S(jt("closed")):this._closedPromise},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===gt(this))throw jt("desiredSize");if(void 0===this._ownerWritableStream)throw kt("desiredSize");return function(t){var e=t._ownerWritableStream,r=e._state;if("errored"===r||"erroring"===r)return null;if("closed"===r)return 0;return Ft(e._writableStreamController)}(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){return!1===gt(this)?S(jt("ready")):this._readyPromise},enumerable:!0,configurable:!0}),t.prototype.abort=function(t){return!1===gt(this)?S(jt("abort")):void 0===this._ownerWritableStream?S(kt("abort")):function(t,e){return ft(t._ownerWritableStream,e)}(this,t)},t.prototype.close=function(){if(!1===gt(this))return S(jt("close"));var t=this._ownerWritableStream;return void 0===t?S(kt("close")):!0===pt(t)?S(new TypeError("Cannot close an already-closing stream")):wt(this)},t.prototype.releaseLock=function(){if(!1===gt(this))throw jt("releaseLock");void 0!==this._ownerWritableStream&&Bt(this)},t.prototype.write=function(t){return!1===gt(this)?S(jt("write")):void 0===this._ownerWritableStream?S(kt("write to")):Et(this,t)},t}();function gt(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_ownerWritableStream")}function wt(t){return dt(t._ownerWritableStream)}function St(t,e){"pending"===t._closedPromiseState?Nt(t,e):function(t,e){zt(t,e)}(t,e)}function It(t,e){"pending"===t._readyPromiseState?Dt(t,e):function(t,e){Vt(t,e)}(t,e)}function Bt(t){var e=t._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");It(t,r),St(t,r),e._writer=void 0,t._ownerWritableStream=void 0}function Et(t,e){var r=t._ownerWritableStream,n=r._writableStreamController,o=function(t,e){try{return t._strategySizeAlgorithm(e)}catch(e){return Ct(t,e),1}}(n,e);if(r!==t._ownerWritableStream)return S(kt("write to"));var i=r._state;if("errored"===i)return S(r._storedError);if(!0===pt(r)||"closed"===i)return S(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return S(r._storedError);var s=function(t){return g((function(e,r){var n={_resolve:e,_reject:r};t._writeRequests.push(n)}))}(r);return function(t,e,r){var n={chunk:e};try{rt(t,n,r)}catch(e){return void Ct(t,e)}var o=t._controlledWritableStream;if(!1===pt(o)&&"writable"===o._state){var i=At(t);vt(o,i)}Ot(t)}(n,e,o),s}var Tt=function(){function t(){throw new TypeError("WritableStreamDefaultController cannot be constructed explicitly")}return t.prototype.error=function(t){if(!1===function(t){if(!a(t))return!1;if(!Object.prototype.hasOwnProperty.call(t,"_controlledWritableStream"))return!1;return!0}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this._controlledWritableStream._state&&qt(this,t)},t.prototype[ot]=function(t){var e=this._abortAlgorithm(t);return Pt(this),e},t.prototype[it]=function(){nt(this)},t}();function Rt(t,e,r,n,o,i,s,a){e._controlledWritableStream=t,t._writableStreamController=e,e._queue=void 0,e._queueTotalSize=void 0,nt(e),e._started=!1,e._strategySizeAlgorithm=a,e._strategyHWM=s,e._writeAlgorithm=n,e._closeAlgorithm=o,e._abortAlgorithm=i;var u=At(e);vt(t,u),B(w(r()),(function(){e._started=!0,Ot(e)}),(function(r){e._started=!0,bt(t,r)}))}function Pt(t){t._writeAlgorithm=void 0,t._closeAlgorithm=void 0,t._abortAlgorithm=void 0,t._strategySizeAlgorithm=void 0}function Ft(t){return t._strategyHWM-t._queueTotalSize}function Ot(t){var e=t._controlledWritableStream;if(!1!==t._started&&void 0===e._inFlightWriteRequest)if("erroring"!==e._state){if(0!==t._queue.length){var r=t._queue.peek().value;"close"===r?function(t){var e=t._controlledWritableStream;(function(t){t._inFlightCloseRequest=t._closeRequest,t._closeRequest=void 0})(e),et(t);var r=t._closeAlgorithm();Pt(t),B(r,(function(){!function(t){t._inFlightCloseRequest._resolve(void 0),t._inFlightCloseRequest=void 0,"erroring"===t._state&&(t._storedError=void 0,void 0!==t._pendingAbortRequest&&(t._pendingAbortRequest._resolve(),t._pendingAbortRequest=void 0)),t._state="closed";var e=t._writer;void 0!==e&&xt(e)}(e)}),(function(t){!function(t,e){t._inFlightCloseRequest._reject(e),t._inFlightCloseRequest=void 0,void 0!==t._pendingAbortRequest&&(t._pendingAbortRequest._reject(e),t._pendingAbortRequest=void 0),bt(t,e)}(e,t)}))}(t):function(t,e){var r=t._controlledWritableStream;(function(t){t._inFlightWriteRequest=t._writeRequests.shift()})(r),B(t._writeAlgorithm(e),(function(){!function(t){t._inFlightWriteRequest._resolve(void 0),t._inFlightWriteRequest=void 0}(r);var e=r._state;if(et(t),!1===pt(r)&&"writable"===e){var n=At(t);vt(r,n)}Ot(t)}),(function(e){"writable"===r._state&&Pt(t),function(t,e){t._inFlightWriteRequest._reject(e),t._inFlightWriteRequest=void 0,bt(t,e)}(r,e)}))}(t,r.chunk)}}else _t(e)}function Ct(t,e){"writable"===t._controlledWritableStream._state&&qt(t,e)}function At(t){return Ft(t)<=0}function qt(t,e){var r=t._controlledWritableStream;Pt(t),ht(r,e)}function Lt(t){return new TypeError("WritableStream.prototype."+t+" can only be used on a WritableStream")}function jt(t){return new TypeError("WritableStreamDefaultWriter.prototype."+t+" can only be used on a WritableStreamDefaultWriter")}function kt(t){return new TypeError("Cannot "+t+" a stream using a released writer")}function Ut(t){t._closedPromise=g((function(e,r){t._closedPromise_resolve=e,t._closedPromise_reject=r,t._closedPromiseState="pending"}))}function zt(t,e){Ut(t),Nt(t,e)}function Nt(t,e){P(t._closedPromise),t._closedPromise_reject(e),t._closedPromise_resolve=void 0,t._closedPromise_reject=void 0,t._closedPromiseState="rejected"}function xt(t){t._closedPromise_resolve(void 0),t._closedPromise_resolve=void 0,t._closedPromise_reject=void 0,t._closedPromiseState="resolved"}function Wt(t){t._readyPromise=g((function(e,r){t._readyPromise_resolve=e,t._readyPromise_reject=r})),t._readyPromiseState="pending"}function Vt(t,e){Wt(t),Dt(t,e)}function Mt(t){Wt(t),Gt(t)}function Dt(t,e){P(t._readyPromise),t._readyPromise_reject(e),t._readyPromise_resolve=void 0,t._readyPromise_reject=void 0,t._readyPromiseState="rejected"}function Gt(t){t._readyPromise_resolve(void 0),t._readyPromise_resolve=void 0,t._readyPromise_reject=void 0,t._readyPromiseState="fulfilled"}function Ht(t){if("object"!=typeof t||null===t)return!1;try{return"boolean"==typeof t.aborted}catch(t){return!1}}var Zt="undefined"!=typeof DOMException?DOMException:void 0;var Xt,Yt=function(t){if("function"!=typeof t&&"object"!=typeof t)return!1;try{return new t,!0}catch(t){return!1}}(Zt)?Zt:((Xt=function(t,e){this.message=t||"",this.name=e||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}).prototype=Object.create(Error.prototype),Object.defineProperty(Xt.prototype,"constructor",{value:Xt,writable:!0,configurable:!0}),Xt);function Jt(t,e,r,n,i,s){var a=W(t),u=at(e);t._disturbed=!0;var l=!1,c=w(void 0);return g((function(f,d){var b,h,_,p;if(void 0!==s){if(b=function(){var r=new Yt("Aborted","AbortError"),o=[];!1===n&&o.push((function(){return"writable"===e._state?ft(e,r):w(void 0)})),!1===i&&o.push((function(){return"readable"===t._state?Ve(t,r):w(void 0)})),R((function(){return Promise.all(o.map((function(t){return t()})))}),!0,r)},!0===s.aborted)return void b();s.addEventListener("abort",b)}if(m(t,a._closedPromise,(function(t){!1===n?R((function(){return ft(e,t)}),!0,t):F(!0,t)})),m(e,u._closedPromise,(function(e){!1===i?R((function(){return Ve(t,e)}),!0,e):F(!0,e)})),h=t,_=a._closedPromise,p=function(){!1===r?R((function(){return function(t){var e=t._ownerWritableStream,r=e._state;return!0===pt(e)||"closed"===r?w(void 0):"errored"===r?S(e._storedError):wt(t)}(u)})):F()},"closed"===h._state?p():E(_,p),!0===pt(e)||"closed"===e._state){var y=new TypeError("the destination writable stream closed before all data could be piped to it");!1===i?R((function(){return Ve(t,y)}),!0,y):F(!0,y)}function v(){var t=c;return I(c,(function(){return t!==c?v():void 0}))}function m(t,e,r){"errored"===t._state?r(t._storedError):T(e,r)}function R(t,r,n){function o(){B(t(),(function(){return O(r,n)}),(function(t){return O(!0,t)}))}!0!==l&&(l=!0,"writable"===e._state&&!1===pt(e)?E(v(),o):o())}function F(t,r){!0!==l&&(l=!0,"writable"===e._state&&!1===pt(e)?E(v(),(function(){return O(t,r)})):O(t,r))}function O(t,e){Bt(u),q(a),void 0!==s&&s.removeEventListener("abort",b),t?d(e):f(void 0)}P(g((function(t,e){!function r(n){n?t():I(!0===l?w(!0):I(u._readyPromise,(function(){return I(J(a),(function(t){return!0===t.done||(c=I(Et(u,t.value),void 0,o),!1)}))})),r,e)}(!1)})))}))}var $t=function(){function t(){throw new TypeError}return Object.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===Qt(this))throw ue("desiredSize");return ie(this)},enumerable:!0,configurable:!0}),t.prototype.close=function(){if(!1===Qt(this))throw ue("close");if(!1===se(this))throw new TypeError("The stream is not in a state that permits close");re(this)},t.prototype.enqueue=function(t){if(!1===Qt(this))throw ue("enqueue");if(!1===se(this))throw new TypeError("The stream is not in a state that permits enqueue");return ne(this,t)},t.prototype.error=function(t){if(!1===Qt(this))throw ue("error");oe(this,t)},t.prototype[N]=function(t){nt(this);var e=this._cancelAlgorithm(t);return ee(this),e},t.prototype[x]=function(){var t=this._controlledReadableStream;if(this._queue.length>0){var e=et(this);return!0===this._closeRequested&&0===this._queue.length?(ee(this),Me(t)):Kt(this),w(O(e,!1,t._reader._forAuthorCode))}var r=V(t);return Kt(this),r},t}();function Qt(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledReadableStream")}function Kt(t){!1!==te(t)&&(!0!==t._pulling?(t._pulling=!0,B(t._pullAlgorithm(),(function(){t._pulling=!1,!0===t._pullAgain&&(t._pullAgain=!1,Kt(t))}),(function(e){oe(t,e)}))):t._pullAgain=!0)}function te(t){var e=t._controlledReadableStream;return!1!==se(t)&&(!1!==t._started&&(!0===We(e)&&D(e)>0||ie(t)>0))}function ee(t){t._pullAlgorithm=void 0,t._cancelAlgorithm=void 0,t._strategySizeAlgorithm=void 0}function re(t){var e=t._controlledReadableStream;t._closeRequested=!0,0===t._queue.length&&(ee(t),Me(e))}function ne(t,e){var r=t._controlledReadableStream;if(!0===We(r)&&D(r)>0)M(r,e,!1);else{var n=void 0;try{n=t._strategySizeAlgorithm(e)}catch(e){throw oe(t,e),e}try{rt(t,e,n)}catch(e){throw oe(t,e),e}}Kt(t)}function oe(t,e){var r=t._controlledReadableStream;"readable"===r._state&&(nt(t),ee(t),De(r,e))}function ie(t){var e=t._controlledReadableStream._state;return"errored"===e?null:"closed"===e?0:t._strategyHWM-t._queueTotalSize}function se(t){var e=t._controlledReadableStream._state;return!1===t._closeRequested&&"readable"===e}function ae(t,e,r,n,o,i,s){e._controlledReadableStream=t,e._queue=void 0,e._queueTotalSize=void 0,nt(e),e._started=!1,e._closeRequested=!1,e._pullAgain=!1,e._pulling=!1,e._strategySizeAlgorithm=s,e._strategyHWM=i,e._pullAlgorithm=n,e._cancelAlgorithm=o,t._readableStreamController=e,B(w(r()),(function(){e._started=!0,Kt(e)}),(function(t){oe(e,t)}))}function ue(t){return new TypeError("ReadableStreamDefaultController.prototype."+t+" can only be used on a ReadableStreamDefaultController")}var le=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},ce=function(){function t(){throw new TypeError("ReadableStreamBYOBRequest cannot be used directly")}return Object.defineProperty(t.prototype,"view",{get:function(){if(!1===be(this))throw Fe("view");return this._view},enumerable:!0,configurable:!0}),t.prototype.respond=function(t){if(!1===be(this))throw Fe("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(t,e){if(!1===l(e=Number(e)))throw new RangeError("bytesWritten must be a finite");Ie(t,e)}(this._associatedReadableByteStreamController,t)},t.prototype.respondWithNewView=function(t){if(!1===be(this))throw Fe("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");t.buffer,function(t,e){var r=t._pendingPullIntos.peek();if(r.byteOffset+r.bytesFilled!==e.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.byteLength!==e.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");r.buffer=e.buffer,Ie(t,e.byteLength)}(this._associatedReadableByteStreamController,t)},t}(),fe=function(){function t(){throw new TypeError("ReadableByteStreamController constructor cannot be used directly")}return Object.defineProperty(t.prototype,"byobRequest",{get:function(){if(!1===de(this))throw Oe("byobRequest");if(void 0===this._byobRequest&&this._pendingPullIntos.length>0){var t=this._pendingPullIntos.peek(),e=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),r=Object.create(ce.prototype);!function(t,e,r){t._associatedReadableByteStreamController=e,t._view=r}(r,this,e),this._byobRequest=r}return this._byobRequest},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===de(this))throw Oe("desiredSize");return Re(this)},enumerable:!0,configurable:!0}),t.prototype.close=function(){if(!1===de(this))throw Oe("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be closed");!function(t){var e=t._controlledReadableByteStream;if(t._queueTotalSize>0)return void(t._closeRequested=!0);if(t._pendingPullIntos.length>0){if(t._pendingPullIntos.peek().bytesFilled>0){var r=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Te(t,r),r}}Ee(t),Me(e)}(this)},t.prototype.enqueue=function(t){if(!1===de(this))throw Oe("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");var e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be enqueued to");if(!ArrayBuffer.isView(t))throw new TypeError("You can only enqueue array buffer views when using a ReadableByteStreamController");t.buffer,function(t,e){var r=t._controlledReadableByteStream,n=e.buffer,o=e.byteOffset,i=e.byteLength,s=n;if(!0===G(r))if(0===D(r))ye(t,s,o,i);else{var a=new Uint8Array(s,o,i);M(r,a,!1)}else!0===qe(r)?(ye(t,s,o,i),Se(t)):ye(t,s,o,i);he(t)}(this,t)},t.prototype.error=function(t){if(!1===de(this))throw Oe("error");Te(this,t)},t.prototype[N]=function(t){this._pendingPullIntos.length>0&&(this._pendingPullIntos.peek().bytesFilled=0);nt(this);var e=this._cancelAlgorithm(t);return Ee(this),e},t.prototype[x]=function(){var t=this._controlledReadableByteStream;if(this._queueTotalSize>0){var e=this._queue.shift();this._queueTotalSize-=e.byteLength,ge(this);var r=void 0;try{r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}catch(t){return S(t)}return w(O(r,!1,t._reader._forAuthorCode))}var n=this._autoAllocateChunkSize;if(void 0!==n){var o=void 0;try{o=new ArrayBuffer(n)}catch(t){return S(t)}var i={buffer:o,byteOffset:0,byteLength:n,bytesFilled:0,elementSize:1,ctor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(i)}var s=V(t);return he(this),s},t}();function de(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledReadableByteStream")}function be(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_associatedReadableByteStreamController")}function he(t){!1!==function(t){var e=t._controlledReadableByteStream;if("readable"!==e._state)return!1;if(!0===t._closeRequested)return!1;if(!1===t._started)return!1;if(!0===G(e)&&D(e)>0)return!0;if(!0===qe(e)&&Ae(e)>0)return!0;if(Re(t)>0)return!0;return!1}(t)&&(!0!==t._pulling?(t._pulling=!0,B(t._pullAlgorithm(),(function(){t._pulling=!1,!0===t._pullAgain&&(t._pullAgain=!1,he(t))}),(function(e){Te(t,e)}))):t._pullAgain=!0)}function _e(t,e){var r=!1;"closed"===t._state&&(r=!0);var n=pe(e);"default"===e.readerType?M(t,n,r):function(t,e,r){var n=t._reader;n._readIntoRequests.shift()._resolve(O(e,r,n._forAuthorCode))}(t,n,r)}function pe(t){var e=t.bytesFilled,r=t.elementSize;return new t.ctor(t.buffer,t.byteOffset,e/r)}function ye(t,e,r,n){t._queue.push({buffer:e,byteOffset:r,byteLength:n}),t._queueTotalSize+=n}function ve(t,e){var r=e.elementSize,n=e.bytesFilled-e.bytesFilled%r,o=Math.min(t._queueTotalSize,e.byteLength-e.bytesFilled),i=e.bytesFilled+o,s=i-i%r,a=o,u=!1;s>n&&(a=s-e.bytesFilled,u=!0);for(var l,c,f,d,b,h=t._queue;a>0;){var _=h.peek(),p=Math.min(a,_.byteLength),y=e.byteOffset+e.bytesFilled;l=e.buffer,c=y,f=_.buffer,d=_.byteOffset,b=p,new Uint8Array(l).set(new Uint8Array(f,d,b),c),_.byteLength===p?h.shift():(_.byteOffset+=p,_.byteLength-=p),t._queueTotalSize-=p,me(t,p,e),a-=p}return u}function me(t,e,r){we(t),r.bytesFilled+=e}function ge(t){0===t._queueTotalSize&&!0===t._closeRequested?(Ee(t),Me(t._controlledReadableByteStream)):he(t)}function we(t){void 0!==t._byobRequest&&(t._byobRequest._associatedReadableByteStreamController=void 0,t._byobRequest._view=void 0,t._byobRequest=void 0)}function Se(t){for(;t._pendingPullIntos.length>0;){if(0===t._queueTotalSize)return;var e=t._pendingPullIntos.peek();!0===ve(t,e)&&(Be(t),_e(t._controlledReadableByteStream,e))}}function Ie(t,e){var r=t._pendingPullIntos.peek();if("closed"===t._controlledReadableByteStream._state){if(0!==e)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(t,e){e.buffer=e.buffer;var r=t._controlledReadableByteStream;if(!0===qe(r))for(;Ae(r)>0;){_e(r,Be(t))}}(t,r)}else!function(t,e,r){if(r.bytesFilled+e>r.byteLength)throw new RangeError("bytesWritten out of range");if(me(t,e,r),!(r.bytesFilled<r.elementSize)){Be(t);var n=r.bytesFilled%r.elementSize;if(n>0){var o=r.byteOffset+r.bytesFilled,i=r.buffer.slice(o-n,o);ye(t,i,0,i.byteLength)}r.buffer=r.buffer,r.bytesFilled-=n,_e(t._controlledReadableByteStream,r),Se(t)}}(t,e,r);he(t)}function Be(t){var e=t._pendingPullIntos.shift();return we(t),e}function Ee(t){t._pullAlgorithm=void 0,t._cancelAlgorithm=void 0}function Te(t,e){var r=t._controlledReadableByteStream;"readable"===r._state&&(!function(t){we(t),t._pendingPullIntos=new F}(t),nt(t),Ee(t),De(r,e))}function Re(t){var e=t._controlledReadableByteStream._state;return"errored"===e?null:"closed"===e?0:t._strategyHWM-t._queueTotalSize}function Pe(t,e,r){var n=Object.create(fe.prototype);var o=f(e,"pull",0,[n]),i=f(e,"cancel",1,[]),s=e.autoAllocateChunkSize;if(void 0!==s&&(s=Number(s),!1===le(s)||s<=0))throw new RangeError("autoAllocateChunkSize must be a positive integer");!function(t,e,r,n,o,i,s){e._controlledReadableByteStream=t,e._pullAgain=!1,e._pulling=!1,e._byobRequest=void 0,e._queue=e._queueTotalSize=void 0,nt(e),e._closeRequested=!1,e._started=!1,e._strategyHWM=h(i),e._pullAlgorithm=n,e._cancelAlgorithm=o,e._autoAllocateChunkSize=s,e._pendingPullIntos=new F,t._readableStreamController=e,B(w(r()),(function(){e._started=!0,he(e)}),(function(t){Te(e,t)}))}(t,n,(function(){return d(e,"start",[n])}),o,i,r,s)}function Fe(t){return new TypeError("ReadableStreamBYOBRequest.prototype."+t+" can only be used on a ReadableStreamBYOBRequest")}function Oe(t){return new TypeError("ReadableByteStreamController.prototype."+t+" can only be used on a ReadableByteStreamController")}function Ce(t){return g((function(e,r){var n={_resolve:e,_reject:r};t._reader._readIntoRequests.push(n)}))}function Ae(t){return t._reader._readIntoRequests.length}function qe(t){var e=t._reader;return void 0!==e&&!!je(e)}var Le=function(){function t(t){if(!xe(t))throw new TypeError("ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a byte source");if(!1===de(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");if(We(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");C(this,t),this._readIntoRequests=new F}return Object.defineProperty(t.prototype,"closed",{get:function(){return je(this)?this._closedPromise:S(ke("closed"))},enumerable:!0,configurable:!0}),t.prototype.cancel=function(t){return je(this)?void 0===this._ownerReadableStream?S(L("cancel")):A(this,t):S(ke("cancel"))},t.prototype.read=function(t){return je(this)?void 0===this._ownerReadableStream?S(L("read from")):ArrayBuffer.isView(t)?(t.buffer,0===t.byteLength?S(new TypeError("view must have non-zero byteLength")):function(t,e){var r=t._ownerReadableStream;if(r._disturbed=!0,"errored"===r._state)return S(r._storedError);return function(t,e){var r=t._controlledReadableByteStream,n=1;e.constructor!==DataView&&(n=e.constructor.BYTES_PER_ELEMENT);var o=e.constructor,i={buffer:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength,bytesFilled:0,elementSize:n,ctor:o,readerType:"byob"};if(t._pendingPullIntos.length>0)return t._pendingPullIntos.push(i),Ce(r);if("closed"===r._state)return w(O(new o(i.buffer,i.byteOffset,0),!0,r._reader._forAuthorCode));if(t._queueTotalSize>0){if(!0===ve(t,i)){var s=pe(i);return ge(t),w(O(s,!1,r._reader._forAuthorCode))}if(!0===t._closeRequested){var a=new TypeError("Insufficient bytes to fill elements in the given buffer");return Te(t,a),S(a)}}t._pendingPullIntos.push(i);var u=Ce(r);return he(t),u}(r._readableStreamController,e)}(this,t)):S(new TypeError("view must be an array buffer view")):S(ke("read"))},t.prototype.releaseLock=function(){if(!je(this))throw ke("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");q(this)}},t}();function je(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_readIntoRequests")}function ke(t){return new TypeError("ReadableStreamBYOBReader.prototype."+t+" can only be used on a ReadableStreamBYOBReader")}var Ue=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e={}),Ne(this);var r=e.size,n=e.highWaterMark,o=t.type;if("bytes"===String(o)){if(void 0!==r)throw new RangeError("The strategy for a byte stream cannot have a size function");void 0===n&&(n=0),Pe(this,t,n=h(n))}else{if(void 0!==o)throw new RangeError("Invalid type is specified");var i=_(r);void 0===n&&(n=1),function(t,e,r,n){var o=Object.create($t.prototype),i=f(e,"pull",0,[o]),s=f(e,"cancel",1,[]);ae(t,o,(function(){return d(e,"start",[o])}),i,s,r,n)}(this,t,n=h(n),i)}}return Object.defineProperty(t.prototype,"locked",{get:function(){if(!1===xe(this))throw Ge("locked");return We(this)},enumerable:!0,configurable:!0}),t.prototype.cancel=function(t){return!1===xe(this)?S(Ge("cancel")):!0===We(this)?S(new TypeError("Cannot cancel a stream that already has a reader")):Ve(this,t)},t.prototype.getReader=function(t){var e=(void 0===t?{}:t).mode;if(!1===xe(this))throw Ge("getReader");if(void 0===e)return W(this,!0);if("byob"===(e=String(e)))return function(t,e){void 0===e&&(e=!1);var r=new Le(t);return r._forAuthorCode=e,r}(this,!0);throw new RangeError("Invalid mode is specified")},t.prototype.pipeThrough=function(t,e){var r=t.writable,n=t.readable,o=void 0===e?{}:e,i=o.preventClose,s=o.preventAbort,a=o.preventCancel,u=o.signal;if(!1===xe(this))throw Ge("pipeThrough");if(!1===lt(r))throw new TypeError("writable argument to pipeThrough must be a WritableStream");if(!1===xe(n))throw new TypeError("readable argument to pipeThrough must be a ReadableStream");if(i=Boolean(i),s=Boolean(s),a=Boolean(a),void 0!==u&&!Ht(u))throw new TypeError("ReadableStream.prototype.pipeThrough's signal option must be an AbortSignal");if(!0===We(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(!0===ct(r))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return P(Jt(this,r,i,s,a,u)),n},t.prototype.pipeTo=function(t,e){var r=void 0===e?{}:e,n=r.preventClose,o=r.preventAbort,i=r.preventCancel,s=r.signal;return!1===xe(this)?S(Ge("pipeTo")):!1===lt(t)?S(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream")):(n=Boolean(n),o=Boolean(o),i=Boolean(i),void 0===s||Ht(s)?!0===We(this)?S(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):!0===ct(t)?S(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Jt(this,t,n,o,i,s):S(new TypeError("ReadableStream.prototype.pipeTo's signal option must be an AbortSignal")))},t.prototype.tee=function(){if(!1===xe(this))throw Ge("tee");var t=function(t,e){var r,n,o,i,s,a=W(t),l=!1,c=!1,f=!1,d=g((function(t){s=t}));function b(){return!0===l||(l=!0,P(R(J(a),(function(t){if(l=!1,!0===t.done)return!1===c&&re(o._readableStreamController),void(!1===f&&re(i._readableStreamController));var e=t.value,r=e,n=e;!1===c&&ne(o._readableStreamController,r),!1===f&&ne(i._readableStreamController,n)})))),w(void 0)}function h(){}return o=ze(h,b,(function(e){if(c=!0,r=e,!0===f){var o=u([r,n]),i=Ve(t,o);s(i)}return d})),i=ze(h,b,(function(e){if(f=!0,n=e,!0===c){var o=u([r,n]),i=Ve(t,o);s(i)}return d})),T(a._closedPromise,(function(t){oe(o._readableStreamController,t),oe(i._readableStreamController,t)})),[o,i]}(this);return u(t)},t.prototype.getIterator=function(t){var e=(void 0===t?{}:t).preventCancel,r=void 0!==e&&e;if(!1===xe(this))throw Ge("getIterator");return function(t,e){void 0===e&&(e=!1);var r=W(t),n=Object.create(Q);return n._asyncIteratorReader=r,n._preventCancel=Boolean(e),n}(this,r)},t}();function ze(t,e,r,n,o){void 0===n&&(n=1),void 0===o&&(o=function(){return 1});var i=Object.create(Ue.prototype);return Ne(i),ae(i,Object.create($t.prototype),t,e,r,n,o),i}function Ne(t){t._state="readable",t._reader=void 0,t._storedError=void 0,t._disturbed=!1}function xe(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_readableStreamController")}function We(t){return void 0!==t._reader}function Ve(t,e){return t._disturbed=!0,"closed"===t._state?w(void 0):"errored"===t._state?S(t._storedError):(Me(t),R(t._readableStreamController[N](e),o))}function Me(t){t._state="closed";var e=t._reader;void 0!==e&&(Y(e)&&(e._readRequests.forEach((function(t){t._resolve(O(void 0,!0,e._forAuthorCode))})),e._readRequests=new F),z(e))}function De(t,e){t._state="errored",t._storedError=e;var r=t._reader;void 0!==r&&(Y(r)?(r._readRequests.forEach((function(t){t._reject(e)})),r._readRequests=new F):(r._readIntoRequests.forEach((function(t){t._reject(e)})),r._readIntoRequests=new F),U(r,e))}function Ge(t){return new TypeError("ReadableStream.prototype."+t+" can only be used on a ReadableStream")}"symbol"==typeof n.asyncIterator&&Object.defineProperty(Ue.prototype,n.asyncIterator,{value:Ue.prototype.getIterator,enumerable:!1,writable:!0,configurable:!0});var He=function(){function t(t){var e=t.highWaterMark;this.highWaterMark=e}return t.prototype.size=function(t){return t.byteLength},t}(),Ze=function(){function t(t){var e=t.highWaterMark;this.highWaterMark=e}return t.prototype.size=function(){return 1},t}(),Xe=function(){function t(t,e,r){void 0===t&&(t={}),void 0===e&&(e={}),void 0===r&&(r={});var n=e.size,o=e.highWaterMark,i=r.size,s=r.highWaterMark;if(void 0!==t.writableType)throw new RangeError("Invalid writable type specified");var a=_(n);if(void 0===o&&(o=1),o=h(o),void 0!==t.readableType)throw new RangeError("Invalid readable type specified");var u,l=_(i);void 0===s&&(s=0),s=h(s),function(t,e,r,n,o,i){function s(){return e}t._writable=function(t,e,r,n,o,i){void 0===o&&(o=1),void 0===i&&(i=function(){return 1});var s=Object.create(st.prototype);return ut(s),Rt(s,Object.create(Tt.prototype),t,e,r,n,o,i),s}(s,(function(e){return function(t,e){var r=t._transformStreamController;if(!0===t._backpressure){return R(t._backpressureChangePromise,(function(){var n=t._writable;if("erroring"===n._state)throw n._storedError;return nr(r,e)}))}return nr(r,e)}(t,e)}),(function(){return function(t){var e=t._readable,r=t._transformStreamController,n=r._flushAlgorithm();return er(r),R(n,(function(){if("errored"===e._state)throw e._storedError;var t=e._readableStreamController;!0===se(t)&&re(t)}),(function(r){throw Je(t,r),e._storedError}))}(t)}),(function(e){return function(t,e){return Je(t,e),w(void 0)}(t,e)}),r,n),t._readable=ze(s,(function(){return function(t){return Qe(t,!1),t._backpressureChangePromise}(t)}),(function(e){return $e(t,e),w(void 0)}),o,i),t._backpressure=void 0,t._backpressureChangePromise=void 0,t._backpressureChangePromise_resolve=void 0,Qe(t,!0),t._transformStreamController=void 0}(this,g((function(t){u=t})),o,a,s,l),function(t,e){var r=Object.create(Ke.prototype),n=function(t){try{return rr(r,t),w(void 0)}catch(t){return S(t)}},o=e.transform;if(void 0!==o){if("function"!=typeof o)throw new TypeError("transform is not a method");n=function(t){return b(o,e,[t,r])}}var i=f(e,"flush",0,[r]);!function(t,e,r,n){e._controlledTransformStream=t,t._transformStreamController=e,e._transformAlgorithm=r,e._flushAlgorithm=n}(t,r,n,i)}(this,t);var c=d(t,"start",[this._transformStreamController]);u(c)}return Object.defineProperty(t.prototype,"readable",{get:function(){if(!1===Ye(this))throw ir("readable");return this._readable},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"writable",{get:function(){if(!1===Ye(this))throw ir("writable");return this._writable},enumerable:!0,configurable:!0}),t}();function Ye(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_transformStreamController")}function Je(t,e){oe(t._readable._readableStreamController,e),$e(t,e)}function $e(t,e){er(t._transformStreamController),Ct(t._writable._writableStreamController,e),!0===t._backpressure&&Qe(t,!1)}function Qe(t,e){void 0!==t._backpressureChangePromise&&t._backpressureChangePromise_resolve(),t._backpressureChangePromise=g((function(e){t._backpressureChangePromise_resolve=e})),t._backpressure=e}var Ke=function(){function t(){throw new TypeError("TransformStreamDefaultController instances cannot be created directly")}return Object.defineProperty(t.prototype,"desiredSize",{get:function(){if(!1===tr(this))throw or("desiredSize");return ie(this._controlledTransformStream._readable._readableStreamController)},enumerable:!0,configurable:!0}),t.prototype.enqueue=function(t){if(!1===tr(this))throw or("enqueue");rr(this,t)},t.prototype.error=function(t){if(!1===tr(this))throw or("error");var e;e=t,Je(this._controlledTransformStream,e)},t.prototype.terminate=function(){if(!1===tr(this))throw or("terminate");!function(t){var e=t._controlledTransformStream,r=e._readable._readableStreamController;!0===se(r)&&re(r);var n=new TypeError("TransformStream terminated");$e(e,n)}(this)},t}();function tr(t){return!!a(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledTransformStream")}function er(t){t._transformAlgorithm=void 0,t._flushAlgorithm=void 0}function rr(t,e){var r=t._controlledTransformStream,n=r._readable._readableStreamController;if(!1===se(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{ne(n,e)}catch(t){throw $e(r,t),r._readable._storedError}(function(t){return!0!==te(t)})(n)!==r._backpressure&&Qe(r,!0)}function nr(t,e){return R(t._transformAlgorithm(e),void 0,(function(e){throw Je(t._controlledTransformStream,e),e}))}function or(t){return new TypeError("TransformStreamDefaultController.prototype."+t+" can only be used on a TransformStreamDefaultController")}function ir(t){return new TypeError("TransformStream.prototype."+t+" can only be used on a TransformStream")}},function(t,e,r){"use strict";r.r(e),r.d(e,"FlatGeobufWorkerLoader",(function(){return n})),r.d(e,"FlatGeobufLoader",(function(){return s})),r.d(e,"_typecheckFlatGeobufLoader",(function(){return a}));const n={id:"flatgeobuf",name:"FlatGeobuf",module:"flatgeobuf",version:"3.0.14",worker:!0,extensions:["fgb"],mimeTypes:["application/octet-stream"],category:"geometry",options:{flatgeobuf:{}}};var o=r(0);function i(t,e){if(0===t.byteLength)return[];const r=new Uint8Array(t),{features:n}=Object(o.deserialize)(r);return n}const s={...n,parse:async(t,e)=>i(t),parseSync:i,parseInBatchesFromStream:function(t,e){return Object(o.deserializeStream)(t)},binary:!0},a=s}])}));
2
2
  //# sourceMappingURL=dist.min.js.map