@loaders.gl/pmtiles 4.3.1 → 4.4.0-alpha.1
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 +95 -47
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +29 -24
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/pmtiles-format.d.ts +12 -0
- package/dist/pmtiles-format.d.ts.map +1 -0
- package/dist/pmtiles-format.js +14 -0
- package/dist/pmtiles-loader.d.ts +8 -8
- package/dist/pmtiles-loader.d.ts.map +1 -1
- package/dist/pmtiles-loader.js +2 -6
- package/dist/pmtiles-source.d.ts +19 -21
- package/dist/pmtiles-source.d.ts.map +1 -1
- package/dist/pmtiles-source.js +15 -17
- package/package.json +7 -7
- package/src/index.ts +1 -1
- package/src/pmtiles-format.ts +17 -0
- package/src/pmtiles-loader.ts +4 -8
- package/src/pmtiles-source.ts +31 -29
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 Tn=Object.create;var se=Object.defineProperty;var Fn=Object.getOwnPropertyDescriptor;var Pn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty;var En=(e,t,r)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kt=(e,t)=>{for(var r in t)se(e,r,{get:t[r],enumerable:!0})},Se=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Pn(t))!bn.call(e,i)&&i!==r&&se(e,i,{get:()=>t[i],enumerable:!(n=Fn(t,i))||n.enumerable});return e},Be=(e,t,r)=>(Se(e,t,"default"),r&&Se(r,t,"default")),Nt=(e,t,r)=>(r=e!=null?Tn(In(e)):{},Se(t||!e||!e.__esModule?se(r,"default",{value:e,enumerable:!0}):r,e)),Sn=e=>Se(se({},"__esModule",{value:!0}),e);var Ct=(e,t,r)=>(En(e,typeof t!="symbol"?t+"":t,r),r);var zt=Ke((ys,Ot)=>{Ot.exports=globalThis.loaders});var Ir=Ke(dt=>{dt.read=function(e,t,r,n,i){var o,s,a=i*8-n-1,l=(1<<a)-1,c=l>>1,f=-7,u=r?i-1:0,h=r?-1:1,d=e[t+u];for(u+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=o*256+e[t+u],u+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=s*256+e[t+u],u+=h,f-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-c}return(d?-1:1)*s*Math.pow(2,o-n)};dt.write=function(e,t,r,n,i,o){var s,a,l,c=o*8-i-1,f=(1<<c)-1,u=f>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?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,i),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=a&255,d+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+d]=s&255,d+=p,s/=256,c-=8);e[r+d-p]|=y*128}});var _r=Ke((Bl,Ar)=>{"use strict";Ar.exports=x;var Oe=Ir();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 pt=(1<<16)*(1<<16),br=1/pt,ro=12,Br=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=ze(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Sr(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=ze(this.buf,this.pos)+ze(this.buf,this.pos+4)*pt;return this.pos+=8,e},readSFixed64:function(){var e=ze(this.buf,this.pos)+Sr(this.buf,this.pos+4)*pt;return this.pos+=8,e},readFloat:function(){var e=Oe.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Oe.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,no(r,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>=ro&&Br?xo(this.buf,t,e):yo(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 r=O(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=O(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=O(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=O(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=O(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=O(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=O(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=O(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=O(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 r=new Uint8Array(t);r.set(this.buf),this.buf=r,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),te(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),te(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),te(this.buf,e&-1,this.pos),te(this.buf,Math.floor(e*br),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),te(this.buf,e&-1,this.pos),te(this.buf,Math.floor(e*br),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){io(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=wo(this.buf,e,this.pos);var r=this.pos-t;r>=128&&Er(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Oe.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Oe.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 r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&Er(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,x.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,ao,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,lo,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,uo,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,co,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,fo,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ho,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,po,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,go,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,mo,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 no(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return ee(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function O(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function ee(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function io(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),oo(r,n,t),so(n,t)}function oo(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function so(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((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 Er(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function ao(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function lo(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function co(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function fo(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function uo(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function ho(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function po(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function go(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function mo(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function ze(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function te(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function Sr(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function yo(e,t,r){for(var n="",i=t;i<r;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a>r)break;var l,c,f;a===1?o<128&&(s=o):a===2?(l=e[i+1],(l&192)===128&&(s=(o&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[i+1],c=e[i+2],(l&192)===128&&(c&192)===128&&(s=(o&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[i+1],c=e[i+2],f=e[i+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(o&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,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),n+=String.fromCharCode(s),i+=a}return n}function xo(e,t,r){return Br.decode(e.subarray(t,r))}function wo(e,t,r){for(var n=0,i,o;n<t.length;n++){if(i=t.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}});var be={};kt(be,{PMTilesSource:()=>hn,PMTilesTileSource:()=>W,_PMTilesLoader:()=>gn});Be(be,Nt(zt(),1));function ae(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var N={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Bn=N.self||N.window||N.global||{},An=N.window||N.self||N.global||{},_n=N.global||N.self||N.window||{},Dn=N.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),Ln=Gt&&parseFloat(Gt[1])||0;var Ae=globalThis,Mn=globalThis.document||{},_e=globalThis.process||{},Vn=globalThis.console,vs=globalThis.navigator||{};function jt(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function j(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||jt()}var Xe="4.0.7";function kn(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var De=class{constructor(t,r,n="sessionStorage"){this.storage=kn(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Rt(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function Ht(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var Le;(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"})(Le||(Le={}));var Nn=10;function Zt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Le[e]||Le.WHITE)}function $t(e,t,r){return!j&&typeof e=="string"&&(t&&(e=`\x1B[${Zt(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Zt(r)+Nn}m${e}\x1B[49m`)),e}function Jt(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}function le(e,t){if(!e)throw new Error(t||"Assertion failed")}function R(){let e;if(j()&&Ae.performance)e=Ae?.performance?.now?.();else if("hrtime"in _e){let t=_e?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var X={debug:j()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Cn={enabled:!0,level:0};function Q(){}var Wt={},Kt={once:!0},G=class{constructor({id:t}={id:""}){this.VERSION=Xe,this._startTs=R(),this._deltaTs=R(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new De(`__probe-${this.id}__`,Cn),this.timeStamp(`${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((R()-this._startTs).toPrecision(10))}getDelta(){return Number((R()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!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,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,X.warn,arguments,Kt)}error(t){return this._getLogFunction(0,t,X.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,X.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,X.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,X.debug||X.info,arguments,Kt)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||Q,n&&[n],{tag:zn(r)}):Q}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||Q)}group(t,r,n={collapsed:!1}){let i=Yt({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Q)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Xt(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=Yt({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,le(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=R();let s=o.tag||o.message;if(o.once&&s)if(!Wt[s])Wt[s]=R();else return Q;return r=On(this.id,o.message,o),n.bind(console,r,...o.args)}return Q}};G.VERSION=Xe;function Xt(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 le(Number.isFinite(t)&&t>=0),t}function Yt(e){let{logLevel:t,message:r}=e;e.logLevel=Xt(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return le(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function On(e,t,r){if(typeof t=="string"){let n=r.time?Ht(Rt(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=$t(t,r.color,r.background)}return t}function zn(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var Zs=new G({id:"@probe.gl/log"});var Qe="4.3.0",Gn=Qe[0]>="0"&&Qe[0]<="9"?`v${Qe}`:"";function jn(){let e=new G({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=Gn,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var qe=jn();var Rn="",Qt={};function et(e){for(let t in Qt)if(e.startsWith(t)){let r=Qt[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Rn}${e}`),e}var ce=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r){return await this.handle.slice(t,t+r).arrayBuffer()}};var fe=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Hn(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function Hn(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,i)=>t(n,i);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var qt="4.3.0";var Zn=globalThis.loaders?.parseImageNode,tt=typeof Image<"u",rt=typeof ImageBitmap<"u",$n=Boolean(Zn),nt=Ye?!0:$n;function er(e){switch(e){case"auto":return rt||tt||nt;case"imagebitmap":return rt;case"image":return tt;case"data":return nt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function tr(){if(rt)return"imagebitmap";if(tt)return"image";if(nt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Jn(e){let t=Wn(e);if(!t)throw new Error("Not an image");return t}function rr(e){switch(Jn(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Wn(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 Kn=/^data:image\/svg\+xml/,Yn=/\.svg((\?|#).*)?$/;function Me(e){return e&&(Kn.test(e)||Yn.test(e))}function nr(e,t){if(Me(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return it(e,t)}function it(e,t){if(Me(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ve(e,t,r){let n=nr(e,r),i=self.URL||self.webkitURL,o=typeof n!="string"&&i.createObjectURL(n);try{return await Xn(o||n,t)}finally{o&&i.revokeObjectURL(o)}}async function Xn(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,i)=>{try{r.onload=()=>n(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var Qn={},ir=!0;async function or(e,t,r){let n;Me(r)?n=await Ve(e,t,r):n=it(e,r);let i=t&&t.imagebitmap;return await qn(n,i)}async function qn(e,t=null){if((ei(t)||!ir)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),ir=!1}return await createImageBitmap(e)}function ei(e){for(let t in e||Qn)return!1;return!0}function sr(e){return!ii(e,"ftyp",4)||!(e[8]&96)?null:ti(e)}function ti(e){switch(ri(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ri(e,t,r){return String.fromCharCode(...e.slice(t,r))}function ni(e){return[...e].map(t=>t.charCodeAt(0))}function ii(e,t,r=0){let n=ni(t);for(let i=0;i<n.length;++i)if(n[i]!==e[i+r])return!1;return!0}var C=!1,ue=!0;function Ue(e){let t=he(e);return si(t)||ci(t)||ai(t)||li(t)||oi(t)}function oi(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=sr(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function si(e){let t=he(e);return t.byteLength>=24&&t.getUint32(0,C)===2303741511?{mimeType:"image/png",width:t.getUint32(16,C),height:t.getUint32(20,C)}:null}function ai(e){let t=he(e);return t.byteLength>=10&&t.getUint32(0,C)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,ue),height:t.getUint16(8,ue)}:null}function li(e){let t=he(e);return t.byteLength>=14&&t.getUint16(0,C)===16973&&t.getUint32(2,ue)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,ue),height:t.getUint32(22,ue)}:null}function ci(e){let t=he(e);if(!(t.byteLength>=3&&t.getUint16(0,C)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=fi(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,C);if(i.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,C),width:t.getUint16(o+7,C)};if(!n.has(s))return null;o+=2,o+=t.getUint16(o,C)}return null}function fi(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function he(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 ar(e,t){let{mimeType:r}=Ue(e)||{},n=globalThis.loaders?.parseImageNode;return ae(n),await n(e,r)}async function lr(e,t,r){t=t||{};let i=(t.image||{}).type||"auto",{url:o}=r||{},s=ui(i),a;switch(s){case"imagebitmap":a=await or(e,t,o);break;case"image":a=await Ve(e,t,o);break;case"data":a=await ar(e,t);break;default:ae(!1)}return i==="data"&&(a=rr(a)),a}function ui(e){switch(e){case"auto":case"data":return tr();default:return er(e),e}}var hi=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],di=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],pi={image:{type:"auto",decode:!0}},ot={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:qt,mimeTypes:di,extensions:hi,parse:lr,tests:[e=>Boolean(Ue(new DataView(e)))],options:pi};function cr(e){let t=[];if(e.fields)for(let r of e.fields)t.push({name:r.name,type:mi(r),metadata:yi(r)});return{metadata:gi(e),fields:t}}function gi(e){let t={};for(let[r,n]of Object.entries(e))r!=="fields"&&n&&(t[r]=JSON.stringify(n));return t}function mi(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 yi(e){let t={};for(let[r,n]of Object.entries(e))r!=="name"&&n&&(t[r]=JSON.stringify(n));return t}var dr=e=>e!==null&&typeof e=="object";function st(e,t){if(!e||!dr(e))return null;let r={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(r.generator=e.generator),typeof e.generator_options=="string"&&(r.generatorOptions=e.generator_options),r.boundingBox=fr(e.bounds)||fr(e.antimeridian_adjusted_bounds),r.center=Pi(e.center),r.maxZoom=ur(e.maxzoom),r.minZoom=ur(e.minzoom),typeof e?.json=="string")try{r.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let n=e.tilestats||r.metaJson?.tilestats,i=vi(n,t),o=xi(e.vector_layers),s=Fi(o,i);return r={...r,layers:s},r.maxZoom===null&&s.length>0&&(r.maxZoom=s[0].maxZoom||null),r.minZoom===null&&s.length>0&&(r.minZoom=s[0].minZoom||null),r}function xi(e){return Array.isArray(e)?e.map(t=>wi(t)):[]}function wi(e){let t=Object.entries(e.fields||[]).map(([n,i])=>({name:n,...yr(String(i))})),r={...e};return delete r.fields,{name:e.id||"",...r,fields:t}}function vi(e,t){return dr(e)&&Array.isArray(e.layers)?e.layers.map(r=>Ti(r,t)):[]}function Ti(e,t){let r=[],n={},i=e.attributes||[];for(let o of i){let s=o.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];n[a]=n[a]||[],n[a].push(o),console.warn("ignoring tilestats indexed field",a)}else r[s]||r.push(bi(o,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:r}}function Fi(e,t){return e.map(r=>{let n=t.find(s=>s.name===r.name),i=n?.fields||r.fields||[],o={...r,...n,fields:i};return o.schema=cr(o),o})}function fr(e){let t=mr(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(gr)&&[t[1],t[3]].every(pr))return[[t[0],t[1]],[t[2],t[3]]]}function Pi(e){let t=mr(e);return Array.isArray(t)&&t.length===3&&gr(t[0])&&pr(t[1])&&Ii(t[2])?t:null}function ur(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function pr(e){return Number.isFinite(e)&&e<=90&&e>=-90}function gr(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Ii(e){return Number.isFinite(e)&&e>=0&&e<=22}function mr(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var hr={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 bi(e={},t){let r=yr(e.type),n={name:e.attribute,...r};return typeof e.min=="number"&&(n.min=e.min),typeof e.max=="number"&&(n.max=e.max),typeof e.count=="number"&&(n.uniqueValueCount=e.count),e.values&&(n.values=e.values),n.values&&typeof t.maxValues=="number"&&(n.values=n.values?.slice(0,t.maxValues)),n}function yr(e){let t=e.toLowerCase();return!t||hr[t],hr[t]||{type:"string"}}var Ei="4.3.0",de={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Ei,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let r=new TextDecoder().decode(e),n=JSON.parse(r),i={...de.options.tilejson,...t?.tilejson};return st(n,i)},parseTextSync:(e,t)=>{let r=JSON.parse(e),n={...de.options.tilejson,...t?.tilejson};return st(r,n)}};var pe={x:0,y:1,z:2};function H(e,t={}){let{start:r=0,end:n=e.length,plane:i="xy"}=t,o=t.size||2,s=0,a=pe[i[0]],l=pe[i[1]];for(let c=r,f=n-o;c<n;c+=o)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function lt(e,t,r=2,n,i="xy"){let o=t&&t.length,s=o?t[0]*r:e.length,a=wr(e,0,s,r,!0,n&&n[0],i),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,d,p,y;if(o&&(a=Mi(e,t,a,r,n,i)),e.length>80*r){h=f=e[0],d=u=e[1];for(let P=r;P<s;P+=r)p=e[P],y=e[P+1],p<h&&(h=p),y<d&&(d=y),p>f&&(f=p),y>u&&(u=y);c=Math.max(f-h,u-d),c=c!==0?32767/c:0}return ge(a,l,r,h,d,c,0),l}function wr(e,t,r,n,i,o,s){let a,l;o===void 0&&(o=H(e,{start:t,end:r,size:n,plane:s}));let c=pe[s[0]],f=pe[s[1]];if(i===o<0)for(a=t;a<r;a+=n)l=xr(a,e[a+c],e[a+f],l);else for(a=r-n;a>=t;a-=n)l=xr(a,e[a+c],e[a+f],l);return l&&Ce(l,l.next)&&(ye(l),l=l.next),l}function Z(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Ce(r,r.next)||T(r.prev,r,r.next)===0)){if(ye(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function ge(e,t,r,n,i,o,s){if(!e)return;!s&&o&&Ci(e,n,i,o);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,o?_i(e,n,i,o):Ai(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(c.i/r|0),ye(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=Di(Z(e),t,r),ge(e,t,r,n,i,o,2)):s===2&&Li(e,t,r,n,i,o):ge(Z(e),t,r,n,i,o,1);break}}}function Ai(e){let t=e.prev,r=e,n=e.next;if(T(t,r,n)>=0)return!1;let i=t.x,o=r.x,s=n.x,a=t.y,l=r.y,c=n.y,f=i<o?i<s?i:s:o<s?o:s,u=a<l?a<c?a:c:l<c?l:c,h=i>o?i>s?i:s:o>s?o:s,d=a>l?a>c?a:c:l>c?l:c,p=n.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&q(i,a,o,l,s,c,p.x,p.y)&&T(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function _i(e,t,r,n){let i=e.prev,o=e,s=e.next;if(T(i,o,s)>=0)return!1;let a=i.x,l=o.x,c=s.x,f=i.y,u=o.y,h=s.y,d=a<l?a<c?a:c:l<c?l:c,p=f<u?f<h?f:h:u<h?u:h,y=a>l?a>c?a:c:l>c?l:c,P=f>u?f>h?f:h:u>h?u:h,D=at(d,p,t,r,n),v=at(y,P,t,r,n),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=D&&g&&g.z<=v;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==i&&m!==s&&q(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==i&&g!==s&&q(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>=D;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==i&&m!==s&&q(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>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==i&&g!==s&&q(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 Di(e,t,r){let n=e;do{let i=n.prev,o=n.next.next;!Ce(i,o)&&vr(i,n,n.next,o)&&me(i,o)&&me(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),ye(n),ye(n.next),n=e=o),n=n.next}while(n!==e);return Z(n)}function Li(e,t,r,n,i,o){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Gi(s,a)){let l=Tr(s,a);s=Z(s,s.next),l=Z(l,l.next),ge(s,t,r,n,i,o,0),ge(l,t,r,n,i,o,0);return}a=a.next}s=s.next}while(s!==e)}function Mi(e,t,r,n,i,o){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*n,f=a<l-1?t[a+1]*n:e.length,u=wr(e,c,f,n,!1,i&&i[a+1],o),u===u.next&&(u.steiner=!0),s.push(zi(u));for(s.sort(Vi),a=0;a<s.length;a++)r=Ui(s[a],r);return r}function Vi(e,t){return e.x-t.x}function Ui(e,t){let r=ki(e,t);if(!r)return t;let n=Tr(r,e);return Z(n,n.next),Z(r,r.next)}function ki(e,t){let r=t,n=e.x,i=e.y,o=-1/0,s;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){let h=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>o&&(o=h,s=r.x<r.next.x?r:r.next,h===n))return s}r=r.next}while(r!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;r=s;do n>=r.x&&r.x>=l&&n!==r.x&&q(i<c?n:o,i,l,c,i<c?o:n,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(n-r.x),me(r,e)&&(u<f||u===f&&(r.x>s.x||r.x===s.x&&Ni(s,r)))&&(s=r,f=u)),r=r.next;while(r!==a);return s}function Ni(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function Ci(e,t,r,n){let i=e;do i.z===0&&(i.z=at(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Oi(i)}function Oi(e){let t,r,n=1,i,o,s,a,l,c;do{for(o=e,e=null,c=null,i=0;o;){for(i++,a=o,s=0,r=0;r<n&&(s++,a=a.nextZ,!!a);r++);for(l=n;s>0||l>0&&a;)s!==0&&(l===0||!a||o.z<=a.z)?(t=o,o=o.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;o=a}c.nextZ=null,n*=2}while(i>1);return e}function at(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|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 zi(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function q(e,t,r,n,i,o,s,a){return(i-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(n-a)>=(r-s)*(t-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function Gi(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ji(e,t)&&(me(e,t)&&me(t,e)&&Ri(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||Ce(e,t)&&T(e.prev,e,e.next)>0&&T(t.prev,t,t.next)>0)}function T(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Ce(e,t){return e.x===t.x&&e.y===t.y}function vr(e,t,r,n){let i=Ne(T(e,t,r)),o=Ne(T(e,t,n)),s=Ne(T(r,n,e)),a=Ne(T(r,n,t));return!!(i!==o&&s!==a||i===0&&ke(e,r,t)||o===0&&ke(e,n,t)||s===0&&ke(r,e,n)||a===0&&ke(r,t,n))}function ke(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Ne(e){return e>0?1:e<0?-1:0}function ji(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&vr(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function me(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 Ri(e,t){let r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Tr(e,t){let r=new xe(e.i,e.x,e.y),n=new xe(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function xr(e,t,r,n){let i=new xe(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ye(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 xe=class{constructor(t,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=n}};function ut(e,t,r){let n=Wi(e),i=Object.keys(n).filter(o=>n[o]!==Array);return Ki(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||i,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Wi(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let i=r.properties[n];t[n]=to(i,t[n])}return t}function Ki(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:i,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:y=Float32Array,triangulate:P=!0}=r,D=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(n*d),globalFeatureIds:new v(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(o*d),globalFeatureIds:new v(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},S={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*d),globalFeatureIds:new v(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};P&&(S.triangles=[]);for(let M of[m,g,S])for(let I of p){let B=h[I];M.numericProps[I]=new B(M.positions.length/d)}g.pathIndices[s]=o,S.polygonIndices[c]=l,S.primitivePolygonIndices[f]=l;let k={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let M of e){let I=M.geometry,B=M.properties||{};switch(I.type){case"Point":Yi(I,m,k,d,B),m.properties.push(ft(B,p)),D&&m.fields.push({id:M.id}),k.pointFeature++;break;case"LineString":Xi(I,g,k,d,B),g.properties.push(ft(B,p)),D&&g.fields.push({id:M.id}),k.lineFeature++;break;case"Polygon":Qi(I,S,k,d,B),S.properties.push(ft(B,p)),D&&S.fields.push({id:M.id}),k.polygonFeature++;break;default:throw new Error("Invalid geometry type")}k.feature++}return eo(m,g,S,d)}function Yi(e,t,r,n,i){t.positions.set(e.data,r.pointPosition*n);let o=e.data.length/n;ht(t,i,r.pointPosition,o),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function Xi(e,t,r,n,i){t.positions.set(e.data,r.linePosition*n);let o=e.data.length/n;ht(t,i,r.linePosition,o),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);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[r.linePath++]=r.linePosition,r.linePosition+=(c-l)/n}}function Qi(e,t,r,n,i){t.positions.set(e.data,r.polygonPosition*n);let o=e.data.length/n;ht(t,i,r.polygonPosition,o),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=r.polygonPosition;t.polygonIndices[r.polygonObject++]=l;let c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let d=0,p=f.length;d<p;++d){let y=f[d],P=d===p-1?u===void 0?e.data.length:u[0]:f[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(P-y)/n}let h=r.polygonPosition;qi(t,c,f,{startPosition:l,endPosition:h,coordLength:n})}}function qi(e,t,r,{startPosition:n,endPosition:i,coordLength:o}){if(!e.triangles)return;let s=n*o,a=i*o,l=e.positions.subarray(s,a),c=r[0],f=r.slice(1).map(h=>(h-c)/o),u=lt(l,f,o,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(n+u[h])}function ct(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function eo(e,t,r,n){let i={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:ct(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:ct(t.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:ct(r.numericProps,1)}};return i.polygons&&r.triangles&&(i.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),i}function ht(e,t,r,n){for(let i in e.numericProps)if(i in t){let o=t[i];e.numericProps[i].fill(o,r,r+n)}}function ft(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function to(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var xt=Nt(_r(),1);function vo(e){let t=0;for(let r=0,n=e.length-1,i,o;r<e.length;n=r++)i=e[r],o=e[n],t+=(o[0]-i[0])*(i[1]+o[1]);return t}function gt(e,t){if(Array.isArray(e[0])){for(let n of e)gt(n,t);return}let r=e;r[0]/=t,r[1]/=t}function Dr(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function mt(e,t,r){if(typeof e[0][0]!="number"){for(let s of e)mt(s,t,r);return}let n=r*Math.pow(2,t.z),i=r*t.x,o=r*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+i)*360/n-180;let l=180-(a[1]+o)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function Lr(e,t,r){let{x:n,y:i,z:o}=t,s=r*Math.pow(2,o),a=r*n,l=r*i;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 Mr(e){let t=e.length;if(t<=1)return[e];let r=[],n,i;for(let o=0;o<t;o++){let s=vo(e[o]);s!==0&&(i===void 0&&(i=s<0),i===s<0?(n&&r.push(n),n=[e[o]]):n&&n.push(e[o]))}return n&&r.push(n),r}function Vr(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[H(e.data)]],indices:[e.indices]};let n=[],i=[],o=[],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),d=H(h);if(d===0){let p=e.data.slice(0,u),y=e.data.slice(c);e.data=p.concat(y),l+=c-u;continue}a===void 0&&(a=d<0),a===d<0?(s.length&&(n.push(o),i.push(s)),s=[u],o=[d]):(o.push(d),s.push(u))}return o&&n.push(o),s.length&&i.push(s),{type:r,areas:n,indices:i,data:e.data}}var $=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,r,n,i,o,s){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=i,this._values=o,this._geometryInfo=s,t.readFields(To,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return Ur(this,n,i=>mt(i,r,this.extent));default:return Ur(this,n,gt)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,i=>Lr(i,r,this.extent));default:return this._toBinaryCoordinates(n,Dr)}}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i=0,o=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<r;){if(i<=0){let u=t.readVarint();n=u&7,i=u>>3}if(i--,n===1||n===2)o+=t.readSVarint(),s+=t.readSVarint(),o<a&&(a=o),o>l&&(l=o),s<c&&(c=s),s>f&&(f=s);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let i=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,n={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/i,n={type:"LineString",...t};break;case 3:n=Vr(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let s of n.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=n.data.length/i;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(o.id=this.id),o}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i=0,o=0,s=0,a=[],l;for(;t.pos<r;){if(i<=0){let c=t.readVarint();n=c&7,i=c>>3}switch(i--,n){case 1:case 2:o+=t.readSVarint(),s+=t.readSVarint(),n===1&&(l&&a.push(l),l=[]),l&&l.push([o,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i,o=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<r;)if(o<=0&&(i=t.readVarint(),n=i&7,o=i>>3),o--,n===1||n===2)s+=t.readSVarint(),a+=t.readSVarint(),n===1&&c.push(l),f.push(s,a),l+=2;else if(n===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 ${n}`);return{data:f,indices:c}}};Ct($,"types",["Unknown","Point","LineString","Polygon"]);function Ur(e,t,r){let n=$.types[e.type],i,o,s;switch(e.type){case 1:let l=[];for(i=0;i<t.length;i++)l[i]=t[i][0];s=l,r(s,e.extent);break;case 2:for(s=t,i=0;i<s.length;i++)r(s[i],e.extent);break;case 3:for(s=Mr(t),i=0;i<s.length;i++)for(o=0;o<s[i].length;o++)r(s[i][o],e.extent);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:n=`Multi${n}`;let a={type:"Feature",geometry:{type:n,coordinates:s},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function To(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?Fo(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function Fo(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}var Ge=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Po,this,r),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 r=this._pbf.readVarint()+this._pbf.pos;return new $(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(t,r){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 $(this._pbf,n,this.extent,this._keys,this._values,r)}};function Po(e,t,r){t&&r&&(e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(Io(r)))}function Io(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}var we=class{layers;constructor(t,r){this.layers=t.readFields(bo,{},r)}};function bo(e,t,r){if(e===3&&r){let n=new Ge(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function wt(e,t){let r=So(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:yt(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:kr(e,r)};case"geojson":return kr(e,r);case"binary-geometry":return yt(e,r);case"binary":return yt(e,r);default:throw new Error(n||"undefined shape")}}function yt(e,t){let[r,n]=Eo(e,t),i=ut(r,n);return i.byteLength=e.byteLength,i}function Eo(e,t){let r=[],n={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[r,n];let i=new we(new xt.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(i.layers)).forEach(s=>{let a=i.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,n),f=Ao(c,t,s);r.push(f)}}),[r,n]}function kr(e,t){if(e.byteLength<=0)return[];let r=[],n=new we(new xt.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(o=>{let s=n.layers[o];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=Bo(l,t,o);r.push(c)}}),r}function So(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&&qe.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function Bo(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function Ao(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var _o="4.3.0",Nr={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:_o,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},vt={...Nr,parse:async(e,t)=>wt(e,t),parseSync:wt,binary:!0};var Pe={};kt(Pe,{Compression:()=>en,EtagMismatch:()=>Re,FetchSource:()=>on,FileSource:()=>fs,PMTiles:()=>bt,Protocol:()=>is,ResolvedValueCache:()=>hs,SharedPromiseCache:()=>fn,TileType:()=>tn,bytesToHeader:()=>sn,findTile:()=>nn,getUint64:()=>_,leafletRasterLayer:()=>rs,readVarint:()=>ne,tileIdToZxy:()=>ls,tileTypeExt:()=>rn,zxyToTileId:()=>qr});var J=Math.pow,F=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{a(r.next(l))}catch(c){i(c)}},s=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,s);a((r=r.apply(e,t)).next())}),E=Uint8Array,ie=Uint16Array,Do=Int32Array,zr=new E([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Gr=new E([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Lo=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jr=function(e,t){for(var r=new ie(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new Do(r[30]),n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return{b:r,r:i}},Rr=jr(zr,2),Hr=Rr.b,Mo=Rr.r;Hr[28]=258,Mo[258]=28;var Zr=jr(Gr,0),Vo=Zr.b,Jl=Zr.r,Pt=new ie(32768);for(w=0;w<32768;++w)z=(w&43690)>>1|(w&21845)<<1,z=(z&52428)>>2|(z&13107)<<2,z=(z&61680)>>4|(z&3855)<<4,Pt[w]=((z&65280)>>8|(z&255)<<8)>>1;var z,w,Te=function(e,t,r){for(var n=e.length,i=0,o=new ie(t);i<n;++i)e[i]&&++o[e[i]-1];var s=new ie(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(r){a=new ie(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var c=i<<4|e[i],f=t-e[i],u=s[e[i]-1]++<<f,h=u|(1<<f)-1;u<=h;++u)a[Pt[u]>>l]=c}else for(a=new ie(n),i=0;i<n;++i)e[i]&&(a[i]=Pt[s[e[i]-1]++]>>15-e[i]);return a},Fe=new E(288);for(w=0;w<144;++w)Fe[w]=8;var w;for(w=144;w<256;++w)Fe[w]=9;var w;for(w=256;w<280;++w)Fe[w]=7;var w;for(w=280;w<288;++w)Fe[w]=8;var w,$r=new E(32);for(w=0;w<32;++w)$r[w]=5;var w,Uo=Te(Fe,9,1),ko=Te($r,5,1),Tt=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},U=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&r},Ft=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},No=function(e){return(e+7)/8|0},Co=function(e,t,r){(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new E(r-t);return n.set(e.subarray(t,r)),n},Oo=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],b=function(e,t,r){var n=new Error(t||Oo[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,b),!r)throw n;return n},Et=function(e,t,r,n){var i=e.length,o=n?n.length:0;if(!i||t.f&&!t.l)return r||new E(0);var s=!r||t.i!=2,a=t.i;r||(r=new E(i*3));var l=function(Mt){var Vt=r.length;if(Mt>Vt){var Ut=new E(Math.max(Vt*2,Mt));Ut.set(r),r=Ut}},c=t.f||0,f=t.p||0,u=t.b||0,h=t.l,d=t.d,p=t.m,y=t.n,P=i*8;do{if(!h){c=U(e,f,1);var D=U(e,f+1,3);if(f+=3,D)if(D==1)h=Uo,d=ko,p=9,y=5;else if(D==2){var S=U(e,f,31)+257,k=U(e,f+10,15)+4,M=S+U(e,f+5,31)+1;f+=14;for(var I=new E(M),B=new E(19),A=0;A<k;++A)B[Lo[A]]=U(e,f+A*3,7);f+=k*3;for(var Bt=Tt(B),mn=(1<<Bt)-1,yn=Te(B,Bt,1),A=0;A<M;){var At=yn[U(e,f,mn)];f+=At&15;var v=At>>4;if(v<16)I[A++]=v;else{var K=0,Ee=0;for(v==16?(Ee=3+U(e,f,3),f+=2,K=I[A-1]):v==17?(Ee=3+U(e,f,7),f+=3):v==18&&(Ee=11+U(e,f,127),f+=7);Ee--;)I[A++]=K}}var _t=I.subarray(0,S),V=I.subarray(S);p=Tt(_t),y=Tt(V),h=Te(_t,p,1),d=Te(V,y,1)}else b(1);else{var v=No(f)+4,m=e[v-4]|e[v-3]<<8,g=v+m;if(g>i){a&&b(0);break}s&&l(u+m),r.set(e.subarray(v,g),u),t.b=u+=m,t.p=f=g*8,t.f=c;continue}if(f>P){a&&b(0);break}}s&&l(u+131072);for(var xn=(1<<p)-1,wn=(1<<y)-1,Ze=f;;Ze=f){var K=h[Ft(e,f)&xn],Y=K>>4;if(f+=K&15,f>P){a&&b(0);break}if(K||b(2),Y<256)r[u++]=Y;else if(Y==256){Ze=f,h=null;break}else{var Dt=Y-254;if(Y>264){var A=Y-257,oe=zr[A];Dt=U(e,f,(1<<oe)-1)+Hr[A],f+=oe}var $e=d[Ft(e,f)&wn],Je=$e>>4;$e||b(3),f+=$e&15;var V=Vo[Je];if(Je>3){var oe=Gr[Je];V+=Ft(e,f)&(1<<oe)-1,f+=oe}if(f>P){a&&b(0);break}s&&l(u+131072);var We=u+Dt;if(u<V){var Lt=o-V,vn=Math.min(V,We);for(Lt+u<0&&b(3);u<vn;++u)r[u]=n[Lt+u]}for(;u<We;u+=4)r[u]=r[u-V],r[u+1]=r[u+1-V],r[u+2]=r[u+2-V],r[u+3]=r[u+3-V];u=We}}t.l=h,t.p=Ze,t.b=u,t.f=c,h&&(c=1,t.m=p,t.d=d,t.n=y)}while(!c);return u==r.length?r:Co(r,0,u)},zo=new E(0),Go=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&b(6,"invalid gzip data");var t=e[3],r=10;t&4&&(r+=(e[10]|e[11]<<8)+2);for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[r++]);return r+(t&2)},jo=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ro=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&b(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&b(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function Ho(e,t){return Et(e,{i:2},t&&t.out,t&&t.dictionary)}function Zo(e,t){var r=Go(e);return r+8>e.length&&b(6,"invalid gzip data"),Et(e.subarray(r,-8),{i:2},t&&t.out||new E(jo(e)),t&&t.dictionary)}function $o(e,t){return Et(e.subarray(Ro(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}function It(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Zo(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Ho(e,t):$o(e,t)}var Jo=typeof TextDecoder<"u"&&new TextDecoder,Wo=0;try{Jo.decode(zo,{stream:!0}),Wo=1}catch{}var Jr=(e,t)=>e*J(2,t),ve=(e,t)=>Math.floor(e/J(2,t)),je=(e,t)=>Jr(e.getUint16(t+1,!0),8)+e.getUint8(t),Wr=(e,t)=>Jr(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),Ko=(e,t,r,n,i)=>{if(e!==n.getUint8(i))return e-n.getUint8(i);let o=je(n,i+1);if(t!==o)return t-o;let s=je(n,i+4);return r!==s?r-s:0},Yo=(e,t,r,n)=>{let i=Kr(e,t|128,r,n);return i?{z:t,x:r,y:n,offset:i[0],length:i[1],isDir:!0}:null},Cr=(e,t,r,n)=>{let i=Kr(e,t,r,n);return i?{z:t,x:r,y:n,offset:i[0],length:i[1],isDir:!1}:null},Kr=(e,t,r,n)=>{let i=0,o=e.byteLength/17-1;for(;i<=o;){let s=o+i>>1,a=Ko(t,r,n,e,s*17);if(a>0)i=s+1;else if(a<0)o=s-1;else return[Wr(e,s*17+7),e.getUint32(s*17+13,!0)]}return null},Xo=(e,t)=>e.isDir&&!t.isDir?1:!e.isDir&&t.isDir?-1:e.z!==t.z?e.z-t.z:e.x!==t.x?e.x-t.x:e.y-t.y,Yr=(e,t)=>{let r=e.getUint8(t*17);return{z:r&127,x:je(e,t*17+1),y:je(e,t*17+4),offset:Wr(e,t*17+7),length:e.getUint32(t*17+13,!0),isDir:r>>7===1}},Or=e=>{let t=[],r=new DataView(e);for(let n=0;n<r.byteLength/17;n++)t.push(Yr(r,n));return Qo(t)},Qo=e=>{e.sort(Xo);let t=new ArrayBuffer(17*e.length),r=new Uint8Array(t);for(let n=0;n<e.length;n++){let i=e[n],o=i.z;i.isDir&&(o=o|128),r[n*17]=o,r[n*17+1]=i.x&255,r[n*17+2]=i.x>>8&255,r[n*17+3]=i.x>>16&255,r[n*17+4]=i.y&255,r[n*17+5]=i.y>>8&255,r[n*17+6]=i.y>>16&255,r[n*17+7]=i.offset&255,r[n*17+8]=ve(i.offset,8)&255,r[n*17+9]=ve(i.offset,16)&255,r[n*17+10]=ve(i.offset,24)&255,r[n*17+11]=ve(i.offset,32)&255,r[n*17+12]=ve(i.offset,48)&255,r[n*17+13]=i.length&255,r[n*17+14]=i.length>>8&255,r[n*17+15]=i.length>>16&255,r[n*17+16]=i.length>>24&255}return t},qo=(e,t)=>{if(e.byteLength<17)return null;let r=e.byteLength/17,n=Yr(e,r-1);if(n.isDir){let i=n.z,o=t.z-i,s=Math.trunc(t.x/(1<<o)),a=Math.trunc(t.y/(1<<o));return{z:i,x:s,y:a}}return null};function es(e){return F(this,null,function*(){let t=yield e.getBytes(0,512e3),r=new DataView(t.data),n=r.getUint32(4,!0),i=r.getUint16(8,!0),o=new TextDecoder("utf-8"),s=JSON.parse(o.decode(new DataView(t.data,10,n))),a=0;s.compression==="gzip"&&(a=2);let l=0;"minzoom"in s&&(l=+s.minzoom);let c=0;"maxzoom"in s&&(c=+s.maxzoom);let f=0,u=0,h=0,d=-180,p=-85,y=180,P=85;if(s.bounds){let v=s.bounds.split(",");d=+v[0],p=+v[1],y=+v[2],P=+v[3]}if(s.center){let v=s.center.split(",");f=+v[0],u=+v[1],h=+v[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+n,rootDirectoryLength:i*17,jsonMetadataOffset:10,jsonMetadataLength:n,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:a,tileType:1,minZoom:l,maxZoom:c,minLon:d,minLat:p,maxLon:y,maxLat:P,centerZoom:h,centerLon:f,centerLat:u,etag:t.etag}})}function ts(e,t,r,n,i,o,s){return F(this,null,function*(){let a=yield r.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);e.specVersion===1&&(a=Or(a));let l=Cr(new DataView(a),n,i,o);if(l){let u=(yield t.getBytes(l.offset,l.length,s)).data,h=new DataView(u);return h.getUint8(0)===31&&h.getUint8(1)===139&&(u=It(new Uint8Array(u))),{data:u}}let c=qo(new DataView(a),{z:n,x:i,y:o});if(c){let f=Yo(new DataView(a),c.z,c.x,c.y);if(f){let u=yield r.getArrayBuffer(t,f.offset,f.length,e);e.specVersion===1&&(u=Or(u));let h=Cr(new DataView(u),n,i,o);if(h){let p=(yield t.getBytes(h.offset,h.length,s)).data,y=new DataView(p);return y.getUint8(0)===31&&y.getUint8(1)===139&&(p=It(new Uint8Array(p))),{data:p}}}}})}var Xr={getHeader:es,getZxy:ts},rs=(e,t)=>{let r=!1,n="",i=L.GridLayer.extend({createTile:(o,s)=>{let a=document.createElement("img"),l=new AbortController,c=l.signal;return a.cancel=()=>{l.abort()},r||(e.getHeader().then(f=>{f.tileType===1?console.error("Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):f.tileType===2?n="image/png":f.tileType===3?n="image/jpeg":f.tileType===4?n="image/webp":f.tileType===5&&(n="image/avif")}),r=!0),e.getZxy(o.z,o.x,o.y,c).then(f=>{if(f){let u=new Blob([f.data],{type:n}),h=window.URL.createObjectURL(u);a.src=h,a.cancel=void 0,s(void 0,a)}}).catch(f=>{if(f.name!=="AbortError")throw f}),a},_removeTile:function(o){let s=this._tiles[o];s&&(s.el.cancel&&s.el.cancel(),s.el.width=0,s.el.height=0,s.el.deleted=!0,L.DomUtil.remove(s.el),delete this._tiles[o],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(o)}))}});return new i(t)},ns=e=>(t,r)=>{if(r instanceof AbortController)return e(t,r);let n=new AbortController;return e(t,n).then(i=>r(void 0,i.data,i.cacheControl||"",i.expires||""),i=>r(i)).catch(i=>r(i)),{cancel:()=>n.abort()}},is=class{constructor(){this.tilev4=(e,t)=>F(this,null,function*(){if(e.type==="json"){let u=e.url.substr(10),h=this.tiles.get(u);h||(h=new bt(u),this.tiles.set(u,h));let d=yield h.getHeader();return{data:{tiles:[`${e.url}/{z}/{x}/{y}`],minzoom:d.minZoom,maxzoom:d.maxZoom,bounds:[d.minLon,d.minLat,d.maxLon,d.maxLat]}}}let r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),n=e.url.match(r);if(!n)throw new Error("Invalid PMTiles protocol URL");let i=n[1],o=this.tiles.get(i);o||(o=new bt(i),this.tiles.set(i,o));let s=n[2],a=n[3],l=n[4],c=yield o.getHeader(),f=yield o?.getZxy(+s,+a,+l,t.signal);return f?{data:new Uint8Array(f.data),cacheControl:f.cacheControl,expires:f.expires}:c.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=ns(this.tilev4),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function re(e,t){return(t>>>0)*4294967296+(e>>>0)}function os(e,t){let r=t.buf,n=r[t.pos++],i=(n&112)>>4;if(n<128||(n=r[t.pos++],i|=(n&127)<<3,n<128)||(n=r[t.pos++],i|=(n&127)<<10,n<128)||(n=r[t.pos++],i|=(n&127)<<17,n<128)||(n=r[t.pos++],i|=(n&127)<<24,n<128)||(n=r[t.pos++],i|=(n&1)<<31,n<128))return re(e,i);throw new Error("Expected varint not more than 10 bytes")}function ne(e){let t=e.buf,r=t[e.pos++],n=r&127;return r<128||(r=t[e.pos++],n|=(r&127)<<7,r<128)||(r=t[e.pos++],n|=(r&127)<<14,r<128)||(r=t[e.pos++],n|=(r&127)<<21,r<128)?n:(r=t[e.pos],n|=(r&15)<<28,os(n,e))}function Qr(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function ss(e,t){let r=J(2,e),n=t,i=t,o=t,s=[0,0],a=1;for(;a<r;)n=1&o/2,i=1&(o^n),Qr(a,s,n,i),s[0]+=a*n,s[1]+=a*i,o=o/4,a*=2;return[e,s[0],s[1]]}var as=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function qr(e,t,r){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>J(2,e)-1||r>J(2,e)-1)throw Error("tile x/y outside zoom level bounds");let n=as[e],i=J(2,e),o=0,s=0,a=0,l=[t,r],c=i/2;for(;c>0;)o=(l[0]&c)>0?1:0,s=(l[1]&c)>0?1:0,a+=c*c*(3*o^s),Qr(c,l,o,s),c=c/2;return n+a}function ls(e){let t=0,r=0;for(let n=0;n<27;n++){let i=(1<<n)*(1<<n);if(t+i>e)return ss(n,e-t);t+=i}throw Error("Tile zoom level exceeds max safe number limit (26)")}var en=(e=>(e[e.Unknown=0]="Unknown",e[e.None=1]="None",e[e.Gzip=2]="Gzip",e[e.Brotli=3]="Brotli",e[e.Zstd=4]="Zstd",e))(en||{});function St(e,t){return F(this,null,function*(){if(t===1||t===0)return e;if(t===2){if(typeof globalThis.DecompressionStream>"u")return It(new Uint8Array(e));let r=new Response(e).body;if(!r)throw Error("Failed to read response stream");let n=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(n).arrayBuffer()}throw Error("Compression method not supported")})}var tn=(e=>(e[e.Unknown=0]="Unknown",e[e.Mvt=1]="Mvt",e[e.Png=2]="Png",e[e.Jpeg=3]="Jpeg",e[e.Webp=4]="Webp",e[e.Avif=5]="Avif",e))(tn||{});function rn(e){return e===1?".mvt":e===2?".png":e===3?".jpg":e===4?".webp":e===5?".avif":""}var cs=127;function nn(e,t){let r=0,n=e.length-1;for(;r<=n;){let i=n+r>>1,o=t-e[i].tileId;if(o>0)r=i+1;else if(o<0)n=i-1;else return e[i]}return n>=0&&(e[n].runLength===0||t-e[n].tileId<e[n].runLength)?e[n]:null}var fs=class{constructor(e){this.file=e}getKey(){return this.file.name}getBytes(e,t){return F(this,null,function*(){return{data:yield this.file.slice(e,e+t).arrayBuffer()}})}},on=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1;let r="";"navigator"in globalThis&&(r=globalThis.navigator.userAgent||"");let n=r.indexOf("Windows")>-1,i=/Chrome|Chromium|Edg|OPR|Brave/.test(r);this.chromeWindowsNoCache=!1,n&&i&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,r,n){return F(this,null,function*(){let i,o;r?o=r:(i=new AbortController,o=i.signal);let s=new Headers(this.customHeaders);s.set("range",`bytes=${e}-${e+t-1}`);let a;this.mustReload?a="reload":this.chromeWindowsNoCache&&(a="no-store");let l=yield fetch(this.url,{signal:o,cache:a,headers:s});if(e===0&&l.status===416){let h=l.headers.get("Content-Range");if(!h||!h.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let d=+h.substr(8);l=yield fetch(this.url,{signal:o,cache:"reload",headers:{range:`bytes=0-${d-1}`}})}let c=l.headers.get("Etag");if(c?.startsWith("W/")&&(c=null),l.status===416||n&&c&&c!==n)throw this.mustReload=!0,new Re(`Server returned non-matching ETag ${n} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);let f=l.headers.get("Content-Length");if(l.status===200&&(!f||+f>t))throw i&&i.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:c||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function _(e,t){let r=e.getUint32(t+4,!0),n=e.getUint32(t+0,!0);return r*J(2,32)+n}function sn(e,t){let r=new DataView(e),n=r.getUint8(7);if(n>3)throw Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:_(r,8),rootDirectoryLength:_(r,16),jsonMetadataOffset:_(r,24),jsonMetadataLength:_(r,32),leafDirectoryOffset:_(r,40),leafDirectoryLength:_(r,48),tileDataOffset:_(r,56),tileDataLength:_(r,64),numAddressedTiles:_(r,72),numTileEntries:_(r,80),numTileContents:_(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:t}}function an(e){let t={buf:new Uint8Array(e),pos:0},r=ne(t),n=[],i=0;for(let o=0;o<r;o++){let s=ne(t);n.push({tileId:i+s,offset:0,length:0,runLength:1}),i+=s}for(let o=0;o<r;o++)n[o].runLength=ne(t);for(let o=0;o<r;o++)n[o].length=ne(t);for(let o=0;o<r;o++){let s=ne(t);s===0&&o>0?n[o].offset=n[o-1].offset+n[o-1].length:n[o].offset=s-1}return n}function us(e){let t=new DataView(e);return t.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):t.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var Re=class extends Error{};function ln(e,t){return F(this,null,function*(){let r=yield e.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(us(r.data)<3)return[yield Xr.getHeader(e)];let i=r.data.slice(0,cs),o=sn(i,r.etag),s=r.data.slice(o.rootDirectoryOffset,o.rootDirectoryOffset+o.rootDirectoryLength),a=`${e.getKey()}|${o.etag||""}|${o.rootDirectoryOffset}|${o.rootDirectoryLength}`,l=an(yield t(s,o.internalCompression));return[o,[a,l.length,l]]})}function cn(e,t,r,n,i){return F(this,null,function*(){let o=yield e.getBytes(r,n,void 0,i.etag),s=yield t(o.data,i.internalCompression),a=an(s);if(a.length===0)throw new Error("Empty directory is invalid");return a})}var hs=class{constructor(e=100,t=!0,r=St){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return F(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,r.data;let n=yield ln(e,this.decompress);return n[1]&&this.cache.set(n[1][0],{lastUsed:this.counter++,data:n[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:n[0]}),this.prune(),n[0]})}getDirectory(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,o.data;let s=yield cn(e,this.decompress,t,r,n);return this.cache.set(i,{lastUsed:this.counter++,data:s}),this.prune(),s})}getArrayBuffer(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=yield e.getBytes(t,r,void 0,n.etag);return this.cache.set(i,{lastUsed:this.counter++,data:s.data}),this.prune(),s.data})}prune(){if(this.cache.size>this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){this.cache.delete(e.getKey())})}},fn=class{constructor(e=100,t=!0,r=St){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return F(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,yield r.data;let n=new Promise((i,o)=>{ln(e,this.decompress).then(s=>{s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:Promise.resolve(s[1][2])}),i(s[0]),this.prune()}).catch(s=>{o(s)})});return this.cache.set(t,{lastUsed:this.counter++,data:n}),n})}getDirectory(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=new Promise((a,l)=>{cn(e,this.decompress,t,r,n).then(c=>{a(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=new Promise((a,l)=>{e.getBytes(t,r,void 0,n.etag).then(c=>{a(c.data),this.cache.has(i),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:s}),s})}prune(){if(this.cache.size>=this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){let t=e.getKey();if(this.invalidations.get(t))return yield this.invalidations.get(t);this.cache.delete(e.getKey());let r=new Promise((n,i)=>{this.getHeader(e).then(o=>{n(),this.invalidations.delete(t)}).catch(o=>{i(o)})});this.invalidations.set(t,r)})}},bt=class{constructor(e,t,r){typeof e=="string"?this.source=new on(e):this.source=e,r?this.decompress=r:this.decompress=St,t?this.cache=t:this.cache=new fn}getHeader(){return F(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,r,n){return F(this,null,function*(){let i=qr(e,t,r),o=yield this.cache.getHeader(this.source);if(o.specVersion<3)return Xr.getZxy(o,this.source,this.cache,e,t,r,n);if(e<o.minZoom||e>o.maxZoom)return;let s=o.rootDirectoryOffset,a=o.rootDirectoryLength;for(let l=0;l<=3;l++){let c=yield this.cache.getDirectory(this.source,s,a,o),f=nn(c,i);if(f){if(f.runLength>0){let u=yield this.source.getBytes(o.tileDataOffset+f.offset,f.length,n,o.etag);return{data:yield this.decompress(u.data,o.tileCompression),cacheControl:u.cacheControl,expires:u.expires}}s=o.leafDirectoryOffset+f.offset,a=f.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(e,t,r,n){return F(this,null,function*(){try{return yield this.getZxyAttempt(e,t,r,n)}catch(i){if(i instanceof Re)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,r,n);throw i}})}getMetadataAttempt(){return F(this,null,function*(){let e=yield this.cache.getHeader(this.source),t=yield this.source.getBytes(e.jsonMetadataOffset,e.jsonMetadataLength,void 0,e.etag),r=yield this.decompress(t.data,e.internalCompression),n=new TextDecoder("utf-8");return JSON.parse(n.decode(r))})}getMetadata(){return F(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof Re)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}getTileJson(e){return F(this,null,function*(){let t=yield this.getHeader(),r=yield this.getMetadata(),n=rn(t.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${e}/{z}/{x}/{y}${n}`],vector_layers:r.vector_layers,attribution:r.attribution,description:r.description,name:r.name,version:r.version,bounds:[t.minLon,t.minLat,t.maxLon,t.maxLat],center:[t.centerLon,t.centerLat,t.centerZoom],minzoom:t.minZoom,maxzoom:t.maxZoom}})}};var{TileType:Ie}=Pe;function un(e,t,r,n){let i=null;if(t)try{let a=JSON.stringify(t);i=de.parseTextSync?.(a,n)||null}catch(a){console.warn("PMTiles metadata could not be interpreted as TileJSON",a)}let o={};typeof i?.name=="string"&&(o.name=i.name),typeof i?.htmlAttribution=="string"&&(o.attributions=[i.htmlAttribution]);let s={...o,format:"pmtiles",formatVersion:e.specVersion,attributions:[],tileMIMEType:ds(e.tileType),minZoom:e.minZoom,maxZoom:e.maxZoom,boundingBox:[[e.minLon,e.minLat],[e.maxLon,e.maxLat]],center:[e.centerLon,e.centerLat],centerZoom:e.centerZoom,etag:e.etag};return i&&(s.tilejson=i),r?.includeFormatHeader&&(s.formatHeader=e,s.formatMetadata=s),s}function ds(e){switch(e){case Ie.Mvt:return"application/vnd.mapbox-vector-tile";case Ie.Png:return"image/png";case Ie.Jpeg:return"image/jpeg";case Ie.Webp:return"image/webp";case Ie.Avif:return"image/avif";default:return"application/octet-stream"}}var He=class{blob;key;constructor(t,r){this.blob=t,this.key=r}getKey(){return this.blob.url||""}async getBytes(t,r,n){return{data:await this.blob.slice(t,t+r).arrayBuffer()}}};var{PMTiles:ps}=Pe,gs="1.0.0",hn={name:"PMTiles",id:"pmtiles",module:"pmtiles",version:gs,extensions:["pmtiles"],mimeTypes:["application/octet-stream"],options:{url:void 0,pmtiles:{}},type:"pmtiles",fromUrl:!0,fromBlob:!0,testURL:e=>e.endsWith(".pmtiles"),createDataSource:(e,t)=>new W(e,t)},W=class extends fe{data;props;mimeType=null;pmtiles;metadata;constructor(t,r){super(r),this.props=r;let n=typeof t=="string"?et(t):new He(t,"pmtiles");this.data=t,this.pmtiles=new ps(n),this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata()}async getSchema(){return{fields:[],metadata:{}}}async getMetadata(){let t=await this.pmtiles.getHeader(),r=await this.pmtiles.getMetadata()||{},n=un(t,r,{includeFormatHeader:!1},this.loadOptions);return this.props.attributions&&(n.attributions=[...this.props.attributions,...n.attributions||[]]),n?.tileMIMEType&&(this.mimeType=n?.tileMIMEType),n}async getTile(t){let{x:r,y:n,z:i}=t,s=(await this.pmtiles.getZxy(i,r,n))?.data;return s||null}async getTileData(t){let{x:r,y:n,z:i}=t.index;switch((await this.metadata).tileMIMEType){case"application/vnd.mapbox-vector-tile":return await this.getVectorTile({x:r,y:n,z:i,layers:[]});default:return await this.getImageTile({x:r,y:n,z:i,layers:[]})}}async getImageTile(t){let r=await this.getTile(t);return r?await ot.parse(r,this.loadOptions):null}async getVectorTile(t){let r=await this.getTile(t),n={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:t.x,y:t.y,z:t.z},...this.loadOptions?.mvt},...this.loadOptions};return r?await vt.parse(r,n):null}};var dn="4.3.0";var gn={name:"PMTiles",id:"pmtiles",module:"pmtiles",version:dn,extensions:["pmtiles"],mimeTypes:["application/octet-stream"],tests:["PMTiles"],options:{pmtiles:{}},parse:async(e,t)=>pn(new ce(new Blob([e])),t),parseFile:pn};async function pn(e,t){let n=await new W(e.handle,{pmtiles:t?.pmtiles||{}}).getMetadata(),{tileMIMEType:i,tilejson:o={}}=n,{layers:s=[]}=o;switch(i){case"application/vnd.mapbox-vector-tile":return{shape:"vector-source",layers:s.map(a=>({name:a.name,schema:a.schema})),tables:[],formatSpecificMetadata:n};case"image/png":case"image/jpeg":return{shape:"image-source",formatSpecificMetadata:n};default:throw new Error(`PMTilesLoader: Unsupported tile MIME type ${i}`)}}return Sn(be);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var Bn=Object.create;var ae=Object.defineProperty;var Sn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var An=Object.getPrototypeOf,_n=Object.prototype.hasOwnProperty;var Dn=(e,t,r)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ot=(e,t)=>{for(var r in t)ae(e,r,{get:t[r],enumerable:!0})},Ee=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of En(t))!_n.call(e,o)&&o!==r&&ae(e,o,{get:()=>t[o],enumerable:!(n=Sn(t,o))||n.enumerable});return e},Ae=(e,t,r)=>(Ee(e,t,"default"),r&&Ee(r,t,"default")),jt=(e,t,r)=>(r=e!=null?Bn(An(e)):{},Ee(t||!e||!e.__esModule?ae(r,"default",{value:e,enumerable:!0}):r,e)),Ln=e=>Ee(ae({},"__esModule",{value:!0}),e);var _e=(e,t,r)=>(Dn(e,typeof t!="symbol"?t+"":t,r),r);var Rt=qe((Fs,zt)=>{zt.exports=globalThis.loaders});var Ar=qe(mt=>{mt.read=function(e,t,r,n,o){var i,s,a=o*8-n-1,l=(1<<a)-1,c=l>>1,f=-7,u=r?o-1:0,h=r?-1:1,d=e[t+u];for(u+=h,i=d&(1<<-f)-1,d>>=-f,f+=a;f>0;i=i*256+e[t+u],u+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;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:(d?-1:1)*(1/0);s=s+Math.pow(2,n),i=i-c}return(d?-1:1)*s*Math.pow(2,i-n)};mt.write=function(e,t,r,n,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,d=n?0:i-1,p=n?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[r+d]=a&255,d+=p,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[r+d]=s&255,d+=p,s/=256,c-=8);e[r+d-p]|=y*128}});var Ur=qe((Nl,Vr)=>{"use strict";Vr.exports=x;var ze=Ar();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 yt=(1<<16)*(1<<16),_r=1/yt,li=12,Mr=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),o=n>>3,i=this.pos;this.type=n&7,e(o,t,this),this.pos===i&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Re(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Lr(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Re(this.buf,this.pos)+Re(this.buf,this.pos+4)*yt;return this.pos+=8,e},readSFixed64:function(){var e=Re(this.buf,this.pos)+Lr(this.buf,this.pos+4)*yt;return this.pos+=8,e},readFloat:function(){var e=ze.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=ze.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,ci(r,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>=li&&Mr?Pi(this.buf,t,e):Fi(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 r=G(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=G(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=G(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=G(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=G(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=G(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=G(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=G(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=G(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 r=new Uint8Array(t);r.set(this.buf),this.buf=r,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),re(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),re(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),re(this.buf,e&-1,this.pos),re(this.buf,Math.floor(e*_r),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),re(this.buf,e&-1,this.pos),re(this.buf,Math.floor(e*_r),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){fi(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=Ii(this.buf,e,this.pos);var r=this.pos-t;r>=128&&Dr(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),ze.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),ze.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 r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&Dr(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,x.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,di,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,pi,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,yi,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,gi,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,mi,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,xi,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,wi,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,vi,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Ti,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 ci(e,t,r){var n=r.buf,o,i;if(i=n[r.pos++],o=(i&112)>>4,i<128||(i=n[r.pos++],o|=(i&127)<<3,i<128)||(i=n[r.pos++],o|=(i&127)<<10,i<128)||(i=n[r.pos++],o|=(i&127)<<17,i<128)||(i=n[r.pos++],o|=(i&127)<<24,i<128)||(i=n[r.pos++],o|=(i&1)<<31,i<128))return te(e,o,t);throw new Error("Expected varint not more than 10 bytes")}function G(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function te(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function fi(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),ui(r,n,t),hi(n,t)}function ui(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function hi(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((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 Dr(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var o=r.pos-1;o>=e;o--)r.buf[o+n]=r.buf[o]}function di(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function pi(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function gi(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function mi(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function yi(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function xi(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function wi(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function vi(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function Ti(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Re(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function re(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function Lr(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Fi(e,t,r){for(var n="",o=t;o<r;){var i=e[o],s=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a>r)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,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),n+=String.fromCharCode(s),o+=a}return n}function Pi(e,t,r){return Mr.decode(e.subarray(t,r))}function Ii(e,t,r){for(var n=0,o,i;n<t.length;n++){if(o=t.charCodeAt(n),o>55295&&o<57344)if(i)if(o<56320){e[r++]=239,e[r++]=191,e[r++]=189,i=o;continue}else o=i-55296<<10|o-56320|65536,i=null;else{o>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):i=o;continue}else i&&(e[r++]=239,e[r++]=191,e[r++]=189,i=null);o<128?e[r++]=o:(o<2048?e[r++]=o>>6|192:(o<65536?e[r++]=o>>12|224:(e[r++]=o>>18|240,e[r++]=o>>12&63|128),e[r++]=o>>6&63|128),e[r++]=o&63|128)}return r}});var Be={};Ot(Be,{PMTilesSource:()=>Dt,PMTilesTileSource:()=>J,_PMTilesLoader:()=>vn});Ae(Be,jt(Rt(),1));function le(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var N={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Mn=N.self||N.window||N.global||{},Vn=N.window||N.self||N.global||{},Un=N.global||N.self||N.window||{},Cn=N.document||{};var et=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Ht=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Nn=Ht&&parseFloat(Ht[1])||0;var De=globalThis,kn=globalThis.document||{},Le=globalThis.process||{},Gn=globalThis.console,bs=globalThis.navigator||{};function Zt(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function z(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Zt()}var tt="4.0.7";function jn(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var Me=class{constructor(t,r,n="sessionStorage"){this.storage=jn(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function $t(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function Wt(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}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 zn=10;function Jt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ve[e]||Ve.WHITE)}function Kt(e,t,r){return!z&&typeof e=="string"&&(t&&(e=`\x1B[${Jt(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Jt(r)+zn}m${e}\x1B[49m`)),e}function Yt(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),o=e;for(let i of n){let s=o[i];typeof s=="function"&&(t.find(a=>i===a)||(o[i]=s.bind(e)))}}function ce(e,t){if(!e)throw new Error(t||"Assertion failed")}function R(){let e;if(z()&&De.performance)e=De?.performance?.now?.();else if("hrtime"in Le){let t=Le?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var X={debug:z()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Rn={enabled:!0,level:0};function Q(){}var Xt={},Qt={once:!0},j=class{constructor({id:t}={id:""}){this.VERSION=tt,this._startTs=R(),this._deltaTs=R(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Me(`__probe-${this.id}__`,Rn),this.timeStamp(`${this.id} started`),Yt(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((R()-this._startTs).toPrecision(10))}getDelta(){return Number((R()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!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,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,X.warn,arguments,Qt)}error(t){return this._getLogFunction(0,t,X.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,X.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,X.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,X.debug||X.info,arguments,Qt)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||Q,n&&[n],{tag:Zn(r)}):Q}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||Q)}group(t,r,n={collapsed:!1}){let o=qt({logLevel:t,message:r,opts:n}),{collapsed:i}=n;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Q)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=er(t)}_getLogFunction(t,r,n,o,i){if(this._shouldLog(t)){i=qt({logLevel:t,message:r,args:o,opts:i}),n=n||i.method,ce(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=R();let s=i.tag||i.message;if(i.once&&s)if(!Xt[s])Xt[s]=R();else return Q;return r=Hn(this.id,i.message,i),n.bind(console,r,...i.args)}return Q}};j.VERSION=tt;function er(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 ce(Number.isFinite(t)&&t>=0),t}function qt(e){let{logLevel:t,message:r}=e;e.logLevel=er(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),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 ce(o==="string"||o==="object"),Object.assign(e,{args:n},e.opts)}function Hn(e,t,r){if(typeof t=="string"){let n=r.time?Wt($t(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=Kt(t,r.color,r.background)}return t}function Zn(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var Ys=new j({id:"@probe.gl/log"});var rt="4.4.0-alpha.0",$n=rt[0]>="0"&&rt[0]<="9"?`v${rt}`:"";function Wn(){let e=new j({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=$n,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var nt=Wn();function tr(e,t){return rr(e||{},t)}function rr(e,t,r=0){if(r>3)return t;let n={...e};for(let[o,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?n[o]=rr(n[o]||{},t[o],r+1):n[o]=t[o];return n}var Jn="",nr={};function fe(e){for(let t in nr)if(e.startsWith(t)){let r=nr[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Jn}${e}`),e}var ue=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r){return await this.handle.slice(Number(t),Number(t)+Number(r)).arrayBuffer()}};var ot=class{optionsType;options;data;url;loadOptions;fetch;_needsRefresh=!0;constructor(t,r,n){n?this.options=tr({...n,core:ot.defaultOptions},r):this.options={...r},this.data=t,this.url=typeof t=="string"?fe(t):"",this.loadOptions={...this.options.core?.loadOptions},this.fetch=Kn(this.loadOptions)}setProps(t){this.options=Object.assign(this.options,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}},q=ot;_e(q,"defaultOptions",{core:{type:"auto",attributions:[],loadOptions:{},loaders:[]}});function Kn(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,o)=>t(n,o);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var or="4.4.0-alpha.0";var Yn=globalThis.loaders?.parseImageNode,it=typeof Image<"u",st=typeof ImageBitmap<"u",Xn=Boolean(Yn),at=et?!0:Xn;function ir(e){switch(e){case"auto":return st||it||at;case"imagebitmap":return st;case"image":return it;case"data":return at;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function sr(){if(st)return"imagebitmap";if(it)return"image";if(at)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Qn(e){let t=qn(e);if(!t)throw new Error("Not an image");return t}function ar(e){switch(Qn(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function qn(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/,to=/\.svg((\?|#).*)?$/;function Ue(e){return e&&(eo.test(e)||to.test(e))}function lr(e,t){if(Ue(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return lt(e,t)}function lt(e,t){if(Ue(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ce(e,t,r){let n=lr(e,r),o=self.URL||self.webkitURL,i=typeof n!="string"&&o.createObjectURL(n);try{return await ro(i||n,t)}finally{i&&o.revokeObjectURL(i)}}async function ro(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,o)=>{try{r.onload=()=>n(r),r.onerror=i=>{let s=i instanceof Error?i.message:"error";o(new Error(s))}}catch(i){o(i)}})}var no={},cr=!0;async function fr(e,t,r){let n;Ue(r)?n=await Ce(e,t,r):n=lt(e,r);let o=t&&t.imagebitmap;return await oo(n,o)}async function oo(e,t=null){if((io(t)||!cr)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),cr=!1}return await createImageBitmap(e)}function io(e){for(let t in e||no)return!1;return!0}function ur(e){return!co(e,"ftyp",4)||!(e[8]&96)?null:so(e)}function so(e){switch(ao(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ao(e,t,r){return String.fromCharCode(...e.slice(t,r))}function lo(e){return[...e].map(t=>t.charCodeAt(0))}function co(e,t,r=0){let n=lo(t);for(let o=0;o<n.length;++o)if(n[o]!==e[o+r])return!1;return!0}var k=!1,he=!0;function Ne(e){let t=de(e);return uo(t)||go(t)||ho(t)||po(t)||fo(t)}function fo(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=ur(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function uo(e){let t=de(e);return t.byteLength>=24&&t.getUint32(0,k)===2303741511?{mimeType:"image/png",width:t.getUint32(16,k),height:t.getUint32(20,k)}:null}function ho(e){let t=de(e);return t.byteLength>=10&&t.getUint32(0,k)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,he),height:t.getUint16(8,he)}:null}function po(e){let t=de(e);return t.byteLength>=14&&t.getUint16(0,k)===16973&&t.getUint32(2,he)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,he),height:t.getUint32(22,he)}:null}function go(e){let t=de(e);if(!(t.byteLength>=3&&t.getUint16(0,k)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:o}=mo(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,k);if(o.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,k),width:t.getUint16(i+7,k)};if(!n.has(s))return null;i+=2,i+=t.getUint16(i,k)}return null}function mo(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function de(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 hr(e,t){let{mimeType:r}=Ne(e)||{},n=globalThis.loaders?.parseImageNode;return le(n),await n(e,r)}async function dr(e,t,r){t=t||{};let o=(t.image||{}).type||"auto",{url:i}=r||{},s=yo(o),a;switch(s){case"imagebitmap":a=await fr(e,t,i);break;case"image":a=await Ce(e,t,i);break;case"data":a=await hr(e,t);break;default:le(!1)}return o==="data"&&(a=ar(a)),a}function yo(e){switch(e){case"auto":case"data":return sr();default:return ir(e),e}}var xo=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],wo=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],vo={image:{type:"auto",decode:!0}},ct={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:or,mimeTypes:wo,extensions:xo,parse:dr,tests:[e=>Boolean(Ne(new DataView(e)))],options:vo};function pr(e){let t=[];if(e.fields)for(let r of e.fields)t.push({name:r.name,type:Fo(r),metadata:Po(r)});return{metadata:To(e),fields:t}}function To(e){let t={};for(let[r,n]of Object.entries(e))r!=="fields"&&n&&(t[r]=JSON.stringify(n));return t}function Fo(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 Po(e){let t={};for(let[r,n]of Object.entries(e))r!=="name"&&n&&(t[r]=JSON.stringify(n));return t}var xr=e=>e!==null&&typeof e=="object";function ft(e,t){if(!e||!xr(e))return null;let r={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(r.generator=e.generator),typeof e.generator_options=="string"&&(r.generatorOptions=e.generator_options),r.boundingBox=gr(e.bounds)||gr(e.antimeridian_adjusted_bounds),r.center=Ao(e.center),r.maxZoom=mr(e.maxzoom),r.minZoom=mr(e.minzoom),typeof e?.json=="string")try{r.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let n=e.tilestats||r.metaJson?.tilestats,o=Bo(n,t),i=Io(e.vector_layers),s=Eo(i,o);return r={...r,layers:s},r.maxZoom===null&&s.length>0&&(r.maxZoom=s[0].maxZoom||null),r.minZoom===null&&s.length>0&&(r.minZoom=s[0].minZoom||null),r}function Io(e){return Array.isArray(e)?e.map(t=>bo(t)):[]}function bo(e){let t=Object.entries(e.fields||[]).map(([n,o])=>({name:n,...Fr(String(o))})),r={...e};return delete r.fields,{name:e.id||"",...r,fields:t}}function Bo(e,t){return xr(e)&&Array.isArray(e.layers)?e.layers.map(r=>So(r,t)):[]}function So(e,t){let r=[],n={},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];n[a]=n[a]||[],n[a].push(i),console.warn("ignoring tilestats indexed field",a)}else r[s]||r.push(Do(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:r}}function Eo(e,t){return e.map(r=>{let n=t.find(s=>s.name===r.name),o=n?.fields||r.fields||[],i={...r,...n,fields:o};return i.schema=pr(i),i})}function gr(e){let t=Tr(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(vr)&&[t[1],t[3]].every(wr))return[[t[0],t[1]],[t[2],t[3]]]}function Ao(e){let t=Tr(e);return Array.isArray(t)&&t.length===3&&vr(t[0])&&wr(t[1])&&_o(t[2])?t:null}function mr(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function wr(e){return Number.isFinite(e)&&e<=90&&e>=-90}function vr(e){return Number.isFinite(e)&&e<=180&&e>=-180}function _o(e){return Number.isFinite(e)&&e>=0&&e<=22}function Tr(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var yr={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 Do(e={},t){let r=Fr(e.type),n={name:e.attribute,...r};return typeof e.min=="number"&&(n.min=e.min),typeof e.max=="number"&&(n.max=e.max),typeof e.count=="number"&&(n.uniqueValueCount=e.count),e.values&&(n.values=e.values),n.values&&typeof t.maxValues=="number"&&(n.values=n.values?.slice(0,t.maxValues)),n}function Fr(e){let t=e.toLowerCase();return!t||yr[t],yr[t]||{type:"string"}}var Lo="4.4.0-alpha.0",pe={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Lo,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let r=new TextDecoder().decode(e),n=JSON.parse(r),o={...pe.options.tilejson,...t?.tilejson};return ft(n,o)},parseTextSync:(e,t)=>{let r=JSON.parse(e),n={...pe.options.tilejson,...t?.tilejson};return ft(r,n)}};var ge={x:0,y:1,z:2};function H(e,t={}){let{start:r=0,end:n=e.length,plane:o="xy"}=t,i=t.size||2,s=0,a=ge[o[0]],l=ge[o[1]];for(let c=r,f=n-i;c<n;c+=i)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function ht(e,t,r=2,n,o="xy"){let i=t&&t.length,s=i?t[0]*r:e.length,a=Ir(e,0,s,r,!0,n&&n[0],o),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,d,p,y;if(i&&(a=Go(e,t,a,r,n,o)),e.length>80*r){h=f=e[0],d=u=e[1];for(let P=r;P<s;P+=r)p=e[P],y=e[P+1],p<h&&(h=p),y<d&&(d=y),p>f&&(f=p),y>u&&(u=y);c=Math.max(f-h,u-d),c=c!==0?32767/c:0}return me(a,l,r,h,d,c,0),l}function Ir(e,t,r,n,o,i,s){let a,l;i===void 0&&(i=H(e,{start:t,end:r,size:n,plane:s}));let c=ge[s[0]],f=ge[s[1]];if(o===i<0)for(a=t;a<r;a+=n)l=Pr(a,e[a+c],e[a+f],l);else for(a=r-n;a>=t;a-=n)l=Pr(a,e[a+c],e[a+f],l);return l&&Oe(l,l.next)&&(xe(l),l=l.next),l}function Z(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Oe(r,r.next)||T(r.prev,r,r.next)===0)){if(xe(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function me(e,t,r,n,o,i,s){if(!e)return;!s&&i&&Ho(e,n,o,i);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,i?Co(e,n,o,i):Uo(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(c.i/r|0),xe(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=No(Z(e),t,r),me(e,t,r,n,o,i,2)):s===2&&ko(e,t,r,n,o,i):me(Z(e),t,r,n,o,i,1);break}}}function Uo(e){let t=e.prev,r=e,n=e.next;if(T(t,r,n)>=0)return!1;let o=t.x,i=r.x,s=n.x,a=t.y,l=r.y,c=n.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,d=a>l?a>c?a:c:l>c?l:c,p=n.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&ee(o,a,i,l,s,c,p.x,p.y)&&T(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Co(e,t,r,n){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,d=a<l?a<c?a:c:l<c?l:c,p=f<u?f<h?f:h:u<h?u:h,y=a>l?a>c?a:c:l>c?l:c,P=f>u?f>h?f:h:u>h?u:h,D=ut(d,p,t,r,n),v=ut(y,P,t,r,n),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=D&&g&&g.z<=v;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==o&&m!==s&&ee(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==o&&g!==s&&ee(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>=D;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==o&&m!==s&&ee(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>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==o&&g!==s&&ee(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 No(e,t,r){let n=e;do{let o=n.prev,i=n.next.next;!Oe(o,i)&&br(o,n,n.next,i)&&ye(o,i)&&ye(i,o)&&(t.push(o.i/r|0),t.push(n.i/r|0),t.push(i.i/r|0),xe(n),xe(n.next),n=e=i),n=n.next}while(n!==e);return Z(n)}function ko(e,t,r,n,o,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Wo(s,a)){let l=Br(s,a);s=Z(s,s.next),l=Z(l,l.next),me(s,t,r,n,o,i,0),me(l,t,r,n,o,i,0);return}a=a.next}s=s.next}while(s!==e)}function Go(e,t,r,n,o,i){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*n,f=a<l-1?t[a+1]*n:e.length,u=Ir(e,c,f,n,!1,o&&o[a+1],i),u===u.next&&(u.steiner=!0),s.push($o(u));for(s.sort(Oo),a=0;a<s.length;a++)r=jo(s[a],r);return r}function Oo(e,t){return e.x-t.x}function jo(e,t){let r=zo(e,t);if(!r)return t;let n=Br(r,e);return Z(n,n.next),Z(r,r.next)}function zo(e,t){let r=t,n=e.x,o=e.y,i=-1/0,s;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){let h=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>i&&(i=h,s=r.x<r.next.x?r:r.next,h===n))return s}r=r.next}while(r!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;r=s;do n>=r.x&&r.x>=l&&n!==r.x&&ee(o<c?n:i,o,l,c,o<c?i:n,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(n-r.x),ye(r,e)&&(u<f||u===f&&(r.x>s.x||r.x===s.x&&Ro(s,r)))&&(s=r,f=u)),r=r.next;while(r!==a);return s}function Ro(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function Ho(e,t,r,n){let o=e;do o.z===0&&(o.z=ut(o.x,o.y,t,r,n)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,Zo(o)}function Zo(e){let t,r,n=1,o,i,s,a,l,c;do{for(i=e,e=null,c=null,o=0;i;){for(o++,a=i,s=0,r=0;r<n&&(s++,a=a.nextZ,!!a);r++);for(l=n;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,n*=2}while(o>1);return e}function ut(e,t,r,n,o){return e=(e-r)*o|0,t=(t-n)*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 $o(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function ee(e,t,r,n,o,i,s,a){return(o-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(n-a)>=(r-s)*(t-a)&&(r-s)*(i-a)>=(o-s)*(n-a)}function Wo(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Jo(e,t)&&(ye(e,t)&&ye(t,e)&&Ko(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||Oe(e,t)&&T(e.prev,e,e.next)>0&&T(t.prev,t,t.next)>0)}function T(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Oe(e,t){return e.x===t.x&&e.y===t.y}function br(e,t,r,n){let o=Ge(T(e,t,r)),i=Ge(T(e,t,n)),s=Ge(T(r,n,e)),a=Ge(T(r,n,t));return!!(o!==i&&s!==a||o===0&&ke(e,r,t)||i===0&&ke(e,n,t)||s===0&&ke(r,e,n)||a===0&&ke(r,t,n))}function ke(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Ge(e){return e>0?1:e<0?-1:0}function Jo(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&br(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function ye(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 Ko(e,t){let r=e,n=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do r.y>i!=r.next.y>i&&r.next.y!==r.y&&o<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Br(e,t){let r=new we(e.i,e.x,e.y),n=new we(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,r.next=o,o.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function Pr(e,t,r,n){let o=new we(e,t,r);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function xe(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 we=class{constructor(t,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=n}};function je(e,t,r){let n=ei(e),o=Object.keys(n).filter(i=>n[i]!==Array);return ti(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||o,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function ei(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let o=r.properties[n];t[n]=ai(o,t[n])}return t}function ti(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:o,linePositionsCount:i,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:y=Float32Array,triangulate:P=!0}=r,D=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(n*d),globalFeatureIds:new v(n),featureIds:o>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(i*d),globalFeatureIds:new v(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},S={type:"Polygon",polygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:l>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new y(l*d),globalFeatureIds:new v(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};P&&(S.triangles=[]);for(let M of[m,g,S])for(let I of p){let E=h[I];M.numericProps[I]=new E(M.positions.length/d)}g.pathIndices[s]=i,S.polygonIndices[c]=l,S.primitivePolygonIndices[f]=l;let C={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let M of e){let I=M.geometry,E=M.properties||{};switch(I.type){case"Point":ri(I,m,C,d,E),m.properties.push(pt(E,p)),D&&m.fields.push({id:M.id}),C.pointFeature++;break;case"LineString":ni(I,g,C,d,E),g.properties.push(pt(E,p)),D&&g.fields.push({id:M.id}),C.lineFeature++;break;case"Polygon":oi(I,S,C,d,E),S.properties.push(pt(E,p)),D&&S.fields.push({id:M.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return si(m,g,S,d)}function ri(e,t,r,n,o){t.positions.set(e.data,r.pointPosition*n);let i=e.data.length/n;gt(t,o,r.pointPosition,i),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+i),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+i),r.pointPosition+=i}function ni(e,t,r,n,o){t.positions.set(e.data,r.linePosition*n);let i=e.data.length/n;gt(t,o,r.linePosition,i),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+i),t.featureIds.fill(r.lineFeature,r.linePosition,r.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[r.linePath++]=r.linePosition,r.linePosition+=(c-l)/n}}function oi(e,t,r,n,o){t.positions.set(e.data,r.polygonPosition*n);let i=e.data.length/n;gt(t,o,r.polygonPosition,i),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+i),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=r.polygonPosition;t.polygonIndices[r.polygonObject++]=l;let c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let d=0,p=f.length;d<p;++d){let y=f[d],P=d===p-1?u===void 0?e.data.length:u[0]:f[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(P-y)/n}let h=r.polygonPosition;ii(t,c,f,{startPosition:l,endPosition:h,coordLength:n})}}function ii(e,t,r,{startPosition:n,endPosition:o,coordLength:i}){if(!e.triangles)return;let s=n*i,a=o*i,l=e.positions.subarray(s,a),c=r[0],f=r.slice(1).map(h=>(h-c)/i),u=ht(l,f,i,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(n+u[h])}function dt(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function si(e,t,r,n){let o={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:dt(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:dt(t.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:dt(r.numericProps,1)}};return o.polygons&&r.triangles&&(o.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),o}function gt(e,t,r,n){for(let o in e.numericProps)if(o in t){let i=t[o];e.numericProps[o].fill(i,r,r+n)}}function pt(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function ai(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var Tt=jt(Ur(),1);function bi(e){let t=0;for(let r=0,n=e.length-1,o,i;r<e.length;n=r++)o=e[r],i=e[n],t+=(i[0]-o[0])*(o[1]+i[1]);return t}function xt(e,t){if(Array.isArray(e[0])){for(let n of e)xt(n,t);return}let r=e;r[0]/=t,r[1]/=t}function Cr(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function wt(e,t,r){if(typeof e[0][0]!="number"){for(let s of e)wt(s,t,r);return}let n=r*Math.pow(2,t.z),o=r*t.x,i=r*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+o)*360/n-180;let l=180-(a[1]+i)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function Nr(e,t,r){let{x:n,y:o,z:i}=t,s=r*Math.pow(2,i),a=r*n,l=r*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 kr(e){let t=e.length;if(t<=1)return[e];let r=[],n,o;for(let i=0;i<t;i++){let s=bi(e[i]);s!==0&&(o===void 0&&(o=s<0),o===s<0?(n&&r.push(n),n=[e[i]]):n&&n.push(e[i]))}return n&&r.push(n),r}function Gr(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[H(e.data)]],indices:[e.indices]};let n=[],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),d=H(h);if(d===0){let p=e.data.slice(0,u),y=e.data.slice(c);e.data=p.concat(y),l+=c-u;continue}a===void 0&&(a=d<0),a===d<0?(s.length&&(n.push(i),o.push(s)),s=[u],i=[d]):(i.push(d),s.push(u))}return i&&n.push(i),s.length&&o.push(s),{type:r,areas:n,indices:o,data:e.data}}var $=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,r,n,o,i,s){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=o,this._values=i,this._geometryInfo=s,t.readFields(Bi,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return Or(this,n,o=>wt(o,r,this.extent));default:return Or(this,n,xt)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,o=>Nr(o,r,this.extent));default:return this._toBinaryCoordinates(n,Cr)}}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o=0,i=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<r;){if(o<=0){let u=t.readVarint();n=u&7,o=u>>3}if(o--,n===1||n===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(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let o=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,n={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/o,n={type:"LineString",...t};break;case 3:n=Gr(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let s of n.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=n.data.length/o;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(i.id=this.id),i}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o=0,i=0,s=0,a=[],l;for(;t.pos<r;){if(o<=0){let c=t.readVarint();n=c&7,o=c>>3}switch(o--,n){case 1:case 2:i+=t.readSVarint(),s+=t.readSVarint(),n===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 ${n}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o,i=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<r;)if(i<=0&&(o=t.readVarint(),n=o&7,i=o>>3),i--,n===1||n===2)s+=t.readSVarint(),a+=t.readSVarint(),n===1&&c.push(l),f.push(s,a),l+=2;else if(n===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 ${n}`);return{data:f,indices:c}}};_e($,"types",["Unknown","Point","LineString","Polygon"]);function Or(e,t,r){let n=$.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,r(s,e.extent);break;case 2:for(s=t,o=0;o<s.length;o++)r(s[o],e.extent);break;case 3:for(s=kr(t),o=0;o<s.length;o++)for(i=0;i<s[o].length;i++)r(s[o][i],e.extent);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:n=`Multi${n}`;let a={type:"Feature",geometry:{type:n,coordinates:s},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function Bi(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?Si(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function Si(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],o=t._values[e.readVarint()];t.properties[n]=o}}var He=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Ei,this,r),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 r=this._pbf.readVarint()+this._pbf.pos;return new $(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(t,r){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 $(this._pbf,n,this.extent,this._keys,this._values,r)}};function Ei(e,t,r){t&&r&&(e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(Ai(r)))}function Ai(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}var ve=class{layers;constructor(t,r){this.layers=t.readFields(_i,{},r)}};function _i(e,t,r){if(e===3&&r){let n=new He(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function Ft(e,t){let r=Li(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:vt(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:jr(e,r)};case"geojson":return jr(e,r);case"binary-geometry":return vt(e,r);case"binary":return vt(e,r);default:throw new Error(n||"undefined shape")}}function vt(e,t){let[r,n]=Di(e,t),o=je(r,n);return o.byteLength=e.byteLength,o}function Di(e,t){let r=[],n={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[r,n];let o=new ve(new Tt.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,n),f=Vi(c,t,s);r.push(f)}}),[r,n]}function jr(e,t){if(e.byteLength<=0)return[];let r=[],n=new ve(new Tt.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(i=>{let s=n.layers[i];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=Mi(l,t,i);r.push(c)}}),r}function Li(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&&nt.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function Mi(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function Vi(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var zr={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],category:"geometry"};var Ui="4.4.0-alpha.0",Rr={...zr,dataType:null,batchType:null,version:Ui,worker:!0,options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},Pt={...Rr,parse:async(e,t)=>Ft(e,t),parseSync:Ft,binary:!0};var Ze={name:"PMTiles",id:"pmtiles",module:"pmtiles",extensions:["pmtiles"],mimeTypes:["application/octet-stream"],tests:["PMTiles"]};var Ie={};Ot(Ie,{Compression:()=>an,EtagMismatch:()=>We,FetchSource:()=>un,FileSource:()=>gs,PMTiles:()=>Et,Protocol:()=>cs,ResolvedValueCache:()=>ys,SharedPromiseCache:()=>mn,TileType:()=>ln,bytesToHeader:()=>hn,findTile:()=>fn,getUint64:()=>_,leafletRasterLayer:()=>as,readVarint:()=>oe,tileIdToZxy:()=>ds,tileTypeExt:()=>cn,zxyToTileId:()=>sn});var W=Math.pow,F=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(c){o(c)}},s=l=>{try{a(r.throw(l))}catch(c){o(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((r=r.apply(e,t)).next())}),B=Uint8Array,ie=Uint16Array,Ci=Int32Array,$r=new B([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Wr=new B([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ni=new B([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jr=function(e,t){for(var r=new ie(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var o=new Ci(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)o[i]=i-r[n]<<5|n;return{b:r,r:o}},Kr=Jr($r,2),Yr=Kr.b,ki=Kr.r;Yr[28]=258,ki[258]=28;var Xr=Jr(Wr,0),Gi=Xr.b,ic=Xr.r,Bt=new ie(32768);for(w=0;w<32768;++w)O=(w&43690)>>1|(w&21845)<<1,O=(O&52428)>>2|(O&13107)<<2,O=(O&61680)>>4|(O&3855)<<4,Bt[w]=((O&65280)>>8|(O&255)<<8)>>1;var O,w,Fe=function(e,t,r){for(var n=e.length,o=0,i=new ie(t);o<n;++o)e[o]&&++i[e[o]-1];var s=new ie(t);for(o=1;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;var a;if(r){a=new ie(1<<t);var l=15-t;for(o=0;o<n;++o)if(e[o])for(var c=o<<4|e[o],f=t-e[o],u=s[e[o]-1]++<<f,h=u|(1<<f)-1;u<=h;++u)a[Bt[u]>>l]=c}else for(a=new ie(n),o=0;o<n;++o)e[o]&&(a[o]=Bt[s[e[o]-1]++]>>15-e[o]);return a},Pe=new B(288);for(w=0;w<144;++w)Pe[w]=8;var w;for(w=144;w<256;++w)Pe[w]=9;var w;for(w=256;w<280;++w)Pe[w]=7;var w;for(w=280;w<288;++w)Pe[w]=8;var w,Qr=new B(32);for(w=0;w<32;++w)Qr[w]=5;var w,Oi=Fe(Pe,9,1),ji=Fe(Qr,5,1),It=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},U=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&r},bt=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},zi=function(e){return(e+7)/8|0},Ri=function(e,t,r){(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new B(r-t);return n.set(e.subarray(t,r)),n},Hi=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],b=function(e,t,r){var n=new Error(t||Hi[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,b),!r)throw n;return n},At=function(e,t,r,n){var o=e.length,i=n?n.length:0;if(!o||t.f&&!t.l)return r||new B(0);var s=!r||t.i!=2,a=t.i;r||(r=new B(o*3));var l=function(Nt){var kt=r.length;if(Nt>kt){var Gt=new B(Math.max(kt*2,Nt));Gt.set(r),r=Gt}},c=t.f||0,f=t.p||0,u=t.b||0,h=t.l,d=t.d,p=t.m,y=t.n,P=o*8;do{if(!h){c=U(e,f,1);var D=U(e,f+1,3);if(f+=3,D)if(D==1)h=Oi,d=ji,p=9,y=5;else if(D==2){var S=U(e,f,31)+257,C=U(e,f+10,15)+4,M=S+U(e,f+5,31)+1;f+=14;for(var I=new B(M),E=new B(19),A=0;A<C;++A)E[Ni[A]]=U(e,f+A*3,7);f+=C*3;for(var Lt=It(E),Tn=(1<<Lt)-1,Fn=Fe(E,Lt,1),A=0;A<M;){var Mt=Fn[U(e,f,Tn)];f+=Mt&15;var v=Mt>>4;if(v<16)I[A++]=v;else{var K=0,Se=0;for(v==16?(Se=3+U(e,f,3),f+=2,K=I[A-1]):v==17?(Se=3+U(e,f,7),f+=3):v==18&&(Se=11+U(e,f,127),f+=7);Se--;)I[A++]=K}}var Vt=I.subarray(0,S),V=I.subarray(S);p=It(Vt),y=It(V),h=Fe(Vt,p,1),d=Fe(V,y,1)}else b(1);else{var v=zi(f)+4,m=e[v-4]|e[v-3]<<8,g=v+m;if(g>o){a&&b(0);break}s&&l(u+m),r.set(e.subarray(v,g),u),t.b=u+=m,t.p=f=g*8,t.f=c;continue}if(f>P){a&&b(0);break}}s&&l(u+131072);for(var Pn=(1<<p)-1,In=(1<<y)-1,Ke=f;;Ke=f){var K=h[bt(e,f)&Pn],Y=K>>4;if(f+=K&15,f>P){a&&b(0);break}if(K||b(2),Y<256)r[u++]=Y;else if(Y==256){Ke=f,h=null;break}else{var Ut=Y-254;if(Y>264){var A=Y-257,se=$r[A];Ut=U(e,f,(1<<se)-1)+Yr[A],f+=se}var Ye=d[bt(e,f)&In],Xe=Ye>>4;Ye||b(3),f+=Ye&15;var V=Gi[Xe];if(Xe>3){var se=Wr[Xe];V+=bt(e,f)&(1<<se)-1,f+=se}if(f>P){a&&b(0);break}s&&l(u+131072);var Qe=u+Ut;if(u<V){var Ct=i-V,bn=Math.min(V,Qe);for(Ct+u<0&&b(3);u<bn;++u)r[u]=n[Ct+u]}for(;u<Qe;u+=4)r[u]=r[u-V],r[u+1]=r[u+1-V],r[u+2]=r[u+2-V],r[u+3]=r[u+3-V];u=Qe}}t.l=h,t.p=Ke,t.b=u,t.f=c,h&&(c=1,t.m=p,t.d=d,t.n=y)}while(!c);return u==r.length?r:Ri(r,0,u)},Zi=new B(0),$i=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&b(6,"invalid gzip data");var t=e[3],r=10;t&4&&(r+=(e[10]|e[11]<<8)+2);for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[r++]);return r+(t&2)},Wi=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ji=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&b(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&b(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function Ki(e,t){return At(e,{i:2},t&&t.out,t&&t.dictionary)}function Yi(e,t){var r=$i(e);return r+8>e.length&&b(6,"invalid gzip data"),At(e.subarray(r,-8),{i:2},t&&t.out||new B(Wi(e)),t&&t.dictionary)}function Xi(e,t){return At(e.subarray(Ji(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}function St(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Yi(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Ki(e,t):Xi(e,t)}var Qi=typeof TextDecoder<"u"&&new TextDecoder,qi=0;try{Qi.decode(Zi,{stream:!0}),qi=1}catch{}var qr=(e,t)=>e*W(2,t),Te=(e,t)=>Math.floor(e/W(2,t)),$e=(e,t)=>qr(e.getUint16(t+1,!0),8)+e.getUint8(t),en=(e,t)=>qr(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),es=(e,t,r,n,o)=>{if(e!==n.getUint8(o))return e-n.getUint8(o);let i=$e(n,o+1);if(t!==i)return t-i;let s=$e(n,o+4);return r!==s?r-s:0},ts=(e,t,r,n)=>{let o=tn(e,t|128,r,n);return o?{z:t,x:r,y:n,offset:o[0],length:o[1],isDir:!0}:null},Hr=(e,t,r,n)=>{let o=tn(e,t,r,n);return o?{z:t,x:r,y:n,offset:o[0],length:o[1],isDir:!1}:null},tn=(e,t,r,n)=>{let o=0,i=e.byteLength/17-1;for(;o<=i;){let s=i+o>>1,a=es(t,r,n,e,s*17);if(a>0)o=s+1;else if(a<0)i=s-1;else return[en(e,s*17+7),e.getUint32(s*17+13,!0)]}return null},rs=(e,t)=>e.isDir&&!t.isDir?1:!e.isDir&&t.isDir?-1:e.z!==t.z?e.z-t.z:e.x!==t.x?e.x-t.x:e.y-t.y,rn=(e,t)=>{let r=e.getUint8(t*17);return{z:r&127,x:$e(e,t*17+1),y:$e(e,t*17+4),offset:en(e,t*17+7),length:e.getUint32(t*17+13,!0),isDir:r>>7===1}},Zr=e=>{let t=[],r=new DataView(e);for(let n=0;n<r.byteLength/17;n++)t.push(rn(r,n));return ns(t)},ns=e=>{e.sort(rs);let t=new ArrayBuffer(17*e.length),r=new Uint8Array(t);for(let n=0;n<e.length;n++){let o=e[n],i=o.z;o.isDir&&(i=i|128),r[n*17]=i,r[n*17+1]=o.x&255,r[n*17+2]=o.x>>8&255,r[n*17+3]=o.x>>16&255,r[n*17+4]=o.y&255,r[n*17+5]=o.y>>8&255,r[n*17+6]=o.y>>16&255,r[n*17+7]=o.offset&255,r[n*17+8]=Te(o.offset,8)&255,r[n*17+9]=Te(o.offset,16)&255,r[n*17+10]=Te(o.offset,24)&255,r[n*17+11]=Te(o.offset,32)&255,r[n*17+12]=Te(o.offset,48)&255,r[n*17+13]=o.length&255,r[n*17+14]=o.length>>8&255,r[n*17+15]=o.length>>16&255,r[n*17+16]=o.length>>24&255}return t},os=(e,t)=>{if(e.byteLength<17)return null;let r=e.byteLength/17,n=rn(e,r-1);if(n.isDir){let o=n.z,i=t.z-o,s=Math.trunc(t.x/(1<<i)),a=Math.trunc(t.y/(1<<i));return{z:o,x:s,y:a}}return null};function is(e){return F(this,null,function*(){let t=yield e.getBytes(0,512e3),r=new DataView(t.data),n=r.getUint32(4,!0),o=r.getUint16(8,!0),i=new TextDecoder("utf-8"),s=JSON.parse(i.decode(new DataView(t.data,10,n))),a=0;s.compression==="gzip"&&(a=2);let l=0;"minzoom"in s&&(l=+s.minzoom);let c=0;"maxzoom"in s&&(c=+s.maxzoom);let f=0,u=0,h=0,d=-180,p=-85,y=180,P=85;if(s.bounds){let v=s.bounds.split(",");d=+v[0],p=+v[1],y=+v[2],P=+v[3]}if(s.center){let v=s.center.split(",");f=+v[0],u=+v[1],h=+v[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+n,rootDirectoryLength:o*17,jsonMetadataOffset:10,jsonMetadataLength:n,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:a,tileType:1,minZoom:l,maxZoom:c,minLon:d,minLat:p,maxLon:y,maxLat:P,centerZoom:h,centerLon:f,centerLat:u,etag:t.etag}})}function ss(e,t,r,n,o,i,s){return F(this,null,function*(){let a=yield r.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);e.specVersion===1&&(a=Zr(a));let l=Hr(new DataView(a),n,o,i);if(l){let u=(yield t.getBytes(l.offset,l.length,s)).data,h=new DataView(u);return h.getUint8(0)===31&&h.getUint8(1)===139&&(u=St(new Uint8Array(u))),{data:u}}let c=os(new DataView(a),{z:n,x:o,y:i});if(c){let f=ts(new DataView(a),c.z,c.x,c.y);if(f){let u=yield r.getArrayBuffer(t,f.offset,f.length,e);e.specVersion===1&&(u=Zr(u));let h=Hr(new DataView(u),n,o,i);if(h){let p=(yield t.getBytes(h.offset,h.length,s)).data,y=new DataView(p);return y.getUint8(0)===31&&y.getUint8(1)===139&&(p=St(new Uint8Array(p))),{data:p}}}}})}var nn={getHeader:is,getZxy:ss},as=(e,t)=>{let r=!1,n="",o=L.GridLayer.extend({createTile:(i,s)=>{let a=document.createElement("img"),l=new AbortController,c=l.signal;return a.cancel=()=>{l.abort()},r||(e.getHeader().then(f=>{f.tileType===1?console.error("Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):f.tileType===2?n="image/png":f.tileType===3?n="image/jpeg":f.tileType===4?n="image/webp":f.tileType===5&&(n="image/avif")}),r=!0),e.getZxy(i.z,i.x,i.y,c).then(f=>{if(f){let u=new Blob([f.data],{type:n}),h=window.URL.createObjectURL(u);a.src=h,a.cancel=void 0,s(void 0,a)}}).catch(f=>{if(f.name!=="AbortError")throw f}),a},_removeTile:function(i){let s=this._tiles[i];s&&(s.el.cancel&&s.el.cancel(),s.el.width=0,s.el.height=0,s.el.deleted=!0,L.DomUtil.remove(s.el),delete this._tiles[i],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(i)}))}});return new o(t)},ls=e=>(t,r)=>{if(r instanceof AbortController)return e(t,r);let n=new AbortController;return e(t,n).then(o=>r(void 0,o.data,o.cacheControl||"",o.expires||""),o=>r(o)).catch(o=>r(o)),{cancel:()=>n.abort()}},cs=class{constructor(){this.tilev4=(e,t)=>F(this,null,function*(){if(e.type==="json"){let u=e.url.substr(10),h=this.tiles.get(u);h||(h=new Et(u),this.tiles.set(u,h));let d=yield h.getHeader();return{data:{tiles:[`${e.url}/{z}/{x}/{y}`],minzoom:d.minZoom,maxzoom:d.maxZoom,bounds:[d.minLon,d.minLat,d.maxLon,d.maxLat]}}}let r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),n=e.url.match(r);if(!n)throw new Error("Invalid PMTiles protocol URL");let o=n[1],i=this.tiles.get(o);i||(i=new Et(o),this.tiles.set(o,i));let s=n[2],a=n[3],l=n[4],c=yield i.getHeader(),f=yield i?.getZxy(+s,+a,+l,t.signal);return f?{data:new Uint8Array(f.data),cacheControl:f.cacheControl,expires:f.expires}:c.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=ls(this.tilev4),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function ne(e,t){return(t>>>0)*4294967296+(e>>>0)}function fs(e,t){let r=t.buf,n=r[t.pos++],o=(n&112)>>4;if(n<128||(n=r[t.pos++],o|=(n&127)<<3,n<128)||(n=r[t.pos++],o|=(n&127)<<10,n<128)||(n=r[t.pos++],o|=(n&127)<<17,n<128)||(n=r[t.pos++],o|=(n&127)<<24,n<128)||(n=r[t.pos++],o|=(n&1)<<31,n<128))return ne(e,o);throw new Error("Expected varint not more than 10 bytes")}function oe(e){let t=e.buf,r=t[e.pos++],n=r&127;return r<128||(r=t[e.pos++],n|=(r&127)<<7,r<128)||(r=t[e.pos++],n|=(r&127)<<14,r<128)||(r=t[e.pos++],n|=(r&127)<<21,r<128)?n:(r=t[e.pos],n|=(r&15)<<28,fs(n,e))}function on(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let o=t[0];t[0]=t[1],t[1]=o}}function us(e,t){let r=W(2,e),n=t,o=t,i=t,s=[0,0],a=1;for(;a<r;)n=1&i/2,o=1&(i^n),on(a,s,n,o),s[0]+=a*n,s[1]+=a*o,i=i/4,a*=2;return[e,s[0],s[1]]}var hs=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function sn(e,t,r){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>W(2,e)-1||r>W(2,e)-1)throw Error("tile x/y outside zoom level bounds");let n=hs[e],o=W(2,e),i=0,s=0,a=0,l=[t,r],c=o/2;for(;c>0;)i=(l[0]&c)>0?1:0,s=(l[1]&c)>0?1:0,a+=c*c*(3*i^s),on(c,l,i,s),c=c/2;return n+a}function ds(e){let t=0,r=0;for(let n=0;n<27;n++){let o=(1<<n)*(1<<n);if(t+o>e)return us(n,e-t);t+=o}throw Error("Tile zoom level exceeds max safe number limit (26)")}var an=(e=>(e[e.Unknown=0]="Unknown",e[e.None=1]="None",e[e.Gzip=2]="Gzip",e[e.Brotli=3]="Brotli",e[e.Zstd=4]="Zstd",e))(an||{});function _t(e,t){return F(this,null,function*(){if(t===1||t===0)return e;if(t===2){if(typeof globalThis.DecompressionStream>"u")return St(new Uint8Array(e));let r=new Response(e).body;if(!r)throw Error("Failed to read response stream");let n=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(n).arrayBuffer()}throw Error("Compression method not supported")})}var ln=(e=>(e[e.Unknown=0]="Unknown",e[e.Mvt=1]="Mvt",e[e.Png=2]="Png",e[e.Jpeg=3]="Jpeg",e[e.Webp=4]="Webp",e[e.Avif=5]="Avif",e))(ln||{});function cn(e){return e===1?".mvt":e===2?".png":e===3?".jpg":e===4?".webp":e===5?".avif":""}var ps=127;function fn(e,t){let r=0,n=e.length-1;for(;r<=n;){let o=n+r>>1,i=t-e[o].tileId;if(i>0)r=o+1;else if(i<0)n=o-1;else return e[o]}return n>=0&&(e[n].runLength===0||t-e[n].tileId<e[n].runLength)?e[n]:null}var gs=class{constructor(e){this.file=e}getKey(){return this.file.name}getBytes(e,t){return F(this,null,function*(){return{data:yield this.file.slice(e,e+t).arrayBuffer()}})}},un=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1;let r="";"navigator"in globalThis&&(r=globalThis.navigator.userAgent||"");let n=r.indexOf("Windows")>-1,o=/Chrome|Chromium|Edg|OPR|Brave/.test(r);this.chromeWindowsNoCache=!1,n&&o&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,r,n){return F(this,null,function*(){let o,i;r?i=r:(o=new AbortController,i=o.signal);let s=new Headers(this.customHeaders);s.set("range",`bytes=${e}-${e+t-1}`);let a;this.mustReload?a="reload":this.chromeWindowsNoCache&&(a="no-store");let l=yield fetch(this.url,{signal:i,cache:a,headers:s});if(e===0&&l.status===416){let h=l.headers.get("Content-Range");if(!h||!h.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let d=+h.substr(8);l=yield fetch(this.url,{signal:i,cache:"reload",headers:{range:`bytes=0-${d-1}`}})}let c=l.headers.get("Etag");if(c?.startsWith("W/")&&(c=null),l.status===416||n&&c&&c!==n)throw this.mustReload=!0,new We(`Server returned non-matching ETag ${n} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);let f=l.headers.get("Content-Length");if(l.status===200&&(!f||+f>t))throw o&&o.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:c||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function _(e,t){let r=e.getUint32(t+4,!0),n=e.getUint32(t+0,!0);return r*W(2,32)+n}function hn(e,t){let r=new DataView(e),n=r.getUint8(7);if(n>3)throw Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:_(r,8),rootDirectoryLength:_(r,16),jsonMetadataOffset:_(r,24),jsonMetadataLength:_(r,32),leafDirectoryOffset:_(r,40),leafDirectoryLength:_(r,48),tileDataOffset:_(r,56),tileDataLength:_(r,64),numAddressedTiles:_(r,72),numTileEntries:_(r,80),numTileContents:_(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:t}}function dn(e){let t={buf:new Uint8Array(e),pos:0},r=oe(t),n=[],o=0;for(let i=0;i<r;i++){let s=oe(t);n.push({tileId:o+s,offset:0,length:0,runLength:1}),o+=s}for(let i=0;i<r;i++)n[i].runLength=oe(t);for(let i=0;i<r;i++)n[i].length=oe(t);for(let i=0;i<r;i++){let s=oe(t);s===0&&i>0?n[i].offset=n[i-1].offset+n[i-1].length:n[i].offset=s-1}return n}function ms(e){let t=new DataView(e);return t.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):t.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var We=class extends Error{};function pn(e,t){return F(this,null,function*(){let r=yield e.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(ms(r.data)<3)return[yield nn.getHeader(e)];let o=r.data.slice(0,ps),i=hn(o,r.etag),s=r.data.slice(i.rootDirectoryOffset,i.rootDirectoryOffset+i.rootDirectoryLength),a=`${e.getKey()}|${i.etag||""}|${i.rootDirectoryOffset}|${i.rootDirectoryLength}`,l=dn(yield t(s,i.internalCompression));return[i,[a,l.length,l]]})}function gn(e,t,r,n,o){return F(this,null,function*(){let i=yield e.getBytes(r,n,void 0,o.etag),s=yield t(i.data,o.internalCompression),a=dn(s);if(a.length===0)throw new Error("Empty directory is invalid");return a})}var ys=class{constructor(e=100,t=!0,r=_t){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return F(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,r.data;let n=yield pn(e,this.decompress);return n[1]&&this.cache.set(n[1][0],{lastUsed:this.counter++,data:n[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:n[0]}),this.prune(),n[0]})}getDirectory(e,t,r,n){return F(this,null,function*(){let o=`${e.getKey()}|${n.etag||""}|${t}|${r}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,i.data;let s=yield gn(e,this.decompress,t,r,n);return this.cache.set(o,{lastUsed:this.counter++,data:s}),this.prune(),s})}getArrayBuffer(e,t,r,n){return F(this,null,function*(){let o=`${e.getKey()}|${n.etag||""}|${t}|${r}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=yield e.getBytes(t,r,void 0,n.etag);return this.cache.set(o,{lastUsed:this.counter++,data:s.data}),this.prune(),s.data})}prune(){if(this.cache.size>this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){this.cache.delete(e.getKey())})}},mn=class{constructor(e=100,t=!0,r=_t){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return F(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,yield r.data;let n=new Promise((o,i)=>{pn(e,this.decompress).then(s=>{s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:Promise.resolve(s[1][2])}),o(s[0]),this.prune()}).catch(s=>{i(s)})});return this.cache.set(t,{lastUsed:this.counter++,data:n}),n})}getDirectory(e,t,r,n){return F(this,null,function*(){let o=`${e.getKey()}|${n.etag||""}|${t}|${r}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=new Promise((a,l)=>{gn(e,this.decompress,t,r,n).then(c=>{a(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(e,t,r,n){return F(this,null,function*(){let o=`${e.getKey()}|${n.etag||""}|${t}|${r}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=new Promise((a,l)=>{e.getBytes(t,r,void 0,n.etag).then(c=>{a(c.data),this.cache.has(o),this.prune()}).catch(c=>{l(c)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}prune(){if(this.cache.size>=this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){let t=e.getKey();if(this.invalidations.get(t))return yield this.invalidations.get(t);this.cache.delete(e.getKey());let r=new Promise((n,o)=>{this.getHeader(e).then(i=>{n(),this.invalidations.delete(t)}).catch(i=>{o(i)})});this.invalidations.set(t,r)})}},Et=class{constructor(e,t,r){typeof e=="string"?this.source=new un(e):this.source=e,r?this.decompress=r:this.decompress=_t,t?this.cache=t:this.cache=new mn}getHeader(){return F(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,r,n){return F(this,null,function*(){let o=sn(e,t,r),i=yield this.cache.getHeader(this.source);if(i.specVersion<3)return nn.getZxy(i,this.source,this.cache,e,t,r,n);if(e<i.minZoom||e>i.maxZoom)return;let s=i.rootDirectoryOffset,a=i.rootDirectoryLength;for(let l=0;l<=3;l++){let c=yield this.cache.getDirectory(this.source,s,a,i),f=fn(c,o);if(f){if(f.runLength>0){let u=yield this.source.getBytes(i.tileDataOffset+f.offset,f.length,n,i.etag);return{data:yield this.decompress(u.data,i.tileCompression),cacheControl:u.cacheControl,expires:u.expires}}s=i.leafDirectoryOffset+f.offset,a=f.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(e,t,r,n){return F(this,null,function*(){try{return yield this.getZxyAttempt(e,t,r,n)}catch(o){if(o instanceof We)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,r,n);throw o}})}getMetadataAttempt(){return F(this,null,function*(){let e=yield this.cache.getHeader(this.source),t=yield this.source.getBytes(e.jsonMetadataOffset,e.jsonMetadataLength,void 0,e.etag),r=yield this.decompress(t.data,e.internalCompression),n=new TextDecoder("utf-8");return JSON.parse(n.decode(r))})}getMetadata(){return F(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof We)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}getTileJson(e){return F(this,null,function*(){let t=yield this.getHeader(),r=yield this.getMetadata(),n=cn(t.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${e}/{z}/{x}/{y}${n}`],vector_layers:r.vector_layers,attribution:r.attribution,description:r.description,name:r.name,version:r.version,bounds:[t.minLon,t.minLat,t.maxLon,t.maxLat],center:[t.centerLon,t.centerLat,t.centerZoom],minzoom:t.minZoom,maxzoom:t.maxZoom}})}};var{TileType:be}=Ie;function yn(e,t,r,n){let o=null;if(t)try{let a=JSON.stringify(t);o=pe.parseTextSync?.(a,n)||null}catch(a){console.warn("PMTiles metadata could not be interpreted as TileJSON",a)}let i={};typeof o?.name=="string"&&(i.name=o.name),typeof o?.htmlAttribution=="string"&&(i.attributions=[o.htmlAttribution]);let s={...i,format:"pmtiles",formatVersion:e.specVersion,attributions:[],tileMIMEType:xs(e.tileType),minZoom:e.minZoom,maxZoom:e.maxZoom,boundingBox:[[e.minLon,e.minLat],[e.maxLon,e.maxLat]],center:[e.centerLon,e.centerLat],centerZoom:e.centerZoom,etag:e.etag};return o&&(s.tilejson=o),r?.includeFormatHeader&&(s.formatHeader=e,s.formatMetadata=s),s}function xs(e){switch(e){case be.Mvt:return"application/vnd.mapbox-vector-tile";case be.Png:return"image/png";case be.Jpeg:return"image/jpeg";case be.Webp:return"image/webp";case be.Avif:return"image/avif";default:return"application/octet-stream"}}var Je=class{blob;key;constructor(t,r){this.blob=t,this.key=r}getKey(){return this.blob.url||""}async getBytes(t,r,n){return{data:await this.blob.slice(t,t+r).arrayBuffer()}}};var{PMTiles:ws}=Ie,vs="1.0.0",Dt={...Ze,version:vs,type:"pmtiles",fromUrl:!0,fromBlob:!0,defaultOptions:{pmtiles:{}},testURL:e=>e.endsWith(".pmtiles"),createDataSource:(e,t)=>new J(e,t)},J=class extends q{mimeType=null;pmtiles;metadata;constructor(t,r){super(t,r,Dt.defaultOptions);let n=typeof t=="string"?fe(t):new Je(t,"pmtiles");this.pmtiles=new ws(n),this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata()}async getSchema(){return{fields:[],metadata:{}}}async getMetadata(){let t=await this.pmtiles.getHeader(),r=await this.pmtiles.getMetadata()||{},n=yn(t,r,{includeFormatHeader:!1},this.loadOptions);return this.options.attributions&&(n.attributions=[...this.options.core?.attributions||[],...n.attributions||[]]),n?.tileMIMEType&&(this.mimeType=n?.tileMIMEType),n}async getTile(t){let{x:r,y:n,z:o}=t,s=(await this.pmtiles.getZxy(o,r,n))?.data;return s||null}async getTileData(t){let{x:r,y:n,z:o}=t.index;switch((await this.metadata).tileMIMEType){case"application/vnd.mapbox-vector-tile":return await this.getVectorTile({x:r,y:n,z:o,layers:[]});default:return await this.getImageTile({x:r,y:n,z:o,layers:[]})}}async getImageTile(t){let r=await this.getTile(t);return r?await ct.parse(r,this.loadOptions):null}async getVectorTile(t){let r=await this.getTile(t),n={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:t.x,y:t.y,z:t.z},...this.loadOptions?.mvt},...this.loadOptions};return r?await Pt.parse(r,n):null}};var xn="4.4.0-alpha.0";var vn={...Ze,version:xn,options:{pmtiles:{}},parse:async(e,t)=>wn(new ue(new Blob([e])),t),parseFile:wn};async function wn(e,t){let n=await new J(e.handle,{pmtiles:t?.pmtiles||{}}).getMetadata(),{tileMIMEType:o,tilejson:i={}}=n,{layers:s=[]}=i;switch(o){case"application/vnd.mapbox-vector-tile":return{shape:"vector-source",layers:s.map(a=>({name:a.name,schema:a.schema})),tables:[],formatSpecificMetadata:n};case"image/png":case"image/jpeg":return{shape:"image-source",formatSpecificMetadata:n};default:throw new Error(`PMTilesLoader: Unsupported tile MIME type ${o}`)}}return Ln(Be);})();
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
ieee754/index.js:
|
package/dist/index.cjs
CHANGED
|
@@ -40,6 +40,18 @@ module.exports = __toCommonJS(dist_exports);
|
|
|
40
40
|
var import_loader_utils = require("@loaders.gl/loader-utils");
|
|
41
41
|
var import_images = require("@loaders.gl/images");
|
|
42
42
|
var import_mvt2 = require("@loaders.gl/mvt");
|
|
43
|
+
|
|
44
|
+
// dist/pmtiles-format.js
|
|
45
|
+
var PMTilesFormat = {
|
|
46
|
+
name: "PMTiles",
|
|
47
|
+
id: "pmtiles",
|
|
48
|
+
module: "pmtiles",
|
|
49
|
+
extensions: ["pmtiles"],
|
|
50
|
+
mimeTypes: ["application/octet-stream"],
|
|
51
|
+
tests: ["PMTiles"]
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// dist/pmtiles-source.js
|
|
43
55
|
var pmtiles2 = __toESM(require("pmtiles"), 1);
|
|
44
56
|
|
|
45
57
|
// dist/lib/parse-pmtiles.js
|
|
@@ -134,31 +146,25 @@ var BlobSource = class {
|
|
|
134
146
|
var { PMTiles } = pmtiles2;
|
|
135
147
|
var VERSION = "1.0.0";
|
|
136
148
|
var PMTilesSource = {
|
|
137
|
-
|
|
138
|
-
id: "pmtiles",
|
|
139
|
-
module: "pmtiles",
|
|
149
|
+
...PMTilesFormat,
|
|
140
150
|
version: VERSION,
|
|
141
|
-
extensions: ["pmtiles"],
|
|
142
|
-
mimeTypes: ["application/octet-stream"],
|
|
143
|
-
options: { url: void 0, pmtiles: {} },
|
|
144
151
|
type: "pmtiles",
|
|
145
152
|
fromUrl: true,
|
|
146
153
|
fromBlob: true,
|
|
154
|
+
defaultOptions: {
|
|
155
|
+
pmtiles: {}
|
|
156
|
+
},
|
|
147
157
|
testURL: (url) => url.endsWith(".pmtiles"),
|
|
148
|
-
createDataSource: (url,
|
|
158
|
+
createDataSource: (url, options) => new PMTilesTileSource(url, options)
|
|
149
159
|
};
|
|
150
160
|
var PMTilesTileSource = class extends import_loader_utils.DataSource {
|
|
151
|
-
data;
|
|
152
|
-
props;
|
|
153
161
|
mimeType = null;
|
|
154
162
|
pmtiles;
|
|
155
163
|
metadata;
|
|
156
|
-
constructor(data,
|
|
157
|
-
super(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
this.data = data;
|
|
161
|
-
this.pmtiles = new PMTiles(url);
|
|
164
|
+
constructor(data, options) {
|
|
165
|
+
super(data, options, PMTilesSource.defaultOptions);
|
|
166
|
+
const urlOrBlob = typeof data === "string" ? (0, import_loader_utils.resolvePath)(data) : new BlobSource(data, "pmtiles");
|
|
167
|
+
this.pmtiles = new PMTiles(urlOrBlob);
|
|
162
168
|
this.getTileData = this.getTileData.bind(this);
|
|
163
169
|
this.metadata = this.getMetadata();
|
|
164
170
|
}
|
|
@@ -166,11 +172,15 @@ var PMTilesTileSource = class extends import_loader_utils.DataSource {
|
|
|
166
172
|
return { fields: [], metadata: {} };
|
|
167
173
|
}
|
|
168
174
|
async getMetadata() {
|
|
175
|
+
var _a;
|
|
169
176
|
const pmtilesHeader = await this.pmtiles.getHeader();
|
|
170
177
|
const pmtilesMetadata = await this.pmtiles.getMetadata() || {};
|
|
171
178
|
const metadata = parsePMTilesHeader(pmtilesHeader, pmtilesMetadata, { includeFormatHeader: false }, this.loadOptions);
|
|
172
|
-
if (this.
|
|
173
|
-
metadata.attributions = [
|
|
179
|
+
if (this.options.attributions) {
|
|
180
|
+
metadata.attributions = [
|
|
181
|
+
...((_a = this.options.core) == null ? void 0 : _a.attributions) || [],
|
|
182
|
+
...metadata.attributions || []
|
|
183
|
+
];
|
|
174
184
|
}
|
|
175
185
|
if (metadata == null ? void 0 : metadata.tileMIMEType) {
|
|
176
186
|
this.mimeType = metadata == null ? void 0 : metadata.tileMIMEType;
|
|
@@ -224,17 +234,12 @@ var PMTilesTileSource = class extends import_loader_utils.DataSource {
|
|
|
224
234
|
var import_loader_utils2 = require("@loaders.gl/loader-utils");
|
|
225
235
|
|
|
226
236
|
// dist/lib/version.js
|
|
227
|
-
var VERSION2 = true ? "4.
|
|
237
|
+
var VERSION2 = true ? "4.4.0-alpha.0" : "latest";
|
|
228
238
|
|
|
229
239
|
// dist/pmtiles-loader.js
|
|
230
240
|
var PMTilesLoader = {
|
|
231
|
-
|
|
232
|
-
id: "pmtiles",
|
|
233
|
-
module: "pmtiles",
|
|
241
|
+
...PMTilesFormat,
|
|
234
242
|
version: VERSION2,
|
|
235
|
-
extensions: ["pmtiles"],
|
|
236
|
-
mimeTypes: ["application/octet-stream"],
|
|
237
|
-
tests: ["PMTiles"],
|
|
238
243
|
options: {
|
|
239
244
|
pmtiles: {}
|
|
240
245
|
},
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["index.js", "pmtiles-source.js", "lib/parse-pmtiles.js", "lib/blob-source.js", "pmtiles-loader.js", "lib/version.js"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { PMTilesSource } from \"./pmtiles-source.js\";\nexport { PMTilesTileSource } from \"./pmtiles-source.js\";\nexport { PMTilesLoader as _PMTilesLoader } from \"./pmtiles-loader.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { DataSource, resolvePath } from '@loaders.gl/loader-utils';\nimport { ImageLoader } from '@loaders.gl/images';\nimport { MVTLoader } from '@loaders.gl/mvt';\nimport * as pmtiles from 'pmtiles';\nconst { PMTiles } = pmtiles;\nimport { parsePMTilesHeader } from \"./lib/parse-pmtiles.js\";\nimport { BlobSource } from \"./lib/blob-source.js\";\nconst VERSION = '1.0.0';\n/**\n * Creates vector tile data sources for PMTiles urls or blobs\n */\nexport const PMTilesSource = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n options: { url: undefined, pmtiles: {} },\n type: 'pmtiles',\n fromUrl: true,\n fromBlob: true,\n testURL: (url) => url.endsWith('.pmtiles'),\n createDataSource: (url, props) => new PMTilesTileSource(url, props)\n};\n/**\n * A PMTiles data source\n * @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.\n */\nexport class PMTilesTileSource extends DataSource {\n data;\n props;\n mimeType = null;\n pmtiles;\n metadata;\n constructor(data, props) {\n super(props);\n this.props = props;\n const url = typeof data === 'string' ? resolvePath(data) : new BlobSource(data, 'pmtiles');\n this.data = data;\n this.pmtiles = new PMTiles(url);\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\n }\n async getSchema() {\n return { fields: [], metadata: {} };\n }\n async getMetadata() {\n const pmtilesHeader = await this.pmtiles.getHeader();\n const pmtilesMetadata = (await this.pmtiles.getMetadata()) || {};\n const metadata = parsePMTilesHeader(pmtilesHeader, pmtilesMetadata, { includeFormatHeader: false }, this.loadOptions);\n // Add additional attribution if necessary\n if (this.props.attributions) {\n metadata.attributions = [...this.props.attributions, ...(metadata.attributions || [])];\n }\n if (metadata?.tileMIMEType) {\n this.mimeType = metadata?.tileMIMEType;\n }\n // TODO - do we need to allow tileSize to be overridden? Some PMTiles examples seem to suggest it.\n return metadata;\n }\n async getTile(tileParams) {\n const { x, y, z } = tileParams;\n const rangeResponse = await this.pmtiles.getZxy(z, x, y);\n const arrayBuffer = rangeResponse?.data;\n if (!arrayBuffer) {\n // console.error('No arrayBuffer', tileParams);\n return null;\n }\n return arrayBuffer;\n }\n // Tile Source interface implementation: deck.gl compatible API\n // TODO - currently only handles image tiles, not vector tiles\n async getTileData(tileParams) {\n const { x, y, z } = tileParams.index;\n const metadata = await this.metadata;\n switch (metadata.tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return await this.getVectorTile({ x, y, z, layers: [] });\n default:\n return await this.getImageTile({ x, y, z, layers: [] });\n }\n }\n // ImageTileSource interface implementation\n async getImageTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n return arrayBuffer ? await ImageLoader.parse(arrayBuffer, this.loadOptions) : null;\n }\n // VectorTileSource interface implementation\n async getVectorTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n const loadOptions = {\n shape: 'geojson-table',\n mvt: {\n coordinates: 'wgs84',\n tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },\n ...this.loadOptions?.mvt\n },\n ...this.loadOptions\n };\n return arrayBuffer ? await MVTLoader.parse(arrayBuffer, loadOptions) : null;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { TileJSONLoader } from '@loaders.gl/mvt';\n// import {Source, PMTiles, Header, TileType} from 'pmtiles';\nimport * as pmtiles from 'pmtiles';\nconst { TileType } = pmtiles;\n/**\n * Parse PMTiles metdata from a PMTiles file\n * @param header\n * @param tilejsonMetadata\n * @param options\n * @param loadOptions\n * @returns\n */\nexport function parsePMTilesHeader(header, pmtilesMetadata, options, loadOptions) {\n // Ironically, to use the TileJSON loader we need to stringify the metadata again.\n // This is the price of integrating with the existing pmtiles library.\n // TODO - provide a non-standard TileJSONLoader parsers that accepts a JSON object?\n let tilejson = null;\n if (pmtilesMetadata) {\n try {\n const string = JSON.stringify(pmtilesMetadata);\n tilejson = TileJSONLoader.parseTextSync?.(string, loadOptions) || null;\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.warn('PMTiles metadata could not be interpreted as TileJSON', error);\n }\n }\n const partialMetadata = {};\n if (typeof tilejson?.name === 'string') {\n partialMetadata.name = tilejson.name;\n }\n if (typeof tilejson?.htmlAttribution === 'string') {\n partialMetadata.attributions = [tilejson.htmlAttribution];\n }\n const metadata = {\n ...partialMetadata,\n format: 'pmtiles',\n formatVersion: header.specVersion,\n attributions: [],\n tileMIMEType: decodeTileType(header.tileType),\n minZoom: header.minZoom,\n maxZoom: header.maxZoom,\n boundingBox: [\n [header.minLon, header.minLat],\n [header.maxLon, header.maxLat]\n ],\n center: [header.centerLon, header.centerLat],\n centerZoom: header.centerZoom,\n etag: header.etag\n };\n if (tilejson) {\n metadata.tilejson = tilejson;\n }\n // Application can optionally include the raw header and metadata.\n if (options?.includeFormatHeader) {\n metadata.formatHeader = header;\n metadata.formatMetadata = metadata;\n }\n return metadata;\n}\n/** Extract a MIME type for tiles from vector tile header */\nfunction decodeTileType(tileType) {\n switch (tileType) {\n case TileType.Mvt:\n return 'application/vnd.mapbox-vector-tile';\n case TileType.Png:\n return 'image/png';\n case TileType.Jpeg:\n return 'image/jpeg';\n case TileType.Webp:\n return 'image/webp';\n case TileType.Avif:\n return 'image/avif';\n default:\n return 'application/octet-stream';\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * A PMTiles library compatible source that reads from blobs\n * @deprecated TODO - reimplement as ReadableFileSource\n * Use loaders.gl HTTP range requests instead\n */\nexport class BlobSource {\n blob;\n key;\n constructor(blob, key) {\n this.blob = blob;\n this.key = key;\n }\n // TODO - how is this used?\n getKey() {\n // @ts-expect-error url is only defined on File subclass\n return this.blob.url || '';\n }\n async getBytes(offset, length, signal) {\n const slice = this.blob.slice(offset, offset + length);\n const data = await slice.arrayBuffer();\n return {\n data\n // etag: response.headers.get('ETag') || undefined,\n // cacheControl: response.headers.get('Cache-Control') || undefined,\n // expires: response.headers.get('Expires') || undefined\n };\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { BlobFile } from '@loaders.gl/loader-utils';\nimport { VERSION } from \"./lib/version.js\";\nimport { PMTilesTileSource } from \"./pmtiles-source.js\";\n/**\n * Loader for PMTiles metadata\n * @note This loader is intended to allow PMTiles to be treated like other file types in top-level loading logic.\n * @note For actual access to the tile data, use the PMTilesSource class.\n */\nexport const PMTilesLoader = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n tests: ['PMTiles'],\n options: {\n pmtiles: {}\n },\n parse: async (arrayBuffer, options) => parseFileAsPMTiles(new BlobFile(new Blob([arrayBuffer])), options),\n parseFile: parseFileAsPMTiles\n};\nasync function parseFileAsPMTiles(file, options) {\n const source = new PMTilesTileSource(file.handle, {\n pmtiles: options?.pmtiles || {}\n });\n const formatSpecificMetadata = await source.getMetadata();\n const { tileMIMEType, tilejson = {} } = formatSpecificMetadata;\n const { layers = [] } = tilejson;\n switch (tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return {\n shape: 'vector-source',\n layers: layers.map((layer) => ({ name: layer.name, schema: layer.schema })),\n tables: [],\n formatSpecificMetadata\n };\n case 'image/png':\n case 'image/jpeg':\n return { shape: 'image-source', formatSpecificMetadata };\n default:\n throw new Error(`PMTilesLoader: Unsupported tile MIME type ${tileMIMEType}`);\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.0\" !== 'undefined' ? \"4.3.0\" : 'latest';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,0BAAwC;AACxC,oBAA4B;AAC5B,IAAAA,cAA0B;
|
|
3
|
+
"sources": ["index.js", "pmtiles-source.js", "pmtiles-format.js", "lib/parse-pmtiles.js", "lib/blob-source.js", "pmtiles-loader.js", "lib/version.js"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { PMTilesSource } from \"./pmtiles-source.js\";\nexport { PMTilesTileSource } from \"./pmtiles-source.js\";\nexport { PMTilesLoader as _PMTilesLoader } from \"./pmtiles-loader.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { DataSource, resolvePath } from '@loaders.gl/loader-utils';\nimport { ImageLoader } from '@loaders.gl/images';\nimport { MVTLoader } from '@loaders.gl/mvt';\nimport { PMTilesFormat } from \"./pmtiles-format.js\";\nimport * as pmtiles from 'pmtiles';\nconst { PMTiles } = pmtiles;\nimport { parsePMTilesHeader } from \"./lib/parse-pmtiles.js\";\nimport { BlobSource } from \"./lib/blob-source.js\";\nconst VERSION = '1.0.0';\n/**\n * Creates vector tile data sources for PMTiles urls or blobs\n */\nexport const PMTilesSource = {\n ...PMTilesFormat,\n version: VERSION,\n type: 'pmtiles',\n fromUrl: true,\n fromBlob: true,\n defaultOptions: {\n pmtiles: {}\n },\n testURL: (url) => url.endsWith('.pmtiles'),\n createDataSource: (url, options) => new PMTilesTileSource(url, options)\n};\n/**\n * A PMTiles data source\n * @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.\n */\nexport class PMTilesTileSource extends DataSource {\n mimeType = null;\n pmtiles;\n metadata;\n constructor(data, options) {\n super(data, options, PMTilesSource.defaultOptions);\n const urlOrBlob = typeof data === 'string' ? resolvePath(data) : new BlobSource(data, 'pmtiles');\n this.pmtiles = new PMTiles(urlOrBlob);\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\n }\n async getSchema() {\n return { fields: [], metadata: {} };\n }\n async getMetadata() {\n const pmtilesHeader = await this.pmtiles.getHeader();\n const pmtilesMetadata = (await this.pmtiles.getMetadata()) || {};\n const metadata = parsePMTilesHeader(pmtilesHeader, pmtilesMetadata, { includeFormatHeader: false }, this.loadOptions);\n // Add additional attribution if necessary\n if (this.options.attributions) {\n metadata.attributions = [\n ...(this.options.core?.attributions || []),\n ...(metadata.attributions || [])\n ];\n }\n if (metadata?.tileMIMEType) {\n this.mimeType = metadata?.tileMIMEType;\n }\n // TODO - do we need to allow tileSize to be overridden? Some PMTiles examples seem to suggest it.\n return metadata;\n }\n async getTile(tileParams) {\n const { x, y, z } = tileParams;\n const rangeResponse = await this.pmtiles.getZxy(z, x, y);\n const arrayBuffer = rangeResponse?.data;\n if (!arrayBuffer) {\n // console.error('No arrayBuffer', tileParams);\n return null;\n }\n return arrayBuffer;\n }\n // Tile Source interface implementation: deck.gl compatible API\n // TODO - currently only handles image tiles, not vector tiles\n async getTileData(tileParams) {\n const { x, y, z } = tileParams.index;\n const metadata = await this.metadata;\n switch (metadata.tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return await this.getVectorTile({ x, y, z, layers: [] });\n default:\n return await this.getImageTile({ x, y, z, layers: [] });\n }\n }\n // ImageTileSource interface implementation\n async getImageTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n return arrayBuffer ? await ImageLoader.parse(arrayBuffer, this.loadOptions) : null;\n }\n // VectorTileSource interface implementation\n async getVectorTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n const loadOptions = {\n shape: 'geojson-table',\n mvt: {\n coordinates: 'wgs84',\n tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },\n ...this.loadOptions?.mvt\n },\n ...this.loadOptions\n };\n return arrayBuffer ? await MVTLoader.parse(arrayBuffer, loadOptions) : null;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * PMTiles\n */\nexport const PMTilesFormat = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n tests: ['PMTiles']\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { TileJSONLoader } from '@loaders.gl/mvt';\n// import {Source, PMTiles, Header, TileType} from 'pmtiles';\nimport * as pmtiles from 'pmtiles';\nconst { TileType } = pmtiles;\n/**\n * Parse PMTiles metdata from a PMTiles file\n * @param header\n * @param tilejsonMetadata\n * @param options\n * @param loadOptions\n * @returns\n */\nexport function parsePMTilesHeader(header, pmtilesMetadata, options, loadOptions) {\n // Ironically, to use the TileJSON loader we need to stringify the metadata again.\n // This is the price of integrating with the existing pmtiles library.\n // TODO - provide a non-standard TileJSONLoader parsers that accepts a JSON object?\n let tilejson = null;\n if (pmtilesMetadata) {\n try {\n const string = JSON.stringify(pmtilesMetadata);\n tilejson = TileJSONLoader.parseTextSync?.(string, loadOptions) || null;\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.warn('PMTiles metadata could not be interpreted as TileJSON', error);\n }\n }\n const partialMetadata = {};\n if (typeof tilejson?.name === 'string') {\n partialMetadata.name = tilejson.name;\n }\n if (typeof tilejson?.htmlAttribution === 'string') {\n partialMetadata.attributions = [tilejson.htmlAttribution];\n }\n const metadata = {\n ...partialMetadata,\n format: 'pmtiles',\n formatVersion: header.specVersion,\n attributions: [],\n tileMIMEType: decodeTileType(header.tileType),\n minZoom: header.minZoom,\n maxZoom: header.maxZoom,\n boundingBox: [\n [header.minLon, header.minLat],\n [header.maxLon, header.maxLat]\n ],\n center: [header.centerLon, header.centerLat],\n centerZoom: header.centerZoom,\n etag: header.etag\n };\n if (tilejson) {\n metadata.tilejson = tilejson;\n }\n // Application can optionally include the raw header and metadata.\n if (options?.includeFormatHeader) {\n metadata.formatHeader = header;\n metadata.formatMetadata = metadata;\n }\n return metadata;\n}\n/** Extract a MIME type for tiles from vector tile header */\nfunction decodeTileType(tileType) {\n switch (tileType) {\n case TileType.Mvt:\n return 'application/vnd.mapbox-vector-tile';\n case TileType.Png:\n return 'image/png';\n case TileType.Jpeg:\n return 'image/jpeg';\n case TileType.Webp:\n return 'image/webp';\n case TileType.Avif:\n return 'image/avif';\n default:\n return 'application/octet-stream';\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * A PMTiles library compatible source that reads from blobs\n * @deprecated TODO - reimplement as ReadableFileSource\n * Use loaders.gl HTTP range requests instead\n */\nexport class BlobSource {\n blob;\n key;\n constructor(blob, key) {\n this.blob = blob;\n this.key = key;\n }\n // TODO - how is this used?\n getKey() {\n // @ts-expect-error url is only defined on File subclass\n return this.blob.url || '';\n }\n async getBytes(offset, length, signal) {\n const slice = this.blob.slice(offset, offset + length);\n const data = await slice.arrayBuffer();\n return {\n data\n // etag: response.headers.get('ETag') || undefined,\n // cacheControl: response.headers.get('Cache-Control') || undefined,\n // expires: response.headers.get('Expires') || undefined\n };\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { BlobFile } from '@loaders.gl/loader-utils';\nimport { VERSION } from \"./lib/version.js\";\nimport { PMTilesTileSource } from \"./pmtiles-source.js\";\nimport { PMTilesFormat } from \"./pmtiles-format.js\";\n/**\n * Loader for PMTiles metadata\n * @note This loader is intended to allow PMTiles to be treated like other file types in top-level loading logic.\n * @note For actual access to the tile data, use the PMTilesSource class.\n */\nexport const PMTilesLoader = {\n ...PMTilesFormat,\n version: VERSION,\n options: {\n pmtiles: {}\n },\n parse: async (arrayBuffer, options) => parseFileAsPMTiles(new BlobFile(new Blob([arrayBuffer])), options),\n parseFile: parseFileAsPMTiles\n};\nasync function parseFileAsPMTiles(file, options) {\n const source = new PMTilesTileSource(file.handle, {\n pmtiles: options?.pmtiles || {}\n });\n const formatSpecificMetadata = await source.getMetadata();\n const { tileMIMEType, tilejson = {} } = formatSpecificMetadata;\n const { layers = [] } = tilejson;\n switch (tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return {\n shape: 'vector-source',\n layers: layers.map((layer) => ({ name: layer.name, schema: layer.schema })),\n tables: [],\n formatSpecificMetadata\n };\n case 'image/png':\n case 'image/jpeg':\n return { shape: 'image-source', formatSpecificMetadata };\n default:\n throw new Error(`PMTilesLoader: Unsupported tile MIME type ${tileMIMEType}`);\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.4.0-alpha.0\" !== 'undefined' ? \"4.4.0-alpha.0\" : 'latest';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,0BAAwC;AACxC,oBAA4B;AAC5B,IAAAA,cAA0B;;;ACCnB,IAAM,gBAAgB;AAAA,EACzB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,YAAY,CAAC,SAAS;AAAA,EACtB,WAAW,CAAC,0BAA0B;AAAA,EACtC,OAAO,CAAC,SAAS;AACrB;;;ADNA,IAAAC,WAAyB;;;AEJzB,iBAA+B;AAE/B,cAAyB;AACzB,IAAM,EAAE,SAAS,IAAI;AASd,SAAS,mBAAmB,QAAQ,iBAAiB,SAAS,aAAa;AAflF;AAmBI,MAAI,WAAW;AACf,MAAI,iBAAiB;AACjB,QAAI;AACA,YAAM,SAAS,KAAK,UAAU,eAAe;AAC7C,mBAAW,sCAAe,kBAAf,4BAA+B,QAAQ,iBAAgB;AAAA,IACtE,SACO,OAAP;AAEI,cAAQ,KAAK,yDAAyD,KAAK;AAAA,IAC/E;AAAA,EACJ;AACA,QAAM,kBAAkB,CAAC;AACzB,MAAI,QAAO,qCAAU,UAAS,UAAU;AACpC,oBAAgB,OAAO,SAAS;AAAA,EACpC;AACA,MAAI,QAAO,qCAAU,qBAAoB,UAAU;AAC/C,oBAAgB,eAAe,CAAC,SAAS,eAAe;AAAA,EAC5D;AACA,QAAM,WAAW;AAAA,IACb,GAAG;AAAA,IACH,QAAQ;AAAA,IACR,eAAe,OAAO;AAAA,IACtB,cAAc,CAAC;AAAA,IACf,cAAc,eAAe,OAAO,QAAQ;AAAA,IAC5C,SAAS,OAAO;AAAA,IAChB,SAAS,OAAO;AAAA,IAChB,aAAa;AAAA,MACT,CAAC,OAAO,QAAQ,OAAO,MAAM;AAAA,MAC7B,CAAC,OAAO,QAAQ,OAAO,MAAM;AAAA,IACjC;AAAA,IACA,QAAQ,CAAC,OAAO,WAAW,OAAO,SAAS;AAAA,IAC3C,YAAY,OAAO;AAAA,IACnB,MAAM,OAAO;AAAA,EACjB;AACA,MAAI,UAAU;AACV,aAAS,WAAW;AAAA,EACxB;AAEA,MAAI,mCAAS,qBAAqB;AAC9B,aAAS,eAAe;AACxB,aAAS,iBAAiB;AAAA,EAC9B;AACA,SAAO;AACX;AAEA,SAAS,eAAe,UAAU;AAC9B,UAAQ,UAAU;AAAA,IACd,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EACf;AACJ;;;ACvEO,IAAM,aAAN,MAAiB;AAAA,EACpB;AAAA,EACA;AAAA,EACA,YAAY,MAAM,KAAK;AACnB,SAAK,OAAO;AACZ,SAAK,MAAM;AAAA,EACf;AAAA;AAAA,EAEA,SAAS;AAEL,WAAO,KAAK,KAAK,OAAO;AAAA,EAC5B;AAAA,EACA,MAAM,SAAS,QAAQ,QAAQ,QAAQ;AACnC,UAAM,QAAQ,KAAK,KAAK,MAAM,QAAQ,SAAS,MAAM;AACrD,UAAM,OAAO,MAAM,MAAM,YAAY;AACrC,WAAO;AAAA,MACH;AAAA;AAAA;AAAA;AAAA,IAIJ;AAAA,EACJ;AACJ;;;AHtBA,IAAM,EAAE,QAAQ,IAAIC;AAGpB,IAAM,UAAU;AAIT,IAAM,gBAAgB;AAAA,EACzB,GAAG;AAAA,EACH,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AAAA,EACV,gBAAgB;AAAA,IACZ,SAAS,CAAC;AAAA,EACd;AAAA,EACA,SAAS,CAAC,QAAQ,IAAI,SAAS,UAAU;AAAA,EACzC,kBAAkB,CAAC,KAAK,YAAY,IAAI,kBAAkB,KAAK,OAAO;AAC1E;AAKO,IAAM,oBAAN,cAAgC,+BAAW;AAAA,EAC9C,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,YAAY,MAAM,SAAS;AACvB,UAAM,MAAM,SAAS,cAAc,cAAc;AACjD,UAAM,YAAY,OAAO,SAAS,eAAW,iCAAY,IAAI,IAAI,IAAI,WAAW,MAAM,SAAS;AAC/F,SAAK,UAAU,IAAI,QAAQ,SAAS;AACpC,SAAK,cAAc,KAAK,YAAY,KAAK,IAAI;AAC7C,SAAK,WAAW,KAAK,YAAY;AAAA,EACrC;AAAA,EACA,MAAM,YAAY;AACd,WAAO,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,EAAE;AAAA,EACtC;AAAA,EACA,MAAM,cAAc;AA7CxB;AA8CQ,UAAM,gBAAgB,MAAM,KAAK,QAAQ,UAAU;AACnD,UAAM,kBAAmB,MAAM,KAAK,QAAQ,YAAY,KAAM,CAAC;AAC/D,UAAM,WAAW,mBAAmB,eAAe,iBAAiB,EAAE,qBAAqB,MAAM,GAAG,KAAK,WAAW;AAEpH,QAAI,KAAK,QAAQ,cAAc;AAC3B,eAAS,eAAe;AAAA,QACpB,KAAI,UAAK,QAAQ,SAAb,mBAAmB,iBAAgB,CAAC;AAAA,QACxC,GAAI,SAAS,gBAAgB,CAAC;AAAA,MAClC;AAAA,IACJ;AACA,QAAI,qCAAU,cAAc;AACxB,WAAK,WAAW,qCAAU;AAAA,IAC9B;AAEA,WAAO;AAAA,EACX;AAAA,EACA,MAAM,QAAQ,YAAY;AACtB,UAAM,EAAE,GAAG,GAAG,EAAE,IAAI;AACpB,UAAM,gBAAgB,MAAM,KAAK,QAAQ,OAAO,GAAG,GAAG,CAAC;AACvD,UAAM,cAAc,+CAAe;AACnC,QAAI,CAAC,aAAa;AAEd,aAAO;AAAA,IACX;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA,EAGA,MAAM,YAAY,YAAY;AAC1B,UAAM,EAAE,GAAG,GAAG,EAAE,IAAI,WAAW;AAC/B,UAAM,WAAW,MAAM,KAAK;AAC5B,YAAQ,SAAS,cAAc;AAAA,MAC3B,KAAK;AACD,eAAO,MAAM,KAAK,cAAc,EAAE,GAAG,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC;AAAA,MAC3D;AACI,eAAO,MAAM,KAAK,aAAa,EAAE,GAAG,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC;AAAA,IAC9D;AAAA,EACJ;AAAA;AAAA,EAEA,MAAM,aAAa,YAAY;AAC3B,UAAM,cAAc,MAAM,KAAK,QAAQ,UAAU;AACjD,WAAO,cAAc,MAAM,0BAAY,MAAM,aAAa,KAAK,WAAW,IAAI;AAAA,EAClF;AAAA;AAAA,EAEA,MAAM,cAAc,YAAY;AA1FpC;AA2FQ,UAAM,cAAc,MAAM,KAAK,QAAQ,UAAU;AACjD,UAAM,cAAc;AAAA,MAChB,OAAO;AAAA,MACP,KAAK;AAAA,QACD,aAAa;AAAA,QACb,WAAW,EAAE,GAAG,WAAW,GAAG,GAAG,WAAW,GAAG,GAAG,WAAW,EAAE;AAAA,QAC/D,IAAG,UAAK,gBAAL,mBAAkB;AAAA,MACzB;AAAA,MACA,GAAG,KAAK;AAAA,IACZ;AACA,WAAO,cAAc,MAAM,sBAAU,MAAM,aAAa,WAAW,IAAI;AAAA,EAC3E;AACJ;;;AIpGA,IAAAC,uBAAyB;;;ACGlB,IAAMC,WAAU,OAAyC,kBAAkB;;;ADM3E,IAAM,gBAAgB;AAAA,EACzB,GAAG;AAAA,EACH,SAASC;AAAA,EACT,SAAS;AAAA,IACL,SAAS,CAAC;AAAA,EACd;AAAA,EACA,OAAO,OAAO,aAAa,YAAY,mBAAmB,IAAI,8BAAS,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,OAAO;AAAA,EACxG,WAAW;AACf;AACA,eAAe,mBAAmB,MAAM,SAAS;AAC7C,QAAM,SAAS,IAAI,kBAAkB,KAAK,QAAQ;AAAA,IAC9C,UAAS,mCAAS,YAAW,CAAC;AAAA,EAClC,CAAC;AACD,QAAM,yBAAyB,MAAM,OAAO,YAAY;AACxD,QAAM,EAAE,cAAc,WAAW,CAAC,EAAE,IAAI;AACxC,QAAM,EAAE,SAAS,CAAC,EAAE,IAAI;AACxB,UAAQ,cAAc;AAAA,IAClB,KAAK;AACD,aAAO;AAAA,QACH,OAAO;AAAA,QACP,QAAQ,OAAO,IAAI,CAAC,WAAW,EAAE,MAAM,MAAM,MAAM,QAAQ,MAAM,OAAO,EAAE;AAAA,QAC1E,QAAQ,CAAC;AAAA,QACT;AAAA,MACJ;AAAA,IACJ,KAAK;AAAA,IACL,KAAK;AACD,aAAO,EAAE,OAAO,gBAAgB,uBAAuB;AAAA,IAC3D;AACI,YAAM,IAAI,MAAM,6CAA6C,cAAc;AAAA,EACnF;AACJ;",
|
|
6
6
|
"names": ["import_mvt", "pmtiles", "pmtiles", "import_loader_utils", "VERSION", "VERSION"]
|
|
7
7
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { PMTilesSource } from "./pmtiles-source.js";
|
|
2
2
|
export type { PMTilesMetadata } from "./lib/parse-pmtiles.js";
|
|
3
|
-
export type {
|
|
3
|
+
export type { PMTilesSourceOptions } from "./pmtiles-source.js";
|
|
4
4
|
export { PMTilesTileSource } from "./pmtiles-source.js";
|
|
5
5
|
export { PMTilesLoader as _PMTilesLoader } from "./pmtiles-loader.js";
|
|
6
6
|
export type { PMTilesLoaderOptions } from "./pmtiles-loader.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAE/C,YAAY,EAAC,eAAe,EAAC,+BAA4B;AACzD,YAAY,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAE/C,YAAY,EAAC,eAAe,EAAC,+BAA4B;AACzD,YAAY,EAAC,oBAAoB,EAAC,4BAAyB;AAC3D,OAAO,EAAC,iBAAiB,EAAC,4BAAyB;AAEnD,OAAO,EAAC,aAAa,IAAI,cAAc,EAAC,4BAAyB;AACjE,YAAY,EAAC,oBAAoB,EAAC,4BAAyB"}
|
package/dist/lib/version.js
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
export const VERSION = typeof "4.
|
|
7
|
+
export const VERSION = typeof "4.4.0-alpha.0" !== 'undefined' ? "4.4.0-alpha.0" : 'latest';
|