@loaders.gl/mvt 4.3.0-alpha.1 → 4.3.0-alpha.2
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.dev.js +568 -175
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +226 -163
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/parse-mvt.d.ts +1 -1
- package/dist/lib/parse-mvt.js +2 -30
- package/dist/lib/parse-tilejson.d.ts +4 -4
- package/dist/lib/parse-tilejson.d.ts.map +1 -1
- package/dist/lib/utils/geometry-utils.d.ts +38 -1
- package/dist/lib/utils/geometry-utils.d.ts.map +1 -1
- package/dist/lib/utils/geometry-utils.js +65 -6
- package/dist/lib/vector-tile/vector-tile-feature.d.ts +28 -9
- package/dist/lib/vector-tile/vector-tile-feature.d.ts.map +1 -1
- package/dist/lib/vector-tile/vector-tile-feature.js +47 -50
- package/dist/lib/{geojsonvt → vector-tiler}/clip.d.ts +3 -3
- package/dist/lib/vector-tiler/clip.d.ts.map +1 -0
- package/dist/lib/vector-tiler/convert.d.ts +18 -0
- package/dist/lib/vector-tiler/convert.d.ts.map +1 -0
- package/dist/lib/{geojsonvt → vector-tiler}/convert.js +8 -1
- package/dist/lib/vector-tiler/feature.d.ts +3 -0
- package/dist/lib/vector-tiler/feature.d.ts.map +1 -0
- package/dist/lib/vector-tiler/simplify.d.ts.map +1 -0
- package/dist/lib/{geojsonvt → vector-tiler}/tile.d.ts +4 -4
- package/dist/lib/vector-tiler/tile.d.ts.map +1 -0
- package/dist/lib/vector-tiler/transform.d.ts +7 -0
- package/dist/lib/vector-tiler/transform.d.ts.map +1 -0
- package/dist/lib/{geojsonvt → vector-tiler}/wrap.d.ts +2 -2
- package/dist/lib/vector-tiler/wrap.d.ts.map +1 -0
- package/dist/mvt-loader.d.ts +1 -1
- package/dist/mvt-loader.js +1 -1
- package/dist/mvt-source.d.ts +4 -4
- package/dist/mvt-source.d.ts.map +1 -1
- package/dist/mvt-source.js +4 -4
- package/dist/mvt-worker.js +101 -56
- package/dist/table-tile-source.d.ts +118 -0
- package/dist/table-tile-source.d.ts.map +1 -0
- package/dist/{geojson-tile-source.js → table-tile-source.js} +154 -103
- package/dist/tilejson-loader.js +1 -1
- package/package.json +7 -6
- package/src/index.ts +3 -3
- package/src/lib/parse-mvt.ts +4 -33
- package/src/lib/parse-tilejson.ts +5 -5
- package/src/lib/utils/geometry-utils.ts +66 -1
- package/src/lib/vector-tile/vector-tile-feature.ts +65 -56
- package/src/lib/{geojsonvt → vector-tiler}/clip.ts +4 -4
- package/src/lib/{geojsonvt → vector-tiler}/convert.ts +18 -8
- package/src/lib/{geojsonvt → vector-tiler}/feature.ts +3 -3
- package/src/lib/{geojsonvt → vector-tiler}/tile.ts +8 -8
- package/src/lib/{geojsonvt → vector-tiler}/transform.ts +2 -2
- package/src/lib/{geojsonvt → vector-tiler}/wrap.ts +5 -5
- package/src/mvt-source.ts +6 -7
- package/src/table-tile-source.ts +508 -0
- package/dist/geojson-tile-source.d.ts +0 -79
- package/dist/geojson-tile-source.d.ts.map +0 -1
- package/dist/lib/geojsonvt/clip.d.ts.map +0 -1
- package/dist/lib/geojsonvt/convert.d.ts +0 -10
- package/dist/lib/geojsonvt/convert.d.ts.map +0 -1
- package/dist/lib/geojsonvt/feature.d.ts +0 -3
- package/dist/lib/geojsonvt/feature.d.ts.map +0 -1
- package/dist/lib/geojsonvt/simplify.d.ts.map +0 -1
- package/dist/lib/geojsonvt/tile.d.ts.map +0 -1
- package/dist/lib/geojsonvt/transform.d.ts +0 -7
- package/dist/lib/geojsonvt/transform.d.ts.map +0 -1
- package/dist/lib/geojsonvt/wrap.d.ts.map +0 -1
- package/src/geojson-tile-source.ts +0 -422
- /package/dist/lib/{geojsonvt → vector-tiler}/clip.js +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/feature.js +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/simplify.d.ts +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/simplify.js +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/tile.js +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/transform.js +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/wrap.js +0 -0
- /package/src/lib/{geojsonvt → vector-tiler}/LICENSE +0 -0
- /package/src/lib/{geojsonvt → vector-tiler}/simplify.ts +0 -0
package/dist/dist.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
6
|
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var wn=Object.create;var Q=Object.defineProperty;var Pn=Object.getOwnPropertyDescriptor;var Tn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,Fn=Object.prototype.hasOwnProperty;var vn=(e,t,n)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Sn=(e,t)=>{for(var n in t)Q(e,n,{get:t[n],enumerable:!0})},ue=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Tn(t))!Fn.call(e,r)&&r!==n&&Q(e,r,{get:()=>t[r],enumerable:!(o=Pn(t,r))||o.enumerable});return e},he=(e,t,n)=>(ue(e,t,"default"),n&&ue(n,t,"default")),ut=(e,t,n)=>(n=e!=null?wn(In(e)):{},ue(t||!e||!e.__esModule?Q(n,"default",{value:e,enumerable:!0}):n,e)),bn=e=>ue(Q({},"__esModule",{value:!0}),e);var pe=(e,t,n)=>(vn(e,typeof t!="symbol"?t+"":t,n),n);var pt=Ae((Zr,ht)=>{ht.exports=globalThis.loaders});var At=Ae(He=>{He.read=function(e,t,n,o,r){var i,s,a=r*8-o-1,l=(1<<a)-1,f=l>>1,c=-7,u=n?r-1:0,p=n?-1:1,h=e[t+u];for(u+=p,i=h&(1<<-c)-1,h>>=-c,c+=a;c>0;i=i*256+e[t+u],u+=p,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=o;c>0;s=s*256+e[t+u],u+=p,c-=8);if(i===0)i=1-f;else{if(i===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,o),i=i-f}return(h?-1:1)*s*Math.pow(2,i-o)};He.write=function(e,t,n,o,r,i){var s,a,l,f=i*8-r-1,c=(1<<f)-1,u=c>>1,p=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=o?0:i-1,d=o?1:-1,x=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=p/l:t+=p*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=c?(a=0,s=c):s+u>=1?(a=(t*l-1)*Math.pow(2,r),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,r),s=0));r>=8;e[n+h]=a&255,h+=d,a/=256,r-=8);for(s=s<<r|a,f+=r;f>0;e[n+h]=s&255,h+=d,s/=256,f-=8);e[n+h-d]|=x*128}});var kt=Ae((Cs,Ct)=>{"use strict";Ct.exports=y;var Te=At();function y(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}y.Varint=0;y.Fixed64=1;y.Bytes=2;y.Fixed32=5;var Je=(1<<16)*(1<<16),Lt=1/Je,To=12,Dt=typeof TextDecoder>"u"?null:new TextDecoder("utf8");y.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var o=this.readVarint(),r=o>>3,i=this.pos;this.type=o&7,e(r,t,this),this.pos===i&&this.skip(o)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ie(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Nt(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ie(this.buf,this.pos)+Ie(this.buf,this.pos+4)*Je;return this.pos+=8,e},readSFixed64:function(){var e=Ie(this.buf,this.pos)+Nt(this.buf,this.pos+4)*Je;return this.pos+=8,e},readFloat:function(){var e=Te.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Te.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,o;return o=t[this.pos++],n=o&127,o<128||(o=t[this.pos++],n|=(o&127)<<7,o<128)||(o=t[this.pos++],n|=(o&127)<<14,o<128)||(o=t[this.pos++],n|=(o&127)<<21,o<128)?n:(o=t[this.pos],n|=(o&15)<<28,Io(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=To&&Dt?Co(this.buf,t,e):Do(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==y.Bytes)return e.push(this.readVarint(t));var n=N(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==y.Bytes)return e.push(this.readSVarint());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==y.Bytes)return e.push(this.readBoolean());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==y.Bytes)return e.push(this.readFloat());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==y.Bytes)return e.push(this.readDouble());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==y.Bytes)return e.push(this.readFixed32());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==y.Bytes)return e.push(this.readSFixed32());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==y.Bytes)return e.push(this.readFixed64());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==y.Bytes)return e.push(this.readSFixed64());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===y.Varint)for(;this.buf[this.pos++]>127;);else if(t===y.Bytes)this.pos=this.readVarint()+this.pos;else if(t===y.Fixed32)this.pos+=4;else if(t===y.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),X(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),X(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),X(this.buf,e&-1,this.pos),X(this.buf,Math.floor(e*Lt),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),X(this.buf,e&-1,this.pos),X(this.buf,Math.floor(e*Lt),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Fo(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=ko(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Vt(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Te.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Te.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var o=this.pos-n;o>=128&&Vt(n,o,this),this.pos=n-1,this.writeVarint(o),this.pos+=o},writeMessage:function(e,t,n){this.writeTag(e,y.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,bo,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,_o,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Mo,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Bo,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Eo,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Ao,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Lo,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Vo,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,No,t)},writeBytesField:function(e,t){this.writeTag(e,y.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,y.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,y.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,y.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,y.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,y.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,y.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,y.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,y.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,y.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function Io(e,t,n){var o=n.buf,r,i;if(i=o[n.pos++],r=(i&112)>>4,i<128||(i=o[n.pos++],r|=(i&127)<<3,i<128)||(i=o[n.pos++],r|=(i&127)<<10,i<128)||(i=o[n.pos++],r|=(i&127)<<17,i<128)||(i=o[n.pos++],r|=(i&127)<<24,i<128)||(i=o[n.pos++],r|=(i&1)<<31,i<128))return Y(e,r,t);throw new Error("Expected varint not more than 10 bytes")}function N(e){return e.type===y.Bytes?e.readVarint()+e.pos:e.pos+1}function Y(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Fo(e,t){var n,o;if(e>=0?(n=e%4294967296|0,o=e/4294967296|0):(n=~(-e%4294967296),o=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,o=o+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),vo(n,o,t),So(o,t)}function vo(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function So(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Vt(e,t,n){var o=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(o);for(var r=n.pos-1;r>=e;r--)n.buf[r+o]=n.buf[r]}function bo(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function _o(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function Bo(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function Eo(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function Mo(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function Ao(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function Lo(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function Vo(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function No(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Ie(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function X(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Nt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Do(e,t,n){for(var o="",r=t;r<n;){var i=e[r],s=null,a=i>239?4:i>223?3:i>191?2:1;if(r+a>n)break;var l,f,c;a===1?i<128&&(s=i):a===2?(l=e[r+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[r+1],f=e[r+2],(l&192)===128&&(f&192)===128&&(s=(i&15)<<12|(l&63)<<6|f&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[r+1],f=e[r+2],c=e[r+3],(l&192)===128&&(f&192)===128&&(c&192)===128&&(s=(i&15)<<18|(l&63)<<12|(f&63)<<6|c&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,o+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),o+=String.fromCharCode(s),r+=a}return o}function Co(e,t,n){return Dt.decode(e.subarray(t,n))}function ko(e,t,n){for(var o=0,r,i;o<t.length;o++){if(r=t.charCodeAt(o),r>55295&&r<57344)if(i)if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}else r=i-55296<<10|r-56320|65536,i=null;else{r>56319||o+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=r&63|128)}return n}});var ce={};Sn(ce,{GeoJSONTileSource:()=>fe,MVTLoader:()=>ve,MVTSource:()=>_e,MVTWorkerLoader:()=>$e,TileJSONLoader:()=>$});he(ce,ut(pt(),1));function D(e){return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(e)}function Le(e,t){if(D(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t||"default");if(D(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ve(e){var t=Le(e,"string");return D(t)==="symbol"?t:String(t)}function P(e,t,n){return t=Ve(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var q={x:0,y:1,z:2};function U(e,t={}){let{start:n=0,end:o=e.length,plane:r="xy"}=t,i=t.size||2,s=0,a=q[r[0]],l=q[r[1]];for(let f=n,c=o-i;f<o;f+=i)s+=(e[f+a]-e[c+a])*(e[f+l]+e[c+l]),c=f;return s/2}function De(e,t,n=2,o,r="xy"){let i=t&&t.length,s=i?t[0]*n:e.length,a=gt(e,0,s,n,!0,o&&o[0],r),l=[];if(!a||a.next===a.prev)return l;let f,c,u,p,h,d,x;if(i&&(a=Vn(e,t,a,n,o,r)),e.length>80*n){p=c=e[0],h=u=e[1];for(let w=n;w<s;w+=n)d=e[w],x=e[w+1],d<p&&(p=d),x<h&&(h=x),d>c&&(c=d),x>u&&(u=x);f=Math.max(c-p,u-h),f=f!==0?32767/f:0}return ee(a,l,n,p,h,f,0),l}function gt(e,t,n,o,r,i,s){let a,l;i===void 0&&(i=U(e,{start:t,end:n,size:o,plane:s}));let f=q[s[0]],c=q[s[1]];if(r===i<0)for(a=t;a<n;a+=o)l=dt(a,e[a+f],e[a+c],l);else for(a=n-o;a>=t;a-=o)l=dt(a,e[a+f],e[a+c],l);return l&&me(l,l.next)&&(ne(l),l=l.next),l}function G(e,t){if(!e)return e;t||(t=e);let n=e,o;do if(o=!1,!n.steiner&&(me(n,n.next)||T(n.prev,n,n.next)===0)){if(ne(n),n=t=n.prev,n===n.next)break;o=!0}else n=n.next;while(o||n!==t);return t}function ee(e,t,n,o,r,i,s){if(!e)return;!s&&i&&Un(e,o,r,i);let a=e,l,f;for(;e.prev!==e.next;){if(l=e.prev,f=e.next,i?Mn(e,o,r,i):En(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(f.i/n|0),ne(e),e=f.next,a=f.next;continue}if(e=f,e===a){s?s===1?(e=An(G(e),t,n),ee(e,t,n,o,r,i,2)):s===2&&Ln(e,t,n,o,r,i):ee(G(e),t,n,o,r,i,1);break}}}function En(e){let t=e.prev,n=e,o=e.next;if(T(t,n,o)>=0)return!1;let r=t.x,i=n.x,s=o.x,a=t.y,l=n.y,f=o.y,c=r<i?r<s?r:s:i<s?i:s,u=a<l?a<f?a:f:l<f?l:f,p=r>i?r>s?r:s:i>s?i:s,h=a>l?a>f?a:f:l>f?l:f,d=o.next;for(;d!==t;){if(d.x>=c&&d.x<=p&&d.y>=u&&d.y<=h&&Z(r,a,i,l,s,f,d.x,d.y)&&T(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Mn(e,t,n,o){let r=e.prev,i=e,s=e.next;if(T(r,i,s)>=0)return!1;let a=r.x,l=i.x,f=s.x,c=r.y,u=i.y,p=s.y,h=a<l?a<f?a:f:l<f?l:f,d=c<u?c<p?c:p:u<p?u:p,x=a>l?a>f?a:f:l>f?l:f,w=c>u?c>p?c:p:u>p?u:p,F=Ne(h,d,t,n,o),_=Ne(x,w,t,n,o),g=e.prevZ,m=e.nextZ;for(;g&&g.z>=F&&m&&m.z<=_;){if(g.x>=h&&g.x<=x&&g.y>=d&&g.y<=w&&g!==r&&g!==s&&Z(a,c,l,u,f,p,g.x,g.y)&&T(g.prev,g,g.next)>=0||(g=g.prevZ,m.x>=h&&m.x<=x&&m.y>=d&&m.y<=w&&m!==r&&m!==s&&Z(a,c,l,u,f,p,m.x,m.y)&&T(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;g&&g.z>=F;){if(g.x>=h&&g.x<=x&&g.y>=d&&g.y<=w&&g!==r&&g!==s&&Z(a,c,l,u,f,p,g.x,g.y)&&T(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;m&&m.z<=_;){if(m.x>=h&&m.x<=x&&m.y>=d&&m.y<=w&&m!==r&&m!==s&&Z(a,c,l,u,f,p,m.x,m.y)&&T(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function An(e,t,n){let o=e;do{let r=o.prev,i=o.next.next;!me(r,i)&&mt(r,o,o.next,i)&&te(r,i)&&te(i,r)&&(t.push(r.i/n|0),t.push(o.i/n|0),t.push(i.i/n|0),ne(o),ne(o.next),o=e=i),o=o.next}while(o!==e);return G(o)}function Ln(e,t,n,o,r,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&jn(s,a)){let l=xt(s,a);s=G(s,s.next),l=G(l,l.next),ee(s,t,n,o,r,i,0),ee(l,t,n,o,r,i,0);return}a=a.next}s=s.next}while(s!==e)}function Vn(e,t,n,o,r,i){let s=[],a,l,f,c,u;for(a=0,l=t.length;a<l;a++)f=t[a]*o,c=a<l-1?t[a+1]*o:e.length,u=gt(e,f,c,o,!1,r&&r[a+1],i),u===u.next&&(u.steiner=!0),s.push(On(u));for(s.sort(Nn),a=0;a<s.length;a++)n=Dn(s[a],n);return n}function Nn(e,t){return e.x-t.x}function Dn(e,t){let n=Cn(e,t);if(!n)return t;let o=xt(n,e);return G(o,o.next),G(n,n.next)}function Cn(e,t){let n=t,o=e.x,r=e.y,i=-1/0,s;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){let p=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=o&&p>i&&(i=p,s=n.x<n.next.x?n:n.next,p===o))return s}n=n.next}while(n!==t);if(!s)return null;let a=s,l=s.x,f=s.y,c=1/0,u;n=s;do o>=n.x&&n.x>=l&&o!==n.x&&Z(r<f?o:i,r,l,f,r<f?i:o,r,n.x,n.y)&&(u=Math.abs(r-n.y)/(o-n.x),te(n,e)&&(u<c||u===c&&(n.x>s.x||n.x===s.x&&kn(s,n)))&&(s=n,c=u)),n=n.next;while(n!==a);return s}function kn(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function Un(e,t,n,o){let r=e;do r.z===0&&(r.z=Ne(r.x,r.y,t,n,o)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,Gn(r)}function Gn(e){let t,n,o=1,r,i,s,a,l,f;do{for(i=e,e=null,f=null,r=0;i;){for(r++,a=i,s=0,n=0;n<o&&(s++,a=a.nextZ,!!a);n++);for(l=o;s>0||l>0&&a;)s!==0&&(l===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,s--):(t=a,a=a.nextZ,l--),f?f.nextZ=t:e=t,t.prevZ=f,f=t;i=a}f.nextZ=null,o*=2}while(r>1);return e}function Ne(e,t,n,o,r){return e=(e-n)*r|0,t=(t-o)*r|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function On(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Z(e,t,n,o,r,i,s,a){return(r-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(o-a)>=(n-s)*(t-a)&&(n-s)*(i-a)>=(r-s)*(o-a)}function jn(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Rn(e,t)&&(te(e,t)&&te(t,e)&&zn(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||me(e,t)&&T(e.prev,e,e.next)>0&&T(t.prev,t,t.next)>0)}function T(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function me(e,t){return e.x===t.x&&e.y===t.y}function mt(e,t,n,o){let r=ge(T(e,t,n)),i=ge(T(e,t,o)),s=ge(T(n,o,e)),a=ge(T(n,o,t));return!!(r!==i&&s!==a||r===0&&de(e,n,t)||i===0&&de(e,o,t)||s===0&&de(n,e,o)||a===0&&de(n,t,o))}function de(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ge(e){return e>0?1:e<0?-1:0}function Rn(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&mt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function te(e,t){return T(e.prev,e,e.next)<0?T(e,t,e.next)>=0&&T(e,e.prev,t)>=0:T(e,t,e.prev)<0||T(e,e.next,t)<0}function zn(e,t){let n=e,o=!1,r=(e.x+t.x)/2,i=(e.y+t.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&r<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==e);return o}function xt(e,t){let n=new oe(e.i,e.x,e.y),o=new oe(t.i,t.x,t.y),r=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,o.next=n,n.prev=o,i.next=o,o.prev=i,o}function dt(e,t,n,o){let r=new oe(e,t,n);return o?(r.next=o.next,r.prev=o,o.next.prev=r,o.next=r):(r.prev=r,r.next=r),r}function ne(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var oe=class{constructor(t,n,o){P(this,"i",void 0),P(this,"x",void 0),P(this,"y",void 0),P(this,"prev",null),P(this,"next",null),P(this,"z",0),P(this,"prevZ",null),P(this,"nextZ",null),P(this,"steiner",!1),this.i=t,this.x=n,this.y=o}};function Ue(e,t,n){let o=Yn(e),r=Object.keys(o).filter(i=>o[i]!==Array);return Xn(e,{propArrayTypes:o,...t},{numericPropKeys:n&&n.numericPropKeys||r,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function Yn(e){let t={};for(let n of e)if(n.properties)for(let o in n.properties){let r=n.properties[o];t[o]=to(r,t[o])}return t}function Xn(e,t,n){let{pointPositionsCount:o,pointFeaturesCount:r,linePositionsCount:i,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:f,polygonRingsCount:c,polygonFeaturesCount:u,propArrayTypes:p,coordLength:h}=t,{numericPropKeys:d=[],PositionDataType:x=Float32Array,triangulate:w=!0}=n,F=e[0]&&"id"in e[0],_=e.length>65535?Uint32Array:Uint16Array,g={type:"Point",positions:new x(o*h),globalFeatureIds:new _(o),featureIds:r>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},m={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new x(i*h),globalFeatureIds:new _(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},v={type:"Polygon",polygonIndices:l>65535?new Uint32Array(f+1):new Uint16Array(f+1),primitivePolygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),positions:new x(l*h),globalFeatureIds:new _(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};w&&(v.triangles=[]);for(let S of[g,m,v])for(let b of d){let B=p[b];S.numericProps[b]=new B(S.positions.length/h)}m.pathIndices[s]=i,v.polygonIndices[f]=l,v.primitivePolygonIndices[c]=l;let I={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let S of e){let b=S.geometry,B=S.properties||{};switch(b.type){case"Point":$n(b,g,I,h,B),g.properties.push(ke(B,d)),F&&g.fields.push({id:S.id}),I.pointFeature++;break;case"LineString":Kn(b,m,I,h,B),m.properties.push(ke(B,d)),F&&m.fields.push({id:S.id}),I.lineFeature++;break;case"Polygon":Qn(b,v,I,h,B),v.properties.push(ke(B,d)),F&&v.fields.push({id:S.id}),I.polygonFeature++;break;default:throw new Error("Invalid geometry type")}I.feature++}return eo(g,m,v,h)}function $n(e,t,n,o,r){t.positions.set(e.data,n.pointPosition*o);let i=e.data.length/o;Ge(t,r,n.pointPosition,i),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function Kn(e,t,n,o,r){t.positions.set(e.data,n.linePosition*o);let i=e.data.length/o;Ge(t,r,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],f=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(f-l)/o}}function Qn(e,t,n,o,r){t.positions.set(e.data,n.polygonPosition*o);let i=e.data.length/o;Ge(t,r,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=n.polygonPosition;t.polygonIndices[n.polygonObject++]=l;let f=e.areas[s],c=e.indices[s],u=e.indices[s+1];for(let h=0,d=c.length;h<d;++h){let x=c[h],w=h===d-1?u===void 0?e.data.length:u[0]:c[h+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(w-x)/o}let p=n.polygonPosition;qn(t,f,c,{startPosition:l,endPosition:p,coordLength:o})}}function qn(e,t,n,{startPosition:o,endPosition:r,coordLength:i}){if(!e.triangles)return;let s=o*i,a=r*i,l=e.positions.subarray(s,a),f=n[0],c=n.slice(1).map(p=>(p-f)/i),u=De(l,c,i,t);for(let p=0,h=u.length;p<h;++p)e.triangles.push(o+u[p])}function Ce(e,t){let n={};for(let o in e)n[o]={value:e[o],size:t};return n}function eo(e,t,n,o){let r={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:o},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Ce(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:o},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Ce(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:o},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:Ce(n.numericProps,1)}};return r.polygons&&n.triangles&&(r.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),r}function Ge(e,t,n,o){for(let r in e.numericProps)if(r in t){let i=t[r];e.numericProps[r].fill(i,n,n+o)}}function ke(e,t){let n={};for(let o in e)t.includes(o)||(n[o]=e[o]);return n}function to(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function re(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var L={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},no=L.self||L.window||L.global||{},oo=L.window||L.self||L.global||{},ro=L.global||L.self||L.window||{},io=L.document||{};var Oe=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Pt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),so=Pt&&parseFloat(Pt[1])||0;function je(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,n=e||t;return!!(n&&n.indexOf("Electron")>=0)}function M(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||je()}var ao=globalThis.self||globalThis.window||globalThis.global,H=globalThis.window||globalThis.self||globalThis.global,lo=globalThis.document||{},O=globalThis.process||{},fo=globalThis.console,zi=globalThis.navigator||{};var xe=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Ji=M();function co(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var ye=class{constructor(t,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";P(this,"storage",void 0),P(this,"id",void 0),P(this,"config",void 0),this.storage=co(o),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function Tt(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function It(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,n=Math.max(t-e.length,0);return"".concat(" ".repeat(n)).concat(e)}function we(e,t,n){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,r=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>o&&(n=Math.min(n,o/e.width));let i=e.width*n,s=e.height*n,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(r,");"),"background-size:".concat(i,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}var Pe;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Pe||(Pe={}));var uo=10;function Ft(e){return typeof e!="string"?e:(e=e.toUpperCase(),Pe[e]||Pe.WHITE)}function vt(e,t,n){if(!M&&typeof e=="string"){if(t){let o=Ft(t);e="\x1B[".concat(o,"m").concat(e,"\x1B[39m")}if(n){let o=Ft(n);e="\x1B[".concat(o+uo,"m").concat(e,"\x1B[49m")}}return e}function St(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],n=Object.getPrototypeOf(e),o=Object.getOwnPropertyNames(n),r=e;for(let i of o){let s=r[i];typeof s=="function"&&(t.find(a=>i===a)||(r[i]=s.bind(e)))}}function J(e,t){if(!e)throw new Error(t||"Assertion failed")}function j(){let e;if(M()&&H.performance){var t,n;e=H===null||H===void 0||(t=H.performance)===null||t===void 0||(n=t.now)===null||n===void 0?void 0:n.call(t)}else if("hrtime"in O){var o;let r=O===null||O===void 0||(o=O.hrtime)===null||o===void 0?void 0:o.call(O);e=r[0]*1e3+r[1]/1e6}else e=Date.now();return e}var W={debug:M()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},ho={enabled:!0,level:0};function E(){}var bt={},_t={once:!0},C=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};P(this,"id",void 0),P(this,"VERSION",xe),P(this,"_startTs",j()),P(this,"_deltaTs",j()),P(this,"_storage",void 0),P(this,"userData",{}),P(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new ye("__probe-".concat(this.id,"__"),ho),this.timeStamp("".concat(this.id," started")),St(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((j()-this._startTs).toPrecision(10))}getDelta(){return Number((j()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){J(t,n)}warn(t){return this._getLogFunction(0,t,W.warn,arguments,_t)}error(t){return this._getLogFunction(0,t,W.error,arguments)}deprecated(t,n){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(n,"` instead"))}removed(t,n){return this.error("`".concat(t,"` has been removed. Use `").concat(n,"` instead"))}probe(t,n){return this._getLogFunction(t,n,W.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,W.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,W.debug||W.info,arguments,_t)}table(t,n,o){return n?this._getLogFunction(t,n,console.table||E,o&&[o],{tag:xo(n)}):E}image(t){let{logLevel:n,priority:o,image:r,message:i="",scale:s=1}=t;return this._shouldLog(n||o)?M()?mo({image:r,message:i,scale:s}):go({image:r,message:i,scale:s}):E}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||E)}group(t,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},r=Bt({logLevel:t,message:n,opts:o}),{collapsed:i}=o;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,n,Object.assign({},o,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||E)}withGroup(t,n,o){this.group(t,n)();try{o()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Et(t)}_getLogFunction(t,n,o,r,i){if(this._shouldLog(t)){i=Bt({logLevel:t,message:n,args:r,opts:i}),o=o||i.method,J(o),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=j();let s=i.tag||i.message;if(i.once&&s)if(!bt[s])bt[s]=j();else return E;return n=po(this.id,i.message,i),o.bind(console,n,...i.args)}return E}};P(C,"VERSION",xe);function Et(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return J(Number.isFinite(t)&&t>=0),t}function Bt(e){let{logLevel:t,message:n}=e;e.logLevel=Et(t);let o=e.args?Array.from(e.args):[];for(;o.length&&o.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&o.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let r=typeof e.message;return J(r==="string"||r==="object"),Object.assign(e,{args:o},e.opts)}function po(e,t,n){if(typeof t=="string"){let o=n.time?It(Tt(n.total)):"";t=n.time?"".concat(e,": ").concat(o," ").concat(t):"".concat(e,": ").concat(t),t=vt(t,n.color,n.background)}return t}function go(e){let{image:t,message:n="",scale:o=1}=e;return console.warn("removed"),E}function mo(e){let{image:t,message:n="",scale:o=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let s=we(i,n,o);console.log(...s)},i.src=t,E}let r=t.nodeName||"";if(r.toLowerCase()==="img")return console.log(...we(t,n,o)),E;if(r.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...we(i,n,o)),i.src=t.toDataURL(),E}return E}function xo(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}var ws=new C({id:"@probe.gl/log"});var Re="4.2.0",yo=Re[0]>="0"&&Re[0]<="9"?`v${Re}`:"",ze=new C({id:`loaders.gl ${yo}`});var wo="",Mt={};function Ze(e){for(let t in Mt)if(e.startsWith(t)){let n=Mt[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${wo}${e}`),e}var ie=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Po(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function Po(e){let t=e?.fetch;if(t&&typeof t=="function")return(o,r)=>t(o,r);let n=e?.fetch;return n&&typeof n!="function"?o=>fetch(o,n):o=>fetch(o)}var Ye=ut(kt(),1);function Uo(e){let t=0;for(let n=0,o=e.length-1,r,i;n<e.length;o=n++)r=e[n],i=e[o],t+=(i[0]-r[0])*(r[1]+i[1]);return t}function Ut(e,t,n){let{x:o,y:r,z:i}=t,s=n*Math.pow(2,i),a=n*o,l=n*r;for(let f=0,c=e.length;f<c;f+=2){e[f]=(e[f]+a)*360/s-180;let u=180-(e[f+1]+l)*360/s;e[f+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function Gt(e){let t=e.length;if(t<=1)return[e];let n=[],o,r;for(let i=0;i<t;i++){let s=Uo(e[i]);s!==0&&(r===void 0&&(r=s<0),r===s<0?(o&&n.push(o),o=[e[i]]):o&&o.push(e[i]))}return o&&n.push(o),n}function Ot(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[U(e.data)]],indices:[e.indices]};let o=[],r=[],i=[],s=[],a,l=0;for(let f,c=0,u;c<t;c++){u=e.indices[c]-l,f=e.indices[c+1]-l||e.data.length;let p=e.data.slice(u,f),h=U(p);if(h===0){let d=e.data.slice(0,u),x=e.data.slice(f);e.data=d.concat(x),l+=f-u;continue}a===void 0&&(a=h<0),a===h<0?(s.length&&(o.push(i),r.push(s)),s=[u],i=[h]):(i.push(h),s.push(u))}return i&&o.push(i),s.length&&r.push(s),{type:n,areas:o,indices:r,data:e.data}}var R=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,o,r,i,s){this.properties={},this.extent=o,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=r,this._values=i,this._geometryInfo=s,t.readFields(Go,this,n)}toGeoJSON(t){let n=this.loadGeometry();if(typeof t=="function")return jt(this,n,t);let{x:o,y:r,z:i}=t,s=this.extent*Math.pow(2,i),a=this.extent*o,l=this.extent*r;function f(c){for(let u=0;u<c.length;u++){let p=c[u];p[0]=(p[0]+a)*360/s-180;let h=180-(p[1]+l)*360/s;p[1]=360/Math.PI*Math.atan(Math.exp(h*Math.PI/180))-90}}return jt(this,n,f)}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let n=t;return this._toBinaryCoordinates(o=>Ut(o,n,this.extent))}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,o=1,r=0,i=0,s=0,a=1/0,l=-1/0,f=1/0,c=-1/0;for(;t.pos<n;){if(r<=0){let u=t.readVarint();o=u&7,r=u>>3}if(r--,o===1||o===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<f&&(f=s),s>c&&(c=s);else if(o!==7)throw new Error(`unknown command ${o}`)}return[a,f,l,c]}_toBinaryCoordinates(t){let n=this.loadFlatGeometry(),o;t(n.data,this);let r=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,o={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/r,o={type:"LineString",...n};break;case 3:o=Ot(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=o.indices.length;for(let s of o.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=o.data.length/r;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:o,properties:this.properties};return this.id!==null&&(i.id=this.id),i}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,o=1,r=0,i=0,s=0,a=[],l;for(;t.pos<n;){if(r<=0){let f=t.readVarint();o=f&7,r=f>>3}switch(r--,o){case 1:case 2:i+=t.readSVarint(),s+=t.readSVarint(),o===1&&(l&&a.push(l),l=[]),l&&l.push([i,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${o}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,o=1,r,i=0,s=0,a=0,l=0,f=[],c=[];for(;t.pos<n;)if(i<=0&&(r=t.readVarint(),o=r&7,i=r>>3),i--,o===1||o===2)s+=t.readSVarint(),a+=t.readSVarint(),o===1&&f.push(l),c.push(s,a),l+=2;else if(o===7){if(l>0){let u=f[f.length-1];c.push(c[u],c[u+1]),l+=2}}else throw new Error(`unknown command ${o}`);return{data:c,indices:f}}};pe(R,"types",["Unknown","Point","LineString","Polygon"]);function jt(e,t,n){let o=R.types[e.type],r,i,s;switch(e.type){case 1:let l=[];for(r=0;r<t.length;r++)l[r]=t[r][0];s=l,n(s,e);break;case 2:for(s=t,r=0;r<s.length;r++)n(s[r],e);break;case 3:for(s=Gt(t),r=0;r<s.length;r++)for(i=0;i<s[r].length;i++)n(s[r][i],e);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:o=`Multi${o}`;let a={type:"Feature",geometry:{type:o,coordinates:s},properties:e.properties};return e.id!==null&&(a.id=e.id),a}function Go(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?Oo(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function Oo(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let o=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[o]=r}}var Fe=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(jo,this,n),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new R(this._pbf,n,this.extent,this._keys,this._values)}getBinaryFeature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let o=this._pbf.readVarint()+this._pbf.pos;return new R(this._pbf,o,this.extent,this._keys,this._values,n)}};function jo(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(Ro(n)))}function Ro(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let o=e.readVarint()>>3;t=o===1?e.readString():o===2?e.readFloat():o===3?e.readDouble():o===4?e.readVarint64():o===5?e.readVarint():o===6?e.readSVarint():o===7?e.readBoolean():null}return t}var se=class{layers;constructor(t,n){this.layers=t.readFields(zo,{},n)}};function zo(e,t,n){if(e===3&&n){let o=new Fe(n,n.readVarint()+n.pos);o.length&&t&&(t[o.name]=o)}}function Xe(e,t){let n=Ho(t),o=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(o){case"columnar-table":return{shape:"columnar-table",data:We(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Rt(e,n)};case"geojson":return Rt(e,n);case"binary-geometry":return We(e,n);case"binary":return We(e,n);default:throw new Error(o||"undefined shape")}}function We(e,t){let[n,o]=Zo(e,t),r=Ue(n,o);return r.byteLength=e.byteLength,r}function Zo(e,t){let n=[],o={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,o];let r=new se(new Ye.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(s=>{let a=r.layers[s];if(a)for(let l=0;l<a.length;l++){let f=a.getBinaryFeature(l,o),c=Wo(f,t,s);n.push(c)}}),[n,o]}function Rt(e,t){if(e.byteLength<=0)return[];let n=[],o=new se(new Ye.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(o.layers)).forEach(i=>{let s=o.layers[i];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),f=Jo(l,t,i);n.push(f)}}),n}function Ho(e){if(!e?.mvt)throw new Error("mvt options required");if(e.mvt?.coordinates==="wgs84"&&!e.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.gis&&ze.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function Jo(e,t,n){let o=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:Yo);return t.layerProperty&&(o.properties||={},o.properties[t.layerProperty]=n),o}function Wo(e,t,n){let o=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:Xo);return t.layerProperty&&o.properties&&(o.properties[t.layerProperty]=n),o}function Yo(e,t){let{extent:n}=t;for(let o=0;o<e.length;o++){let r=e[o];r[0]/=n,r[1]/=n}}function Xo(e,t){let{extent:n}=t;for(let o=0,r=e.length;o<r;++o)e[o]/=n}var $o="4.2.0",$e={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:$o,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},ve={...$e,parse:async(e,t)=>Xe(e,t),parseSync:Xe,binary:!0};var Jt=e=>e!==null&&typeof e=="object";function Ke(e,t){if(!e||!Jt(e))return null;let n={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(n.generator=e.generator),typeof e.generator_options=="string"&&(n.generatorOptions=e.generator_options),n.boundingBox=zt(e.bounds)||zt(e.antimeridian_adjusted_bounds),n.center=nr(e.center),n.maxZoom=Zt(e.maxzoom),n.minZoom=Zt(e.minzoom),typeof e?.json=="string")try{n.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let o=e.tilestats||n.metaJson?.tilestats,r=qo(o,t),i=Ko(e.vector_layers),s=tr(i,r);return n={...n,layers:s},n.maxZoom===null&&s.length>0&&(n.maxZoom=s[0].maxZoom||null),n.minZoom===null&&s.length>0&&(n.minZoom=s[0].minZoom||null),n}function Ko(e){return Array.isArray(e)?e.map(t=>Qo(t)):[]}function Qo(e){let t=Object.entries(e.fields||[]).map(([o,r])=>({name:o,...$t(String(r))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function qo(e,t){return Jt(e)&&Array.isArray(e.layers)?e.layers.map(n=>er(n,t)):[]}function er(e,t){let n=[],o={},r=e.attributes||[];for(let i of r){let s=i.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];o[a]=o[a]||[],o[a].push(i),console.warn("ignoring tilestats indexed field",a)}else n[s]||n.push(rr(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function tr(e,t){return e.map(n=>{let o=t.find(s=>s.name===n.name),r=o?.fields||[],i={...n};return delete i.fields,{...i,...o,fields:r}})}function zt(e){let t=Xt(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(Yt)&&[t[1],t[3]].every(Wt))return[[t[0],t[1]],[t[2],t[3]]]}function nr(e){let t=Xt(e);return Array.isArray(t)&&t.length===3&&Yt(t[0])&&Wt(t[1])&&or(t[2])?t:null}function Zt(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function Wt(e){return Number.isFinite(e)&&e<=90&&e>=-90}function Yt(e){return Number.isFinite(e)&&e<=180&&e>=-180}function or(e){return Number.isFinite(e)&&e>=0&&e<=22}function Xt(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var Ht={number:{type:"float32"},numeric:{type:"float32"},string:{type:"utf8"},vachar:{type:"utf8"},float:{type:"float32"},int:{type:"int32"},int4:{type:"int32"},boolean:{type:"boolean"},bool:{type:"boolean"}};function rr(e={},t){let n=$t(e.type),o={name:e.attribute,...n};return typeof e.min=="number"&&(o.min=e.min),typeof e.max=="number"&&(o.max=e.max),typeof e.count=="number"&&(o.uniqueValueCount=e.count),e.values&&(o.values=e.values),o.values&&typeof t.maxValues=="number"&&(o.values=o.values?.slice(0,t.maxValues)),o}function $t(e){let t=e.toLowerCase();return!t||Ht[t],Ht[t]||{type:"string"}}var ir="4.2.0",$={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:ir,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),o=JSON.parse(n),r={...$.options.tilejson,...t?.tilejson};return Ke(o,r)},parseTextSync:(e,t)=>{let n=JSON.parse(e),o={...$.options.tilejson,...t?.tilejson};return Ke(n,o)}};var Kt="4.2.0";var sr=globalThis.loaders?.parseImageNode,Qe=typeof Image<"u",qe=typeof ImageBitmap<"u",ar=Boolean(sr),et=Oe?!0:ar;function Qt(e){switch(e){case"auto":return qe||Qe||et;case"imagebitmap":return qe;case"image":return Qe;case"data":return et;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function qt(){if(qe)return"imagebitmap";if(Qe)return"image";if(et)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function lr(e){let t=fr(e);if(!t)throw new Error("Not an image");return t}function en(e){switch(lr(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function fr(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var cr=/^data:image\/svg\+xml/,ur=/\.svg((\?|#).*)?$/;function Se(e){return e&&(cr.test(e)||ur.test(e))}function tn(e,t){if(Se(t)){let o=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(o=unescape(encodeURIComponent(o)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(o)}`}return tt(e,t)}function tt(e,t){if(Se(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function be(e,t,n){let o=tn(e,n),r=self.URL||self.webkitURL,i=typeof o!="string"&&r.createObjectURL(o);try{return await hr(i||o,t)}finally{i&&r.revokeObjectURL(i)}}async function hr(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((o,r)=>{try{n.onload=()=>o(n),n.onerror=i=>{let s=i instanceof Error?i.message:"error";r(new Error(s))}}catch(i){r(i)}})}var pr={},nn=!0;async function on(e,t,n){let o;Se(n)?o=await be(e,t,n):o=tt(e,n);let r=t&&t.imagebitmap;return await dr(o,r)}async function dr(e,t=null){if((gr(t)||!nn)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),nn=!1}return await createImageBitmap(e)}function gr(e){for(let t in e||pr)return!1;return!0}function rn(e){return!wr(e,"ftyp",4)||!(e[8]&96)?null:mr(e)}function mr(e){switch(xr(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function xr(e,t,n){return String.fromCharCode(...e.slice(t,n))}function yr(e){return[...e].map(t=>t.charCodeAt(0))}function wr(e,t,n=0){let o=yr(t);for(let r=0;r<o.length;++r)if(o[r]!==e[r+n])return!1;return!0}var V=!1,ae=!0;function z(e){let t=le(e);return Tr(t)||vr(t)||Ir(t)||Fr(t)||Pr(t)}function Pr(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=rn(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function Tr(e){let t=le(e);return t.byteLength>=24&&t.getUint32(0,V)===2303741511?{mimeType:"image/png",width:t.getUint32(16,V),height:t.getUint32(20,V)}:null}function Ir(e){let t=le(e);return t.byteLength>=10&&t.getUint32(0,V)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,ae),height:t.getUint16(8,ae)}:null}function Fr(e){let t=le(e);return t.byteLength>=14&&t.getUint16(0,V)===16973&&t.getUint32(2,ae)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,ae),height:t.getUint32(22,ae)}:null}function vr(e){let t=le(e);if(!(t.byteLength>=3&&t.getUint16(0,V)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:o,sofMarkers:r}=Sr(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,V);if(r.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,V),width:t.getUint16(i+7,V)};if(!o.has(s))return null;i+=2,i+=t.getUint16(i,V)}return null}function Sr(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function le(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function sn(e,t){let{mimeType:n}=z(e)||{},o=globalThis.loaders?.parseImageNode;return re(o),await o(e,n)}async function an(e,t,n){t=t||{};let r=(t.image||{}).type||"auto",{url:i}=n||{},s=br(r),a;switch(s){case"imagebitmap":a=await on(e,t,i);break;case"image":a=await be(e,t,i);break;case"data":a=await sn(e,t);break;default:re(!1)}return r==="data"&&(a=en(a)),a}function br(e){switch(e){case"auto":case"data":return qt();default:return Qt(e),e}}var _r=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Br=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Er={image:{type:"auto",decode:!0}},nt={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Kt,mimeTypes:Br,extensions:_r,parse:an,tests:[e=>Boolean(z(new DataView(e)))],options:Er};var _e=class extends ie{props;url;metadataUrl=null;data;schema="tms";metadata;extension;mimeType=null;constructor(t){super(t),this.props=t,this.url=Ze(t.url),this.metadataUrl=t.metadataUrl===void 0?`${this.url}/tilejson.json`:t.metadataUrl,this.extension=t.extension||".png",this.data=this.url,this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata(),Mr(this.url)&&(this.schema="template")}async getMetadata(){if(!this.metadataUrl)return null;let t;try{t=await this.fetch(this.metadataUrl)}catch(r){return console.error(r.message),null}if(!t.ok)return console.error(t.statusText),null;let n=await t.text();return $.parseTextSync?.(n)||null}getTileMIMEType(){return this.mimeType}async getTile(t){let{x:n,y:o,z:r}=t,i=this.getTileURL(n,o,r),s=await this.fetch(i);return s.ok?await s.arrayBuffer():null}async getTileData(t){let{x:n,y:o,z:r}=t.index,i=await this.getTile({x:n,y:o,z:r,layers:[]});if(i===null)return null;let s=z(i);switch(this.mimeType=this.mimeType||s?.mimeType||"application/vnd.mapbox-vector-tile",this.mimeType){case"application/vnd.mapbox-vector-tile":return await this._parseVectorTile(i,{x:n,y:o,z:r,layers:[]});default:return await this._parseImageTile(i)}}async getImageTile(t){let n=await this.getTile(t);return n?this._parseImageTile(n):null}async _parseImageTile(t){return await nt.parse(t,this.loadOptions)}async getVectorTile(t){let n=await this.getTile(t);return n?this._parseVectorTile(n,t):null}async _parseVectorTile(t,n){let o={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:n.x,y:n.y,z:n.z},...this.loadOptions?.mvt},...this.loadOptions};return await ve.parse(t,o)}getMetadataUrl(){return this.metadataUrl}getTileURL(t,n,o){switch(this.schema){case"xyz":return`${this.url}/${t}/${n}/${o}${this.extension}`;case"tms":return`${this.url}/${o}/${t}/${n}${this.extension}`;case"template":return Nr(this.url,t,n,o,"0");default:throw new Error(this.schema)}}};function Mr(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(e)}var Ar=new RegExp("{x}","g"),Lr=new RegExp("{y}","g"),Vr=new RegExp("{z}","g");function Nr(e,t,n,o,r="0"){if(Array.isArray(e)){let s=Dr(r)%e.length;e=e[s]}let i=e;return i=i.replace(Ar,String(t)),i=i.replace(Lr,String(n)),i=i.replace(Vr,String(o)),Number.isInteger(n)&&Number.isInteger(o)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,o)-n-1))),i}function Dr(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function Be(e,t,n,o){let r=o,i=n-t>>1,s=n-t,a,l=e[t],f=e[t+1],c=e[n],u=e[n+1];for(let p=t+3;p<n;p+=3){let h=Cr(e[p],e[p+1],l,f,c,u);if(h>r)a=p,r=h;else if(h===r){let d=Math.abs(p-i);d<s&&(a=p,s=d)}}r>o&&(a-t>3&&Be(e,t,a,o),e[a+2]=r,n-a>3&&Be(e,a,n,o))}function Cr(e,t,n,o,r,i){let s=r-n,a=i-o;if(s!==0||a!==0){let l=((e-n)*s+(t-o)*a)/(s*s+a*a);l>1?(n=r,o=i):l>0&&(n+=s*l,o+=a*l)}return s=e-n,a=t-o,s*s+a*a}function k(e,t,n,o){let r={id:e??null,type:t,geometry:n,tags:o,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(t==="Point"||t==="MultiPoint"||t==="LineString")Ee(r,n);else if(t==="Polygon")Ee(r,n[0]);else if(t==="MultiLineString")for(let i of n)Ee(r,i);else if(t==="MultiPolygon")for(let i of n)Ee(r,i[0]);return r}function Ee(e,t){for(let n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function fn(e,t){let n=[];if(e.type==="FeatureCollection")for(let o=0;o<e.features.length;o++)Me(n,e.features[o],t,o);else e.type==="Feature"?Me(n,e,t):Me(n,{geometry:e},t);return n}function Me(e,t,n,o){if(!t.geometry)return;let r=t.geometry.coordinates,i=t.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),a=[],l=t.id;if(n.promoteId?l=t.properties[n.promoteId]:n.generateId&&(l=o||0),i==="Point")ln(r,a);else if(i==="MultiPoint")for(let f of r)ln(f,a);else if(i==="LineString")rt(r,a,s,!1);else if(i==="MultiLineString")if(n.lineMetrics){for(let f of r)a=[],rt(f,a,s,!1),e.push(k(l,"LineString",a,t.properties));return}else ot(r,a,s,!1);else if(i==="Polygon")ot(r,a,s,!0);else if(i==="MultiPolygon")for(let f of r){let c=[];ot(f,c,s,!0),a.push(c)}else if(i==="GeometryCollection"){for(let f of t.geometry.geometries)Me(e,{id:l,geometry:f,properties:t.properties},n,o);return}else throw new Error("Input data is not a valid GeoJSON object.");e.push(k(l,i,a,t.properties))}function ln(e,t){t.push(cn(e[0]),un(e[1]),0)}function rt(e,t,n,o){let r,i,s=0;for(let l=0;l<e.length;l++){let f=cn(e[l][0]),c=un(e[l][1]);t.push(f,c,0),l>0&&(o?s+=(r*c-f*i)/2:s+=Math.sqrt(Math.pow(f-r,2)+Math.pow(c-i,2))),r=f,i=c}let a=t.length-3;t[2]=1,Be(t,0,a,n),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function ot(e,t,n,o){for(let r=0;r<e.length;r++){let i=[];rt(e[r],i,n,o),t.push(i)}}function cn(e){return e/360+.5}function un(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function A(e,t,n,o,r,i,s,a){if(n/=t,o/=t,i>=n&&s<o)return e;if(s<n||i>=o)return null;let l=[];for(let f of e){let c=f.geometry,u=f.type,p=r===0?f.minX:f.minY,h=r===0?f.maxX:f.maxY;if(p>=n&&h<o){l.push(f);continue}else if(h<n||p>=o)continue;let d=[];if(u==="Point"||u==="MultiPoint")kr(c,d,n,o,r);else if(u==="LineString")pn(c,d,n,o,r,!1,a.lineMetrics);else if(u==="MultiLineString")it(c,d,n,o,r,!1);else if(u==="Polygon")it(c,d,n,o,r,!0);else if(u==="MultiPolygon")for(let x of c){let w=[];it(x,w,n,o,r,!0),w.length&&d.push(w)}if(d.length){if(a.lineMetrics&&u==="LineString"){for(let x of d)l.push(k(f.id,u,x,f.tags));continue}(u==="LineString"||u==="MultiLineString")&&(d.length===1?(u="LineString",d=d[0]):u="MultiLineString"),(u==="Point"||u==="MultiPoint")&&(u=d.length===3?"Point":"MultiPoint"),l.push(k(f.id,u,d,f.tags))}}return l.length?l:null}function kr(e,t,n,o,r){for(let i=0;i<e.length;i+=3){let s=e[i+r];s>=n&&s<=o&&K(t,e[i],e[i+1],e[i+2])}}function pn(e,t,n,o,r,i,s){let a=hn(e),l=r===0?Ur:Gr,f=e.start,c,u;for(let F=0;F<e.length-3;F+=3){let _=e[F],g=e[F+1],m=e[F+2],v=e[F+3],I=e[F+4],S=r===0?_:g,b=r===0?v:I,B=!1;s&&(c=Math.sqrt(Math.pow(_-v,2)+Math.pow(g-I,2))),S<n?b>n&&(u=l(a,_,g,v,I,n),s&&(a.start=f+c*u)):S>o?b<o&&(u=l(a,_,g,v,I,o),s&&(a.start=f+c*u)):K(a,_,g,m),b<n&&S>=n&&(u=l(a,_,g,v,I,n),B=!0),b>o&&S<=o&&(u=l(a,_,g,v,I,o),B=!0),!i&&B&&(s&&(a.end=f+c*u),t.push(a),a=hn(e)),s&&(f+=c)}let p=e.length-3,h=e[p],d=e[p+1],x=e[p+2],w=r===0?h:d;w>=n&&w<=o&&K(a,h,d,x),p=a.length-3,i&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&K(a,a[0],a[1],a[2]),a.length&&t.push(a)}function hn(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function it(e,t,n,o,r,i){for(let s of e)pn(s,t,n,o,r,i,!1)}function K(e,t,n,o){e.push(t,n,o)}function Ur(e,t,n,o,r,i){let s=(i-t)/(o-t);return K(e,i,n+(r-n)*s,1),s}function Gr(e,t,n,o,r,i){let s=(i-n)/(r-n);return K(e,t+(o-t)*s,i,1),s}function gn(e,t){let n=t.buffer/t.extent,o=e,r=A(e,1,-1-n,n,0,-1,2,t),i=A(e,1,1-n,2+n,0,-1,2,t);return(r||i)&&(o=A(e,1,-n,1+n,0,-1,2,t)||[],r&&(o=dn(r,1).concat(o)),i&&(o=o.concat(dn(i,-1)))),o}function dn(e,t){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=r.type,s;if(i==="Point"||i==="MultiPoint"||i==="LineString")s=st(r.geometry,t);else if(i==="MultiLineString"||i==="Polygon"){s=[];for(let a of r.geometry)s.push(st(a,t))}else if(i==="MultiPolygon"){s=[];for(let a of r.geometry){let l=[];for(let f of a)l.push(st(f,t));s.push(l)}}n.push(k(r.id,i,s,r.tags))}return n}function st(e,t){let n=[];n.size=e.size,e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let o=0;o<e.length;o+=3)n.push(e[o]+t,e[o+1],e[o+2]);return n}function at(e,t){if(e.transformed)return e;let n=1<<e.z,o=e.x,r=e.y;for(let i of e.features){let s=i.geometry,a=i.type;if(i.geometry=[],a===1)for(let l=0;l<s.length;l+=2)i.geometry.push(mn(s[l],s[l+1],t,n,o,r));else for(let l=0;l<s.length;l++){let f=[];for(let c=0;c<s[l].length;c+=2)f.push(mn(s[l][c],s[l][c+1],t,n,o,r));i.geometry.push(f)}}return e.transformed=!0,e}function mn(e,t,n,o,r,i){return[Math.round(n*(e*o-r)),Math.round(n*(t*o-i))]}function xn(e,t,n,o,r){let i=t===r.maxZoom?0:r.tolerance/((1<<t)*r.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:n,y:o,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let a of e)Or(s,a,i,r);return s}function Or(e,t,n,o){let r=t.geometry,i=t.type,s=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),i==="Point"||i==="MultiPoint")for(let a=0;a<r.length;a+=3)s.push(r[a],r[a+1]),e.numPoints++,e.numSimplified++;else if(i==="LineString")lt(s,r,e,n,!1,!1);else if(i==="MultiLineString"||i==="Polygon")for(let a=0;a<r.length;a++)lt(s,r[a],e,n,i==="Polygon",a===0);else if(i==="MultiPolygon")for(let a=0;a<r.length;a++){let l=r[a];for(let f=0;f<l.length;f++)lt(s,l[f],e,n,!0,f===0)}if(s.length){let a=t.tags||null;if(i==="LineString"&&o.lineMetrics){a={};for(let f in t.tags)a[f]=t.tags[f];a.mapbox_clip_start=r.start/r.size,a.mapbox_clip_end=r.end/r.size}let l={geometry:s,type:i==="Polygon"||i==="MultiPolygon"?3:i==="LineString"||i==="MultiLineString"?2:1,tags:a};t.id!==null&&(l.id=t.id),e.features.push(l)}}function lt(e,t,n,o,r,i){let s=o*o;if(o>0&&t.size<(r?s:o)){n.numPoints+=t.length/3;return}let a=[];for(let l=0;l<t.length;l+=3)(o===0||t[l+2]>s)&&(n.numSimplified++,a.push(t[l],t[l+1])),n.numPoints++;r&&jr(a,i),e.push(a)}function jr(e,t){let n=0;for(let o=0,r=e.length-2;o<e.length;r=o,o+=2)n+=(e[o]-e[r])*(e[o+1]+e[r+1]);if(n>0===t)for(let o=0,r=e.length;o<r/2;o+=2){let i=e[o],s=e[o+1];e[o]=e[r-2-o],e[o+1]=e[r-1-o],e[r-2-o]=i,e[r-1-o]=s}}var ct=class{mimeType="application/vnd.mapbox-vector-tile";options;tiles={};tileCoords=[];stats={};total=0;ready;constructor(t,n){this.options={...ct.defaultOptions,...n},this.getTileData=this.getTileData.bind(this),this.ready=this.initializeTilesAsync(t)}async initializeTilesAsync(t){let n=await t;this.initializeTilesSync(n)}initializeTilesSync(t){let n=this.options,o=n.debug;if(o&&console.time("preprocess data"),this.options.maxZoom<0||this.options.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&this.options.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=fn(t,n);o&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles")),r=gn(r,this.options),r.length&&this.splitTile(r,0,0,0),o&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}async getMetadata(){return{}}async getVectorTile(t){return await this.ready,this.getTileSync(t)}async getTile(t){return await this.ready,this.getTileSync(t)}async getTileData(t){let{x:n,y:o,z:r}=t.index;return await this.getVectorTile({x:n,y:o,z:r})}getTileSync(t){let n=this.getRawTile(t);return n?Rr(n,this.options.extent):null}getRawTile(t){let{z:n,y:o}=t,{x:r}=t,{extent:i,debug:s}=this.options;if(n<0||n>24)return null;let a=1<<n;r=r+a&a-1;let l=ft(n,r,o);if(this.tiles[l])return at(this.tiles[l],i);s>1&&console.log("drilling down to z%d-%d-%d",n,r,o);let f=n,c=r,u=o,p;for(;!p&&f>0;)f--,c=c>>1,u=u>>1,p=this.tiles[ft(f,c,u)];return!p||!p.source?null:(s>1&&(console.log("found parent tile z%d-%d-%d",f,c,u),console.time("drilling down")),this.splitTile(p.source,f,c,u,n,r,o),s>1&&console.timeEnd("drilling down"),this.tiles[l]?at(this.tiles[l],i):null)}splitTile(t,n,o,r,i,s,a){let l=[t,n,o,r],f=this.options,c=f.debug;for(;l.length;){r=l.pop(),o=l.pop(),n=l.pop(),t=l.pop();let u=1<<n,p=ft(n,o,r),h=this.tiles[p];if(!h&&(c>1&&console.time("creation"),h=this.tiles[p]=xn(t,n,o,r,f),this.tileCoords.push({z:n,x:o,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,o,r,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));let b=`z${n}`;this.stats[b]=(this.stats[b]||0)+1,this.total++}if(h.source=t,i===void 0){if(n===f.indexMaxZoom||h.numPoints<=f.indexMaxPoints)continue}else{if(n===f.maxZoom||n===i)continue;if(i!==void 0){let b=i-n;if(o!==s>>b||r!==a>>b)continue}}if(h.source=null,t.length===0)continue;c>1&&console.time("clipping");let d=.5*f.buffer/f.extent,x=.5-d,w=.5+d,F=1+d,_=null,g=null,m=null,v=null,I=A(t,u,o-d,o+w,0,h.minX,h.maxX,f),S=A(t,u,o+x,o+F,0,h.minX,h.maxX,f);t=null,I&&(_=A(I,u,r-d,r+w,1,h.minY,h.maxY,f),g=A(I,u,r+x,r+F,1,h.minY,h.maxY,f),I=null),S&&(m=A(S,u,r-d,r+w,1,h.minY,h.maxY,f),v=A(S,u,r+x,r+F,1,h.minY,h.maxY,f),S=null),c>1&&console.timeEnd("clipping"),l.push(_||[],n+1,o*2,r*2),l.push(g||[],n+1,o*2,r*2+1),l.push(m||[],n+1,o*2+1,r*2),l.push(v||[],n+1,o*2+1,r*2+1)}}},fe=ct;pe(fe,"defaultOptions",{maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:void 0,generateId:!1,debug:0});function ft(e,t,n){return((1<<e)*n+t)*32+e}function Rr(e,t){let n=[];for(let r of e.features){if(!r||!r.geometry)continue;let i,s;switch(r.type){case 1:r.geometry.length===1?(i="Point",s=r.geometry[0]):(i="MultiPoint",s=r.geometry);break;case 2:r.geometry.length===1?(i="LineString",s=r.geometry[0]):(i="MultiLineString",s=r.geometry);break;case 3:r.geometry.length>1?(i="MultiPolygon",s=[r.geometry]):(i="Polygon",s=r.geometry);break;default:continue}s=yn(s,t);let a={type:"Feature",geometry:{type:i,coordinates:s},properties:r.tags||{}};n.push(a)}return{shape:"geojson-table",type:"FeatureCollection",features:n}}function yn(e,t){return Array.isArray(e[0])?e.map(n=>yn(n,t)):[e[0]/t,e[1]/t]}return bn(ce);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var An=Object.create;var nt=Object.defineProperty;var Bn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Mn=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty;var Vn=(t,e,n)=>e in t?nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Gt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dn=(t,e)=>{for(var n in e)nt(t,n,{get:e[n],enumerable:!0})},wt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of En(e))!Ln.call(t,o)&&o!==n&&nt(t,o,{get:()=>e[o],enumerable:!(r=Bn(e,o))||r.enumerable});return t},Tt=(t,e,n)=>(wt(t,e,"default"),n&&wt(n,e,"default")),xe=(t,e,n)=>(n=t!=null?An(Mn(t)):{},wt(e||!t||!t.__esModule?nt(n,"default",{value:t,enumerable:!0}):n,t)),Cn=t=>wt(nt({},"__esModule",{value:!0}),t);var rt=(t,e,n)=>(Vn(t,typeof e!="symbol"?e+"":e,n),n);var Te=Gt((ri,we)=>{we.exports=globalThis.loaders});var je=Gt(qt=>{qt.read=function(t,e,n,r,o){var i,s,a=o*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,f=n?o-1:0,h=n?-1:1,p=t[e+f];for(f+=h,i=p&(1<<-u)-1,p>>=-u,u+=a;u>0;i=i*256+t[e+f],f+=h,u-=8);for(s=i&(1<<-u)-1,i>>=-u,u+=r;u>0;s=s*256+t[e+f],f+=h,u-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-c}return(p?-1:1)*s*Math.pow(2,i-r)};qt.write=function(t,e,n,r,o,i){var s,a,l,c=i*8-o-1,u=(1<<c)-1,f=u>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?e+=h/l:e+=h*Math.pow(2,1-f),e*l>=2&&(s++,l/=2),s+f>=u?(a=0,s=u):s+f>=1?(a=(e*l-1)*Math.pow(2,o),s=s+f):(a=e*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;t[n+p]=a&255,p+=d,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;t[n+p]=s&255,p+=d,s/=256,c-=8);t[n+p-d]|=y*128}});var Je=Gt((ta,Ze)=>{"use strict";Ze.exports=x;var Bt=je();function x(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}x.Varint=0;x.Fixed64=1;x.Bytes=2;x.Fixed32=5;var te=(1<<16)*(1<<16),Oe=1/te,Cr=12,He=typeof TextDecoder>"u"?null:new TextDecoder("utf8");x.prototype={destroy:function(){this.buf=null},readFields:function(t,e,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),o=r>>3,i=this.pos;this.type=r&7,t(o,e,this),this.pos===i&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Et(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=ze(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Et(this.buf,this.pos)+Et(this.buf,this.pos+4)*te;return this.pos+=8,t},readSFixed64:function(){var t=Et(this.buf,this.pos)+ze(this.buf,this.pos+4)*te;return this.pos+=8,t},readFloat:function(){var t=Bt.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Bt.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,n,r;return r=e[this.pos++],n=r&127,r<128||(r=e[this.pos++],n|=(r&127)<<7,r<128)||(r=e[this.pos++],n|=(r&127)<<14,r<128)||(r=e[this.pos++],n|=(r&127)<<21,r<128)?n:(r=e[this.pos],n|=(r&15)<<28,Nr(n,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Cr&&He?$r(this.buf,e,t):Xr(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==x.Bytes)return t.push(this.readVarint(e));var n=N(this);for(t=t||[];this.pos<n;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==x.Bytes)return t.push(this.readSVarint());var e=N(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==x.Bytes)return t.push(this.readBoolean());var e=N(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==x.Bytes)return t.push(this.readFloat());var e=N(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==x.Bytes)return t.push(this.readDouble());var e=N(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==x.Bytes)return t.push(this.readFixed32());var e=N(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==x.Bytes)return t.push(this.readSFixed32());var e=N(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==x.Bytes)return t.push(this.readFixed64());var e=N(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==x.Bytes)return t.push(this.readSFixed64());var e=N(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===x.Varint)for(;this.buf[this.pos++]>127;);else if(e===x.Bytes)this.pos=this.readVarint()+this.pos;else if(e===x.Fixed32)this.pos+=4;else if(e===x.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Q(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Q(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Q(this.buf,t&-1,this.pos),Q(this.buf,Math.floor(t*Oe),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Q(this.buf,t&-1,this.pos),Q(this.buf,Math.floor(t*Oe),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){kr(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=Kr(this.buf,t,this.pos);var n=this.pos-e;n>=128&&Re(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),Bt.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Bt.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n<e;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var r=this.pos-n;r>=128&&Re(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,x.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,jr,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Or,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Hr,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Rr,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,zr,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Zr,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Jr,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Wr,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Yr,e)},writeBytesField:function(t,e){this.writeTag(t,x.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,x.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,x.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,x.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,x.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,x.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,x.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,x.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,x.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,x.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function Nr(t,e,n){var r=n.buf,o,i;if(i=r[n.pos++],o=(i&112)>>4,i<128||(i=r[n.pos++],o|=(i&127)<<3,i<128)||(i=r[n.pos++],o|=(i&127)<<10,i<128)||(i=r[n.pos++],o|=(i&127)<<17,i<128)||(i=r[n.pos++],o|=(i&127)<<24,i<128)||(i=r[n.pos++],o|=(i&1)<<31,i<128))return K(t,o,e);throw new Error("Expected varint not more than 10 bytes")}function N(t){return t.type===x.Bytes?t.readVarint()+t.pos:t.pos+1}function K(t,e,n){return n?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function kr(t,e){var n,r;if(t>=0?(n=t%4294967296|0,r=t/4294967296|0):(n=~(-t%4294967296),r=~(-t/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Ur(n,r,e),Gr(r,e)}function Ur(t,e,n){n.buf[n.pos++]=t&127|128,t>>>=7,n.buf[n.pos++]=t&127|128,t>>>=7,n.buf[n.pos++]=t&127|128,t>>>=7,n.buf[n.pos++]=t&127|128,t>>>=7,n.buf[n.pos]=t&127}function Gr(t,e){var n=(t&7)<<4;e.buf[e.pos++]|=n|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function Re(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));n.realloc(r);for(var o=n.pos-1;o>=t;o--)n.buf[o+r]=n.buf[o]}function jr(t,e){for(var n=0;n<t.length;n++)e.writeVarint(t[n])}function Or(t,e){for(var n=0;n<t.length;n++)e.writeSVarint(t[n])}function Rr(t,e){for(var n=0;n<t.length;n++)e.writeFloat(t[n])}function zr(t,e){for(var n=0;n<t.length;n++)e.writeDouble(t[n])}function Hr(t,e){for(var n=0;n<t.length;n++)e.writeBoolean(t[n])}function Zr(t,e){for(var n=0;n<t.length;n++)e.writeFixed32(t[n])}function Jr(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function Wr(t,e){for(var n=0;n<t.length;n++)e.writeFixed64(t[n])}function Yr(t,e){for(var n=0;n<t.length;n++)e.writeSFixed64(t[n])}function Et(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Q(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function ze(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Xr(t,e,n){for(var r="",o=e;o<n;){var i=t[o],s=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a>n)break;var l,c,u;a===1?i<128&&(s=i):a===2?(l=t[o+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=t[o+1],c=t[o+2],(l&192)===128&&(c&192)===128&&(s=(i&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=t[o+1],c=t[o+2],u=t[o+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(s=(i&15)<<18|(l&63)<<12|(c&63)<<6|u&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,r+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),r+=String.fromCharCode(s),o+=a}return r}function $r(t,e,n){return He.decode(t.subarray(e,n))}function Kr(t,e,n){for(var r=0,o,i;r<e.length;r++){if(o=e.charCodeAt(r),o>55295&&o<57344)if(i)if(o<56320){t[n++]=239,t[n++]=191,t[n++]=189,i=o;continue}else o=i-55296<<10|o-56320|65536,i=null;else{o>56319||r+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):i=o;continue}else i&&(t[n++]=239,t[n++]=191,t[n++]=189,i=null);o<128?t[n++]=o:(o<2048?t[n++]=o>>6|192:(o<65536?t[n++]=o>>12|224:(t[n++]=o>>18|240,t[n++]=o>>12&63|128),t[n++]=o>>6&63|128),t[n++]=o&63|128)}return n}});var xt={};Dn(xt,{MVTLoader:()=>Lt,MVTSource:()=>Ct,MVTWorkerLoader:()=>oe,TableTileSource:()=>et,TileJSONLoader:()=>q});Tt(xt,xe(Te(),1));function Pt(t,e="float32"){return t instanceof Date?"date-millisecond":t instanceof Number?e:typeof t=="string"?"utf8":(t===null||t==="undefined","null")}function Pe(t){let e=Nn(t);return e!=="null"?{type:e,nullable:!1}:t.length>0?(e=Pt(t[0]),{type:e,nullable:!0}):{type:"null",nullable:!0}}function Nn(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function jt(t){switch(t.shape){case"array-row-table":case"object-row-table":return Un(t.data);case"geojson-table":return Gn(t.features);case"columnar-table":return kn(t.data);case"arrow-table":default:throw new Error("Deduce schema")}}function kn(t){let e=[];for(let[n,r]of Object.entries(t)){let o=jn(r,n);e.push(o)}return{fields:e,metadata:{}}}function Un(t){if(!t.length)throw new Error("deduce from empty table");let e=[],n=t[0];for(let[r,o]of Object.entries(n))e.push(Fe(o,r));return{fields:e,metadata:{}}}function Gn(t){if(!t.length)throw new Error("deduce from empty table");let e=[],n=t[0].properties||{};for(let[r,o]of Object.entries(n))e.push(Fe(o,r));return{fields:e,metadata:{}}}function jn(t,e){if(ArrayBuffer.isView(t)){let n=Pe(t);return{name:e,type:n.type||"null",nullable:n.nullable}}if(Array.isArray(t)&&t.length>0){let n=t[0],r=Pt(n);return{name:e,type:r,nullable:!0}}throw new Error("empty table")}function Fe(t,e){let n=Pt(t);return{name:e,type:n,nullable:!0}}function k(t){return k=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k(t)}function Ot(t,e){if(k(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(k(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Rt(t){var e=Ot(t,"string");return k(e)==="symbol"?e:String(e)}function w(t,e,n){return e=Rt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ot={x:0,y:1,z:2};function j(t,e={}){let{start:n=0,end:r=t.length,plane:o="xy"}=e,i=e.size||2,s=0,a=ot[o[0]],l=ot[o[1]];for(let c=n,u=r-i;c<r;c+=i)s+=(t[c+a]-t[u+a])*(t[c+l]+t[u+l]),u=c;return s/2}function Ht(t,e,n=2,r,o="xy"){let i=e&&e.length,s=i?e[0]*n:t.length,a=Se(t,0,s,n,!0,r&&r[0],o),l=[];if(!a||a.next===a.prev)return l;let c,u,f,h,p,d,y;if(i&&(a=Wn(t,e,a,n,r,o)),t.length>80*n){h=u=t[0],p=f=t[1];for(let T=n;T<s;T+=n)d=t[T],y=t[T+1],d<h&&(h=d),y<p&&(p=y),d>u&&(u=d),y>f&&(f=y);c=Math.max(u-h,f-p),c=c!==0?32767/c:0}return it(a,l,n,h,p,c,0),l}function Se(t,e,n,r,o,i,s){let a,l;i===void 0&&(i=j(t,{start:e,end:n,size:r,plane:s}));let c=ot[s[0]],u=ot[s[1]];if(o===i<0)for(a=e;a<n;a+=r)l=Ie(a,t[a+c],t[a+u],l);else for(a=n-r;a>=e;a-=r)l=Ie(a,t[a+c],t[a+u],l);return l&&St(l,l.next)&&(at(l),l=l.next),l}function O(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(St(n,n.next)||P(n.prev,n,n.next)===0)){if(at(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function it(t,e,n,r,o,i,s){if(!t)return;!s&&i&&Qn(t,r,o,i);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,i?Hn(t,r,o,i):zn(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),at(t),t=c.next,a=c.next;continue}if(t=c,t===a){s?s===1?(t=Zn(O(t),e,n),it(t,e,n,r,o,i,2)):s===2&&Jn(t,e,n,r,o,i):it(O(t),e,n,r,o,i,1);break}}}function zn(t){let e=t.prev,n=t,r=t.next;if(P(e,n,r)>=0)return!1;let o=e.x,i=n.x,s=r.x,a=e.y,l=n.y,c=r.y,u=o<i?o<s?o:s:i<s?i:s,f=a<l?a<c?a:c:l<c?l:c,h=o>i?o>s?o:s:i>s?i:s,p=a>l?a>c?a:c:l>c?l:c,d=r.next;for(;d!==e;){if(d.x>=u&&d.x<=h&&d.y>=f&&d.y<=p&&W(o,a,i,l,s,c,d.x,d.y)&&P(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Hn(t,e,n,r){let o=t.prev,i=t,s=t.next;if(P(o,i,s)>=0)return!1;let a=o.x,l=i.x,c=s.x,u=o.y,f=i.y,h=s.y,p=a<l?a<c?a:c:l<c?l:c,d=u<f?u<h?u:h:f<h?f:h,y=a>l?a>c?a:c:l>c?l:c,T=u>f?u>h?u:h:f>h?f:h,v=zt(p,d,e,n,r),_=zt(y,T,e,n,r),g=t.prevZ,m=t.nextZ;for(;g&&g.z>=v&&m&&m.z<=_;){if(g.x>=p&&g.x<=y&&g.y>=d&&g.y<=T&&g!==o&&g!==s&&W(a,u,l,f,c,h,g.x,g.y)&&P(g.prev,g,g.next)>=0||(g=g.prevZ,m.x>=p&&m.x<=y&&m.y>=d&&m.y<=T&&m!==o&&m!==s&&W(a,u,l,f,c,h,m.x,m.y)&&P(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;g&&g.z>=v;){if(g.x>=p&&g.x<=y&&g.y>=d&&g.y<=T&&g!==o&&g!==s&&W(a,u,l,f,c,h,g.x,g.y)&&P(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;m&&m.z<=_;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=T&&m!==o&&m!==s&&W(a,u,l,f,c,h,m.x,m.y)&&P(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Zn(t,e,n){let r=t;do{let o=r.prev,i=r.next.next;!St(o,i)&&be(o,r,r.next,i)&&st(o,i)&&st(i,o)&&(e.push(o.i/n|0),e.push(r.i/n|0),e.push(i.i/n|0),at(r),at(r.next),r=t=i),r=r.next}while(r!==t);return O(r)}function Jn(t,e,n,r,o,i){let s=t;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&er(s,a)){let l=ve(s,a);s=O(s,s.next),l=O(l,l.next),it(s,e,n,r,o,i,0),it(l,e,n,r,o,i,0);return}a=a.next}s=s.next}while(s!==t)}function Wn(t,e,n,r,o,i){let s=[],a,l,c,u,f;for(a=0,l=e.length;a<l;a++)c=e[a]*r,u=a<l-1?e[a+1]*r:t.length,f=Se(t,c,u,r,!1,o&&o[a+1],i),f===f.next&&(f.steiner=!0),s.push(tr(f));for(s.sort(Yn),a=0;a<s.length;a++)n=Xn(s[a],n);return n}function Yn(t,e){return t.x-e.x}function Xn(t,e){let n=$n(t,e);if(!n)return e;let r=ve(n,t);return O(r,r.next),O(n,n.next)}function $n(t,e){let n=e,r=t.x,o=t.y,i=-1/0,s;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){let h=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>i&&(i=h,s=n.x<n.next.x?n:n.next,h===r))return s}n=n.next}while(n!==e);if(!s)return null;let a=s,l=s.x,c=s.y,u=1/0,f;n=s;do r>=n.x&&n.x>=l&&r!==n.x&&W(o<c?r:i,o,l,c,o<c?i:r,o,n.x,n.y)&&(f=Math.abs(o-n.y)/(r-n.x),st(n,t)&&(f<u||f===u&&(n.x>s.x||n.x===s.x&&Kn(s,n)))&&(s=n,u=f)),n=n.next;while(n!==a);return s}function Kn(t,e){return P(t.prev,t,e.prev)<0&&P(e.next,t,t.next)<0}function Qn(t,e,n,r){let o=t;do o.z===0&&(o.z=zt(o.x,o.y,e,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==t);o.prevZ.nextZ=null,o.prevZ=null,qn(o)}function qn(t){let e,n,r=1,o,i,s,a,l,c;do{for(i=t,t=null,c=null,o=0;i;){for(o++,a=i,s=0,n=0;n<r&&(s++,a=a.nextZ,!!a);n++);for(l=r;s>0||l>0&&a;)s!==0&&(l===0||!a||i.z<=a.z)?(e=i,i=i.nextZ,s--):(e=a,a=a.nextZ,l--),c?c.nextZ=e:t=e,e.prevZ=c,c=e;i=a}c.nextZ=null,r*=2}while(o>1);return t}function zt(t,e,n,r,o){return t=(t-n)*o|0,e=(e-r)*o|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function tr(t){let e=t,n=t;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==t);return n}function W(t,e,n,r,o,i,s,a){return(o-s)*(e-a)>=(t-s)*(i-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(i-a)>=(o-s)*(r-a)}function er(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!nr(t,e)&&(st(t,e)&&st(e,t)&&rr(t,e)&&(P(t.prev,t,e.prev)||P(t,e.prev,e))||St(t,e)&&P(t.prev,t,t.next)>0&&P(e.prev,e,e.next)>0)}function P(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function St(t,e){return t.x===e.x&&t.y===e.y}function be(t,e,n,r){let o=It(P(t,e,n)),i=It(P(t,e,r)),s=It(P(n,r,t)),a=It(P(n,r,e));return!!(o!==i&&s!==a||o===0&&Ft(t,n,e)||i===0&&Ft(t,r,e)||s===0&&Ft(n,t,r)||a===0&&Ft(n,e,r))}function Ft(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function It(t){return t>0?1:t<0?-1:0}function nr(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&be(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function st(t,e){return P(t.prev,t,t.next)<0?P(t,e,t.next)>=0&&P(t,t.prev,e)>=0:P(t,e,t.prev)<0||P(t,t.next,e)<0}function rr(t,e){let n=t,r=!1,o=(t.x+e.x)/2,i=(t.y+e.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function ve(t,e){let n=new lt(t.i,t.x,t.y),r=new lt(e.i,e.x,e.y),o=t.next,i=e.prev;return t.next=e,e.prev=t,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function Ie(t,e,n,r){let o=new lt(t,e,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function at(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}var lt=class{constructor(e,n,r){w(this,"i",void 0),w(this,"x",void 0),w(this,"y",void 0),w(this,"prev",null),w(this,"next",null),w(this,"z",0),w(this,"prevZ",null),w(this,"nextZ",null),w(this,"steiner",!1),this.i=e,this.x=n,this.y=r}};function Wt(t,e,n){let r=lr(t),o=Object.keys(r).filter(i=>r[i]!==Array);return cr(t,{propArrayTypes:r,...e},{numericPropKeys:n&&n.numericPropKeys||o,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function lr(t){let e={};for(let n of t)if(n.properties)for(let r in n.properties){let o=n.properties[r];e[r]=gr(o,e[r])}return e}function cr(t,e,n){let{pointPositionsCount:r,pointFeaturesCount:o,linePositionsCount:i,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:u,polygonFeaturesCount:f,propArrayTypes:h,coordLength:p}=e,{numericPropKeys:d=[],PositionDataType:y=Float32Array,triangulate:T=!0}=n,v=t[0]&&"id"in t[0],_=t.length>65535?Uint32Array:Uint16Array,g={type:"Point",positions:new y(r*p),globalFeatureIds:new _(r),featureIds:o>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},m={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(i*p),globalFeatureIds:new _(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},S={type:"Polygon",polygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:l>65535?new Uint32Array(u+1):new Uint16Array(u+1),positions:new y(l*p),globalFeatureIds:new _(l),featureIds:f>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};T&&(S.triangles=[]);for(let I of[g,m,S])for(let A of d){let B=h[A];I.numericProps[A]=new B(I.positions.length/p)}m.pathIndices[s]=i,S.polygonIndices[c]=l,S.primitivePolygonIndices[u]=l;let b={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let I of t){let A=I.geometry,B=I.properties||{};switch(A.type){case"Point":fr(A,g,b,p,B),g.properties.push(Jt(B,d)),v&&g.fields.push({id:I.id}),b.pointFeature++;break;case"LineString":ur(A,m,b,p,B),m.properties.push(Jt(B,d)),v&&m.fields.push({id:I.id}),b.lineFeature++;break;case"Polygon":hr(A,S,b,p,B),S.properties.push(Jt(B,d)),v&&S.fields.push({id:I.id}),b.polygonFeature++;break;default:throw new Error("Invalid geometry type")}b.feature++}return dr(g,m,S,p)}function fr(t,e,n,r,o){e.positions.set(t.data,n.pointPosition*r);let i=t.data.length/r;Yt(e,o,n.pointPosition,i),e.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),e.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function ur(t,e,n,r,o){e.positions.set(t.data,n.linePosition*r);let i=t.data.length/r;Yt(e,o,n.linePosition,i),e.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),e.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let s=0,a=t.indices.length;s<a;++s){let l=t.indices[s],c=s===a-1?t.data.length:t.indices[s+1];e.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(c-l)/r}}function hr(t,e,n,r,o){e.positions.set(t.data,n.polygonPosition*r);let i=t.data.length/r;Yt(e,o,n.polygonPosition,i),e.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),e.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let s=0,a=t.indices.length;s<a;++s){let l=n.polygonPosition;e.polygonIndices[n.polygonObject++]=l;let c=t.areas[s],u=t.indices[s],f=t.indices[s+1];for(let p=0,d=u.length;p<d;++p){let y=u[p],T=p===d-1?f===void 0?t.data.length:f[0]:u[p+1];e.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(T-y)/r}let h=n.polygonPosition;pr(e,c,u,{startPosition:l,endPosition:h,coordLength:r})}}function pr(t,e,n,{startPosition:r,endPosition:o,coordLength:i}){if(!t.triangles)return;let s=r*i,a=o*i,l=t.positions.subarray(s,a),c=n[0],u=n.slice(1).map(h=>(h-c)/i),f=Ht(l,u,i,e);for(let h=0,p=f.length;h<p;++h)t.triangles.push(r+f[h])}function Zt(t,e){let n={};for(let r in t)n[r]={value:t[r],size:e};return n}function dr(t,e,n,r){let o={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:r},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Zt(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:r},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Zt(e.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:Zt(n.numericProps,1)}};return o.polygons&&n.triangles&&(o.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),o}function Yt(t,e,n,r){for(let o in t.numericProps)if(o in e){let i=e[o];t.numericProps[o].fill(i,n,n+r)}}function Jt(t,e){let n={};for(let r in t)e.includes(r)||(n[r]=t[r]);return n}function gr(t,e){return e===Array||!Number.isFinite(t)?Array:e===Float64Array||Math.fround(t)!==t?Float64Array:Float32Array}function ct(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var D={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},mr=D.self||D.window||D.global||{},yr=D.window||D.self||D.global||{},xr=D.global||D.self||D.window||{},wr=D.document||{};var Xt=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Be=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Tr=Be&&parseFloat(Be[1])||0;function $t(t){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let e=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,n=t||e;return!!(n&&n.indexOf("Electron")>=0)}function L(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||$t()}var Pr=globalThis.self||globalThis.window||globalThis.global,Y=globalThis.window||globalThis.self||globalThis.global,Fr=globalThis.document||{},R=globalThis.process||{},Ir=globalThis.console,as=globalThis.navigator||{};var bt=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",fs=L();function Sr(t){try{let e=window[t],n="__storage_test__";return e.setItem(n,n),e.removeItem(n),e}catch{return null}}var vt=class{constructor(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";w(this,"storage",void 0),w(this,"id",void 0),w(this,"config",void 0),this.storage=Sr(r),this.id=e,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let e={};if(this.storage){let n=this.storage.getItem(this.id);e=n?JSON.parse(n):{}}return Object.assign(this.config,e),this}};function Ee(t){let e;return t<10?e="".concat(t.toFixed(2),"ms"):t<100?e="".concat(t.toFixed(1),"ms"):t<1e3?e="".concat(t.toFixed(0),"ms"):e="".concat((t/1e3).toFixed(2),"s"),e}function Me(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,n=Math.max(e-t.length,0);return"".concat(" ".repeat(n)).concat(t)}function _t(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>r&&(n=Math.min(n,r/t.width));let i=t.width*n,s=t.height*n,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(o,");"),"background-size:".concat(i,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}var At;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(At||(At={}));var br=10;function Le(t){return typeof t!="string"?t:(t=t.toUpperCase(),At[t]||At.WHITE)}function Ve(t,e,n){if(!L&&typeof t=="string"){if(e){let r=Le(e);t="\x1B[".concat(r,"m").concat(t,"\x1B[39m")}if(n){let r=Le(n);t="\x1B[".concat(r+br,"m").concat(t,"\x1B[49m")}}return t}function De(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],n=Object.getPrototypeOf(t),r=Object.getOwnPropertyNames(n),o=t;for(let i of r){let s=o[i];typeof s=="function"&&(e.find(a=>i===a)||(o[i]=s.bind(t)))}}function X(t,e){if(!t)throw new Error(e||"Assertion failed")}function z(){let t;if(L()&&Y.performance){var e,n;t=Y===null||Y===void 0||(e=Y.performance)===null||e===void 0||(n=e.now)===null||n===void 0?void 0:n.call(e)}else if("hrtime"in R){var r;let o=R===null||R===void 0||(r=R.hrtime)===null||r===void 0?void 0:r.call(R);t=o[0]*1e3+o[1]/1e6}else t=Date.now();return t}var $={debug:L()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},vr={enabled:!0,level:0};function E(){}var Ce={},Ne={once:!0},U=class{constructor(){let{id:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};w(this,"id",void 0),w(this,"VERSION",bt),w(this,"_startTs",z()),w(this,"_deltaTs",z()),w(this,"_storage",void 0),w(this,"userData",{}),w(this,"LOG_THROTTLE_TIMEOUT",0),this.id=e,this.userData={},this._storage=new vt("__probe-".concat(this.id,"__"),vr),this.timeStamp("".concat(this.id," started")),De(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((z()-this._startTs).toPrecision(10))}getDelta(){return Number((z()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,n){this._storage.setConfiguration({[e]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,n){X(e,n)}warn(e){return this._getLogFunction(0,e,$.warn,arguments,Ne)}error(e){return this._getLogFunction(0,e,$.error,arguments)}deprecated(e,n){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(n,"` instead"))}removed(e,n){return this.error("`".concat(e,"` has been removed. Use `").concat(n,"` instead"))}probe(e,n){return this._getLogFunction(e,n,$.log,arguments,{time:!0,once:!0})}log(e,n){return this._getLogFunction(e,n,$.debug,arguments)}info(e,n){return this._getLogFunction(e,n,console.info,arguments)}once(e,n){return this._getLogFunction(e,n,$.debug||$.info,arguments,Ne)}table(e,n,r){return n?this._getLogFunction(e,n,console.table||E,r&&[r],{tag:Er(n)}):E}image(e){let{logLevel:n,priority:r,image:o,message:i="",scale:s=1}=e;return this._shouldLog(n||r)?L()?Br({image:o,message:i,scale:s}):Ar({image:o,message:i,scale:s}):E}time(e,n){return this._getLogFunction(e,n,console.time?console.time:console.info)}timeEnd(e,n){return this._getLogFunction(e,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,n){return this._getLogFunction(e,n,console.timeStamp||E)}group(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=ke({logLevel:e,message:n,opts:r}),{collapsed:i}=r;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(e,n,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||E)}withGroup(e,n,r){this.group(e,n)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Ue(e)}_getLogFunction(e,n,r,o,i){if(this._shouldLog(e)){i=ke({logLevel:e,message:n,args:o,opts:i}),r=r||i.method,X(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=z();let s=i.tag||i.message;if(i.once&&s)if(!Ce[s])Ce[s]=z();else return E;return n=_r(this.id,i.message,i),r.bind(console,n,...i.args)}return E}};w(U,"VERSION",bt);function Ue(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return X(Number.isFinite(e)&&e>=0),e}function ke(t){let{logLevel:e,message:n}=t;t.logLevel=Ue(e);let r=t.args?Array.from(t.args):[];for(;r.length&&r.shift()!==n;);switch(typeof e){case"string":case"function":n!==void 0&&r.unshift(n),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let o=typeof t.message;return X(o==="string"||o==="object"),Object.assign(t,{args:r},t.opts)}function _r(t,e,n){if(typeof e=="string"){let r=n.time?Me(Ee(n.total)):"";e=n.time?"".concat(t,": ").concat(r," ").concat(e):"".concat(t,": ").concat(e),e=Ve(e,n.color,n.background)}return e}function Ar(t){let{image:e,message:n="",scale:r=1}=t;return console.warn("removed"),E}function Br(t){let{image:e,message:n="",scale:r=1}=t;if(typeof e=="string"){let i=new Image;return i.onload=()=>{let s=_t(i,n,r);console.log(...s)},i.src=e,E}let o=e.nodeName||"";if(o.toLowerCase()==="img")return console.log(..._t(e,n,r)),E;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(..._t(i,n,r)),i.src=e.toDataURL(),E}return E}function Er(t){for(let e in t)for(let n in t[e])return n||"untitled";return"empty"}var ks=new U({id:"@probe.gl/log"});var Kt="4.3.0-alpha.1",Mr=Kt[0]>="0"&&Kt[0]<="9"?`v${Kt}`:"";function Lr(){let t=new U({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=t,globalThis.loaders.version=Mr,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=t,t}var F=Lr();var Vr="",Ge={};function Qt(t){for(let e in Ge)if(t.startsWith(e)){let n=Ge[e];t=t.replace(e,n)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${Vr}${t}`),t}var ft=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(e){this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=Dr(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){let n=this._needsRefresh;return e&&(this._needsRefresh=!1),n}};function Dr(t){let e=t?.fetch;if(e&&typeof e=="function")return(r,o)=>e(r,o);let n=t?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var ne=xe(Je(),1);function Qr(t){let e=0;for(let n=0,r=t.length-1,o,i;n<t.length;r=n++)o=t[n],i=t[r],e+=(i[0]-o[0])*(o[1]+i[1]);return e}function ut(t,e){if(Array.isArray(t[0])){for(let r of t)ut(r,e);return}let n=t;n[0]/=e,n[1]/=e}function We(t,e){for(let n=0,r=t.length;n<r;++n)t[n]/=e}function ht(t,e,n){if(typeof t[0][0]!="number"){for(let s of t)ht(s,e,n);return}let r=n*Math.pow(2,e.z),o=n*e.x,i=n*e.y;for(let s=0;s<t.length;s++){let a=t[s];a[0]=(a[0]+o)*360/r-180;let l=180-(a[1]+i)*360/r;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function Ye(t,e,n){let{x:r,y:o,z:i}=e,s=n*Math.pow(2,i),a=n*r,l=n*o;for(let c=0,u=t.length;c<u;c+=2){t[c]=(t[c]+a)*360/s-180;let f=180-(t[c+1]+l)*360/s;t[c+1]=360/Math.PI*Math.atan(Math.exp(f*Math.PI/180))-90}}function Xe(t){let e=t.length;if(e<=1)return[t];let n=[],r,o;for(let i=0;i<e;i++){let s=Qr(t[i]);s!==0&&(o===void 0&&(o=s<0),o===s<0?(r&&n.push(r),r=[t[i]]):r&&r.push(t[i]))}return r&&n.push(r),n}function $e(t){let e=t.indices.length,n="Polygon";if(e<=1)return{type:n,data:t.data,areas:[[j(t.data)]],indices:[t.indices]};let r=[],o=[],i=[],s=[],a,l=0;for(let c,u=0,f;u<e;u++){f=t.indices[u]-l,c=t.indices[u+1]-l||t.data.length;let h=t.data.slice(f,c),p=j(h);if(p===0){let d=t.data.slice(0,f),y=t.data.slice(c);t.data=d.concat(y),l+=c-f;continue}a===void 0&&(a=p<0),a===p<0?(s.length&&(r.push(i),o.push(s)),s=[f],i=[p]):(i.push(p),s.push(f))}return i&&r.push(i),s.length&&o.push(s),{type:n,areas:r,indices:o,data:t.data}}var H=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(e,n,r,o,i,s){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=o,this._values=i,this._geometryInfo=s,e.readFields(qr,this,n)}toGeoJSONFeature(e,n){let r=this.loadGeometry();switch(e){case"wgs84":return Ke(this,r,o=>ht(o,n,this.extent));default:return Ke(this,r,ut)}}toBinaryFeature(e,n){let r=this.loadFlatGeometry();switch(e){case"wgs84":return this._toBinaryCoordinates(r,o=>Ye(o,n,this.extent));default:return this._toBinaryCoordinates(r,We)}}bbox(){let e=this._pbf;e.pos=this._geometry;let n=e.readVarint()+e.pos,r=1,o=0,i=0,s=0,a=1/0,l=-1/0,c=1/0,u=-1/0;for(;e.pos<n;){if(o<=0){let f=e.readVarint();r=f&7,o=f>>3}if(o--,r===1||r===2)i+=e.readSVarint(),s+=e.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<c&&(c=s),s>u&&(u=s);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,c,l,u]}_toBinaryCoordinates(e,n){let r;n(e.data,this.extent);let o=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=e.indices.length,r={type:"Point",...e};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=e.indices.length,this._geometryInfo.linePositionsCount+=e.data.length/o,r={type:"LineString",...e};break;case 3:r=$e(e),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let s of r.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=r.data.length/o;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let n=e.readVarint()+e.pos,r=1,o=0,i=0,s=0,a=[],l;for(;e.pos<n;){if(o<=0){let c=e.readVarint();r=c&7,o=c>>3}switch(o--,r){case 1:case 2:i+=e.readSVarint(),s+=e.readSVarint(),r===1&&(l&&a.push(l),l=[]),l&&l.push([i,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${r}`)}}return l&&a.push(l),a}loadFlatGeometry(){let e=this._pbf;e.pos=this._geometry;let n=e.readVarint()+e.pos,r=1,o,i=0,s=0,a=0,l=0,c=[],u=[];for(;e.pos<n;)if(i<=0&&(o=e.readVarint(),r=o&7,i=o>>3),i--,r===1||r===2)s+=e.readSVarint(),a+=e.readSVarint(),r===1&&c.push(l),u.push(s,a),l+=2;else if(r===7){if(l>0){let f=c[c.length-1];u.push(u[f],u[f+1]),l+=2}}else throw new Error(`unknown command ${r}`);return{data:u,indices:c}}};rt(H,"types",["Unknown","Point","LineString","Polygon"]);function Ke(t,e,n){let r=H.types[t.type],o,i,s;switch(t.type){case 1:let l=[];for(o=0;o<e.length;o++)l[o]=e[o][0];s=l,n(s,t.extent);break;case 2:for(s=e,o=0;o<s.length;o++)n(s[o],t.extent);break;case 3:for(s=Xe(e),o=0;o<s.length;o++)for(i=0;i<s[o].length;i++)n(s[o][i],t.extent);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:r=`Multi${r}`;let a={type:"Feature",geometry:{type:r,coordinates:s},properties:t.properties};return t.id!==null&&(a.properties||={},a.properties.id=t.id),a}function qr(t,e,n){e&&n&&(t===1?e.id=n.readVarint():t===2?to(n,e):t===3?e.type=n.readVarint():t===4&&(e._geometry=n.pos))}function to(t,e){let n=t.readVarint()+t.pos;for(;t.pos<n;){let r=e._keys[t.readVarint()],o=e._values[t.readVarint()];e.properties[r]=o}}var Mt=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(e,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(eo,this,n),this.length=this._features.length}getGeoJSONFeature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let n=this._pbf.readVarint()+this._pbf.pos;return new H(this._pbf,n,this.extent,this._keys,this._values)}getBinaryFeature(e,n){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let r=this._pbf.readVarint()+this._pbf.pos;return new H(this._pbf,r,this.extent,this._keys,this._values,n)}};function eo(t,e,n){e&&n&&(t===15?e.version=n.readVarint():t===1?e.name=n.readString():t===5?e.extent=n.readVarint():t===2?e._features.push(n.pos):t===3?e._keys.push(n.readString()):t===4&&e._values.push(no(n)))}function no(t){let e=null,n=t.readVarint()+t.pos;for(;t.pos<n;){let r=t.readVarint()>>3;e=r===1?t.readString():r===2?t.readFloat():r===3?t.readDouble():r===4?t.readVarint64():r===5?t.readVarint():r===6?t.readSVarint():r===7?t.readBoolean():null}return e}var pt=class{layers;constructor(e,n){this.layers=e.readFields(ro,{},n)}};function ro(t,e,n){if(t===3&&n){let r=new Mt(n,n.readVarint()+n.pos);r.length&&e&&(e[r.name]=r)}}function re(t,e){let n=io(e),r=e?.gis?.format||e?.mvt?.shape||e?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:ee(t,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Qe(t,n)};case"geojson":return Qe(t,n);case"binary-geometry":return ee(t,n);case"binary":return ee(t,n);default:throw new Error(r||"undefined shape")}}function ee(t,e){let[n,r]=oo(t,e),o=Wt(n,r);return o.byteLength=t.byteLength,o}function oo(t,e){let n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength<=0)return[n,r];let o=new pt(new ne.default(t));return(e&&Array.isArray(e.layers)?e.layers:Object.keys(o.layers)).forEach(s=>{let a=o.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,r),u=ao(c,e,s);n.push(u)}}),[n,r]}function Qe(t,e){if(t.byteLength<=0)return[];let n=[],r=new pt(new ne.default(t));return(Array.isArray(e.layers)?e.layers:Object.keys(r.layers)).forEach(i=>{let s=r.layers[i];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=so(l,e,i);n.push(c)}}),n}function io(t){if(!t?.mvt)throw new Error("mvt options required");if(t.mvt?.coordinates==="wgs84"&&!t.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return t.gis&&F.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),t.mvt}function so(t,e,n){let r=t.toGeoJSONFeature(e.coordinates||"local",e.tileIndex);return e.layerProperty&&(r.properties||={},r.properties[e.layerProperty]=n),r}function ao(t,e,n){let r=t.toBinaryFeature(e.coordinates||"local",e.tileIndex);return e.layerProperty&&r.properties&&(r.properties[e.layerProperty]=n),r}var lo="4.3.0-alpha.1",oe={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:lo,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},Lt={...oe,parse:async(t,e)=>re(t,e),parseSync:re,binary:!0};var nn=t=>t!==null&&typeof t=="object";function ie(t,e){if(!t||!nn(t))return null;let n={name:t.name||"",description:t.description||""};if(typeof t.generator=="string"&&(n.generator=t.generator),typeof t.generator_options=="string"&&(n.generatorOptions=t.generator_options),n.boundingBox=qe(t.bounds)||qe(t.antimeridian_adjusted_bounds),n.center=go(t.center),n.maxZoom=tn(t.maxzoom),n.minZoom=tn(t.minzoom),typeof t?.json=="string")try{n.metaJson=JSON.parse(t.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let r=t.tilestats||n.metaJson?.tilestats,o=uo(r,e),i=co(t.vector_layers),s=po(i,o);return n={...n,layers:s},n.maxZoom===null&&s.length>0&&(n.maxZoom=s[0].maxZoom||null),n.minZoom===null&&s.length>0&&(n.minZoom=s[0].minZoom||null),n}function co(t){return Array.isArray(t)?t.map(e=>fo(e)):[]}function fo(t){let e=Object.entries(t.fields||[]).map(([r,o])=>({name:r,...an(String(o))})),n={...t};return delete n.fields,{name:t.id||"",...n,fields:e}}function uo(t,e){return nn(t)&&Array.isArray(t.layers)?t.layers.map(n=>ho(n,e)):[]}function ho(t,e){let n=[],r={},o=t.attributes||[];for(let i of o){let s=i.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];r[a]=r[a]||[],r[a].push(i),console.warn("ignoring tilestats indexed field",a)}else n[s]||n.push(yo(i,e))}return{name:t.layer||"",dominantGeometry:t.geometry,fields:n}}function po(t,e){return t.map(n=>{let r=e.find(s=>s.name===n.name),o=r?.fields||[],i={...n};return delete i.fields,{...i,...r,fields:o}})}function qe(t){let e=sn(t);if(Array.isArray(e)&&e.length===4&&[e[0],e[2]].every(on)&&[e[1],e[3]].every(rn))return[[e[0],e[1]],[e[2],e[3]]]}function go(t){let e=sn(t);return Array.isArray(e)&&e.length===3&&on(e[0])&&rn(e[1])&&mo(e[2])?e:null}function tn(t){let e=typeof t=="string"?parseFloat(t):typeof t=="number"?t:null;return e===null||isNaN(e)?null:e}function rn(t){return Number.isFinite(t)&&t<=90&&t>=-90}function on(t){return Number.isFinite(t)&&t<=180&&t>=-180}function mo(t){return Number.isFinite(t)&&t>=0&&t<=22}function sn(t){return typeof t=="string"?t.split(",").map(parseFloat):Array.isArray(t)?t:null}var en={number:{type:"float32"},numeric:{type:"float32"},string:{type:"utf8"},vachar:{type:"utf8"},float:{type:"float32"},int:{type:"int32"},int4:{type:"int32"},boolean:{type:"boolean"},bool:{type:"boolean"}};function yo(t={},e){let n=an(t.type),r={name:t.attribute,...n};return typeof t.min=="number"&&(r.min=t.min),typeof t.max=="number"&&(r.max=t.max),typeof t.count=="number"&&(r.uniqueValueCount=t.count),t.values&&(r.values=t.values),r.values&&typeof e.maxValues=="number"&&(r.values=r.values?.slice(0,e.maxValues)),r}function an(t){let e=t.toLowerCase();return!e||en[e],en[e]||{type:"string"}}var xo="4.3.0-alpha.1",q={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:xo,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(t,e)=>{let n=new TextDecoder().decode(t),r=JSON.parse(n),o={...q.options.tilejson,...e?.tilejson};return ie(r,o)},parseTextSync:(t,e)=>{let n=JSON.parse(t),r={...q.options.tilejson,...e?.tilejson};return ie(n,r)}};var ln="4.3.0-alpha.1";var wo=globalThis.loaders?.parseImageNode,se=typeof Image<"u",ae=typeof ImageBitmap<"u",To=Boolean(wo),le=Xt?!0:To;function cn(t){switch(t){case"auto":return ae||se||le;case"imagebitmap":return ae;case"image":return se;case"data":return le;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function fn(){if(ae)return"imagebitmap";if(se)return"image";if(le)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Po(t){let e=Fo(t);if(!e)throw new Error("Not an image");return e}function un(t){switch(Po(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),n=e.getContext("2d");if(!n)throw new Error("getImageData");return e.width=t.width,e.height=t.height,n.drawImage(t,0,0),n.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Fo(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Io=/^data:image\/svg\+xml/,So=/\.svg((\?|#).*)?$/;function Vt(t){return t&&(Io.test(t)||So.test(t))}function hn(t,e){if(Vt(e)){let r=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return ce(t,e)}function ce(t,e){if(Vt(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function Dt(t,e,n){let r=hn(t,n),o=self.URL||self.webkitURL,i=typeof r!="string"&&o.createObjectURL(r);try{return await bo(i||r,e)}finally{i&&o.revokeObjectURL(i)}}async function bo(t,e){let n=new Image;return n.src=t,e.image&&e.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,o)=>{try{n.onload=()=>r(n),n.onerror=i=>{let s=i instanceof Error?i.message:"error";o(new Error(s))}}catch(i){o(i)}})}var vo={},pn=!0;async function dn(t,e,n){let r;Vt(n)?r=await Dt(t,e,n):r=ce(t,n);let o=e&&e.imagebitmap;return await _o(r,o)}async function _o(t,e=null){if((Ao(e)||!pn)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(n){console.warn(n),pn=!1}return await createImageBitmap(t)}function Ao(t){for(let e in t||vo)return!1;return!0}function gn(t){return!Lo(t,"ftyp",4)||!(t[8]&96)?null:Bo(t)}function Bo(t){switch(Eo(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Eo(t,e,n){return String.fromCharCode(...t.slice(e,n))}function Mo(t){return[...t].map(e=>e.charCodeAt(0))}function Lo(t,e,n=0){let r=Mo(e);for(let o=0;o<r.length;++o)if(r[o]!==t[o+n])return!1;return!0}var C=!1,dt=!0;function Z(t){let e=gt(t);return Do(e)||ko(e)||Co(e)||No(e)||Vo(e)}function Vo(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),n=gn(e);return n?{mimeType:n.mimeType,width:0,height:0}:null}function Do(t){let e=gt(t);return e.byteLength>=24&&e.getUint32(0,C)===2303741511?{mimeType:"image/png",width:e.getUint32(16,C),height:e.getUint32(20,C)}:null}function Co(t){let e=gt(t);return e.byteLength>=10&&e.getUint32(0,C)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,dt),height:e.getUint16(8,dt)}:null}function No(t){let e=gt(t);return e.byteLength>=14&&e.getUint16(0,C)===16973&&e.getUint32(2,dt)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,dt),height:e.getUint32(22,dt)}:null}function ko(t){let e=gt(t);if(!(e.byteLength>=3&&e.getUint16(0,C)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:o}=Uo(),i=2;for(;i+9<e.byteLength;){let s=e.getUint16(i,C);if(o.has(s))return{mimeType:"image/jpeg",height:e.getUint16(i+5,C),width:e.getUint16(i+7,C)};if(!r.has(s))return null;i+=2,i+=e.getUint16(i,C)}return null}function Uo(){let t=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)t.add(n);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function gt(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function mn(t,e){let{mimeType:n}=Z(t)||{},r=globalThis.loaders?.parseImageNode;return ct(r),await r(t,n)}async function yn(t,e,n){e=e||{};let o=(e.image||{}).type||"auto",{url:i}=n||{},s=Go(o),a;switch(s){case"imagebitmap":a=await dn(t,e,i);break;case"image":a=await Dt(t,e,i);break;case"data":a=await mn(t,e);break;default:ct(!1)}return o==="data"&&(a=un(a)),a}function Go(t){switch(t){case"auto":case"data":return fn();default:return cn(t),t}}var jo=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Oo=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Ro={image:{type:"auto",decode:!0}},fe={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:ln,mimeTypes:Oo,extensions:jo,parse:yn,tests:[t=>Boolean(Z(new DataView(t)))],options:Ro};var Ct=class extends ft{props;url;metadataUrl=null;data;schema="tms";metadata;extension;mimeType=null;constructor(e){super(e),this.props=e,this.url=Qt(e.url),this.metadataUrl=e.metadataUrl===void 0?`${this.url}/tilejson.json`:e.metadataUrl,this.extension=e.extension||".png",this.data=this.url,this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata(),zo(this.url)&&(this.schema="template")}async getMetadata(){if(!this.metadataUrl)return null;let e;try{e=await this.fetch(this.metadataUrl)}catch(o){return console.error(o.message),null}if(!e.ok)return console.error(e.statusText),null;let n=await e.text();return q.parseTextSync?.(n)||null}getTileMIMEType(){return this.mimeType}async getTile(e){let{x:n,y:r,z:o}=e,i=this.getTileURL(n,r,o),s=await this.fetch(i);return s.ok?await s.arrayBuffer():null}async getTileData(e){let{x:n,y:r,z:o}=e.index,i=await this.getTile({x:n,y:r,z:o,layers:[]});if(i===null)return null;let s=Z(i);switch(this.mimeType=this.mimeType||s?.mimeType||"application/vnd.mapbox-vector-tile",this.mimeType){case"application/vnd.mapbox-vector-tile":return await this._parseVectorTile(i,{x:n,y:r,z:o,layers:[]});default:return await this._parseImageTile(i)}}async getImageTile(e){let n=await this.getTile(e);return n?this._parseImageTile(n):null}async _parseImageTile(e){return await fe.parse(e,this.loadOptions)}async getVectorTile(e){let n=await this.getTile(e);return n?this._parseVectorTile(n,e):null}async _parseVectorTile(e,n){let r={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:n.x,y:n.y,z:n.z},...this.loadOptions?.mvt},...this.loadOptions};return await Lt.parse(e,r)}getMetadataUrl(){return this.metadataUrl}getTileURL(e,n,r){switch(this.schema){case"xyz":return`${this.url}/${e}/${n}/${r}${this.extension}`;case"tms":return`${this.url}/${r}/${e}/${n}${this.extension}`;case"template":return Wo(this.url,e,n,r,"0");default:throw new Error(this.schema)}}};function zo(t){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(t)}var Ho=new RegExp("{x}","g"),Zo=new RegExp("{y}","g"),Jo=new RegExp("{z}","g");function Wo(t,e,n,r,o="0"){if(Array.isArray(t)){let s=Yo(o)%t.length;t=t[s]}let i=t;return i=i.replace(Ho,String(e)),i=i.replace(Zo,String(n)),i=i.replace(Jo,String(r)),Number.isInteger(n)&&Number.isInteger(r)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,r)-n-1))),i}function Yo(t){return Math.abs(t.split("").reduce((e,n)=>(e<<5)-e+n.charCodeAt(0)|0,0))}function mt(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var M=class{constructor(e,n){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=n,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=mt(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(mt()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var J=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,n="count"){return this._getOrCreate({name:e,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let n of Object.values(this.stats))e(n)}getTable(){let e={};return this.forEach(n=>{e[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(n=>this._getOrCreate(n))}_getOrCreate(e){let{name:n,type:r}=e,o=this.stats[n];return o||(e instanceof M?o=e:o=new M(n,r),this.stats[n]=o),o}};function Nt(t,e,n,r){let o=r,i=n-e>>1,s=n-e,a,l=t[e],c=t[e+1],u=t[n],f=t[n+1];for(let h=e+3;h<n;h+=3){let p=Xo(t[h],t[h+1],l,c,u,f);if(p>o)a=h,o=p;else if(p===o){let d=Math.abs(h-i);d<s&&(a=h,s=d)}}o>r&&(a-e>3&&Nt(t,e,a,r),t[a+2]=o,n-a>3&&Nt(t,a,n,r))}function Xo(t,e,n,r,o,i){let s=o-n,a=i-r;if(s!==0||a!==0){let l=((t-n)*s+(e-r)*a)/(s*s+a*a);l>1?(n=o,r=i):l>0&&(n+=s*l,r+=a*l)}return s=t-n,a=e-r,s*s+a*a}function G(t,e,n,r){let o={id:t??null,type:e,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")kt(o,n);else if(e==="Polygon")kt(o,n[0]);else if(e==="MultiLineString")for(let i of n)kt(o,i);else if(e==="MultiPolygon")for(let i of n)kt(o,i[0]);return o}function kt(t,e){for(let n=0;n<e.length;n+=3)t.minX=Math.min(t.minX,e[n]),t.minY=Math.min(t.minY,e[n+1]),t.maxX=Math.max(t.maxX,e[n]),t.maxY=Math.max(t.maxY,e[n+1])}function wn(t,e){let n=[];if(t.type==="FeatureCollection")for(let r=0;r<t.features.length;r++)Ut(n,t.features[r],e,r);else t.type==="Feature"?Ut(n,t,e):Ut(n,{geometry:t},e);return n}function Ut(t,e,n,r){if(!e.geometry)return;let o=e.geometry.coordinates,i=e.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),a=[],l=e.id;if(n.promoteId?l=e.properties[n.promoteId]:n.generateId&&(l=r||0),i==="Point")xn(o,a);else if(i==="MultiPoint")for(let c of o)xn(c,a);else if(i==="LineString")he(o,a,s,!1);else if(i==="MultiLineString")if(n.lineMetrics){for(let c of o)a=[],he(c,a,s,!1),t.push(G(l,"LineString",a,e.properties));return}else ue(o,a,s,!1);else if(i==="Polygon")ue(o,a,s,!0);else if(i==="MultiPolygon")for(let c of o){let u=[];ue(c,u,s,!0),a.push(u)}else if(i==="GeometryCollection"){for(let c of e.geometry.geometries)Ut(t,{id:l,geometry:c,properties:e.properties},n,r);return}else throw new Error("Input data is not a valid GeoJSON object.");t.push(G(l,i,a,e.properties))}function xn(t,e){e.push(Tn(t[0]),Pn(t[1]),0)}function he(t,e,n,r){let o,i,s=0;for(let l=0;l<t.length;l++){let c=Tn(t[l][0]),u=Pn(t[l][1]);e.push(c,u,0),l>0&&(r?s+=(o*u-c*i)/2:s+=Math.sqrt(Math.pow(c-o,2)+Math.pow(u-i,2))),o=c,i=u}let a=e.length-3;e[2]=1,Nt(e,0,a,n),e[a+2]=1,e.size=Math.abs(s),e.start=0,e.end=e.size}function ue(t,e,n,r){for(let o=0;o<t.length;o++){let i=[];he(t[o],i,n,r),e.push(i)}}function Tn(t){return t/360+.5}function Pn(t){let e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function V(t,e,n,r,o,i,s,a){if(n/=e,r/=e,i>=n&&s<r)return t;if(s<n||i>=r)return null;let l=[];for(let c of t){let u=c.geometry,f=c.type,h=o===0?c.minX:c.minY,p=o===0?c.maxX:c.maxY;if(h>=n&&p<r){l.push(c);continue}else if(p<n||h>=r)continue;let d=[];if(f==="Point"||f==="MultiPoint")$o(u,d,n,r,o);else if(f==="LineString")In(u,d,n,r,o,!1,a.lineMetrics);else if(f==="MultiLineString")pe(u,d,n,r,o,!1);else if(f==="Polygon")pe(u,d,n,r,o,!0);else if(f==="MultiPolygon")for(let y of u){let T=[];pe(y,T,n,r,o,!0),T.length&&d.push(T)}if(d.length){if(a.lineMetrics&&f==="LineString"){for(let y of d)l.push(G(c.id,f,y,c.tags));continue}(f==="LineString"||f==="MultiLineString")&&(d.length===1?(f="LineString",d=d[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=d.length===3?"Point":"MultiPoint"),l.push(G(c.id,f,d,c.tags))}}return l.length?l:null}function $o(t,e,n,r,o){for(let i=0;i<t.length;i+=3){let s=t[i+o];s>=n&&s<=r&&tt(e,t[i],t[i+1],t[i+2])}}function In(t,e,n,r,o,i,s){let a=Fn(t),l=o===0?Ko:Qo,c=t.start,u,f;for(let v=0;v<t.length-3;v+=3){let _=t[v],g=t[v+1],m=t[v+2],S=t[v+3],b=t[v+4],I=o===0?_:g,A=o===0?S:b,B=!1;s&&(u=Math.sqrt(Math.pow(_-S,2)+Math.pow(g-b,2))),I<n?A>n&&(f=l(a,_,g,S,b,n),s&&(a.start=c+u*f)):I>r?A<r&&(f=l(a,_,g,S,b,r),s&&(a.start=c+u*f)):tt(a,_,g,m),A<n&&I>=n&&(f=l(a,_,g,S,b,n),B=!0),A>r&&I<=r&&(f=l(a,_,g,S,b,r),B=!0),!i&&B&&(s&&(a.end=c+u*f),e.push(a),a=Fn(t)),s&&(c+=u)}let h=t.length-3,p=t[h],d=t[h+1],y=t[h+2],T=o===0?p:d;T>=n&&T<=r&&tt(a,p,d,y),h=a.length-3,i&&h>=3&&(a[h]!==a[0]||a[h+1]!==a[1])&&tt(a,a[0],a[1],a[2]),a.length&&e.push(a)}function Fn(t){let e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function pe(t,e,n,r,o,i){for(let s of t)In(s,e,n,r,o,i,!1)}function tt(t,e,n,r){t.push(e,n,r)}function Ko(t,e,n,r,o,i){let s=(i-e)/(r-e);return tt(t,i,n+(o-n)*s,1),s}function Qo(t,e,n,r,o,i){let s=(i-n)/(o-n);return tt(t,e+(r-e)*s,i,1),s}function bn(t,e){let n=e.buffer/e.extent,r=t,o=V(t,1,-1-n,n,0,-1,2,e),i=V(t,1,1-n,2+n,0,-1,2,e);return(o||i)&&(r=V(t,1,-n,1+n,0,-1,2,e)||[],o&&(r=Sn(o,1).concat(r)),i&&(r=r.concat(Sn(i,-1)))),r}function Sn(t,e){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=o.type,s;if(i==="Point"||i==="MultiPoint"||i==="LineString")s=de(o.geometry,e);else if(i==="MultiLineString"||i==="Polygon"){s=[];for(let a of o.geometry)s.push(de(a,e))}else if(i==="MultiPolygon"){s=[];for(let a of o.geometry){let l=[];for(let c of a)l.push(de(c,e));s.push(l)}}n.push(G(o.id,i,s,o.tags))}return n}function de(t,e){let n=[];n.size=t.size,t.start!==void 0&&(n.start=t.start,n.end=t.end);for(let r=0;r<t.length;r+=3)n.push(t[r]+e,t[r+1],t[r+2]);return n}function ge(t,e){if(t.transformed)return t;let n=1<<t.z,r=t.x,o=t.y;for(let i of t.features){let s=i.geometry,a=i.type;if(i.geometry=[],a===1)for(let l=0;l<s.length;l+=2)i.geometry.push(vn(s[l],s[l+1],e,n,r,o));else for(let l=0;l<s.length;l++){let c=[];for(let u=0;u<s[l].length;u+=2)c.push(vn(s[l][u],s[l][u+1],e,n,r,o));i.geometry.push(c)}}return t.transformed=!0,t}function vn(t,e,n,r,o,i){return[Math.round(n*(t*r-o)),Math.round(n*(e*r-i))]}function _n(t,e,n,r,o){let i=e===o.maxZoom?0:o.tolerance/((1<<e)*o.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:n,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let a of t)qo(s,a,i,o);return s}function qo(t,e,n,r){let o=e.geometry,i=e.type,s=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),i==="Point"||i==="MultiPoint")for(let a=0;a<o.length;a+=3)s.push(o[a],o[a+1]),t.numPoints++,t.numSimplified++;else if(i==="LineString")me(s,o,t,n,!1,!1);else if(i==="MultiLineString"||i==="Polygon")for(let a=0;a<o.length;a++)me(s,o[a],t,n,i==="Polygon",a===0);else if(i==="MultiPolygon")for(let a=0;a<o.length;a++){let l=o[a];for(let c=0;c<l.length;c++)me(s,l[c],t,n,!0,c===0)}if(s.length){let a=e.tags||null;if(i==="LineString"&&r.lineMetrics){a={};for(let c in e.tags)a[c]=e.tags[c];a.mapbox_clip_start=o.start/o.size,a.mapbox_clip_end=o.end/o.size}let l={geometry:s,type:i==="Polygon"||i==="MultiPolygon"?3:i==="LineString"||i==="MultiLineString"?2:1,tags:a};e.id!==null&&(l.id=e.id),t.features.push(l)}}function me(t,e,n,r,o,i){let s=r*r;if(r>0&&e.size<(o?s:r)){n.numPoints+=e.length/3;return}let a=[];for(let l=0;l<e.length;l+=3)(r===0||e[l+2]>s)&&(n.numSimplified++,a.push(e[l],e[l+1])),n.numPoints++;o&&ti(a,i),t.push(a)}function ti(t,e){let n=0;for(let r=0,o=t.length-2;r<t.length;o=r,r+=2)n+=(t[r]-t[o])*(t[r+1]+t[o+1]);if(n>0===e)for(let r=0,o=t.length;r<o/2;r+=2){let i=t[r],s=t[r+1];t[r]=t[o-2-r],t[r+1]=t[o-1-r],t[o-2-r]=i,t[o-1-r]=s}}var yt=class{stats=new J({id:"table-tile-source",stats:[new M("tiles","count"),new M("features","count")]});mimeType="application/vnd.mapbox-vector-tile";localCoordinates=!0;props;schema=null;tiles={};tileCoords=[];ready;metadata;constructor(e,n){this.props={...yt.defaultProps,...n},this.getTileData=this.getTileData.bind(this),this.ready=this.initializeTilesAsync(e),this.metadata=this.getMetadata()}async initializeTilesAsync(e){let n=await e;this.schema=jt(n),this.createRootTiles(n)}async getMetadata(){return await this.ready,{schema:this.schema,minZoom:0,maxZoom:this.props.maxZoom}}async getSchema(){return await this.ready,this.schema}async getVectorTile(e){await this.ready;let n=this.getTileSync(e);return F.info(2,"getVectorTile",e,n)(),n}async getTile(e){return await this.ready,this.getTileSync(e)}async getTileData(e){let{x:n,y:r,z:o}=e.index;return(await this.getVectorTile({x:n,y:r,z:o}))?.features||[]}getTileSync(e){let n=this.getRawTile(e);return n?ei(n,{coordinates:this.props.coordinates,tileIndex:e,extent:this.props.extent}):null}createRootTiles(e){if(this.props.maxZoom<0||this.props.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(this.props.promoteId&&this.props.generateId)throw new Error("promoteId and generateId cannot be used together.");F.log(1,"TableTileSource creating root tiles",this.props)(),F.time(1,"preprocess table")();let n=wn(e,this.props);if(F.timeEnd(1,"preprocess table")(),F.time(1,"generate tiles")(),n=bn(n,this.props),n.length===0){F.log(1,"TableTileSource: no features generated")();return}this.splitTile(n,0,0,0);let r=this.tiles[0];F.log(1,`root tile features: ${r.numFeatures}, points: ${r.numPoints}`)(),F.timeEnd(1,"generate tiles")(),F.log(1,`TableTileSource: tiles generated: ${this.stats.get("total").count}`,this.stats)()}getRawTile(e){let{z:n,y:r}=e,{x:o}=e,{extent:i}=this.props;if(n<0||n>24)return null;let s=1<<n;o=o+s&s-1;let a=ye(n,o,r);if(this.tiles[a])return ge(this.tiles[a],i);F.log(F,"drilling down to z%d-%d-%d",n,o,r)();let l=n,c=o,u=r,f;for(;!f&&l>0;)l--,c=c>>1,u=u>>1,f=this.tiles[ye(l,c,u)];return!f||!f.source?null:(F.log(1,"found parent tile z%d-%d-%d",l,c,u)(),F.time(1,"drilling down")(),this.splitTile(f.source,l,c,u,n,o,r),F.timeEnd(1,"drilling down")(),this.tiles[a]?ge(this.tiles[a],i):null)}splitTile(e,n,r,o,i,s,a){let l=[e,n,r,o];for(;l.length;){o=l.pop(),r=l.pop(),n=l.pop(),e=l.pop();let c=1<<n,u=ye(n,r,o),f=this.tiles[u];if(!f){F.time(2,"tile creation")(),f=this.tiles[u]=_n(e,n,r,o,this.props),this.tileCoords.push({z:n,x:r,y:o});let b=`z${n}`,I=this.stats.get(b,"count");I.incrementCount(),I=this.stats.get("total"),I.incrementCount(),I=yt.stats.get(b,"count"),I.incrementCount(),I=yt.stats.get("total"),I.incrementCount(),F.log(2,"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,r,o,f.numFeatures,f.numPoints,f.numSimplified)(),F.timeEnd(2,"tile creation")()}if(f.source=e,i===void 0){if(n===this.props.indexMaxZoom||f.numPoints<=this.props.maxPointsPerTile)continue}else{if(n===this.props.maxZoom||n===i)continue;if(i!==void 0){let b=i-n;if(r!==s>>b||o!==a>>b)continue}}if(f.source=null,e.length===0)continue;F.time(2,"clipping tile")();let h=.5*this.props.buffer/this.props.extent,p=.5-h,d=.5+h,y=1+h,T=null,v=null,_=null,g=null,m=V(e,c,r-h,r+d,0,f.minX,f.maxX,this.props),S=V(e,c,r+p,r+y,0,f.minX,f.maxX,this.props);e=null,m&&(T=V(m,c,o-h,o+d,1,f.minY,f.maxY,this.props),v=V(m,c,o+p,o+y,1,f.minY,f.maxY,this.props),m=null),S&&(_=V(S,c,o-h,o+d,1,f.minY,f.maxY,this.props),g=V(S,c,o+p,o+y,1,f.minY,f.maxY,this.props),S=null),F.timeEnd(2,"clipping tile")(),l.push(T||[],n+1,r*2,o*2),l.push(v||[],n+1,r*2,o*2+1),l.push(_||[],n+1,r*2+1,o*2),l.push(g||[],n+1,r*2+1,o*2+1)}}},et=yt;rt(et,"defaultProps",{coordinates:"wgs84",maxZoom:14,indexMaxZoom:5,maxPointsPerTile:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:void 0,generateId:!1,debug:0}),rt(et,"stats",new J({id:"table-tile-source-all",stats:[new M("count","tiles"),new M("count","features")]}));function ye(t,e,n){return((1<<t)*n+e)*32+t}function ei(t,e){let n=[];for(let o of t.features){if(!o||!o.geometry)continue;let i,s;switch(o.type){case 1:o.geometry.length===1?(i="Point",s=o.geometry[0]):(i="MultiPoint",s=o.geometry);break;case 2:o.geometry.length===1?(i="LineString",s=o.geometry[0]):(i="MultiLineString",s=o.geometry);break;case 3:o.geometry.length>1?(i="MultiPolygon",s=[o.geometry]):(i="Polygon",s=o.geometry);break;default:continue}switch(e.coordinates){case"EPSG:4326":case"wgs84":ht(s,e.tileIndex,e.extent);break;case"local":ut(s,e.extent);break;default:throw new Error(`Unsupported CRS ${e.coordinates}`)}let a={type:"Feature",geometry:{type:i,coordinates:s},properties:o.tags||{},id:o.id};n.push(a)}return n.length===0?null:{shape:"geojson-table",type:"FeatureCollection",features:n}}return Cn(xt);})();
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
ieee754/index.js:
|