@loaders.gl/pmtiles 4.2.1 → 4.3.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 +1126 -689
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +2 -2
- package/dist/pmtiles-source.js +4 -4
- package/package.json +6 -6
- package/src/pmtiles-source.ts +4 -4
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 nr=Object.create;var Fe=Object.defineProperty;var rr=Object.getOwnPropertyDescriptor;var ir=Object.getOwnPropertyNames;var or=Object.getPrototypeOf,sr=Object.prototype.hasOwnProperty;var Je=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Mt=(e,t)=>{for(var n in t)Fe(e,n,{get:t[n],enumerable:!0})},Pe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ir(t))!sr.call(e,i)&&i!==n&&Fe(e,i,{get:()=>t[i],enumerable:!(r=rr(t,i))||r.enumerable});return e},Ie=(e,t,n)=>(Pe(e,t,"default"),n&&Pe(n,t,"default")),Ut=(e,t,n)=>(n=e!=null?nr(or(e)):{},Pe(t||!e||!e.__esModule?Fe(n,"default",{value:e,enumerable:!0}):n,e)),ar=e=>Pe(Fe({},"__esModule",{value:!0}),e);var kt=Je((Ro,Lt)=>{Lt.exports=globalThis.loaders});var tn=Je(lt=>{lt.read=function(e,t,n,r,i){var o,s,a=i*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,u=n?i-1:0,h=n?-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+=r;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,r),o=o-c}return(d?-1:1)*s*Math.pow(2,o-r)};lt.write=function(e,t,n,r,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=r?0:o-1,p=r?1:-1,m=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[n+d]=a&255,d+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+d]=s&255,d+=p,s/=256,c-=8);e[n+d-p]|=m*128}});var ln=Je((Ta,an)=>{"use strict";an.exports=x;var Be=tn();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 ct=(1<<16)*(1<<16),nn=1/ct,pi=12,sn=typeof TextDecoder>"u"?null:new TextDecoder("utf8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=r&7,e(i,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ee(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=on(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ee(this.buf,this.pos)+Ee(this.buf,this.pos+4)*ct;return this.pos+=8,e},readSFixed64:function(){var e=Ee(this.buf,this.pos)+on(this.buf,this.pos+4)*ct;return this.pos+=8,e},readFloat:function(){var e=Be.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Be.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,gi(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=pi&&sn?Ai(this.buf,t,e):bi(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==x.Bytes)return e.push(this.readVarint(t));var n=z(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=z(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=z(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=z(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=z(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=z(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=z(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=z(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=z(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===x.Varint)for(;this.buf[this.pos++]>127;);else if(t===x.Bytes)this.pos=this.readVarint()+this.pos;else if(t===x.Fixed32)this.pos+=4;else if(t===x.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),Y(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Y(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Y(this.buf,e&-1,this.pos),Y(this.buf,Math.floor(e*nn),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Y(this.buf,e&-1,this.pos),Y(this.buf,Math.floor(e*nn),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){yi(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=Bi(this.buf,e,this.pos);var n=this.pos-t;n>=128&&rn(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Be.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Be.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&rn(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,x.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,wi,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,vi,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Ii,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Pi,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Fi,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Ti,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Si,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Di,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Vi,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 gi(e,t,n){var r=n.buf,i,o;if(o=r[n.pos++],i=(o&112)>>4,o<128||(o=r[n.pos++],i|=(o&127)<<3,o<128)||(o=r[n.pos++],i|=(o&127)<<10,o<128)||(o=r[n.pos++],i|=(o&127)<<17,o<128)||(o=r[n.pos++],i|=(o&127)<<24,o<128)||(o=r[n.pos++],i|=(o&1)<<31,o<128))return X(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function z(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function X(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function yi(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),mi(n,r,t),xi(r,t)}function mi(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function xi(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function rn(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var i=n.pos-1;i>=e;i--)n.buf[i+r]=n.buf[i]}function wi(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function vi(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function Pi(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function Fi(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function Ii(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function Ti(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function Si(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function Di(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function Vi(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Ee(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Y(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function on(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function bi(e,t,n){for(var r="",i=t;i<n;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a>n)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,r+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),r+=String.fromCharCode(s),i+=a}return r}function Ai(e,t,n){return sn.decode(e.subarray(t,n))}function Bi(e,t,n){for(var r=0,i,o;r<t.length;r++){if(i=t.charCodeAt(r),i>55295&&i<57344)if(o)if(i<56320){e[n++]=239,e[n++]=191,e[n++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):o=i;continue}else o&&(e[n++]=239,e[n++]=191,e[n++]=189,o=null);i<128?e[n++]=i:(i<2048?e[n++]=i>>6|192:(i<65536?e[n++]=i>>12|224:(e[n++]=i>>18|240,e[n++]=i>>12&63|128),e[n++]=i>>6&63|128),e[n++]=i&63|128)}return n}});var we={};Mt(we,{PMTilesSource:()=>Ze});Ie(we,Ut(kt(),1));function re(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var O={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},lr=O.self||O.window||O.global||{},cr=O.window||O.self||O.global||{},fr=O.global||O.self||O.window||{},ur=O.document||{};var We=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Ct=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),hr=Ct&&parseFloat(Ct[1])||0;function R(e){return R=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(e)}function $e(e,t){if(R(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(R(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ke(e){var t=$e(e,"string");return R(t)==="symbol"?t:String(t)}function B(e,t,n){return t=Ke(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var dr="",Ot={};function Xe(e){for(let t in Ot)if(e.startsWith(t)){let n=Ot[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${dr}${e}`),e}var ie=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=pr(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function pr(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,i)=>t(r,i);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var Nt="4.2.0";var gr=globalThis.loaders?.parseImageNode,Ye=typeof Image<"u",Qe=typeof ImageBitmap<"u",yr=Boolean(gr),qe=We?!0:yr;function zt(e){switch(e){case"auto":return Qe||Ye||qe;case"imagebitmap":return Qe;case"image":return Ye;case"data":return qe;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Zt(){if(Qe)return"imagebitmap";if(Ye)return"image";if(qe)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function mr(e){let t=xr(e);if(!t)throw new Error("Not an image");return t}function Rt(e){switch(mr(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function xr(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 wr=/^data:image\/svg\+xml/,vr=/\.svg((\?|#).*)?$/;function Te(e){return e&&(wr.test(e)||vr.test(e))}function jt(e,t){if(Te(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return et(e,t)}function et(e,t){if(Te(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Se(e,t,n){let r=jt(e,n),i=self.URL||self.webkitURL,o=typeof r!="string"&&i.createObjectURL(r);try{return await Pr(o||r,t)}finally{o&&i.revokeObjectURL(o)}}async function Pr(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,i)=>{try{n.onload=()=>r(n),n.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var Fr={},Gt=!0;async function Ht(e,t,n){let r;Te(n)?r=await Se(e,t,n):r=et(e,n);let i=t&&t.imagebitmap;return await Ir(r,i)}async function Ir(e,t=null){if((Tr(t)||!Gt)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),Gt=!1}return await createImageBitmap(e)}function Tr(e){for(let t in e||Fr)return!1;return!0}function Jt(e){return!br(e,"ftyp",4)||!(e[8]&96)?null:Sr(e)}function Sr(e){switch(Dr(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Dr(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Vr(e){return[...e].map(t=>t.charCodeAt(0))}function br(e,t,n=0){let r=Vr(t);for(let i=0;i<r.length;++i)if(r[i]!==e[i+n])return!1;return!0}var N=!1,oe=!0;function De(e){let t=se(e);return Br(t)||Mr(t)||Er(t)||_r(t)||Ar(t)}function Ar(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=Jt(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function Br(e){let t=se(e);return t.byteLength>=24&&t.getUint32(0,N)===2303741511?{mimeType:"image/png",width:t.getUint32(16,N),height:t.getUint32(20,N)}:null}function Er(e){let t=se(e);return t.byteLength>=10&&t.getUint32(0,N)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,oe),height:t.getUint16(8,oe)}:null}function _r(e){let t=se(e);return t.byteLength>=14&&t.getUint16(0,N)===16973&&t.getUint32(2,oe)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,oe),height:t.getUint32(22,oe)}:null}function Mr(e){let t=se(e);if(!(t.byteLength>=3&&t.getUint16(0,N)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:i}=Ur(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,N);if(i.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,N),width:t.getUint16(o+7,N)};if(!r.has(s))return null;o+=2,o+=t.getUint16(o,N)}return null}function Ur(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function se(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 Wt(e,t){let{mimeType:n}=De(e)||{},r=globalThis.loaders?.parseImageNode;return re(r),await r(e,n)}async function $t(e,t,n){t=t||{};let i=(t.image||{}).type||"auto",{url:o}=n||{},s=Lr(i),a;switch(s){case"imagebitmap":a=await Ht(e,t,o);break;case"image":a=await Se(e,t,o);break;case"data":a=await Wt(e,t);break;default:re(!1)}return i==="data"&&(a=Rt(a)),a}function Lr(e){switch(e){case"auto":case"data":return Zt();default:return zt(e),e}}var kr=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Cr=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Or={image:{type:"auto",decode:!0}},tt={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Nt,mimeTypes:Cr,extensions:kr,parse:$t,tests:[e=>Boolean(De(new DataView(e)))],options:Or};var ae={x:0,y:1,z:2};function j(e,t={}){let{start:n=0,end:r=e.length,plane:i="xy"}=t,o=t.size||2,s=0,a=ae[i[0]],l=ae[i[1]];for(let c=n,f=r-o;c<r;c+=o)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function rt(e,t,n=2,r,i="xy"){let o=t&&t.length,s=o?t[0]*n:e.length,a=Xt(e,0,s,n,!0,r&&r[0],i),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,d,p,m;if(o&&(a=Hr(e,t,a,n,r,i)),e.length>80*n){h=f=e[0],d=u=e[1];for(let F=n;F<s;F+=n)p=e[F],m=e[F+1],p<h&&(h=p),m<d&&(d=m),p>f&&(f=p),m>u&&(u=m);c=Math.max(f-h,u-d),c=c!==0?32767/c:0}return le(a,l,n,h,d,c,0),l}function Xt(e,t,n,r,i,o,s){let a,l;o===void 0&&(o=j(e,{start:t,end:n,size:r,plane:s}));let c=ae[s[0]],f=ae[s[1]];if(i===o<0)for(a=t;a<n;a+=r)l=Kt(a,e[a+c],e[a+f],l);else for(a=n-r;a>=t;a-=r)l=Kt(a,e[a+c],e[a+f],l);return l&&Ae(l,l.next)&&(fe(l),l=l.next),l}function G(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Ae(n,n.next)||P(n.prev,n,n.next)===0)){if(fe(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function le(e,t,n,r,i,o,s){if(!e)return;!s&&o&&Xr(e,r,i,o);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,o?Rr(e,r,i,o):Zr(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(c.i/n|0),fe(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=jr(G(e),t,n),le(e,t,n,r,i,o,2)):s===2&&Gr(e,t,n,r,i,o):le(G(e),t,n,r,i,o,1);break}}}function Zr(e){let t=e.prev,n=e,r=e.next;if(P(t,n,r)>=0)return!1;let i=t.x,o=n.x,s=r.x,a=t.y,l=n.y,c=r.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=r.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&K(i,a,o,l,s,c,p.x,p.y)&&P(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Rr(e,t,n,r){let i=e.prev,o=e,s=e.next;if(P(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,m=a>l?a>c?a:c:l>c?l:c,F=f>u?f>h?f:h:u>h?u:h,_=nt(d,p,t,n,r),v=nt(m,F,t,n,r),y=e.prevZ,g=e.nextZ;for(;y&&y.z>=_&&g&&g.z<=v;){if(y.x>=d&&y.x<=m&&y.y>=p&&y.y<=F&&y!==i&&y!==s&&K(a,f,l,u,c,h,y.x,y.y)&&P(y.prev,y,y.next)>=0||(y=y.prevZ,g.x>=d&&g.x<=m&&g.y>=p&&g.y<=F&&g!==i&&g!==s&&K(a,f,l,u,c,h,g.x,g.y)&&P(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;y&&y.z>=_;){if(y.x>=d&&y.x<=m&&y.y>=p&&y.y<=F&&y!==i&&y!==s&&K(a,f,l,u,c,h,y.x,y.y)&&P(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;g&&g.z<=v;){if(g.x>=d&&g.x<=m&&g.y>=p&&g.y<=F&&g!==i&&g!==s&&K(a,f,l,u,c,h,g.x,g.y)&&P(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function jr(e,t,n){let r=e;do{let i=r.prev,o=r.next.next;!Ae(i,o)&&Yt(i,r,r.next,o)&&ce(i,o)&&ce(o,i)&&(t.push(i.i/n|0),t.push(r.i/n|0),t.push(o.i/n|0),fe(r),fe(r.next),r=e=o),r=r.next}while(r!==e);return G(r)}function Gr(e,t,n,r,i,o){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&qr(s,a)){let l=Qt(s,a);s=G(s,s.next),l=G(l,l.next),le(s,t,n,r,i,o,0),le(l,t,n,r,i,o,0);return}a=a.next}s=s.next}while(s!==e)}function Hr(e,t,n,r,i,o){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*r,f=a<l-1?t[a+1]*r:e.length,u=Xt(e,c,f,r,!1,i&&i[a+1],o),u===u.next&&(u.steiner=!0),s.push(Qr(u));for(s.sort(Jr),a=0;a<s.length;a++)n=Wr(s[a],n);return n}function Jr(e,t){return e.x-t.x}function Wr(e,t){let n=$r(e,t);if(!n)return t;let r=Qt(n,e);return G(r,r.next),G(n,n.next)}function $r(e,t){let n=t,r=e.x,i=e.y,o=-1/0,s;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let h=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>o&&(o=h,s=n.x<n.next.x?n:n.next,h===r))return s}n=n.next}while(n!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;n=s;do r>=n.x&&n.x>=l&&r!==n.x&&K(i<c?r:o,i,l,c,i<c?o:r,i,n.x,n.y)&&(u=Math.abs(i-n.y)/(r-n.x),ce(n,e)&&(u<f||u===f&&(n.x>s.x||n.x===s.x&&Kr(s,n)))&&(s=n,f=u)),n=n.next;while(n!==a);return s}function Kr(e,t){return P(e.prev,e,t.prev)<0&&P(t.next,e,e.next)<0}function Xr(e,t,n,r){let i=e;do i.z===0&&(i.z=nt(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Yr(i)}function Yr(e){let t,n,r=1,i,o,s,a,l,c;do{for(o=e,e=null,c=null,i=0;o;){for(i++,a=o,s=0,n=0;n<r&&(s++,a=a.nextZ,!!a);n++);for(l=r;s>0||l>0&&a;)s!==0&&(l===0||!a||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,r*=2}while(i>1);return e}function nt(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*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 Qr(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function K(e,t,n,r,i,o,s,a){return(i-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(r-a)>=(n-s)*(t-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function qr(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ei(e,t)&&(ce(e,t)&&ce(t,e)&&ti(e,t)&&(P(e.prev,e,t.prev)||P(e,t.prev,t))||Ae(e,t)&&P(e.prev,e,e.next)>0&&P(t.prev,t,t.next)>0)}function P(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ae(e,t){return e.x===t.x&&e.y===t.y}function Yt(e,t,n,r){let i=be(P(e,t,n)),o=be(P(e,t,r)),s=be(P(n,r,e)),a=be(P(n,r,t));return!!(i!==o&&s!==a||i===0&&Ve(e,n,t)||o===0&&Ve(e,r,t)||s===0&&Ve(n,e,r)||a===0&&Ve(n,t,r))}function Ve(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function be(e){return e>0?1:e<0?-1:0}function ei(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Yt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function ce(e,t){return P(e.prev,e,e.next)<0?P(e,t,e.next)>=0&&P(e,e.prev,t)>=0:P(e,t,e.prev)<0||P(e,e.next,t)<0}function ti(e,t){let n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Qt(e,t){let n=new ue(e.i,e.x,e.y),r=new ue(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Kt(e,t,n,r){let i=new ue(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function fe(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 ue=class{constructor(t,n,r){B(this,"i",void 0),B(this,"x",void 0),B(this,"y",void 0),B(this,"prev",null),B(this,"next",null),B(this,"z",0),B(this,"prevZ",null),B(this,"nextZ",null),B(this,"steiner",!1),this.i=t,this.x=n,this.y=r}};function st(e,t,n){let r=si(e),i=Object.keys(r).filter(o=>r[o]!==Array);return ai(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||i,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function si(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let i=n.properties[r];t[r]=di(i,t[r])}return t}function ai(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:i,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:m=Float32Array,triangulate:F=!0}=n,_=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,y={type:"Point",positions:new m(r*d),globalFeatureIds:new v(r),featureIds:i>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new m(o*d),globalFeatureIds:new v(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},V={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 m(l*d),globalFeatureIds:new v(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};F&&(V.triangles=[]);for(let M of[y,g,V])for(let T of p){let b=h[T];M.numericProps[T]=new b(M.positions.length/d)}g.pathIndices[s]=o,V.polygonIndices[c]=l,V.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 T=M.geometry,b=M.properties||{};switch(T.type){case"Point":li(T,y,C,d,b),y.properties.push(ot(b,p)),_&&y.fields.push({id:M.id}),C.pointFeature++;break;case"LineString":ci(T,g,C,d,b),g.properties.push(ot(b,p)),_&&g.fields.push({id:M.id}),C.lineFeature++;break;case"Polygon":fi(T,V,C,d,b),V.properties.push(ot(b,p)),_&&V.fields.push({id:M.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return hi(y,g,V,d)}function li(e,t,n,r,i){t.positions.set(e.data,n.pointPosition*r);let o=e.data.length/r;at(t,i,n.pointPosition,o),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+o),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+o),n.pointPosition+=o}function ci(e,t,n,r,i){t.positions.set(e.data,n.linePosition*r);let o=e.data.length/r;at(t,i,n.linePosition,o),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+o),t.featureIds.fill(n.lineFeature,n.linePosition,n.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[n.linePath++]=n.linePosition,n.linePosition+=(c-l)/r}}function fi(e,t,n,r,i){t.positions.set(e.data,n.polygonPosition*r);let o=e.data.length/r;at(t,i,n.polygonPosition,o),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+o),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=n.polygonPosition;t.polygonIndices[n.polygonObject++]=l;let c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let d=0,p=f.length;d<p;++d){let m=f[d],F=d===p-1?u===void 0?e.data.length:u[0]:f[d+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(F-m)/r}let h=n.polygonPosition;ui(t,c,f,{startPosition:l,endPosition:h,coordLength:r})}}function ui(e,t,n,{startPosition:r,endPosition:i,coordLength:o}){if(!e.triangles)return;let s=r*o,a=i*o,l=e.positions.subarray(s,a),c=n[0],f=n.slice(1).map(h=>(h-c)/o),u=rt(l,f,o,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(r+u[h])}function it(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function hi(e,t,n,r){let i={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:it(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:it(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:it(n.numericProps,1)}};return i.polygons&&n.triangles&&(i.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),i}function at(e,t,n,r){for(let i in e.numericProps)if(i in t){let o=t[i];e.numericProps[i].fill(o,n,n+r)}}function ot(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function di(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var pt=Ut(ln(),1);function cn(e){let t=e.length;if(t<=1)return[e];let n=[],r,i;for(let o=0;o<t;o++){let s=Ei(e[o]);s!==0&&(i===void 0&&(i=s<0),i===s<0?(r&&n.push(r),r=[e[o]]):r&&r.push(e[o]))}return r&&n.push(r),n}function Ei(e){let t=0;for(let n=0,r=e.length-1,i,o;n<e.length;r=n++)i=e[n],o=e[r],t+=(o[0]-i[0])*(i[1]+o[1]);return t}function fn(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?_i(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function _i(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[r]=i}}var Q=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,n,r,i,o){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=i,this._values=o,t.readFields(fn,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=[],l;for(;t.pos<n;){if(i<=0){let c=t.readVarint();r=c&7,i=c>>3}if(i--,r===1||r===2)o+=t.readSVarint(),s+=t.readSVarint(),r===1&&(l&&a.push(l),l=[]),l&&l.push([o,s]);else if(r===7)l&&l.push(l[0].slice());else throw new Error(`unknown command ${r}`)}return l&&a.push(l),a}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<n;){if(i<=0){let u=t.readVarint();r=u&7,i=u>>3}if(i--,r===1||r===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(r!==7)throw new Error(`unknown command ${r}`)}return[a,c,l,f]}_toGeoJSON(t){let n=this.loadGeometry(),r=Q.types[this.type],i,o;switch(this.type){case 1:let a=[];for(i=0;i<n.length;i++)a[i]=n[i][0];n=a,t(n,this);break;case 2:for(i=0;i<n.length;i++)t(n[i],this);break;case 3:for(n=cn(n),i=0;i<n.length;i++)for(o=0;o<n[i].length;o++)t(n[i][o],this);break}n.length===1?n=n[0]:r=`Multi${r}`;let s={type:"Feature",geometry:{type:r,coordinates:n},properties:this.properties};return this.id!==null&&(s.id=this.id),s}toGeoJSON(t){if(typeof t=="function")return this._toGeoJSON(t);let{x:n,y:r,z:i}=t,o=this.extent*Math.pow(2,i),s=this.extent*n,a=this.extent*r;function l(c){for(let f=0;f<c.length;f++){let u=c[f];u[0]=(u[0]+s)*360/o-180;let h=180-(u[1]+a)*360/o;u[1]=360/Math.PI*Math.atan(Math.exp(h*Math.PI/180))-90}}return this._toGeoJSON(l)}};var _e=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Mi,this,n),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new Q(this._pbf,n,this.extent,this._keys,this._values)}};function Mi(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(Ui(n)))}function Ui(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var Me=class{layers;constructor(t,n){this.layers=t.readFields(Li,{},n)}};function Li(e,t,n){if(e===3&&n){let r=new _e(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function un(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[j(e.data)]],indices:[e.indices]};let r=[],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=j(h);if(d===0){let p=e.data.slice(0,u),m=e.data.slice(c);e.data=p.concat(m),l+=c-u;continue}a===void 0&&(a=d<0),a===d<0?(s.length&&(r.push(o),i.push(s)),s=[u],o=[d]):(o.push(d),s.push(u))}return o&&r.push(o),s.length&&i.push(s),{type:n,areas:r,indices:i,data:e.data}}function hn(e,t,n,r){for(let i=0,o=e.length;i<o;i+=2){e[i]=(e[i]+t)*360/r-180;let s=180-(e[i+1]+n)*360/r;e[i+1]=360/Math.PI*Math.atan(Math.exp(s*Math.PI/180))-90}}function dn(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?ki(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function ki(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[r]=i}}var pn,H,ft,Ue,ut,ht,he;var Le=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,i,o,s){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=i,this._values=o,this._geometryInfo=s,t.readFields(dn,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,pn=t.readVarint()+t.pos,H=1,Ue=0,ut=0,ht=0,he=0;let n=[],r=[];for(;t.pos<pn;)if(Ue<=0&&(ft=t.readVarint(),H=ft&7,Ue=ft>>3),Ue--,H===1||H===2)ut+=t.readSVarint(),ht+=t.readSVarint(),H===1&&n.push(he),r.push(ut,ht),he+=2;else if(H===7){if(he>0){let i=n[n.length-1];r.push(r[i],r[i+1]),he+=2}}else throw new Error(`unknown command ${H}`);return{data:r,indices:n}}_toBinaryCoordinates(t){let n=this.loadGeometry(),r;t(n.data,this);let i=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,r={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/i,r={type:"LineString",...n};break;case 3:r=un(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let s of r.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=r.data.length/i;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(o.id=this.id),o}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let{x:n,y:r,z:i}=t,o=this.extent*Math.pow(2,i),s=this.extent*n,a=this.extent*r;return this._toBinaryCoordinates(l=>hn(l,s,a,o))}};var ke=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Ci,this,n),this.length=this._features.length}feature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new Le(this._pbf,r,this.extent,this._keys,this._values,n)}};function Ci(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(Oi(n)))}function Oi(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var Ce=class{layers;constructor(t,n){this.layers=t.readFields(Ni,{},n)}};function Ni(e,t,n){if(e===3&&n){let r=new ke(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function gt(e,t){let n=Zi(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:dt(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:gn(e,n)};case"geojson":return gn(e,n);case"binary-geometry":return dt(e,n);case"binary":return dt(e,n);default:throw new Error(r||"undefined shape")}}function dt(e,t){let[n,r]=zi(e,t),i=st(n,r);return i.byteLength=e.byteLength,i}function zi(e,t){let n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,r];let i=new Ce(new pt.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.feature(l,r),f=ji(c,t,s);n.push(f)}}),[n,r]}function gn(e,t){if(e.byteLength<=0)return[];let n=[],r=new Me(new pt.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(o=>{let s=r.layers[o];if(s)for(let a=0;a<s.length;a++){let l=s.feature(a),c=Ri(l,t,o);n.push(c)}}),n}function Zi(e){if(!e?.mvt)throw new Error("mvt options required");let t=e.mvt?.coordinates==="wgs84",{tileIndex:n}=e.mvt,r=n&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&Number.isFinite(n.z);if(t&&!r)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.mvt}function Ri(e,t,n){let r=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:Gi);return t.layerProperty&&(r.properties[t.layerProperty]=n),r}function ji(e,t,n){let r=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:Hi);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}function Gi(e,t){let{extent:n}=t;for(let r=0;r<e.length;r++){let i=e[r];i[0]/=n,i[1]/=n}}function Hi(e,t){let{extent:n}=t;for(let r=0,i=e.length;r<i;++r)e[r]/=n}var Ji="4.2.0",yn={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:Ji,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:null}}},yt={...yn,parse:async(e,t)=>gt(e,t),parseSync:gt,binary:!0};var vn=e=>e!==null&&typeof e=="object";function mt(e,t){if(!e||!vn(e))return null;let n={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(n.generator=e.generator),typeof e.generator_options=="string"&&(n.generatorOptions=e.generator_options),n.boundingBox=mn(e.bounds)||mn(e.antimeridian_adjusted_bounds),n.center=Qi(e.center),n.maxZoom=xn(e.maxzoom),n.minZoom=xn(e.minzoom),typeof e?.json=="string")try{n.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let r=e.tilestats||n.metaJson?.tilestats,i=Ki(r,t),o=Wi(e.vector_layers),s=Yi(o,i);return n={...n,layers:s},n.maxZoom===null&&s.length>0&&(n.maxZoom=s[0].maxZoom||null),n.minZoom===null&&s.length>0&&(n.minZoom=s[0].minZoom||null),n}function Wi(e){return Array.isArray(e)?e.map(t=>$i(t)):[]}function $i(e){let t=Object.entries(e.fields||[]).map(([r,i])=>({name:r,...Tn(String(i))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function Ki(e,t){return vn(e)&&Array.isArray(e.layers)?e.layers.map(n=>Xi(n,t)):[]}function Xi(e,t){let n=[],r={},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];r[a]=r[a]||[],r[a].push(o),console.warn("ignoring tilestats indexed field",a)}else n[s]||n.push(eo(o,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function Yi(e,t){return e.map(n=>{let r=t.find(s=>s.name===n.name),i=r?.fields||[],o={...n};return delete o.fields,{...o,...r,fields:i}})}function mn(e){let t=In(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(Fn)&&[t[1],t[3]].every(Pn))return[[t[0],t[1]],[t[2],t[3]]]}function Qi(e){let t=In(e);return Array.isArray(t)&&t.length===3&&Fn(t[0])&&Pn(t[1])&&qi(t[2])?t:null}function xn(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function Pn(e){return Number.isFinite(e)&&e<=90&&e>=-90}function Fn(e){return Number.isFinite(e)&&e<=180&&e>=-180}function qi(e){return Number.isFinite(e)&&e>=0&&e<=22}function In(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var wn={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 eo(e={},t){let n=Tn(e.type),r={name:e.attribute,...n};return typeof e.min=="number"&&(r.min=e.min),typeof e.max=="number"&&(r.max=e.max),typeof e.count=="number"&&(r.uniqueValueCount=e.count),e.values&&(r.values=e.values),r.values&&typeof t.maxValues=="number"&&(r.values=r.values?.slice(0,t.maxValues)),r}function Tn(e){let t=e.toLowerCase();return!t||wn[t],wn[t]||{type:"string"}}var to="4.2.0",de={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:to,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),r=JSON.parse(n),i={...de.options.tilejson,...t?.tilejson};return mt(r,i)},parseTextSync:(e,t)=>{let n=JSON.parse(e),r={...de.options.tilejson,...t?.tilejson};return mt(n,r)}};var me={};Mt(me,{Compression:()=>Zn,EtagMismatch:()=>Ne,FetchSource:()=>Gn,FileSource:()=>ko,PMTiles:()=>Ft,Protocol:()=>Bo,ResolvedValueCache:()=>Oo,SharedPromiseCache:()=>Kn,TileType:()=>Rn,bytesToHeader:()=>Hn,findTile:()=>jn,getUint64:()=>E,leafletRasterLayer:()=>bo,readVarint:()=>ee,tileIdToZxy:()=>Uo,zxyToTileId:()=>zn});var J=Math.pow,I=(e,t,n)=>new Promise((r,i)=>{var o=l=>{try{a(n.next(l))}catch(c){i(c)}},s=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,s);a((n=n.apply(e,t)).next())}),D=Uint8Array,te=Uint16Array,no=Int32Array,Vn=new D([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]),bn=new D([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]),ro=new D([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),An=function(e,t){for(var n=new te(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new no(n[30]),r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return{b:n,r:i}},Bn=An(Vn,2),En=Bn.b,io=Bn.r;En[28]=258,io[258]=28;var _n=An(bn,0),oo=_n.b,Qa=_n.r,vt=new te(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,vt[w]=((Z&65280)>>8|(Z&255)<<8)>>1;var Z,w,ge=function(e,t,n){for(var r=e.length,i=0,o=new te(t);i<r;++i)e[i]&&++o[e[i]-1];var s=new te(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(n){a=new te(1<<t);var l=15-t;for(i=0;i<r;++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[vt[u]>>l]=c}else for(a=new te(r),i=0;i<r;++i)e[i]&&(a[i]=vt[s[e[i]-1]++]>>15-e[i]);return a},ye=new D(288);for(w=0;w<144;++w)ye[w]=8;var w;for(w=144;w<256;++w)ye[w]=9;var w;for(w=256;w<280;++w)ye[w]=7;var w;for(w=280;w<288;++w)ye[w]=8;var w,Mn=new D(32);for(w=0;w<32;++w)Mn[w]=5;var w,so=ge(ye,9,1),ao=ge(Mn,5,1),xt=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},k=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},wt=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},lo=function(e){return(e+7)/8|0},co=function(e,t,n){(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new D(n-t);return r.set(e.subarray(t,n)),r},fo=["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"],S=function(e,t,n){var r=new Error(t||fo[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,S),!n)throw r;return r},It=function(e,t,n,r){var i=e.length,o=r?r.length:0;if(!i||t.f&&!t.l)return n||new D(0);var s=!n||t.i!=2,a=t.i;n||(n=new D(i*3));var l=function(Bt){var Et=n.length;if(Bt>Et){var _t=new D(Math.max(Et*2,Bt));_t.set(n),n=_t}},c=t.f||0,f=t.p||0,u=t.b||0,h=t.l,d=t.d,p=t.m,m=t.n,F=i*8;do{if(!h){c=k(e,f,1);var _=k(e,f+1,3);if(f+=3,_)if(_==1)h=so,d=ao,p=9,m=5;else if(_==2){var V=k(e,f,31)+257,C=k(e,f+10,15)+4,M=V+k(e,f+5,31)+1;f+=14;for(var T=new D(M),b=new D(19),A=0;A<C;++A)b[ro[A]]=k(e,f+A*3,7);f+=C*3;for(var St=xt(b),Yn=(1<<St)-1,Qn=ge(b,St,1),A=0;A<M;){var Dt=Qn[k(e,f,Yn)];f+=Dt&15;var v=Dt>>4;if(v<16)T[A++]=v;else{var W=0,ve=0;for(v==16?(ve=3+k(e,f,3),f+=2,W=T[A-1]):v==17?(ve=3+k(e,f,7),f+=3):v==18&&(ve=11+k(e,f,127),f+=7);ve--;)T[A++]=W}}var Vt=T.subarray(0,V),U=T.subarray(V);p=xt(Vt),m=xt(U),h=ge(Vt,p,1),d=ge(U,m,1)}else S(1);else{var v=lo(f)+4,y=e[v-4]|e[v-3]<<8,g=v+y;if(g>i){a&&S(0);break}s&&l(u+y),n.set(e.subarray(v,g),u),t.b=u+=y,t.p=f=g*8,t.f=c;continue}if(f>F){a&&S(0);break}}s&&l(u+131072);for(var qn=(1<<p)-1,er=(1<<m)-1,Re=f;;Re=f){var W=h[wt(e,f)&qn],$=W>>4;if(f+=W&15,f>F){a&&S(0);break}if(W||S(2),$<256)n[u++]=$;else if($==256){Re=f,h=null;break}else{var bt=$-254;if($>264){var A=$-257,ne=Vn[A];bt=k(e,f,(1<<ne)-1)+En[A],f+=ne}var je=d[wt(e,f)&er],Ge=je>>4;je||S(3),f+=je&15;var U=oo[Ge];if(Ge>3){var ne=bn[Ge];U+=wt(e,f)&(1<<ne)-1,f+=ne}if(f>F){a&&S(0);break}s&&l(u+131072);var He=u+bt;if(u<U){var At=o-U,tr=Math.min(U,He);for(At+u<0&&S(3);u<tr;++u)n[u]=r[At+u]}for(;u<He;u+=4)n[u]=n[u-U],n[u+1]=n[u+1-U],n[u+2]=n[u+2-U],n[u+3]=n[u+3-U];u=He}}t.l=h,t.p=Re,t.b=u,t.f=c,h&&(c=1,t.m=p,t.d=d,t.n=m)}while(!c);return u==n.length?n:co(n,0,u)},uo=new D(0),ho=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&S(6,"invalid gzip data");var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},po=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},go=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&S(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&S(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function yo(e,t){return It(e,{i:2},t&&t.out,t&&t.dictionary)}function mo(e,t){var n=ho(e);return n+8>e.length&&S(6,"invalid gzip data"),It(e.subarray(n,-8),{i:2},t&&t.out||new D(po(e)),t&&t.dictionary)}function xo(e,t){return It(e.subarray(go(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}function Pt(e,t){return e[0]==31&&e[1]==139&&e[2]==8?mo(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?yo(e,t):xo(e,t)}var wo=typeof TextDecoder<"u"&&new TextDecoder,vo=0;try{wo.decode(uo,{stream:!0}),vo=1}catch{}var Un=(e,t)=>e*J(2,t),pe=(e,t)=>Math.floor(e/J(2,t)),Oe=(e,t)=>Un(e.getUint16(t+1,!0),8)+e.getUint8(t),Ln=(e,t)=>Un(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),Po=(e,t,n,r,i)=>{if(e!==r.getUint8(i))return e-r.getUint8(i);let o=Oe(r,i+1);if(t!==o)return t-o;let s=Oe(r,i+4);return n!==s?n-s:0},Fo=(e,t,n,r)=>{let i=kn(e,t|128,n,r);return i?{z:t,x:n,y:r,offset:i[0],length:i[1],isDir:!0}:null},Sn=(e,t,n,r)=>{let i=kn(e,t,n,r);return i?{z:t,x:n,y:r,offset:i[0],length:i[1],isDir:!1}:null},kn=(e,t,n,r)=>{let i=0,o=e.byteLength/17-1;for(;i<=o;){let s=o+i>>1,a=Po(t,n,r,e,s*17);if(a>0)i=s+1;else if(a<0)o=s-1;else return[Ln(e,s*17+7),e.getUint32(s*17+13,!0)]}return null},Io=(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,Cn=(e,t)=>{let n=e.getUint8(t*17);return{z:n&127,x:Oe(e,t*17+1),y:Oe(e,t*17+4),offset:Ln(e,t*17+7),length:e.getUint32(t*17+13,!0),isDir:n>>7===1}},Dn=e=>{let t=[],n=new DataView(e);for(let r=0;r<n.byteLength/17;r++)t.push(Cn(n,r));return To(t)},To=e=>{e.sort(Io);let t=new ArrayBuffer(17*e.length),n=new Uint8Array(t);for(let r=0;r<e.length;r++){let i=e[r],o=i.z;i.isDir&&(o=o|128),n[r*17]=o,n[r*17+1]=i.x&255,n[r*17+2]=i.x>>8&255,n[r*17+3]=i.x>>16&255,n[r*17+4]=i.y&255,n[r*17+5]=i.y>>8&255,n[r*17+6]=i.y>>16&255,n[r*17+7]=i.offset&255,n[r*17+8]=pe(i.offset,8)&255,n[r*17+9]=pe(i.offset,16)&255,n[r*17+10]=pe(i.offset,24)&255,n[r*17+11]=pe(i.offset,32)&255,n[r*17+12]=pe(i.offset,48)&255,n[r*17+13]=i.length&255,n[r*17+14]=i.length>>8&255,n[r*17+15]=i.length>>16&255,n[r*17+16]=i.length>>24&255}return t},So=(e,t)=>{if(e.byteLength<17)return null;let n=e.byteLength/17,r=Cn(e,n-1);if(r.isDir){let i=r.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 Do(e){return I(this,null,function*(){let t=yield e.getBytes(0,512e3),n=new DataView(t.data),r=n.getUint32(4,!0),i=n.getUint16(8,!0),o=new TextDecoder("utf-8"),s=JSON.parse(o.decode(new DataView(t.data,10,r))),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,m=180,F=85;if(s.bounds){let v=s.bounds.split(",");d=+v[0],p=+v[1],m=+v[2],F=+v[3]}if(s.center){let v=s.center.split(",");f=+v[0],u=+v[1],h=+v[2]}return{specVersion:n.getUint16(2,!0),rootDirectoryOffset:10+r,rootDirectoryLength:i*17,jsonMetadataOffset:10,jsonMetadataLength:r,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:m,maxLat:F,centerZoom:h,centerLon:f,centerLat:u,etag:t.etag}})}function Vo(e,t,n,r,i,o,s){return I(this,null,function*(){let a=yield n.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);e.specVersion===1&&(a=Dn(a));let l=Sn(new DataView(a),r,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=Pt(new Uint8Array(u))),{data:u}}let c=So(new DataView(a),{z:r,x:i,y:o});if(c){let f=Fo(new DataView(a),c.z,c.x,c.y);if(f){let u=yield n.getArrayBuffer(t,f.offset,f.length,e);e.specVersion===1&&(u=Dn(u));let h=Sn(new DataView(u),r,i,o);if(h){let p=(yield t.getBytes(h.offset,h.length,s)).data,m=new DataView(p);return m.getUint8(0)===31&&m.getUint8(1)===139&&(p=Pt(new Uint8Array(p))),{data:p}}}}})}var On={getHeader:Do,getZxy:Vo},bo=(e,t)=>{let n=!1,r="",i=L.GridLayer.extend({createTile:(o,s)=>{let a=document.createElement("img"),l=new AbortController,c=l.signal;return a.cancel=()=>{l.abort()},n||(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?r="image/png":f.tileType===3?r="image/jpeg":f.tileType===4?r="image/webp":f.tileType===5&&(r="image/avif")}),n=!0),e.getZxy(o.z,o.x,o.y,c).then(f=>{if(f){let u=new Blob([f.data],{type:r}),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)},Ao=e=>(t,n)=>{if(n instanceof AbortController)return e(t,n);let r=new AbortController;return e(t,r).then(i=>n(void 0,i.data,i.cacheControl||"",i.expires||""),i=>n(i)).catch(i=>n(i)),{cancel:()=>r.abort()}},Bo=class{constructor(){this.tilev4=(e,t)=>I(this,null,function*(){if(e.type==="json"){let u=e.url.substr(10),h=this.tiles.get(u);h||(h=new Ft(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 n=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),r=e.url.match(n);if(!r)throw new Error("Invalid PMTiles protocol URL");let i=r[1],o=this.tiles.get(i);o||(o=new Ft(i),this.tiles.set(i,o));let s=r[2],a=r[3],l=r[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=Ao(this.tilev4),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function q(e,t){return(t>>>0)*4294967296+(e>>>0)}function Eo(e,t){let n=t.buf,r=n[t.pos++],i=(r&112)>>4;if(r<128||(r=n[t.pos++],i|=(r&127)<<3,r<128)||(r=n[t.pos++],i|=(r&127)<<10,r<128)||(r=n[t.pos++],i|=(r&127)<<17,r<128)||(r=n[t.pos++],i|=(r&127)<<24,r<128)||(r=n[t.pos++],i|=(r&1)<<31,r<128))return q(e,i);throw new Error("Expected varint not more than 10 bytes")}function ee(e){let t=e.buf,n=t[e.pos++],r=n&127;return n<128||(n=t[e.pos++],r|=(n&127)<<7,n<128)||(n=t[e.pos++],r|=(n&127)<<14,n<128)||(n=t[e.pos++],r|=(n&127)<<21,n<128)?r:(n=t[e.pos],r|=(n&15)<<28,Eo(r,e))}function Nn(e,t,n,r){if(r===0){n===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 _o(e,t){let n=J(2,e),r=t,i=t,o=t,s=[0,0],a=1;for(;a<n;)r=1&o/2,i=1&(o^r),Nn(a,s,r,i),s[0]+=a*r,s[1]+=a*i,o=o/4,a*=2;return[e,s[0],s[1]]}var Mo=[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 zn(e,t,n){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>J(2,e)-1||n>J(2,e)-1)throw Error("tile x/y outside zoom level bounds");let r=Mo[e],i=J(2,e),o=0,s=0,a=0,l=[t,n],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),Nn(c,l,o,s),c=c/2;return r+a}function Uo(e){let t=0,n=0;for(let r=0;r<27;r++){let i=(1<<r)*(1<<r);if(t+i>e)return _o(r,e-t);t+=i}throw Error("Tile zoom level exceeds max safe number limit (26)")}var Zn=(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))(Zn||{});function Tt(e,t){return I(this,null,function*(){if(t===1||t===0)return e;if(t===2){if(typeof globalThis.DecompressionStream>"u")return Pt(new Uint8Array(e));let n=new Response(e).body;if(!n)throw Error("Failed to read response stream");let r=n.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(r).arrayBuffer()}throw Error("Compression method not supported")})}var Rn=(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))(Rn||{}),Lo=127;function jn(e,t){let n=0,r=e.length-1;for(;n<=r;){let i=r+n>>1,o=t-e[i].tileId;if(o>0)n=i+1;else if(o<0)r=i-1;else return e[i]}return r>=0&&(e[r].runLength===0||t-e[r].tileId<e[r].runLength)?e[r]:null}var ko=class{constructor(e){this.file=e}getKey(){return this.file.name}getBytes(e,t){return I(this,null,function*(){return{data:yield this.file.slice(e,e+t).arrayBuffer()}})}},Gn=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,n,r){return I(this,null,function*(){let i,o;n?o=n:(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");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||r&&c&&c!==r)throw this.mustReload=!0,new Ne(r);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(e,t){let n=e.getUint32(t+4,!0),r=e.getUint32(t+0,!0);return n*J(2,32)+r}function Hn(e,t){let n=new DataView(e),r=n.getUint8(7);if(r>3)throw Error(`Archive is spec version ${r} but this library supports up to spec version 3`);return{specVersion:r,rootDirectoryOffset:E(n,8),rootDirectoryLength:E(n,16),jsonMetadataOffset:E(n,24),jsonMetadataLength:E(n,32),leafDirectoryOffset:E(n,40),leafDirectoryLength:E(n,48),tileDataOffset:E(n,56),tileDataLength:E(n,64),numAddressedTiles:E(n,72),numTileEntries:E(n,80),numTileContents:E(n,88),clustered:n.getUint8(96)===1,internalCompression:n.getUint8(97),tileCompression:n.getUint8(98),tileType:n.getUint8(99),minZoom:n.getUint8(100),maxZoom:n.getUint8(101),minLon:n.getInt32(102,!0)/1e7,minLat:n.getInt32(106,!0)/1e7,maxLon:n.getInt32(110,!0)/1e7,maxLat:n.getInt32(114,!0)/1e7,centerZoom:n.getUint8(118),centerLon:n.getInt32(119,!0)/1e7,centerLat:n.getInt32(123,!0)/1e7,etag:t}}function Jn(e){let t={buf:new Uint8Array(e),pos:0},n=ee(t),r=[],i=0;for(let o=0;o<n;o++){let s=ee(t);r.push({tileId:i+s,offset:0,length:0,runLength:1}),i+=s}for(let o=0;o<n;o++)r[o].runLength=ee(t);for(let o=0;o<n;o++)r[o].length=ee(t);for(let o=0;o<n;o++){let s=ee(t);s===0&&o>0?r[o].offset=r[o-1].offset+r[o-1].length:r[o].offset=s-1}return r}function Co(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 Ne=class extends Error{};function Wn(e,t){return I(this,null,function*(){let n=yield e.getBytes(0,16384);if(new DataView(n.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(Co(n.data)<3)return[yield On.getHeader(e)];let i=n.data.slice(0,Lo),o=Hn(i,n.etag),s=n.data.slice(o.rootDirectoryOffset,o.rootDirectoryOffset+o.rootDirectoryLength),a=`${e.getKey()}|${o.etag||""}|${o.rootDirectoryOffset}|${o.rootDirectoryLength}`,l=Jn(yield t(s,o.internalCompression));return[o,[a,l.length,l]]})}function $n(e,t,n,r,i){return I(this,null,function*(){let o=yield e.getBytes(n,r,void 0,i.etag),s=yield t(o.data,i.internalCompression),a=Jn(s);if(a.length===0)throw new Error("Empty directory is invalid");return a})}var Oo=class{constructor(e=100,t=!0,n=Tt){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=n}getHeader(e){return I(this,null,function*(){let t=e.getKey(),n=this.cache.get(t);if(n)return n.lastUsed=this.counter++,n.data;let r=yield Wn(e,this.decompress);return r[1]&&this.cache.set(r[1][0],{lastUsed:this.counter++,data:r[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:r[0]}),this.prune(),r[0]})}getDirectory(e,t,n,r){return I(this,null,function*(){let i=`${e.getKey()}|${r.etag||""}|${t}|${n}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,o.data;let s=yield $n(e,this.decompress,t,n,r);return this.cache.set(i,{lastUsed:this.counter++,data:s}),this.prune(),s})}getArrayBuffer(e,t,n,r){return I(this,null,function*(){let i=`${e.getKey()}|${r.etag||""}|${t}|${n}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=yield e.getBytes(t,n,void 0,r.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((n,r)=>{n.lastUsed<e&&(e=n.lastUsed,t=r)}),t&&this.cache.delete(t)}}invalidate(e){return I(this,null,function*(){this.cache.delete(e.getKey())})}},Kn=class{constructor(e=100,t=!0,n=Tt){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=n}getHeader(e){return I(this,null,function*(){let t=e.getKey(),n=this.cache.get(t);if(n)return n.lastUsed=this.counter++,yield n.data;let r=new Promise((i,o)=>{Wn(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:r}),r})}getDirectory(e,t,n,r){return I(this,null,function*(){let i=`${e.getKey()}|${r.etag||""}|${t}|${n}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=new Promise((a,l)=>{$n(e,this.decompress,t,n,r).then(c=>{a(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(e,t,n,r){return I(this,null,function*(){let i=`${e.getKey()}|${r.etag||""}|${t}|${n}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=new Promise((a,l)=>{e.getBytes(t,n,void 0,r.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((n,r)=>{n.lastUsed<e&&(e=n.lastUsed,t=r)}),t&&this.cache.delete(t)}}invalidate(e){return I(this,null,function*(){let t=e.getKey();if(this.invalidations.get(t))return yield this.invalidations.get(t);this.cache.delete(e.getKey());let n=new Promise((r,i)=>{this.getHeader(e).then(o=>{r(),this.invalidations.delete(t)}).catch(o=>{i(o)})});this.invalidations.set(t,n)})}},Ft=class{constructor(e,t,n){typeof e=="string"?this.source=new Gn(e):this.source=e,n?this.decompress=n:this.decompress=Tt,t?this.cache=t:this.cache=new Kn}getHeader(){return I(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,n,r){return I(this,null,function*(){let i=zn(e,t,n),o=yield this.cache.getHeader(this.source);if(o.specVersion<3)return On.getZxy(o,this.source,this.cache,e,t,n,r);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=jn(c,i);if(f){if(f.runLength>0){let u=yield this.source.getBytes(o.tileDataOffset+f.offset,f.length,r,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,n,r){return I(this,null,function*(){try{return yield this.getZxyAttempt(e,t,n,r)}catch(i){if(i instanceof Ne)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,n,r);throw i}})}getMetadataAttempt(){return I(this,null,function*(){let e=yield this.cache.getHeader(this.source),t=yield this.source.getBytes(e.jsonMetadataOffset,e.jsonMetadataLength,void 0,e.etag),n=yield this.decompress(t.data,e.internalCompression),r=new TextDecoder("utf-8");return JSON.parse(r.decode(n))})}getMetadata(){return I(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof Ne)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}};var{TileType:xe}=me;function Xn(e,t,n,r){let i=t,o=null;if(i)try{let l=JSON.stringify(i);o=de.parseTextSync?.(l,r)||null}catch(l){console.warn("PMTiles metadata could not be interpreted as TileJSON",l)}let s={};typeof o?.name=="string"&&(s.name=o.name),typeof o?.htmlAttribution=="string"&&(s.attributions=[o.htmlAttribution]);let a={...s,format:"pmtiles",formatVersion:e.specVersion,attributions:[],tileMIMEType:No(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&&(a.tilejson=o),n?.includeFormatHeader&&(a.formatHeader=e,a.formatMetadata=a),a}function No(e){switch(e){case xe.Mvt:return"application/vnd.mapbox-vector-tile";case xe.Png:return"image/png";case xe.Jpeg:return"image/jpeg";case xe.Webp:return"image/webp";case xe.Avif:return"image/avif";default:return"application/octet-stream"}}var ze=class{blob;key;constructor(t,n){this.blob=t,this.key=n}getKey(){return this.blob.url||""}async getBytes(t,n,r){return{data:await this.blob.slice(t,t+n).arrayBuffer()}}};var{PMTiles:zo}=me;var Ze=class extends ie{data;props;mimeType=null;pmtiles;metadata;constructor(t){super(t),this.props=t;let n=typeof t.url=="string"?Xe(t.url):new ze(t.url,"pmtiles");this.data=t.url,this.pmtiles=new zo(n),this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata()}async getMetadata(){let t=await this.pmtiles.getHeader(),n=await this.pmtiles.getMetadata(),r=Xn(t,n,{includeFormatHeader:!1},this.loadOptions);return this.props.attributions&&(r.attributions=[...this.props.attributions,...r.attributions||[]]),r?.tileMIMEType&&(this.mimeType=r?.tileMIMEType),r}async getTile(t){let{x:n,y:r,zoom:i}=t,s=(await this.pmtiles.getZxy(i,n,r))?.data;return s||null}async getTileData(t){let{x:n,y:r,z:i}=t.index;switch((await this.metadata).tileMIMEType){case"application/vnd.mapbox-vector-tile":return await this.getVectorTile({x:n,y:r,zoom:i,layers:[]});default:return await this.getImageTile({x:n,y:r,zoom:i,layers:[]})}}async getImageTile(t){let n=await this.getTile(t);return n?await tt.parse(n,this.loadOptions):null}async getVectorTile(t){let n=await this.getTile(t),r={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:t.x,y:t.y,z:t.zoom},...this.loadOptions?.mvt},...this.loadOptions};return n?await yt.parse(n,r):null}};return ar(we);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var mr=Object.create;var fe=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,vr=Object.prototype.hasOwnProperty;var Tr=(e,t,n)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ot=(e,t)=>{for(var n in t)fe(e,n,{get:t[n],enumerable:!0})},Be=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xr(t))!vr.call(e,o)&&o!==n&&fe(e,o,{get:()=>t[o],enumerable:!(r=yr(t,o))||r.enumerable});return e},Ae=(e,t,n)=>(Be(e,t,"default"),n&&Be(n,t,"default")),Gt=(e,t,n)=>(n=e!=null?mr(wr(e)):{},Be(t||!e||!e.__esModule?fe(n,"default",{value:e,enumerable:!0}):n,e)),Ir=e=>Be(fe({},"__esModule",{value:!0}),e);var zt=(e,t,n)=>(Tr(e,typeof t!="symbol"?t+"":t,n),n);var Rt=Qe((us,jt)=>{jt.exports=globalThis.loaders});var xn=Qe(yt=>{yt.read=function(e,t,n,r,o){var i,s,a=o*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,u=n?o-1:0,h=n?-1:1,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+=r;f>0;s=s*256+e[t+u],u+=h,f-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-c}return(d?-1:1)*s*Math.pow(2,i-r)};yt.write=function(e,t,n,r,o,i){var s,a,l,c=i*8-o-1,f=(1<<c)-1,u=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=h/l:t+=h*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(t*l-1)*Math.pow(2,o),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,o),s=0));o>=8;e[n+d]=a&255,d+=p,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+d]=s&255,d+=p,s/=256,c-=8);e[n+d-p]|=y*128}});var Fn=Qe((Vl,Pn)=>{"use strict";Pn.exports=x;var ze=xn();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 xt=(1<<16)*(1<<16),wn=1/xt,zo=12,In=typeof TextDecoder>"u"?null:new TextDecoder("utf8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),o=r>>3,i=this.pos;this.type=r&7,e(o,t,this),this.pos===i&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=je(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Tn(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=je(this.buf,this.pos)+je(this.buf,this.pos+4)*xt;return this.pos+=8,e},readSFixed64:function(){var e=je(this.buf,this.pos)+Tn(this.buf,this.pos+4)*xt;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,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,jo(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=zo&&In?ni(this.buf,t,e):ti(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==x.Bytes)return e.push(this.readVarint(t));var n=j(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=j(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=j(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=j(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=j(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=j(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=j(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=j(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=j(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===x.Varint)for(;this.buf[this.pos++]>127;);else if(t===x.Bytes)this.pos=this.readVarint()+this.pos;else if(t===x.Fixed32)this.pos+=4;else if(t===x.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),ie(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),ie(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),ie(this.buf,e&-1,this.pos),ie(this.buf,Math.floor(e*wn),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),ie(this.buf,e&-1,this.pos),ie(this.buf,Math.floor(e*wn),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Ro(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=ri(this.buf,e,this.pos);var n=this.pos-t;n>=128&&vn(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},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 n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&vn(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,x.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,Wo,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Jo,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Yo,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Ko,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,$o,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Xo,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Qo,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,qo,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,ei,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 jo(e,t,n){var r=n.buf,o,i;if(i=r[n.pos++],o=(i&112)>>4,i<128||(i=r[n.pos++],o|=(i&127)<<3,i<128)||(i=r[n.pos++],o|=(i&127)<<10,i<128)||(i=r[n.pos++],o|=(i&127)<<17,i<128)||(i=r[n.pos++],o|=(i&127)<<24,i<128)||(i=r[n.pos++],o|=(i&1)<<31,i<128))return oe(e,o,t);throw new Error("Expected varint not more than 10 bytes")}function j(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function oe(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Ro(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),Ho(n,r,t),Zo(r,t)}function Ho(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function Zo(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function vn(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var o=n.pos-1;o>=e;o--)n.buf[o+r]=n.buf[o]}function Wo(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function Jo(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function Ko(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function $o(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function Yo(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function Xo(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function Qo(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function qo(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function ei(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function je(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function ie(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Tn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function ti(e,t,n){for(var r="",o=t;o<n;){var i=e[o],s=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a>n)break;var l,c,f;a===1?i<128&&(s=i):a===2?(l=e[o+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[o+1],c=e[o+2],(l&192)===128&&(c&192)===128&&(s=(i&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[o+1],c=e[o+2],f=e[o+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(i&15)<<18|(l&63)<<12|(c&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,r+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),r+=String.fromCharCode(s),o+=a}return r}function ni(e,t,n){return In.decode(e.subarray(t,n))}function ri(e,t,n){for(var r=0,o,i;r<t.length;r++){if(o=t.charCodeAt(r),o>55295&&o<57344)if(i)if(o<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=o;continue}else o=i-55296<<10|o-56320|65536,i=null;else{o>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=o;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);o<128?e[n++]=o:(o<2048?e[n++]=o>>6|192:(o<65536?e[n++]=o>>12|224:(e[n++]=o>>18|240,e[n++]=o>>12&63|128),e[n++]=o>>6&63|128),e[n++]=o&63|128)}return n}});var Se={};Ot(Se,{PMTilesSource:()=>Je});Ae(Se,Gt(Rt(),1));function ue(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var G={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Pr=G.self||G.window||G.global||{},Fr=G.window||G.self||G.global||{},br=G.global||G.self||G.window||{},Er=G.document||{};var qe=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Ht=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Sr=Ht&&parseFloat(Ht[1])||0;function H(e){return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(e)}function et(e,t){if(H(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(H(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tt(e){var t=et(e,"string");return H(t)==="symbol"?t:String(t)}function T(e,t,n){return t=tt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nt(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,n=e||t;return!!(n&&n.indexOf("Electron")>=0)}function N(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||nt()}var _r=globalThis.self||globalThis.window||globalThis.global,ee=globalThis.window||globalThis.self||globalThis.global,Br=globalThis.document||{},W=globalThis.process||{},Ar=globalThis.console,bs=globalThis.navigator||{};var De=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",_s=N();function Dr(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Ve=class{constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";T(this,"storage",void 0),T(this,"id",void 0),T(this,"config",void 0),this.storage=Dr(r),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function Zt(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function Wt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,n=Math.max(t-e.length,0);return"".concat(" ".repeat(n)).concat(e)}function Le(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(n=Math.min(n,r/e.width));let i=e.width*n,s=e.height*n,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(o,");"),"background-size:".concat(i,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}var Me;(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"})(Me||(Me={}));var Vr=10;function Jt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Me[e]||Me.WHITE)}function Kt(e,t,n){if(!N&&typeof e=="string"){if(t){let r=Jt(t);e="\x1B[".concat(r,"m").concat(e,"\x1B[39m")}if(n){let r=Jt(n);e="\x1B[".concat(r+Vr,"m").concat(e,"\x1B[49m")}}return e}function $t(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),o=e;for(let i of r){let s=o[i];typeof s=="function"&&(t.find(a=>i===a)||(o[i]=s.bind(e)))}}function te(e,t){if(!e)throw new Error(t||"Assertion failed")}function J(){let e;if(N()&&ee.performance){var t,n;e=ee===null||ee===void 0||(t=ee.performance)===null||t===void 0||(n=t.now)===null||n===void 0?void 0:n.call(t)}else if("hrtime"in W){var r;let o=W===null||W===void 0||(r=W.hrtime)===null||r===void 0?void 0:r.call(W);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var ne={debug:N()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Lr={enabled:!0,level:0};function D(){}var Yt={},Xt={once:!0},Z=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};T(this,"id",void 0),T(this,"VERSION",De),T(this,"_startTs",J()),T(this,"_deltaTs",J()),T(this,"_storage",void 0),T(this,"userData",{}),T(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new Ve("__probe-".concat(this.id,"__"),Lr),this.timeStamp("".concat(this.id," started")),$t(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((J()-this._startTs).toPrecision(10))}getDelta(){return Number((J()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){te(t,n)}warn(t){return this._getLogFunction(0,t,ne.warn,arguments,Xt)}error(t){return this._getLogFunction(0,t,ne.error,arguments)}deprecated(t,n){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(n,"` instead"))}removed(t,n){return this.error("`".concat(t,"` has been removed. Use `").concat(n,"` instead"))}probe(t,n){return this._getLogFunction(t,n,ne.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,ne.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,ne.debug||ne.info,arguments,Xt)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||D,r&&[r],{tag:Nr(n)}):D}image(t){let{logLevel:n,priority:r,image:o,message:i="",scale:s=1}=t;return this._shouldLog(n||r)?N()?kr({image:o,message:i,scale:s}):Ur({image:o,message:i,scale:s}):D}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||D)}group(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=Qt({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||D)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=qt(t)}_getLogFunction(t,n,r,o,i){if(this._shouldLog(t)){i=Qt({logLevel:t,message:n,args:o,opts:i}),r=r||i.method,te(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=J();let s=i.tag||i.message;if(i.once&&s)if(!Yt[s])Yt[s]=J();else return D;return n=Mr(this.id,i.message,i),r.bind(console,n,...i.args)}return D}};T(Z,"VERSION",De);function qt(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 te(Number.isFinite(t)&&t>=0),t}function Qt(e){let{logLevel:t,message:n}=e;e.logLevel=qt(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return te(o==="string"||o==="object"),Object.assign(e,{args:r},e.opts)}function Mr(e,t,n){if(typeof t=="string"){let r=n.time?Wt(Zt(n.total)):"";t=n.time?"".concat(e,": ").concat(r," ").concat(t):"".concat(e,": ").concat(t),t=Kt(t,n.color,n.background)}return t}function Ur(e){let{image:t,message:n="",scale:r=1}=e;return console.warn("removed"),D}function kr(e){let{image:t,message:n="",scale:r=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let s=Le(i,n,r);console.log(...s)},i.src=t,D}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...Le(t,n,r)),D;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Le(i,n,r)),i.src=t.toDataURL(),D}return D}function Nr(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}var ta=new Z({id:"@probe.gl/log"});var rt="4.2.0",Cr=rt[0]>="0"&&rt[0]<="9"?`v${rt}`:"",ot=new Z({id:`loaders.gl ${Cr}`});var Or="",en={};function it(e){for(let t in en)if(e.startsWith(t)){let n=en[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Or}${e}`),e}var he=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Gr(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function Gr(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,o)=>t(r,o);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var tn="4.2.0";var zr=globalThis.loaders?.parseImageNode,st=typeof Image<"u",at=typeof ImageBitmap<"u",jr=Boolean(zr),lt=qe?!0:jr;function nn(e){switch(e){case"auto":return at||st||lt;case"imagebitmap":return at;case"image":return st;case"data":return lt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function rn(){if(at)return"imagebitmap";if(st)return"image";if(lt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Rr(e){let t=Hr(e);if(!t)throw new Error("Not an image");return t}function on(e){switch(Rr(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Hr(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 Zr=/^data:image\/svg\+xml/,Wr=/\.svg((\?|#).*)?$/;function Ue(e){return e&&(Zr.test(e)||Wr.test(e))}function sn(e,t){if(Ue(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return ct(e,t)}function ct(e,t){if(Ue(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ke(e,t,n){let r=sn(e,n),o=self.URL||self.webkitURL,i=typeof r!="string"&&o.createObjectURL(r);try{return await Jr(i||r,t)}finally{i&&o.revokeObjectURL(i)}}async function Jr(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,o)=>{try{n.onload=()=>r(n),n.onerror=i=>{let s=i instanceof Error?i.message:"error";o(new Error(s))}}catch(i){o(i)}})}var Kr={},an=!0;async function ln(e,t,n){let r;Ue(n)?r=await ke(e,t,n):r=ct(e,n);let o=t&&t.imagebitmap;return await $r(r,o)}async function $r(e,t=null){if((Yr(t)||!an)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),an=!1}return await createImageBitmap(e)}function Yr(e){for(let t in e||Kr)return!1;return!0}function cn(e){return!eo(e,"ftyp",4)||!(e[8]&96)?null:Xr(e)}function Xr(e){switch(Qr(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Qr(e,t,n){return String.fromCharCode(...e.slice(t,n))}function qr(e){return[...e].map(t=>t.charCodeAt(0))}function eo(e,t,n=0){let r=qr(t);for(let o=0;o<r.length;++o)if(r[o]!==e[o+n])return!1;return!0}var z=!1,de=!0;function Ne(e){let t=pe(e);return no(t)||io(t)||ro(t)||oo(t)||to(t)}function to(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=cn(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function no(e){let t=pe(e);return t.byteLength>=24&&t.getUint32(0,z)===2303741511?{mimeType:"image/png",width:t.getUint32(16,z),height:t.getUint32(20,z)}:null}function ro(e){let t=pe(e);return t.byteLength>=10&&t.getUint32(0,z)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,de),height:t.getUint16(8,de)}:null}function oo(e){let t=pe(e);return t.byteLength>=14&&t.getUint16(0,z)===16973&&t.getUint32(2,de)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,de),height:t.getUint32(22,de)}:null}function io(e){let t=pe(e);if(!(t.byteLength>=3&&t.getUint16(0,z)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:o}=so(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,z);if(o.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,z),width:t.getUint16(i+7,z)};if(!r.has(s))return null;i+=2,i+=t.getUint16(i,z)}return null}function so(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function pe(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function fn(e,t){let{mimeType:n}=Ne(e)||{},r=globalThis.loaders?.parseImageNode;return ue(r),await r(e,n)}async function un(e,t,n){t=t||{};let o=(t.image||{}).type||"auto",{url:i}=n||{},s=ao(o),a;switch(s){case"imagebitmap":a=await ln(e,t,i);break;case"image":a=await ke(e,t,i);break;case"data":a=await fn(e,t);break;default:ue(!1)}return o==="data"&&(a=on(a)),a}function ao(e){switch(e){case"auto":case"data":return rn();default:return nn(e),e}}var lo=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],co=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],fo={image:{type:"auto",decode:!0}},ft={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:tn,mimeTypes:co,extensions:lo,parse:un,tests:[e=>Boolean(Ne(new DataView(e)))],options:fo};var ge={x:0,y:1,z:2};function K(e,t={}){let{start:n=0,end:r=e.length,plane:o="xy"}=t,i=t.size||2,s=0,a=ge[o[0]],l=ge[o[1]];for(let c=n,f=r-i;c<r;c+=i)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function ht(e,t,n=2,r,o="xy"){let i=t&&t.length,s=i?t[0]*n:e.length,a=dn(e,0,s,n,!0,r&&r[0],o),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,d,p,y;if(i&&(a=xo(e,t,a,n,r,o)),e.length>80*n){h=f=e[0],d=u=e[1];for(let P=n;P<s;P+=n)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,n,h,d,c,0),l}function dn(e,t,n,r,o,i,s){let a,l;i===void 0&&(i=K(e,{start:t,end:n,size:r,plane:s}));let c=ge[s[0]],f=ge[s[1]];if(o===i<0)for(a=t;a<n;a+=r)l=hn(a,e[a+c],e[a+f],l);else for(a=n-r;a>=t;a-=r)l=hn(a,e[a+c],e[a+f],l);return l&&Ge(l,l.next)&&(xe(l),l=l.next),l}function $(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Ge(n,n.next)||I(n.prev,n,n.next)===0)){if(xe(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function me(e,t,n,r,o,i,s){if(!e)return;!s&&i&&Po(e,r,o,i);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,i?go(e,r,o,i):po(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(c.i/n|0),xe(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=mo($(e),t,n),me(e,t,n,r,o,i,2)):s===2&&yo(e,t,n,r,o,i):me($(e),t,n,r,o,i,1);break}}}function po(e){let t=e.prev,n=e,r=e.next;if(I(t,n,r)>=0)return!1;let o=t.x,i=n.x,s=r.x,a=t.y,l=n.y,c=r.y,f=o<i?o<s?o:s:i<s?i:s,u=a<l?a<c?a:c:l<c?l:c,h=o>i?o>s?o:s:i>s?i:s,d=a>l?a>c?a:c:l>c?l:c,p=r.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&re(o,a,i,l,s,c,p.x,p.y)&&I(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function go(e,t,n,r){let o=e.prev,i=e,s=e.next;if(I(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,M=ut(d,p,t,n,r),v=ut(y,P,t,n,r),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=M&&g&&g.z<=v;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==o&&m!==s&&re(a,f,l,u,c,h,m.x,m.y)&&I(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&&re(a,f,l,u,c,h,g.x,g.y)&&I(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;m&&m.z>=M;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==o&&m!==s&&re(a,f,l,u,c,h,m.x,m.y)&&I(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&&re(a,f,l,u,c,h,g.x,g.y)&&I(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function mo(e,t,n){let r=e;do{let o=r.prev,i=r.next.next;!Ge(o,i)&&pn(o,r,r.next,i)&&ye(o,i)&&ye(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),xe(r),xe(r.next),r=e=i),r=r.next}while(r!==e);return $(r)}function yo(e,t,n,r,o,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Eo(s,a)){let l=gn(s,a);s=$(s,s.next),l=$(l,l.next),me(s,t,n,r,o,i,0),me(l,t,n,r,o,i,0);return}a=a.next}s=s.next}while(s!==e)}function xo(e,t,n,r,o,i){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*r,f=a<l-1?t[a+1]*r:e.length,u=dn(e,c,f,r,!1,o&&o[a+1],i),u===u.next&&(u.steiner=!0),s.push(bo(u));for(s.sort(wo),a=0;a<s.length;a++)n=vo(s[a],n);return n}function wo(e,t){return e.x-t.x}function vo(e,t){let n=To(e,t);if(!n)return t;let r=gn(n,e);return $(r,r.next),$(n,n.next)}function To(e,t){let n=t,r=e.x,o=e.y,i=-1/0,s;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){let h=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>i&&(i=h,s=n.x<n.next.x?n:n.next,h===r))return s}n=n.next}while(n!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;n=s;do r>=n.x&&n.x>=l&&r!==n.x&&re(o<c?r:i,o,l,c,o<c?i:r,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(r-n.x),ye(n,e)&&(u<f||u===f&&(n.x>s.x||n.x===s.x&&Io(s,n)))&&(s=n,f=u)),n=n.next;while(n!==a);return s}function Io(e,t){return I(e.prev,e,t.prev)<0&&I(t.next,e,e.next)<0}function Po(e,t,n,r){let o=e;do o.z===0&&(o.z=ut(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,Fo(o)}function Fo(e){let t,n,r=1,o,i,s,a,l,c;do{for(i=e,e=null,c=null,o=0;i;){for(o++,a=i,s=0,n=0;n<r&&(s++,a=a.nextZ,!!a);n++);for(l=r;s>0||l>0&&a;)s!==0&&(l===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;i=a}c.nextZ=null,r*=2}while(o>1);return e}function ut(e,t,n,r,o){return e=(e-n)*o|0,t=(t-r)*o|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function bo(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function re(e,t,n,r,o,i,s,a){return(o-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(r-a)>=(n-s)*(t-a)&&(n-s)*(i-a)>=(o-s)*(r-a)}function Eo(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!So(e,t)&&(ye(e,t)&&ye(t,e)&&_o(e,t)&&(I(e.prev,e,t.prev)||I(e,t.prev,t))||Ge(e,t)&&I(e.prev,e,e.next)>0&&I(t.prev,t,t.next)>0)}function I(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ge(e,t){return e.x===t.x&&e.y===t.y}function pn(e,t,n,r){let o=Oe(I(e,t,n)),i=Oe(I(e,t,r)),s=Oe(I(n,r,e)),a=Oe(I(n,r,t));return!!(o!==i&&s!==a||o===0&&Ce(e,n,t)||i===0&&Ce(e,r,t)||s===0&&Ce(n,e,r)||a===0&&Ce(n,t,r))}function Ce(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Oe(e){return e>0?1:e<0?-1:0}function So(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&pn(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function ye(e,t){return I(e.prev,e,e.next)<0?I(e,t,e.next)>=0&&I(e,e.prev,t)>=0:I(e,t,e.prev)<0||I(e,e.next,t)<0}function _o(e,t){let n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function gn(e,t){let n=new we(e.i,e.x,e.y),r=new we(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function hn(e,t,n,r){let o=new we(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function 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,n,r){T(this,"i",void 0),T(this,"x",void 0),T(this,"y",void 0),T(this,"prev",null),T(this,"next",null),T(this,"z",0),T(this,"prevZ",null),T(this,"nextZ",null),T(this,"steiner",!1),this.i=t,this.x=n,this.y=r}};function gt(e,t,n){let r=Lo(e),o=Object.keys(r).filter(i=>r[i]!==Array);return Mo(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||o,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function Lo(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let o=n.properties[r];t[r]=Go(o,t[r])}return t}function Mo(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:o,linePositionsCount:i,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:y=Float32Array,triangulate:P=!0}=n,M=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(r*d),globalFeatureIds:new v(r),featureIds:o>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(i*d),globalFeatureIds:new v(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},_={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&&(_.triangles=[]);for(let U of[m,g,_])for(let b of p){let B=h[b];U.numericProps[b]=new B(U.positions.length/d)}g.pathIndices[s]=i,_.polygonIndices[c]=l,_.primitivePolygonIndices[f]=l;let O={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let U of e){let b=U.geometry,B=U.properties||{};switch(b.type){case"Point":Uo(b,m,O,d,B),m.properties.push(pt(B,p)),M&&m.fields.push({id:U.id}),O.pointFeature++;break;case"LineString":ko(b,g,O,d,B),g.properties.push(pt(B,p)),M&&g.fields.push({id:U.id}),O.lineFeature++;break;case"Polygon":No(b,_,O,d,B),_.properties.push(pt(B,p)),M&&_.fields.push({id:U.id}),O.polygonFeature++;break;default:throw new Error("Invalid geometry type")}O.feature++}return Oo(m,g,_,d)}function Uo(e,t,n,r,o){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;mt(t,o,n.pointPosition,i),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function ko(e,t,n,r,o){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;mt(t,o,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(c-l)/r}}function No(e,t,n,r,o){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;mt(t,o,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=n.polygonPosition;t.polygonIndices[n.polygonObject++]=l;let c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let 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[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(P-y)/r}let h=n.polygonPosition;Co(t,c,f,{startPosition:l,endPosition:h,coordLength:r})}}function Co(e,t,n,{startPosition:r,endPosition:o,coordLength:i}){if(!e.triangles)return;let s=r*i,a=o*i,l=e.positions.subarray(s,a),c=n[0],f=n.slice(1).map(h=>(h-c)/i),u=ht(l,f,i,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(r+u[h])}function dt(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function Oo(e,t,n,r){let o={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:dt(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:dt(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:dt(n.numericProps,1)}};return o.polygons&&n.triangles&&(o.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),o}function mt(e,t,n,r){for(let o in e.numericProps)if(o in t){let i=t[o];e.numericProps[o].fill(i,n,n+r)}}function pt(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function Go(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var vt=Gt(Fn(),1);function oi(e){let t=0;for(let n=0,r=e.length-1,o,i;n<e.length;r=n++)o=e[n],i=e[r],t+=(i[0]-o[0])*(o[1]+i[1]);return t}function bn(e,t,n){let{x:r,y:o,z:i}=t,s=n*Math.pow(2,i),a=n*r,l=n*o;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function En(e){let t=e.length;if(t<=1)return[e];let n=[],r,o;for(let i=0;i<t;i++){let s=oi(e[i]);s!==0&&(o===void 0&&(o=s<0),o===s<0?(r&&n.push(r),r=[e[i]]):r&&r.push(e[i]))}return r&&n.push(r),n}function Sn(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[K(e.data)]],indices:[e.indices]};let r=[],o=[],i=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),d=K(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&&(r.push(i),o.push(s)),s=[u],i=[d]):(i.push(d),s.push(u))}return i&&r.push(i),s.length&&o.push(s),{type:n,areas:r,indices:o,data:e.data}}var Y=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,o,i,s){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=o,this._values=i,this._geometryInfo=s,t.readFields(ii,this,n)}toGeoJSON(t){let n=this.loadGeometry();if(typeof t=="function")return _n(this,n,t);let{x:r,y:o,z:i}=t,s=this.extent*Math.pow(2,i),a=this.extent*r,l=this.extent*o;function c(f){for(let u=0;u<f.length;u++){let h=f[u];h[0]=(h[0]+a)*360/s-180;let d=180-(h[1]+l)*360/s;h[1]=360/Math.PI*Math.atan(Math.exp(d*Math.PI/180))-90}}return _n(this,n,c)}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let n=t;return this._toBinaryCoordinates(r=>bn(r,n,this.extent))}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o=0,i=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<n;){if(o<=0){let u=t.readVarint();r=u&7,o=u>>3}if(o--,r===1||r===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<c&&(c=s),s>f&&(f=s);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,c,l,f]}_toBinaryCoordinates(t){let n=this.loadFlatGeometry(),r;t(n.data,this);let o=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,r={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/o,r={type:"LineString",...n};break;case 3:r=Sn(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let s of r.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=r.data.length/o;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o=0,i=0,s=0,a=[],l;for(;t.pos<n;){if(o<=0){let c=t.readVarint();r=c&7,o=c>>3}switch(o--,r){case 1:case 2:i+=t.readSVarint(),s+=t.readSVarint(),r===1&&(l&&a.push(l),l=[]),l&&l.push([i,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${r}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o,i=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<n;)if(i<=0&&(o=t.readVarint(),r=o&7,i=o>>3),i--,r===1||r===2)s+=t.readSVarint(),a+=t.readSVarint(),r===1&&c.push(l),f.push(s,a),l+=2;else if(r===7){if(l>0){let u=c[c.length-1];f.push(f[u],f[u+1]),l+=2}}else throw new Error(`unknown command ${r}`);return{data:f,indices:c}}};zt(Y,"types",["Unknown","Point","LineString","Polygon"]);function _n(e,t,n){let r=Y.types[e.type],o,i,s;switch(e.type){case 1:let l=[];for(o=0;o<t.length;o++)l[o]=t[o][0];s=l,n(s,e);break;case 2:for(s=t,o=0;o<s.length;o++)n(s[o],e);break;case 3:for(s=En(t),o=0;o<s.length;o++)for(i=0;i<s[o].length;i++)n(s[o][i],e);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:r=`Multi${r}`;let a={type:"Feature",geometry:{type:r,coordinates:s},properties:e.properties};return e.id!==null&&(a.id=e.id),a}function ii(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?si(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function si(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],o=t._values[e.readVarint()];t.properties[r]=o}}var Re=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ai,this,n),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new Y(this._pbf,n,this.extent,this._keys,this._values)}getBinaryFeature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new Y(this._pbf,r,this.extent,this._keys,this._values,n)}};function ai(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(li(n)))}function li(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var ve=class{layers;constructor(t,n){this.layers=t.readFields(ci,{},n)}};function ci(e,t,n){if(e===3&&n){let r=new Re(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function Tt(e,t){let n=ui(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:wt(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Bn(e,n)};case"geojson":return Bn(e,n);case"binary-geometry":return wt(e,n);case"binary":return wt(e,n);default:throw new Error(r||"undefined shape")}}function wt(e,t){let[n,r]=fi(e,t),o=gt(n,r);return o.byteLength=e.byteLength,o}function fi(e,t){let n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,r];let o=new ve(new vt.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(o.layers)).forEach(s=>{let a=o.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,r),f=di(c,t,s);n.push(f)}}),[n,r]}function Bn(e,t){if(e.byteLength<=0)return[];let n=[],r=new ve(new vt.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(i=>{let s=r.layers[i];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=hi(l,t,i);n.push(c)}}),n}function ui(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&&ot.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function hi(e,t,n){let r=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:pi);return t.layerProperty&&(r.properties||={},r.properties[t.layerProperty]=n),r}function di(e,t,n){let r=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:gi);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}function pi(e,t){let{extent:n}=t;for(let r=0;r<e.length;r++){let o=e[r];o[0]/=n,o[1]/=n}}function gi(e,t){let{extent:n}=t;for(let r=0,o=e.length;r<o;++r)e[r]/=n}var mi="4.2.0",An={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:mi,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}}},It={...An,parse:async(e,t)=>Tt(e,t),parseSync:Tt,binary:!0};var Mn=e=>e!==null&&typeof e=="object";function Pt(e,t){if(!e||!Mn(e))return null;let n={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(n.generator=e.generator),typeof e.generator_options=="string"&&(n.generatorOptions=e.generator_options),n.boundingBox=Dn(e.bounds)||Dn(e.antimeridian_adjusted_bounds),n.center=Ii(e.center),n.maxZoom=Vn(e.maxzoom),n.minZoom=Vn(e.minzoom),typeof e?.json=="string")try{n.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let r=e.tilestats||n.metaJson?.tilestats,o=wi(r,t),i=yi(e.vector_layers),s=Ti(i,o);return n={...n,layers:s},n.maxZoom===null&&s.length>0&&(n.maxZoom=s[0].maxZoom||null),n.minZoom===null&&s.length>0&&(n.minZoom=s[0].minZoom||null),n}function yi(e){return Array.isArray(e)?e.map(t=>xi(t)):[]}function xi(e){let t=Object.entries(e.fields||[]).map(([r,o])=>({name:r,...Cn(String(o))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function wi(e,t){return Mn(e)&&Array.isArray(e.layers)?e.layers.map(n=>vi(n,t)):[]}function vi(e,t){let n=[],r={},o=e.attributes||[];for(let i of o){let s=i.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];r[a]=r[a]||[],r[a].push(i),console.warn("ignoring tilestats indexed field",a)}else n[s]||n.push(Fi(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function Ti(e,t){return e.map(n=>{let r=t.find(s=>s.name===n.name),o=r?.fields||[],i={...n};return delete i.fields,{...i,...r,fields:o}})}function Dn(e){let t=Nn(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(kn)&&[t[1],t[3]].every(Un))return[[t[0],t[1]],[t[2],t[3]]]}function Ii(e){let t=Nn(e);return Array.isArray(t)&&t.length===3&&kn(t[0])&&Un(t[1])&&Pi(t[2])?t:null}function Vn(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function Un(e){return Number.isFinite(e)&&e<=90&&e>=-90}function kn(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Pi(e){return Number.isFinite(e)&&e>=0&&e<=22}function Nn(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var Ln={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 Fi(e={},t){let n=Cn(e.type),r={name:e.attribute,...n};return typeof e.min=="number"&&(r.min=e.min),typeof e.max=="number"&&(r.max=e.max),typeof e.count=="number"&&(r.uniqueValueCount=e.count),e.values&&(r.values=e.values),r.values&&typeof t.maxValues=="number"&&(r.values=r.values?.slice(0,t.maxValues)),r}function Cn(e){let t=e.toLowerCase();return!t||Ln[t],Ln[t]||{type:"string"}}var bi="4.2.0",Te={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:bi,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),r=JSON.parse(n),o={...Te.options.tilejson,...t?.tilejson};return Pt(r,o)},parseTextSync:(e,t)=>{let n=JSON.parse(e),r={...Te.options.tilejson,...t?.tilejson};return Pt(n,r)}};var be={};Ot(be,{Compression:()=>tr,EtagMismatch:()=>Ze,FetchSource:()=>or,FileSource:()=>is,PMTiles:()=>_t,Protocol:()=>qi,ResolvedValueCache:()=>as,SharedPromiseCache:()=>cr,TileType:()=>nr,bytesToHeader:()=>ir,findTile:()=>rr,getUint64:()=>V,leafletRasterLayer:()=>Xi,readVarint:()=>ae,tileIdToZxy:()=>rs,zxyToTileId:()=>er});var X=Math.pow,F=(e,t,n)=>new Promise((r,o)=>{var i=l=>{try{a(n.next(l))}catch(c){o(c)}},s=l=>{try{a(n.throw(l))}catch(c){o(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,s);a((n=n.apply(e,t)).next())}),S=Uint8Array,le=Uint16Array,Ei=Int32Array,zn=new S([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]),jn=new S([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]),Si=new S([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rn=function(e,t){for(var n=new le(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new Ei(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)o[i]=i-n[r]<<5|r;return{b:n,r:o}},Hn=Rn(zn,2),Zn=Hn.b,_i=Hn.r;Zn[28]=258,_i[258]=28;var Wn=Rn(jn,0),Bi=Wn.b,ec=Wn.r,Et=new le(32768);for(w=0;w<32768;++w)R=(w&43690)>>1|(w&21845)<<1,R=(R&52428)>>2|(R&13107)<<2,R=(R&61680)>>4|(R&3855)<<4,Et[w]=((R&65280)>>8|(R&255)<<8)>>1;var R,w,Pe=function(e,t,n){for(var r=e.length,o=0,i=new le(t);o<r;++o)e[o]&&++i[e[o]-1];var s=new le(t);for(o=1;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;var a;if(n){a=new le(1<<t);var l=15-t;for(o=0;o<r;++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[Et[u]>>l]=c}else for(a=new le(r),o=0;o<r;++o)e[o]&&(a[o]=Et[s[e[o]-1]++]>>15-e[o]);return a},Fe=new S(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,Jn=new S(32);for(w=0;w<32;++w)Jn[w]=5;var w,Ai=Pe(Fe,9,1),Di=Pe(Jn,5,1),Ft=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},C=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},bt=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Vi=function(e){return(e+7)/8|0},Li=function(e,t,n){(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new S(n-t);return r.set(e.subarray(t,n)),r},Mi=["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"],E=function(e,t,n){var r=new Error(t||Mi[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,E),!n)throw r;return r},Bt=function(e,t,n,r){var o=e.length,i=r?r.length:0;if(!o||t.f&&!t.l)return n||new S(0);var s=!n||t.i!=2,a=t.i;n||(n=new S(o*3));var l=function(kt){var Nt=n.length;if(kt>Nt){var Ct=new S(Math.max(Nt*2,kt));Ct.set(n),n=Ct}},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=C(e,f,1);var M=C(e,f+1,3);if(f+=3,M)if(M==1)h=Ai,d=Di,p=9,y=5;else if(M==2){var _=C(e,f,31)+257,O=C(e,f+10,15)+4,U=_+C(e,f+5,31)+1;f+=14;for(var b=new S(U),B=new S(19),A=0;A<O;++A)B[Si[A]]=C(e,f+A*3,7);f+=O*3;for(var Dt=Ft(B),ur=(1<<Dt)-1,hr=Pe(B,Dt,1),A=0;A<U;){var Vt=hr[C(e,f,ur)];f+=Vt&15;var v=Vt>>4;if(v<16)b[A++]=v;else{var Q=0,_e=0;for(v==16?(_e=3+C(e,f,3),f+=2,Q=b[A-1]):v==17?(_e=3+C(e,f,7),f+=3):v==18&&(_e=11+C(e,f,127),f+=7);_e--;)b[A++]=Q}}var Lt=b.subarray(0,_),k=b.subarray(_);p=Ft(Lt),y=Ft(k),h=Pe(Lt,p,1),d=Pe(k,y,1)}else E(1);else{var v=Vi(f)+4,m=e[v-4]|e[v-3]<<8,g=v+m;if(g>o){a&&E(0);break}s&&l(u+m),n.set(e.subarray(v,g),u),t.b=u+=m,t.p=f=g*8,t.f=c;continue}if(f>P){a&&E(0);break}}s&&l(u+131072);for(var dr=(1<<p)-1,pr=(1<<y)-1,Ke=f;;Ke=f){var Q=h[bt(e,f)&dr],q=Q>>4;if(f+=Q&15,f>P){a&&E(0);break}if(Q||E(2),q<256)n[u++]=q;else if(q==256){Ke=f,h=null;break}else{var Mt=q-254;if(q>264){var A=q-257,ce=zn[A];Mt=C(e,f,(1<<ce)-1)+Zn[A],f+=ce}var $e=d[bt(e,f)&pr],Ye=$e>>4;$e||E(3),f+=$e&15;var k=Bi[Ye];if(Ye>3){var ce=jn[Ye];k+=bt(e,f)&(1<<ce)-1,f+=ce}if(f>P){a&&E(0);break}s&&l(u+131072);var Xe=u+Mt;if(u<k){var Ut=i-k,gr=Math.min(k,Xe);for(Ut+u<0&&E(3);u<gr;++u)n[u]=r[Ut+u]}for(;u<Xe;u+=4)n[u]=n[u-k],n[u+1]=n[u+1-k],n[u+2]=n[u+2-k],n[u+3]=n[u+3-k];u=Xe}}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==n.length?n:Li(n,0,u)},Ui=new S(0),ki=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&E(6,"invalid gzip data");var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Ni=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ci=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&E(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&E(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function Oi(e,t){return Bt(e,{i:2},t&&t.out,t&&t.dictionary)}function Gi(e,t){var n=ki(e);return n+8>e.length&&E(6,"invalid gzip data"),Bt(e.subarray(n,-8),{i:2},t&&t.out||new S(Ni(e)),t&&t.dictionary)}function zi(e,t){return Bt(e.subarray(Ci(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?Gi(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Oi(e,t):zi(e,t)}var ji=typeof TextDecoder<"u"&&new TextDecoder,Ri=0;try{ji.decode(Ui,{stream:!0}),Ri=1}catch{}var Kn=(e,t)=>e*X(2,t),Ie=(e,t)=>Math.floor(e/X(2,t)),He=(e,t)=>Kn(e.getUint16(t+1,!0),8)+e.getUint8(t),$n=(e,t)=>Kn(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),Hi=(e,t,n,r,o)=>{if(e!==r.getUint8(o))return e-r.getUint8(o);let i=He(r,o+1);if(t!==i)return t-i;let s=He(r,o+4);return n!==s?n-s:0},Zi=(e,t,n,r)=>{let o=Yn(e,t|128,n,r);return o?{z:t,x:n,y:r,offset:o[0],length:o[1],isDir:!0}:null},On=(e,t,n,r)=>{let o=Yn(e,t,n,r);return o?{z:t,x:n,y:r,offset:o[0],length:o[1],isDir:!1}:null},Yn=(e,t,n,r)=>{let o=0,i=e.byteLength/17-1;for(;o<=i;){let s=i+o>>1,a=Hi(t,n,r,e,s*17);if(a>0)o=s+1;else if(a<0)i=s-1;else return[$n(e,s*17+7),e.getUint32(s*17+13,!0)]}return null},Wi=(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,Xn=(e,t)=>{let n=e.getUint8(t*17);return{z:n&127,x:He(e,t*17+1),y:He(e,t*17+4),offset:$n(e,t*17+7),length:e.getUint32(t*17+13,!0),isDir:n>>7===1}},Gn=e=>{let t=[],n=new DataView(e);for(let r=0;r<n.byteLength/17;r++)t.push(Xn(n,r));return Ji(t)},Ji=e=>{e.sort(Wi);let t=new ArrayBuffer(17*e.length),n=new Uint8Array(t);for(let r=0;r<e.length;r++){let o=e[r],i=o.z;o.isDir&&(i=i|128),n[r*17]=i,n[r*17+1]=o.x&255,n[r*17+2]=o.x>>8&255,n[r*17+3]=o.x>>16&255,n[r*17+4]=o.y&255,n[r*17+5]=o.y>>8&255,n[r*17+6]=o.y>>16&255,n[r*17+7]=o.offset&255,n[r*17+8]=Ie(o.offset,8)&255,n[r*17+9]=Ie(o.offset,16)&255,n[r*17+10]=Ie(o.offset,24)&255,n[r*17+11]=Ie(o.offset,32)&255,n[r*17+12]=Ie(o.offset,48)&255,n[r*17+13]=o.length&255,n[r*17+14]=o.length>>8&255,n[r*17+15]=o.length>>16&255,n[r*17+16]=o.length>>24&255}return t},Ki=(e,t)=>{if(e.byteLength<17)return null;let n=e.byteLength/17,r=Xn(e,n-1);if(r.isDir){let o=r.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 $i(e){return F(this,null,function*(){let t=yield e.getBytes(0,512e3),n=new DataView(t.data),r=n.getUint32(4,!0),o=n.getUint16(8,!0),i=new TextDecoder("utf-8"),s=JSON.parse(i.decode(new DataView(t.data,10,r))),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:n.getUint16(2,!0),rootDirectoryOffset:10+r,rootDirectoryLength:o*17,jsonMetadataOffset:10,jsonMetadataLength:r,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 Yi(e,t,n,r,o,i,s){return F(this,null,function*(){let a=yield n.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);e.specVersion===1&&(a=Gn(a));let l=On(new DataView(a),r,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=Ki(new DataView(a),{z:r,x:o,y:i});if(c){let f=Zi(new DataView(a),c.z,c.x,c.y);if(f){let u=yield n.getArrayBuffer(t,f.offset,f.length,e);e.specVersion===1&&(u=Gn(u));let h=On(new DataView(u),r,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 Qn={getHeader:$i,getZxy:Yi},Xi=(e,t)=>{let n=!1,r="",o=L.GridLayer.extend({createTile:(i,s)=>{let a=document.createElement("img"),l=new AbortController,c=l.signal;return a.cancel=()=>{l.abort()},n||(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?r="image/png":f.tileType===3?r="image/jpeg":f.tileType===4?r="image/webp":f.tileType===5&&(r="image/avif")}),n=!0),e.getZxy(i.z,i.x,i.y,c).then(f=>{if(f){let u=new Blob([f.data],{type:r}),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)},Qi=e=>(t,n)=>{if(n instanceof AbortController)return e(t,n);let r=new AbortController;return e(t,r).then(o=>n(void 0,o.data,o.cacheControl||"",o.expires||""),o=>n(o)).catch(o=>n(o)),{cancel:()=>r.abort()}},qi=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 _t(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 n=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),r=e.url.match(n);if(!r)throw new Error("Invalid PMTiles protocol URL");let o=r[1],i=this.tiles.get(o);i||(i=new _t(o),this.tiles.set(o,i));let s=r[2],a=r[3],l=r[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=Qi(this.tilev4),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function se(e,t){return(t>>>0)*4294967296+(e>>>0)}function es(e,t){let n=t.buf,r=n[t.pos++],o=(r&112)>>4;if(r<128||(r=n[t.pos++],o|=(r&127)<<3,r<128)||(r=n[t.pos++],o|=(r&127)<<10,r<128)||(r=n[t.pos++],o|=(r&127)<<17,r<128)||(r=n[t.pos++],o|=(r&127)<<24,r<128)||(r=n[t.pos++],o|=(r&1)<<31,r<128))return se(e,o);throw new Error("Expected varint not more than 10 bytes")}function ae(e){let t=e.buf,n=t[e.pos++],r=n&127;return n<128||(n=t[e.pos++],r|=(n&127)<<7,n<128)||(n=t[e.pos++],r|=(n&127)<<14,n<128)||(n=t[e.pos++],r|=(n&127)<<21,n<128)?r:(n=t[e.pos],r|=(n&15)<<28,es(r,e))}function qn(e,t,n,r){if(r===0){n===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 ts(e,t){let n=X(2,e),r=t,o=t,i=t,s=[0,0],a=1;for(;a<n;)r=1&i/2,o=1&(i^r),qn(a,s,r,o),s[0]+=a*r,s[1]+=a*o,i=i/4,a*=2;return[e,s[0],s[1]]}var ns=[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 er(e,t,n){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>X(2,e)-1||n>X(2,e)-1)throw Error("tile x/y outside zoom level bounds");let r=ns[e],o=X(2,e),i=0,s=0,a=0,l=[t,n],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),qn(c,l,i,s),c=c/2;return r+a}function rs(e){let t=0,n=0;for(let r=0;r<27;r++){let o=(1<<r)*(1<<r);if(t+o>e)return ts(r,e-t);t+=o}throw Error("Tile zoom level exceeds max safe number limit (26)")}var tr=(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))(tr||{});function At(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 n=new Response(e).body;if(!n)throw Error("Failed to read response stream");let r=n.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(r).arrayBuffer()}throw Error("Compression method not supported")})}var nr=(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))(nr||{}),os=127;function rr(e,t){let n=0,r=e.length-1;for(;n<=r;){let o=r+n>>1,i=t-e[o].tileId;if(i>0)n=o+1;else if(i<0)r=o-1;else return e[o]}return r>=0&&(e[r].runLength===0||t-e[r].tileId<e[r].runLength)?e[r]:null}var is=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()}})}},or=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,n,r){return F(this,null,function*(){let o,i;n?i=n:(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");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||r&&c&&c!==r)throw this.mustReload=!0,new Ze(r);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 V(e,t){let n=e.getUint32(t+4,!0),r=e.getUint32(t+0,!0);return n*X(2,32)+r}function ir(e,t){let n=new DataView(e),r=n.getUint8(7);if(r>3)throw Error(`Archive is spec version ${r} but this library supports up to spec version 3`);return{specVersion:r,rootDirectoryOffset:V(n,8),rootDirectoryLength:V(n,16),jsonMetadataOffset:V(n,24),jsonMetadataLength:V(n,32),leafDirectoryOffset:V(n,40),leafDirectoryLength:V(n,48),tileDataOffset:V(n,56),tileDataLength:V(n,64),numAddressedTiles:V(n,72),numTileEntries:V(n,80),numTileContents:V(n,88),clustered:n.getUint8(96)===1,internalCompression:n.getUint8(97),tileCompression:n.getUint8(98),tileType:n.getUint8(99),minZoom:n.getUint8(100),maxZoom:n.getUint8(101),minLon:n.getInt32(102,!0)/1e7,minLat:n.getInt32(106,!0)/1e7,maxLon:n.getInt32(110,!0)/1e7,maxLat:n.getInt32(114,!0)/1e7,centerZoom:n.getUint8(118),centerLon:n.getInt32(119,!0)/1e7,centerLat:n.getInt32(123,!0)/1e7,etag:t}}function sr(e){let t={buf:new Uint8Array(e),pos:0},n=ae(t),r=[],o=0;for(let i=0;i<n;i++){let s=ae(t);r.push({tileId:o+s,offset:0,length:0,runLength:1}),o+=s}for(let i=0;i<n;i++)r[i].runLength=ae(t);for(let i=0;i<n;i++)r[i].length=ae(t);for(let i=0;i<n;i++){let s=ae(t);s===0&&i>0?r[i].offset=r[i-1].offset+r[i-1].length:r[i].offset=s-1}return r}function ss(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 Ze=class extends Error{};function ar(e,t){return F(this,null,function*(){let n=yield e.getBytes(0,16384);if(new DataView(n.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(ss(n.data)<3)return[yield Qn.getHeader(e)];let o=n.data.slice(0,os),i=ir(o,n.etag),s=n.data.slice(i.rootDirectoryOffset,i.rootDirectoryOffset+i.rootDirectoryLength),a=`${e.getKey()}|${i.etag||""}|${i.rootDirectoryOffset}|${i.rootDirectoryLength}`,l=sr(yield t(s,i.internalCompression));return[i,[a,l.length,l]]})}function lr(e,t,n,r,o){return F(this,null,function*(){let i=yield e.getBytes(n,r,void 0,o.etag),s=yield t(i.data,o.internalCompression),a=sr(s);if(a.length===0)throw new Error("Empty directory is invalid");return a})}var as=class{constructor(e=100,t=!0,n=At){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=n}getHeader(e){return F(this,null,function*(){let t=e.getKey(),n=this.cache.get(t);if(n)return n.lastUsed=this.counter++,n.data;let r=yield ar(e,this.decompress);return r[1]&&this.cache.set(r[1][0],{lastUsed:this.counter++,data:r[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:r[0]}),this.prune(),r[0]})}getDirectory(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,i.data;let s=yield lr(e,this.decompress,t,n,r);return this.cache.set(o,{lastUsed:this.counter++,data:s}),this.prune(),s})}getArrayBuffer(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=yield e.getBytes(t,n,void 0,r.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((n,r)=>{n.lastUsed<e&&(e=n.lastUsed,t=r)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){this.cache.delete(e.getKey())})}},cr=class{constructor(e=100,t=!0,n=At){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=n}getHeader(e){return F(this,null,function*(){let t=e.getKey(),n=this.cache.get(t);if(n)return n.lastUsed=this.counter++,yield n.data;let r=new Promise((o,i)=>{ar(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:r}),r})}getDirectory(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=new Promise((a,l)=>{lr(e,this.decompress,t,n,r).then(c=>{a(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=new Promise((a,l)=>{e.getBytes(t,n,void 0,r.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((n,r)=>{n.lastUsed<e&&(e=n.lastUsed,t=r)}),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 n=new Promise((r,o)=>{this.getHeader(e).then(i=>{r(),this.invalidations.delete(t)}).catch(i=>{o(i)})});this.invalidations.set(t,n)})}},_t=class{constructor(e,t,n){typeof e=="string"?this.source=new or(e):this.source=e,n?this.decompress=n:this.decompress=At,t?this.cache=t:this.cache=new cr}getHeader(){return F(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,n,r){return F(this,null,function*(){let o=er(e,t,n),i=yield this.cache.getHeader(this.source);if(i.specVersion<3)return Qn.getZxy(i,this.source,this.cache,e,t,n,r);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=rr(c,o);if(f){if(f.runLength>0){let u=yield this.source.getBytes(i.tileDataOffset+f.offset,f.length,r,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,n,r){return F(this,null,function*(){try{return yield this.getZxyAttempt(e,t,n,r)}catch(o){if(o instanceof Ze)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,n,r);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),n=yield this.decompress(t.data,e.internalCompression),r=new TextDecoder("utf-8");return JSON.parse(r.decode(n))})}getMetadata(){return F(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof Ze)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}};var{TileType:Ee}=be;function fr(e,t,n,r){let o=t,i=null;if(o)try{let l=JSON.stringify(o);i=Te.parseTextSync?.(l,r)||null}catch(l){console.warn("PMTiles metadata could not be interpreted as TileJSON",l)}let s={};typeof i?.name=="string"&&(s.name=i.name),typeof i?.htmlAttribution=="string"&&(s.attributions=[i.htmlAttribution]);let a={...s,format:"pmtiles",formatVersion:e.specVersion,attributions:[],tileMIMEType:ls(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&&(a.tilejson=i),n?.includeFormatHeader&&(a.formatHeader=e,a.formatMetadata=a),a}function ls(e){switch(e){case Ee.Mvt:return"application/vnd.mapbox-vector-tile";case Ee.Png:return"image/png";case Ee.Jpeg:return"image/jpeg";case Ee.Webp:return"image/webp";case Ee.Avif:return"image/avif";default:return"application/octet-stream"}}var We=class{blob;key;constructor(t,n){this.blob=t,this.key=n}getKey(){return this.blob.url||""}async getBytes(t,n,r){return{data:await this.blob.slice(t,t+n).arrayBuffer()}}};var{PMTiles:cs}=be;var Je=class extends he{data;props;mimeType=null;pmtiles;metadata;constructor(t){super(t),this.props=t;let n=typeof t.url=="string"?it(t.url):new We(t.url,"pmtiles");this.data=t.url,this.pmtiles=new cs(n),this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata()}async getMetadata(){let t=await this.pmtiles.getHeader(),n=await this.pmtiles.getMetadata(),r=fr(t,n,{includeFormatHeader:!1},this.loadOptions);return this.props.attributions&&(r.attributions=[...this.props.attributions,...r.attributions||[]]),r?.tileMIMEType&&(this.mimeType=r?.tileMIMEType),r}async getTile(t){let{x:n,y:r,z:o}=t,s=(await this.pmtiles.getZxy(o,n,r))?.data;return s||null}async getTileData(t){let{x:n,y:r,z:o}=t.index;switch((await this.metadata).tileMIMEType){case"application/vnd.mapbox-vector-tile":return await this.getVectorTile({x:n,y:r,z:o,layers:[]});default:return await this.getImageTile({x:n,y:r,z:o,layers:[]})}}async getImageTile(t){let n=await this.getTile(t);return n?await ft.parse(n,this.loadOptions):null}async getVectorTile(t){let n=await this.getTile(t),r={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:t.x,y:t.y,z:t.z},...this.loadOptions?.mvt},...this.loadOptions};return n?await It.parse(n,r):null}};return Ir(Se);})();
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
ieee754/index.js:
|
package/dist/index.cjs
CHANGED
|
@@ -159,7 +159,7 @@ var PMTilesSource = class extends import_loader_utils.DataSource {
|
|
|
159
159
|
return metadata;
|
|
160
160
|
}
|
|
161
161
|
async getTile(tileParams) {
|
|
162
|
-
const { x, y,
|
|
162
|
+
const { x, y, z } = tileParams;
|
|
163
163
|
const rangeResponse = await this.pmtiles.getZxy(z, x, y);
|
|
164
164
|
const arrayBuffer = rangeResponse == null ? void 0 : rangeResponse.data;
|
|
165
165
|
if (!arrayBuffer) {
|
|
@@ -174,9 +174,9 @@ var PMTilesSource = class extends import_loader_utils.DataSource {
|
|
|
174
174
|
const metadata = await this.metadata;
|
|
175
175
|
switch (metadata.tileMIMEType) {
|
|
176
176
|
case "application/vnd.mapbox-vector-tile":
|
|
177
|
-
return await this.getVectorTile({ x, y,
|
|
177
|
+
return await this.getVectorTile({ x, y, z, layers: [] });
|
|
178
178
|
default:
|
|
179
|
-
return await this.getImageTile({ x, y,
|
|
179
|
+
return await this.getImageTile({ x, y, z, layers: [] });
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
// ImageTileSource interface implementation
|
|
@@ -192,7 +192,7 @@ var PMTilesSource = class extends import_loader_utils.DataSource {
|
|
|
192
192
|
shape: "geojson-table",
|
|
193
193
|
mvt: {
|
|
194
194
|
coordinates: "wgs84",
|
|
195
|
-
tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.
|
|
195
|
+
tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },
|
|
196
196
|
...(_a = this.loadOptions) == null ? void 0 : _a.mvt
|
|
197
197
|
},
|
|
198
198
|
...this.loadOptions
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.js", "pmtiles-source.js", "lib/parse-pmtiles.js", "lib/blob-source.js"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { PMTilesSource } from \"./pmtiles-source.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';\nexport const PMTilesService = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n options: {\n pmtiles: {}\n },\n createSource: (props) => new PMTilesSource(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 PMTilesSource extends DataSource {\n data;\n props;\n mimeType = null;\n pmtiles;\n metadata;\n constructor(props) {\n super(props);\n this.props = props;\n const url = typeof props.url === 'string' ? resolvePath(props.url) : new BlobSource(props.url, 'pmtiles');\n this.data = props.url;\n this.pmtiles = new PMTiles(url);\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\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,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,0BAAwC;AACxC,oBAA4B;AAC5B,IAAAA,cAA0B;AAC1B,IAAAC,WAAyB;;;ACHzB,iBAA+B;AAE/B,cAAyB;AACzB,IAAM,EAAE,SAAS,IAAI;AASd,SAAS,mBAAmB,QAAQ,YAAY,SAAS,aAAa;AAf7E;AAgBI,QAAM,kBAAkB;AAIxB,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;;;ACxEO,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;;;AFvBA,IAAM,EAAE,QAAQ,IAAIC;AAoBb,IAAM,gBAAN,cAA4B,+BAAW;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,YAAY,OAAO;AACf,UAAM,KAAK;AACX,SAAK,QAAQ;AACb,UAAM,MAAM,OAAO,MAAM,QAAQ,eAAW,iCAAY,MAAM,GAAG,IAAI,IAAI,WAAW,MAAM,KAAK,SAAS;AACxG,SAAK,OAAO,MAAM;AAClB,SAAK,UAAU,IAAI,QAAQ,GAAG;AAC9B,SAAK,cAAc,KAAK,YAAY,KAAK,IAAI;AAC7C,SAAK,WAAW,KAAK,YAAY;AAAA,EACrC;AAAA,EACA,MAAM,cAAc;AAChB,UAAM,gBAAgB,MAAM,KAAK,QAAQ,UAAU;AACnD,UAAM,kBAAkB,MAAM,KAAK,QAAQ,YAAY;AACvD,UAAM,WAAW,mBAAmB,eAAe,iBAAiB,EAAE,qBAAqB,MAAM,GAAG,KAAK,WAAW;AAEpH,QAAI,KAAK,MAAM,cAAc;AACzB,eAAS,eAAe,CAAC,GAAG,KAAK,MAAM,cAAc,GAAI,SAAS,gBAAgB,CAAC,CAAE;AAAA,IACzF;AACA,QAAI,qCAAU,cAAc;AACxB,WAAK,WAAW,qCAAU;AAAA,IAC9B;AAEA,WAAO;AAAA,EACX;AAAA,EACA,MAAM,QAAQ,YAAY;AACtB,UAAM,EAAE,GAAG,GAAG,
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { PMTilesSource } from \"./pmtiles-source.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';\nexport const PMTilesService = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n options: {\n pmtiles: {}\n },\n createSource: (props) => new PMTilesSource(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 PMTilesSource extends DataSource {\n data;\n props;\n mimeType = null;\n pmtiles;\n metadata;\n constructor(props) {\n super(props);\n this.props = props;\n const url = typeof props.url === 'string' ? resolvePath(props.url) : new BlobSource(props.url, 'pmtiles');\n this.data = props.url;\n this.pmtiles = new PMTiles(url);\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\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, pmmetadata, options, loadOptions) {\n const pmtilesMetadata = pmmetadata;\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,0BAAwC;AACxC,oBAA4B;AAC5B,IAAAA,cAA0B;AAC1B,IAAAC,WAAyB;;;ACHzB,iBAA+B;AAE/B,cAAyB;AACzB,IAAM,EAAE,SAAS,IAAI;AASd,SAAS,mBAAmB,QAAQ,YAAY,SAAS,aAAa;AAf7E;AAgBI,QAAM,kBAAkB;AAIxB,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;;;ACxEO,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;;;AFvBA,IAAM,EAAE,QAAQ,IAAIC;AAoBb,IAAM,gBAAN,cAA4B,+BAAW;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,YAAY,OAAO;AACf,UAAM,KAAK;AACX,SAAK,QAAQ;AACb,UAAM,MAAM,OAAO,MAAM,QAAQ,eAAW,iCAAY,MAAM,GAAG,IAAI,IAAI,WAAW,MAAM,KAAK,SAAS;AACxG,SAAK,OAAO,MAAM;AAClB,SAAK,UAAU,IAAI,QAAQ,GAAG;AAC9B,SAAK,cAAc,KAAK,YAAY,KAAK,IAAI;AAC7C,SAAK,WAAW,KAAK,YAAY;AAAA,EACrC;AAAA,EACA,MAAM,cAAc;AAChB,UAAM,gBAAgB,MAAM,KAAK,QAAQ,UAAU;AACnD,UAAM,kBAAkB,MAAM,KAAK,QAAQ,YAAY;AACvD,UAAM,WAAW,mBAAmB,eAAe,iBAAiB,EAAE,qBAAqB,MAAM,GAAG,KAAK,WAAW;AAEpH,QAAI,KAAK,MAAM,cAAc;AACzB,eAAS,eAAe,CAAC,GAAG,KAAK,MAAM,cAAc,GAAI,SAAS,gBAAgB,CAAC,CAAE;AAAA,IACzF;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;AApFpC;AAqFQ,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;",
|
|
6
6
|
"names": ["import_mvt", "pmtiles", "pmtiles"]
|
|
7
7
|
}
|
package/dist/pmtiles-source.js
CHANGED
|
@@ -55,7 +55,7 @@ export class PMTilesSource extends DataSource {
|
|
|
55
55
|
return metadata;
|
|
56
56
|
}
|
|
57
57
|
async getTile(tileParams) {
|
|
58
|
-
const { x, y,
|
|
58
|
+
const { x, y, z } = tileParams;
|
|
59
59
|
const rangeResponse = await this.pmtiles.getZxy(z, x, y);
|
|
60
60
|
const arrayBuffer = rangeResponse?.data;
|
|
61
61
|
if (!arrayBuffer) {
|
|
@@ -71,9 +71,9 @@ export class PMTilesSource extends DataSource {
|
|
|
71
71
|
const metadata = await this.metadata;
|
|
72
72
|
switch (metadata.tileMIMEType) {
|
|
73
73
|
case 'application/vnd.mapbox-vector-tile':
|
|
74
|
-
return await this.getVectorTile({ x, y,
|
|
74
|
+
return await this.getVectorTile({ x, y, z, layers: [] });
|
|
75
75
|
default:
|
|
76
|
-
return await this.getImageTile({ x, y,
|
|
76
|
+
return await this.getImageTile({ x, y, z, layers: [] });
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
// ImageTileSource interface implementation
|
|
@@ -88,7 +88,7 @@ export class PMTilesSource extends DataSource {
|
|
|
88
88
|
shape: 'geojson-table',
|
|
89
89
|
mvt: {
|
|
90
90
|
coordinates: 'wgs84',
|
|
91
|
-
tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.
|
|
91
|
+
tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },
|
|
92
92
|
...this.loadOptions?.mvt
|
|
93
93
|
},
|
|
94
94
|
...this.loadOptions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/pmtiles",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-alpha.1",
|
|
4
4
|
"description": "Framework-independent loader for the pmtiles format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@loaders.gl/images": "4.
|
|
50
|
-
"@loaders.gl/loader-utils": "4.
|
|
51
|
-
"@loaders.gl/mvt": "4.
|
|
52
|
-
"@loaders.gl/schema": "4.
|
|
49
|
+
"@loaders.gl/images": "4.3.0-alpha.1",
|
|
50
|
+
"@loaders.gl/loader-utils": "4.3.0-alpha.1",
|
|
51
|
+
"@loaders.gl/mvt": "4.3.0-alpha.1",
|
|
52
|
+
"@loaders.gl/schema": "4.3.0-alpha.1",
|
|
53
53
|
"pmtiles": "^3.0.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@loaders.gl/core": "^4.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "568446ea69eb590f0c42d965459b636216cda74e"
|
|
59
59
|
}
|
package/src/pmtiles-source.ts
CHANGED
|
@@ -96,7 +96,7 @@ export class PMTilesSource extends DataSource implements ImageTileSource, Vector
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
async getTile(tileParams: GetTileParameters): Promise<ArrayBuffer | null> {
|
|
99
|
-
const {x, y,
|
|
99
|
+
const {x, y, z} = tileParams;
|
|
100
100
|
const rangeResponse = await this.pmtiles.getZxy(z, x, y);
|
|
101
101
|
const arrayBuffer = rangeResponse?.data;
|
|
102
102
|
if (!arrayBuffer) {
|
|
@@ -114,9 +114,9 @@ export class PMTilesSource extends DataSource implements ImageTileSource, Vector
|
|
|
114
114
|
const metadata = await this.metadata;
|
|
115
115
|
switch (metadata.tileMIMEType) {
|
|
116
116
|
case 'application/vnd.mapbox-vector-tile':
|
|
117
|
-
return await this.getVectorTile({x, y,
|
|
117
|
+
return await this.getVectorTile({x, y, z, layers: []});
|
|
118
118
|
default:
|
|
119
|
-
return await this.getImageTile({x, y,
|
|
119
|
+
return await this.getImageTile({x, y, z, layers: []});
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -135,7 +135,7 @@ export class PMTilesSource extends DataSource implements ImageTileSource, Vector
|
|
|
135
135
|
shape: 'geojson-table',
|
|
136
136
|
mvt: {
|
|
137
137
|
coordinates: 'wgs84',
|
|
138
|
-
tileIndex: {x: tileParams.x, y: tileParams.y, z: tileParams.
|
|
138
|
+
tileIndex: {x: tileParams.x, y: tileParams.y, z: tileParams.z},
|
|
139
139
|
...(this.loadOptions as MVTLoaderOptions)?.mvt
|
|
140
140
|
},
|
|
141
141
|
...this.loadOptions
|