- ui.js Map.create: Basemap-Swap OSM-Raster→PMTiles-Vektorlayer hinter Flag 'by_vector_map' (?vectormap=1/0). Leaflet+markercluster+Marker unverändert, sauberer Raster-Fallback bei Fehler. Attribution Pflicht eingeblendet. - map-vector.js: protomaps-leaflet paintRules/labelRules für OpenMapTiles-Schema (Light+Dark), Labels per Canvas-Text → keine Glyphs nötig. Quelle /tiles/dach.pmtiles. - protomaps-leaflet 4.0.1 vendored. - Makefile: 'make tiles' (download→merge -H+time-filter dedup→planetiler) + 'make tiles-deploy' (atomarer Swap, ENV=prod für Produktion).
9 lines
No EOL
98 KiB
JavaScript
9 lines
No EOL
98 KiB
JavaScript
"use strict";var protomapsL=(()=>{var Ve=Object.defineProperty;var pi=Object.getOwnPropertyDescriptor;var bi=Object.getOwnPropertyNames;var xi=Object.prototype.hasOwnProperty;var D=Math.pow;var l=(i,e)=>Ve(i,"name",{value:e,configurable:!0});var yi=(i,e)=>{for(var t in e)Ve(i,t,{get:e[t],enumerable:!0})},wi=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of bi(e))!xi.call(i,r)&&r!==t&&Ve(i,r,{get:()=>e[r],enumerable:!(n=pi(e,r))||n.enumerable});return i};var _i=i=>wi(Ve({},"__esModule",{value:!0}),i);var A=(i,e,t)=>new Promise((n,r)=>{var s=c=>{try{o(t.next(c))}catch(u){r(u)}},a=c=>{try{o(t.throw(c))}catch(u){r(u)}},o=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,a);o((t=t.apply(i,e)).next())});var ms={};yi(ms,{CenteredSymbolizer:()=>Ge,CenteredTextSymbolizer:()=>W,CircleSymbolizer:()=>Te,FlexSymbolizer:()=>jt,Font:()=>fs,GeomType:()=>Dt,GroupSymbolizer:()=>Le,IconSymbolizer:()=>Ot,Index:()=>st,Justify:()=>ei,Labeler:()=>de,Labelers:()=>me,LineLabelPlacement:()=>ii,LineLabelSymbolizer:()=>Z,LineSymbolizer:()=>R,OffsetSymbolizer:()=>Qe,OffsetTextSymbolizer:()=>Se,Padding:()=>Et,PmtilesSource:()=>ue,PolygonSymbolizer:()=>C,Sheet:()=>dn,ShieldSymbolizer:()=>It,Static:()=>un,TextPlacements:()=>ti,TextSymbolizer:()=>Me,TileCache:()=>Pe,View:()=>rt,ZxySource:()=>ze,arr:()=>$r,covering:()=>oi,createPattern:()=>Ur,exp:()=>X,getZoom:()=>cn,isCcw:()=>Jn,isInRing:()=>Ct,labelRules:()=>Ce,leafletLayer:()=>hs,linear:()=>et,paint:()=>Ee,paintRules:()=>Fe,pointInPolygon:()=>Kn,pointMinDistToLines:()=>Qn,pointMinDistToPoints:()=>Gn,sourcesToViews:()=>je,step:()=>Wr,toIndex:()=>q,transformGeom:()=>Ie,wrap:()=>Oe});function y(i,e){this.x=i,this.y=e}l(y,"Point");y.prototype={clone(){return new y(this.x,this.y)},add(i){return this.clone()._add(i)},sub(i){return this.clone()._sub(i)},multByPoint(i){return this.clone()._multByPoint(i)},divByPoint(i){return this.clone()._divByPoint(i)},mult(i){return this.clone()._mult(i)},div(i){return this.clone()._div(i)},rotate(i){return this.clone()._rotate(i)},rotateAround(i,e){return this.clone()._rotateAround(i,e)},matMult(i){return this.clone()._matMult(i)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(i){return this.x===i.x&&this.y===i.y},dist(i){return Math.sqrt(this.distSqr(i))},distSqr(i){let e=i.x-this.x,t=i.y-this.y;return e*e+t*t},angle(){return Math.atan2(this.y,this.x)},angleTo(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith(i){return this.angleWithSep(i.x,i.y)},angleWithSep(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult(i){let e=i[0]*this.x+i[1]*this.y,t=i[2]*this.x+i[3]*this.y;return this.x=e,this.y=t,this},_add(i){return this.x+=i.x,this.y+=i.y,this},_sub(i){return this.x-=i.x,this.y-=i.y,this},_mult(i){return this.x*=i,this.y*=i,this},_div(i){return this.x/=i,this.y/=i,this},_multByPoint(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint(i){return this.x/=i.x,this.y/=i.y,this},_unit(){return this._div(this.mag()),this},_perp(){let i=this.y;return this.y=this.x,this.x=-i,this},_rotate(i){let e=Math.cos(i),t=Math.sin(i),n=e*this.x-t*this.y,r=t*this.x+e*this.y;return this.x=n,this.y=r,this},_rotateAround(i,e){let t=Math.cos(i),n=Math.sin(i),r=e.x+t*(this.x-e.x)-n*(this.y-e.y),s=e.y+n*(this.x-e.x)+t*(this.y-e.y);return this.x=r,this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:y};y.convert=function(i){if(i instanceof y)return i;if(Array.isArray(i))return new y(+i[0],+i[1]);if(i.x!==void 0&&i.y!==void 0)return new y(+i.x,+i.y);throw new Error("Expected [x, y] or {x, y} point format")};function Q(i,e,t){return Math.min(Math.max(i,t),e)}l(Q,"guard");var ht=class ht extends Error{constructor(e){super(`Failed to parse color: "${e}"`)}};l(ht,"ColorError");var ut=ht,pe=ut;function vn(i){if(typeof i!="string")throw new pe(i);if(i.trim().toLowerCase()==="transparent")return[0,0,0,0];let e=i.trim();e=Si.test(i)?zi(i):i;let t=Pi.exec(e);if(t){let a=Array.from(t).slice(1);return[...a.slice(0,3).map(o=>parseInt(be(o,2),16)),parseInt(be(a[3]||"f",2),16)/255]}let n=Ti.exec(e);if(n){let a=Array.from(n).slice(1);return[...a.slice(0,3).map(o=>parseInt(o,16)),parseInt(a[3]||"ff",16)/255]}let r=Li.exec(e);if(r){let a=Array.from(r).slice(1);return[...a.slice(0,3).map(o=>parseInt(o,10)),parseFloat(a[3]||"1")]}let s=Mi.exec(e);if(s){let[a,o,c,u]=Array.from(s).slice(1).map(parseFloat);if(Q(0,100,o)!==o)throw new pe(i);if(Q(0,100,c)!==c)throw new pe(i);return[...Fi(a,o,c),Number.isNaN(u)?1:u]}throw new pe(i)}l(vn,"parseToRgba");function vi(i){let e=5381,t=i.length;for(;t;)e=e*33^i.charCodeAt(--t);return(e>>>0)%2341}l(vi,"hash");var kn=l(i=>parseInt(i.replace(/_/g,""),36),"colorToInt"),ki="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((i,e)=>{let t=kn(e.substring(0,3)),n=kn(e.substring(3)).toString(16),r="";for(let s=0;s<6-n.length;s++)r+="0";return i[t]=`${r}${n}`,i},{});function zi(i){let e=i.toLowerCase().trim(),t=ki[vi(e)];if(!t)throw new pe(i);return`#${t}`}l(zi,"nameToHex");var be=l((i,e)=>Array.from(Array(e)).map(()=>i).join(""),"r"),Pi=new RegExp(`^#${be("([a-f0-9])",3)}([a-f0-9])?$`,"i"),Ti=new RegExp(`^#${be("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),Li=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${be(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Mi=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,Si=/^[a-z]+$/i,zn=l(i=>Math.round(i*255),"roundColor"),Fi=l((i,e,t)=>{let n=t/100;if(e===0)return[n,n,n].map(zn);let r=(i%360+360)%360/60,s=(1-Math.abs(2*n-1))*(e/100),a=s*(1-Math.abs(r%2-1)),o=0,c=0,u=0;r>=0&&r<1?(o=s,c=a):r>=1&&r<2?(o=a,c=s):r>=2&&r<3?(c=s,u=a):r>=3&&r<4?(c=a,u=s):r>=4&&r<5?(o=a,u=s):r>=5&&r<6&&(o=s,u=a);let h=n-s/2,f=o+h,d=c+h,m=u+h;return[f,d,m].map(zn)},"hslToRgb");function Ci(i,e,t,n){return`rgba(${Q(0,255,i).toFixed()}, ${Q(0,255,e).toFixed()}, ${Q(0,255,t).toFixed()}, ${parseFloat(Q(0,1,n).toFixed(3))})`}l(Ci,"rgba");function Ue(i,e,t){let n=l((b,T)=>T===3?b:b/255,"normalize"),[r,s,a,o]=vn(i).map(n),[c,u,h,f]=vn(e).map(n),d=f-o,m=t*2-1,x=((m*d===-1?m:m+d/(1+m*d))+1)/2,w=1-x,k=(r*w+c*x)*255,p=(s*w+u*x)*255,_=(a*w+h*x)*255,S=f*t+o*(1-t);return Ci(k,p,_,S)}l(Ue,"mix");var ft=class ft{constructor(e,t){this.str=e!=null?e:t,this.perFeature=typeof this.str=="function"&&this.str.length===2}get(e,t){return typeof this.str=="function"?this.str(e,t):this.str}};l(ft,"StringAttr");var B=ft,dt=class dt{constructor(e,t=1){this.value=e!=null?e:t,this.perFeature=typeof this.value=="function"&&this.value.length===2}get(e,t){return typeof this.value=="function"?this.value(e,t):this.value}};l(dt,"NumberAttr");var M=dt,mt=class mt{constructor(e){var t;this.labelProps=(t=e==null?void 0:e.labelProps)!=null?t:["name"],this.textTransform=e==null?void 0:e.textTransform}get(e,t){let n,r;typeof this.labelProps=="function"?r=this.labelProps(e,t):r=this.labelProps;for(let a of r)if(Object.prototype.hasOwnProperty.call(t.props,a)&&typeof t.props[a]=="string"){n=t.props[a];break}let s;return typeof this.textTransform=="function"?s=this.textTransform(e,t):s=this.textTransform,n&&s==="uppercase"?n=n.toUpperCase():n&&s==="lowercase"?n=n.toLowerCase():n&&s==="capitalize"&&(n=n.toLowerCase().split(" ").map(c=>c[0].toUpperCase()+c.slice(1)).join(" ")),n}};l(mt,"TextAttr");var ee=mt,gt=class gt{constructor(e){var t,n;e!=null&&e.font?this.font=e.font:(this.family=(t=e==null?void 0:e.fontFamily)!=null?t:"sans-serif",this.size=(n=e==null?void 0:e.fontSize)!=null?n:12,this.weight=e==null?void 0:e.fontWeight,this.style=e==null?void 0:e.fontStyle)}get(e,t){if(this.font)return typeof this.font=="function"?this.font(e,t):this.font;let n="";this.style&&(typeof this.style=="function"?n=`${this.style(e,t)} `:n=`${this.style} `);let r="";this.weight&&(typeof this.weight=="function"?r=`${this.weight(e,t)} `:r=`${this.weight} `);let s;typeof this.size=="function"?s=this.size(e,t):s=this.size;let a;return typeof this.family=="function"?a=this.family(e,t):a=this.family,`${n}${r}${s}px ${a}`}};l(gt,"FontAttr");var te=gt,pt=class pt{constructor(e,t=[]){this.value=e!=null?e:t,this.perFeature=typeof this.value=="function"&&this.value.length===2}get(e,t){return typeof this.value=="function"?this.value(e,t):this.value}};l(pt,"ArrayAttr");var $e=pt;var Di=l((i,e,t)=>{let n=[],r,s,a,o=0,c=0,u=0,h=0,f=0,d=0,m=0,g=0,x=0,w=0,k=0,p=0;if(i.length<2)return[];if(i.length===2)return u=Math.sqrt(D(i[1].x-i[0].x,2)+D(i[1].y-i[0].y,2)),[{length:u,beginIndex:0,beginDistance:0,endIndex:2,endDistance:u}];for(h=Math.sqrt(D(i[1].x-i[0].x,2)+D(i[1].y-i[0].y,2)),o=1,c=i.length-1;o<c;o++)r=i[o-1],s=i[o],a=i[o+1],d=s.x-r.x,m=s.y-r.y,g=a.x-s.x,x=a.y-s.y,f=Math.sqrt(g*g+x*x),u+=h,w=Math.acos((d*g+m*x)/(h*f)),(w>e||u-p>t)&&(n.push({length:u-p,beginDistance:p,beginIndex:k,endIndex:o+1,endDistance:u}),k=o,p=u),h=f;return o-k>0&&n.push({length:u-p+f,beginIndex:k,beginDistance:p,endIndex:o+1,endDistance:u+f}),n},"linelabel");function Pn(i,e,t,n){let r=[];for(let s of i){let a=Di(s,Math.PI/45,e);for(let o of a)if(o.length>=e+n){let c=new y(s[o.beginIndex].x,s[o.beginIndex].y),u=s[o.endIndex-1],h=new y((u.x-c.x)/o.length,(u.y-c.y)/o.length);for(let f=n;f<o.length-e;f+=t)r.push({start:c.add(h.mult(f)),end:c.add(h.mult(f+e))})}}return r}l(Pn,"simpleLabel");function Tn(i,e,t,n){let r=e.x-i.x,s=e.y-i.y,a=Math.sqrt(D(e.x-i.x,2)+D(e.y-i.y,2)),o=[];for(let c=0;c<t+n;c+=2*n){let u=c*1/a;o.push({x:i.x+u*r,y:i.y+u*s})}return o}l(Tn,"lineCells");function bt(i,e){if(i.length<=e)return[i];let t=e-1,n=i.lastIndexOf(" ",t),r=i.indexOf(" ",t);if(n===-1&&r===-1)return[i];let s,a;return r===-1||n>=0&&t-n<r-t?(s=i.substring(0,n),a=i.substring(n+1,i.length)):(s=i.substring(0,r),a=i.substring(r+1,i.length)),[s,...bt(a,e)]}l(bt,"linebreak");var Ai="\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DB5\u4E00-\u9FEA\uF900-\uFA6D\uFA70-\uFAD9\u2000",Ps=new RegExp(`^[${Ai}]+$`);var yt=class yt{constructor(e,t,n,r,s){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=s,e.readFields(Bi,this,t)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,n=[],r,s=1,a=0,o=0,c=0;for(;e.pos<t;){if(a<=0){let u=e.readVarint();s=u&7,a=u>>3}if(a--,s===1||s===2)o+=e.readSVarint(),c+=e.readSVarint(),s===1&&(r&&n.push(r),r=[]),r&&r.push(new y(o,c));else if(s===7)r&&r.push(r[0].clone());else throw new Error(`unknown command ${s}`)}return r&&n.push(r),n}bbox(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,n=1,r=0,s=0,a=0,o=1/0,c=-1/0,u=1/0,h=-1/0;for(;e.pos<t;){if(r<=0){let f=e.readVarint();n=f&7,r=f>>3}if(r--,n===1||n===2)s+=e.readSVarint(),a+=e.readSVarint(),s<o&&(o=s),s>c&&(c=s),a<u&&(u=a),a>h&&(h=a);else if(n!==7)throw new Error(`unknown command ${n}`)}return[o,u,c,h]}toGeoJSON(e,t,n){let r=this.extent*Math.pow(2,n),s=this.extent*e,a=this.extent*t,o=this.loadGeometry();function c(d){return[(d.x+s)*360/r-180,360/Math.PI*Math.atan(Math.exp((1-(d.y+a)*2/r)*Math.PI))-90]}l(c,"projectPoint");function u(d){return d.map(c)}l(u,"projectLine");let h;if(this.type===1){let d=[];for(let g of o)d.push(g[0]);let m=u(d);h=d.length===1?{type:"Point",coordinates:m[0]}:{type:"MultiPoint",coordinates:m}}else if(this.type===2){let d=o.map(u);h=d.length===1?{type:"LineString",coordinates:d[0]}:{type:"MultiLineString",coordinates:d}}else if(this.type===3){let d=Oi(o),m=[];for(let g of d)m.push(g.map(u));h=m.length===1?{type:"Polygon",coordinates:m[0]}:{type:"MultiPolygon",coordinates:m}}else throw new Error("unknown feature type");let f={type:"Feature",geometry:h,properties:this.properties};return this.id!=null&&(f.id=this.id),f}};l(yt,"VectorTileFeature");var He=yt;He.types=["Unknown","Point","LineString","Polygon"];function Bi(i,e,t){i===1?e.id=t.readVarint():i===2?Ri(t,e):i===3?e.type=t.readVarint():i===4&&(e._geometry=t.pos)}l(Bi,"readFeature");function Ri(i,e){let t=i.readVarint()+i.pos;for(;i.pos<t;){let n=e._keys[i.readVarint()],r=e._values[i.readVarint()];e.properties[n]=r}}l(Ri,"readTag");function Oi(i){let e=i.length;if(e<=1)return[i];let t=[],n,r;for(let s=0;s<e;s++){let a=Ii(i[s]);a!==0&&(r===void 0&&(r=a<0),r===a<0?(n&&t.push(n),n=[i[s]]):n&&n.push(i[s]))}return n&&t.push(n),t}l(Oi,"classifyRings");function Ii(i){let e=0;for(let t=0,n=i.length,r=n-1,s,a;t<n;r=t++)s=i[t],a=i[r],e+=(a.x-s.x)*(s.y+a.y);return e}l(Ii,"signedArea");var wt=class wt{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(ji,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new He(this._pbf,t,this.extent,this._keys,this._values)}};l(wt,"VectorTileLayer");var xt=wt;function ji(i,e,t){i===15?e.version=t.readVarint():i===1?e.name=t.readString():i===5?e.extent=t.readVarint():i===2?e._features.push(t.pos):i===3?e._keys.push(t.readString()):i===4&&e._values.push(Ei(t))}l(ji,"readLayer");function Ei(i){let e=null,t=i.readVarint()+i.pos;for(;i.pos<t;){let n=i.readVarint()>>3;e=n===1?i.readString():n===2?i.readFloat():n===3?i.readDouble():n===4?i.readVarint64():n===5?i.readVarint():n===6?i.readSVarint():n===7?i.readBoolean():null}return e}l(Ei,"readValueMessage");var _t=class _t{constructor(e,t){this.layers=e.readFields(Xi,{},t)}};l(_t,"VectorTile");var Ne=_t;function Xi(i,e,t){if(i===3){let n=new xt(t,t.readVarint()+t.pos);n.length&&(e[n.name]=n)}}l(Xi,"readTile");var Ln=23283064365386963e-26,Yi=12,Mn=typeof TextDecoder=="undefined"?null:new TextDecoder("utf-8"),vt=0,qe=1,xe=2,We=5,kt=class kt{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){let r=this.readVarint(),s=r>>3,a=this.pos;this.type=r&7,e(s,t,this),this.pos===a&&this.skip(r)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*4294967296;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*4294967296;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let 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,Vi(n,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){let e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=Yi&&Mn?Mn.decode(this.buf.subarray(t,e)):tr(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===xe?this.readVarint()+this.pos:this.pos+1}skip(e){let t=e&7;if(t===vt)for(;this.buf[this.pos++]>127;);else if(t===xe)this.pos=this.readVarint()+this.pos;else if(t===We)this.pos+=4;else if(t===qe)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){let n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.dataView=new DataView(n.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Ln),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Ln),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){Ui(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(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;let t=this.pos;this.pos=nr(this.buf,e,this.pos);let n=this.pos-t;n>=128&&Sn(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;let n=this.pos;e(t,this);let r=this.pos-n;r>=128&&Sn(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,n){this.writeTag(e,xe),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Ni,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,qi,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Ji,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Wi,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Zi,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Ki,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Gi,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Qi,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,er,t)}writeBytesField(e,t){this.writeTag(e,xe),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,We),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,We),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,qe),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,qe),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,vt),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,vt),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,xe),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,We),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,qe),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}};l(kt,"Pbf");var ye=kt;function Vi(i,e,t){let n=t.buf,r,s;if(s=n[t.pos++],r=(s&112)>>4,s<128||(s=n[t.pos++],r|=(s&127)<<3,s<128)||(s=n[t.pos++],r|=(s&127)<<10,s<128)||(s=n[t.pos++],r|=(s&127)<<17,s<128)||(s=n[t.pos++],r|=(s&127)<<24,s<128)||(s=n[t.pos++],r|=(s&1)<<31,s<128))return ne(i,r,e);throw new Error("Expected varint not more than 10 bytes")}l(Vi,"readVarintRemainder");function ne(i,e,t){return t?e*4294967296+(i>>>0):(e>>>0)*4294967296+(i>>>0)}l(ne,"toNum");function Ui(i,e){let t,n;if(i>=0?(t=i%4294967296|0,n=i/4294967296|0):(t=~(-i%4294967296),n=~(-i/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),$i(t,n,e),Hi(n,e)}l(Ui,"writeBigVarint");function $i(i,e,t){t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos++]=i&127|128,i>>>=7,t.buf[t.pos]=i&127}l($i,"writeBigVarintLow");function Hi(i,e){let t=(i&7)<<4;e.buf[e.pos++]|=t|((i>>>=3)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127|((i>>>=7)?128:0),i&&(e.buf[e.pos++]=i&127)))))}l(Hi,"writeBigVarintHigh");function Sn(i,e,t){let n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(let r=t.pos-1;r>=i;r--)t.buf[r+n]=t.buf[r]}l(Sn,"makeRoomForExtraLength");function Ni(i,e){for(let t=0;t<i.length;t++)e.writeVarint(i[t])}l(Ni,"writePackedVarint");function qi(i,e){for(let t=0;t<i.length;t++)e.writeSVarint(i[t])}l(qi,"writePackedSVarint");function Wi(i,e){for(let t=0;t<i.length;t++)e.writeFloat(i[t])}l(Wi,"writePackedFloat");function Zi(i,e){for(let t=0;t<i.length;t++)e.writeDouble(i[t])}l(Zi,"writePackedDouble");function Ji(i,e){for(let t=0;t<i.length;t++)e.writeBoolean(i[t])}l(Ji,"writePackedBoolean");function Ki(i,e){for(let t=0;t<i.length;t++)e.writeFixed32(i[t])}l(Ki,"writePackedFixed32");function Gi(i,e){for(let t=0;t<i.length;t++)e.writeSFixed32(i[t])}l(Gi,"writePackedSFixed32");function Qi(i,e){for(let t=0;t<i.length;t++)e.writeFixed64(i[t])}l(Qi,"writePackedFixed64");function er(i,e){for(let t=0;t<i.length;t++)e.writeSFixed64(i[t])}l(er,"writePackedSFixed64");function tr(i,e,t){let n="",r=e;for(;r<t;){let s=i[r],a=null,o=s>239?4:s>223?3:s>191?2:1;if(r+o>t)break;let c,u,h;o===1?s<128&&(a=s):o===2?(c=i[r+1],(c&192)===128&&(a=(s&31)<<6|c&63,a<=127&&(a=null))):o===3?(c=i[r+1],u=i[r+2],(c&192)===128&&(u&192)===128&&(a=(s&15)<<12|(c&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):o===4&&(c=i[r+1],u=i[r+2],h=i[r+3],(c&192)===128&&(u&192)===128&&(h&192)===128&&(a=(s&15)<<18|(c&63)<<12|(u&63)<<6|h&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,o=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),r+=o}return n}l(tr,"readUtf8");function nr(i,e,t){for(let n=0,r,s;n<e.length;n++){if(r=e.charCodeAt(n),r>55295&&r<57344)if(s)if(r<56320){i[t++]=239,i[t++]=191,i[t++]=189,s=r;continue}else r=s-55296<<10|r-56320|65536,s=null;else{r>56319||n+1===e.length?(i[t++]=239,i[t++]=191,i[t++]=189):s=r;continue}else s&&(i[t++]=239,i[t++]=191,i[t++]=189,s=null);r<128?i[t++]=r:(r<2048?i[t++]=r>>6|192:(r<65536?i[t++]=r>>12|224:(i[t++]=r>>18|240,i[t++]=r>>12&63|128),i[t++]=r>>6&63|128),i[t++]=r&63|128)}return t}l(nr,"writeUtf8");var se=Math.pow,I=l((i,e,t)=>new Promise((n,r)=>{var s=l(c=>{try{o(t.next(c))}catch(u){r(u)}},"fulfilled"),a=l(c=>{try{o(t.throw(c))}catch(u){r(u)}},"rejected"),o=l(c=>c.done?n(c.value):Promise.resolve(c.value).then(s,a),"step");o((t=t.apply(i,e)).next())}),"__async"),E=Uint8Array,re=Uint16Array,ir=Int32Array,Dn=new E([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),An=new E([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),rr=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bn=l(function(i,e){for(var t=new re(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var r=new ir(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)r[s]=s-t[n]<<5|n;return{b:t,r}},"freb"),Rn=Bn(Dn,2),On=Rn.b,sr=Rn.r;On[28]=258,sr[258]=28;var In=Bn(An,0),ar=In.b,As=In.r,Tt=new re(32768);for(z=0;z<32768;++z)N=(z&43690)>>1|(z&21845)<<1,N=(N&52428)>>2|(N&13107)<<2,N=(N&61680)>>4|(N&3855)<<4,Tt[z]=((N&65280)>>8|(N&255)<<8)>>1;var N,z,ve=l(function(i,e,t){for(var n=i.length,r=0,s=new re(e);r<n;++r)i[r]&&++s[i[r]-1];var a=new re(e);for(r=1;r<e;++r)a[r]=a[r-1]+s[r-1]<<1;var o;if(t){o=new re(1<<e);var c=15-e;for(r=0;r<n;++r)if(i[r])for(var u=r<<4|i[r],h=e-i[r],f=a[i[r]-1]++<<h,d=f|(1<<h)-1;f<=d;++f)o[Tt[f]>>c]=u}else for(o=new re(n),r=0;r<n;++r)i[r]&&(o[r]=Tt[a[i[r]-1]++]>>15-i[r]);return o},"hMap"),ke=new E(288);for(z=0;z<144;++z)ke[z]=8;var z;for(z=144;z<256;++z)ke[z]=9;var z;for(z=256;z<280;++z)ke[z]=7;var z;for(z=280;z<288;++z)ke[z]=8;var z,jn=new E(32);for(z=0;z<32;++z)jn[z]=5;var z,or=ve(ke,9,1),lr=ve(jn,5,1),zt=l(function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},"max"),$=l(function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(e&7)&t},"bits"),Pt=l(function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},"bits16"),cr=l(function(i){return(i+7)/8|0},"shft"),ur=l(function(i,e,t){(e==null||e<0)&&(e=0),(t==null||t>i.length)&&(t=i.length);var n=new E(t-e);return n.set(i.subarray(e,t)),n},"slc"),hr=["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"],j=l(function(i,e,t){var n=new Error(e||hr[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,j),!t)throw n;return n},"err"),St=l(function(i,e,t,n){var r=i.length,s=n?n.length:0;if(!r||e.f&&!e.l)return t||new E(0);var a=!t||e.i!=2,o=e.i;t||(t=new E(r*3));var c=l(function(yn){var wn=t.length;if(yn>wn){var _n=new E(Math.max(wn*2,yn));_n.set(t),t=_n}},"cbuf"),u=e.f||0,h=e.p||0,f=e.b||0,d=e.l,m=e.d,g=e.m,x=e.n,w=r*8;do{if(!d){u=$(i,h,1);var k=$(i,h+1,3);if(h+=3,k)if(k==1)d=or,m=lr,g=9,x=5;else if(k==2){var b=$(i,h,31)+257,T=$(i,h+10,15)+4,P=b+$(i,h+5,31)+1;h+=14;for(var v=new E(P),F=new E(19),O=0;O<T;++O)F[rr[O]]=$(i,h+O*3,7);h+=T*3;for(var J=zt(F),hi=(1<<J)-1,fi=ve(F,J,1),O=0;O<P;){var gn=fi[$(i,h,hi)];h+=gn&15;var p=gn>>4;if(p<16)v[O++]=p;else{var K=0,Ye=0;for(p==16?(Ye=3+$(i,h,3),h+=2,K=v[O-1]):p==17?(Ye=3+$(i,h,7),h+=3):p==18&&(Ye=11+$(i,h,127),h+=7);Ye--;)v[O++]=K}}var pn=v.subarray(0,b),U=v.subarray(b);g=zt(pn),x=zt(U),d=ve(pn,g,1),m=ve(U,x,1)}else j(1);else{var p=cr(h)+4,_=i[p-4]|i[p-3]<<8,S=p+_;if(S>r){o&&j(0);break}a&&c(f+_),t.set(i.subarray(p,S),f),e.b=f+=_,e.p=h=S*8,e.f=u;continue}if(h>w){o&&j(0);break}}a&&c(f+131072);for(var di=(1<<g)-1,mi=(1<<x)-1,at=h;;at=h){var K=d[Pt(i,h)&di],G=K>>4;if(h+=K&15,h>w){o&&j(0);break}if(K||j(2),G<256)t[f++]=G;else if(G==256){at=h,d=null;break}else{var bn=G-254;if(G>264){var O=G-257,ge=Dn[O];bn=$(i,h,(1<<ge)-1)+On[O],h+=ge}var ot=m[Pt(i,h)&mi],lt=ot>>4;ot||j(3),h+=ot&15;var U=ar[lt];if(lt>3){var ge=An[lt];U+=Pt(i,h)&(1<<ge)-1,h+=ge}if(h>w){o&&j(0);break}a&&c(f+131072);var ct=f+bn;if(f<U){var xn=s-U,gi=Math.min(U,ct);for(xn+f<0&&j(3);f<gi;++f)t[f]=n[xn+f]}for(;f<ct;f+=4)t[f]=t[f-U],t[f+1]=t[f+1-U],t[f+2]=t[f+2-U],t[f+3]=t[f+3-U];f=ct}}e.l=d,e.p=at,e.b=f,e.f=u,d&&(u=1,e.m=g,e.d=m,e.n=x)}while(!u);return f==t.length?t:ur(t,0,f)},"inflt"),fr=new E(0),dr=l(function(i){(i[0]!=31||i[1]!=139||i[2]!=8)&&j(6,"invalid gzip data");var e=i[3],t=10;e&4&&(t+=(i[10]|i[11]<<8)+2);for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!i[t++]);return t+(e&2)},"gzs"),mr=l(function(i){var e=i.length;return(i[e-4]|i[e-3]<<8|i[e-2]<<16|i[e-1]<<24)>>>0},"gzl"),gr=l(function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&j(6,"invalid zlib data"),(i[1]>>5&1)==+!e&&j(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2},"zls");function pr(i,e){return St(i,{i:2},e&&e.out,e&&e.dictionary)}l(pr,"inflateSync");function br(i,e){var t=dr(i);return t+8>i.length&&j(6,"invalid gzip data"),St(i.subarray(t,-8),{i:2},e&&e.out||new E(mr(i)),e&&e.dictionary)}l(br,"gunzipSync");function xr(i,e){return St(i.subarray(gr(i,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}l(xr,"unzlibSync");function Lt(i,e){return i[0]==31&&i[1]==139&&i[2]==8?br(i,e):(i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31?pr(i,e):xr(i,e)}l(Lt,"decompressSync");var yr=typeof TextDecoder!="undefined"&&new TextDecoder,wr=0;try{yr.decode(fr,{stream:!0}),wr=1}catch(i){}var En=l((i,e)=>i*se(2,e),"shift"),we=l((i,e)=>Math.floor(i/se(2,e)),"unshift"),Ze=l((i,e)=>En(i.getUint16(e+1,!0),8)+i.getUint8(e),"getUint24"),Xn=l((i,e)=>En(i.getUint32(e+2,!0),16)+i.getUint16(e,!0),"getUint48"),_r=l((i,e,t,n,r)=>{if(i!==n.getUint8(r))return i-n.getUint8(r);let s=Ze(n,r+1);if(e!==s)return e-s;let a=Ze(n,r+4);return t!==a?t-a:0},"compare"),vr=l((i,e,t,n)=>{let r=Yn(i,e|128,t,n);return r?{z:e,x:t,y:n,offset:r[0],length:r[1],isDir:!0}:null},"queryLeafdir"),Fn=l((i,e,t,n)=>{let r=Yn(i,e,t,n);return r?{z:e,x:t,y:n,offset:r[0],length:r[1],isDir:!1}:null},"queryTile"),Yn=l((i,e,t,n)=>{let r=0,s=i.byteLength/17-1;for(;r<=s;){let a=s+r>>1,o=_r(e,t,n,i,a*17);if(o>0)r=a+1;else if(o<0)s=a-1;else return[Xn(i,a*17+7),i.getUint32(a*17+13,!0)]}return null},"queryView"),kr=l((i,e)=>i.isDir&&!e.isDir?1:!i.isDir&&e.isDir?-1:i.z!==e.z?i.z-e.z:i.x!==e.x?i.x-e.x:i.y-e.y,"entrySort"),Vn=l((i,e)=>{let t=i.getUint8(e*17);return{z:t&127,x:Ze(i,e*17+1),y:Ze(i,e*17+4),offset:Xn(i,e*17+7),length:i.getUint32(e*17+13,!0),isDir:t>>7===1}},"parseEntry"),Cn=l(i=>{let e=[],t=new DataView(i);for(let n=0;n<t.byteLength/17;n++)e.push(Vn(t,n));return zr(e)},"sortDir"),zr=l(i=>{i.sort(kr);let e=new ArrayBuffer(17*i.length),t=new Uint8Array(e);for(let n=0;n<i.length;n++){let r=i[n],s=r.z;r.isDir&&(s=s|128),t[n*17]=s,t[n*17+1]=r.x&255,t[n*17+2]=r.x>>8&255,t[n*17+3]=r.x>>16&255,t[n*17+4]=r.y&255,t[n*17+5]=r.y>>8&255,t[n*17+6]=r.y>>16&255,t[n*17+7]=r.offset&255,t[n*17+8]=we(r.offset,8)&255,t[n*17+9]=we(r.offset,16)&255,t[n*17+10]=we(r.offset,24)&255,t[n*17+11]=we(r.offset,32)&255,t[n*17+12]=we(r.offset,48)&255,t[n*17+13]=r.length&255,t[n*17+14]=r.length>>8&255,t[n*17+15]=r.length>>16&255,t[n*17+16]=r.length>>24&255}return e},"createDirectory"),Pr=l((i,e)=>{if(i.byteLength<17)return null;let t=i.byteLength/17,n=Vn(i,t-1);if(n.isDir){let r=n.z,s=e.z-r,a=Math.trunc(e.x/(1<<s)),o=Math.trunc(e.y/(1<<s));return{z:r,x:a,y:o}}return null},"deriveLeaf");function Tr(i){return I(this,null,function*(){let e=yield i.getBytes(0,512e3),t=new DataView(e.data),n=t.getUint32(4,!0),r=t.getUint16(8,!0),s=new TextDecoder("utf-8"),a=JSON.parse(s.decode(new DataView(e.data,10,n))),o=0;a.compression==="gzip"&&(o=2);let c=0;"minzoom"in a&&(c=+a.minzoom);let u=0;"maxzoom"in a&&(u=+a.maxzoom);let h=0,f=0,d=0,m=-180,g=-85,x=180,w=85;if(a.bounds){let p=a.bounds.split(",");m=+p[0],g=+p[1],x=+p[2],w=+p[3]}if(a.center){let p=a.center.split(",");h=+p[0],f=+p[1],d=+p[2]}return{specVersion:t.getUint16(2,!0),rootDirectoryOffset:10+n,rootDirectoryLength:r*17,jsonMetadataOffset:10,jsonMetadataLength:n,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:o,tileType:1,minZoom:c,maxZoom:u,minLon:m,minLat:g,maxLon:x,maxLat:w,centerZoom:d,centerLon:h,centerLat:f,etag:e.etag}})}l(Tr,"getHeader");function Lr(i,e,t,n,r,s,a){return I(this,null,function*(){let o=yield t.getArrayBuffer(e,i.rootDirectoryOffset,i.rootDirectoryLength,i);i.specVersion===1&&(o=Cn(o));let c=Fn(new DataView(o),n,r,s);if(c){let f=(yield e.getBytes(c.offset,c.length,a)).data,d=new DataView(f);return d.getUint8(0)===31&&d.getUint8(1)===139&&(f=Lt(new Uint8Array(f))),{data:f}}let u=Pr(new DataView(o),{z:n,x:r,y:s});if(u){let h=vr(new DataView(o),u.z,u.x,u.y);if(h){let f=yield t.getArrayBuffer(e,h.offset,h.length,i);i.specVersion===1&&(f=Cn(f));let d=Fn(new DataView(f),n,r,s);if(d){let g=(yield e.getBytes(d.offset,d.length,a)).data,x=new DataView(g);return x.getUint8(0)===31&&x.getUint8(1)===139&&(g=Lt(new Uint8Array(g))),{data:g}}}}})}l(Lr,"getZxy");var Un={getHeader:Tr,getZxy:Lr};function ie(i,e){return(e>>>0)*4294967296+(i>>>0)}l(ie,"toNum");function Mr(i,e){let t=e.buf,n=t[e.pos++],r=(n&112)>>4;if(n<128||(n=t[e.pos++],r|=(n&127)<<3,n<128)||(n=t[e.pos++],r|=(n&127)<<10,n<128)||(n=t[e.pos++],r|=(n&127)<<17,n<128)||(n=t[e.pos++],r|=(n&127)<<24,n<128)||(n=t[e.pos++],r|=(n&1)<<31,n<128))return ie(i,r);throw new Error("Expected varint not more than 10 bytes")}l(Mr,"readVarintRemainder");function _e(i){let e=i.buf,t=e[i.pos++],n=t&127;return t<128||(t=e[i.pos++],n|=(t&127)<<7,t<128)||(t=e[i.pos++],n|=(t&127)<<14,t<128)||(t=e[i.pos++],n|=(t&127)<<21,t<128)?n:(t=e[i.pos],n|=(t&15)<<28,Mr(n,i))}l(_e,"readVarint");function Sr(i,e,t,n){if(n===0){t===1&&(e[0]=i-1-e[0],e[1]=i-1-e[1]);let r=e[0];e[0]=e[1],e[1]=r}}l(Sr,"rotate");var Fr=[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 Cr(i,e,t){if(i>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>se(2,i)-1||t>se(2,i)-1)throw Error("tile x/y outside zoom level bounds");let n=Fr[i],r=se(2,i),s=0,a=0,o=0,c=[e,t],u=r/2;for(;u>0;)s=(c[0]&u)>0?1:0,a=(c[1]&u)>0?1:0,o+=u*u*(3*s^a),Sr(u,c,s,a),u=u/2;return n+o}l(Cr,"zxyToTileId");function $n(i,e){return I(this,null,function*(){if(e===1||e===0)return i;if(e===2){if(typeof globalThis.DecompressionStream=="undefined")return Lt(new Uint8Array(i));let t=new Response(i).body;if(!t)throw Error("Failed to read response stream");let n=t.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(n).arrayBuffer()}throw Error("Compression method not supported")})}l($n,"defaultDecompress");var Dr=127;function Ar(i,e){let t=0,n=i.length-1;for(;t<=n;){let r=n+t>>1,s=e-i[r].tileId;if(s>0)t=r+1;else if(s<0)n=r-1;else return i[r]}return n>=0&&(i[n].runLength===0||e-i[n].tileId<i[n].runLength)?i[n]:null}l(Ar,"findTile");var ae,Br=(ae=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 s,a;n?a=n:(s=new AbortController,a=s.signal);let o=new Headers(this.customHeaders);o.set("range",`bytes=${e}-${e+t-1}`);let c;this.mustReload&&(c="reload");let u=yield fetch(this.url,{signal:a,cache:c,headers:o});if(e===0&&u.status===416){let m=u.headers.get("Content-Range");if(!m||!m.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let g=+m.substr(8);u=yield fetch(this.url,{signal:a,cache:"reload",headers:{range:`bytes=0-${g-1}`}})}let h=u.headers.get("Etag");if(h!=null&&h.startsWith("W/")&&(h=null),u.status===416||r&&h&&h!==r)throw this.mustReload=!0,new Mt(`Server returned non-matching ETag ${r} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(u.status>=300)throw Error(`Bad response code: ${u.status}`);let f=u.headers.get("Content-Length");if(u.status===200&&(!f||+f>t))throw s&&s.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 u.arrayBuffer(),etag:h||void 0,cacheControl:u.headers.get("Cache-Control")||void 0,expires:u.headers.get("Expires")||void 0}})}},l(ae,"FetchSource"),ae);function H(i,e){let t=i.getUint32(e+4,!0),n=i.getUint32(e+0,!0);return t*se(2,32)+n}l(H,"getUint64");function Rr(i,e){let t=new DataView(i),n=t.getUint8(7);if(n>3)throw Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:H(t,8),rootDirectoryLength:H(t,16),jsonMetadataOffset:H(t,24),jsonMetadataLength:H(t,32),leafDirectoryOffset:H(t,40),leafDirectoryLength:H(t,48),tileDataOffset:H(t,56),tileDataLength:H(t,64),numAddressedTiles:H(t,72),numTileEntries:H(t,80),numTileContents:H(t,88),clustered:t.getUint8(96)===1,internalCompression:t.getUint8(97),tileCompression:t.getUint8(98),tileType:t.getUint8(99),minZoom:t.getUint8(100),maxZoom:t.getUint8(101),minLon:t.getInt32(102,!0)/1e7,minLat:t.getInt32(106,!0)/1e7,maxLon:t.getInt32(110,!0)/1e7,maxLat:t.getInt32(114,!0)/1e7,centerZoom:t.getUint8(118),centerLon:t.getInt32(119,!0)/1e7,centerLat:t.getInt32(123,!0)/1e7,etag:e}}l(Rr,"bytesToHeader");function Hn(i){let e={buf:new Uint8Array(i),pos:0},t=_e(e),n=[],r=0;for(let s=0;s<t;s++){let a=_e(e);n.push({tileId:r+a,offset:0,length:0,runLength:1}),r+=a}for(let s=0;s<t;s++)n[s].runLength=_e(e);for(let s=0;s<t;s++)n[s].length=_e(e);for(let s=0;s<t;s++){let a=_e(e);a===0&&s>0?n[s].offset=n[s-1].offset+n[s-1].length:n[s].offset=a-1}return n}l(Hn,"deserializeIndex");function Or(i){let e=new DataView(i);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.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}l(Or,"detectVersion");var oe,Mt=(oe=class extends Error{},l(oe,"EtagMismatch"),oe);function Ir(i,e){return I(this,null,function*(){let t=yield i.getBytes(0,16384);if(new DataView(t.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(Or(t.data)<3)return[yield Un.getHeader(i)];let r=t.data.slice(0,Dr),s=Rr(r,t.etag),a=t.data.slice(s.rootDirectoryOffset,s.rootDirectoryOffset+s.rootDirectoryLength),o=`${i.getKey()}|${s.etag||""}|${s.rootDirectoryOffset}|${s.rootDirectoryLength}`,c=Hn(yield e(a,s.internalCompression));return[s,[o,c.length,c]]})}l(Ir,"getHeaderAndRoot");function jr(i,e,t,n,r){return I(this,null,function*(){let s=yield i.getBytes(t,n,void 0,r.etag),a=yield e(s.data,r.internalCompression),o=Hn(a);if(o.length===0)throw new Error("Empty directory is invalid");return o})}l(jr,"getDirectory");var le,Er=(le=class{constructor(e=100,t=!0,n=$n){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((s,a)=>{Ir(e,this.decompress).then(o=>{o[1]&&this.cache.set(o[1][0],{lastUsed:this.counter++,data:Promise.resolve(o[1][2])}),s(o[0]),this.prune()}).catch(o=>{a(o)})});return this.cache.set(t,{lastUsed:this.counter++,data:r}),r})}getDirectory(e,t,n,r){return I(this,null,function*(){let s=`${e.getKey()}|${r.etag||""}|${t}|${n}`,a=this.cache.get(s);if(a)return a.lastUsed=this.counter++,yield a.data;let o=new Promise((c,u)=>{jr(e,this.decompress,t,n,r).then(h=>{c(h),this.prune()}).catch(h=>{u(h)})});return this.cache.set(s,{lastUsed:this.counter++,data:o}),o})}getArrayBuffer(e,t,n,r){return I(this,null,function*(){let s=`${e.getKey()}|${r.etag||""}|${t}|${n}`,a=this.cache.get(s);if(a)return a.lastUsed=this.counter++,yield a.data;let o=new Promise((c,u)=>{e.getBytes(t,n,void 0,r.etag).then(h=>{c(h.data),this.cache.has(s),this.prune()}).catch(h=>{u(h)})});return this.cache.set(s,{lastUsed:this.counter++,data:o}),o})}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,s)=>{this.getHeader(e).then(a=>{r(),this.invalidations.delete(t)}).catch(a=>{s(a)})});this.invalidations.set(t,n)})}},l(le,"SharedPromiseCache"),le),ce,Nn=(ce=class{constructor(e,t,n){typeof e=="string"?this.source=new Br(e):this.source=e,n?this.decompress=n:this.decompress=$n,t?this.cache=t:this.cache=new Er}getHeader(){return I(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,n,r){return I(this,null,function*(){let s=Cr(e,t,n),a=yield this.cache.getHeader(this.source);if(a.specVersion<3)return Un.getZxy(a,this.source,this.cache,e,t,n,r);if(e<a.minZoom||e>a.maxZoom)return;let o=a.rootDirectoryOffset,c=a.rootDirectoryLength;for(let u=0;u<=3;u++){let h=yield this.cache.getDirectory(this.source,o,c,a),f=Ar(h,s);if(f){if(f.runLength>0){let d=yield this.source.getBytes(a.tileDataOffset+f.offset,f.length,r,a.etag);return{data:yield this.decompress(d.data,a.tileCompression),cacheControl:d.cacheControl,expires:d.expires}}o=a.leafDirectoryOffset+f.offset,c=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(s){if(s instanceof Mt)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,n,r);throw s}})}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 Mt)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}},l(ce,"PMTiles"),ce);var Dt=(n=>(n[n.Point=1]="Point",n[n.Line=2]="Line",n[n.Polygon=3]="Polygon",n))(Dt||{});function q(i){return`${i.x}:${i.y}:${i.z}`}l(q,"toIndex");var Xr=l((i,e,t)=>{i.pos=e;let n=i.readVarint()+i.pos,r=1,s=0,a=0,o=0,c=1/0,u=-1/0,h=1/0,f=-1/0,d=[],m=[];for(;i.pos<n;){if(s<=0){let g=i.readVarint();r=g&7,s=g>>3}if(s--,r===1||r===2)a+=i.readSVarint()*t,o+=i.readSVarint()*t,a<c&&(c=a),a>u&&(u=a),o<h&&(h=o),o>f&&(f=o),r===1&&(m.length>0&&d.push(m),m=[]),m.push(new y(a,o));else if(r===7)m&&m.push(m[0].clone());else throw new Error(`unknown command ${r}`)}return m&&d.push(m),{geom:d,bbox:{minX:c,minY:h,maxX:u,maxY:f}}},"loadGeomAndBbox");function Zn(i,e){let t=new Ne(new ye(i)),n=new Map;for(let[r,s]of Object.entries(t.layers)){let a=[],o=s;for(let c=0;c<o.length;c++){let u=Xr(o.feature(c)._pbf,o.feature(c)._geometry,e/o.extent),h=0;for(let f of u.geom)h+=f.length;a.push({id:o.feature(c).id,geomType:o.feature(c).type,geom:u.geom,numVertices:h,bbox:u.bbox,props:o.feature(c).properties})}n.set(r,a)}return n}l(Zn,"parseTile");var At=class At{constructor(e,t){typeof e=="string"?this.p=new Nn(e):this.p=e,this.zoomaborts=[],this.shouldCancelZooms=t}get(e,t){return A(this,null,function*(){this.shouldCancelZooms&&(this.zoomaborts=this.zoomaborts.filter(a=>a.z!==e.z?(a.controller.abort(),!1):!0));let n=new AbortController;this.zoomaborts.push({z:e.z,controller:n});let r=n.signal,s=yield this.p.getZxy(e.z,e.x,e.y,r);return s?Zn(s.data,t):new Map})}};l(At,"PmtilesSource");var ue=At,Bt=class Bt{constructor(e,t){this.url=e,this.zoomaborts=[],this.shouldCancelZooms=t}get(e,t){return A(this,null,function*(){this.shouldCancelZooms&&(this.zoomaborts=this.zoomaborts.filter(a=>a.z!==e.z?(a.controller.abort(),!1):!0));let n=this.url.replace("{z}",e.z.toString()).replace("{x}",e.x.toString()).replace("{y}",e.y.toString()),r=new AbortController;this.zoomaborts.push({z:e.z,controller:r});let s=r.signal;return new Promise((a,o)=>{fetch(n,{signal:s}).then(c=>c.arrayBuffer()).then(c=>{let u=Zn(c,t);a(u)}).catch(c=>{o(c)})})})}};l(Bt,"ZxySource");var ze=Bt,Ft=6378137,qn=85.0511287798,Je=Ft*Math.PI,Yr=l(i=>{let e=Math.PI/180,t=Math.max(Math.min(qn,i[0]),-qn),n=Math.sin(t*e);return new y(Ft*i[1]*e,Ft*Math.log((1+n)/(1-n))/2)},"project");function Wn(i){return i*i}l(Wn,"sqr");function Ke(i,e){return Wn(i.x-e.x)+Wn(i.y-e.y)}l(Ke,"dist2");function Vr(i,e,t){let n=Ke(e,t);if(n===0)return Ke(i,e);let r=((i.x-e.x)*(t.x-e.x)+(i.y-e.y)*(t.y-e.y))/n;return r=Math.max(0,Math.min(1,r)),Ke(i,new y(e.x+r*(t.x-e.x),e.y+r*(t.y-e.y)))}l(Vr,"distToSegmentSquared");function Ct(i,e){let t=!1;for(let n=0,r=e.length-1;n<e.length;r=n++){let s=e[n].x,a=e[n].y,o=e[r].x,c=e[r].y;a>i.y!=c>i.y&&i.x<(o-s)*(i.y-a)/(c-a)+s&&(t=!t)}return t}l(Ct,"isInRing");function Jn(i){let e=0;for(let t=0;t<i.length;t++){let n=(t+1)%i.length;e+=i[t].x*i[n].y,e-=i[n].x*i[t].y}return e<0}l(Jn,"isCcw");function Kn(i,e){let t=!1;for(let n of e)if(Jn(n))Ct(i,n)&&(t=!1);else{if(t)return!0;Ct(i,n)&&(t=!0)}return t}l(Kn,"pointInPolygon");function Gn(i,e){let t=1/0;for(let n of e){let r=Math.sqrt(Ke(i,n[0]));r<t&&(t=r)}return t}l(Gn,"pointMinDistToPoints");function Qn(i,e){let t=1/0;for(let n of e)for(let r=0;r<n.length-1;r++){let s=Math.sqrt(Vr(i,n[r],n[r+1]));s<t&&(t=s)}return t}l(Qn,"pointMinDistToLines");var Rt=class Rt{constructor(e,t){this.source=e,this.cache=new Map,this.inflight=new Map,this.tileSize=t}get(e){return A(this,null,function*(){let t=q(e);return new Promise((n,r)=>{let s=this.cache.get(t);if(s)s.used=performance.now(),n(s.data);else{let a=this.inflight.get(t);a?a.push({resolve:n,reject:r}):(this.inflight.set(t,[]),this.source.get(e,this.tileSize).then(o=>{this.cache.set(t,{used:performance.now(),data:o});let c=this.inflight.get(t);if(c)for(let u of c)u.resolve(o);if(this.inflight.delete(t),n(o),this.cache.size>=64){let u=1/0,h;this.cache.forEach((f,d)=>{f.used<u&&(u=f.used,h=d)}),h&&this.cache.delete(h)}}).catch(o=>{let c=this.inflight.get(t);if(c)for(let u of c)u.reject(o);this.inflight.delete(t),r(o)}))}})})}queryFeatures(e,t,n,r){let s=Yr([t,e]),a=new y((s.x+Je)/(Je*2),1-(s.y+Je)/(Je*2));a.x>1&&(a.x=a.x-Math.floor(a.x));let o=a.mult(1<<n),c=Math.floor(o.x),u=Math.floor(o.y),h=q({z:n,x:c,y:u}),f=[],d=this.cache.get(h);if(d){let m=new y((o.x-c)*this.tileSize,(o.y-u)*this.tileSize);for(let[g,x]of d.data.entries())for(let w of x)w.geomType===1?Gn(m,w.geom)<r&&f.push({feature:w,layerName:g}):w.geomType===2?Qn(m,w.geom)<r&&f.push({feature:w,layerName:g}):Kn(m,w.geom)&&f.push({feature:w,layerName:g})}return f}};l(Rt,"TileCache");var Pe=Rt;var ei=(n=>(n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=3]="Right",n))(ei||{}),ti=(c=>(c[c.N=1]="N",c[c.Ne=2]="Ne",c[c.E=3]="E",c[c.Se=4]="Se",c[c.S=5]="S",c[c.Sw=6]="Sw",c[c.W=7]="W",c[c.Nw=8]="Nw",c))(ti||{}),Ur=l((i,e,t)=>{let n=document.createElement("canvas"),r=n.getContext("2d");return n.width=i,n.height=e,r!==null&&t(n,r),n},"createPattern"),Xt=class Xt{constructor(e){var t;this.pattern=e.pattern,this.fill=new B(e.fill,"black"),this.opacity=new M(e.opacity,1),this.stroke=new B(e.stroke,"black"),this.width=new M(e.width,0),this.perFeature=(t=this.fill.perFeature||this.opacity.perFeature||this.stroke.perFeature||this.width.perFeature||e.perFeature)!=null?t:!1,this.doStroke=!1}before(e,t){if(!this.perFeature){e.globalAlpha=this.opacity.get(t),e.fillStyle=this.fill.get(t),e.strokeStyle=this.stroke.get(t);let n=this.width.get(t);n>0&&(this.doStroke=!0),e.lineWidth=n}if(this.pattern){let n=e.createPattern(this.pattern,"repeat");n&&(e.fillStyle=n)}}draw(e,t,n,r){let s=!1;if(this.perFeature){e.globalAlpha=this.opacity.get(n,r),e.fillStyle=this.fill.get(n,r);let o=this.width.get(n,r);o&&(s=!0,e.strokeStyle=this.stroke.get(n,r),e.lineWidth=o)}let a=l(()=>{e.fill(),(s||this.doStroke)&&e.stroke()},"drawPath");e.beginPath();for(let o of t)for(let c=0;c<o.length;c++){let u=o[c];c===0?e.moveTo(u.x,u.y):e.lineTo(u.x,u.y)}a()}};l(Xt,"PolygonSymbolizer");var C=Xt;function $r(i,e){return t=>{let n=t-i;return n>=0&&n<e.length?e[n]:0}}l($r,"arr");function Hr(i,e){let t=0;for(;e[t+1][0]<i;)t++;return t}l(Hr,"getStopIndex");function Nr(i,e,t){return i*(t-e)+e}l(Nr,"interpolate");function qr(i,e,t,n){let r=n[e+1][0]-n[e][0],s=i-n[e][0];return r===0?0:t===1?s/r:(D(t,s)-1)/(D(t,r)-1)}l(qr,"computeInterpolationFactor");function X(i,e){return t=>{if(e.length<1)return 0;if(t<=e[0][0])return e[0][1];if(t>=e[e.length-1][0])return e[e.length-1][1];let n=Hr(t,e),r=qr(t,n,i,e);return Nr(r,e[n][1],e[n+1][1])}}l(X,"exp");function Wr(i,e){return t=>{if(e.length<1)return 0;let n=i;for(let r=0;r<e.length;r++)t>=e[r][0]&&(n=e[r][1]);return n}}l(Wr,"step");function et(i){return X(1,i)}l(et,"linear");var Yt=class Yt{constructor(e){var t;this.color=new B(e.color,"black"),this.width=new M(e.width),this.opacity=new M(e.opacity),this.dash=e.dash?new $e(e.dash):null,this.dashColor=new B(e.dashColor,"black"),this.dashWidth=new M(e.dashWidth,1),this.lineCap=new B(e.lineCap,"butt"),this.lineJoin=new B(e.lineJoin,"miter"),this.skip=!1,this.perFeature=!!((t=this.dash)!=null&&t.perFeature||this.color.perFeature||this.opacity.perFeature||this.width.perFeature||this.lineCap.perFeature||this.lineJoin.perFeature||e.perFeature)}before(e,t){this.perFeature||(e.strokeStyle=this.color.get(t),e.lineWidth=this.width.get(t),e.globalAlpha=this.opacity.get(t),e.lineCap=this.lineCap.get(t),e.lineJoin=this.lineJoin.get(t))}draw(e,t,n,r){if(this.skip)return;let s=l(()=>{this.perFeature&&(e.globalAlpha=this.opacity.get(n,r),e.lineCap=this.lineCap.get(n,r),e.lineJoin=this.lineJoin.get(n,r)),this.dash?(e.save(),this.perFeature?(e.lineWidth=this.dashWidth.get(n,r),e.strokeStyle=this.dashColor.get(n,r),e.setLineDash(this.dash.get(n,r))):e.setLineDash(this.dash.get(n)),e.stroke(),e.restore()):(e.save(),this.perFeature&&(e.lineWidth=this.width.get(n,r),e.strokeStyle=this.color.get(n,r)),e.stroke(),e.restore())},"strokePath");e.beginPath();for(let a of t)for(let o=0;o<a.length;o++){let c=a[o];o===0?e.moveTo(c.x,c.y):e.lineTo(c.x,c.y)}s()}};l(Yt,"LineSymbolizer");var R=Yt,Vt=class Vt{constructor(e){this.name=e.name,this.sheet=e.sheet,this.dpr=window.devicePixelRatio}place(e,t,n){let r=t[0],s=new y(t[0][0].x,t[0][0].y),a=this.sheet.get(this.name),o=a.w/this.dpr,c=a.h/this.dpr,u={minX:s.x-o/2,minY:s.y-c/2,maxX:s.x+o/2,maxY:s.y+c/2};return[{anchor:s,bboxes:[u],draw:l(f=>{f.globalAlpha=1,f.drawImage(this.sheet.canvas,a.x,a.y,a.w,a.h,-a.w/2/this.dpr,-a.h/2/this.dpr,a.w/2,a.h/2)},"draw")}]}};l(Vt,"IconSymbolizer");var Ot=Vt,Ut=class Ut{constructor(e){this.radius=new M(e.radius,3),this.fill=new B(e.fill,"black"),this.stroke=new B(e.stroke,"white"),this.width=new M(e.width,0),this.opacity=new M(e.opacity)}draw(e,t,n,r){e.globalAlpha=this.opacity.get(n,r);let s=this.radius.get(n,r),a=this.width.get(n,r);a>0&&(e.strokeStyle=this.stroke.get(n,r),e.lineWidth=a,e.beginPath(),e.arc(t[0][0].x,t[0][0].y,s+a/2,0,2*Math.PI),e.stroke()),e.fillStyle=this.fill.get(n,r),e.beginPath(),e.arc(t[0][0].x,t[0][0].y,s,0,2*Math.PI),e.fill()}place(e,t,n){let r=t[0],s=new y(t[0][0].x,t[0][0].y),a=this.radius.get(e.zoom,n),o={minX:s.x-a,minY:s.y-a,maxX:s.x+a,maxY:s.y+a};return[{anchor:s,bboxes:[o],draw:l(u=>{this.draw(u,[[new y(0,0)]],e.zoom,n)},"draw")}]}};l(Ut,"CircleSymbolizer");var Te=Ut,$t=class $t{constructor(e){this.font=new te(e),this.text=new ee(e),this.fill=new B(e.fill,"black"),this.background=new B(e.background,"white"),this.padding=new M(e.padding,0)}place(e,t,n){let r=this.text.get(e.zoom,n);if(!r)return;let s=this.font.get(e.zoom,n);e.scratch.font=s;let a=e.scratch.measureText(r),o=a.width,c=a.actualBoundingBoxAscent,u=a.actualBoundingBoxDescent,h=t[0],f=new y(t[0][0].x,t[0][0].y),d=this.padding.get(e.zoom,n),m={minX:f.x-o/2-d,minY:f.y-c-d,maxX:f.x+o/2+d,maxY:f.y+u+d};return[{anchor:f,bboxes:[m],draw:l(x=>{x.globalAlpha=1,x.fillStyle=this.background.get(e.zoom,n),x.fillRect(-o/2-d,-c-d,o+2*d,c+u+2*d),x.fillStyle=this.fill.get(e.zoom,n),x.font=s,x.fillText(r,-o/2,0)},"draw")}]}};l($t,"ShieldSymbolizer");var It=$t,Ht=class Ht{constructor(e){this.list=e}place(e,t,n){let r=this.list[0].place(e,t,n);if(!r)return;let s=r[0],a=s.anchor,o=s.bboxes[0],c=o.maxY-o.minY,u=[{draw:s.draw,translate:{x:0,y:0}}],h=[[new y(t[0][0].x,t[0][0].y+c)]];for(let d=1;d<this.list.length;d++)r=this.list[d].place(e,h,n),r&&(s=r[0],o=ni(o,s.bboxes[0]),u.push({draw:s.draw,translate:{x:0,y:c}}));return[{anchor:a,bboxes:[o],draw:l(d=>{for(let m of u)d.save(),d.translate(m.translate.x,m.translate.y),m.draw(d),d.restore()},"draw")}]}};l(Ht,"FlexSymbolizer");var jt=Ht,ni=l((i,e)=>({minX:Math.min(i.minX,e.minX),minY:Math.min(i.minY,e.minY),maxX:Math.max(i.maxX,e.maxX),maxY:Math.max(i.maxY,e.maxY)}),"mergeBbox"),Nt=class Nt{constructor(e){this.list=e}place(e,t,n){let r=this.list[0];if(!r)return;let s=r.place(e,t,n);if(!s)return;let a=s[0],o=a.anchor,c=a.bboxes[0],u=[a.draw];for(let f=1;f<this.list.length;f++){if(s=this.list[f].place(e,t,n),!s)return;a=s[0],c=ni(c,a.bboxes[0]),u.push(a.draw)}return[{anchor:o,bboxes:[c],draw:l(f=>{for(let d of u)d(f)},"draw")}]}};l(Nt,"GroupSymbolizer");var Le=Nt,qt=class qt{constructor(e){this.symbolizer=e}place(e,t,n){let r=t[0][0],s=this.symbolizer.place(e,[[new y(0,0)]],n);if(!s||s.length===0)return;let a=s[0],o=a.bboxes[0],c=o.maxX-o.minX,u=o.maxY-o.minY,h={minX:r.x-c/2,maxX:r.x+c/2,minY:r.y-u/2,maxY:r.y+u/2};return[{anchor:r,bboxes:[h],draw:l(d=>{d.translate(-c/2,u/2-o.maxY),a.draw(d,{justify:2})},"draw")}]}};l(qt,"CenteredSymbolizer");var Ge=qt,Wt=class Wt{constructor(e,t){this.padding=new M(e,0),this.symbolizer=t}place(e,t,n){let r=this.symbolizer.place(e,t,n);if(!r||r.length===0)return;let s=this.padding.get(e.zoom,n);for(let a of r)for(let o of a.bboxes)o.minX-=s,o.minY-=s,o.maxX+=s,o.maxY+=s;return r}};l(Wt,"Padding");var Et=Wt,Zt=class Zt{constructor(e){this.font=new te(e),this.text=new ee(e),this.fill=new B(e.fill,"black"),this.stroke=new B(e.stroke,"black"),this.width=new M(e.width,0),this.lineHeight=new M(e.lineHeight,1),this.letterSpacing=new M(e.letterSpacing,0),this.maxLineCodeUnits=new M(e.maxLineChars,15),this.justify=e.justify}place(e,t,n){let r=this.text.get(e.zoom,n);if(!r)return;let s=this.font.get(e.zoom,n);e.scratch.font=s;let a=this.letterSpacing.get(e.zoom,n),o=bt(r,this.maxLineCodeUnits.get(e.zoom,n)),c="",u=0;for(let p of o)p.length>u&&(u=p.length,c=p);let h=e.scratch.measureText(c),f=h.width+a*(u-1),d=h.actualBoundingBoxAscent,m=h.actualBoundingBoxDescent,g=(d+m)*this.lineHeight.get(e.zoom,n),x=new y(t[0][0].x,t[0][0].y),w={minX:x.x,minY:x.y-d,maxX:x.x+f,maxY:x.y+m+(o.length-1)*g};return[{anchor:x,bboxes:[w],draw:l((p,_)=>{p.globalAlpha=1,p.font=s,p.fillStyle=this.fill.get(e.zoom,n);let S=this.width.get(e.zoom,n),b=0;for(let T of o){let P=0;if(this.justify===2||_&&_.justify===2?P=(f-p.measureText(T).width)/2:(this.justify===3||_&&_.justify===3)&&(P=f-p.measureText(T).width),S)if(p.lineWidth=S*2,p.strokeStyle=this.stroke.get(e.zoom,n),a>0){let v=P;for(let F of T)p.strokeText(F,v,b),v+=p.measureText(F).width+a}else p.strokeText(T,P,b);if(a>0){let v=P;for(let F of T)p.fillText(F,v,b),v+=p.measureText(F).width+a}else p.fillText(T,P,b);b+=g}},"draw")}]}};l(Zt,"TextSymbolizer");var Me=Zt,Jt=class Jt{constructor(e){this.centered=new Ge(new Me(e))}place(e,t,n){return this.centered.place(e,t,n)}};l(Jt,"CenteredTextSymbolizer");var W=Jt,Kt=class Kt{constructor(e,t){var n,r,s;this.symbolizer=e,this.offsetX=new M(t.offsetX,0),this.offsetY=new M(t.offsetY,0),this.justify=(n=t.justify)!=null?n:void 0,this.placements=(r=t.placements)!=null?r:[2,6,8,4,1,3,5,7],this.ddValues=(s=t.ddValues)!=null?s:()=>({})}place(e,t,n){if(n.geomType!==1)return;let r=t[0][0],s=this.symbolizer.place(e,[[new y(0,0)]],n);if(!s||s.length===0)return;let a=s[0],o=a.bboxes[0],c=this.offsetX,u=this.offsetY,h=this.justify,f=this.placements,{offsetX:d,offsetY:m,justify:g,placements:x}=this.ddValues(e.zoom,n)||{};d&&(c=new M(d,0)),m&&(u=new M(m,0)),g&&(h=g),x&&(f=x);let w=c.get(e.zoom,n),k=u.get(e.zoom,n),p=l((P,v)=>({minX:P.x+v.x+o.minX,minY:P.y+v.y+o.minY,maxX:P.x+v.x+o.maxX,maxY:P.y+v.y+o.maxY}),"getBbox"),_=new y(w,k),S,b=l(P=>{P.translate(_.x,_.y),a.draw(P,{justify:S})},"draw"),T=l((P,v)=>{let F=p(P,v);if(!e.index.bboxCollides(F,e.order))return[{anchor:r,bboxes:[F],draw:b}]},"placeLabelInPoint");for(let P of f){let v=this.computeXaxisOffset(w,o,P),F=this.computeYaxisOffset(k,o,P);return S=this.computeJustify(h,P),_=new y(v,F),T(r,_)}}computeXaxisOffset(e,t,n){let r=t.maxX,s=r/2;return[1,5].includes(n)?e-s:[8,7,6].includes(n)?e-r:e}computeYaxisOffset(e,t,n){let r=Math.abs(t.minY),s=t.maxY,a=(t.minY+t.maxY)/2;return[3,7].includes(n)?e-a:[8,2,1].includes(n)?e-s:[6,4,5].includes(n)?e+r:e}computeJustify(e,t){return e||([1,5].includes(t)?2:[2,3,4].includes(t)?1:3)}};l(Kt,"OffsetSymbolizer");var Qe=Kt,Gt=class Gt{constructor(e){this.symbolizer=new Qe(new Me(e),e)}place(e,t,n){return this.symbolizer.place(e,t,n)}};l(Gt,"OffsetTextSymbolizer");var Se=Gt,ii=(n=>(n[n.Above=1]="Above",n[n.Center=2]="Center",n[n.Below=3]="Below",n))(ii||{}),Qt=class Qt{constructor(e){var t;this.font=new te(e),this.text=new ee(e),this.fill=new B(e.fill,"black"),this.stroke=new B(e.stroke,"black"),this.width=new M(e.width,0),this.offset=new M(e.offset,0),this.position=(t=e.position)!=null?t:1,this.maxLabelCodeUnits=new M(e.maxLabelChars,40),this.repeatDistance=new M(e.repeatDistance,250)}place(e,t,n){let r=this.text.get(e.zoom,n);if(!r||r.length>this.maxLabelCodeUnits.get(e.zoom,n))return;let s=20,a=n.bbox;if(a.maxY-a.minY<s&&a.maxX-a.minX<s)return;let o=this.font.get(e.zoom,n);e.scratch.font=o;let c=e.scratch.measureText(r),u=c.width,h=c.actualBoundingBoxAscent+c.actualBoundingBoxDescent,f=this.repeatDistance.get(e.zoom,n);e.overzoom>4&&(f*=1<<e.overzoom-4);let d=h*2,m=Pn(t,u,f,d);if(m.length===0)return;let g=[];for(let x of m){let w=x.end.x-x.start.x,k=x.end.y-x.start.y,_=Tn(x.start,x.end,u,d/2).map(b=>({minX:b.x-d/2,minY:b.y-d/2,maxX:b.x+d/2,maxY:b.y+d/2})),S=l(b=>{b.globalAlpha=1,b.rotate(Math.atan2(k,w)),w<0&&(b.scale(-1,-1),b.translate(-u,0));let T=0;this.position===3?T+=h:this.position===2&&(T+=h/2),b.translate(0,T-this.offset.get(e.zoom,n)),b.font=o;let P=this.width.get(e.zoom,n);P&&(b.lineWidth=P,b.strokeStyle=this.stroke.get(e.zoom,n),b.strokeText(r,0,0)),b.fillStyle=this.fill.get(e.zoom,n),b.fillText(r,0,0)},"draw");g.push({anchor:x.start,bboxes:_,draw:S,deduplicationKey:r,deduplicationDistance:f})}return g}};l(Qt,"LineLabelSymbolizer");var Z=Qt;var Y=l((i,e)=>{let t=i[e];return typeof t=="string"?t:""},"getString"),ri=l((i,e)=>{let t=i[e];return typeof t=="number"?t:0},"getNumber"),Fe=l(i=>[{dataLayer:"earth",symbolizer:new C({fill:i.earth})},{dataLayer:"landuse",symbolizer:new C({fill:l((e,t)=>Ue(i.park_a,i.park_b,Math.min(Math.max(e/12,12),0)),"fill")}),filter:l((e,t)=>{let n=Y(t.props,"pmap:kind");return["allotments","village_green","playground"].includes(n)},"filter")},{dataLayer:"landuse",symbolizer:new C({fill:i.park_b,opacity:.7}),filter:l((e,t)=>{let n=Y(t.props,"pmap:kind");return["national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course"].includes(n)},"filter")},{dataLayer:"landuse",symbolizer:new C({fill:i.hospital}),filter:l((e,t)=>t.props["pmap:kind"]==="hospital","filter")},{dataLayer:"landuse",symbolizer:new C({fill:i.industrial}),filter:l((e,t)=>t.props["pmap:kind"]==="industrial","filter")},{dataLayer:"landuse",symbolizer:new C({fill:i.school}),filter:l((e,t)=>{let n=Y(t.props,"pmap:kind");return["school","university","college"].includes(n)},"filter")},{dataLayer:"landuse",symbolizer:new C({fill:i.beach}),filter:l((e,t)=>t.props["pmap:kind"]==="beach","filter")},{dataLayer:"landuse",symbolizer:new C({fill:i.zoo}),filter:l((e,t)=>t.props["pmap:kind"]==="zoo","filter")},{dataLayer:"landuse",symbolizer:new C({fill:i.zoo}),filter:l((e,t)=>{let n=Y(t.props,"pmap:kind");return["military","naval_base","airfield"].includes(n)},"filter")},{dataLayer:"natural",symbolizer:new C({fill:l((e,t)=>Ue(i.wood_a,i.wood_b,Math.min(Math.max(e/12,12),0)),"fill")}),filter:l((e,t)=>{let n=Y(t.props,"pmap:kind");return["wood","nature_reserve","forest"].includes(n)},"filter")},{dataLayer:"natural",symbolizer:new C({fill:l((e,t)=>Ue(i.scrub_a,i.scrub_b,Math.min(Math.max(e/12,12),0)),"fill")}),filter:l((e,t)=>{let n=Y(t.props,"pmap:kind");return["scrub","grassland","grass"].includes(n)},"filter")},{dataLayer:"natural",symbolizer:new C({fill:i.scrub_b}),filter:l((e,t)=>{let n=Y(t.props,"pmap:kind");return["scrub","grassland","grass"].includes(n)},"filter")},{dataLayer:"natural",symbolizer:new C({fill:i.glacier}),filter:l((e,t)=>t.props["pmap:kind"]==="glacier","filter")},{dataLayer:"natural",symbolizer:new C({fill:i.sand}),filter:l((e,t)=>t.props["pmap:kind"]==="sand","filter")},{dataLayer:"landuse",symbolizer:new C({fill:i.aerodrome}),filter:l((e,t)=>t.props["pmap:kind"]==="aerodrome","filter")},{dataLayer:"water",symbolizer:new C({fill:i.water})},{dataLayer:"transit",symbolizer:new R({color:i.runway,width:l((e,t)=>X(1.6,[[11,0],[13,4],[19,30]])(e),"width")}),filter:l((e,t)=>t.props["pmap:kind_detail"]==="runway","filter")},{dataLayer:"transit",symbolizer:new R({color:i.runway,width:l((e,t)=>X(1.6,[[14,0],[14.5,1],[16,6]])(e),"width")}),filter:l((e,t)=>t.props["pmap:kind_detail"]==="taxiway","filter")},{dataLayer:"transit",symbolizer:new R({color:i.pier,width:l((e,t)=>X(1.6,[[13,0],[13.5,0,5],[21,16]])(e),"width")}),filter:l((e,t)=>t.props["pmap:kind"]==="pier","filter")},{dataLayer:"physical_line",minzoom:14,symbolizer:new R({color:i.water,width:l((e,t)=>X(1.6,[[9,0],[9.5,1],[18,12]])(e),"width")}),filter:l((e,t)=>t.props["pmap:kind"]==="river","filter")},{dataLayer:"physical_line",minzoom:14,symbolizer:new R({color:i.water,width:.5}),filter:l((e,t)=>t.props["pmap:kind"]==="stream","filter")},{dataLayer:"landuse",symbolizer:new C({fill:i.pedestrian}),filter:l((e,t)=>t.props["pmap:kind"]==="pedestrian","filter")},{dataLayer:"landuse",symbolizer:new C({fill:i.pier}),filter:l((e,t)=>t.props["pmap:kind"]==="pier","filter")},{dataLayer:"buildings",symbolizer:new C({fill:i.buildings,opacity:.5})},{dataLayer:"roads",symbolizer:new R({color:i.major,width:l((e,t)=>X(1.6,[[14,0],[20,7]])(e),"width")}),filter:l((e,t)=>{let n=Y(t.props,"pmap:kind");return["other","path"].includes(n)},"filter")},{dataLayer:"roads",symbolizer:new R({color:i.major,width:l((e,t)=>X(1.6,[[13,0],[18,8]])(e),"width")}),filter:l((e,t)=>t.props["pmap:kind"]==="minor_road","filter")},{dataLayer:"roads",symbolizer:new R({color:i.major,width:l((e,t)=>X(1.6,[[7,0],[12,1.2],[15,3],[18,13]])(e),"width")}),filter:l((e,t)=>t.props["pmap:kind"]==="medium_road","filter")},{dataLayer:"roads",symbolizer:new R({color:i.major,width:l((e,t)=>X(1.6,[[6,0],[12,1.6],[15,3],[18,13]])(e),"width")}),filter:l((e,t)=>t.props["pmap:kind"]==="major_road","filter")},{dataLayer:"roads",symbolizer:new R({color:i.major,width:l((e,t)=>X(1.6,[[3,0],[6,1.1],[12,1.6],[15,5],[18,15]])(e),"width")}),filter:l((e,t)=>t.props["pmap:kind"]==="highway","filter")},{dataLayer:"boundaries",symbolizer:new R({dash:[3,2],color:i.boundaries,width:1}),filter:l((e,t)=>{let n=t.props["pmap:min_admin_level"];return typeof n=="number"&&n<=2},"filter")},{dataLayer:"transit",symbolizer:new R({dash:[.3,.75],color:i.railway,dashWidth:l((e,t)=>X(1.6,[[4,0],[7,.15],[19,9]])(e),"dashWidth"),opacity:.5}),filter:l((e,t)=>t.props["pmap:kind"]==="rail","filter")},{dataLayer:"boundaries",symbolizer:new R({dash:[3,2],color:i.boundaries,width:.5}),filter:l((e,t)=>{let n=t.props["pmap:min_admin_level"];return typeof n=="number"&&n>2},"filter")}],"paintRules"),Ce=l(i=>{let e=["name"];return[{dataLayer:"roads",symbolizer:new Z({labelProps:e,fill:i.roads_label_minor,font:"400 12px sans-serif",width:2,stroke:i.roads_label_minor_halo}),minzoom:16,filter:l((t,n)=>{let r=Y(n.props,"pmap:kind");return["minor_road","other","path"].includes(r)},"filter")},{dataLayer:"roads",symbolizer:new Z({labelProps:e,fill:i.roads_label_major,font:"400 12px sans-serif",width:2,stroke:i.roads_label_major_halo}),minzoom:12,filter:l((t,n)=>{let r=Y(n.props,"pmap:kind");return["highway","major_road","medium_road"].includes(r)},"filter")},{dataLayer:"roads",symbolizer:new Z({labelProps:e,fill:i.roads_label_major,font:"400 12px sans-serif",width:2,stroke:i.roads_label_major_halo}),minzoom:12,filter:l((t,n)=>{let r=Y(n.props,"pmap:kind");return["highway","major_road","medium_road"].includes(r)},"filter")},{dataLayer:"physical_point",symbolizer:new W({labelProps:e,fill:i.ocean_label,lineHeight:1.5,letterSpacing:1,font:l((t,n)=>`400 ${et([[3,10],[10,12]])(t)}px sans-serif`,"font"),textTransform:"uppercase"}),filter:l((t,n)=>{let r=Y(n.props,"pmap:kind");return["ocean","bay","strait","fjord"].includes(r)},"filter")},{dataLayer:"physical_point",symbolizer:new W({labelProps:e,fill:i.ocean_label,lineHeight:1.5,letterSpacing:1,font:l((t,n)=>`400 ${et([[3,0],[6,12],[10,12]])(t)}px sans-serif`,"font")}),filter:l((t,n)=>{let r=Y(n.props,"pmap:kind");return["sea","lake","water"].includes(r)},"filter")},{dataLayer:"places",symbolizer:new W({labelProps:l((t,n)=>t<6?["name:short"]:e,"labelProps"),fill:i.state_label,stroke:i.state_label_halo,width:1,lineHeight:1.5,font:l((t,n)=>t<6?"400 16px sans-serif":"400 12px sans-serif","font"),textTransform:"uppercase"}),filter:l((t,n)=>n.props["pmap:kind"]==="region","filter")},{dataLayer:"places",symbolizer:new W({labelProps:e,fill:i.country_label,lineHeight:1.5,font:l((t,n)=>(t<6,"600 12px sans-serif"),"font"),textTransform:"uppercase"}),filter:l((t,n)=>n.props["pmap:kind"]==="country","filter")},{dataLayer:"places",minzoom:9,symbolizer:new W({labelProps:e,fill:i.city_label,lineHeight:1.5,font:l((t,n)=>{if(!n)return"400 12px sans-serif";let r=n.props["pmap:min_zoom"],s=400;r&&r<=5&&(s=600);let a=12,o=n.props["pmap:population_rank"];return o&&o>9&&(a=16),`${s} ${a}px sans-serif`},"font")}),sort:l((t,n)=>{let r=ri(t,"pmap:population_rank"),s=ri(n,"pmap:population_rank");return r-s},"sort"),filter:l((t,n)=>n.props["pmap:kind"]==="locality","filter")},{dataLayer:"places",maxzoom:8,symbolizer:new Le([new Te({radius:2,fill:i.city_circle,stroke:i.city_circle_stroke,width:1.5}),new Se({labelProps:e,fill:i.city_label,stroke:i.city_label_halo,width:1,offsetX:6,offsetY:4.5,font:l((t,n)=>"400 12px sans-serif","font")})]),filter:l((t,n)=>n.props["pmap:kind"]==="locality","filter")}]},"labelRules");var Zr={background:"#cccccc",earth:"#e0e0e0",park_a:"#cfddd5",park_b:"#9cd3b4",hospital:"#e4dad9",industrial:"#d1dde1",school:"#e4ded7",wood_a:"#d0ded0",wood_b:"#a0d9a0",pedestrian:"#e3e0d4",scrub_a:"#cedcd7",scrub_b:"#99d2bb",glacier:"#e7e7e7",sand:"#e2e0d7",beach:"#e8e4d0",aerodrome:"#dadbdf",runway:"#e9e9ed",water:"#80deea",pier:"#e0e0e0",zoo:"#c6dcdc",military:"#dcdcdc",tunnel_other_casing:"#e0e0e0",tunnel_minor_casing:"#e0e0e0",tunnel_link_casing:"#e0e0e0",tunnel_medium_casing:"#e0e0e0",tunnel_major_casing:"#e0e0e0",tunnel_highway_casing:"#e0e0e0",tunnel_other:"#d5d5d5",tunnel_minor:"#d5d5d5",tunnel_link:"#d5d5d5",tunnel_medium:"#d5d5d5",tunnel_major:"#d5d5d5",tunnel_highway:"#d5d5d5",transit_pier:"#e0e0e0",buildings:"#cccccc",minor_service_casing:"#e0e0e0",minor_casing:"#e0e0e0",link_casing:"#e0e0e0",medium_casing:"#e0e0e0",major_casing_late:"#e0e0e0",highway_casing_late:"#e0e0e0",other:"#ebebeb",minor_service:"#ebebeb",minor_a:"#ebebeb",minor_b:"#ffffff",link:"#ffffff",medium:"#f5f5f5",major_casing_early:"#e0e0e0",major:"#ffffff",highway_casing_early:"#e0e0e0",highway:"#ffffff",railway:"#a7b1b3",boundaries:"#adadad",waterway_label:"#ffffff",bridges_other_casing:"#e0e0e0",bridges_minor_casing:"#e0e0e0",bridges_link_casing:"#e0e0e0",bridges_medium_casing:"#e0e0e0",bridges_major_casing:"#e0e0e0",bridges_highway_casing:"#e0e0e0",bridges_other:"#ebebeb",bridges_minor:"#ffffff",bridges_link:"#ffffff",bridges_medium:"#f0eded",bridges_major:"#f5f5f5",bridges_highway:"#ffffff",roads_label_minor:"#91888b",roads_label_minor_halo:"#ffffff",roads_label_major:"#938a8d",roads_label_major_halo:"#ffffff",ocean_label:"#ffffff",peak_label:"#7e9aa0",subplace_label:"#8f8f8f",subplace_label_halo:"#e0e0e0",city_circle:"#ffffff",city_circle_stroke:"#a3a3a3",city_label:"#5c5c5c",city_label_halo:"#e0e0e0",state_label:"#b3b3b3",state_label_halo:"#e0e0e0",country_label:"#a3a3a3"},Jr={background:"#34373d",earth:"#1f1f1f",park_a:"#232325",park_b:"#232325",hospital:"#252424",industrial:"#222222",school:"#262323",wood_a:"#202121",wood_b:"#202121",pedestrian:"#1e1e1e",scrub_a:"#222323",scrub_b:"#222323",glacier:"#1c1c1c",sand:"#212123",beach:"#28282a",aerodrome:"#1e1e1e",runway:"#333333",water:"#34373d",pier:"#222222",zoo:"#222323",military:"#242323",tunnel_other_casing:"#141414",tunnel_minor_casing:"#141414",tunnel_link_casing:"#141414",tunnel_medium_casing:"#141414",tunnel_major_casing:"#141414",tunnel_highway_casing:"#141414",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_medium:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",transit_pier:"#333333",buildings:"#111111",minor_service_casing:"#1f1f1f",minor_casing:"#1f1f1f",link_casing:"#1f1f1f",medium_casing:"#1f1f1f",major_casing_late:"#1f1f1f",highway_casing_late:"#1f1f1f",other:"#333333",minor_service:"#333333",minor_a:"#3d3d3d",minor_b:"#333333",link:"#3d3d3d",medium:"#3d3d3d",major_casing_early:"#1f1f1f",major:"#3d3d3d",highway_casing_early:"#1f1f1f",highway:"#474747",railway:"#000000",boundaries:"#5b6374",waterway_label:"#717784",bridges_other_casing:"#2b2b2b",bridges_minor_casing:"#1f1f1f",bridges_link_casing:"#1f1f1f",bridges_medium_casing:"#1f1f1f",bridges_major_casing:"#1f1f1f",bridges_highway_casing:"#1f1f1f",bridges_other:"#333333",bridges_minor:"#333333",bridges_link:"#3d3d3d",bridges_medium:"#3d3d3d",bridges_major:"#3d3d3d",bridges_highway:"#474747",roads_label_minor:"#525252",roads_label_minor_halo:"#1f1f1f",roads_label_major:"#666666",roads_label_major_halo:"#1f1f1f",ocean_label:"#717784",peak_label:"#898080",subplace_label:"#525252",subplace_label_halo:"#1f1f1f",city_circle:"#000000",city_circle_stroke:"#7a7a7a",city_label:"#7a7a7a",city_label_halo:"#212121",state_label:"#3d3d3d",state_label_halo:"#1f1f1f",country_label:"#5c5c5c"},Kr={background:"#ffffff",earth:"#ffffff",park_a:"#fcfcfc",park_b:"#fcfcfc",hospital:"#f8f8f8",industrial:"#fcfcfc",school:"#f8f8f8",wood_a:"#fafafa",wood_b:"#fafafa",pedestrian:"#fdfdfd",scrub_a:"#fafafa",scrub_b:"#fafafa",glacier:"#fcfcfc",sand:"#fafafa",beach:"#f6f6f6",aerodrome:"#fdfdfd",runway:"#efefef",water:"#dcdcdc",pier:"#f5f5f5",zoo:"#f7f7f7",military:"#fcfcfc",tunnel_other_casing:"#d6d6d6",tunnel_minor_casing:"#fcfcfc",tunnel_link_casing:"#fcfcfc",tunnel_medium_casing:"#fcfcfc",tunnel_major_casing:"#fcfcfc",tunnel_highway_casing:"#fcfcfc",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_medium:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",transit_pier:"#efefef",buildings:"#efefef",minor_service_casing:"#ffffff",minor_casing:"#ffffff",link_casing:"#ffffff",medium_casing:"#ffffff",major_casing_late:"#ffffff",highway_casing_late:"#ffffff",other:"#f5f5f5",minor_service:"#f5f5f5",minor_a:"#ebebeb",minor_b:"#f5f5f5",link:"#ebebeb",medium:"#ebebeb",major_casing_early:"#ffffff",major:"#ebebeb",highway_casing_early:"#ffffff",highway:"#ebebeb",railway:"#d6d6d6",boundaries:"#adadad",waterway_label:"#adadad",bridges_other_casing:"#ffffff",bridges_minor_casing:"#ffffff",bridges_link_casing:"#ffffff",bridges_medium_casing:"#ffffff",bridges_major_casing:"#ffffff",bridges_highway_casing:"#ffffff",bridges_other:"#f5f5f5",bridges_minor:"#f5f5f5",bridges_link:"#ebebeb",bridges_medium:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#adadad",roads_label_minor_halo:"#ffffff",roads_label_major:"#999999",roads_label_major_halo:"#ffffff",ocean_label:"#adadad",peak_label:"#adadad",subplace_label:"#8f8f8f",subplace_label_halo:"#ffffff",city_circle:"#ffffff",city_circle_stroke:"#adadad",city_label:"#5c5c5c",city_label_halo:"#ffffff",state_label:"#b3b3b3",state_label_halo:"#ffffff",country_label:"#b8b8b8"},Gr={background:"#a3a3a3",earth:"#cccccc",park_a:"#c2c2c2",park_b:"#c2c2c2",hospital:"#d0d0d0",industrial:"#c6c6c6",school:"#d0d0d0",wood_a:"#c2c2c2",wood_b:"#c2c2c2",pedestrian:"#c4c4c4",scrub_a:"#c2c2c2",scrub_b:"#c2c2c2",glacier:"#d2d2d2",sand:"#d2d2d2",beach:"#d2d2d2",aerodrome:"#c9c9c9",runway:"#f5f5f5",water:"#a3a3a3",pier:"#b8b8b8",zoo:"#c7c7c7",military:"#bfbfbf",tunnel_other_casing:"#b8b8b8",tunnel_minor_casing:"#b8b8b8",tunnel_link_casing:"#b8b8b8",tunnel_medium_casing:"#b8b8b8",tunnel_major_casing:"#b8b8b8",tunnel_highway_casing:"#b8b8b8",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_medium:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",transit_pier:"#b8b8b8",buildings:"#e0e0e0",minor_service_casing:"#cccccc",minor_casing:"#cccccc",link_casing:"#cccccc",medium_casing:"#cccccc",major_casing_late:"#cccccc",highway_casing_late:"#cccccc",other:"#e0e0e0",minor_service:"#e0e0e0",minor_a:"#ebebeb",minor_b:"#e0e0e0",link:"#ebebeb",medium:"#ebebeb",major_casing_early:"#cccccc",major:"#ebebeb",highway_casing_early:"#cccccc",highway:"#ebebeb",railway:"#f5f5f5",boundaries:"#5c5c5c",waterway_label:"#7a7a7a",bridges_other_casing:"#cccccc",bridges_minor_casing:"#cccccc",bridges_link_casing:"#cccccc",bridges_medium_casing:"#cccccc",bridges_major_casing:"#cccccc",bridges_highway_casing:"#cccccc",bridges_other:"#e0e0e0",bridges_minor:"#e0e0e0",bridges_link:"#ebebeb",bridges_medium:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#999999",roads_label_minor_halo:"#e0e0e0",roads_label_major:"#8f8f8f",roads_label_major_halo:"#ebebeb",ocean_label:"#7a7a7a",peak_label:"#5c5c5c",subplace_label:"#7a7a7a",subplace_label_halo:"#cccccc",city_circle:"#c2c2c2",city_circle_stroke:"#7a7a7a",city_label:"#474747",city_label_halo:"#cccccc",state_label:"#999999",state_label_halo:"#cccccc",country_label:"#858585"},Qr={background:"#2b2b2b",earth:"#141414",park_a:"#181818",park_b:"#181818",hospital:"#1d1d1d",industrial:"#101010",school:"#111111",wood_a:"#1a1a1a",wood_b:"#1a1a1a",pedestrian:"#191919",scrub_a:"#1c1c1c",scrub_b:"#1c1c1c",glacier:"#191919",sand:"#161616",beach:"#1f1f1f",aerodrome:"#191919",runway:"#323232",water:"#333333",pier:"#0a0a0a",zoo:"#191919",military:"#121212",tunnel_other_casing:"#101010",tunnel_minor_casing:"#101010",tunnel_link_casing:"#101010",tunnel_medium_casing:"#101010",tunnel_major_casing:"#101010",tunnel_highway_casing:"#101010",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_medium:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",transit_pier:"#0a0a0a",buildings:"#0a0a0a",minor_service_casing:"#141414",minor_casing:"#141414",link_casing:"#141414",medium_casing:"#141414",major_casing_late:"#141414",highway_casing_late:"#141414",other:"#1f1f1f",minor_service:"#1f1f1f",minor_a:"#292929",minor_b:"#1f1f1f",link:"#1f1f1f",medium:"#292929",major_casing_early:"#141414",major:"#292929",highway_casing_early:"#141414",highway:"#292929",railway:"#292929",boundaries:"#707070",waterway_label:"#707070",bridges_other_casing:"#141414",bridges_minor_casing:"#141414",bridges_link_casing:"#141414",bridges_medium_casing:"#141414",bridges_major_casing:"#141414",bridges_highway_casing:"#141414",bridges_other:"#1f1f1f",bridges_minor:"#1f1f1f",bridges_link:"#292929",bridges_medium:"#292929",bridges_major:"#292929",bridges_highway:"#292929",roads_label_minor:"#525252",roads_label_minor_halo:"#141414",roads_label_major:"#5c5c5c",roads_label_major_halo:"#141414",ocean_label:"#707070",peak_label:"#707070",subplace_label:"#5c5c5c",subplace_label_halo:"#141414",city_circle:"#000000",city_circle_stroke:"#666666",city_label:"#999999",city_label_halo:"#141414",state_label:"#3d3d3d",state_label_halo:"#141414",country_label:"#707070"},tt={light:Zr,dark:Jr,white:Kr,grayscale:Gr,black:Qr};function en(i,e,t,n,r){si(i,e,t||0,n||i.length-1,r||es)}l(en,"quickselect");function si(i,e,t,n,r){for(;n>t;){if(n-t>600){var s=n-t+1,a=e-t+1,o=Math.log(s),c=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*c*(s-c)/s)*(a-s/2<0?-1:1),h=Math.max(t,Math.floor(e-a*c/s+u)),f=Math.min(n,Math.floor(e+(s-a)*c/s+u));si(i,e,h,f,r)}var d=i[e],m=t,g=n;for(De(i,t,e),r(i[n],d)>0&&De(i,t,n);m<g;){for(De(i,m,g),m++,g--;r(i[m],d)<0;)m++;for(;r(i[g],d)>0;)g--}r(i[t],d)===0?De(i,t,g):(g++,De(i,g,n)),g<=e&&(t=g+1),e<=g&&(n=g-1)}}l(si,"quickselectStep");function De(i,e,t){var n=i[e];i[e]=i[t],i[t]=n}l(De,"swap");function es(i,e){return i<e?-1:i>e?1:0}l(es,"defaultCompare");var rn=class rn{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!it(e,t))return n;let r=this.toBBox,s=[];for(;t;){for(let a=0;a<t.children.length;a++){let o=t.children[a],c=t.leaf?r(o):o;it(e,c)&&(t.leaf?n.push(o):nn(e,c)?this._all(o,n):s.push(o))}t=s.pop()}return n}collides(e){let t=this.data;if(!it(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let s=t.children[r],a=t.leaf?this.toBBox(s):s;if(it(e,a)){if(t.leaf||nn(e,a))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=fe([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],a=[],o,c,u;for(;n||s.length;){if(n||(n=s.pop(),c=s[s.length-1],o=a.pop(),u=!0),n.leaf){let h=ts(e,n.children,t);if(h!==-1)return n.children.splice(h,1),s.push(n),this._condense(s),this}!u&&!n.leaf&&nn(n,r)?(s.push(n),a.push(o),o=0,c=n,n=n.children[0]):c?(o++,n=c.children[o],u=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let s=n-t+1,a=this._maxEntries,o;if(s<=a)return o=fe(e.slice(t,n+1)),he(o,this.toBBox),o;r||(r=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/Math.pow(a,r-1))),o=fe([]),o.leaf=!1,o.height=r;let c=Math.ceil(s/a),u=c*Math.ceil(Math.sqrt(a));ai(e,t,n,u,this.compareMinX);for(let h=t;h<=n;h+=u){let f=Math.min(h+u-1,n);ai(e,h,f,c,this.compareMinY);for(let d=h;d<=f;d+=c){let m=Math.min(d+c-1,f);o.children.push(this._build(e,d,m,r-1))}}return he(o,this.toBBox),o}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,a=1/0,o;for(let c=0;c<t.children.length;c++){let u=t.children[c],h=tn(u),f=rs(e,u)-h;f<a?(a=f,s=h<s?h:s,o=u):f===a&&h<s&&(s=h,o=u)}t=o||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),s=[],a=this._chooseSubtree(r,this.data,t,s);for(a.children.push(e),Be(a,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){let n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);let a=this._chooseSplitIndex(n,s,r),o=fe(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,he(n,this.toBBox),he(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=fe([e,t]),this.data.height=e.height+1,this.data.leaf=!1,he(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,a=1/0;for(let o=t;o<=n-t;o++){let c=Ae(e,0,o,this.toBBox),u=Ae(e,o,n,this.toBBox),h=ss(c,u),f=tn(c)+tn(u);h<s?(s=h,r=o,a=f<a?f:a):h===s&&f<a&&(a=f,r=o)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:ns,s=e.leaf?this.compareMinY:is,a=this._allDistMargin(e,t,n,r),o=this._allDistMargin(e,t,n,s);a<o&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let s=this.toBBox,a=Ae(e,0,t,s),o=Ae(e,n-t,n,s),c=nt(a)+nt(o);for(let u=t;u<n-t;u++){let h=e.children[u];Be(a,e.leaf?s(h):h),c+=nt(a)}for(let u=n-t-1;u>=t;u--){let h=e.children[u];Be(o,e.leaf?s(h):h),c+=nt(o)}return c}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Be(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():he(e[t],this.toBBox)}};l(rn,"RBush");var Re=rn;function ts(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}l(ts,"findItem");function he(i,e){Ae(i,0,i.children.length,e,i)}l(he,"calcBBox");function Ae(i,e,t,n,r){r||(r=fe(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){let a=i.children[s];Be(r,i.leaf?n(a):a)}return r}l(Ae,"distBBox");function Be(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}l(Be,"extend");function ns(i,e){return i.minX-e.minX}l(ns,"compareNodeMinX");function is(i,e){return i.minY-e.minY}l(is,"compareNodeMinY");function tn(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}l(tn,"bboxArea");function nt(i){return i.maxX-i.minX+(i.maxY-i.minY)}l(nt,"bboxMargin");function rs(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}l(rs,"enlargedArea");function ss(i,e){let t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}l(ss,"intersectionArea");function nn(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}l(nn,"contains");function it(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}l(it,"intersects");function fe(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}l(fe,"createNode");function ai(i,e,t,n,r){let s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;let a=e+Math.ceil((t-e)/n/2)*n;en(i,a,e,t,r),s.push(e,a,a,t)}}l(ai,"multiSelect");var Ie=l((i,e,t)=>{let n=[];for(let r of i){let s=[];for(let a of r)s.push(a.clone().mult(e).add(t));n.push(s)}return n},"transformGeom"),Oe=l((i,e)=>{let t=1<<e;return i<0?t+i:i>=t?i%t:i},"wrap"),sn=class sn{constructor(e,t,n){this.tileCache=e,this.maxDataLevel=t,this.levelDiff=n}dataTilesForBounds(e,t){let n=D(2,e)/D(2,Math.ceil(e)),r=[],s=1,a=this.tileCache.tileSize;if(e<this.levelDiff)s=1/(1<<this.levelDiff-e)*n,r.push({dataTile:{z:0,x:0,y:0},origin:new y(0,0),scale:s,dim:a*s});else if(e<=this.levelDiff+this.maxDataLevel){let o=1<<this.levelDiff,c=256*n,u=Math.ceil(e)-this.levelDiff,h=Math.floor(t.minX/o/c),f=Math.floor(t.minY/o/c),d=Math.floor(t.maxX/o/c),m=Math.floor(t.maxY/o/c);for(let g=h;g<=d;g++)for(let x=f;x<=m;x++){let w=new y(g*o*c,x*o*c);r.push({dataTile:{z:u,x:Oe(g,u),y:Oe(x,u)},origin:w,scale:n,dim:a*n})}}else{let o=1<<this.levelDiff;s=(1<<Math.ceil(e)-this.maxDataLevel-this.levelDiff)*n;let c=Math.floor(t.minX/o/256/s),u=Math.floor(t.minY/o/256/s),h=Math.floor(t.maxX/o/256/s),f=Math.floor(t.maxY/o/256/s);for(let d=c;d<=h;d++)for(let m=u;m<=f;m++){let g=new y(d*o*256*s,m*o*256*s);r.push({dataTile:{z:this.maxDataLevel,x:Oe(d,this.maxDataLevel),y:Oe(m,this.maxDataLevel)},origin:g,scale:s,dim:a*s})}}return r}dataTileForDisplayTile(e){let t,n=1,r=this.tileCache.tileSize,s;if(e.z<this.levelDiff)t={z:0,x:0,y:0},n=1/(1<<this.levelDiff-e.z),s=new y(0,0),r=r*n;else if(e.z<=this.levelDiff+this.maxDataLevel){let a=1<<this.levelDiff;t={z:e.z-this.levelDiff,x:Math.floor(e.x/a),y:Math.floor(e.y/a)},s=new y(t.x*a*256,t.y*a*256)}else{n=1<<e.z-this.maxDataLevel-this.levelDiff;let a=1<<this.levelDiff;t={z:this.maxDataLevel,x:Math.floor(e.x/a/n),y:Math.floor(e.y/a/n)},s=new y(t.x*a*n*256,t.y*a*n*256),r=r*n}return{dataTile:t,scale:n,origin:s,dim:r}}getBbox(e,t){return A(this,null,function*(){let n=this.dataTilesForBounds(e,t);return(yield Promise.all(n.map(s=>this.tileCache.get(s.dataTile)))).map((s,a)=>{let o=n[a];return{data:s,z:e,dataTile:o.dataTile,scale:o.scale,dim:o.dim,origin:o.origin}})})}getDisplayTile(e){return A(this,null,function*(){let t=this.dataTileForDisplayTile(e);return{data:yield this.tileCache.get(t.dataTile),z:e.z,dataTile:t.dataTile,scale:t.scale,origin:t.origin,dim:t.dim}})}queryFeatures(e,t,n,r){let s=Math.round(n),a=Math.min(s-this.levelDiff,this.maxDataLevel),o=r/(1<<s-a);return this.tileCache.queryFeatures(e,t,a,o)}};l(sn,"View");var rt=sn,je=l(i=>{let e=l(n=>{let r=n.levelDiff===void 0?1:n.levelDiff,s=n.maxDataZoom||15,a;if(typeof n.url=="string")new URL(n.url,"http://example.com").pathname.endsWith(".pmtiles")?a=new ue(n.url,!0):a=new ze(n.url,!0);else if(n.url)a=new ue(n.url,!0);else throw new Error(`Invalid source ${n.url}`);let o=new Pe(a,256*1<<r);return new rt(o,s,r)},"sourceToViews"),t=new Map;if(i.sources)for(let n in i.sources)t.set(n,e(i.sources[n]));else t.set("",e(i));return t},"sourcesToViews");var oi=l((i,e,t)=>{let r=e/256,s=Math.floor(t.minX/256),a=Math.floor(t.minY/256),o=Math.floor(t.maxX/256),c=Math.floor(t.maxY/256),u=Math.log2(r),h=[];for(let f=s;f<=o;f++){let d=f%(1<<i);for(let m=a;m<=c;m++)h.push({display:q({z:i,x:d,y:m}),key:q({z:i-u,x:Math.floor(d/r),y:Math.floor(m/r)})})}return h},"covering"),an=class an{constructor(e,t){this.tree=new Re,this.current=new Map,this.dim=e,this.maxLabeledTiles=t}hasPrefix(e){for(let t of this.current.keys())if(t.startsWith(e))return!0;return!1}has(e){return this.current.has(e)}size(){return this.current.size}keys(){return this.current.keys()}searchBbox(e,t){let n=new Set;for(let r of this.tree.search(e))r.indexedLabel.order<=t&&n.add(r.indexedLabel);return n}searchLabel(e,t){let n=new Set;for(let r of e.bboxes)for(let s of this.tree.search(r))s.indexedLabel.order<=t&&n.add(s.indexedLabel);return n}bboxCollides(e,t){for(let n of this.tree.search(e))if(n.indexedLabel.order<=t)return!0;return!1}labelCollides(e,t){for(let n of e.bboxes)for(let r of this.tree.search(n))if(r.indexedLabel.order<=t)return!0;return!1}deduplicationCollides(e){if(!e.deduplicationKey||!e.deduplicationDistance)return!1;let t=e.deduplicationDistance,n={minX:e.anchor.x-t,minY:e.anchor.y-t,maxX:e.anchor.x+t,maxY:e.anchor.y+t};for(let r of this.tree.search(n))if(r.indexedLabel.deduplicationKey===e.deduplicationKey&&r.indexedLabel.anchor.dist(e.anchor)<t)return!0;return!1}makeEntry(e){this.current.get(e)&&console.log("consistency error 1");let t=new Set;this.current.set(e,t)}insert(e,t,n){let r={anchor:e.anchor,bboxes:e.bboxes,draw:e.draw,order:t,tileKey:n,deduplicationKey:e.deduplicationKey,deduplicationDistance:e.deduplicationDistance},s=this.current.get(n);if(!s){let c=new Set;this.current.set(n,c),s=c}s.add(r);let a=!1,o=!1;for(let c of e.bboxes)this.tree.insert({minX:c.minX,minY:c.minY,maxX:c.maxX,maxY:c.maxY,indexedLabel:r}),c.minX<0&&(a=!0),c.maxX>this.dim&&(o=!0);if(a||o){let c=a?this.dim:-this.dim,u=[];for(let d of e.bboxes)u.push({minX:d.minX+c,minY:d.minY,maxX:d.maxX+c,maxY:d.maxY});let h={anchor:new y(e.anchor.x+c,e.anchor.y),bboxes:u,draw:e.draw,order:t,tileKey:n},f=this.current.get(n);f&&f.add(h);for(let d of u)this.tree.insert({minX:d.minX,minY:d.minY,maxX:d.maxX,maxY:d.maxY,indexedLabel:h})}}pruneOrNoop(e){let t=e.split(":"),n,r=0,s=0;for(let a of this.current.keys()){let o=a.split(":");if(o[3]===t[3]){s++;let c=Math.sqrt(D(+o[0]-+t[0],2)+D(+o[1]-+t[1],2));c>r&&(r=c,n=a)}n&&s>this.maxLabeledTiles&&this.pruneKey(n)}}pruneKey(e){let t=this.current.get(e);if(!t)return;let n=[];for(let r of this.tree.all())t.has(r.indexedLabel)&&n.push(r);for(let r of n)this.tree.remove(r);this.current.delete(e)}removeLabel(e){let t=[];for(let r of this.tree.all())e===r.indexedLabel&&t.push(r);for(let r of t)this.tree.remove(r);let n=this.current.get(e.tileKey);n&&n.delete(e)}};l(an,"Index");var st=an,on=class on{constructor(e,t,n,r,s){this.index=new st(256*1<<e,r),this.z=e,this.scratch=t,this.labelRules=n,this.callback=s}layout(e){let t=performance.now(),n=new Set;for(let[s,a]of e)for(let o of a){let c=`${q(o.dataTile)}:${s}`;this.index.has(c)||(this.index.makeEntry(c),n.add(c))}let r=new Set;for(let[s,a]of this.labelRules.entries()){if(a.visible===!1||a.minzoom&&this.z<a.minzoom||a.maxzoom&&this.z>a.maxzoom)continue;let o=a.dataSource||"",c=e.get(o);if(c)for(let u of c){let h=`${q(u.dataTile)}:${o}`;if(!n.has(h))continue;let f=u.data.get(a.dataLayer);if(f===void 0)continue;let d=f;a.sort&&d.sort((g,x)=>a.sort?a.sort(g.props,x.props):0);let m={index:this.index,zoom:this.z,scratch:this.scratch,order:s,overzoom:this.z-u.dataTile.z};for(let g of d){if(a.filter&&!a.filter(this.z,g))continue;let x=Ie(g.geom,u.scale,u.origin),w=a.symbolizer.place(m,x,g);if(w)for(let k of w){let p=!1;if(!(k.deduplicationKey&&this.index.deduplicationCollides(k))){if(this.index.labelCollides(k,1/0)){if(!this.index.labelCollides(k,s)){let _=this.index.searchLabel(k,1/0);for(let S of _){this.index.removeLabel(S);for(let b of S.bboxes)this.findInvalidatedTiles(r,u.dim,b,h)}this.index.insert(k,s,h),p=!0}}else this.index.insert(k,s,h),p=!0;if(p)for(let _ of k.bboxes)(_.maxX>u.origin.x+u.dim||_.minX<u.origin.x||_.minY<u.origin.y||_.maxY>u.origin.y+u.dim)&&this.findInvalidatedTiles(r,u.dim,_,h)}}}}}for(let s of n)this.index.pruneOrNoop(s);return r.size>0&&this.callback&&this.callback(r),performance.now()-t}findInvalidatedTiles(e,t,n,r){let s=oi(this.z,t,n);for(let a of s)a.key!==r&&this.index.hasPrefix(a.key)&&e.add(a.display)}add(e){let t=!0;for(let[r,s]of e)for(let a of s)this.index.has(`${q(a.dataTile)}:${r}`)||(t=!1);return t?0:this.layout(e)}};l(on,"Labeler");var de=on,ln=class ln{constructor(e,t,n,r){this.labelers=new Map,this.scratch=e,this.labelRules=t,this.maxLabeledTiles=n,this.callback=r}add(e,t){let n=this.labelers.get(e);return n||(n=new de(e,this.scratch,this.labelRules,this.maxLabeledTiles,this.callback),this.labelers.set(e,n)),n.add(t)}getIndex(e){let t=this.labelers.get(e);if(t)return t.index}};l(ln,"Labelers");var me=ln;function Ee(i,e,t,n,r,s,a,o,c){let u=performance.now();i.save(),i.miterLimit=2;for(let h of r){if(h.minzoom&&e<h.minzoom||h.maxzoom&&e>h.maxzoom)continue;let f=t.get(h.dataSource||"");if(f)for(let d of f){let m=d.data.get(h.dataLayer);if(m===void 0)continue;h.symbolizer.before&&h.symbolizer.before(i,d.z);let g=d.origin,x=d.dim,w=d.scale;if(i.save(),o){i.beginPath();let k=Math.max(g.x-a.x,s.minX-a.x),p=Math.max(g.y-a.y,s.minY-a.y),_=Math.min(g.x-a.x+x,s.maxX-a.x),S=Math.min(g.y-a.y+x,s.maxY-a.y);i.rect(k,p,_-k,S-p),i.clip()}i.translate(g.x-a.x,g.y-a.y);for(let k of m){let p=k.geom,_=k.bbox;_.maxX*w+g.x<s.minX||_.minX*w+g.x>s.maxX||_.minY*w+g.y>s.maxY||_.maxY*w+g.y<s.minY||h.filter&&!h.filter(d.z,k)||(w!==1&&(p=Ie(p,w,new y(0,0))),h.symbolizer.draw(i,p,d.z,k))}i.restore()}}if(o&&(i.beginPath(),i.rect(s.minX-a.x,s.minY-a.y,s.maxX-s.minX,s.maxY-s.minY),i.clip()),n){let h=n.searchBbox(s,1/0);for(let f of h)if(i.save(),i.translate(f.anchor.x-a.x,f.anchor.y-a.y),f.draw(i),i.restore(),c){i.lineWidth=.5,i.strokeStyle=c,i.fillStyle=c,i.globalAlpha=1,i.fillRect(f.anchor.x-a.x-2,f.anchor.y-a.y-2,4,4);for(let d of f.bboxes)i.strokeRect(d.minX-a.x,d.minY-a.y,d.maxX-d.minX,d.maxY-d.minY)}}return i.restore(),performance.now()-u}l(Ee,"paint");var Xe=6378137,li=85.0511287798,V=Xe*Math.PI,ci=l(i=>{let e=Math.PI/180,t=Math.max(Math.min(li,i.y),-li),n=Math.sin(t*e);return new y(Xe*i.x*e,Xe*Math.log((1+n)/(1-n))/2)},"project"),as=l(i=>{let e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(i.y/Xe))-Math.PI/2)*e,lng:i.x*e/Xe}},"unproject"),os=l((i,e)=>t=>{let n=ci(t);return new y((n.x+V)/(V*2),1-(n.y+V)/(V*2)).mult(D(2,e)*256).sub(i)},"instancedProject"),ls=l((i,e)=>t=>{let n=new y(t.x,t.y).add(i).div(D(2,e)*256),r=new y(n.x*(V*2)-V,(1-n.y)*(V*2)-V);return as(r)},"instancedUnproject"),cn=l((i,e)=>{let t=e*(360/i);return Math.log2(t/256)},"getZoom"),hn=class hn{constructor(e){if(e.theme){let t=tt[e.theme];this.paintRules=Fe(t),this.labelRules=Ce(t),this.backgroundColor=t.background}else this.paintRules=e.paintRules||[],this.labelRules=e.labelRules||[],this.backgroundColor=e.backgroundColor;this.views=je(e),this.debug=e.debug||""}drawContext(e,t,n,r,s){return A(this,null,function*(){let a=ci(r),c=new y((a.x+V)/(V*2),1-(a.y+V)/(V*2)).clone().mult(D(2,s)*256).sub(new y(t/2,n/2)),u={minX:c.x,minY:c.y,maxX:c.x+t,maxY:c.y+n},h=[];for(let[p,_]of this.views){let S=_.getBbox(s,u);h.push({key:p,promise:S})}let f=yield Promise.all(h.map(p=>p.promise.then(_=>({status:"fulfilled",value:_,key:p.key}),_=>({status:"rejected",value:[],reason:_,key:p.key})))),d=new Map;for(let p of f)p.status==="fulfilled"&&d.set(p.key,p.value);let m=performance.now(),g=new de(s,e,this.labelRules,16,void 0),x=g.add(d);this.backgroundColor&&(e.save(),e.fillStyle=this.backgroundColor,e.fillRect(0,0,t,n),e.restore());let w=this.paintRules,k=Ee(e,s,d,g.index,w,u,c,!0,this.debug);if(this.debug){e.save(),e.translate(-c.x,-c.y),e.strokeStyle=this.debug,e.fillStyle=this.debug,e.font="12px sans-serif";let p=0;for(let[_,S]of d){for(let b of S){e.strokeRect(b.origin.x,b.origin.y,b.dim,b.dim);let T=b.dataTile;e.fillText(`${_+(_?" ":"")+T.z} ${T.x} ${T.y}`,b.origin.x+4,b.origin.y+14*(1+p))}p++}e.restore()}return{elapsed:performance.now()-m,project:os(c,s),unproject:ls(c,s)}})}drawCanvas(s,a,o){return A(this,arguments,function*(e,t,n,r={}){let c=window.devicePixelRatio,u=e.clientWidth,h=e.clientHeight;e.width===u*c&&e.height===h*c||(e.width=u*c,e.height=h*c),r.lang&&(e.lang=r.lang);let f=e.getContext("2d");if(!f){console.error("Failed to initialize canvas2d context.");return}return f.setTransform(c,0,0,c,0,0),this.drawContext(f,u,h,t,n)})}drawContextBounds(e,t,n,r,s){return A(this,null,function*(){let a=n.x-t.x,o=new y((t.x+n.x)/2,(t.y+n.y)/2);return this.drawContext(e,r,s,o,cn(a,r))})}drawCanvasBounds(a,o,c,u){return A(this,arguments,function*(e,t,n,r,s={}){let h=n.x-t.x,f=new y((t.x+n.x)/2,(t.y+n.y)/2);return this.drawCanvas(e,f,cn(h,r),s)})}};l(hn,"Static");var un=hn;var cs=l(i=>new Promise(e=>{setTimeout(()=>{e()},i)}),"timer"),us=l(i=>i.then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e})),"reflect"),hs=l((i={})=>{let t=class t extends L.GridLayer{constructor(r={}){if(r.noWrap&&!r.bounds&&(r.bounds=[[-90,-180],[90,180]]),r.attribution==null&&(r.attribution='<a href="https://protomaps.com">Protomaps</a> \xA9 <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>'),super(r),r.theme){let a=tt[r.theme];this.paintRules=Fe(a),this.labelRules=Ce(a),this.backgroundColor=a.background}else this.paintRules=r.paintRules||[],this.labelRules=r.labelRules||[],this.backgroundColor=r.backgroundColor;this.lastRequestedZ=void 0,this.tasks=r.tasks||[],this.views=je(r),this.debug=r.debug;let s=document.createElement("canvas").getContext("2d");this.scratch=s,this.onTilesInvalidated=a=>{for(let o of a)this.rerenderTile(o)},this.labelers=new me(this.scratch,this.labelRules,16,this.onTilesInvalidated),this.tileSize=256*window.devicePixelRatio,this.tileDelay=r.tileDelay||3,this.lang=r.lang}renderTile(r,s,a,o=()=>{}){return A(this,null,function*(){this.lastRequestedZ=r.z;let c=[];for(let[v,F]of this.views){let O=F.getDisplayTile(r);c.push({key:v,promise:O})}let u=yield Promise.all(c.map(v=>v.promise.then(F=>({status:"fulfilled",value:F,key:v.key}),F=>({status:"rejected",reason:F,key:v.key})))),h=new Map;for(let v of u)v.status==="fulfilled"?h.set(v.key,[v.value]):v.reason.name==="AbortError"||console.error(v.reason);if(s.key!==a||this.lastRequestedZ!==r.z||(yield Promise.all(this.tasks.map(us)),s.key!==a)||this.lastRequestedZ!==r.z)return;let f=this.labelers.add(r.z,h);if(s.key!==a||this.lastRequestedZ!==r.z)return;let d=this.labelers.getIndex(r.z);if(!this._map)return;let m=this._map.getCenter().wrap(),g=this._getTiledPixelBounds(m),w=this._pxBoundsToTileRange(g).getCenter(),k=r.distanceTo(w)*this.tileDelay;if(yield cs(k),s.key!==a||this.lastRequestedZ!==r.z)return;let p=16,_={minX:256*r.x-p,minY:256*r.y-p,maxX:256*(r.x+1)+p,maxY:256*(r.y+1)+p},S=new y(256*r.x,256*r.y);s.width=this.tileSize,s.height=this.tileSize;let b=s.getContext("2d");if(!b){console.error("Failed to get Canvas context");return}b.setTransform(this.tileSize/256,0,0,this.tileSize/256,0,0),b.clearRect(0,0,256,256),this.backgroundColor&&(b.save(),b.fillStyle=this.backgroundColor,b.fillRect(0,0,256,256),b.restore());let T=0,P=this.paintRules;if(T=Ee(b,r.z,h,this.xray?null:d,P,_,S,!1,this.debug),this.debug){b.save(),b.fillStyle=this.debug,b.font="600 12px sans-serif",b.fillText(`${r.z} ${r.x} ${r.y}`,4,14),b.font="12px sans-serif";let v=28;for(let[F,O]of h){let J=O[0].dataTile;b.fillText(`${F+(F?" ":"")+J.z} ${J.x} ${J.y}`,4,v),v+=14}b.font="600 10px sans-serif",T>8&&(b.fillText(`${T.toFixed()} ms paint`,4,v),v+=14),f>8&&b.fillText(`${f.toFixed()} ms layout`,4,v),b.strokeStyle=this.debug,b.lineWidth=.5,b.beginPath(),b.moveTo(0,0),b.lineTo(0,256),b.stroke(),b.lineWidth=.5,b.beginPath(),b.moveTo(0,0),b.lineTo(256,0),b.stroke(),b.restore()}o()})}rerenderTile(r){for(let s in this._tiles){let a=this._wrapCoords(this._keyToTileCoords(s));r===this._tileCoordsToKey(a)&&this.renderTile(a,this._tiles[s].el,r)}}queryTileFeaturesDebug(r,s,a=16){let o=new Map;for(let[c,u]of this.views)o.set(c,u.queryFeatures(r,s,this._map.getZoom(),a));return o}clearLayout(){this.labelers=new me(this.scratch,this.labelRules,16,this.onTilesInvalidated)}rerenderTiles(){for(let r in this._tiles){let s=this._wrapCoords(this._keyToTileCoords(r)),a=this._tileCoordsToKey(s);this.renderTile(s,this._tiles[r].el,a)}}createTile(r,s){let a=L.DomUtil.create("canvas","leaflet-tile");a.lang=this.lang;let o=this._tileCoordsToKey(r);return a.key=o,this.renderTile(r,a,o,()=>{s(void 0,a)}),a}_removeTile(r){let s=this._tiles[r];s&&(s.el.removed=!0,s.el.key=void 0,L.DomUtil.removeClass(s.el,"leaflet-tile-loaded"),s.el.width=s.el.height=0,L.DomUtil.remove(s.el),delete this._tiles[r],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(r)}))}};l(t,"LeafletLayer");let e=t;return new e(i)},"leafletLayer");function fn(i){let e=0,t=0;for(let o of i)e+=o.w*o.h,t=Math.max(t,o.w);i.sort((o,c)=>c.h-o.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),t),h:1/0}],s=0,a=0;for(let o of i)for(let c=r.length-1;c>=0;c--){let u=r[c];if(!(o.w>u.w||o.h>u.h)){if(o.x=u.x,o.y=u.y,a=Math.max(a,o.y+o.h),s=Math.max(s,o.x+o.w),o.w===u.w&&o.h===u.h){let h=r.pop();c<r.length&&(r[c]=h)}else o.h===u.h?(u.x+=o.w,u.w-=o.w):o.w===u.w?(u.y+=o.h,u.h-=o.h):(r.push({x:u.x+o.w,y:u.y,w:u.w-o.w,h:o.h}),u.y+=o.h,u.h-=o.h);break}}return{w:s,h:a,fill:e/(s*a)||0}}l(fn,"potpack");var fs=l((i,e,t)=>{let n=new FontFace(i,`url(${e})`,{weight:t});return document.fonts.add(n),n.load()},"Font"),ui=l(i=>A(void 0,null,function*(){return new Promise((e,t)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>t("Invalid SVG"),n.src=i})}),"mkimg"),ds=`
|
|
<svg width="20px" height="20px" viewBox="0 0 50 50" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
<rect width="50" height="50" fill="#cccccc"/>
|
|
<g transform="translate(5,5)">
|
|
<path fill="none" stroke="#666666" stroke-width="7" d="m11,12a8.5,8 0 1,1 17,0q0,4-4,6t-4.5,4.5-.4,4v.2m0,3v7"/>
|
|
</g>
|
|
</svg>
|
|
`,mn=class mn{constructor(e){this.src=e,this.canvas=document.createElement("canvas"),this.mapping=new Map,this.missingBox={x:0,y:0,w:0,h:0}}load(){return A(this,null,function*(){let e=this.src,t=window.devicePixelRatio;e.endsWith(".html")&&(e=yield(yield fetch(e)).text());let n=new window.DOMParser().parseFromString(e,"text/html"),r=Array.from(n.body.children),s=yield ui(`data:image/svg+xml;base64,${btoa(ds)}`),a=[{w:s.width*t,h:s.height*t,img:s,id:""}],o=new XMLSerializer;for(let h of r){let d=`data:image/svg+xml;base64,${btoa(o.serializeToString(h))}`,m=yield ui(d);a.push({w:m.width*t,h:m.height*t,img:m,id:h.id})}let c=fn(a);this.canvas.width=c.w,this.canvas.height=c.h;let u=this.canvas.getContext("2d");if(u)for(let h of a)h.x!==void 0&&h.y!==void 0&&(u.drawImage(h.img,h.x,h.y,h.w,h.h),h.id?this.mapping.set(h.id,{x:h.x,y:h.y,w:h.w,h:h.h}):this.missingBox={x:h.x,y:h.y,w:h.w,h:h.h});return this})}get(e){let t=this.mapping.get(e);return t||(t=this.missingBox),t}};l(mn,"Sheet");var dn=mn;return _i(ms);})();
|
|
//# sourceMappingURL=protomaps-leaflet.js.map
|