@loaders.gl/mvt 4.3.0-alpha.6 → 4.3.0-alpha.8

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 CHANGED
@@ -1216,52 +1216,6 @@ var __exports__ = (() => {
1216
1216
  };
1217
1217
  }
1218
1218
 
1219
- // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
1220
- function _typeof(obj) {
1221
- "@babel/helpers - typeof";
1222
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
1223
- return typeof obj2;
1224
- } : function(obj2) {
1225
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
1226
- }, _typeof(obj);
1227
- }
1228
-
1229
- // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
1230
- function _toPrimitive(input, hint) {
1231
- if (_typeof(input) !== "object" || input === null)
1232
- return input;
1233
- var prim = input[Symbol.toPrimitive];
1234
- if (prim !== void 0) {
1235
- var res = prim.call(input, hint || "default");
1236
- if (_typeof(res) !== "object")
1237
- return res;
1238
- throw new TypeError("@@toPrimitive must return a primitive value.");
1239
- }
1240
- return (hint === "string" ? String : Number)(input);
1241
- }
1242
-
1243
- // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
1244
- function _toPropertyKey(arg) {
1245
- var key = _toPrimitive(arg, "string");
1246
- return _typeof(key) === "symbol" ? key : String(key);
1247
- }
1248
-
1249
- // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
1250
- function _defineProperty(obj, key, value) {
1251
- key = _toPropertyKey(key);
1252
- if (key in obj) {
1253
- Object.defineProperty(obj, key, {
1254
- value,
1255
- enumerable: true,
1256
- configurable: true,
1257
- writable: true
1258
- });
1259
- } else {
1260
- obj[key] = value;
1261
- }
1262
- return obj;
1263
- }
1264
-
1265
1219
  // ../../node_modules/@math.gl/polygon/dist/polygon-utils.js
1266
1220
  var DimIndex = {
1267
1221
  x: 0,
@@ -1269,11 +1223,7 @@ var __exports__ = (() => {
1269
1223
  z: 2
1270
1224
  };
1271
1225
  function getPolygonSignedArea(points, options = {}) {
1272
- const {
1273
- start = 0,
1274
- end = points.length,
1275
- plane = "xy"
1276
- } = options;
1226
+ const { start = 0, end = points.length, plane = "xy" } = options;
1277
1227
  const dim = options.size || 2;
1278
1228
  let area2 = 0;
1279
1229
  const i0 = DimIndex[plane[0]];
@@ -1327,12 +1277,7 @@ var __exports__ = (() => {
1327
1277
  let i;
1328
1278
  let last;
1329
1279
  if (area2 === void 0) {
1330
- area2 = getPolygonSignedArea(data, {
1331
- start,
1332
- end,
1333
- size: dim,
1334
- plane
1335
- });
1280
+ area2 = getPolygonSignedArea(data, { start, end, size: dim, plane });
1336
1281
  }
1337
1282
  let i0 = DimIndex[plane[0]];
1338
1283
  let i1 = DimIndex[plane[1]];
@@ -1667,7 +1612,10 @@ var __exports__ = (() => {
1667
1612
  return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
1668
1613
  }
1669
1614
  function isValidDiagonal(a, b) {
1670
- return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (area(a.prev, a, b.prev) || area(a, b.prev, b)) || equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
1615
+ return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
1616
+ (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
1617
+ (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
1618
+ equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
1671
1619
  }
1672
1620
  function area(p, q, r) {
1673
1621
  return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
@@ -1760,15 +1708,12 @@ var __exports__ = (() => {
1760
1708
  }
1761
1709
  var Vertex = class {
1762
1710
  constructor(i, x, y) {
1763
- _defineProperty(this, "i", void 0);
1764
- _defineProperty(this, "x", void 0);
1765
- _defineProperty(this, "y", void 0);
1766
- _defineProperty(this, "prev", null);
1767
- _defineProperty(this, "next", null);
1768
- _defineProperty(this, "z", 0);
1769
- _defineProperty(this, "prevZ", null);
1770
- _defineProperty(this, "nextZ", null);
1771
- _defineProperty(this, "steiner", false);
1711
+ this.prev = null;
1712
+ this.next = null;
1713
+ this.z = 0;
1714
+ this.prevZ = null;
1715
+ this.nextZ = null;
1716
+ this.steiner = false;
1772
1717
  this.i = i;
1773
1718
  this.x = x;
1774
1719
  this.y = y;
@@ -2088,6 +2033,52 @@ var __exports__ = (() => {
2088
2033
  var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
2089
2034
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
2090
2035
 
2036
+ // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
2037
+ function _typeof(obj) {
2038
+ "@babel/helpers - typeof";
2039
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
2040
+ return typeof obj2;
2041
+ } : function(obj2) {
2042
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
2043
+ }, _typeof(obj);
2044
+ }
2045
+
2046
+ // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
2047
+ function _toPrimitive(input, hint) {
2048
+ if (_typeof(input) !== "object" || input === null)
2049
+ return input;
2050
+ var prim = input[Symbol.toPrimitive];
2051
+ if (prim !== void 0) {
2052
+ var res = prim.call(input, hint || "default");
2053
+ if (_typeof(res) !== "object")
2054
+ return res;
2055
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2056
+ }
2057
+ return (hint === "string" ? String : Number)(input);
2058
+ }
2059
+
2060
+ // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
2061
+ function _toPropertyKey(arg) {
2062
+ var key = _toPrimitive(arg, "string");
2063
+ return _typeof(key) === "symbol" ? key : String(key);
2064
+ }
2065
+
2066
+ // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
2067
+ function _defineProperty(obj, key, value) {
2068
+ key = _toPropertyKey(key);
2069
+ if (key in obj) {
2070
+ Object.defineProperty(obj, key, {
2071
+ value,
2072
+ enumerable: true,
2073
+ configurable: true,
2074
+ writable: true
2075
+ });
2076
+ } else {
2077
+ obj[key] = value;
2078
+ }
2079
+ return obj;
2080
+ }
2081
+
2091
2082
  // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
2092
2083
  function isElectron(mockUserAgent) {
2093
2084
  if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
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 Ln=Object.create;var te=Object.defineProperty;var Dn=Object.getOwnPropertyDescriptor;var Vn=Object.getOwnPropertyNames;var Nn=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty;var Cn=(e,t,n)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ge=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Un=(e,t)=>{for(var n in t)te(e,n,{get:t[n],enumerable:!0})},ge=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vn(t))!kn.call(e,o)&&o!==n&&te(e,o,{get:()=>t[o],enumerable:!(r=Dn(t,o))||r.enumerable});return e},ye=(e,t,n)=>(ge(e,t,"default"),n&&ge(n,t,"default")),wt=(e,t,n)=>(n=e!=null?Ln(Nn(e)):{},ge(t||!e||!e.__esModule?te(n,"default",{value:e,enumerable:!0}):n,e)),Gn=e=>ge(te({},"__esModule",{value:!0}),e);var xe=(e,t,n)=>(Cn(e,typeof t!="symbol"?t+"":t,n),n);var Ft=Ge((fi,Tt)=>{Tt.exports=globalThis.loaders});var $t=Ge(et=>{et.read=function(e,t,n,r,o){var i,s,a=o*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,u=n?o-1:0,h=n?-1:1,p=e[t+u];for(u+=h,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=i*256+e[t+u],u+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=r;f>0;s=s*256+e[t+u],u+=h,f-=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)};et.write=function(e,t,n,r,o,i){var s,a,l,c=i*8-o-1,f=(1<<c)-1,u=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,y=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=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=h/l:t+=h*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(t*l-1)*Math.pow(2,o),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,o),s=0));o>=8;e[n+p]=a&255,p+=d,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+p]=s&255,p+=d,s/=256,c-=8);e[n+p-d]|=y*128}});var nn=Ge((ha,tn)=>{"use strict";tn.exports=x;var _e=$t();function x(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||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 tt=(1<<16)*(1<<16),Kt=1/tt,Kr=12,en=typeof TextDecoder>"u"?null:new TextDecoder("utf8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),o=r>>3,i=this.pos;this.type=r&7,e(o,t,this),this.pos===i&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ae(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=qt(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ae(this.buf,this.pos)+Ae(this.buf,this.pos+4)*tt;return this.pos+=8,e},readSFixed64:function(){var e=Ae(this.buf,this.pos)+qt(this.buf,this.pos+4)*tt;return this.pos+=8,e},readFloat:function(){var e=_e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=_e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,Qr(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>=Kr&&en?ho(this.buf,t,e):uo(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!==x.Bytes)return e.push(this.readVarint(t));var n=k(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==x.Bytes)return e.push(this.readBoolean());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==x.Bytes)return e.push(this.readFloat());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==x.Bytes)return e.push(this.readDouble());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed32());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed32());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed64());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed64());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===x.Varint)for(;this.buf[this.pos++]>127;);else if(t===x.Bytes)this.pos=this.readVarint()+this.pos;else if(t===x.Fixed32)this.pos+=4;else if(t===x.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),q(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),q(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),q(this.buf,e&-1,this.pos),q(this.buf,Math.floor(e*Kt),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),q(this.buf,e&-1,this.pos),q(this.buf,Math.floor(e*Kt),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){qr(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=po(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Qt(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),_e.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),_e.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 r=this.pos-n;r>=128&&Qt(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,x.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,no,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,ro,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,so,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,oo,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,io,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,co,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,fo,t)},writeBytesField:function(e,t){this.writeTag(e,x.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,x.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,x.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,x.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function Qr(e,t,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 Q(e,o,t);throw new Error("Expected varint not more than 10 bytes")}function k(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function Q(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function qr(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),eo(n,r,t),to(r,t)}function eo(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 to(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 Qt(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var o=n.pos-1;o>=e;o--)n.buf[o+r]=n.buf[o]}function no(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function ro(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function oo(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function io(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function so(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 co(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function fo(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Ae(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function q(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function qt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function uo(e,t,n){for(var r="",o=t;o<n;){var i=e[o],s=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a>n)break;var l,c,f;a===1?i<128&&(s=i):a===2?(l=e[o+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[o+1],c=e[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=e[o+1],c=e[o+2],f=e[o+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(i&15)<<18|(l&63)<<12|(c&63)<<6|f&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 ho(e,t,n){return en.decode(e.subarray(t,n))}function po(e,t,n){for(var r=0,o,i;r<t.length;r++){if(o=t.charCodeAt(r),o>55295&&o<57344)if(i)if(o<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=o;continue}else o=i-55296<<10|o-56320|65536,i=null;else{o>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=o;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);o<128?e[n++]=o:(o<2048?e[n++]=o>>6|192:(o<65536?e[n++]=o>>12|224:(e[n++]=o>>18|240,e[n++]=o>>12&63|128),e[n++]=o>>6&63|128),e[n++]=o&63|128)}return n}});var me={};Un(me,{MVTLoader:()=>Ee,MVTSource:()=>Tn,MVTWorkerLoader:()=>it,TableTileSource:()=>xt,TileJSONLoader:()=>W});ye(me,wt(Ft(),1));function Pt(e){let t=[];if(e.fields)for(let n of e.fields)t.push({name:n.name,type:jn(n),metadata:Rn(n)});return{metadata:On(e),fields:t}}function On(e){let t={};for(let[n,r]of Object.entries(e))n!=="fields"&&r&&(t[n]=JSON.stringify(r));return t}function jn(e){switch(e.type.toLowerCase()){case"float32":return"float32";case"number":case"float64":return"float64";case"string":case"utf8":return"utf8";case"boolean":return"bool";default:return"null"}}function Rn(e){let t={};for(let[n,r]of Object.entries(e))n!=="name"&&r&&(t[n]=JSON.stringify(r));return t}var vt=e=>e!==null&&typeof e=="object";function Oe(e,t){if(!e||!vt(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=bt(e.bounds)||bt(e.antimeridian_adjusted_bounds),n.center=Yn(e.center),n.maxZoom=It(e.maxzoom),n.minZoom=It(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 r=e.tilestats||n.metaJson?.tilestats,o=Hn(r,t),i=zn(e.vector_layers),s=Wn(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 zn(e){return Array.isArray(e)?e.map(t=>Jn(t)):[]}function Jn(e){let t=Object.entries(e.fields||[]).map(([r,o])=>({name:r,...Et(String(o))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function Hn(e,t){return vt(e)&&Array.isArray(e.layers)?e.layers.map(n=>Zn(n,t)):[]}function Zn(e,t){let n=[],r={},o=e.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($n(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function Wn(e,t){return e.map(n=>{let r=t.find(s=>s.name===n.name),o=r?.fields||n.fields||[],i={...n,...r,fields:o};return i.schema=Pt(i),i})}function bt(e){let t=Bt(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(At)&&[t[1],t[3]].every(_t))return[[t[0],t[1]],[t[2],t[3]]]}function Yn(e){let t=Bt(e);return Array.isArray(t)&&t.length===3&&At(t[0])&&_t(t[1])&&Xn(t[2])?t:null}function It(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function _t(e){return Number.isFinite(e)&&e<=90&&e>=-90}function At(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Xn(e){return Number.isFinite(e)&&e>=0&&e<=22}function Bt(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var St={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 $n(e={},t){let n=Et(e.type),r={name:e.attribute,...n};return typeof e.min=="number"&&(r.min=e.min),typeof e.max=="number"&&(r.max=e.max),typeof e.count=="number"&&(r.uniqueValueCount=e.count),e.values&&(r.values=e.values),r.values&&typeof t.maxValues=="number"&&(r.values=r.values?.slice(0,t.maxValues)),r}function Et(e){let t=e.toLowerCase();return!t||St[t],St[t]||{type:"string"}}var Kn="4.3.0-alpha.5",W={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Kn,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),r=JSON.parse(n),o={...W.options.tilejson,...t?.tilejson};return Oe(r,o)},parseTextSync:(e,t)=>{let n=JSON.parse(e),r={...W.options.tilejson,...t?.tilejson};return Oe(n,r)}};function we(e,t="float32"){return e instanceof Date?"date-millisecond":e instanceof Number?t:typeof e=="string"?"utf8":(e===null||e==="undefined","null")}function Mt(e){let t=Qn(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=we(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function Qn(e){switch(e.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 je(e){switch(e.shape){case"array-row-table":case"object-row-table":return er(e.data);case"geojson-table":return tr(e.features);case"columnar-table":return qn(e.data);case"arrow-table":default:throw new Error("Deduce schema")}}function qn(e){let t=[];for(let[n,r]of Object.entries(e)){let o=nr(r,n);t.push(o)}return{fields:t,metadata:{}}}function er(e){if(!e.length)throw new Error("deduce from empty table");let t=[],n=e[0];for(let[r,o]of Object.entries(n))t.push(Lt(o,r));return{fields:t,metadata:{}}}function tr(e){if(!e.length)throw new Error("deduce from empty table");let t=[],n=e[0].properties||{};for(let[r,o]of Object.entries(n))t.push(Lt(o,r));return{fields:t,metadata:{}}}function nr(e,t){if(ArrayBuffer.isView(e)){let n=Mt(e);return{name:t,type:n.type||"null",nullable:n.nullable}}if(Array.isArray(e)&&e.length>0){let n=e[0],r=we(n);return{name:t,type:r,nullable:!0}}throw new Error("empty table")}function Lt(e,t){let n=we(e);return{name:t,type:n,nullable:!0}}function C(e){return C=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},C(e)}function Re(e,t){if(C(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(C(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ze(e){var t=Re(e,"string");return C(t)==="symbol"?t:String(t)}function w(e,t,n){return t=ze(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ne={x:0,y:1,z:2};function O(e,t={}){let{start:n=0,end:r=e.length,plane:o="xy"}=t,i=t.size||2,s=0,a=ne[o[0]],l=ne[o[1]];for(let c=n,f=r-i;c<r;c+=i)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function He(e,t,n=2,r,o="xy"){let i=t&&t.length,s=i?t[0]*n:e.length,a=Vt(e,0,s,n,!0,r&&r[0],o),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,p,d,y;if(i&&(a=cr(e,t,a,n,r,o)),e.length>80*n){h=f=e[0],p=u=e[1];for(let T=n;T<s;T+=n)d=e[T],y=e[T+1],d<h&&(h=d),y<p&&(p=y),d>f&&(f=d),y>u&&(u=y);c=Math.max(f-h,u-p),c=c!==0?32767/c:0}return re(a,l,n,h,p,c,0),l}function Vt(e,t,n,r,o,i,s){let a,l;i===void 0&&(i=O(e,{start:t,end:n,size:r,plane:s}));let c=ne[s[0]],f=ne[s[1]];if(o===i<0)for(a=t;a<n;a+=r)l=Dt(a,e[a+c],e[a+f],l);else for(a=n-r;a>=t;a-=r)l=Dt(a,e[a+c],e[a+f],l);return l&&Pe(l,l.next)&&(ie(l),l=l.next),l}function j(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Pe(n,n.next)||F(n.prev,n,n.next)===0)){if(ie(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function re(e,t,n,r,o,i,s){if(!e)return;!s&&i&&dr(e,r,o,i);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,i?sr(e,r,o,i):ir(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(c.i/n|0),ie(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=ar(j(e),t,n),re(e,t,n,r,o,i,2)):s===2&&lr(e,t,n,r,o,i):re(j(e),t,n,r,o,i,1);break}}}function ir(e){let t=e.prev,n=e,r=e.next;if(F(t,n,r)>=0)return!1;let o=t.x,i=n.x,s=r.x,a=t.y,l=n.y,c=r.y,f=o<i?o<s?o:s:i<s?i:s,u=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!==t;){if(d.x>=f&&d.x<=h&&d.y>=u&&d.y<=p&&Y(o,a,i,l,s,c,d.x,d.y)&&F(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function sr(e,t,n,r){let o=e.prev,i=e,s=e.next;if(F(o,i,s)>=0)return!1;let a=o.x,l=i.x,c=s.x,f=o.y,u=i.y,h=s.y,p=a<l?a<c?a:c:l<c?l:c,d=f<u?f<h?f:h:u<h?u:h,y=a>l?a>c?a:c:l>c?l:c,T=f>u?f>h?f:h:u>h?u:h,v=Je(p,d,t,n,r),_=Je(y,T,t,n,r),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=v&&g&&g.z<=_;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=T&&m!==o&&m!==s&&Y(a,f,l,u,c,h,m.x,m.y)&&F(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=p&&g.x<=y&&g.y>=d&&g.y<=T&&g!==o&&g!==s&&Y(a,f,l,u,c,h,g.x,g.y)&&F(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;m&&m.z>=v;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=T&&m!==o&&m!==s&&Y(a,f,l,u,c,h,m.x,m.y)&&F(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=_;){if(g.x>=p&&g.x<=y&&g.y>=d&&g.y<=T&&g!==o&&g!==s&&Y(a,f,l,u,c,h,g.x,g.y)&&F(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function ar(e,t,n){let r=e;do{let o=r.prev,i=r.next.next;!Pe(o,i)&&Nt(o,r,r.next,i)&&oe(o,i)&&oe(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),ie(r),ie(r.next),r=e=i),r=r.next}while(r!==e);return j(r)}function lr(e,t,n,r,o,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&yr(s,a)){let l=kt(s,a);s=j(s,s.next),l=j(l,l.next),re(s,t,n,r,o,i,0),re(l,t,n,r,o,i,0);return}a=a.next}s=s.next}while(s!==e)}function cr(e,t,n,r,o,i){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*r,f=a<l-1?t[a+1]*r:e.length,u=Vt(e,c,f,r,!1,o&&o[a+1],i),u===u.next&&(u.steiner=!0),s.push(gr(u));for(s.sort(fr),a=0;a<s.length;a++)n=ur(s[a],n);return n}function fr(e,t){return e.x-t.x}function ur(e,t){let n=hr(e,t);if(!n)return t;let r=kt(n,e);return j(r,r.next),j(n,n.next)}function hr(e,t){let n=t,r=e.x,o=e.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!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;n=s;do r>=n.x&&n.x>=l&&r!==n.x&&Y(o<c?r:i,o,l,c,o<c?i:r,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(r-n.x),oe(n,e)&&(u<f||u===f&&(n.x>s.x||n.x===s.x&&pr(s,n)))&&(s=n,f=u)),n=n.next;while(n!==a);return s}function pr(e,t){return F(e.prev,e,t.prev)<0&&F(t.next,e,e.next)<0}function dr(e,t,n,r){let o=e;do o.z===0&&(o.z=Je(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,mr(o)}function mr(e){let t,n,r=1,o,i,s,a,l,c;do{for(i=e,e=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)?(t=i,i=i.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;i=a}c.nextZ=null,r*=2}while(o>1);return e}function Je(e,t,n,r,o){return e=(e-n)*o|0,t=(t-r)*o|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 gr(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 Y(e,t,n,r,o,i,s,a){return(o-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(r-a)>=(n-s)*(t-a)&&(n-s)*(i-a)>=(o-s)*(r-a)}function yr(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!xr(e,t)&&(oe(e,t)&&oe(t,e)&&wr(e,t)&&(F(e.prev,e,t.prev)||F(e,t.prev,t))||Pe(e,t)&&F(e.prev,e,e.next)>0&&F(t.prev,t,t.next)>0)}function F(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Pe(e,t){return e.x===t.x&&e.y===t.y}function Nt(e,t,n,r){let o=Fe(F(e,t,n)),i=Fe(F(e,t,r)),s=Fe(F(n,r,e)),a=Fe(F(n,r,t));return!!(o!==i&&s!==a||o===0&&Te(e,n,t)||i===0&&Te(e,r,t)||s===0&&Te(n,e,r)||a===0&&Te(n,t,r))}function Te(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 Fe(e){return e>0?1:e<0?-1:0}function xr(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&&Nt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function oe(e,t){return F(e.prev,e,e.next)<0?F(e,t,e.next)>=0&&F(e,e.prev,t)>=0:F(e,t,e.prev)<0||F(e,e.next,t)<0}function wr(e,t){let n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.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!==e);return r}function kt(e,t){let n=new se(e.i,e.x,e.y),r=new se(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function Dt(e,t,n,r){let o=new se(e,t,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 ie(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 se=class{constructor(t,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=t,this.x=n,this.y=r}};function Ye(e,t,n){let r=Ir(e),o=Object.keys(r).filter(i=>r[i]!==Array);return Sr(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||o,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function Ir(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let o=n.properties[r];t[r]=Mr(o,t[r])}return t}function Sr(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:o,linePositionsCount:i,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:p}=t,{numericPropKeys:d=[],PositionDataType:y=Float32Array,triangulate:T=!0}=n,v=e[0]&&"id"in e[0],_=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(r*p),globalFeatureIds:new _(r),featureIds:o>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},g={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:[]},I={type:"Polygon",polygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:l>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new y(l*p),globalFeatureIds:new _(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};T&&(I.triangles=[]);for(let b of[m,g,I])for(let A of d){let B=h[A];b.numericProps[A]=new B(b.positions.length/p)}g.pathIndices[s]=i,I.polygonIndices[c]=l,I.primitivePolygonIndices[f]=l;let S={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let b of e){let A=b.geometry,B=b.properties||{};switch(A.type){case"Point":vr(A,m,S,p,B),m.properties.push(We(B,d)),v&&m.fields.push({id:b.id}),S.pointFeature++;break;case"LineString":_r(A,g,S,p,B),g.properties.push(We(B,d)),v&&g.fields.push({id:b.id}),S.lineFeature++;break;case"Polygon":Ar(A,I,S,p,B),I.properties.push(We(B,d)),v&&I.fields.push({id:b.id}),S.polygonFeature++;break;default:throw new Error("Invalid geometry type")}S.feature++}return Er(m,g,I,p)}function vr(e,t,n,r,o){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;Xe(t,o,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 _r(e,t,n,r,o){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;Xe(t,o,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],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(c-l)/r}}function Ar(e,t,n,r,o){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;Xe(t,o,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 c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let p=0,d=f.length;p<d;++p){let y=f[p],T=p===d-1?u===void 0?e.data.length:u[0]:f[p+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(T-y)/r}let h=n.polygonPosition;Br(t,c,f,{startPosition:l,endPosition:h,coordLength:r})}}function Br(e,t,n,{startPosition:r,endPosition:o,coordLength:i}){if(!e.triangles)return;let s=r*i,a=o*i,l=e.positions.subarray(s,a),c=n[0],f=n.slice(1).map(h=>(h-c)/i),u=He(l,f,i,t);for(let h=0,p=u.length;h<p;++h)e.triangles.push(r+u[h])}function Ze(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function Er(e,t,n,r){let o={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Ze(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Ze(t.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:Ze(n.numericProps,1)}};return o.polygons&&n.triangles&&(o.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),o}function Xe(e,t,n,r){for(let o in e.numericProps)if(o in t){let i=t[o];e.numericProps[o].fill(i,n,n+r)}}function We(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function Mr(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function ae(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var V={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Lr=V.self||V.window||V.global||{},Dr=V.window||V.self||V.global||{},Vr=V.global||V.self||V.window||{},Nr=V.document||{};var $e=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Gt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),kr=Gt&&parseFloat(Gt[1])||0;function Ke(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 L(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Ke()}var Cr=globalThis.self||globalThis.window||globalThis.global,X=globalThis.window||globalThis.self||globalThis.global,Ur=globalThis.document||{},R=globalThis.process||{},Gr=globalThis.console,ws=globalThis.navigator||{};var be=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Ps=L();function Or(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Ie=class{constructor(t,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=Or(r),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 Ot(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 jt(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 Se(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(n=Math.min(n,r/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(o,");"),"background-size:".concat(i,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}var ve;(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"})(ve||(ve={}));var jr=10;function Rt(e){return typeof e!="string"?e:(e=e.toUpperCase(),ve[e]||ve.WHITE)}function zt(e,t,n){if(!L&&typeof e=="string"){if(t){let r=Rt(t);e="\x1B[".concat(r,"m").concat(e,"\x1B[39m")}if(n){let r=Rt(n);e="\x1B[".concat(r+jr,"m").concat(e,"\x1B[49m")}}return e}function Jt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),o=e;for(let i of r){let s=o[i];typeof s=="function"&&(t.find(a=>i===a)||(o[i]=s.bind(e)))}}function $(e,t){if(!e)throw new Error(t||"Assertion failed")}function z(){let e;if(L()&&X.performance){var t,n;e=X===null||X===void 0||(t=X.performance)===null||t===void 0||(n=t.now)===null||n===void 0?void 0:n.call(t)}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);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var K={debug:L()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Rr={enabled:!0,level:0};function E(){}var Ht={},Zt={once:!0},U=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};w(this,"id",void 0),w(this,"VERSION",be),w(this,"_startTs",z()),w(this,"_deltaTs",z()),w(this,"_storage",void 0),w(this,"userData",{}),w(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new Ie("__probe-".concat(this.id,"__"),Rr),this.timeStamp("".concat(this.id," started")),Jt(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((z()-this._startTs).toPrecision(10))}getDelta(){return Number((z()-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){$(t,n)}warn(t){return this._getLogFunction(0,t,K.warn,arguments,Zt)}error(t){return this._getLogFunction(0,t,K.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,K.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,K.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,K.debug||K.info,arguments,Zt)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||E,r&&[r],{tag:Zr(n)}):E}image(t){let{logLevel:n,priority:r,image:o,message:i="",scale:s=1}=t;return this._shouldLog(n||r)?L()?Hr({image:o,message:i,scale:s}):Jr({image:o,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 r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=Wt({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||E)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Yt(t)}_getLogFunction(t,n,r,o,i){if(this._shouldLog(t)){i=Wt({logLevel:t,message:n,args:o,opts:i}),r=r||i.method,$(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=z();let s=i.tag||i.message;if(i.once&&s)if(!Ht[s])Ht[s]=z();else return E;return n=zr(this.id,i.message,i),r.bind(console,n,...i.args)}return E}};w(U,"VERSION",be);function Yt(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 $(Number.isFinite(t)&&t>=0),t}function Wt(e){let{logLevel:t,message:n}=e;e.logLevel=Yt(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return $(o==="string"||o==="object"),Object.assign(e,{args:r},e.opts)}function zr(e,t,n){if(typeof t=="string"){let r=n.time?jt(Ot(n.total)):"";t=n.time?"".concat(e,": ").concat(r," ").concat(t):"".concat(e,": ").concat(t),t=zt(t,n.color,n.background)}return t}function Jr(e){let{image:t,message:n="",scale:r=1}=e;return console.warn("removed"),E}function Hr(e){let{image:t,message:n="",scale:r=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let s=Se(i,n,r);console.log(...s)},i.src=t,E}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...Se(t,n,r)),E;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Se(i,n,r)),i.src=t.toDataURL(),E}return E}function Zr(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}var Xs=new U({id:"@probe.gl/log"});var Qe="4.3.0-alpha.5",Wr=Qe[0]>="0"&&Qe[0]<="9"?`v${Qe}`:"";function Yr(){let e=new U({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=Wr,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var P=Yr();var Xr="",Xt={};function qe(e){for(let t in Xt)if(e.startsWith(t)){let n=Xt[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Xr}${e}`),e}var le=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=$r(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 $r(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,o)=>t(r,o);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var rt=wt(nn(),1);function mo(e){let t=0;for(let n=0,r=e.length-1,o,i;n<e.length;r=n++)o=e[n],i=e[r],t+=(i[0]-o[0])*(o[1]+i[1]);return t}function ce(e,t){if(Array.isArray(e[0])){for(let r of e)ce(r,t);return}let n=e;n[0]/=t,n[1]/=t}function rn(e,t){for(let n=0;n<e.length;++n)e[n]/=t}function fe(e,t,n){if(typeof e[0][0]!="number"){for(let s of e)fe(s,t,n);return}let r=n*Math.pow(2,t.z),o=n*t.x,i=n*t.y;for(let s=0;s<e.length;s++){let a=e[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 on(e,t,n){let{x:r,y:o,z:i}=t,s=n*Math.pow(2,i),a=n*r,l=n*o;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function sn(e){let t=e.length;if(t<=1)return[e];let n=[],r,o;for(let i=0;i<t;i++){let s=mo(e[i]);s!==0&&(o===void 0&&(o=s<0),o===s<0?(r&&n.push(r),r=[e[i]]):r&&r.push(e[i]))}return r&&n.push(r),n}function an(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[O(e.data)]],indices:[e.indices]};let r=[],o=[],i=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),p=O(h);if(p===0){let d=e.data.slice(0,u),y=e.data.slice(c);e.data=d.concat(y),l+=c-u;continue}a===void 0&&(a=p<0),a===p<0?(s.length&&(r.push(i),o.push(s)),s=[u],i=[p]):(i.push(p),s.push(u))}return i&&r.push(i),s.length&&o.push(s),{type:n,areas:r,indices:o,data:e.data}}var J=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,o,i,s){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=o,this._values=i,this._geometryInfo=s,t.readFields(go,this,n)}toGeoJSONFeature(t,n){let r=this.loadGeometry();switch(t){case"wgs84":return ln(this,r,o=>fe(o,n,this.extent));default:return ln(this,r,ce)}}toBinaryFeature(t,n){let r=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(r,o=>on(o,n,this.extent));default:return this._toBinaryCoordinates(r,rn)}}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o=0,i=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<n;){if(o<=0){let u=t.readVarint();r=u&7,o=u>>3}if(o--,r===1||r===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<c&&(c=s),s>f&&(f=s);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,c,l,f]}_toBinaryCoordinates(t,n){let r;n(t.data,this.extent);let o=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,r={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/o,r={type:"LineString",...t};break;case 3:r=an(t),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 t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o=0,i=0,s=0,a=[],l;for(;t.pos<n;){if(o<=0){let c=t.readVarint();r=c&7,o=c>>3}switch(o--,r){case 1:case 2:i+=t.readSVarint(),s+=t.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 t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o,i=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<n;)if(i<=0&&(o=t.readVarint(),r=o&7,i=o>>3),i--,r===1||r===2)s+=t.readSVarint(),a+=t.readSVarint(),r===1&&c.push(l),f.push(s,a),l+=2;else if(r===7){if(l>0){let u=c[c.length-1];f.push(f[u],f[u+1]),l+=2}}else throw new Error(`unknown command ${r}`);return{data:f,indices:c}}};xe(J,"types",["Unknown","Point","LineString","Polygon"]);function ln(e,t,n){let r=J.types[e.type],o,i,s;switch(e.type){case 1:let l=[];for(o=0;o<t.length;o++)l[o]=t[o][0];s=l,n(s,e.extent);break;case 2:for(s=t,o=0;o<s.length;o++)n(s[o],e.extent);break;case 3:for(s=sn(t),o=0;o<s.length;o++)for(i=0;i<s[o].length;i++)n(s[o][i],e.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:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function go(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?yo(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function yo(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],o=t._values[e.readVarint()];t.properties[r]=o}}var Be=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(xo,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 J(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 r=this._pbf.readVarint()+this._pbf.pos;return new J(this._pbf,r,this.extent,this._keys,this._values,n)}};function xo(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(wo(n)))}function wo(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var ue=class{layers;constructor(t,n){this.layers=t.readFields(To,{},n)}};function To(e,t,n){if(e===3&&n){let r=new Be(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function ot(e,t){let n=Po(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:nt(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:cn(e,n)};case"geojson":return cn(e,n);case"binary-geometry":return nt(e,n);case"binary":return nt(e,n);default:throw new Error(r||"undefined shape")}}function nt(e,t){let[n,r]=Fo(e,t),o=Ye(n,r);return o.byteLength=e.byteLength,o}function Fo(e,t){let n=[],r={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,r];let o=new ue(new rt.default(e));return(t&&Array.isArray(t.layers)?t.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),f=Io(c,t,s);n.push(f)}}),[n,r]}function cn(e,t){if(e.byteLength<=0)return[];let n=[],r=new ue(new rt.default(e));return(Array.isArray(t.layers)?t.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=bo(l,t,i);n.push(c)}}),n}function Po(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&&P.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function bo(e,t,n){let r=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(r.properties||={},r.properties[t.layerProperty]=n),r}function Io(e,t,n){let r=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}var So="4.3.0-alpha.5",it={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:So,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}}},Ee={...it,parse:async(e,t)=>ot(e,t),parseSync:ot,binary:!0};var fn="4.3.0-alpha.5";var vo=globalThis.loaders?.parseImageNode,st=typeof Image<"u",at=typeof ImageBitmap<"u",_o=Boolean(vo),lt=$e?!0:_o;function un(e){switch(e){case"auto":return at||st||lt;case"imagebitmap":return at;case"image":return st;case"data":return lt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function hn(){if(at)return"imagebitmap";if(st)return"image";if(lt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Ao(e){let t=Bo(e);if(!t)throw new Error("Not an image");return t}function pn(e){switch(Ao(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 Bo(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 Eo=/^data:image\/svg\+xml/,Mo=/\.svg((\?|#).*)?$/;function Me(e){return e&&(Eo.test(e)||Mo.test(e))}function dn(e,t){if(Me(t)){let r=new TextDecoder().decode(e);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 ct(e,t)}function ct(e,t){if(Me(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Le(e,t,n){let r=dn(e,n),o=self.URL||self.webkitURL,i=typeof r!="string"&&o.createObjectURL(r);try{return await Lo(i||r,t)}finally{i&&o.revokeObjectURL(i)}}async function Lo(e,t){let n=new Image;return n.src=e,t.image&&t.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 Do={},mn=!0;async function gn(e,t,n){let r;Me(n)?r=await Le(e,t,n):r=ct(e,n);let o=t&&t.imagebitmap;return await Vo(r,o)}async function Vo(e,t=null){if((No(t)||!mn)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),mn=!1}return await createImageBitmap(e)}function No(e){for(let t in e||Do)return!1;return!0}function yn(e){return!Go(e,"ftyp",4)||!(e[8]&96)?null:ko(e)}function ko(e){switch(Co(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Co(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Uo(e){return[...e].map(t=>t.charCodeAt(0))}function Go(e,t,n=0){let r=Uo(t);for(let o=0;o<r.length;++o)if(r[o]!==e[o+n])return!1;return!0}var N=!1,he=!0;function H(e){let t=pe(e);return jo(t)||Jo(t)||Ro(t)||zo(t)||Oo(t)}function Oo(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=yn(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function jo(e){let t=pe(e);return t.byteLength>=24&&t.getUint32(0,N)===2303741511?{mimeType:"image/png",width:t.getUint32(16,N),height:t.getUint32(20,N)}:null}function Ro(e){let t=pe(e);return t.byteLength>=10&&t.getUint32(0,N)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,he),height:t.getUint16(8,he)}:null}function zo(e){let t=pe(e);return t.byteLength>=14&&t.getUint16(0,N)===16973&&t.getUint32(2,he)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,he),height:t.getUint32(22,he)}:null}function Jo(e){let t=pe(e);if(!(t.byteLength>=3&&t.getUint16(0,N)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:o}=Ho(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,N);if(o.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,N),width:t.getUint16(i+7,N)};if(!r.has(s))return null;i+=2,i+=t.getUint16(i,N)}return null}function Ho(){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 pe(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 xn(e,t){let{mimeType:n}=H(e)||{},r=globalThis.loaders?.parseImageNode;return ae(r),await r(e,n)}async function wn(e,t,n){t=t||{};let o=(t.image||{}).type||"auto",{url:i}=n||{},s=Zo(o),a;switch(s){case"imagebitmap":a=await gn(e,t,i);break;case"image":a=await Le(e,t,i);break;case"data":a=await xn(e,t);break;default:ae(!1)}return o==="data"&&(a=pn(a)),a}function Zo(e){switch(e){case"auto":case"data":return hn();default:return un(e),e}}var Wo=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Yo=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Xo={image:{type:"auto",decode:!0}},ft={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:fn,mimeTypes:Yo,extensions:Wo,parse:wn,tests:[e=>Boolean(H(new DataView(e)))],options:Xo};var Tn={name:"MVT",id:"mvt",module:"mvt",version:"0.0.0",extensions:["mvt"],mimeTypes:["application/octet-stream"],options:{mvt:{}},type:"mvt",fromUrl:!0,fromBlob:!1,testURL:e=>!0,createDataSource(e,t){return new ut(e,t)}},ut=class extends le{props;url;metadataUrl=null;data;schema="tms";metadata;extension;mimeType=null;constructor(t,n){super(n),this.props=n,this.url=qe(t),this.metadataUrl=n.mvt?.metadataUrl||`${this.url}/tilejson.json`,this.extension=n.mvt?.extension||".png",this.data=this.url,this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata(),$o(this.url)&&(this.schema="template")}async getMetadata(){if(!this.metadataUrl)return null;let t;try{t=await this.fetch(this.metadataUrl)}catch(o){return console.error(o.message),null}if(!t.ok)return console.error(t.statusText),null;let n=await t.text();return W.parseTextSync?.(n)||null}getTileMIMEType(){return this.mimeType}async getTile(t){let{x:n,y:r,z:o}=t,i=this.getTileURL(n,r,o),s=await this.fetch(i);return s.ok?await s.arrayBuffer():null}async getTileData(t){let{x:n,y:r,z:o}=t.index,i=await this.getTile({x:n,y:r,z:o,layers:[]});if(i===null)return null;let s=H(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(t){let n=await this.getTile(t);return n?this._parseImageTile(n):null}async _parseImageTile(t){return await ft.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 r={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:n.x,y:n.y,z:n.z},...this.loadOptions?.mvt},...this.loadOptions};return await Ee.parse(t,r)}getMetadataUrl(){return this.metadataUrl}getTileURL(t,n,r){switch(this.schema){case"xyz":return`${this.url}/${t}/${n}/${r}${this.extension}`;case"tms":return`${this.url}/${r}/${t}/${n}${this.extension}`;case"template":return ei(this.url,t,n,r,"0");default:throw new Error(this.schema)}}};function $o(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(e)}var Ko=new RegExp("{x}","g"),Qo=new RegExp("{y}","g"),qo=new RegExp("{z}","g");function ei(e,t,n,r,o="0"){if(Array.isArray(e)){let s=ti(o)%e.length;e=e[s]}let i=e;return i=i.replace(Ko,String(t)),i=i.replace(Qo,String(n)),i=i.replace(qo,String(r)),Number.isInteger(n)&&Number.isInteger(r)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,r)-n-1))),i}function ti(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function de(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var M=class{constructor(t,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=t,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(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=de(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(de()-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 Z=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,o=this.stats[n];return o||(t instanceof M?o=t:o=new M(n,r),this.stats[n]=o),o}};function Fn(e,t,n,r,o){let i=t===o.maxZoom?0:o.tolerance/((1<<t)*o.extent),s={protoFeatures:[],sourceFeatures:null,numPoints:0,numSimplified:0,numFeatures:e.length,x:n,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let a of e)ni(s,a,i,o);return s}function ni(e,t,n,r){let o=t.geometry,i=t.type,s=[];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);let a;switch(i){case"Point":case"MultiPoint":a=1;for(let l=0;l<o.length;l+=3)s.push(o[l],o[l+1]),e.numPoints++,e.numSimplified++;break;case"LineString":a=2,De(s,o,e,n,!1,!1);break;case"MultiLineString":a=2;for(let l=0;l<o.length;l++)De(s,o[l],e,n,!1,l===0);break;case"Polygon":a=3;for(let l=0;l<o.length;l++)De(s,o[l],e,n,!0,l===0);break;case"MultiPolygon":a=3;for(let l=0;l<o.length;l++){let c=o[l];for(let f=0;f<c.length;f++)De(s,c[f],e,n,!0,f===0)}break;default:throw new Error(`Unknown geometry type: ${i}`)}if(s.length){let l=t.tags||null;if(i==="LineString"&&r.lineMetrics){l={};for(let f in t.tags)l[f]=t.tags[f];l.mapbox_clip_start=o.start/o.size,l.mapbox_clip_end=o.end/o.size}let c={geometry:s,simplifiedType:a,tags:l};t.id!==null&&(c.id=t.id),e.protoFeatures.push(c)}}function De(e,t,n,r,o,i){let s=r*r;if(r>0&&t.size<(o?s:r)){n.numPoints+=t.length/3;return}let a=[];for(let l=0;l<t.length;l+=3)(r===0||t[l+2]>s)&&(n.numSimplified++,a.push(t[l],t[l+1])),n.numPoints++;o&&ri(a,i),e.push(a)}function ri(e,t){let n=0;for(let r=0,o=e.length-2;r<e.length;o=r,r+=2)n+=(e[r]-e[o])*(e[r+1]+e[o+1]);if(n>0===t)for(let r=0,o=e.length;r<o/2;r+=2){let i=e[r],s=e[r+1];e[r]=e[o-2-r],e[r+1]=e[o-1-r],e[o-2-r]=i,e[o-1-r]=s}}function ht(e,t){if(e.transformed)return e;let n=1<<e.z,r=e.x,o=e.y;for(let i of e.protoFeatures){let s=i.geometry,a=i.simplifiedType;if(i.geometry=[],a===1)for(let l=0;l<s.length;l+=2)i.geometry.push(Pn(s[l],s[l+1],t,n,r,o));else for(let l=0;l<s.length;l++){let c=[];for(let f=0;f<s[l].length;f+=2)c.push(Pn(s[l][f],s[l][f+1],t,n,r,o));i.geometry.push(c)}}return e.transformed=!0,e}function Pn(e,t,n,r,o,i){return[Math.round(n*(e*r-o)),Math.round(n*(t*r-i))]}function bn(e,t){let n=[];for(let o of e.protoFeatures){if(!o||!o.geometry)continue;let i,s;switch(o.simplifiedType){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:throw new Error(`${o.simplifiedType}is not a valid simplified type`)}switch(t.coordinates){case"EPSG:4326":case"wgs84":fe(s,t.tileIndex,t.extent);break;default:ce(s,t.extent);break}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}}function G(e,t,n,r){let o={id:e??null,type:t,simplifiedType:void 0,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(t){case"Point":case"MultiPoint":case"LineString":Ve(o,n);break;case"MultiLineString":for(let i of n)Ve(o,i);break;case"Polygon":Ve(o,n[0]);break;case"MultiPolygon":for(let i of n)Ve(o,i[0]);break;default:throw new Error(String(t))}return o}function Ve(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 Ne(e,t,n,r){let o=r,i=n-t>>1,s=n-t,a,l=e[t],c=e[t+1],f=e[n],u=e[n+1];for(let h=t+3;h<n;h+=3){let p=oi(e[h],e[h+1],l,c,f,u);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-t>3&&Ne(e,t,a,r),e[a+2]=o,n-a>3&&Ne(e,a,n,r))}function oi(e,t,n,r,o,i){let s=o-n,a=i-r;if(s!==0||a!==0){let l=((e-n)*s+(t-r)*a)/(s*s+a*a);l>1?(n=o,r=i):l>0&&(n+=s*l,r+=a*l)}return s=e-n,a=t-r,s*s+a*a}function Sn(e,t){let n=[];switch(e.type){case"FeatureCollection":let r=0;for(let o of e.features)n.push(ke(o,t,r++));break;case"Feature":n.push(ke(e,t));break;default:n.push(ke({geometry:e},t))}return n}function ke(e,t,n){if(!e.geometry)return;let r=e.geometry.coordinates,o=e.geometry.type,i=Math.pow(t.tolerance/((1<<t.maxZoom)*t.extent),2),s=[],a=e.id;switch(t.promoteId?a=e.properties[t.promoteId]:t.generateId&&(a=n||0),o){case"Point":In(r,s);break;case"MultiPoint":for(let l of r)In(l,s);break;case"LineString":dt(r,s,i,!1);break;case"MultiLineString":if(t.lineMetrics){for(let l of r)s=[],dt(l,s,i,!1),features.push(G(a,"LineString",s,e.properties));return}break;case"Polygon":pt(r,s,i,!0);break;case"MultiPolygon":for(let l of r){let c=[];pt(l,c,i,!0),s.push(c)}break;case"GeometryCollection":for(let l of e.geometry.geometries)ke(features,{id:a,geometry:l,properties:e.properties},t,n);break;default:throw new Error("Input data is not a valid GeoJSON object.")}return G(a,o,s,e.properties)}function In(e,t){t.push(vn(e[0]),_n(e[1]),0)}function dt(e,t,n,r){let o,i,s=0;for(let l=0;l<e.length;l++){let c=vn(e[l][0]),f=_n(e[l][1]);t.push(c,f,0),l>0&&(r?s+=(o*f-c*i)/2:s+=Math.sqrt(Math.pow(c-o,2)+Math.pow(f-i,2))),o=c,i=f}let a=t.length-3;t[2]=1,Ne(t,0,a,n),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function pt(e,t,n,r){for(let o=0;o<e.length;o++){let i=[];dt(e[o],i,n,r),t.push(i)}}function vn(e){return e/360+.5}function _n(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 D(e,t,n,r,o,i,s,a){if(n/=t,r/=t,i>=n&&s<r)return e;if(s<n||i>=r)return null;let l=[];for(let c of e){let f=c.geometry,u=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(u==="Point"||u==="MultiPoint")ii(f,d,n,r,o);else if(u==="LineString")Bn(f,d,n,r,o,!1,a.lineMetrics);else if(u==="MultiLineString")mt(f,d,n,r,o,!1);else if(u==="Polygon")mt(f,d,n,r,o,!0);else if(u==="MultiPolygon")for(let y of f){let T=[];mt(y,T,n,r,o,!0),T.length&&d.push(T)}if(d.length){if(a.lineMetrics&&u==="LineString"){for(let y of d)l.push(G(c.id,u,y,c.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(G(c.id,u,d,c.tags))}}return l.length?l:null}function ii(e,t,n,r,o){for(let i=0;i<e.length;i+=3){let s=e[i+o];s>=n&&s<=r&&ee(t,e[i],e[i+1],e[i+2])}}function Bn(e,t,n,r,o,i,s){let a=An(e),l=o===0?si:ai,c=e.start,f,u;for(let v=0;v<e.length-3;v+=3){let _=e[v],m=e[v+1],g=e[v+2],I=e[v+3],S=e[v+4],b=o===0?_:m,A=o===0?I:S,B=!1;s&&(f=Math.sqrt(Math.pow(_-I,2)+Math.pow(m-S,2))),b<n?A>n&&(u=l(a,_,m,I,S,n),s&&(a.start=c+f*u)):b>r?A<r&&(u=l(a,_,m,I,S,r),s&&(a.start=c+f*u)):ee(a,_,m,g),A<n&&b>=n&&(u=l(a,_,m,I,S,n),B=!0),A>r&&b<=r&&(u=l(a,_,m,I,S,r),B=!0),!i&&B&&(s&&(a.end=c+f*u),t.push(a),a=An(e)),s&&(c+=f)}let h=e.length-3,p=e[h],d=e[h+1],y=e[h+2],T=o===0?p:d;T>=n&&T<=r&&ee(a,p,d,y),h=a.length-3,i&&h>=3&&(a[h]!==a[0]||a[h+1]!==a[1])&&ee(a,a[0],a[1],a[2]),a.length&&t.push(a)}function An(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function mt(e,t,n,r,o,i){for(let s of e)Bn(s,t,n,r,o,i,!1)}function ee(e,t,n,r){e.push(t,n,r)}function si(e,t,n,r,o,i){let s=(i-t)/(r-t);return ee(e,i,n+(o-n)*s,1),s}function ai(e,t,n,r,o,i){let s=(i-n)/(o-n);return ee(e,t+(r-t)*s,i,1),s}function Mn(e,t){let n=t.buffer/t.extent,r=e,o=D(e,1,-1-n,n,0,-1,2,t),i=D(e,1,1-n,2+n,0,-1,2,t);return(o||i)&&(r=D(e,1,-n,1+n,0,-1,2,t)||[],o&&(r=En(o,1).concat(r)),i&&(r=r.concat(En(i,-1)))),r}function En(e,t){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=o.type,s;switch(i){case"Point":case"MultiPoint":case"LineString":s=gt(o.geometry,t);break;case"MultiLineString":case"Polygon":s=[];for(let a of o.geometry)s.push(gt(a,t));break;case"MultiPolygon":s=[];for(let a of o.geometry){let l=[];for(let c of a)l.push(gt(c,t));s.push(l)}break;default:throw new Error(String(i))}n.push(G(o.id,i,s,o.tags))}return n}function gt(e,t){let n=[];n.size=e.size,e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}var xt={name:"TableTiler",id:"table-tiler",version:"0.0.0",extensions:["mvt"],mimeTypes:["application/octet-stream"],options:{table:{coordinates:"local",promoteId:void 0,maxZoom:14,indexMaxZoom:5,maxPointsPerTile:1e4,tolerance:3,extent:4096,buffer:64,generateId:void 0}},type:"table",testURL:e=>e.endsWith(".geojson"),createDataSource(e,t){let n=typeof e=="string"||e instanceof Blob,r=t?.table?.loaders?.[0],o=n?li(e,r):e;return new Ce(o,t)}};async function li(e,t){if(typeof e=="string"){let o=await(await fetch(e)).arrayBuffer();return await t.parse(o)}let n=await e.arrayBuffer();return await t.parse(n)}var Ue=class{stats=new Z({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(t,n){this.props={...xt.options.table,...n?.table},this.getTileData=this.getTileData.bind(this),this.ready=this.initializeTilesAsync(t),this.metadata=this.getMetadata()}async initializeTilesAsync(t){let n=await t;this.schema=je(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(t){await this.ready;let n=this.getTileSync(t);return P.info(2,"getVectorTile",t,n)(),n}async getTile(t){return await this.ready,this.getTileSync(t)}async getTileData(t){let{x:n,y:r,z:o}=t.index;return(await this.getVectorTile({x:n,y:r,z:o}))?.features||[]}getTileSync(t){let n=this.getProtoTile(t);return n?bn(n,{coordinates:this.props.coordinates,tileIndex:t,extent:this.props.extent}):null}createRootTiles(t){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.");P.log(1,"DynamicVectorTileSource creating root tiles",this.props)(),P.time(1,"preprocess table")();let n=Sn(t,this.props);if(P.timeEnd(1,"preprocess table")(),P.time(1,"generate tiles")(),n=Mn(n,this.props),n.length===0){P.log(1,"DynamicVectorTileSource: no features generated")();return}this.splitTile(n,0,0,0);let r=this.tiles[0];P.log(1,`root tile features: ${r.numFeatures}, points: ${r.numPoints}`)(),P.timeEnd(1,"generate tiles")(),P.log(1,`DynamicVectorTileSource: tiles generated: ${this.stats.get("total").count}`,this.stats)()}getProtoTile(t){let{z:n,y:r}=t,{x:o}=t,{extent:i}=this.props;if(n<0||n>24)return null;let s=1<<n;o=o+s&s-1;let a=yt(n,o,r);if(this.tiles[a])return ht(this.tiles[a],i);P.log(P,"drilling down to z%d-%d-%d",n,o,r)();let l=n,c=o,f=r,u;for(;!u&&l>0;)l--,c=c>>1,f=f>>1,u=this.tiles[yt(l,c,f)];return!u||!u.sourceFeatures?null:(P.log(1,"found parent tile z%d-%d-%d",l,c,f)(),P.time(1,"drilling down")(),this.splitTile(u.sourceFeatures,l,c,f,n,o,r),P.timeEnd(1,"drilling down")(),this.tiles[a]?ht(this.tiles[a],i):null)}splitTile(t,n,r,o,i,s,a){let l=[t,n,r,o];for(;l.length;){o=l.pop(),r=l.pop(),n=l.pop(),t=l.pop();let c=1<<n,f=yt(n,r,o),u=this.tiles[f];if(!u){P.time(2,"tile creation")(),u=this.tiles[f]=Fn(t,n,r,o,this.props),this.tileCoords.push({z:n,x:r,y:o});let S=`z${n}`,b=this.stats.get(S,"count");b.incrementCount(),b=this.stats.get("total"),b.incrementCount(),b=Ue.stats.get(S,"count"),b.incrementCount(),b=Ue.stats.get("total"),b.incrementCount(),P.log(2,"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,r,o,u.numFeatures,u.numPoints,u.numSimplified)(),P.timeEnd(2,"tile creation")()}if(u.sourceFeatures=t,i===void 0){if(n===this.props.indexMaxZoom||u.numPoints<=this.props.maxPointsPerTile)continue}else{if(n===this.props.maxZoom||n===i)continue;if(i!==void 0){let S=i-n;if(r!==s>>S||o!==a>>S)continue}}if(u.sourceFeatures=null,t.length===0)continue;P.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,m=null,g=D(t,c,r-h,r+d,0,u.minX,u.maxX,this.props),I=D(t,c,r+p,r+y,0,u.minX,u.maxX,this.props);t=null,g&&(T=D(g,c,o-h,o+d,1,u.minY,u.maxY,this.props),v=D(g,c,o+p,o+y,1,u.minY,u.maxY,this.props),g=null),I&&(_=D(I,c,o-h,o+d,1,u.minY,u.maxY,this.props),m=D(I,c,o+p,o+y,1,u.minY,u.maxY,this.props),I=null),P.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(m||[],n+1,r*2+1,o*2+1)}}},Ce=Ue;xe(Ce,"stats",new Z({id:"table-tile-source-all",stats:[new M("count","tiles"),new M("count","features")]}));function yt(e,t,n){return((1<<e)*n+t)*32+e}return Gn(me);})();
7
+ "use strict";var __exports__=(()=>{var Ln=Object.create;var te=Object.defineProperty;var Dn=Object.getOwnPropertyDescriptor;var Vn=Object.getOwnPropertyNames;var Nn=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty;var Cn=(e,t,n)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ge=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Un=(e,t)=>{for(var n in t)te(e,n,{get:t[n],enumerable:!0})},ge=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vn(t))!kn.call(e,o)&&o!==n&&te(e,o,{get:()=>t[o],enumerable:!(r=Dn(t,o))||r.enumerable});return e},ye=(e,t,n)=>(ge(e,t,"default"),n&&ge(n,t,"default")),wt=(e,t,n)=>(n=e!=null?Ln(Nn(e)):{},ge(t||!e||!e.__esModule?te(n,"default",{value:e,enumerable:!0}):n,e)),Gn=e=>ge(te({},"__esModule",{value:!0}),e);var xe=(e,t,n)=>(Cn(e,typeof t!="symbol"?t+"":t,n),n);var Ft=Ge((fi,Tt)=>{Tt.exports=globalThis.loaders});var $t=Ge(et=>{et.read=function(e,t,n,r,o){var i,s,a=o*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,u=n?o-1:0,h=n?-1:1,p=e[t+u];for(u+=h,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=i*256+e[t+u],u+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=r;f>0;s=s*256+e[t+u],u+=h,f-=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)};et.write=function(e,t,n,r,o,i){var s,a,l,c=i*8-o-1,f=(1<<c)-1,u=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,y=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=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=h/l:t+=h*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(t*l-1)*Math.pow(2,o),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,o),s=0));o>=8;e[n+p]=a&255,p+=d,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+p]=s&255,p+=d,s/=256,c-=8);e[n+p-d]|=y*128}});var nn=Ge((fa,tn)=>{"use strict";tn.exports=x;var _e=$t();function x(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||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 tt=(1<<16)*(1<<16),Kt=1/tt,Kr=12,en=typeof TextDecoder>"u"?null:new TextDecoder("utf8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),o=r>>3,i=this.pos;this.type=r&7,e(o,t,this),this.pos===i&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ae(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=qt(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ae(this.buf,this.pos)+Ae(this.buf,this.pos+4)*tt;return this.pos+=8,e},readSFixed64:function(){var e=Ae(this.buf,this.pos)+qt(this.buf,this.pos+4)*tt;return this.pos+=8,e},readFloat:function(){var e=_e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=_e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,Qr(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>=Kr&&en?ho(this.buf,t,e):uo(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!==x.Bytes)return e.push(this.readVarint(t));var n=k(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==x.Bytes)return e.push(this.readBoolean());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==x.Bytes)return e.push(this.readFloat());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==x.Bytes)return e.push(this.readDouble());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed32());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed32());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed64());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed64());var t=k(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===x.Varint)for(;this.buf[this.pos++]>127;);else if(t===x.Bytes)this.pos=this.readVarint()+this.pos;else if(t===x.Fixed32)this.pos+=4;else if(t===x.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),q(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),q(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),q(this.buf,e&-1,this.pos),q(this.buf,Math.floor(e*Kt),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),q(this.buf,e&-1,this.pos),q(this.buf,Math.floor(e*Kt),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){qr(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=po(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Qt(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),_e.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),_e.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 r=this.pos-n;r>=128&&Qt(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,x.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,no,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,ro,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,so,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,oo,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,io,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,co,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,fo,t)},writeBytesField:function(e,t){this.writeTag(e,x.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,x.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,x.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,x.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function Qr(e,t,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 Q(e,o,t);throw new Error("Expected varint not more than 10 bytes")}function k(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function Q(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function qr(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),eo(n,r,t),to(r,t)}function eo(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 to(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 Qt(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var o=n.pos-1;o>=e;o--)n.buf[o+r]=n.buf[o]}function no(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function ro(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function oo(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function io(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function so(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 co(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function fo(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Ae(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function q(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function qt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function uo(e,t,n){for(var r="",o=t;o<n;){var i=e[o],s=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a>n)break;var l,c,f;a===1?i<128&&(s=i):a===2?(l=e[o+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[o+1],c=e[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=e[o+1],c=e[o+2],f=e[o+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(i&15)<<18|(l&63)<<12|(c&63)<<6|f&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 ho(e,t,n){return en.decode(e.subarray(t,n))}function po(e,t,n){for(var r=0,o,i;r<t.length;r++){if(o=t.charCodeAt(r),o>55295&&o<57344)if(i)if(o<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=o;continue}else o=i-55296<<10|o-56320|65536,i=null;else{o>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=o;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);o<128?e[n++]=o:(o<2048?e[n++]=o>>6|192:(o<65536?e[n++]=o>>12|224:(e[n++]=o>>18|240,e[n++]=o>>12&63|128),e[n++]=o>>6&63|128),e[n++]=o&63|128)}return n}});var me={};Un(me,{MVTLoader:()=>Ee,MVTSource:()=>Tn,MVTWorkerLoader:()=>it,TableTileSource:()=>xt,TileJSONLoader:()=>W});ye(me,wt(Ft(),1));function Pt(e){let t=[];if(e.fields)for(let n of e.fields)t.push({name:n.name,type:jn(n),metadata:Rn(n)});return{metadata:On(e),fields:t}}function On(e){let t={};for(let[n,r]of Object.entries(e))n!=="fields"&&r&&(t[n]=JSON.stringify(r));return t}function jn(e){switch(e.type.toLowerCase()){case"float32":return"float32";case"number":case"float64":return"float64";case"string":case"utf8":return"utf8";case"boolean":return"bool";default:return"null"}}function Rn(e){let t={};for(let[n,r]of Object.entries(e))n!=="name"&&r&&(t[n]=JSON.stringify(r));return t}var vt=e=>e!==null&&typeof e=="object";function Oe(e,t){if(!e||!vt(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=bt(e.bounds)||bt(e.antimeridian_adjusted_bounds),n.center=Yn(e.center),n.maxZoom=It(e.maxzoom),n.minZoom=It(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 r=e.tilestats||n.metaJson?.tilestats,o=Hn(r,t),i=zn(e.vector_layers),s=Wn(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 zn(e){return Array.isArray(e)?e.map(t=>Jn(t)):[]}function Jn(e){let t=Object.entries(e.fields||[]).map(([r,o])=>({name:r,...Et(String(o))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function Hn(e,t){return vt(e)&&Array.isArray(e.layers)?e.layers.map(n=>Zn(n,t)):[]}function Zn(e,t){let n=[],r={},o=e.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($n(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function Wn(e,t){return e.map(n=>{let r=t.find(s=>s.name===n.name),o=r?.fields||n.fields||[],i={...n,...r,fields:o};return i.schema=Pt(i),i})}function bt(e){let t=Bt(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(At)&&[t[1],t[3]].every(_t))return[[t[0],t[1]],[t[2],t[3]]]}function Yn(e){let t=Bt(e);return Array.isArray(t)&&t.length===3&&At(t[0])&&_t(t[1])&&Xn(t[2])?t:null}function It(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function _t(e){return Number.isFinite(e)&&e<=90&&e>=-90}function At(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Xn(e){return Number.isFinite(e)&&e>=0&&e<=22}function Bt(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var St={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 $n(e={},t){let n=Et(e.type),r={name:e.attribute,...n};return typeof e.min=="number"&&(r.min=e.min),typeof e.max=="number"&&(r.max=e.max),typeof e.count=="number"&&(r.uniqueValueCount=e.count),e.values&&(r.values=e.values),r.values&&typeof t.maxValues=="number"&&(r.values=r.values?.slice(0,t.maxValues)),r}function Et(e){let t=e.toLowerCase();return!t||St[t],St[t]||{type:"string"}}var Kn="4.3.0-alpha.7",W={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Kn,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),r=JSON.parse(n),o={...W.options.tilejson,...t?.tilejson};return Oe(r,o)},parseTextSync:(e,t)=>{let n=JSON.parse(e),r={...W.options.tilejson,...t?.tilejson};return Oe(n,r)}};function we(e,t="float32"){return e instanceof Date?"date-millisecond":e instanceof Number?t:typeof e=="string"?"utf8":(e===null||e==="undefined","null")}function Mt(e){let t=Qn(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=we(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function Qn(e){switch(e.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 je(e){switch(e.shape){case"array-row-table":case"object-row-table":return er(e.data);case"geojson-table":return tr(e.features);case"columnar-table":return qn(e.data);case"arrow-table":default:throw new Error("Deduce schema")}}function qn(e){let t=[];for(let[n,r]of Object.entries(e)){let o=nr(r,n);t.push(o)}return{fields:t,metadata:{}}}function er(e){if(!e.length)throw new Error("deduce from empty table");let t=[],n=e[0];for(let[r,o]of Object.entries(n))t.push(Lt(o,r));return{fields:t,metadata:{}}}function tr(e){if(!e.length)throw new Error("deduce from empty table");let t=[],n=e[0].properties||{};for(let[r,o]of Object.entries(n))t.push(Lt(o,r));return{fields:t,metadata:{}}}function nr(e,t){if(ArrayBuffer.isView(e)){let n=Mt(e);return{name:t,type:n.type||"null",nullable:n.nullable}}if(Array.isArray(e)&&e.length>0){let n=e[0],r=we(n);return{name:t,type:r,nullable:!0}}throw new Error("empty table")}function Lt(e,t){let n=we(e);return{name:t,type:n,nullable:!0}}var ne={x:0,y:1,z:2};function O(e,t={}){let{start:n=0,end:r=e.length,plane:o="xy"}=t,i=t.size||2,s=0,a=ne[o[0]],l=ne[o[1]];for(let c=n,f=r-i;c<r;c+=i)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function ze(e,t,n=2,r,o="xy"){let i=t&&t.length,s=i?t[0]*n:e.length,a=Vt(e,0,s,n,!0,r&&r[0],o),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,p,d,y;if(i&&(a=cr(e,t,a,n,r,o)),e.length>80*n){h=f=e[0],p=u=e[1];for(let w=n;w<s;w+=n)d=e[w],y=e[w+1],d<h&&(h=d),y<p&&(p=y),d>f&&(f=d),y>u&&(u=y);c=Math.max(f-h,u-p),c=c!==0?32767/c:0}return re(a,l,n,h,p,c,0),l}function Vt(e,t,n,r,o,i,s){let a,l;i===void 0&&(i=O(e,{start:t,end:n,size:r,plane:s}));let c=ne[s[0]],f=ne[s[1]];if(o===i<0)for(a=t;a<n;a+=r)l=Dt(a,e[a+c],e[a+f],l);else for(a=n-r;a>=t;a-=r)l=Dt(a,e[a+c],e[a+f],l);return l&&Pe(l,l.next)&&(ie(l),l=l.next),l}function j(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Pe(n,n.next)||T(n.prev,n,n.next)===0)){if(ie(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function re(e,t,n,r,o,i,s){if(!e)return;!s&&i&&dr(e,r,o,i);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,i?sr(e,r,o,i):ir(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(c.i/n|0),ie(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=ar(j(e),t,n),re(e,t,n,r,o,i,2)):s===2&&lr(e,t,n,r,o,i):re(j(e),t,n,r,o,i,1);break}}}function ir(e){let t=e.prev,n=e,r=e.next;if(T(t,n,r)>=0)return!1;let o=t.x,i=n.x,s=r.x,a=t.y,l=n.y,c=r.y,f=o<i?o<s?o:s:i<s?i:s,u=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!==t;){if(d.x>=f&&d.x<=h&&d.y>=u&&d.y<=p&&Y(o,a,i,l,s,c,d.x,d.y)&&T(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function sr(e,t,n,r){let o=e.prev,i=e,s=e.next;if(T(o,i,s)>=0)return!1;let a=o.x,l=i.x,c=s.x,f=o.y,u=i.y,h=s.y,p=a<l?a<c?a:c:l<c?l:c,d=f<u?f<h?f:h:u<h?u:h,y=a>l?a>c?a:c:l>c?l:c,w=f>u?f>h?f:h:u>h?u:h,S=Re(p,d,t,n,r),v=Re(y,w,t,n,r),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=S&&g&&g.z<=v;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=w&&m!==o&&m!==s&&Y(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=p&&g.x<=y&&g.y>=d&&g.y<=w&&g!==o&&g!==s&&Y(a,f,l,u,c,h,g.x,g.y)&&T(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;m&&m.z>=S;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=w&&m!==o&&m!==s&&Y(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=v;){if(g.x>=p&&g.x<=y&&g.y>=d&&g.y<=w&&g!==o&&g!==s&&Y(a,f,l,u,c,h,g.x,g.y)&&T(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function ar(e,t,n){let r=e;do{let o=r.prev,i=r.next.next;!Pe(o,i)&&Nt(o,r,r.next,i)&&oe(o,i)&&oe(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),ie(r),ie(r.next),r=e=i),r=r.next}while(r!==e);return j(r)}function lr(e,t,n,r,o,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&yr(s,a)){let l=kt(s,a);s=j(s,s.next),l=j(l,l.next),re(s,t,n,r,o,i,0),re(l,t,n,r,o,i,0);return}a=a.next}s=s.next}while(s!==e)}function cr(e,t,n,r,o,i){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*r,f=a<l-1?t[a+1]*r:e.length,u=Vt(e,c,f,r,!1,o&&o[a+1],i),u===u.next&&(u.steiner=!0),s.push(gr(u));for(s.sort(fr),a=0;a<s.length;a++)n=ur(s[a],n);return n}function fr(e,t){return e.x-t.x}function ur(e,t){let n=hr(e,t);if(!n)return t;let r=kt(n,e);return j(r,r.next),j(n,n.next)}function hr(e,t){let n=t,r=e.x,o=e.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!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;n=s;do r>=n.x&&n.x>=l&&r!==n.x&&Y(o<c?r:i,o,l,c,o<c?i:r,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(r-n.x),oe(n,e)&&(u<f||u===f&&(n.x>s.x||n.x===s.x&&pr(s,n)))&&(s=n,f=u)),n=n.next;while(n!==a);return s}function pr(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function dr(e,t,n,r){let o=e;do o.z===0&&(o.z=Re(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,mr(o)}function mr(e){let t,n,r=1,o,i,s,a,l,c;do{for(i=e,e=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)?(t=i,i=i.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;i=a}c.nextZ=null,r*=2}while(o>1);return e}function Re(e,t,n,r,o){return e=(e-n)*o|0,t=(t-r)*o|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 gr(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 Y(e,t,n,r,o,i,s,a){return(o-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(r-a)>=(n-s)*(t-a)&&(n-s)*(i-a)>=(o-s)*(r-a)}function yr(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!xr(e,t)&&(oe(e,t)&&oe(t,e)&&wr(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||Pe(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 Pe(e,t){return e.x===t.x&&e.y===t.y}function Nt(e,t,n,r){let o=Fe(T(e,t,n)),i=Fe(T(e,t,r)),s=Fe(T(n,r,e)),a=Fe(T(n,r,t));return!!(o!==i&&s!==a||o===0&&Te(e,n,t)||i===0&&Te(e,r,t)||s===0&&Te(n,e,r)||a===0&&Te(n,t,r))}function Te(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 Fe(e){return e>0?1:e<0?-1:0}function xr(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&&Nt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function oe(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 wr(e,t){let n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.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!==e);return r}function kt(e,t){let n=new se(e.i,e.x,e.y),r=new se(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function Dt(e,t,n,r){let o=new se(e,t,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 ie(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 se=class{constructor(t,n,r){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=n,this.y=r}};function Ze(e,t,n){let r=Ir(e),o=Object.keys(r).filter(i=>r[i]!==Array);return Sr(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||o,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function Ir(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let o=n.properties[r];t[r]=Mr(o,t[r])}return t}function Sr(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:o,linePositionsCount:i,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:p}=t,{numericPropKeys:d=[],PositionDataType:y=Float32Array,triangulate:w=!0}=n,S=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(r*p),globalFeatureIds:new v(r),featureIds:o>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(i*p),globalFeatureIds:new v(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},b={type:"Polygon",polygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:l>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new y(l*p),globalFeatureIds:new v(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};w&&(b.triangles=[]);for(let P of[m,g,b])for(let A of d){let B=h[A];P.numericProps[A]=new B(P.positions.length/p)}g.pathIndices[s]=i,b.polygonIndices[c]=l,b.primitivePolygonIndices[f]=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 P of e){let A=P.geometry,B=P.properties||{};switch(A.type){case"Point":vr(A,m,I,p,B),m.properties.push(He(B,d)),S&&m.fields.push({id:P.id}),I.pointFeature++;break;case"LineString":_r(A,g,I,p,B),g.properties.push(He(B,d)),S&&g.fields.push({id:P.id}),I.lineFeature++;break;case"Polygon":Ar(A,b,I,p,B),b.properties.push(He(B,d)),S&&b.fields.push({id:P.id}),I.polygonFeature++;break;default:throw new Error("Invalid geometry type")}I.feature++}return Er(m,g,b,p)}function vr(e,t,n,r,o){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;We(t,o,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 _r(e,t,n,r,o){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;We(t,o,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],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(c-l)/r}}function Ar(e,t,n,r,o){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;We(t,o,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 c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let p=0,d=f.length;p<d;++p){let y=f[p],w=p===d-1?u===void 0?e.data.length:u[0]:f[p+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(w-y)/r}let h=n.polygonPosition;Br(t,c,f,{startPosition:l,endPosition:h,coordLength:r})}}function Br(e,t,n,{startPosition:r,endPosition:o,coordLength:i}){if(!e.triangles)return;let s=r*i,a=o*i,l=e.positions.subarray(s,a),c=n[0],f=n.slice(1).map(h=>(h-c)/i),u=ze(l,f,i,t);for(let h=0,p=u.length;h<p;++h)e.triangles.push(r+u[h])}function Je(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function Er(e,t,n,r){let o={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Je(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Je(t.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:Je(n.numericProps,1)}};return o.polygons&&n.triangles&&(o.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),o}function We(e,t,n,r){for(let o in e.numericProps)if(o in t){let i=t[o];e.numericProps[o].fill(i,n,n+r)}}function He(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function Mr(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function ae(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var V={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Lr=V.self||V.window||V.global||{},Dr=V.window||V.self||V.global||{},Vr=V.global||V.self||V.window||{},Nr=V.document||{};var Ye=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Gt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),kr=Gt&&parseFloat(Gt[1])||0;function C(e){return C=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},C(e)}function Xe(e,t){if(C(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(C(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $e(e){var t=Xe(e,"string");return C(t)==="symbol"?t:String(t)}function _(e,t,n){return t=$e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ke(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 L(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Ke()}var Cr=globalThis.self||globalThis.window||globalThis.global,X=globalThis.window||globalThis.self||globalThis.global,Ur=globalThis.document||{},R=globalThis.process||{},Gr=globalThis.console,ys=globalThis.navigator||{};var be=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Ts=L();function Or(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Ie=class{constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";_(this,"storage",void 0),_(this,"id",void 0),_(this,"config",void 0),this.storage=Or(r),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 Ot(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 jt(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 Se(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(n=Math.min(n,r/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(o,");"),"background-size:".concat(i,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}var ve;(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"})(ve||(ve={}));var jr=10;function Rt(e){return typeof e!="string"?e:(e=e.toUpperCase(),ve[e]||ve.WHITE)}function zt(e,t,n){if(!L&&typeof e=="string"){if(t){let r=Rt(t);e="\x1B[".concat(r,"m").concat(e,"\x1B[39m")}if(n){let r=Rt(n);e="\x1B[".concat(r+jr,"m").concat(e,"\x1B[49m")}}return e}function Jt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),o=e;for(let i of r){let s=o[i];typeof s=="function"&&(t.find(a=>i===a)||(o[i]=s.bind(e)))}}function $(e,t){if(!e)throw new Error(t||"Assertion failed")}function z(){let e;if(L()&&X.performance){var t,n;e=X===null||X===void 0||(t=X.performance)===null||t===void 0||(n=t.now)===null||n===void 0?void 0:n.call(t)}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);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var K={debug:L()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Rr={enabled:!0,level:0};function E(){}var Ht={},Zt={once:!0},U=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};_(this,"id",void 0),_(this,"VERSION",be),_(this,"_startTs",z()),_(this,"_deltaTs",z()),_(this,"_storage",void 0),_(this,"userData",{}),_(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new Ie("__probe-".concat(this.id,"__"),Rr),this.timeStamp("".concat(this.id," started")),Jt(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((z()-this._startTs).toPrecision(10))}getDelta(){return Number((z()-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){$(t,n)}warn(t){return this._getLogFunction(0,t,K.warn,arguments,Zt)}error(t){return this._getLogFunction(0,t,K.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,K.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,K.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,K.debug||K.info,arguments,Zt)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||E,r&&[r],{tag:Zr(n)}):E}image(t){let{logLevel:n,priority:r,image:o,message:i="",scale:s=1}=t;return this._shouldLog(n||r)?L()?Hr({image:o,message:i,scale:s}):Jr({image:o,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 r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=Wt({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||E)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Yt(t)}_getLogFunction(t,n,r,o,i){if(this._shouldLog(t)){i=Wt({logLevel:t,message:n,args:o,opts:i}),r=r||i.method,$(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=z();let s=i.tag||i.message;if(i.once&&s)if(!Ht[s])Ht[s]=z();else return E;return n=zr(this.id,i.message,i),r.bind(console,n,...i.args)}return E}};_(U,"VERSION",be);function Yt(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 $(Number.isFinite(t)&&t>=0),t}function Wt(e){let{logLevel:t,message:n}=e;e.logLevel=Yt(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return $(o==="string"||o==="object"),Object.assign(e,{args:r},e.opts)}function zr(e,t,n){if(typeof t=="string"){let r=n.time?jt(Ot(n.total)):"";t=n.time?"".concat(e,": ").concat(r," ").concat(t):"".concat(e,": ").concat(t),t=zt(t,n.color,n.background)}return t}function Jr(e){let{image:t,message:n="",scale:r=1}=e;return console.warn("removed"),E}function Hr(e){let{image:t,message:n="",scale:r=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let s=Se(i,n,r);console.log(...s)},i.src=t,E}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...Se(t,n,r)),E;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Se(i,n,r)),i.src=t.toDataURL(),E}return E}function Zr(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}var Ws=new U({id:"@probe.gl/log"});var Qe="4.3.0-alpha.7",Wr=Qe[0]>="0"&&Qe[0]<="9"?`v${Qe}`:"";function Yr(){let e=new U({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=Wr,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var F=Yr();var Xr="",Xt={};function qe(e){for(let t in Xt)if(e.startsWith(t)){let n=Xt[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Xr}${e}`),e}var le=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=$r(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 $r(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,o)=>t(r,o);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var rt=wt(nn(),1);function mo(e){let t=0;for(let n=0,r=e.length-1,o,i;n<e.length;r=n++)o=e[n],i=e[r],t+=(i[0]-o[0])*(o[1]+i[1]);return t}function ce(e,t){if(Array.isArray(e[0])){for(let r of e)ce(r,t);return}let n=e;n[0]/=t,n[1]/=t}function rn(e,t){for(let n=0;n<e.length;++n)e[n]/=t}function fe(e,t,n){if(typeof e[0][0]!="number"){for(let s of e)fe(s,t,n);return}let r=n*Math.pow(2,t.z),o=n*t.x,i=n*t.y;for(let s=0;s<e.length;s++){let a=e[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 on(e,t,n){let{x:r,y:o,z:i}=t,s=n*Math.pow(2,i),a=n*r,l=n*o;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function sn(e){let t=e.length;if(t<=1)return[e];let n=[],r,o;for(let i=0;i<t;i++){let s=mo(e[i]);s!==0&&(o===void 0&&(o=s<0),o===s<0?(r&&n.push(r),r=[e[i]]):r&&r.push(e[i]))}return r&&n.push(r),n}function an(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[O(e.data)]],indices:[e.indices]};let r=[],o=[],i=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),p=O(h);if(p===0){let d=e.data.slice(0,u),y=e.data.slice(c);e.data=d.concat(y),l+=c-u;continue}a===void 0&&(a=p<0),a===p<0?(s.length&&(r.push(i),o.push(s)),s=[u],i=[p]):(i.push(p),s.push(u))}return i&&r.push(i),s.length&&o.push(s),{type:n,areas:r,indices:o,data:e.data}}var J=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,o,i,s){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=o,this._values=i,this._geometryInfo=s,t.readFields(go,this,n)}toGeoJSONFeature(t,n){let r=this.loadGeometry();switch(t){case"wgs84":return ln(this,r,o=>fe(o,n,this.extent));default:return ln(this,r,ce)}}toBinaryFeature(t,n){let r=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(r,o=>on(o,n,this.extent));default:return this._toBinaryCoordinates(r,rn)}}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o=0,i=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<n;){if(o<=0){let u=t.readVarint();r=u&7,o=u>>3}if(o--,r===1||r===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<c&&(c=s),s>f&&(f=s);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,c,l,f]}_toBinaryCoordinates(t,n){let r;n(t.data,this.extent);let o=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,r={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/o,r={type:"LineString",...t};break;case 3:r=an(t),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 t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o=0,i=0,s=0,a=[],l;for(;t.pos<n;){if(o<=0){let c=t.readVarint();r=c&7,o=c>>3}switch(o--,r){case 1:case 2:i+=t.readSVarint(),s+=t.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 t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o,i=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<n;)if(i<=0&&(o=t.readVarint(),r=o&7,i=o>>3),i--,r===1||r===2)s+=t.readSVarint(),a+=t.readSVarint(),r===1&&c.push(l),f.push(s,a),l+=2;else if(r===7){if(l>0){let u=c[c.length-1];f.push(f[u],f[u+1]),l+=2}}else throw new Error(`unknown command ${r}`);return{data:f,indices:c}}};xe(J,"types",["Unknown","Point","LineString","Polygon"]);function ln(e,t,n){let r=J.types[e.type],o,i,s;switch(e.type){case 1:let l=[];for(o=0;o<t.length;o++)l[o]=t[o][0];s=l,n(s,e.extent);break;case 2:for(s=t,o=0;o<s.length;o++)n(s[o],e.extent);break;case 3:for(s=sn(t),o=0;o<s.length;o++)for(i=0;i<s[o].length;i++)n(s[o][i],e.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:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function go(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?yo(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function yo(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],o=t._values[e.readVarint()];t.properties[r]=o}}var Be=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(xo,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 J(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 r=this._pbf.readVarint()+this._pbf.pos;return new J(this._pbf,r,this.extent,this._keys,this._values,n)}};function xo(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(wo(n)))}function wo(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var ue=class{layers;constructor(t,n){this.layers=t.readFields(To,{},n)}};function To(e,t,n){if(e===3&&n){let r=new Be(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function ot(e,t){let n=Po(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:nt(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:cn(e,n)};case"geojson":return cn(e,n);case"binary-geometry":return nt(e,n);case"binary":return nt(e,n);default:throw new Error(r||"undefined shape")}}function nt(e,t){let[n,r]=Fo(e,t),o=Ze(n,r);return o.byteLength=e.byteLength,o}function Fo(e,t){let n=[],r={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,r];let o=new ue(new rt.default(e));return(t&&Array.isArray(t.layers)?t.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),f=Io(c,t,s);n.push(f)}}),[n,r]}function cn(e,t){if(e.byteLength<=0)return[];let n=[],r=new ue(new rt.default(e));return(Array.isArray(t.layers)?t.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=bo(l,t,i);n.push(c)}}),n}function Po(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&&F.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function bo(e,t,n){let r=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(r.properties||={},r.properties[t.layerProperty]=n),r}function Io(e,t,n){let r=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}var So="4.3.0-alpha.7",it={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:So,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}}},Ee={...it,parse:async(e,t)=>ot(e,t),parseSync:ot,binary:!0};var fn="4.3.0-alpha.7";var vo=globalThis.loaders?.parseImageNode,st=typeof Image<"u",at=typeof ImageBitmap<"u",_o=Boolean(vo),lt=Ye?!0:_o;function un(e){switch(e){case"auto":return at||st||lt;case"imagebitmap":return at;case"image":return st;case"data":return lt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function hn(){if(at)return"imagebitmap";if(st)return"image";if(lt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Ao(e){let t=Bo(e);if(!t)throw new Error("Not an image");return t}function pn(e){switch(Ao(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 Bo(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 Eo=/^data:image\/svg\+xml/,Mo=/\.svg((\?|#).*)?$/;function Me(e){return e&&(Eo.test(e)||Mo.test(e))}function dn(e,t){if(Me(t)){let r=new TextDecoder().decode(e);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 ct(e,t)}function ct(e,t){if(Me(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Le(e,t,n){let r=dn(e,n),o=self.URL||self.webkitURL,i=typeof r!="string"&&o.createObjectURL(r);try{return await Lo(i||r,t)}finally{i&&o.revokeObjectURL(i)}}async function Lo(e,t){let n=new Image;return n.src=e,t.image&&t.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 Do={},mn=!0;async function gn(e,t,n){let r;Me(n)?r=await Le(e,t,n):r=ct(e,n);let o=t&&t.imagebitmap;return await Vo(r,o)}async function Vo(e,t=null){if((No(t)||!mn)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),mn=!1}return await createImageBitmap(e)}function No(e){for(let t in e||Do)return!1;return!0}function yn(e){return!Go(e,"ftyp",4)||!(e[8]&96)?null:ko(e)}function ko(e){switch(Co(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Co(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Uo(e){return[...e].map(t=>t.charCodeAt(0))}function Go(e,t,n=0){let r=Uo(t);for(let o=0;o<r.length;++o)if(r[o]!==e[o+n])return!1;return!0}var N=!1,he=!0;function H(e){let t=pe(e);return jo(t)||Jo(t)||Ro(t)||zo(t)||Oo(t)}function Oo(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=yn(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function jo(e){let t=pe(e);return t.byteLength>=24&&t.getUint32(0,N)===2303741511?{mimeType:"image/png",width:t.getUint32(16,N),height:t.getUint32(20,N)}:null}function Ro(e){let t=pe(e);return t.byteLength>=10&&t.getUint32(0,N)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,he),height:t.getUint16(8,he)}:null}function zo(e){let t=pe(e);return t.byteLength>=14&&t.getUint16(0,N)===16973&&t.getUint32(2,he)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,he),height:t.getUint32(22,he)}:null}function Jo(e){let t=pe(e);if(!(t.byteLength>=3&&t.getUint16(0,N)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:o}=Ho(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,N);if(o.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,N),width:t.getUint16(i+7,N)};if(!r.has(s))return null;i+=2,i+=t.getUint16(i,N)}return null}function Ho(){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 pe(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 xn(e,t){let{mimeType:n}=H(e)||{},r=globalThis.loaders?.parseImageNode;return ae(r),await r(e,n)}async function wn(e,t,n){t=t||{};let o=(t.image||{}).type||"auto",{url:i}=n||{},s=Zo(o),a;switch(s){case"imagebitmap":a=await gn(e,t,i);break;case"image":a=await Le(e,t,i);break;case"data":a=await xn(e,t);break;default:ae(!1)}return o==="data"&&(a=pn(a)),a}function Zo(e){switch(e){case"auto":case"data":return hn();default:return un(e),e}}var Wo=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Yo=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Xo={image:{type:"auto",decode:!0}},ft={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:fn,mimeTypes:Yo,extensions:Wo,parse:wn,tests:[e=>Boolean(H(new DataView(e)))],options:Xo};var Tn={name:"MVT",id:"mvt",module:"mvt",version:"0.0.0",extensions:["mvt"],mimeTypes:["application/octet-stream"],options:{mvt:{}},type:"mvt",fromUrl:!0,fromBlob:!1,testURL:e=>!0,createDataSource(e,t){return new ut(e,t)}},ut=class extends le{props;url;metadataUrl=null;data;schema="tms";metadata;extension;mimeType=null;constructor(t,n){super(n),this.props=n,this.url=qe(t),this.metadataUrl=n.mvt?.metadataUrl||`${this.url}/tilejson.json`,this.extension=n.mvt?.extension||".png",this.data=this.url,this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata(),$o(this.url)&&(this.schema="template")}async getMetadata(){if(!this.metadataUrl)return null;let t;try{t=await this.fetch(this.metadataUrl)}catch(o){return console.error(o.message),null}if(!t.ok)return console.error(t.statusText),null;let n=await t.text();return W.parseTextSync?.(n)||null}getTileMIMEType(){return this.mimeType}async getTile(t){let{x:n,y:r,z:o}=t,i=this.getTileURL(n,r,o),s=await this.fetch(i);return s.ok?await s.arrayBuffer():null}async getTileData(t){let{x:n,y:r,z:o}=t.index,i=await this.getTile({x:n,y:r,z:o,layers:[]});if(i===null)return null;let s=H(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(t){let n=await this.getTile(t);return n?this._parseImageTile(n):null}async _parseImageTile(t){return await ft.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 r={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:n.x,y:n.y,z:n.z},...this.loadOptions?.mvt},...this.loadOptions};return await Ee.parse(t,r)}getMetadataUrl(){return this.metadataUrl}getTileURL(t,n,r){switch(this.schema){case"xyz":return`${this.url}/${t}/${n}/${r}${this.extension}`;case"tms":return`${this.url}/${r}/${t}/${n}${this.extension}`;case"template":return ei(this.url,t,n,r,"0");default:throw new Error(this.schema)}}};function $o(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(e)}var Ko=new RegExp("{x}","g"),Qo=new RegExp("{y}","g"),qo=new RegExp("{z}","g");function ei(e,t,n,r,o="0"){if(Array.isArray(e)){let s=ti(o)%e.length;e=e[s]}let i=e;return i=i.replace(Ko,String(t)),i=i.replace(Qo,String(n)),i=i.replace(qo,String(r)),Number.isInteger(n)&&Number.isInteger(r)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,r)-n-1))),i}function ti(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function de(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var M=class{constructor(t,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=t,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(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=de(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(de()-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 Z=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,o=this.stats[n];return o||(t instanceof M?o=t:o=new M(n,r),this.stats[n]=o),o}};function Fn(e,t,n,r,o){let i=t===o.maxZoom?0:o.tolerance/((1<<t)*o.extent),s={protoFeatures:[],sourceFeatures:null,numPoints:0,numSimplified:0,numFeatures:e.length,x:n,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let a of e)ni(s,a,i,o);return s}function ni(e,t,n,r){let o=t.geometry,i=t.type,s=[];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);let a;switch(i){case"Point":case"MultiPoint":a=1;for(let l=0;l<o.length;l+=3)s.push(o[l],o[l+1]),e.numPoints++,e.numSimplified++;break;case"LineString":a=2,De(s,o,e,n,!1,!1);break;case"MultiLineString":a=2;for(let l=0;l<o.length;l++)De(s,o[l],e,n,!1,l===0);break;case"Polygon":a=3;for(let l=0;l<o.length;l++)De(s,o[l],e,n,!0,l===0);break;case"MultiPolygon":a=3;for(let l=0;l<o.length;l++){let c=o[l];for(let f=0;f<c.length;f++)De(s,c[f],e,n,!0,f===0)}break;default:throw new Error(`Unknown geometry type: ${i}`)}if(s.length){let l=t.tags||null;if(i==="LineString"&&r.lineMetrics){l={};for(let f in t.tags)l[f]=t.tags[f];l.mapbox_clip_start=o.start/o.size,l.mapbox_clip_end=o.end/o.size}let c={geometry:s,simplifiedType:a,tags:l};t.id!==null&&(c.id=t.id),e.protoFeatures.push(c)}}function De(e,t,n,r,o,i){let s=r*r;if(r>0&&t.size<(o?s:r)){n.numPoints+=t.length/3;return}let a=[];for(let l=0;l<t.length;l+=3)(r===0||t[l+2]>s)&&(n.numSimplified++,a.push(t[l],t[l+1])),n.numPoints++;o&&ri(a,i),e.push(a)}function ri(e,t){let n=0;for(let r=0,o=e.length-2;r<e.length;o=r,r+=2)n+=(e[r]-e[o])*(e[r+1]+e[o+1]);if(n>0===t)for(let r=0,o=e.length;r<o/2;r+=2){let i=e[r],s=e[r+1];e[r]=e[o-2-r],e[r+1]=e[o-1-r],e[o-2-r]=i,e[o-1-r]=s}}function ht(e,t){if(e.transformed)return e;let n=1<<e.z,r=e.x,o=e.y;for(let i of e.protoFeatures){let s=i.geometry,a=i.simplifiedType;if(i.geometry=[],a===1)for(let l=0;l<s.length;l+=2)i.geometry.push(Pn(s[l],s[l+1],t,n,r,o));else for(let l=0;l<s.length;l++){let c=[];for(let f=0;f<s[l].length;f+=2)c.push(Pn(s[l][f],s[l][f+1],t,n,r,o));i.geometry.push(c)}}return e.transformed=!0,e}function Pn(e,t,n,r,o,i){return[Math.round(n*(e*r-o)),Math.round(n*(t*r-i))]}function bn(e,t){let n=[];for(let o of e.protoFeatures){if(!o||!o.geometry)continue;let i,s;switch(o.simplifiedType){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:throw new Error(`${o.simplifiedType}is not a valid simplified type`)}switch(t.coordinates){case"EPSG:4326":case"wgs84":fe(s,t.tileIndex,t.extent);break;default:ce(s,t.extent);break}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}}function G(e,t,n,r){let o={id:e??null,type:t,simplifiedType:void 0,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(t){case"Point":case"MultiPoint":case"LineString":Ve(o,n);break;case"MultiLineString":for(let i of n)Ve(o,i);break;case"Polygon":Ve(o,n[0]);break;case"MultiPolygon":for(let i of n)Ve(o,i[0]);break;default:throw new Error(String(t))}return o}function Ve(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 Ne(e,t,n,r){let o=r,i=n-t>>1,s=n-t,a,l=e[t],c=e[t+1],f=e[n],u=e[n+1];for(let h=t+3;h<n;h+=3){let p=oi(e[h],e[h+1],l,c,f,u);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-t>3&&Ne(e,t,a,r),e[a+2]=o,n-a>3&&Ne(e,a,n,r))}function oi(e,t,n,r,o,i){let s=o-n,a=i-r;if(s!==0||a!==0){let l=((e-n)*s+(t-r)*a)/(s*s+a*a);l>1?(n=o,r=i):l>0&&(n+=s*l,r+=a*l)}return s=e-n,a=t-r,s*s+a*a}function Sn(e,t){let n=[];switch(e.type){case"FeatureCollection":let r=0;for(let o of e.features)n.push(ke(o,t,r++));break;case"Feature":n.push(ke(e,t));break;default:n.push(ke({geometry:e},t))}return n}function ke(e,t,n){if(!e.geometry)return;let r=e.geometry.coordinates,o=e.geometry.type,i=Math.pow(t.tolerance/((1<<t.maxZoom)*t.extent),2),s=[],a=e.id;switch(t.promoteId?a=e.properties[t.promoteId]:t.generateId&&(a=n||0),o){case"Point":In(r,s);break;case"MultiPoint":for(let l of r)In(l,s);break;case"LineString":dt(r,s,i,!1);break;case"MultiLineString":if(t.lineMetrics){for(let l of r)s=[],dt(l,s,i,!1),features.push(G(a,"LineString",s,e.properties));return}break;case"Polygon":pt(r,s,i,!0);break;case"MultiPolygon":for(let l of r){let c=[];pt(l,c,i,!0),s.push(c)}break;case"GeometryCollection":for(let l of e.geometry.geometries)ke(features,{id:a,geometry:l,properties:e.properties},t,n);break;default:throw new Error("Input data is not a valid GeoJSON object.")}return G(a,o,s,e.properties)}function In(e,t){t.push(vn(e[0]),_n(e[1]),0)}function dt(e,t,n,r){let o,i,s=0;for(let l=0;l<e.length;l++){let c=vn(e[l][0]),f=_n(e[l][1]);t.push(c,f,0),l>0&&(r?s+=(o*f-c*i)/2:s+=Math.sqrt(Math.pow(c-o,2)+Math.pow(f-i,2))),o=c,i=f}let a=t.length-3;t[2]=1,Ne(t,0,a,n),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function pt(e,t,n,r){for(let o=0;o<e.length;o++){let i=[];dt(e[o],i,n,r),t.push(i)}}function vn(e){return e/360+.5}function _n(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 D(e,t,n,r,o,i,s,a){if(n/=t,r/=t,i>=n&&s<r)return e;if(s<n||i>=r)return null;let l=[];for(let c of e){let f=c.geometry,u=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(u==="Point"||u==="MultiPoint")ii(f,d,n,r,o);else if(u==="LineString")Bn(f,d,n,r,o,!1,a.lineMetrics);else if(u==="MultiLineString")mt(f,d,n,r,o,!1);else if(u==="Polygon")mt(f,d,n,r,o,!0);else if(u==="MultiPolygon")for(let y of f){let w=[];mt(y,w,n,r,o,!0),w.length&&d.push(w)}if(d.length){if(a.lineMetrics&&u==="LineString"){for(let y of d)l.push(G(c.id,u,y,c.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(G(c.id,u,d,c.tags))}}return l.length?l:null}function ii(e,t,n,r,o){for(let i=0;i<e.length;i+=3){let s=e[i+o];s>=n&&s<=r&&ee(t,e[i],e[i+1],e[i+2])}}function Bn(e,t,n,r,o,i,s){let a=An(e),l=o===0?si:ai,c=e.start,f,u;for(let S=0;S<e.length-3;S+=3){let v=e[S],m=e[S+1],g=e[S+2],b=e[S+3],I=e[S+4],P=o===0?v:m,A=o===0?b:I,B=!1;s&&(f=Math.sqrt(Math.pow(v-b,2)+Math.pow(m-I,2))),P<n?A>n&&(u=l(a,v,m,b,I,n),s&&(a.start=c+f*u)):P>r?A<r&&(u=l(a,v,m,b,I,r),s&&(a.start=c+f*u)):ee(a,v,m,g),A<n&&P>=n&&(u=l(a,v,m,b,I,n),B=!0),A>r&&P<=r&&(u=l(a,v,m,b,I,r),B=!0),!i&&B&&(s&&(a.end=c+f*u),t.push(a),a=An(e)),s&&(c+=f)}let h=e.length-3,p=e[h],d=e[h+1],y=e[h+2],w=o===0?p:d;w>=n&&w<=r&&ee(a,p,d,y),h=a.length-3,i&&h>=3&&(a[h]!==a[0]||a[h+1]!==a[1])&&ee(a,a[0],a[1],a[2]),a.length&&t.push(a)}function An(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function mt(e,t,n,r,o,i){for(let s of e)Bn(s,t,n,r,o,i,!1)}function ee(e,t,n,r){e.push(t,n,r)}function si(e,t,n,r,o,i){let s=(i-t)/(r-t);return ee(e,i,n+(o-n)*s,1),s}function ai(e,t,n,r,o,i){let s=(i-n)/(o-n);return ee(e,t+(r-t)*s,i,1),s}function Mn(e,t){let n=t.buffer/t.extent,r=e,o=D(e,1,-1-n,n,0,-1,2,t),i=D(e,1,1-n,2+n,0,-1,2,t);return(o||i)&&(r=D(e,1,-n,1+n,0,-1,2,t)||[],o&&(r=En(o,1).concat(r)),i&&(r=r.concat(En(i,-1)))),r}function En(e,t){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=o.type,s;switch(i){case"Point":case"MultiPoint":case"LineString":s=gt(o.geometry,t);break;case"MultiLineString":case"Polygon":s=[];for(let a of o.geometry)s.push(gt(a,t));break;case"MultiPolygon":s=[];for(let a of o.geometry){let l=[];for(let c of a)l.push(gt(c,t));s.push(l)}break;default:throw new Error(String(i))}n.push(G(o.id,i,s,o.tags))}return n}function gt(e,t){let n=[];n.size=e.size,e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}var xt={name:"TableTiler",id:"table-tiler",version:"0.0.0",extensions:["mvt"],mimeTypes:["application/octet-stream"],options:{table:{coordinates:"local",promoteId:void 0,maxZoom:14,indexMaxZoom:5,maxPointsPerTile:1e4,tolerance:3,extent:4096,buffer:64,generateId:void 0}},type:"table",testURL:e=>e.endsWith(".geojson"),createDataSource(e,t){let n=typeof e=="string"||e instanceof Blob,r=t?.table?.loaders?.[0],o=n?li(e,r):e;return new Ce(o,t)}};async function li(e,t){if(typeof e=="string"){let o=await(await fetch(e)).arrayBuffer();return await t.parse(o)}let n=await e.arrayBuffer();return await t.parse(n)}var Ue=class{stats=new Z({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(t,n){this.props={...xt.options.table,...n?.table},this.getTileData=this.getTileData.bind(this),this.ready=this.initializeTilesAsync(t),this.metadata=this.getMetadata()}async initializeTilesAsync(t){let n=await t;this.schema=je(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(t){await this.ready;let n=this.getTileSync(t);return F.info(2,"getVectorTile",t,n)(),n}async getTile(t){return await this.ready,this.getTileSync(t)}async getTileData(t){let{x:n,y:r,z:o}=t.index;return(await this.getVectorTile({x:n,y:r,z:o}))?.features||[]}getTileSync(t){let n=this.getProtoTile(t);return n?bn(n,{coordinates:this.props.coordinates,tileIndex:t,extent:this.props.extent}):null}createRootTiles(t){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,"DynamicVectorTileSource creating root tiles",this.props)(),F.time(1,"preprocess table")();let n=Sn(t,this.props);if(F.timeEnd(1,"preprocess table")(),F.time(1,"generate tiles")(),n=Mn(n,this.props),n.length===0){F.log(1,"DynamicVectorTileSource: 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,`DynamicVectorTileSource: tiles generated: ${this.stats.get("total").count}`,this.stats)()}getProtoTile(t){let{z:n,y:r}=t,{x:o}=t,{extent:i}=this.props;if(n<0||n>24)return null;let s=1<<n;o=o+s&s-1;let a=yt(n,o,r);if(this.tiles[a])return ht(this.tiles[a],i);F.log(F,"drilling down to z%d-%d-%d",n,o,r)();let l=n,c=o,f=r,u;for(;!u&&l>0;)l--,c=c>>1,f=f>>1,u=this.tiles[yt(l,c,f)];return!u||!u.sourceFeatures?null:(F.log(1,"found parent tile z%d-%d-%d",l,c,f)(),F.time(1,"drilling down")(),this.splitTile(u.sourceFeatures,l,c,f,n,o,r),F.timeEnd(1,"drilling down")(),this.tiles[a]?ht(this.tiles[a],i):null)}splitTile(t,n,r,o,i,s,a){let l=[t,n,r,o];for(;l.length;){o=l.pop(),r=l.pop(),n=l.pop(),t=l.pop();let c=1<<n,f=yt(n,r,o),u=this.tiles[f];if(!u){F.time(2,"tile creation")(),u=this.tiles[f]=Fn(t,n,r,o,this.props),this.tileCoords.push({z:n,x:r,y:o});let I=`z${n}`,P=this.stats.get(I,"count");P.incrementCount(),P=this.stats.get("total"),P.incrementCount(),P=Ue.stats.get(I,"count"),P.incrementCount(),P=Ue.stats.get("total"),P.incrementCount(),F.log(2,"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,r,o,u.numFeatures,u.numPoints,u.numSimplified)(),F.timeEnd(2,"tile creation")()}if(u.sourceFeatures=t,i===void 0){if(n===this.props.indexMaxZoom||u.numPoints<=this.props.maxPointsPerTile)continue}else{if(n===this.props.maxZoom||n===i)continue;if(i!==void 0){let I=i-n;if(r!==s>>I||o!==a>>I)continue}}if(u.sourceFeatures=null,t.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,w=null,S=null,v=null,m=null,g=D(t,c,r-h,r+d,0,u.minX,u.maxX,this.props),b=D(t,c,r+p,r+y,0,u.minX,u.maxX,this.props);t=null,g&&(w=D(g,c,o-h,o+d,1,u.minY,u.maxY,this.props),S=D(g,c,o+p,o+y,1,u.minY,u.maxY,this.props),g=null),b&&(v=D(b,c,o-h,o+d,1,u.minY,u.maxY,this.props),m=D(b,c,o+p,o+y,1,u.minY,u.maxY,this.props),b=null),F.timeEnd(2,"clipping tile")(),l.push(w||[],n+1,r*2,o*2),l.push(S||[],n+1,r*2,o*2+1),l.push(v||[],n+1,r*2+1,o*2),l.push(m||[],n+1,r*2+1,o*2+1)}}},Ce=Ue;xe(Ce,"stats",new Z({id:"table-tile-source-all",stats:[new M("count","tiles"),new M("count","features")]}));function yt(e,t,n){return((1<<e)*n+t)*32+e}return Gn(me);})();
8
8
  /*! Bundled license information:
9
9
 
10
10
  ieee754/index.js:
package/dist/index.cjs CHANGED
@@ -302,7 +302,7 @@ function attributeTypeToFieldType(aType) {
302
302
  }
303
303
 
304
304
  // dist/tilejson-loader.js
305
- var VERSION = true ? "4.3.0-alpha.5" : "latest";
305
+ var VERSION = true ? "4.3.0-alpha.7" : "latest";
306
306
  var TileJSONLoader = {
307
307
  dataType: null,
308
308
  batchType: null,
@@ -980,7 +980,7 @@ function getDecodedFeatureBinary(feature, options, layerName) {
980
980
  }
981
981
 
982
982
  // dist/mvt-loader.js
983
- var VERSION2 = true ? "4.3.0-alpha.5" : "latest";
983
+ var VERSION2 = true ? "4.3.0-alpha.7" : "latest";
984
984
  var MVTWorkerLoader = {
985
985
  dataType: null,
986
986
  batchType: null,