@mappedin/mappedin-js 5.21.0 → 5.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/get-venue/index.js +1 -1
- package/lib/esm/navigator/index.js +1 -1
- package/lib/esm/renderer/{Arrival-7RQOIYDT.js → Arrival-4TTHZQOF.js} +1 -1
- package/lib/esm/renderer/{Chalet-BU67ABNM.js → Chalet-LUA2Z236.js} +1 -1
- package/lib/esm/renderer/{HelveticaNeue-LMAJKD43.js → HelveticaNeue-U3XEZDB5.js} +1 -1
- package/lib/esm/renderer/{Helvetiker-NJKVVKLU.js → Helvetiker-WFBA7C7H.js} +1 -1
- package/lib/esm/renderer/{Lato-4S4GNVAX.js → Lato-ZI244CQU.js} +1 -1
- package/lib/esm/renderer/{MyriadPro-LTC2Z4HK.js → MyriadPro-XF3IH7EM.js} +1 -1
- package/lib/esm/renderer/{ProximaNova-2HOTLKJS.js → ProximaNova-YIIK4S37.js} +1 -1
- package/lib/esm/renderer/{SimonCircular-YVIITNI5.js → SimonCircular-NQ53YBIJ.js} +1 -1
- package/lib/esm/renderer/browser-TNMQUB7G.js +1 -0
- package/lib/esm/renderer/chunk-HZJGZV5Z.js +1 -0
- package/lib/esm/renderer/chunk-VT5JGPT4.js +1 -0
- package/lib/esm/renderer/chunk-ZRT45YCM.js +1 -0
- package/lib/esm/renderer/index.css +1 -1
- package/lib/esm/renderer/index.d.ts +5667 -5387
- package/lib/esm/renderer/index.js +1 -1
- package/lib/esm/renderer/outdoor-context-4DYDRFJG.js +1 -0
- package/lib/mappedin.css +1 -1
- package/lib/mappedin.js +1 -1
- package/lib/node/index.js +1 -1
- package/package.json +2 -2
- package/lib/esm/renderer/browser-WHTUFU2K.js +0 -1
- package/lib/esm/renderer/chunk-6IFB2STL.js +0 -1
- package/lib/esm/renderer/chunk-7RQTLAKE.js +0 -1
- package/lib/esm/renderer/chunk-XPQLPFMX.js +0 -1
- package/lib/esm/renderer/outdoor-context-VFHSJAOZ.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e_,b as Ap}from"./chunk-7RQTLAKE.js";import{a as d}from"./chunk-6IFB2STL.js";import{a as u,c as $t,d as Ii,e as ae}from"./chunk-XPQLPFMX.js";var Pe=$t(((e,t)=>{function r(e,t){this.x=e,this.y=t}d(),t.exports=r,u(r,"Point"),r.prototype={clone:function(){return new r(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),r=Math.sin(e),i=t*this.x-r*this.y,a=r*this.x+t*this.y;return this.x=i,this.y=a,this},_rotateAround:function(e,t){var r=Math.cos(e),i=Math.sin(e),a=t.x+r*(this.x-t.x)-i*(this.y-t.y),n=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=a,this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(e){return e instanceof r?e:Array.isArray(e)?new r(e[0],e[1]):e}})),Du=$t(((e,t)=>{function r(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}d(),t.exports=r,u(r,"UnitBezier"),r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,i=0;i<8;i++){var a=this.sampleCurveX(r)-e;if(Math.abs(a)<t)return r;var n=this.sampleCurveDerivativeX(r);if(Math.abs(n)<1e-6)break;r-=a/n}var s=0,o=1;for(r=e,i=0;i<20&&(a=this.sampleCurveX(r),!(Math.abs(a-e)<t));i++)e>a?s=r:o=r,r=.5*(o-s)+s;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}}})),cm=$t(((e,t)=>{function r(e,t){var r,i,a,n,s,o,l,u;for(r=3&e.length,i=e.length-r,a=t,s=3432918353,o=461845907,u=0;u<i;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,a=27492+(65535&(n=5*(65535&(a=(a^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(n>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:a^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return a^=e.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}d(),u(r,"murmurhash3_32_gc"),void 0!==t&&(t.exports=r)})),pm=$t(((e,t)=>{function r(e,t){for(var r,i=e.length,a=t^i,n=0;i>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+((1540483477*(r>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),i-=4,++n;switch(i){case 3:a^=(255&e.charCodeAt(n+2))<<16;case 2:a^=(255&e.charCodeAt(n+1))<<8;case 1:a=1540483477*(65535&(a^=255&e.charCodeAt(n)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0}d(),u(r,"murmurhash2_32_gc"),void 0!==typeof t&&(t.exports=r)})),dc=$t(((e,t)=>{d();var r=cm(),i=pm();t.exports=r,t.exports.murmur3=r,t.exports.murmur2=i})),Pc=$t(((e,t)=>{d();var r=Pe();function i(e,t,r,i,n){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=n,e.readFields(a,this,t)}function a(e,t,r){1==e?t.id=r.readVarint():2==e?n(r,t):3==e?t.type=r.readVarint():4==e&&(t._geometry=r.pos)}function n(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var i=t._keys[e.readVarint()],a=t._values[e.readVarint()];t.properties[i]=a}}function s(e){var t=e.length;if(t<=1)return[e];for(var r,i,a=[],n=0;n<t;n++){var s=o(e[n]);0!==s&&(void 0===i&&(i=s<0),i===s<0?(r&&a.push(r),r=[e[n]]):r.push(e[n]))}return r&&a.push(r),a}function o(e){for(var t,r,i=0,a=0,n=e.length,s=n-1;a<n;s=a++)t=e[a],i+=((r=e[s]).x-t.x)*(t.y+r.y);return i}t.exports=i,u(i,"VectorTileFeature"),u(a,"readFeature"),u(n,"readTag"),i.types=["Unknown","Point","LineString","Polygon"],i.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,i=e.readVarint()+e.pos,a=1,n=0,s=0,o=0,l=[];e.pos<i;){if(n<=0){var u=e.readVarint();a=7&u,n=u>>3}if(n--,1===a||2===a)s+=e.readSVarint(),o+=e.readSVarint(),1===a&&(t&&l.push(t),t=[]),t.push(new r(s,o));else{if(7!==a)throw new Error("unknown command "+a);t&&t.push(t[0].clone())}}return t&&l.push(t),l},i.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,i=0,a=0,n=0,s=1/0,o=-1/0,l=1/0,u=-1/0;e.pos<t;){if(i<=0){var h=e.readVarint();r=7&h,i=h>>3}if(i--,1===r||2===r)(a+=e.readSVarint())<s&&(s=a),a>o&&(o=a),(n+=e.readSVarint())<l&&(l=n),n>u&&(u=n);else if(7!==r)throw new Error("unknown command "+r)}return[s,l,o,u]},i.prototype.toGeoJSON=function(e,t,r){var a,n,o=this.extent*Math.pow(2,r),l=this.extent*e,h=this.extent*t,c=this.loadGeometry(),p=i.types[this.type];function d(e){for(var t=0;t<e.length;t++){var r=e[t],i=180-360*(r.y+h)/o;e[t]=[360*(r.x+l)/o-180,360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90]}}switch(u(d,"project"),this.type){case 1:var f=[];for(a=0;a<c.length;a++)f[a]=c[a][0];d(c=f);break;case 2:for(a=0;a<c.length;a++)d(c[a]);break;case 3:for(c=s(c),a=0;a<c.length;a++)for(n=0;n<c[a].length;n++)d(c[a][n])}1===c.length?c=c[0]:p="Multi"+p;var m={type:"Feature",geometry:{type:p,coordinates:c},properties:this.properties};return"id"in this&&(m.id=this.id),m},u(s,"classifyRings"),u(o,"signedArea")})),Tc=$t(((e,t)=>{d();var r=Pc();function i(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(a,this,t),this.length=this._features.length}function a(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(n(r))}function n(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var i=e.readVarint()>>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}return t}t.exports=i,u(i,"VectorTileLayer"),u(a,"readLayer"),u(n,"readValueMessage"),i.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,t,this.extent,this._keys,this._values)}})),Cf=$t(((e,t)=>{d();var r=Tc();function i(e,t){this.layers=e.readFields(a,{},t)}function a(e,t,i){if(3===e){var a=new r(i,i.readVarint()+i.pos);a.length&&(t[a.name]=a)}}t.exports=i,u(i,"VectorTile"),u(a,"readTile")})),Na=$t(((e,t)=>{d(),t.exports.VectorTile=Cf(),t.exports.VectorTileFeature=Pc(),t.exports.VectorTileLayer=Tc()})),Kf=$t((e=>{d(),e.read=function(e,t,r,i,a){var n,s,o=8*a-i-1,l=(1<<o)-1,u=l>>1,h=-7,c=r?a-1:0,p=r?-1:1,d=e[t+c];for(c+=p,n=d&(1<<-h)-1,d>>=-h,h+=o;h>0;n=256*n+e[t+c],c+=p,h-=8);for(s=n&(1<<-h)-1,n>>=-h,h+=i;h>0;s=256*s+e[t+c],c+=p,h-=8);if(0===n)n=1-u;else{if(n===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),n-=u}return(d?-1:1)*s*Math.pow(2,n-i)},e.write=function(e,t,r,i,a,n){var s,o,l,u=8*n-a-1,h=(1<<u)-1,c=h>>1,p=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:n-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+c>=1?p/l:p*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=h?(o=0,s=h):s+c>=1?(o=(t*l-1)*Math.pow(2,a),s+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,a),s=0));a>=8;e[r+d]=255&o,d+=f,o/=256,a-=8);for(s=s<<a|o,u+=a;u>0;e[r+d]=255&s,d+=f,s/=256,u-=8);e[r+d-f]|=128*m}})),Lc=$t(((e,t)=>{d(),t.exports=i;var r=Kf();function i(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}u(i,"Pbf"),i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var a=4294967296,n=1/a,s="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function o(e,t,r){var i,a,n=r.buf;if(i=(112&(a=n[r.pos++]))>>4,a<128||(i|=(127&(a=n[r.pos++]))<<3,a<128)||(i|=(127&(a=n[r.pos++]))<<10,a<128)||(i|=(127&(a=n[r.pos++]))<<17,a<128)||(i|=(127&(a=n[r.pos++]))<<24,a<128)||(i|=(1&(a=n[r.pos++]))<<31,a<128))return h(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function l(e){return e.type===i.Bytes?e.readVarint()+e.pos:e.pos+1}function h(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function c(e,t){var r,i;if(e>=0?(r=e%4294967296|0,i=e/4294967296|0):(i=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:(r=0,i=i+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),p(r,i,t),f(i,t)}function p(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos]=127&e}function f(e,t){var r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}function m(e,t,r){var i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(i);for(var a=r.pos-1;a>=e;a--)r.buf[a+i]=r.buf[a]}function y(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function g(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function _(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function x(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function v(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function b(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function w(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function S(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function A(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function I(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function M(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function T(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function C(e,t,r){for(var i="",a=t;a<r;){var n,s,o,l=e[a],u=null,h=l>239?4:l>223?3:l>191?2:1;if(a+h>r)break;1===h?l<128&&(u=l):2===h?128==(192&(n=e[a+1]))&&((u=(31&l)<<6|63&n)<=127&&(u=null)):3===h?(n=e[a+1],s=e[a+2],128==(192&n)&&128==(192&s)&&(((u=(15&l)<<12|(63&n)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null))):4===h&&(n=e[a+1],s=e[a+2],o=e[a+3],128==(192&n)&&128==(192&s)&&128==(192&o)&&(((u=(15&l)<<18|(63&n)<<12|(63&s)<<6|63&o)<=65535||u>=1114112)&&(u=null))),null===u?(u=65533,h=1):u>65535&&(u-=65536,i+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),i+=String.fromCharCode(u),a+=h}return i}function P(e,t,r){return s.decode(e.subarray(t,r))}function k(e,t,r){for(var i,a,n=0;n<t.length;n++){if((i=t.charCodeAt(n))>55295&&i<57344){if(!a){i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):a=i;continue}if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,a=i;continue}i=a-55296<<10|i-56320|65536,a=null}else a&&(e[r++]=239,e[r++]=191,e[r++]=189,a=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=63&i|128)}return r}i.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var i=this.readVarint(),a=i>>3,n=this.pos;this.type=7&i,e(a,t,this),this.pos===n&&this.skip(i)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=I(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=T(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=I(this.buf,this.pos)+I(this.buf,this.pos+4)*a;return this.pos+=8,e},readSFixed64:function(){var e=I(this.buf,this.pos)+T(this.buf,this.pos+4)*a;return this.pos+=8,e},readFloat:function(){var e=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,r,i=this.buf;return t=127&(r=i[this.pos++]),r<128||(t|=(127&(r=i[this.pos++]))<<7,r<128)||(t|=(127&(r=i[this.pos++]))<<14,r<128)||(t|=(127&(r=i[this.pos++]))<<21,r<128)?t:o(t|=(15&(r=i[this.pos]))<<28,e,this)},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&s?P(this.buf,t,e):C(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==i.Bytes)return e.push(this.readVarint(t));var r=l(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==i.Bytes)return e.push(this.readSVarint());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==i.Bytes)return e.push(this.readBoolean());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==i.Bytes)return e.push(this.readFloat());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==i.Bytes)return e.push(this.readDouble());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==i.Bytes)return e.push(this.readFixed32());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed32());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==i.Bytes)return e.push(this.readFixed64());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed64());var t=l(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===i.Varint)for(;this.buf[this.pos++]>127;);else if(t===i.Bytes)this.pos=this.readVarint()+this.pos;else if(t===i.Fixed32)this.pos+=4;else{if(t!==i.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),M(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),M(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),M(this.buf,-1&e,this.pos),M(this.buf,Math.floor(e*n),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),M(this.buf,-1&e,this.pos),M(this.buf,Math.floor(e*n),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?c(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=k(this.buf,e,this.pos);var r=this.pos-t;r>=128&&m(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),r.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),r.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var i=this.pos-r;i>=128&&m(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i},writeMessage:function(e,t,r){this.writeTag(e,i.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,y,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,g,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,v,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,_,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,x,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,b,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,w,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,S,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,A,t)},writeBytesField:function(e,t){this.writeTag(e,i.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,i.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,i.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,i.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,i.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,i.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,i.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,i.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,i.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,i.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},u(o,"readVarintRemainder"),u(l,"readPackedEnd"),u(h,"toNum"),u(c,"writeBigVarint"),u(p,"writeBigVarintLow"),u(f,"writeBigVarintHigh"),u(m,"makeRoomForExtraLength"),u(y,"writePackedVarint"),u(g,"writePackedSVarint"),u(_,"writePackedFloat"),u(x,"writePackedDouble"),u(v,"writePackedBoolean"),u(b,"writePackedFixed32"),u(w,"writePackedSFixed32"),u(S,"writePackedFixed64"),u(A,"writePackedSFixed64"),u(I,"readUInt32"),u(M,"writeInt32"),u(T,"readInt32"),u(C,"readUtf8"),u(P,"readUtf8TextDecoder"),u(k,"writeUtf8")}));d();var t_="maplibre-gl",r_="BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",i_="3.2.0",n_="dist/maplibre-gl.js",a_="dist/maplibre-gl.css",o_="BSD-3-Clause",s_="https://github.com/maplibre/maplibre-gl-js?sponsor=1",l_={type:"git",url:"git://github.com/maplibre/maplibre-gl-js.git"},u_="dist/maplibre-gl.d.ts",c_="module",p_={"@mapbox/geojson-rewind":"^0.5.2","@mapbox/jsonlint-lines-primitives":"^2.0.2","@mapbox/point-geometry":"^0.1.0","@mapbox/tiny-sdf":"^2.0.6","@mapbox/unitbezier":"^0.0.1","@mapbox/vector-tile":"^1.3.1","@mapbox/whoots-js":"^3.1.0","@maplibre/maplibre-gl-style-spec":"^19.2.2","@types/geojson":"^7946.0.10","@types/mapbox__point-geometry":"^0.1.2","@types/mapbox__vector-tile":"^1.3.0","@types/pbf":"^3.0.2",earcut:"^2.2.4","geojson-vt":"^3.2.1","gl-matrix":"^3.4.3","global-prefix":"^3.0.0",kdbush:"^4.0.2","murmurhash-js":"^1.0.0",pbf:"^3.2.1",potpack:"^2.0.0",quickselect:"^2.0.0",supercluster:"^8.0.1",tinyqueue:"^2.0.3","vt-pbf":"^3.1.3"},h_={"@mapbox/mapbox-gl-rtl-text":"^0.2.3","@mapbox/mvt-fixtures":"^3.10.0","@rollup/plugin-commonjs":"^25.0.3","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.1.0","@rollup/plugin-replace":"^5.0.2","@rollup/plugin-strip":"^3.0.2","@rollup/plugin-terser":"^0.4.3","@rollup/plugin-typescript":"^11.1.2","@types/benchmark":"^2.1.2","@types/cssnano":"^5.0.0","@types/d3":"^7.4.0","@types/diff":"^5.0.3","@types/earcut":"^2.1.1","@types/eslint":"^8.44.0","@types/gl":"^6.0.2","@types/glob":"^8.1.0","@types/jest":"^29.5.3","@types/jsdom":"^21.1.1","@types/minimist":"^1.2.2","@types/murmurhash-js":"^1.0.4","@types/nise":"^1.4.1","@types/node":"^20.4.2","@types/offscreencanvas":"^2019.7.0","@types/pixelmatch":"^5.2.4","@types/pngjs":"^6.0.1","@types/react":"^18.2.15","@types/react-dom":"^18.2.6","@types/request":"^2.48.8","@types/shuffle-seed":"^1.1.0","@types/supercluster":"^7.1.0","@types/window-or-global":"^1.0.4","@typescript-eslint/eslint-plugin":"^5.61.0","@typescript-eslint/parser":"^5.62.0",address:"^1.2.2",benchmark:"^2.1.4",canvas:"^2.11.2",cssnano:"^6.0.1",d3:"^7.8.5","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1170846",diff:"^5.1.0","dts-bundle-generator":"^8.0.1",eslint:"^8.45.0","eslint-config-mourner":"^3.0.0","eslint-plugin-html":"^7.1.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jest":"^27.2.3","eslint-plugin-tsdoc":"0.2.17","eslint-plugin-react":"^7.32.2",expect:"^29.5.0",gl:"^6.0.2",glob:"^10.3.3","is-builtin-module":"^3.2.1",jest:"^29.6.1","jest-canvas-mock":"^2.5.2","jest-environment-jsdom":"^29.6.1",jsdom:"^22.1.0","json-stringify-pretty-compact":"^4.0.0",minimist:"^1.2.8","mock-geolocation":"^1.0.11",nise:"^5.1.4","node-plantuml":"^0.9.0","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5","pdf-merger-js":"^4.3.0",pixelmatch:"^5.3.0",pngjs:"^7.0.0",postcss:"^8.4.26","postcss-cli":"^10.1.0","postcss-inline-svg":"^6.0.0","pretty-bytes":"^6.1.1",puppeteer:"^20.8.2",react:"^18.2.0","react-dom":"^18.2.0",rollup:"^3.26.2","rollup-plugin-sourcemaps":"^0.6.3",rw:"^1.3.3",semver:"^7.5.4","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.0",stylelint:"^15.10.1","stylelint-config-standard":"^34.0.0","ts-jest":"^29.1.1","ts-node":"^10.9.1",tslib:"^2.6.0",typedoc:"^0.24.8","typedoc-plugin-markdown":"^3.15.3","typedoc-plugin-missing-exports":"^2.0.0",typescript:"^5.1.6"},m_={"postcss-inline-svg":{"css-select":"^5.1.0","dom-serializer":"^2.0.0",htmlparser2:"^8.0.1","postcss-value-parser":"^4.2.0"}},f_={"generate-dist-package":"npm run tsnode build/generate-dist-package.js","generate-shaders":"npm run tsnode build/generate-shaders.ts","generate-struct-arrays":"npm run tsnode build/generate-struct-arrays.ts","generate-style-code":"npm run tsnode build/generate-style-code.ts","generate-typings":"npm run tsnode build/generate-typings.ts","generate-docs":"typedoc && npm run tsnode build/generate-docs.ts","generate-images":"npm run tsnode build/generate-doc-images.ts","build-dist":"run-p --print-label generate-typings build-dev build-prod build-csp build-csp-dev build-css","build-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev","watch-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev --watch","build-prod":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:production","build-csp":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts","build-csp-dev":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts --environment BUILD:dev","build-css":"postcss -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-diagrams":"cd docs/diagrams; ls *.plantuml | xargs -I {} puml generate --svg {} -o {}.svg","watch-css":"postcss --watch -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-benchmarks":"npm run build-dev && rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts","watch-benchmarks":"rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts --watch","start-server":"st --no-cache -H 0.0.0.0 --port 9966 .",start:"run-p watch-css watch-dev start-server","start-bench":"run-p watch-css watch-benchmarks start-server",lint:"eslint --cache --ext .ts,.tsx,.js,.html --ignore-path .gitignore .","lint-css":"stylelint src/css/maplibre-gl.css",test:"run-p lint lint-css test-render jest",jest:"jest","jest-ci":"jest --reporters=github-actions --reporters=summary","test-build":"jest --selectProjects=build","test-integration":"jest --selectProjects=integration","test-render":"npm run tsnode test/integration/render/run_render_tests.ts","test-unit":"jest --selectProjects=unit","test-watch-roots":"jest --watch",codegen:"run-p generate-dist-package generate-style-code generate-struct-arrays generate-shaders",benchmark:"npm run tsnode test/bench/run-benchmarks.ts","gl-stats":"npm run tsnode test/bench/gl-stats.ts",prepare:"npm run codegen",typecheck:"tsc --noEmit && tsc --project tsconfig.dist.json",tsnode:"node --experimental-loader=ts-node/esm --no-warnings"},d_=["build/","dist/*","src/"],y_={npm:">=8.1.0",node:">=16.14.0"},xo={name:t_,description:r_,version:i_,main:n_,style:a_,license:o_,funding:s_,repository:l_,types:u_,type:c_,dependencies:p_,devDependencies:h_,overrides:m_,scripts:f_,files:d_,engines:y_};d(),d();var Ep=ae(Pe()),kp=ae(Du());function Lp(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function zu(e,t,r,i){let a=new kp.default(e,t,r,i);return function(e){return a.solve(e)}}u(Lp,"easeCubicInOut"),u(zu,"bezier");var Fu=zu(.25,.1,.25,1);function Te(e,t,r){return Math.min(r,Math.max(t,e))}function nr(e,t,r){let i=r-t,a=((e-t)%i+i)%i+t;return a===t?r:a}function _o(e,t,r){if(!e.length)return r(null,[]);let i=e.length,a=new Array(e.length),n=null;e.forEach(((e,s)=>{t(e,((e,t)=>{e&&(n=e),a[s]=t,0==--i&&r(n,a)}))}))}function Dp(e,t){let r=[];for(let i in e)i in t||r.push(i);return r}function R(e,...t){for(let r of t)for(let t in r)e[t]=r[t];return e}function Gt(e,t){let r={};for(let i=0;i<t.length;i++){let a=t[i];a in e&&(r[a]=e[a])}return r}u(Te,"clamp"),u(nr,"wrap"),u(_o,"asyncAll"),u(Dp,"keysDifference"),u(R,"extend"),u(Gt,"pick");var g_=1;function bo(){return g_++}function zp(e){return Math.log(e)/Math.LN2%1==0}function Fp(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Rn(e,t,r){let i={};for(let a in e)i[a]=t.call(r||this,e[a],a,e);return i}function vo(e,t,r){let i={};for(let a in e)t.call(r||this,e[a],a,e)&&(i[a]=e[a]);return i}function ar(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!ar(e[r],t[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!ar(e[r],t[r]))return!1;return!0}return e===t}function gt(e){return Array.isArray(e)?e.map(gt):"object"==typeof e&&e?Rn(e,gt):e}function Bp(e,t){for(let r=0;r<e.length;r++)if(t.indexOf(e[r])>=0)return!0;return!1}u(bo,"uniqueId"),u(zp,"isPowerOfTwo"),u(Fp,"nextPowerOfTwo"),u(Rn,"mapObject"),u(vo,"filterObject"),u(ar,"deepEqual"),u(gt,"clone"),u(Bp,"arraysIntersect");var Rp={};function Me(e){Rp[e]||("undefined"!=typeof console&&console.warn(e),Rp[e]=!0)}function or(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function Op(e,t,r,i){let a=t.y-e.y,n=t.x-e.x,s=i.y-r.y,o=i.x-r.x,l=s*n-o*a;if(0===l)return null;let u=(o*(e.y-r.y)-s*(e.x-r.x))/l;return new Ep.default(e.x+u*n,e.y+u*a)}function Vp(e){let t=0;for(let r,i,a=0,n=e.length,s=n-1;a<n;s=a++)r=e[a],i=e[s],t+=(i.x-r.x)*(r.y+i.y);return t}function Up([e,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(r),y:e*Math.sin(t)*Math.sin(r),z:e*Math.cos(r)}}function xt(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function Np(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,r,i,a)=>{let n=i||a;return t[r]=!n||n.toLowerCase(),""})),t["max-age"]){let e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}u(Me,"warnOnce"),u(or,"isCounterClockwise"),u(Op,"findLineIntersection"),u(Vp,"calculateSignedArea"),u(Up,"sphericalToCartesian"),u(xt,"isWorker"),u(Np,"parseCacheControl");var Bu=null;function Xr(e){if(null==Bu){let t=e.navigator?e.navigator.userAgent:null;Bu=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Bu}function Ft(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}function qp(e,t){let r=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(r).then((e=>{t(null,e)})).catch((e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}u(Xr,"isSafari"),u(Ft,"isImageBitmap"),u(qp,"arrayBufferToImageBitmap");var $p="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Gp(e,t){let r=new Image;r.onload=()=>{t(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=$p}))},r.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let i=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(i):$p}u(Gp,"arrayBufferToImage"),d();var wo,Ru,x_="undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),ne={now:x_,frame(e){let t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement("canvas"),r=t.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0,e.width,e.height),r},resolveURL:e=>(wo||(wo=document.createElement("a")),wo.href=e,wo.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==Ru&&(Ru=matchMedia("(prefers-reduced-motion: reduce)")),Ru.matches)}};d();var Ou=ae(Pe()),je=class{static testProp(e){if(!je.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in je.docStyle)return e[t];return e[0]}static create(e,t,r){let i=window.document.createElement(e);return void 0!==t&&(i.className=t),r&&r.appendChild(i),i}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){je.docStyle&&je.selectProp&&(je.userSelect=je.docStyle[je.selectProp],je.docStyle[je.selectProp]="none")}static enableDrag(){je.docStyle&&je.selectProp&&(je.docStyle[je.selectProp]=je.userSelect)}static setTransform(e,t){e.style[je.transformProp]=t}static addEventListener(e,t,r,i={}){"passive"in i?e.addEventListener(t,r,i):e.addEventListener(t,r,i.capture)}static removeEventListener(e,t,r,i={}){"passive"in i?e.removeEventListener(t,r,i):e.removeEventListener(t,r,i.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",je.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",je.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",je.suppressClickInternal,!0)}),0)}static mousePos(e,t){let r=e.getBoundingClientRect();return new Ou.default(t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop)}static touchPos(e,t){let r=e.getBoundingClientRect(),i=[];for(let a=0;a<t.length;a++)i.push(new Ou.default(t[a].clientX-r.left-e.clientLeft,t[a].clientY-r.top-e.clientTop));return i}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}},F=je;u(F,"DOM"),F.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,F.selectProp=je.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),F.transformProp=je.testProp(["transform","WebkitTransform"]),d(),d();var ot={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""},vr=class extends Error{constructor(e,t,r,i){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=i}};u(vr,"AJAXError");var So=xt()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href,Vu=u((e=>ot.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]),"getProtocolAction"),__=u((e=>/^file:/.test(e)||/^file:/.test(So())&&!/^\w+:/.test(e)),"isFileURL");function jp(e,t){let r=new AbortController,i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:So(),signal:r.signal}),a=!1,n=!1;"json"===e.type&&i.headers.set("Accept","application/json");let s=u(((r,a,s)=>{if(!n){if(r&&"SecurityError"!==r.message&&Me(r),a&&s)return o(a);fetch(i).then((r=>r.ok?o(r):r.blob().then((i=>t(new vr(r.status,r.statusText,e.url,i)))))).catch((e=>{20!==e.code&&t(new Error(e.message))}))}}),"validateOrFetch"),o=u((r=>{("arrayBuffer"===e.type||"image"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then((e=>{n||(a=!0,t(null,e,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((e=>{n||t(new Error(e.message))}))}),"finishRequest");return s(null,null),{cancel:()=>{n=!0,a||r.abort()}}}function b_(e,t){let r=new XMLHttpRequest;r.open(e.method||"GET",e.url,!0),("arrayBuffer"===e.type||"image"===e.type)&&(r.responseType="arraybuffer");for(let t in e.headers)r.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{t(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let i=r.response;if("json"===e.type)try{i=JSON.parse(r.response)}catch(e){return t(e)}t(null,i,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else{let i=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});t(new vr(r.status,r.statusText,e.url,i))}},r.send(e.body),{cancel:()=>r.abort()}}u(jp,"makeFetchRequest"),u(b_,"makeXMLHttpRequest");var Mi=u((function(e,t){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){if(xt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t);if(!xt())return(Vu(e.url)||jp)(e,t)}if(!__(e.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return jp(e,t);if(xt()&&self.worker&&self.worker.actor){let r=!0;return self.worker.actor.send("getResource",e,t,void 0,r)}}return b_(e,t)}),"makeRequest"),wr=u((function(e,t){return Mi(R(e,{type:"json"}),t)}),"getJSON"),Po=u((function(e,t){return Mi(R(e,{type:"arrayBuffer"}),t)}),"getArrayBuffer");function Uu(e){if(!e||e.indexOf("://")<=0||0===e.indexOf("data:image/")||0===e.indexOf("blob:"))return!0;let t=new URL(e),r=window.location;return t.protocol===r.protocol&&t.host===r.host}u(Uu,"sameOrigin");var Hp=u((function(e,t){let r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){t(null,r)};for(let t=0;t<e.length;t++){let i=window.document.createElement("source");Uu(e[t])||(r.crossOrigin="Anonymous"),i.src=e[t],r.appendChild(i)}return{cancel:()=>{}}}),"getVideo");d(),d();var Vn,Ei,mt,Oe,On={supported:!1,testSupport:v_},Nu=!1,Zp=!1;function v_(e){Nu||!Ei||(Zp?Wp(e):Vn=e)}function Wp(e){let t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,Ei),e.isContextLost())return;On.supported=!0}catch(e){}e.deleteTexture(t),Nu=!0}"undefined"!=typeof document&&((Ei=document.createElement("img")).onload=function(){Vn&&Wp(Vn),Vn=null,Zp=!0},Ei.onerror=function(){Nu=!0,Vn=null},Ei.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),u(v_,"testSupport"),u(Wp,"testWebpTextureUpload"),function(e){let t,r,i,a;e.resetRequestQueue=u((()=>{t=[],r=0,i=0,a={}}),"resetRequestQueue"),e.addThrottleControl=u((e=>{let t=i++;return a[t]=e,t}),"addThrottleControl"),e.removeThrottleControl=u((e=>{delete a[e],h()}),"removeThrottleControl");let n=u((()=>{let e=Object.keys(a),t=!1;if(e.length>0)for(let r of e)if(t=a[r](),t)break;return t}),"isThrottled");e.getImage=u(((e,i,a=!0)=>{On.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*");let n={requestParameters:e,supportImageRefresh:a,callback:i,cancelled:!1,completed:!1,cancel:()=>{!n.completed&&!n.cancelled&&(n.cancelled=!0,n.innerRequest&&(n.innerRequest.cancel(),r--),h())}};return t.push(n),h(),n}),"getImage");let s=u(((e,t)=>{"function"==typeof createImageBitmap?qp(e,t):Gp(e,t)}),"arrayBufferToCanvasImageSource"),o=u((e=>{let{requestParameters:t,supportImageRefresh:r,callback:i}=e;return R(t,{type:"image"}),(!1!==r||xt()||Vu(t.url)||t.headers&&!Object.keys(t.headers).reduce(((e,t)=>e&&"accept"===t),!0)?Mi:c)(t,((t,r,a,n)=>{l(e,i,t,r,a,n)}))}),"doImageRequest"),l=u(((e,t,i,a,n,o)=>{i?t(i):a instanceof HTMLImageElement||a instanceof ImageBitmap?t(null,a):a&&s(a,u(((e,r)=>{null!=e?t(e):null!=r&&t(null,r,{cacheControl:n,expires:o})}),"decoratedCallback")),e.cancelled||(e.completed=!0,r--,h())}),"onImageResponse"),h=u((()=>{let e=n()?ot.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:ot.MAX_PARALLEL_IMAGE_REQUESTS;for(let i=r;i<e&&t.length>0;i++){let e=t.shift();if(e.cancelled){i--;continue}let a=o(e);r++,e.innerRequest=a}}),"processQueue"),c=u(((e,t)=>{let r=new Image,i=e.url,a=!1,n=e.credentials;return n&&"include"===n?r.crossOrigin="use-credentials":(n&&"same-origin"===n||!Uu(i))&&(r.crossOrigin="anonymous"),r.fetchPriority="high",r.onload=()=>{t(null,r),r.onerror=r.onload=null},r.onerror=()=>{a||t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),r.onerror=r.onload=null},r.src=i,{cancel:()=>{a=!0,r.src=""}}}),"getImageUsingHtmlImage")}(mt||(mt={})),mt.resetRequestQueue(),d(),function(e){e.Glyphs="Glyphs",e.Image="Image",e.Source="Source",e.SpriteImage="SpriteImage",e.SpriteJSON="SpriteJSON",e.Style="Style",e.Tile="Tile",e.Unknown="Unknown"}(Oe||(Oe={}));var To=class{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeSpriteURL(e,t,r){let i=S_(e);return i.path+=`${t}${r}`,P_(i)}setTransformRequest(e){this._transformRequestFn=e}};u(To,"RequestManager");var w_=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function S_(e){let t=e.match(w_);if(!t)throw new Error(`Unable to parse URL "${e}"`);return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function P_(e){let t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}function Xp(e,t,r){r[e]&&-1!==r[e].indexOf(t)||(r[e]=r[e]||[],r[e].push(t))}function qu(e,t,r){if(r&&r[e]){let i=r[e].indexOf(t);-1!==i&&r[e].splice(i,1)}}u(S_,"parseUrl"),u(P_,"formatUrl"),d(),d(),u(Xp,"_addEventListener"),u(qu,"_removeEventListener");var z=class{constructor(e,t={}){R(this,t),this.type=e}};u(z,"Event");var Z=class extends z{constructor(e,t={}){super("error",R({error:e},t))}};u(Z,"ErrorEvent");var fe=class{on(e,t){return this._listeners=this._listeners||{},Xp(e,t,this._listeners),this}off(e,t){return qu(e,t,this._listeners),qu(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Xp(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){"string"==typeof e&&(e=new z(e,t||{}));let r=e.type;if(this.listens(r)){e.target=this;let t=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(let r of t)r.call(this,e);let i=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(let t of i)qu(r,t,this._oneTimeListeners),t.call(this,e);let a=this._eventedParent;a&&(R(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof Z&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}};u(fe,"Evented"),d(),d(),d(),d();var Kp=ae(Du()),T_=8,A_={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},I_={"*":{type:"source"}},C_=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],M_={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},E_={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},k_={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},L_={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},D_={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},z_={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},F_={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},B_=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],R_={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},O_={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},V_={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},U_={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},N_={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},q_={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},$_={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},G_={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},j_={type:"array",value:"*"},H_={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},Z_={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},W_={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},X_={type:"array",value:"*",minimum:1},K_={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},Y_={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},J_=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],Q_={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},eb={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},tb={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},rb={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},ib={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},nb={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},ab={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},ob={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},sb={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},lb={"*":{type:"string"}},C={$version:T_,$root:A_,sources:I_,source:C_,source_vector:M_,source_raster:E_,source_raster_dem:k_,source_geojson:L_,source_video:D_,source_image:z_,layer:F_,layout:B_,layout_background:R_,layout_fill:O_,layout_circle:V_,layout_heatmap:U_,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:N_,layout_symbol:q_,layout_raster:$_,layout_hillshade:G_,filter:j_,filter_operator:H_,geometry_type:Z_,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:W_,expression:X_,light:K_,terrain:Y_,paint:J_,paint_fill:Q_,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:eb,paint_circle:tb,paint_heatmap:rb,paint_symbol:ib,paint_raster:nb,paint_hillshade:ab,paint_background:ob,transition:sb,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:lb},ub=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function cb(e,t){let r={};for(let t in e)"ref"!==t&&(r[t]=e[t]);return ub.forEach((e=>{e in t&&(r[e]=t[e])})),r}function $u(e){e=e.slice();let t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=cb(e[r],t[e[r].ref]));return e}function Ue(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Ue(e[r],t[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!Ue(e[r],t[r]))return!1;return!0}return e===t}u(cb,"deref"),u($u,"derefLayers"),u(Ue,"deepEqual");var Ae={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Yp(e,t,r){r.push({command:Ae.addSource,args:[e,t[e]]})}function Jp(e,t,r){t.push({command:Ae.removeSource,args:[e]}),r[e]=!0}function pb(e,t,r,i){Jp(e,r,i),Yp(e,t,r)}function hb(e,t,r){let i;for(i in e[r])if(Object.prototype.hasOwnProperty.call(e[r],i)&&"data"!==i&&!Ue(e[r][i],t[r][i]))return!1;for(i in t[r])if(Object.prototype.hasOwnProperty.call(t[r],i)&&"data"!==i&&!Ue(e[r][i],t[r][i]))return!1;return!0}function mb(e,t,r,i){let a;for(a in t=t||{},e=e||{})!Object.prototype.hasOwnProperty.call(e,a)||Object.prototype.hasOwnProperty.call(t,a)||Jp(a,r,i);for(a in t)!Object.prototype.hasOwnProperty.call(t,a)||(Object.prototype.hasOwnProperty.call(e,a)?Ue(e[a],t[a])||("geojson"===e[a].type&&"geojson"===t[a].type&&hb(e,t,a)?r.push({command:Ae.setGeoJSONSourceData,args:[a,t[a].data]}):pb(a,t,r,i)):Yp(a,t,r))}function Ao(e,t,r,i,a,n){let s;for(s in t=t||{},e=e||{})!Object.prototype.hasOwnProperty.call(e,s)||Ue(e[s],t[s])||r.push({command:n,args:[i,s,t[s],a]});for(s in t)!Object.prototype.hasOwnProperty.call(t,s)||Object.prototype.hasOwnProperty.call(e,s)||Ue(e[s],t[s])||r.push({command:n,args:[i,s,t[s],a]})}function Qp(e){return e.id}function eh(e,t){return e[t.id]=t,e}function fb(e,t,r){t=t||[];let i,a,n,s,o,l,u,h=(e=e||[]).map(Qp),c=t.map(Qp),p=e.reduce(eh,{}),d=t.reduce(eh,{}),f=h.slice(),m=Object.create(null);for(i=0,a=0;i<h.length;i++)n=h[i],Object.prototype.hasOwnProperty.call(d,n)?a++:(r.push({command:Ae.removeLayer,args:[n]}),f.splice(f.indexOf(n,a),1));for(i=0,a=0;i<c.length;i++)n=c[c.length-1-i],f[f.length-1-i]!==n&&(Object.prototype.hasOwnProperty.call(p,n)?(r.push({command:Ae.removeLayer,args:[n]}),f.splice(f.lastIndexOf(n,f.length-a),1)):a++,l=f[f.length-i],r.push({command:Ae.addLayer,args:[d[n],l]}),f.splice(f.length-i,0,n),m[n]=!0);for(i=0;i<c.length;i++)if(n=c[i],s=p[n],o=d[n],!m[n]&&!Ue(s,o)){if(!Ue(s.source,o.source)||!Ue(s["source-layer"],o["source-layer"])||!Ue(s.type,o.type)){r.push({command:Ae.removeLayer,args:[n]}),l=f[f.lastIndexOf(n)+1],r.push({command:Ae.addLayer,args:[o,l]});continue}for(u in Ao(s.layout,o.layout,r,n,null,Ae.setLayoutProperty),Ao(s.paint,o.paint,r,n,null,Ae.setPaintProperty),Ue(s.filter,o.filter)||r.push({command:Ae.setFilter,args:[n,o.filter]}),(!Ue(s.minzoom,o.minzoom)||!Ue(s.maxzoom,o.maxzoom))&&r.push({command:Ae.setLayerZoomRange,args:[n,o.minzoom,o.maxzoom]}),s)!Object.prototype.hasOwnProperty.call(s,u)||"layout"===u||"paint"===u||"filter"===u||"metadata"===u||"minzoom"===u||"maxzoom"===u||(0===u.indexOf("paint.")?Ao(s[u],o[u],r,n,u.slice(6),Ae.setPaintProperty):Ue(s[u],o[u])||r.push({command:Ae.setLayerProperty,args:[n,u,o[u]]}));for(u in o)!Object.prototype.hasOwnProperty.call(o,u)||Object.prototype.hasOwnProperty.call(s,u)||"layout"===u||"paint"===u||"filter"===u||"metadata"===u||"minzoom"===u||"maxzoom"===u||(0===u.indexOf("paint.")?Ao(s[u],o[u],r,n,u.slice(6),Ae.setPaintProperty):Ue(s[u],o[u])||r.push({command:Ae.setLayerProperty,args:[n,u,o[u]]}))}}function th(e,t){if(!e)return[{command:Ae.setStyle,args:[t]}];let r=[];try{if(!Ue(e.version,t.version))return[{command:Ae.setStyle,args:[t]}];Ue(e.center,t.center)||r.push({command:Ae.setCenter,args:[t.center]}),Ue(e.zoom,t.zoom)||r.push({command:Ae.setZoom,args:[t.zoom]}),Ue(e.bearing,t.bearing)||r.push({command:Ae.setBearing,args:[t.bearing]}),Ue(e.pitch,t.pitch)||r.push({command:Ae.setPitch,args:[t.pitch]}),Ue(e.sprite,t.sprite)||r.push({command:Ae.setSprite,args:[t.sprite]}),Ue(e.glyphs,t.glyphs)||r.push({command:Ae.setGlyphs,args:[t.glyphs]}),Ue(e.transition,t.transition)||r.push({command:Ae.setTransition,args:[t.transition]}),Ue(e.light,t.light)||r.push({command:Ae.setLight,args:[t.light]});let i={},a=[];mb(e.sources,t.sources,a,i);let n=[];e.layers&&e.layers.forEach((e=>{i[e.source]?r.push({command:Ae.removeLayer,args:[e.id]}):n.push(e)})),r=r.concat(a),fb(n,t.layers,r)}catch(e){console.warn("Unable to compute style diff:",e),r=[{command:Ae.setStyle,args:[t]}]}return r}u(Yp,"addSource"),u(Jp,"removeSource"),u(pb,"updateSource"),u(hb,"canUpdateGeoJSON"),u(mb,"diffSources"),u(Ao,"diffLayerPropertyChanges"),u(Qp,"pluckId"),u(eh,"indexById"),u(fb,"diffLayers"),u(th,"diffStyles");var U=class{constructor(e,t,r,i){this.message=(e?`${e}: `:"")+r,i&&(this.identifier=i),null!=t&&t.__line__&&(this.line=t.__line__)}};function ki(e,...t){for(let r of t)for(let t in r)e[t]=r[t];return e}u(U,"ValidationError"),u(ki,"extendBy");var Bt=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}};u(Bt,"ExpressionParsingError");var Un=class{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,r]of t)this.bindings[e]=r}concat(e){return new Un(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}};u(Un,"Scope");var Li={kind:"null"},q={kind:"number"},pe={kind:"string"},oe={kind:"boolean"},Rt={kind:"color"},Di={kind:"object"},se={kind:"value"},db={kind:"error"},Io={kind:"collator"},zi={kind:"formatted"},Co={kind:"padding"},Nn={kind:"resolvedImage"},Mo={kind:"variableAnchorOffsetCollection"};function Mt(e,t){return{kind:"array",itemType:e,N:t}}function qe(e){if("array"===e.kind){let t=qe(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}u(Mt,"array$1"),u(qe,"toString$1");var yb=[Li,q,pe,oe,Rt,zi,Di,Mt(se),Co,Nn,Mo];function qn(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!qn(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(let e of yb)if(!qn(e,t))return null}return`Expected ${qe(e)} but found ${qe(t)} instead.`}function Gu(e,t){return t.some((t=>t.kind===e.kind))}function $n(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}function Gn(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}u(qn,"checkSubtype"),u(Gu,"isValidType"),u($n,"isValidNativeType"),u(Gn,"verifyType");var rh=.96422,ih=1,nh=.82521,ah=4/29,Fi=6/29,oh=3*Fi*Fi,gb=Fi*Fi*Fi,xb=Math.PI/180,_b=180/Math.PI;function sh(e){return(e%=360)<0&&(e+=360),e}function lh([e,t,r,i]){let a,n,s=Hu((.2225045*(e=ju(e))+.7168786*(t=ju(t))+.0606169*(r=ju(r)))/ih);e===t&&t===r?a=n=s:(a=Hu((.4360747*e+.3850649*t+.1430804*r)/rh),n=Hu((.0139322*e+.0971045*t+.7141733*r)/nh));let o=116*s-16;return[o<0?0:o,500*(a-s),200*(s-n),i]}function ju(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Hu(e){return e>gb?Math.pow(e,1/3):e/oh+ah}function uh([e,t,r,i]){let a=(e+16)/116,n=isNaN(t)?a:a+t/500,s=isNaN(r)?a:a-r/200;return a=ih*Wu(a),n=rh*Wu(n),s=nh*Wu(s),[Zu(3.1338561*n-1.6168667*a-.4906146*s),Zu(-.9787684*n+1.9161415*a+.033454*s),Zu(.0719453*n-.2289914*a+1.4052427*s),i]}function Zu(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function Wu(e){return e>Fi?e*e*e:oh*(e-ah)}function bb(e){let[t,r,i,a]=lh(e),n=Math.sqrt(r*r+i*i);return[Math.round(1e4*n)?sh(Math.atan2(i,r)*_b):NaN,n,t,a]}function vb([e,t,r,i]){return e=isNaN(e)?0:e*xb,uh([r,Math.cos(e)*t,Math.sin(e)*t,i])}function wb([e,t,r,i]){function a(i){let a=(i+e/30)%12,n=t*Math.min(r,1-r);return r-n*Math.max(-1,Math.min(a-3,9-a,1))}return e=sh(e),t/=100,r/=100,u(a,"f"),[a(0),a(8),a(4),i]}function Sb(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];let t=Pb[e];if(t){let[e,r,i]=t;return[e/255,r/255,i/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,r=1;return[Eo(e.slice(r,r+=t)),Eo(e.slice(r,r+=t)),Eo(e.slice(r,r+=t)),Eo(e.slice(r,r+t)||"ff")]}if(e.startsWith("rgb")){let t=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=e.match(t);if(r){let[e,t,i,a,n,s,o,l,u,h,c,p]=r,d=[a||" ",o||" ",h].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){let e=[i,s,u].join(""),r="%%%"===e?100:""===e?255:0;if(r){let e=[Bi(+t/r,0,1),Bi(+n/r,0,1),Bi(+l/r,0,1),c?ch(+c,p):1];if(ph(e))return e}}return}}let r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[e,t,i,a,n,s,o,l,u]=r,h=[i||" ",n||" ",o].join("");if(" "===h||" /"===h||",,"===h||",,,"===h){let e=[+t,Bi(+a,0,100),Bi(+s,0,100),l?ch(+l,u):1];if(ph(e))return wb(e)}}}function Eo(e){return parseInt(e.padEnd(2,e),16)/255}function ch(e,t){return Bi(t?e/100:e,0,1)}function Bi(e,t,r){return Math.min(Math.max(t,e),r)}function ph(e){return!e.some(Number.isNaN)}u(sh,"constrainAngle"),u(lh,"rgbToLab"),u(ju,"rgb2xyz"),u(Hu,"xyz2lab"),u(uh,"labToRgb"),u(Zu,"xyz2rgb"),u(Wu,"lab2xyz"),u(bb,"rgbToHcl"),u(vb,"hclToRgb"),u(wb,"hslToRgb"),u(Sb,"parseCssColor"),u(Eo,"parseHex"),u(ch,"parseAlpha"),u(Bi,"clamp"),u(ph,"validateNumbers");var Pb={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},X=class{constructor(e,t,r,i=1,a=!0){this.r=e,this.g=t,this.b=r,this.a=i,a||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,t,r,i]))}static parse(e){if(e instanceof X)return e;if("string"!=typeof e)return;let t=Sb(e);return t?new X(...t,!1):void 0}get rgb(){let{r:e,g:t,b:r,a:i}=this,a=i||1/0;return this.overwriteGetter("rgb",[e/a,t/a,r/a,i])}get hcl(){return this.overwriteGetter("hcl",bb(this.rgb))}get lab(){return this.overwriteGetter("lab",lh(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,r,i]=this.rgb;return`rgba(${[e,t,r].map((e=>Math.round(255*e))).join(",")},${i})`}};u(X,"Color"),X.black=new X(0,0,0,1),X.white=new X(1,1,1,1),X.transparent=new X(0,0,0,0),X.red=new X(1,0,0,1);var jn=class{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};u(jn,"Collator");var Hn=class{constructor(e,t,r,i,a){this.text=e,this.image=t,this.scale=r,this.fontStack=i,this.textColor=a}};u(Hn,"FormattedSection");var st=class{constructor(e){this.sections=e}static fromString(e){return new st([new Hn(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof st?e:st.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}};u(st,"Formatted");var ft=class{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ft)return e;if("number"==typeof e)return new ft([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new ft(e)}}toString(){return JSON.stringify(this.values)}};u(ft,"Padding");var Tb=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Ot=class{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ot)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){let r=e[t],i=e[t+1];if("string"!=typeof r||!Tb.has(r)||!Array.isArray(i)||2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])return}return new Ot(e)}}toString(){return JSON.stringify(this.values)}};u(Ot,"VariableAnchorOffsetCollection");var ut=class{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new ut({name:e,available:!1}):null}};function hh(e,t,r,i){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[e,t,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[e,t,r,i]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ko(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof X||e instanceof jn||e instanceof st||e instanceof ft||e instanceof Ot||e instanceof ut)return!0;if(Array.isArray(e)){for(let t of e)if(!ko(t))return!1;return!0}if("object"==typeof e){for(let t in e)if(!ko(e[t]))return!1;return!0}return!1}function Ke(e){if(null===e)return Li;if("string"==typeof e)return pe;if("boolean"==typeof e)return oe;if("number"==typeof e)return q;if(e instanceof X)return Rt;if(e instanceof jn)return Io;if(e instanceof st)return zi;if(e instanceof ft)return Co;if(e instanceof Ot)return Mo;if(e instanceof ut)return Nn;if(Array.isArray(e)){let t,r=e.length;for(let r of e){let e=Ke(r);if(t){if(t===e)continue;t=se;break}t=e}return Mt(t||se,r)}return Di}function Zn(e){let t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof X||e instanceof st||e instanceof ft||e instanceof Ot||e instanceof ut?e.toString():JSON.stringify(e)}u(ut,"ResolvedImage"),u(hh,"validateRGBA"),u(ko,"isValue"),u(Ke,"typeOf"),u(Zn,"toString");var Xt=class{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ko(e[1]))return t.error("invalid value");let r=e[1],i=Ke(r),a=t.expectedType;return"array"===i.kind&&0===i.N&&a&&"array"===a.kind&&("number"!=typeof a.N||0===a.N)&&(i=a),new Xt(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};u(Xt,"Literal");var $e=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}};u($e,"RuntimeError");var Lo={string:pe,number:q,boolean:oe,object:Di},Et=class{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r,i=1,a=e[0];if("array"===a){let a,n;if(e.length>2){let r=e[1];if("string"!=typeof r||!(r in Lo)||"object"===r)return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=Lo[r],i++}else a=se;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);n=e[2],i++}r=Mt(a,n)}else{if(!Lo[a])throw new Error(`Types doesn't contain name = ${a}`);r=Lo[a]}let n=[];for(;i<e.length;i++){let r=t.parse(e[i],i,se);if(!r)return null;n.push(r)}return new Et(r,n)}evaluate(e){for(let t=0;t<this.args.length;t++){let r=this.args[t].evaluate(e);if(!qn(this.type,Ke(r)))return r;if(t===this.args.length-1)throw new $e(`Expected value to be of type ${qe(this.type)}, but found ${qe(Ke(r))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}};u(Et,"Assertion");var mh={"to-boolean":oe,"to-color":Rt,"to-number":q,"to-string":pe},Kt=class{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r=e[0];if(!mh[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return t.error("Expected one argument.");let i=mh[r],a=[];for(let r=1;r<e.length;r++){let i=t.parse(e[r],r,se);if(!i)return null;a.push(i)}return new Kt(i,a)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let t,r;for(let i of this.args){if(t=i.evaluate(e),r=null,t instanceof X)return t;if("string"==typeof t){let r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:hh(t[0],t[1],t[2],t[3]),!r))return new X(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new $e(r||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(let r of this.args){t=r.evaluate(e);let i=ft.parse(t);if(i)return i}throw new $e(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(let r of this.args){t=r.evaluate(e);let i=Ot.parse(t);if(i)return i}throw new $e(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(let r of this.args){if(t=r.evaluate(e),null===t)return 0;let i=Number(t);if(!isNaN(i))return i}throw new $e(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return st.fromString(Zn(this.args[0].evaluate(e)));case"resolvedImage":return ut.fromString(Zn(this.args[0].evaluate(e)));default:return Zn(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}};u(Kt,"Coercion");var Ab=["Unknown","Point","LineString","Polygon"],Do=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ab[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=X.parse(e)),t}};u(Do,"EvaluationContext");var Ri=class{constructor(e,t,r=[],i,a=new Un,n=[]){this.registry=e,this.path=r,this.key=r.map((e=>`[${e}]`)).join(""),this.scope=a,this.errors=n,this.expectedType=i,this._isConstant=t}parse(e,t,r,i,a={}){return t?this.concat(t,r,i)._parse(e,a):this._parse(e,a)}_parse(e,t){function r(e,t,r){return"assert"===r?new Et(t,[e]):"coerce"===r?new Kt(t,[e]):e}if((null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e)&&(e=["literal",e]),u(r,"annotate"),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let i=e[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let a=this.registry[i];if(a){let i=a.parse(e,this);if(!i)return null;if(this.expectedType){let e=this.expectedType,a=i.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==a.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==a.kind&&"string"!==a.kind)if("padding"!==e.kind||"value"!==a.kind&&"number"!==a.kind&&"array"!==a.kind)if("variableAnchorOffsetCollection"!==e.kind||"value"!==a.kind&&"array"!==a.kind){if(this.checkSubtype(e,a))return null}else i=r(i,e,t.typeAnnotation||"coerce");else i=r(i,e,t.typeAnnotation||"coerce");else i=r(i,e,t.typeAnnotation||"coerce");else i=r(i,e,t.typeAnnotation||"assert")}if(!(i instanceof Xt)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){let e=new Do;try{i=new Xt(i.type,i.evaluate(e))}catch(e){return this.error(e.message),null}}return i}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===e?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,r){let i="number"==typeof e?this.path.concat(e):this.path,a=r?this.scope.concat(r):this.scope;return new Ri(this.registry,this._isConstant,i,t||null,a,this.errors)}error(e,...t){let r=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new Bt(r,e))}checkSubtype(e,t){let r=qn(e,t);return r&&this.error(r),r}};u(Ri,"ParsingContext");var Oi=class{constructor(e,t,r){this.type=Io,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");let r=e[1];if("object"!=typeof r||Array.isArray(r))return t.error("Collator options argument must be an object.");let i=t.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,oe);if(!i)return null;let a=t.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,oe);if(!a)return null;let n=null;return r.locale&&(n=t.parse(r.locale,1,pe),!n)?null:new Oi(i,a,n)}evaluate(e){return new jn(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}};u(Oi,"CollatorExpression");var Sr=8192;function Xu(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Ib(e){return(180+e)/360}function Cb(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function zo(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Mb(e,t){let r=Ib(e[0]),i=Cb(e[1]),a=Math.pow(2,t.z);return[Math.round(r*a*Sr),Math.round(i*a*Sr)]}function Eb(e,t,r){let i=e[0]-t[0],a=e[1]-t[1],n=e[0]-r[0],s=e[1]-r[1];return i*s-n*a==0&&i*n<=0&&a*s<=0}function kb(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Ku(e,t){let r=!1;for(let i=0,a=t.length;i<a;i++){let a=t[i];for(let t=0,i=a.length;t<i-1;t++){if(Eb(e,a[t],a[t+1]))return!1;kb(e,a[t],a[t+1])&&(r=!r)}}return r}function Lb(e,t){for(let r=0;r<t.length;r++)if(Ku(e,t[r]))return!0;return!1}function Db(e,t){return e[0]*t[1]-e[1]*t[0]}function fh(e,t,r,i){let a=e[0]-r[0],n=e[1]-r[1],s=t[0]-r[0],o=t[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],h=a*u-l*n,c=s*u-l*o;return h>0&&c<0||h<0&&c>0}function zb(e,t,r,i){let a=[t[0]-e[0],t[1]-e[1]];return 0!==Db([i[0]-r[0],i[1]-r[1]],a)&&!(!fh(e,t,r,i)||!fh(r,i,e,t))}function Fb(e,t,r){for(let i of r)for(let r=0;r<i.length-1;++r)if(zb(e,t,i[r],i[r+1]))return!0;return!1}function dh(e,t){for(let r=0;r<e.length;++r)if(!Ku(e[r],t))return!1;for(let r=0;r<e.length-1;++r)if(Fb(e[r],e[r+1],t))return!1;return!0}function Bb(e,t){for(let r=0;r<t.length;r++)if(dh(e,t[r]))return!0;return!1}function Yu(e,t,r){let i=[];for(let a=0;a<e.length;a++){let n=[];for(let i=0;i<e[a].length;i++){let s=Mb(e[a][i],r);Xu(t,s),n.push(s)}i.push(n)}return i}function yh(e,t,r){let i=[];for(let a=0;a<e.length;a++){let n=Yu(e[a],t,r);i.push(n)}return i}function gh(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){let t=.5*i,a=e[0]-r[0]>t?-i:r[0]-e[0]>t?i:0;0===a&&(a=e[0]-r[2]>t?-i:r[2]-e[0]>t?i:0),e[0]+=a}Xu(t,e)}function Rb(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function xh(e,t,r,i){let a=Math.pow(2,i.z)*Sr,n=[i.x*Sr,i.y*Sr],s=[];for(let i of e)for(let e of i){let i=[e.x+n[0],e.y+n[1]];gh(i,t,r,a),s.push(i)}return s}function _h(e,t,r,i){let a=Math.pow(2,i.z)*Sr,n=[i.x*Sr,i.y*Sr],s=[];for(let r of e){let e=[];for(let i of r){let r=[i.x+n[0],i.y+n[1]];Xu(t,r),e.push(r)}s.push(e)}if(t[2]-t[0]<=a/2){Rb(t);for(let e of s)for(let i of e)gh(i,t,r,a)}return s}function Ob(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if("Polygon"===t.type){let n=Yu(t.coordinates,i,a),s=xh(e.geometry(),r,i,a);if(!zo(r,i))return!1;for(let e of s)if(!Ku(e,n))return!1}if("MultiPolygon"===t.type){let n=yh(t.coordinates,i,a),s=xh(e.geometry(),r,i,a);if(!zo(r,i))return!1;for(let e of s)if(!Lb(e,n))return!1}return!0}function Vb(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if("Polygon"===t.type){let n=Yu(t.coordinates,i,a),s=_h(e.geometry(),r,i,a);if(!zo(r,i))return!1;for(let e of s)if(!dh(e,n))return!1}if("MultiPolygon"===t.type){let n=yh(t.coordinates,i,a),s=_h(e.geometry(),r,i,a);if(!zo(r,i))return!1;for(let e of s)if(!Bb(e,n))return!1}return!0}u(Xu,"updateBBox"),u(Ib,"mercatorXfromLng"),u(Cb,"mercatorYfromLat"),u(zo,"boxWithinBox"),u(Mb,"getTileCoordinates"),u(Eb,"onBoundary"),u(kb,"rayIntersect"),u(Ku,"pointWithinPolygon"),u(Lb,"pointWithinPolygons"),u(Db,"perp"),u(fh,"twoSided"),u(zb,"lineIntersectLine"),u(Fb,"lineIntersectPolygon"),u(dh,"lineStringWithinPolygon"),u(Bb,"lineStringWithinPolygons"),u(Yu,"getTilePolygon"),u(yh,"getTilePolygons"),u(gh,"updatePoint"),u(Rb,"resetBBox"),u(xh,"getTilePoints"),u(_h,"getTileLines"),u(Ob,"pointsWithinPolygons"),u(Vb,"linesWithinPolygons");var sr=class{constructor(e,t){this.type=oe,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ko(e[1])){let t=e[1];if("FeatureCollection"===t.type)for(let e=0;e<t.features.length;++e){let r=t.features[e].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new sr(t,t.features[e].geometry)}else if("Feature"===t.type){let e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new sr(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new sr(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return Ob(e,this.geometries);if("LineString"===e.geometryType())return Vb(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}};u(sr,"Within");var Vi=class{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");let r=e[1];return t.scope.has(r)?new Vi(r,t.scope.get(r)):t.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}};u(Vi,"Var");var dt=class{constructor(e,t,r,i){this.name=e,this.type=t,this._evaluate=r,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let r=e[0],i=dt.definitions[r];if(!i)return t.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(i)?i[0]:i.type,n=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=n.filter((([t])=>!Array.isArray(t)||t.length===e.length-1)),o=null;for(let[i,n]of s){o=new Ri(t.registry,Fo,t.path,null,t.scope);let s=[],l=!1;for(let t=1;t<e.length;t++){let r=e[t],a=Array.isArray(i)?i[t-1]:i.type,n=o.parse(r,1+s.length,a);if(!n){l=!0;break}s.push(n)}if(!l){if(Array.isArray(i)&&i.length!==s.length){o.error(`Expected ${i.length} arguments, but found ${s.length} instead.`);continue}for(let e=0;e<s.length;e++){let t=Array.isArray(i)?i[e]:i.type,r=s[e];o.concat(e+1).checkSubtype(t,r.type)}if(0===o.errors.length)return new dt(r,a,n,s)}}if(1===s.length)t.errors.push(...o.errors);else{let r=(s.length?s:n).map((([e])=>Ub(e))).join(" | "),i=[];for(let r=1;r<e.length;r++){let a=t.parse(e[r],1+i.length);if(!a)return null;i.push(qe(a.type))}t.error(`Expected arguments of type ${r}, but found (${i.join(", ")}) instead.`)}return null}static register(e,t){dt.definitions=t;for(let r in t)e[r]=dt}};function Ub(e){return Array.isArray(e)?`(${e.map(qe).join(", ")})`:`(${qe(e.type)}...)`}function Fo(e){if(e instanceof Vi)return Fo(e.boundExpression);if(e instanceof dt&&"error"===e.name)return!1;if(e instanceof Oi)return!1;if(e instanceof sr)return!1;let t=e instanceof Kt||e instanceof Et,r=!0;return e.eachChild((e=>{r=t?r&&Fo(e):r&&e instanceof Xt})),!!r&&(Bo(e)&&Ro(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]))}function Bo(e){if(e instanceof dt){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof sr)return!1;let t=!0;return e.eachChild((e=>{t&&!Bo(e)&&(t=!1)})),t}function Wn(e){if(e instanceof dt&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!Wn(e)&&(t=!1)})),t}function Ro(e,t){if(e instanceof dt&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild((e=>{r&&!Ro(e,t)&&(r=!1)})),r}function Oo(e,t){let r,i,a=e.length-1,n=0,s=a,o=0;for(;n<=s;)if(o=Math.floor((n+s)/2),r=e[o],i=e[o+1],r<=t){if(o===a||t<i)return o;n=o+1}else{if(!(r>t))throw new $e("Input is not a number.");s=o-1}return 0}u(dt,"CompoundExpression"),u(Ub,"stringifySignature"),u(Fo,"isExpressionConstant"),u(Bo,"isFeatureConstant"),u(Wn,"isStateConstant"),u(Ro,"isGlobalPropertyConstant"),u(Oo,"findStopLessThanOrEqualTo");var Pr=class{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[e,t]of r)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");let r=t.parse(e[1],1,q);if(!r)return null;let i=[],a=null;t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let r=1;r<e.length;r+=2){let n=1===r?-1/0:e[r],s=e[r+1],o=r,l=r+1;if("number"!=typeof n)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(i.length&&i[i.length-1][0]>=n)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);let u=t.parse(s,l,a);if(!u)return null;a=a||u.type,i.push([n,u])}return new Pr(a,r,i)}evaluate(e){let t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);let i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);let a=t.length;return i>=t[a-1]?r[a-1].evaluate(e):r[Oo(t,i)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}};function Nb(e){return"rgb"===e||"hcl"===e||"lab"===e}function Kr(e,t,r){return e+r*(t-e)}function qb(e,t,r,i="rgb"){switch(i){case"rgb":{let[i,a,n,s]=Vo(e.rgb,t.rgb,r);return new X(i,a,n,s,!1)}case"hcl":{let i,a,[n,s,o,l]=e.hcl,[u,h,c,p]=t.hcl;if(isNaN(n)||isNaN(u))isNaN(n)?isNaN(u)?i=NaN:(i=u,(1===o||0===o)&&(a=h)):(i=n,(1===c||0===c)&&(a=s));else{let e=u-n;u>n&&e>180?e-=360:u<n&&n-u>180&&(e+=360),i=n+r*e}let[d,f,m,y]=vb([i,null!=a?a:Kr(s,h,r),Kr(o,c,r),Kr(l,p,r)]);return new X(d,f,m,y,!1)}case"lab":{let[i,a,n,s]=uh(Vo(e.lab,t.lab,r));return new X(i,a,n,s,!1)}}}function Vo(e,t,r){return e.map(((e,i)=>Kr(e,t[i],r)))}function $b(e,t,r){return new ft(Vo(e.values,t.values,r))}function Gb(e,t,r){let i=e.values,a=t.values;if(i.length!==a.length)throw new $e(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);let n=[];for(let e=0;e<i.length;e+=2){if(i[e]!==a[e])throw new $e(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${i[e]}, to[${e}]: ${a[e]}`);n.push(i[e]);let[t,s]=i[e+1],[o,l]=a[e+1];n.push([Kr(t,o,r),Kr(s,l,r)])}return new Ot(n)}u(Pr,"Step"),u(Nb,"isSupportedInterpolationColorSpace"),u(Kr,"number"),u(qb,"color"),u(Vo,"array"),u($b,"padding"),u(Gb,"variableAnchorOffsetCollection");var Le={number:Kr,color:qb,array:Vo,padding:$b,variableAnchorOffsetCollection:Gb},ct=class{constructor(e,t,r,i,a){this.type=e,this.operator=t,this.interpolation=r,this.input=i,this.labels=[],this.outputs=[];for(let[e,t]of a)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,r,i){let a=0;if("exponential"===e.name)a=Ju(t,e.base,r,i);else if("linear"===e.name)a=Ju(t,1,r,i);else if("cubic-bezier"===e.name){let n=e.controlPoints;a=new Kp.default(n[0],n[1],n[2],n[3]).solve(Ju(t,1,r,i))}return a}static parse(e,t){let[r,i,a,...n]=e;if(!Array.isArray(i)||0===i.length)return t.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){let e=i[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:e}}else{if("cubic-bezier"!==i[0])return t.error(`Unknown interpolation type ${String(i[0])}`,1,0);{let e=i.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(a=t.parse(a,2,q),!a)return null;let s=[],o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=Rt:t.expectedType&&"value"!==t.expectedType.kind&&(o=t.expectedType);for(let e=0;e<n.length;e+=2){let r=n[e],i=n[e+1],a=e+3,l=e+4;if("number"!=typeof r)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(s.length&&s[s.length-1][0]>=r)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',a);let u=t.parse(i,l,o);if(!u)return null;o=o||u.type,s.push([r,u])}return Gn(o,q)||Gn(o,Rt)||Gn(o,Co)||Gn(o,Mo)||Gn(o,Mt(q))?new ct(o,r,i,a,s):t.error(`Type ${qe(o)} is not interpolatable.`)}evaluate(e){let t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);let i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);let a=t.length;if(i>=t[a-1])return r[a-1].evaluate(e);let n=Oo(t,i),s=t[n],o=t[n+1],l=ct.interpolationFactor(this.interpolation,i,s,o),u=r[n].evaluate(e),h=r[n+1].evaluate(e);switch(this.operator){case"interpolate":return Le[this.type.kind](u,h,l);case"interpolate-hcl":return Le.color(u,h,l,"hcl");case"interpolate-lab":return Le.color(u,h,l,"lab")}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}};function Ju(e,t,r,i){let a=i-r,n=e-r;return 0===a?0:1===t?n/a:(Math.pow(t,n)-1)/(Math.pow(t,a)-1)}u(ct,"Interpolate"),u(Ju,"exponentialInterpolation");var Yr=class{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument.");let r=null,i=t.expectedType;i&&"value"!==i.kind&&(r=i);let a=[];for(let i of e.slice(1)){let e=t.parse(i,1+a.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,a.push(e)}if(!r)throw new Error("No output type");return i&&a.some((e=>qn(i,e.type)))?new Yr(se,a):new Yr(r,a)}evaluate(e){let t,r=null,i=0;for(let a of this.args)if(i++,r=a.evaluate(e),r&&r instanceof ut&&!r.available&&(t||(t=r.name),r=null,i===this.args.length&&(r=t)),null!==r)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}};u(Yr,"Coalesce");var Ui=class{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let r=[];for(let i=1;i<e.length-1;i+=2){let a=e[i];if("string"!=typeof a)return t.error(`Expected string, but found ${typeof a} instead.`,i);if(/[^a-zA-Z0-9_]/.test(a))return t.error("Variable names must contain only alphanumeric characters or '_'.",i);let n=t.parse(e[i+1],i+1);if(!n)return null;r.push([a,n])}let i=t.parse(e[e.length-1],e.length-1,t.expectedType,r);return i?new Ui(r,i):null}outputDefined(){return this.result.outputDefined()}};u(Ui,"Let");var Xn=class{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=t.parse(e[1],1,q),i=t.parse(e[2],2,Mt(t.expectedType||se));if(!r||!i)return null;let a=i.type;return new Xn(a.itemType,r,i)}evaluate(e){let t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new $e(`Array index out of bounds: ${t} < 0.`);if(t>=r.length)throw new $e(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t!==Math.floor(t))throw new $e(`Array index must be an integer, but found ${t} instead.`);return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}};u(Xn,"At");var Kn=class{constructor(e,t){this.type=oe,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=t.parse(e[1],1,se),i=t.parse(e[2],2,se);return r&&i?Gu(r.type,[oe,pe,q,Li,se])?new Kn(r,i):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${qe(r.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!$n(t,["boolean","string","number","null"]))throw new $e(`Expected first argument to be of type boolean, string, number or null, but found ${qe(Ke(t))} instead.`);if(!$n(r,["string","array"]))throw new $e(`Expected second argument to be of type array or string, but found ${qe(Ke(r))} instead.`);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}};u(Kn,"In");var Ni=class{constructor(e,t,r){this.type=q,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let r=t.parse(e[1],1,se),i=t.parse(e[2],2,se);if(!r||!i)return null;if(!Gu(r.type,[oe,pe,q,Li,se]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${qe(r.type)} instead`);if(4===e.length){let a=t.parse(e[3],3,q);return a?new Ni(r,i,a):null}return new Ni(r,i)}evaluate(e){let t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!$n(t,["boolean","string","number","null"]))throw new $e(`Expected first argument to be of type boolean, string, number or null, but found ${qe(Ke(t))} instead.`);if(!$n(r,["string","array"]))throw new $e(`Expected second argument to be of type array or string, but found ${qe(Ke(r))} instead.`);if(this.fromIndex){let i=this.fromIndex.evaluate(e);return r.indexOf(t,i)}return r.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}};u(Ni,"IndexOf");var Yn=class{constructor(e,t,r,i,a,n){this.inputType=e,this.type=t,this.input=r,this.cases=i,this.outputs=a,this.otherwise=n}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let r,i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);let a={},n=[];for(let s=2;s<e.length-1;s+=2){let o=e[s],l=e[s+1];Array.isArray(o)||(o=[o]);let u=t.concat(s);if(0===o.length)return u.error("Expected at least one branch label.");for(let e of o){if("number"!=typeof e&&"string"!=typeof e)return u.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,Ke(e)))return null}else r=Ke(e);if(void 0!==a[String(e)])return u.error("Branch labels must be unique.");a[String(e)]=n.length}let h=t.parse(l,s,i);if(!h)return null;i=i||h.type,n.push(h)}let s=t.parse(e[1],1,se);if(!s)return null;let o=t.parse(e[e.length-1],e.length-1,i);return!o||"value"!==s.type.kind&&t.concat(1).checkSubtype(r,s.type)?null:new Yn(r,i,s,a,n,o)}evaluate(e){let t=this.input.evaluate(e);return(Ke(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}};u(Yn,"Match");var Jn=class{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let n=t.parse(e[a],a,oe);if(!n)return null;let s=t.parse(e[a+1],a+1,r);if(!s)return null;i.push([n,s]),r=r||s.type}let a=t.parse(e[e.length-1],e.length-1,r);if(!a)return null;if(!r)throw new Error("Can't infer output type");return new Jn(r,i,a)}evaluate(e){for(let[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}};u(Jn,"Case");var qi=class{constructor(e,t,r,i){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let r=t.parse(e[1],1,se),i=t.parse(e[2],2,q);if(!r||!i)return null;if(!Gu(r.type,[Mt(se),pe,se]))return t.error(`Expected first argument to be of type array or string, but found ${qe(r.type)} instead`);if(4===e.length){let a=t.parse(e[3],3,q);return a?new qi(r.type,r,i,a):null}return new qi(r.type,r,i)}evaluate(e){let t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!$n(t,["string","array"]))throw new $e(`Expected first argument to be of type array or string, but found ${qe(Ke(t))} instead.`);if(this.endIndex){let i=this.endIndex.evaluate(e);return t.slice(r,i)}return t.slice(r)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function bh(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function jb(e,t,r){return t===r}function Hb(e,t,r){return t!==r}function Zb(e,t,r){return t<r}function Wb(e,t,r){return t>r}function Xb(e,t,r){return t<=r}function Kb(e,t,r){return t>=r}function vh(e,t,r,i){return 0===i.compare(t,r)}function Yb(e,t,r,i){return!vh(e,t,r,i)}function Jb(e,t,r,i){return i.compare(t,r)<0}function Qb(e,t,r,i){return i.compare(t,r)>0}function ev(e,t,r,i){return i.compare(t,r)<=0}function tv(e,t,r,i){return i.compare(t,r)>=0}function $i(e,t,r){let i="=="!==e&&"!="!==e;return u(class a{constructor(e,t,r){this.type=oe,this.lhs=e,this.rhs=t,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");let r=e[0],n=t.parse(e[1],1,se);if(!n)return null;if(!bh(r,n.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${qe(n.type)}'.`);let s=t.parse(e[2],2,se);if(!s)return null;if(!bh(r,s.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${qe(s.type)}'.`);if(n.type.kind!==s.type.kind&&"value"!==n.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${qe(n.type)}' and '${qe(s.type)}'.`);i&&("value"===n.type.kind&&"value"!==s.type.kind?n=new Et(s.type,[n]):"value"!==n.type.kind&&"value"===s.type.kind&&(s=new Et(n.type,[s])));let o=null;if(4===e.length){if("string"!==n.type.kind&&"string"!==s.type.kind&&"value"!==n.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(o=t.parse(e[3],3,Io),!o)return null}return new a(n,s,o)}evaluate(a){let n=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let t=Ke(n),r=Ke(s);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new $e(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){let e=Ke(n),r=Ke(s);if("string"!==e.kind||"string"!==r.kind)return t(a,n,s)}return this.collator?r(a,n,s,this.collator.evaluate(a)):t(a,n,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}},"Comparison")}u(qi,"Slice"),u(bh,"isComparableType"),u(jb,"eq"),u(Hb,"neq"),u(Zb,"lt"),u(Wb,"gt"),u(Xb,"lteq"),u(Kb,"gteq"),u(vh,"eqCollate"),u(Yb,"neqCollate"),u(Jb,"ltCollate"),u(Qb,"gtCollate"),u(ev,"lteqCollate"),u(tv,"gteqCollate"),u($i,"makeComparison");var rv=$i("==",jb,vh),iv=$i("!=",Hb,Yb),nv=$i("<",Zb,Jb),av=$i(">",Wb,Qb),ov=$i("<=",Xb,ev),sv=$i(">=",Kb,tv),Qn=class{constructor(e,t,r,i,a){this.type=pe,this.number=e,this.locale=t,this.currency=r,this.minFractionDigits=i,this.maxFractionDigits=a}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");let r=t.parse(e[1],1,q);if(!r)return null;let i=e[2];if("object"!=typeof i||Array.isArray(i))return t.error("NumberFormat options argument must be an object.");let a=null;if(i.locale&&(a=t.parse(i.locale,1,pe),!a))return null;let n=null;if(i.currency&&(n=t.parse(i.currency,1,pe),!n))return null;let s=null;if(i["min-fraction-digits"]&&(s=t.parse(i["min-fraction-digits"],1,q),!s))return null;let o=null;return i["max-fraction-digits"]&&(o=t.parse(i["max-fraction-digits"],1,q),!o)?null:new Qn(r,a,n,s,o)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}};u(Qn,"NumberFormat");var Jr=class{constructor(e){this.type=zi,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return t.error("First argument must be an image or text section.");let i=[],a=!1;for(let r=1;r<=e.length-1;++r){let n=e[r];if(a&&"object"==typeof n&&!Array.isArray(n)){a=!1;let e=null;if(n["font-scale"]&&(e=t.parse(n["font-scale"],1,q),!e))return null;let r=null;if(n["text-font"]&&(r=t.parse(n["text-font"],1,Mt(pe)),!r))return null;let s=null;if(n["text-color"]&&(s=t.parse(n["text-color"],1,Rt),!s))return null;let o=i[i.length-1];o.scale=e,o.font=r,o.textColor=s}else{let n=t.parse(e[r],1,se);if(!n)return null;let s=n.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,i.push({content:n,scale:null,font:null,textColor:null})}}return new Jr(i)}evaluate(e){let t=u((t=>{let r=t.content.evaluate(e);return Ke(r)===Nn?new Hn("",r,null,null,null):new Hn(Zn(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}),"evaluateSection");return new st(this.sections.map(t))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}};u(Jr,"FormatExpression");var ea=class{constructor(e){this.type=Nn,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");let r=t.parse(e[1],1,pe);return r?new ea(r):t.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),r=ut.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}};u(ea,"ImageExpression");var ta=class{constructor(e){this.type=q,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let r=t.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?t.error(`Expected argument of type string or array, but found ${qe(r.type)} instead.`):new ta(r):null}evaluate(e){let t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new $e(`Expected value to be of type string or array, but found ${qe(Ke(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}};u(ta,"Length");var Qr={"==":rv,"!=":iv,">":av,"<":nv,">=":sv,"<=":ov,array:Et,at:Xn,boolean:Et,case:Jn,coalesce:Yr,collator:Oi,format:Jr,image:ea,in:Kn,"index-of":Ni,interpolate:ct,"interpolate-hcl":ct,"interpolate-lab":ct,length:ta,let:Ui,literal:Xt,match:Yn,number:Et,"number-format":Qn,object:Et,slice:qi,step:Pr,string:Et,"to-boolean":Kt,"to-color":Kt,"to-number":Kt,"to-string":Kt,var:Vi,within:sr};function Sh(e,[t,r,i,a]){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);let n=a?a.evaluate(e):1,s=hh(t,r,i,n);if(s)throw new $e(s);return new X(t/255,r/255,i/255,n,!1)}function Ph(e,t){return e in t}function Qu(e,t){let r=t[e];return void 0===r?null:r}function lv(e,t,r,i){for(;r<=i;){let a=r+i>>1;if(t[a]===e)return!0;t[a]>e?i=a-1:r=a+1}return!1}function ei(e){return{type:e}}function ec(e){return{result:"success",value:e}}function Gi(e){return{result:"error",value:e}}function Tr(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function Th(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function tc(e){return!!e.expression&&e.expression.interpolated}function be(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Uo(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function uv(e){return e}function Ah(e,t){let r,i,a,n="color"===t.type,s=e.stops&&"object"==typeof e.stops[0][0],o=s||void 0!==e.property,l=s||!o,u=e.type||(tc(t)?"exponential":"interval");if(n||"padding"===t.type){let r=n?X.parse:ft.parse;(e=ki({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],r(e[1])]))),e.default?e.default=r(e.default):e.default=r(t.default)}if(e.colorSpace&&!Nb(e.colorSpace))throw new Error(`Unknown color space: "${e.colorSpace}"`);if("exponential"===u)r=Ih;else if("interval"===u)r=pv;else if("categorical"===u){r=cv,i=Object.create(null);for(let t of e.stops)i[t[0]]=t[1];a=typeof e.stops[0][0]}else{if("identity"!==u)throw new Error(`Unknown function type "${u}"`);r=hv}if(s){let r={},i=[];for(let t=0;t<e.stops.length;t++){let a=e.stops[t],n=a[0].zoom;void 0===r[n]&&(r[n]={zoom:n,type:e.type,property:e.property,default:e.default,stops:[]},i.push(n)),r[n].stops.push([a[0].value,a[1]])}let a=[];for(let e of i)a.push([r[e].zoom,Ah(r[e],t)]);let n={name:"linear"};return{kind:"composite",interpolationType:n,interpolationFactor:ct.interpolationFactor.bind(void 0,n),zoomStops:a.map((e=>e[0])),evaluate:({zoom:r},i)=>Ih({stops:a,base:e.base},t,r).evaluate(r,i)}}if(l){let n="exponential"===u?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:n,interpolationFactor:ct.interpolationFactor.bind(void 0,n),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:n})=>r(e,t,n,i,a)}}return{kind:"source",evaluate(n,s){let o=s&&s.properties?s.properties[e.property]:void 0;return void 0===o?ra(e.default,t.default):r(e,t,o,i,a)}}}function ra(e,t,r){return void 0!==e?e:void 0!==t?t:void 0!==r?r:void 0}function cv(e,t,r,i,a){return ra(typeof r===a?i[r]:void 0,e.default,t.default)}function pv(e,t,r){if("number"!==be(r))return ra(e.default,t.default);let i=e.stops.length;if(1===i||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let a=Oo(e.stops.map((e=>e[0])),r);return e.stops[a][1]}function Ih(e,t,r){let i=void 0!==e.base?e.base:1;if("number"!==be(r))return ra(e.default,t.default);let a=e.stops.length;if(1===a||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[a-1][0])return e.stops[a-1][1];let n=Oo(e.stops.map((e=>e[0])),r),s=mv(r,i,e.stops[n][0],e.stops[n+1][0]),o=e.stops[n][1],l=e.stops[n+1][1],u=Le[t.type]||uv;return"function"==typeof o.evaluate?{evaluate(...t){let r=o.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==i)return u(r,i,s,e.colorSpace)}}:u(o,l,s,e.colorSpace)}function hv(e,t,r){switch(t.type){case"color":r=X.parse(r);break;case"formatted":r=st.fromString(r.toString());break;case"resolvedImage":r=ut.fromString(r.toString());break;case"padding":r=ft.parse(r);break;default:be(r)!==t.type&&("enum"!==t.type||!t.values[r])&&(r=void 0)}return ra(r,e.default,t.default)}function mv(e,t,r,i){let a=i-r,n=e-r;return 0===a?0:1===t?n/a:(Math.pow(t,n)-1)/(Math.pow(t,a)-1)}u(Sh,"rgba"),u(Ph,"has"),u(Qu,"get"),u(lv,"binarySearch"),u(ei,"varargs"),dt.register(Qr,{error:[db,[pe],(e,[t])=>{throw new $e(t.evaluate(e))}],typeof:[pe,[se],(e,[t])=>qe(Ke(t.evaluate(e)))],"to-rgba":[Mt(q,4),[Rt],(e,[t])=>{let[r,i,a,n]=t.evaluate(e).rgb;return[255*r,255*i,255*a,n]}],rgb:[Rt,[q,q,q],Sh],rgba:[Rt,[q,q,q,q],Sh],has:{type:oe,overloads:[[[pe],(e,[t])=>Ph(t.evaluate(e),e.properties())],[[pe,Di],(e,[t,r])=>Ph(t.evaluate(e),r.evaluate(e))]]},get:{type:se,overloads:[[[pe],(e,[t])=>Qu(t.evaluate(e),e.properties())],[[pe,Di],(e,[t,r])=>Qu(t.evaluate(e),r.evaluate(e))]]},"feature-state":[se,[pe],(e,[t])=>Qu(t.evaluate(e),e.featureState||{})],properties:[Di,[],e=>e.properties()],"geometry-type":[pe,[],e=>e.geometryType()],id:[se,[],e=>e.id()],zoom:[q,[],e=>e.globals.zoom],"heatmap-density":[q,[],e=>e.globals.heatmapDensity||0],"line-progress":[q,[],e=>e.globals.lineProgress||0],accumulated:[se,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[q,ei(q),(e,t)=>{let r=0;for(let i of t)r+=i.evaluate(e);return r}],"*":[q,ei(q),(e,t)=>{let r=1;for(let i of t)r*=i.evaluate(e);return r}],"-":{type:q,overloads:[[[q,q],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[q],(e,[t])=>-t.evaluate(e)]]},"/":[q,[q,q],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[q,[q,q],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[q,[],()=>Math.LN2],pi:[q,[],()=>Math.PI],e:[q,[],()=>Math.E],"^":[q,[q,q],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[q,[q],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[q,[q],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[q,[q],(e,[t])=>Math.log(t.evaluate(e))],log2:[q,[q],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[q,[q],(e,[t])=>Math.sin(t.evaluate(e))],cos:[q,[q],(e,[t])=>Math.cos(t.evaluate(e))],tan:[q,[q],(e,[t])=>Math.tan(t.evaluate(e))],asin:[q,[q],(e,[t])=>Math.asin(t.evaluate(e))],acos:[q,[q],(e,[t])=>Math.acos(t.evaluate(e))],atan:[q,[q],(e,[t])=>Math.atan(t.evaluate(e))],min:[q,ei(q),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[q,ei(q),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[q,[q],(e,[t])=>Math.abs(t.evaluate(e))],round:[q,[q],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[q,[q],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[q,[q],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[oe,[pe,se],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[oe,[se],(e,[t])=>e.id()===t.value],"filter-type-==":[oe,[pe],(e,[t])=>e.geometryType()===t.value],"filter-<":[oe,[pe,se],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i<a}],"filter-id-<":[oe,[se],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<i}],"filter->":[oe,[pe,se],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i>a}],"filter-id->":[oe,[se],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>i}],"filter-<=":[oe,[pe,se],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[oe,[se],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<=i}],"filter->=":[oe,[pe,se],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[oe,[se],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>=i}],"filter-has":[oe,[se],(e,[t])=>t.value in e.properties()],"filter-has-id":[oe,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[oe,[Mt(pe)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[oe,[Mt(se)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[oe,[pe,Mt(se)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[oe,[pe,Mt(se)],(e,[t,r])=>lv(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:oe,overloads:[[[oe,oe],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[ei(oe),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:oe,overloads:[[[oe,oe],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[ei(oe),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[oe,[oe],(e,[t])=>!t.evaluate(e)],"is-supported-script":[oe,[pe],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[pe,[pe],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[pe,[pe],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[pe,ei(se),(e,t)=>t.map((t=>Zn(t.evaluate(e)))).join("")],"resolved-locale":[pe,[Io],(e,[t])=>t.evaluate(e).resolvedLocale()]}),u(ec,"success"),u(Gi,"error"),u(Tr,"supportsPropertyExpression"),u(Th,"supportsZoomExpression"),u(tc,"supportsInterpolation"),u(be,"getType"),u(Uo,"isFunction"),u(uv,"identityFunction"),u(Ah,"createFunction"),u(ra,"coalesce$1"),u(cv,"evaluateCategoricalFunction"),u(pv,"evaluateIntervalFunction"),u(Ih,"evaluateExponentialFunction"),u(hv,"evaluateIdentityFunction"),u(mv,"interpolationFactor");var ti=class{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Do,this._defaultValue=t?dv(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,r,i,a,n){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=n,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,i,a,n){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=n||null;try{let e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new $e(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}};function ia(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Qr}function rc(e,t){let r=new Ri(Qr,Fo,[],t?fv(t):void 0),i=r.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return i?ec(new ti(i,t)):Gi(r.errors)}u(ti,"StyleExpression"),u(ia,"isExpression"),u(rc,"createExpression");var Ar=class{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Wn(t.expression)}evaluateWithoutErrorHandling(e,t,r,i,a,n){return this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,a,n)}evaluate(e,t,r,i,a,n){return this._styleExpression.evaluate(e,t,r,i,a,n)}};u(Ar,"ZoomConstantExpression");var Ir=class{constructor(e,t,r,i){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Wn(t.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,t,r,i,a,n){return this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,a,n)}evaluate(e,t,r,i,a,n){return this._styleExpression.evaluate(e,t,r,i,a,n)}interpolationFactor(e,t,r){return this.interpolationType?ct.interpolationFactor(this.interpolationType,e,t,r):0}};function Ch(e,t){let r=rc(e,t);if("error"===r.result)return r;let i=r.value.expression,a=Bo(i);if(!a&&!Tr(t))return Gi([new Bt("","data expressions not supported")]);let n=Ro(i,["zoom"]);if(!n&&!Th(t))return Gi([new Bt("","zoom expressions not supported")]);let s=No(i);if(!s&&!n)return Gi([new Bt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof Bt)return Gi([s]);if(s instanceof ct&&!tc(t))return Gi([new Bt("",'"interpolate" expressions cannot be used with this property')]);if(!s)return ec(new Ar(a?"constant":"source",r.value));let o=s instanceof ct?s.interpolation:void 0;return ec(new Ir(a?"camera":"composite",r.value,s.labels,o))}u(Ir,"ZoomDependentExpression"),u(Ch,"createPropertyExpression");var ri=class{constructor(e,t){this._parameters=e,this._specification=t,ki(this,Ah(this._parameters,this._specification))}static deserialize(e){return new ri(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function Mh(e,t){if(Uo(e))return new ri(e,t);if(ia(e)){let r=Ch(e,t);if("error"===r.result)throw new Error(r.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return r.value}{let r=e;return"color"===t.type&&"string"==typeof e?r=X.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)&&(r=Ot.parse(e)):r=ft.parse(e),{kind:"constant",evaluate:()=>r}}}function No(e){let t=null;if(e instanceof Ui)t=No(e.result);else if(e instanceof Yr){for(let r of e.args)if(t=No(r),t)break}else(e instanceof Pr||e instanceof ct)&&e.input instanceof dt&&"zoom"===e.input.name&&(t=e);return t instanceof Bt||e.eachChild((e=>{let r=No(e);r instanceof Bt?t=r:!t&&r?t=new Bt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new Bt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function fv(e){let t={color:Rt,string:pe,number:q,enum:pe,boolean:oe,formatted:zi,padding:Co,resolvedImage:Nn,variableAnchorOffsetCollection:Mo};return"array"===e.type?Mt(t[e.value]||se,e.length):t[e.type]}function dv(e){return"color"===e.type&&Uo(e.default)?new X(0,0,0,0):"color"===e.type?X.parse(e.default)||null:"padding"===e.type?ft.parse(e.default)||null:"variableAnchorOffsetCollection"===e.type?Ot.parse(e.default)||null:void 0===e.default?null:e.default}function ic(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!ic(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}u(ri,"StylePropertyFunction"),u(Mh,"normalizePropertyExpression"),u(No,"findZoomCurve"),u(fv,"getExpectedType"),u(dv,"getDefaultValue"),u(ic,"isExpressionFilter");var yv={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function na(e){if(null==e)return{filter:()=>!0,needGeometry:!1};ic(e)||(e=qo(e));let t=rc(e,yv);if("error"===t.result)throw new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return{filter:(e,r,i)=>t.value.evaluate(e,r,{},i),needGeometry:Eh(e)}}function gv(e,t){return e<t?-1:e>t?1:0}function Eh(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(let t=1;t<e.length;t++)if(Eh(e[t]))return!0;return!1}function qo(e){if(!e)return!0;let t=e[0];return e.length<=1?"any"!==t:"=="===t?nc(e[1],e[2],"=="):"!="===t?$o(nc(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?nc(e[1],e[2],t):"any"===t?xv(e.slice(1)):"all"===t?["all"].concat(e.slice(1).map(qo)):"none"===t?["all"].concat(e.slice(1).map(qo).map($o)):"in"===t?kh(e[1],e.slice(2)):"!in"===t?$o(kh(e[1],e.slice(2))):"has"===t?Lh(e[1]):"!has"===t?$o(Lh(e[1])):"within"!==t||e}function nc(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function xv(e){return["any"].concat(e.map(qo))}function kh(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(gv)]]:["filter-in-small",e,["literal",t]]}}function Lh(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function $o(e){return["!",e]}function Dh(){let e={},t=C.$version;for(let r in C.$root){let i=C.$root[r];if(i.required){let a=null;a="version"===r?t:"array"===i.type?[]:{},null!=a&&(e[r]=a)}}return e}function zh(e){let t=e.key,r=e.value;return r?[new U(t,r,"constants have been deprecated as of v8")]:[]}function Ye(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function ii(e){if(Array.isArray(e))return e.map(ii);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=ii(e[r]);return t}return Ye(e)}function Vt(e){let t=e.key,r=e.value,i=e.valueSpec||{},a=e.objectElementValidators||{},n=e.style,s=e.styleSpec,o=e.validateSpec,l=[],u=be(r);if("object"!==u)return[new U(t,r,`object expected, ${u} found`)];for(let e in r){let u,h=e.split(".")[0],c=i[h]||i["*"];if(a[h])u=a[h];else if(i[h])u=o;else if(a["*"])u=a["*"];else{if(!i["*"]){l.push(new U(t,r[e],`unknown property "${e}"`));continue}u=o}l=l.concat(u({key:(t&&`${t}.`)+e,value:r[e],valueSpec:c,style:n,styleSpec:s,object:r,objectKey:e,validateSpec:o},r))}for(let e in i)a[e]||i[e].required&&void 0===i[e].default&&void 0===r[e]&&l.push(new U(t,r,`missing required property "${e}"`));return l}function ac(e){let t=e.value,r=e.valueSpec,i=e.validateSpec,a=e.style,n=e.styleSpec,s=e.key,o=e.arrayElementValidator||i;if("array"!==be(t))return[new U(s,t,`array expected, ${be(t)} found`)];if(r.length&&t.length!==r.length)return[new U(s,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new U(s,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let l={type:r.value,values:r.values};n.$version<7&&(l.function=r.function),"object"===be(r.value)&&(l=r.value);let u=[];for(let r=0;r<t.length;r++)u=u.concat(o({array:t,arrayIndex:r,value:t[r],valueSpec:l,validateSpec:e.validateSpec,style:a,styleSpec:n,key:`${s}[${r}]`}));return u}function oc(e){let t=e.key,r=e.value,i=e.valueSpec,a=be(r);return"number"===a&&r!=r&&(a="NaN"),"number"!==a?[new U(t,r,`number expected, ${a} found`)]:"minimum"in i&&r<i.minimum?[new U(t,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new U(t,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]}function Fh(e){let t,r,i,a=e.valueSpec,n=Ye(e.value.type),s={},o="categorical"!==n&&void 0===e.value.property,l=!o,u="array"===be(e.value.stops)&&"array"===be(e.value.stops[0])&&"object"===be(e.value.stops[0][0]),h=Vt({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:c,default:f}});return"identity"===n&&o&&h.push(new U(e.key,e.value,'missing required property "property"')),"identity"!==n&&!e.value.stops&&h.push(new U(e.key,e.value,'missing required property "stops"')),"exponential"===n&&e.valueSpec.expression&&!tc(e.valueSpec)&&h.push(new U(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Tr(e.valueSpec)?h.push(new U(e.key,e.value,"property functions not supported")):o&&!Th(e.valueSpec)&&h.push(new U(e.key,e.value,"zoom functions not supported"))),("categorical"===n||u)&&void 0===e.value.property&&h.push(new U(e.key,e.value,'"property" property is required')),h;function c(e){if("identity"===n)return[new U(e.key,e.value,'identity function may not have a "stops" property')];let t=[],r=e.value;return t=t.concat(ac({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:p})),"array"===be(r)&&0===r.length&&t.push(new U(e.key,r,"array must have at least one stop")),t}function p(e){let t=[],n=e.value,o=e.key;if("array"!==be(n))return[new U(o,n,`array expected, ${be(n)} found`)];if(2!==n.length)return[new U(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==be(n[0]))return[new U(o,n,`object expected, ${be(n[0])} found`)];if(void 0===n[0].zoom)return[new U(o,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new U(o,n,"object stop key must have value")];if(i&&i>Ye(n[0].zoom))return[new U(o,n[0].zoom,"stop zoom values must appear in ascending order")];Ye(n[0].zoom)!==i&&(i=Ye(n[0].zoom),r=void 0,s={}),t=t.concat(Vt({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:oc,value:d}}))}else t=t.concat(d({key:`${o}[0]`,value:n[0],valueSpec:{},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},n));return ia(ii(n[1]))?t.concat([new U(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):t.concat(e.validateSpec({key:`${o}[1]`,value:n[1],valueSpec:a,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,i){let o=be(e.value),l=Ye(e.value),u=null!==e.value?e.value:i;if(t){if(o!==t)return[new U(e.key,u,`${o} stop domain type must match previous stop domain type ${t}`)]}else t=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return[new U(e.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==n){let t=`number expected, ${o} found`;return Tr(a)&&void 0===n&&(t+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new U(e.key,u,t)]}return"categorical"!==n||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===o&&void 0!==r&&l<r?[new U(e.key,u,"stop domain values must appear in ascending order")]:(r=l,"categorical"===n&&l in s?[new U(e.key,u,"stop domain values must be unique")]:(s[l]=!0,[])):[new U(e.key,u,`integer expected, found ${l}`)]}function f(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:a,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}function ji(e){let t=("property"===e.expressionContext?Ch:rc)(ii(e.value),e.valueSpec);if("error"===t.result)return t.value.map((t=>new U(`${e.key}${t.key}`,e.value,t.message)));let r=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!r.outputDefined())return[new U(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!Wn(r))return[new U(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!Wn(r))return[new U(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Ro(r,["zoom","feature-state"]))return[new U(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Bo(r))return[new U(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function _v(e){let t=e.value,r=e.key,i=be(t);return"boolean"!==i?[new U(r,t,`boolean expected, ${i} found`)]:[]}function bv(e){let t=e.key,r=e.value,i=be(r);return"string"!==i?[new U(t,r,`color expected, ${i} found`)]:X.parse(String(r))?[]:[new U(t,r,`color expected, "${r}" found`)]}function aa(e){let t=e.key,r=e.value,i=e.valueSpec,a=[];return Array.isArray(i.values)?-1===i.values.indexOf(Ye(r))&&a.push(new U(t,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(i.values).indexOf(Ye(r))&&a.push(new U(t,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),a}function sc(e){return ic(ii(e.value))?ji(ki({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Bh(e)}function Bh(e){let t=e.value,r=e.key;if("array"!==be(t))return[new U(r,t,`array expected, ${be(t)} found`)];let i,a=e.styleSpec,n=[];if(t.length<1)return[new U(r,t,"filter array must have at least 1 element")];switch(n=n.concat(aa({key:`${r}[0]`,value:t[0],valueSpec:a.filter_operator,style:e.style,styleSpec:e.styleSpec})),Ye(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Ye(t[1])&&n.push(new U(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&n.push(new U(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(i=be(t[1]),"string"!==i&&n.push(new U(`${r}[1]`,t[1],`string expected, ${i} found`)));for(let s=2;s<t.length;s++)i=be(t[s]),"$type"===Ye(t[1])?n=n.concat(aa({key:`${r}[${s}]`,value:t[s],valueSpec:a.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&n.push(new U(`${r}[${s}]`,t[s],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let i=1;i<t.length;i++)n=n.concat(Bh({key:`${r}[${i}]`,value:t[i],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=be(t[1]),2!==t.length?n.push(new U(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):"string"!==i&&n.push(new U(`${r}[1]`,t[1],`string expected, ${i} found`));break;case"within":i=be(t[1]),2!==t.length?n.push(new U(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):"object"!==i&&n.push(new U(`${r}[1]`,t[1],`object expected, ${i} found`))}return n}function Rh(e,t){let r=e.key,i=e.validateSpec,a=e.style,n=e.styleSpec,s=e.value,o=e.objectKey,l=n[`${t}_${e.layerType}`];if(!l)return[];let u=o.match(/^(.*)-transition$/);if("paint"===t&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:s,valueSpec:n.transition,style:a,styleSpec:n});let h,c=e.valueSpec||l[o];if(!c)return[new U(r,s,`unknown property "${o}"`)];if("string"===be(s)&&Tr(c)&&!c.tokens&&(h=/^{([^}]+)}$/.exec(s)))return[new U(r,s,`"${o}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];let p=[];return"symbol"===e.layerType&&("text-field"===o&&a&&!a.glyphs&&p.push(new U(r,s,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&Uo(ii(s))&&"identity"===Ye(s.type)&&p.push(new U(r,s,'"text-font" does not support identity functions'))),p.concat(i({key:e.key,value:s,valueSpec:c,style:a,styleSpec:n,expressionContext:"property",propertyType:t,propertyKey:o}))}function Oh(e){return Rh(e,"paint")}function Vh(e){return Rh(e,"layout")}function Uh(e){let t=[],r=e.value,i=e.key,a=e.style,n=e.styleSpec;!r.type&&!r.ref&&t.push(new U(i,r,'either "type" or "ref" is required'));let s=Ye(r.type),o=Ye(r.ref);if(r.id){let n=Ye(r.id);for(let s=0;s<e.arrayIndex;s++){let e=a.layers[s];Ye(e.id)===n&&t.push(new U(i,r.id,`duplicate layer id "${r.id}", previously used at line ${e.id.__line__}`))}}if("ref"in r){let e;["type","source","source-layer","filter","layout"].forEach((e=>{e in r&&t.push(new U(i,r[e],`"${e}" is prohibited for ref layers`))})),a.layers.forEach((t=>{Ye(t.id)===o&&(e=t)})),e?e.ref?t.push(new U(i,r.ref,"ref cannot reference another ref layer")):s=Ye(e.type):t.push(new U(i,r.ref,`ref layer "${o}" not found`))}else if("background"!==s)if(r.source){let e=a.sources&&a.sources[r.source],n=e&&Ye(e.type);e?"vector"===n&&"raster"===s?t.push(new U(i,r.source,`layer "${r.id}" requires a raster source`)):"raster"===n&&"raster"!==s?t.push(new U(i,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==n||r["source-layer"]?"raster-dem"===n&&"hillshade"!==s?t.push(new U(i,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===s&&r.paint&&r.paint["line-gradient"]&&("geojson"!==n||!e.lineMetrics)&&t.push(new U(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new U(i,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new U(i,r.source,`source "${r.source}" not found`))}else t.push(new U(i,r,'missing required property "source"'));return t=t.concat(Vt({key:i,value:r,valueSpec:n.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${i}.type`,value:r.type,valueSpec:n.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"}),filter:sc,layout:e=>Vt({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Vh(ki({layerType:s},e))}}),paint:e=>Vt({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Oh(ki({layerType:s},e))}})}})),t}function ni(e){let t=e.value,r=e.key,i=be(t);return"string"!==i?[new U(r,t,`string expected, ${i} found`)]:[]}u(na,"createFilter"),u(gv,"compare"),u(Eh,"geometryNeeded"),u(qo,"convertFilter$1"),u(nc,"convertComparisonOp$1"),u(xv,"convertDisjunctionOp"),u(kh,"convertInOp$1"),u(Lh,"convertHasOp$1"),u($o,"convertNegation"),u(Dh,"emptyStyle"),u(zh,"validateConstants"),u(Ye,"unbundle"),u(ii,"deepUnbundle"),u(Vt,"validateObject"),u(ac,"validateArray"),u(oc,"validateNumber"),u(Fh,"validateFunction"),u(ji,"validateExpression"),u(_v,"validateBoolean"),u(bv,"validateColor"),u(aa,"validateEnum"),u(sc,"validateFilter"),u(Bh,"validateNonExpressionFilter"),u(Rh,"validateProperty"),u(Oh,"validatePaintProperty"),u(Vh,"validateLayoutProperty"),u(Uh,"validateLayer"),u(ni,"validateString");var Nh={promoteId:vv};function qh(e){let t=e.value,r=e.key,i=e.styleSpec,a=e.style,n=e.validateSpec;if(!t.type)return[new U(r,t,'"type" is required')];let s,o=Ye(t.type);switch(o){case"vector":case"raster":case"raster-dem":return s=Vt({key:r,value:t,valueSpec:i[`source_${o.replace("-","_")}`],style:e.style,styleSpec:i,objectElementValidators:Nh,validateSpec:n}),s;case"geojson":if(s=Vt({key:r,value:t,valueSpec:i.source_geojson,style:a,styleSpec:i,validateSpec:n,objectElementValidators:Nh}),t.cluster)for(let e in t.clusterProperties){let[i,a]=t.clusterProperties[e],o="string"==typeof i?[i,["accumulated"],["get",e]]:i;s.push(...ji({key:`${r}.${e}.map`,value:a,validateSpec:n,expressionContext:"cluster-map"})),s.push(...ji({key:`${r}.${e}.reduce`,value:o,validateSpec:n,expressionContext:"cluster-reduce"}))}return s;case"video":return Vt({key:r,value:t,valueSpec:i.source_video,style:a,validateSpec:n,styleSpec:i});case"image":return Vt({key:r,value:t,valueSpec:i.source_image,style:a,validateSpec:n,styleSpec:i});case"canvas":return[new U(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return aa({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:a,validateSpec:n,styleSpec:i})}}function vv({key:e,value:t}){if("string"===be(t))return ni({key:e,value:t});{let r=[];for(let i in t)r.push(...ni({key:`${e}.${i}`,value:t[i]}));return r}}function $h(e){let t=e.value,r=e.styleSpec,i=r.light,a=e.style,n=[],s=be(t);if(void 0===t)return n;if("object"!==s)return n=n.concat([new U("light",t,`object expected, ${s} found`)]),n;for(let s in t){let o=s.match(/^(.*)-transition$/);n=o&&i[o[1]]&&i[o[1]].transition?n.concat(e.validateSpec({key:s,value:t[s],valueSpec:r.transition,validateSpec:e.validateSpec,style:a,styleSpec:r})):i[s]?n.concat(e.validateSpec({key:s,value:t[s],valueSpec:i[s],validateSpec:e.validateSpec,style:a,styleSpec:r})):n.concat([new U(s,t[s],`unknown property "${s}"`)])}return n}function Gh(e){let t=e.value,r=e.styleSpec,i=r.terrain,a=e.style,n=[],s=be(t);if(void 0===t)return n;if("object"!==s)return n=n.concat([new U("terrain",t,`object expected, ${s} found`)]),n;for(let s in t)n=i[s]?n.concat(e.validateSpec({key:s,value:t[s],valueSpec:i[s],validateSpec:e.validateSpec,style:a,styleSpec:r})):n.concat([new U(s,t[s],`unknown property "${s}"`)]);return n}function wv(e){return 0===ni(e).length?[]:ji(e)}function Sv(e){return 0===ni(e).length?[]:ji(e)}function Pv(e){let t=e.key,r=e.value;if("array"===be(r)){if(r.length<1||r.length>4)return[new U(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},a=[];for(let n=0;n<r.length;n++)a=a.concat(e.validateSpec({key:`${t}[${n}]`,value:r[n],validateSpec:e.validateSpec,valueSpec:i}));return a}return oc({key:t,value:r,valueSpec:{}})}function Tv(e){let t=e.key,r=e.value,i=be(r),a=e.styleSpec;if("array"!==i||r.length<1||r.length%2!=0)return[new U(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let n=[];for(let i=0;i<r.length;i+=2)n=n.concat(aa({key:`${t}[${i}]`,value:r[i],valueSpec:a.layout_symbol["text-anchor"]})),n=n.concat(ac({key:`${t}[${i+1}]`,value:r[i+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:a}));return n}function jh(e){let t=[],r=e.value,i=e.key;if(Array.isArray(r)){let a=[],n=[];for(let s in r){r[s].id&&a.includes(r[s].id)&&t.push(new U(i,r,`all the sprites' ids must be unique, but ${r[s].id} is duplicated`)),a.push(r[s].id),r[s].url&&n.includes(r[s].url)&&t.push(new U(i,r,`all the sprites' URLs must be unique, but ${r[s].url} is duplicated`)),n.push(r[s].url);let o={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(Vt({key:`${i}[${s}]`,value:r[s],valueSpec:o,validateSpec:e.validateSpec}))}return t}return ni({key:i,value:r})}u(qh,"validateSource"),u(vv,"validatePromoteId"),u($h,"validateLight"),u(Gh,"validateTerrain"),u(wv,"validateFormatted"),u(Sv,"validateImage"),u(Pv,"validatePadding"),u(Tv,"validateVariableAnchorOffsetCollection"),u(jh,"validateSprite");var Hh={"*":()=>[],array:ac,boolean:_v,number:oc,color:bv,constants:zh,enum:aa,filter:sc,function:Fh,layer:Uh,object:Vt,source:qh,light:$h,terrain:Gh,string:ni,formatted:wv,resolvedImage:Sv,padding:Pv,variableAnchorOffsetCollection:Tv,sprite:jh};function oa(e){let t=e.value,r=e.valueSpec,i=e.styleSpec;return e.validateSpec=oa,r.expression&&Uo(Ye(t))?Fh(e):r.expression&&ia(ii(t))?ji(e):r.type&&Hh[r.type]?Hh[r.type](e):Vt(ki({},e,{valueSpec:r.type?i[r.type]:r}))}function Zh(e){let t=e.value,r=e.key,i=ni(e);return i.length||(-1===t.indexOf("{fontstack}")&&i.push(new U(r,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&i.push(new U(r,t,'"glyphs" url must include a "{range}" token'))),i}function jt(e,t=C){let r=[];return r=r.concat(oa({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:oa,objectElementValidators:{glyphs:Zh,"*":()=>[]}})),e.constants&&(r=r.concat(zh({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:oa}))),Wh(r)}function lr(e){return function(t){return e({...t,validateSpec:oa})}}function Wh(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function ur(e){return function(...t){return Wh(e.apply(this,t))}}u(oa,"validate"),u(Zh,"validateGlyphsUrl"),u(jt,"validateStyleMin"),jt.source=ur(lr(qh)),jt.sprite=ur(lr(jh)),jt.glyphs=ur(lr(Zh)),jt.light=ur(lr($h)),jt.terrain=ur(lr(Gh)),jt.layer=ur(lr(Uh)),jt.filter=ur(lr(sc)),jt.paintProperty=ur(lr(Oh)),jt.layoutProperty=ur(lr(Vh)),u(lr,"injectValidateSpec"),u(Wh,"sortErrors"),u(ur,"wrapCleanErrors"),d();var He=jt,jT=He.source,Xh=He.light,HT=He.terrain,ZT=He.filter,Kh=He.paintProperty,Yh=He.layoutProperty;function Hi(e,t){let r=!1;if(t&&t.length)for(let i of t)e.fire(new Z(new Error(i.message))),r=!0;return r}u(Hi,"emitValidationErrors"),d(),d(),d();var Cr=3,cr=class{constructor(e,t,r){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],t=a[1],r=a[2],this.d=t+2*r;for(let e=0;e<this.d*this.d;e++){let t=a[Cr+e],r=a[Cr+e+1];i.push(t===r?null:a.subarray(t,r))}let n=a[Cr+i.length],s=a[Cr+i.length+1];this.keys=a.subarray(n,s),this.bboxes=a.subarray(s),this.insert=this._insertReadonly}else{this.d=t+2*r;for(let e=0;e<this.d*this.d;e++)i.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=r,this.scale=t/e,this.uid=0;let a=r/t*e;this.min=-a,this.max=e+a}insert(e,t,r,i,a){this._forEachCell(t,r,i,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(a)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,r,i,a,n){this.cells[a].push(n)}query(e,t,r,i,a){let n=this.min,s=this.max;if(e<=n&&t<=n&&s<=r&&s<=i&&!a)return Array.prototype.slice.call(this.keys);{let n=[],s={};return this._forEachCell(e,t,r,i,this._queryCell,n,s,a),n}}_queryCell(e,t,r,i,a,n,s,o){let l=this.cells[a];if(null!==l){let a=this.keys,u=this.bboxes;for(let h=0;h<l.length;h++){let c=l[h];if(void 0===s[c]){let l=4*c;(o?o(u[l+0],u[l+1],u[l+2],u[l+3]):e<=u[l+2]&&t<=u[l+3]&&r>=u[l+0]&&i>=u[l+1])?(s[c]=!0,n.push(a[c])):s[c]=!1}}}}_forEachCell(e,t,r,i,a,n,s,o){let l=this._convertToCellCoord(e),u=this._convertToCellCoord(t),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i);for(let p=l;p<=h;p++)for(let l=u;l<=c;l++){let u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&a.call(this,e,t,r,i,u,n,s,o))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=Cr+this.cells.length+1+1,r=0;for(let e=0;e<this.cells.length;e++)r+=this.cells[e].length;let i=new Int32Array(t+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let a=t;for(let t=0;t<e.length;t++){let r=e[t];i[Cr+t]=a,i.set(r,a),a+=r.length}return i[Cr+e.length]=a,i.set(this.keys,a),a+=this.keys.length,i[Cr+e.length+1]=a,i.set(this.bboxes,a),a+=this.bboxes.length,i.buffer}static serialize(e,t){let r=e.toArrayBuffer();return t&&t.push(r),{buffer:r}}static deserialize(e){return new cr(e.buffer)}};u(cr,"TransferableGridIndex");var Mr={};function N(e,t,r={}){if(Mr[e])throw new Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),Mr[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}u(N,"register"),N("Object",Object),N("TransferableGridIndex",cr),N("Color",X),N("Error",Error),N("AJAXError",vr),N("ResolvedImage",ut),N("StylePropertyFunction",ri),N("StyleExpression",ti,{omit:["_evaluator"]}),N("ZoomDependentExpression",Ir),N("ZoomConstantExpression",Ar),N("CompoundExpression",dt,{omit:["_evaluate"]});for(let e in Qr)Qr[e]._classRegistryKey||N(`Expression_${e}`,Qr[e]);function Jh(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Zi(e,t){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob)return e;if(Jh(e)||Ft(e))return t&&t.push(e),e;if(ArrayBuffer.isView(e)){let r=e;return t&&t.push(r.buffer),r}if(e instanceof ImageData)return t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let r=[];for(let i of e)r.push(Zi(i,t));return r}if("object"==typeof e){let r=e.constructor,i=r._classRegistryKey;if(!i)throw new Error("can't serialize object of unregistered class");if(!Mr[i])throw new Error(`${i} is not registered.`);let a=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&a===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let r in e){if(!e.hasOwnProperty(r)||Mr[i].omit.indexOf(r)>=0)continue;let n=e[r];a[r]=Mr[i].shallow.indexOf(r)>=0?n:Zi(n,t)}e instanceof Error&&(a.message=e.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(a.$name=i),a}throw new Error("can't serialize object of type "+typeof e)}function Wi(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||Jh(e)||Ft(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(Wi);if("object"==typeof e){let t=e.$name||"Object";if(!Mr[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=Mr[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(e);let i=Object.create(r.prototype);for(let r of Object.keys(e)){if("$name"===r)continue;let a=e[r];i[r]=Mr[t].shallow.indexOf(r)>=0?a:Wi(a)}return i}throw new Error("can't deserialize object of type "+typeof e)}u(Jh,"isArrayBuffer"),u(Zi,"serialize"),u(Wi,"deserialize"),d(),d();var Xi=class{constructor(){this.first=!0}update(e,t){let r=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=r,!0))}};u(Xi,"ZoomHistory"),d(),d();var he={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function lc(e){for(let t of e)if(Qh(t.charCodeAt(0)))return!0;return!1}function Qh(e){return 746===e||747===e||!(e<4352)&&!(!(he["Bopomofo Extended"](e)||he.Bopomofo(e)||he["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||he["CJK Compatibility Ideographs"](e)||he["CJK Compatibility"](e)||he["CJK Radicals Supplement"](e)||he["CJK Strokes"](e)||he["CJK Symbols and Punctuation"](e)&&!(e>=12296&&e<=12305)&&!(e>=12308&&e<=12319)&&12336!==e||he["CJK Unified Ideographs Extension A"](e)||he["CJK Unified Ideographs"](e)||he["Enclosed CJK Letters and Months"](e)||he["Hangul Compatibility Jamo"](e)||he["Hangul Jamo Extended-A"](e)||he["Hangul Jamo Extended-B"](e)||he["Hangul Jamo"](e)||he["Hangul Syllables"](e)||he.Hiragana(e)||he["Ideographic Description Characters"](e)||he.Kanbun(e)||he["Kangxi Radicals"](e)||he["Katakana Phonetic Extensions"](e)||he.Katakana(e)&&12540!==e)&&(!he["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)&&(!he["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)&&!he["Unified Canadian Aboriginal Syllabics"](e)&&!he["Unified Canadian Aboriginal Syllabics Extended"](e)&&!he["Vertical Forms"](e)&&!he["Yijing Hexagram Symbols"](e)&&!he["Yi Syllables"](e)&&!he["Yi Radicals"](e))}function em(e){return e>=1424&&e<=2303||he["Arabic Presentation Forms-A"](e)||he["Arabic Presentation Forms-B"](e)}function Av(e,t){return!(!t&&em(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||he.Khmer(e))}function tm(e){for(let t of e)if(em(t.charCodeAt(0)))return!0;return!1}function rm(e,t){for(let r of e)if(!Av(r.charCodeAt(0),t))return!1;return!0}u(lc,"allowsVerticalWritingMode"),u(Qh,"charHasUprightVerticalOrientation"),u(em,"charInRTLScript"),u(Av,"charInSupportedScript"),u(tm,"stringContainsRTLText"),u(rm,"isStringInSupportedScript"),d();var Ht={unavailable:"unavailable",deferred:"deferred",loading:"loading",loaded:"loaded",error:"error"},uc=null,_t=Ht.unavailable,Er=null,cc=u((function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(_t=Ht.error),uc&&uc(e)}),"triggerPluginCompletionEvent");function pc(){Go.fire(new z("pluginStateChange",{pluginStatus:_t,pluginURL:Er}))}u(pc,"sendPluginStateToWorker");var Go=new fe,sa=u((function(){return _t}),"getRTLTextPluginStatus"),im=u((function(e){return e({pluginStatus:_t,pluginURL:Er}),Go.on("pluginStateChange",e),e}),"registerForPluginStateChange"),nm=u((function(e,t,r=!1){if(_t===Ht.deferred||_t===Ht.loading||_t===Ht.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Er=ne.resolveURL(e),_t=Ht.deferred,uc=t,pc(),r||am()}),"setRTLTextPlugin"),am=u((function(){if(_t!==Ht.deferred||!Er)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");_t=Ht.loading,pc(),Er&&Po({url:Er},(e=>{e?cc(e):(_t=Ht.loaded,pc())}))}),"downloadRTLTextPlugin"),bt={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>_t===Ht.loaded||null!=bt.applyArabicShaping,isLoading:()=>_t===Ht.loading,setState(e){if(!xt())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");_t=e.pluginStatus,Er=e.pluginURL},isParsed(){if(!xt())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=bt.applyArabicShaping&&null!=bt.processBidirectionalText&&null!=bt.processStyledBidirectionalText},getPluginURL(){if(!xt())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Er}},om=u((function(){!bt.isLoading()&&!bt.isLoaded()&&"deferred"===sa()&&am()}),"lazyLoadRTLTextPlugin"),de=class{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Xi,this.transition={})}isSupportedScript(e){return rm(e,bt.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),r=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*t}}};u(de,"EvaluationParameters");var Ki=class{constructor(e,t){this.property=e,this.value=t,this.expression=Mh(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,r){return this.property.possiblyEvaluate(this,e,t,r)}};u(Ki,"PropertyValue");var la=class{constructor(e){this.property=e,this.value=new Ki(e,void 0)}transitioned(e,t){return new jo(this.property,this.value,t,R({},e.transition,this.transition),e.now)}untransitioned(){return new jo(this.property,this.value,null,{},0)}};u(la,"TransitionablePropertyValue");var Yi=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return gt(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new la(this._values[e].property)),this._values[e].value=new Ki(this._values[e].property,null===t?void 0:gt(t))}getTransition(e){return gt(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new la(this._values[e].property)),this._values[e].transition=gt(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);void 0!==r&&(e[t]=r);let i=this.getTransition(t);void 0!==i&&(e[`${t}-transition`]=i)}return e}transitioned(e,t){let r=new Ho(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(e,t._values[i]);return r}untransitioned(){let e=new Ho(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}};u(Yi,"Transitionable");var jo=class{constructor(e,t,r,i,a){this.property=e,this.value=t,this.begin=a+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(e,t,r){let i=e.now||0,a=this.value.possiblyEvaluate(e,t,r),n=this.prior;if(n){if(i>this.end)return this.prior=null,a;if(this.value.isDataDriven())return this.prior=null,a;if(i<this.begin)return n.possiblyEvaluate(e,t,r);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(n.possiblyEvaluate(e,t,r),a,Lp(s))}}return a}};u(jo,"TransitioningPropertyValue");var Ho=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,r){let i=new kr(this._properties);for(let a of Object.keys(this._values))i._values[a]=this._values[a].possiblyEvaluate(e,t,r);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}};u(Ho,"Transitioning");var Zo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return gt(this._values[e].value)}setValue(e,t){this._values[e]=new Ki(this._values[e].property,null===t?void 0:gt(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);void 0!==r&&(e[t]=r)}return e}possiblyEvaluate(e,t,r){let i=new kr(this._properties);for(let a of Object.keys(this._values))i._values[a]=this._values[a].possiblyEvaluate(e,t,r);return i}};u(Zo,"Layout");var pt=class{constructor(e,t,r){this.property=e,this.value=t,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,r,i){return this.property.evaluate(this.value,this.parameters,e,t,r,i)}};u(pt,"PossiblyEvaluatedPropertyValue");var kr=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}};u(kr,"PossiblyEvaluated");var H=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,r){let i=this.specification.type,a=Le[i];return a?a(e,t,r):e}};u(H,"DataConstantProperty");var W=class{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,r,i){return"constant"===e.expression.kind||"camera"===e.expression.kind?new pt(this,{kind:"constant",value:e.expression.evaluate(t,null,{},r,i)},t):new pt(this,e.expression,t)}interpolate(e,t,r){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new pt(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,a=Le[i];if(a){let i=a(e.value.value,t.value.value,r);return new pt(this,{kind:"constant",value:i},e.parameters)}return e}evaluate(e,t,r,i,a,n){return"constant"===e.kind?e.value:e.evaluate(t,r,i,a,n)}};u(W,"DataDrivenProperty");var pr=class extends W{possiblyEvaluate(e,t,r,i){if(void 0===e.value)return new pt(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){let a=e.expression.evaluate(t,null,{},r,i),n="resolvedImage"===e.property.specification.type&&"string"!=typeof a?a.name:a,s=this._calculate(n,n,n,t);return new pt(this,{kind:"constant",value:s},t)}if("camera"===e.expression.kind){let r=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new pt(this,{kind:"constant",value:r},t)}return new pt(this,e.expression,t)}evaluate(e,t,r,i,a,n){if("source"===e.kind){let s=e.evaluate(t,r,i,a,n);return this._calculate(s,s,s,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},r,i),e.evaluate({zoom:Math.floor(t.zoom)},r,i),e.evaluate({zoom:Math.floor(t.zoom)+1},r,i),t):e.value}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}};u(pr,"CrossFadedDataDrivenProperty");var ai=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,r,i){if(void 0!==e.value){if("constant"===e.expression.kind){let a=e.expression.evaluate(t,null,{},r,i);return this._calculate(a,a,a,t)}return this._calculate(e.expression.evaluate(new de(Math.floor(t.zoom-1),t)),e.expression.evaluate(new de(Math.floor(t.zoom),t)),e.expression.evaluate(new de(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}};u(ai,"CrossFadedProperty");var oi=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,r,i){return!!e.expression.evaluate(t,null,{},r,i)}interpolate(){return!1}};u(oi,"ColorRampProperty");var Ve=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let r=e[t];r.specification.overridable&&this.overridableProperties.push(t);let i=this.defaultPropertyValues[t]=new Ki(r,void 0),a=this.defaultTransitionablePropertyValues[t]=new la(r);this.defaultTransitioningPropertyValues[t]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=i.possiblyEvaluate({})}}};u(Ve,"Properties"),N("DataDrivenProperty",W),N("DataConstantProperty",H),N("CrossFadedDataDrivenProperty",pr),N("CrossFadedProperty",ai),N("ColorRampProperty",oi);var Wo="-transition",Ze=class extends fe{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new Zo(t.layout)),t.paint)){this._transitionablePaint=new Yi(t.paint);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new kr(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,r={}){if(null!=t){let i=`layers.${this.id}.layout.${e}`;if(this._validate(Yh,i,e,t,r))return}"visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t}getPaintProperty(e){return e.endsWith(Wo)?this._transitionablePaint.getTransition(e.slice(0,-Wo.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,r={}){if(null!=t){let i=`layers.${this.id}.paint.${e}`;if(this._validate(Kh,i,e,t,r))return!1}if(e.endsWith(Wo))return this._transitionablePaint.setTransition(e.slice(0,-Wo.length),t||void 0),!1;{let r=this._transitionablePaint._values[e],i="cross-faded-data-driven"===r.property.specification["property-type"],a=r.value.isDataDriven(),n=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let s=this._transitionablePaint._values[e].value;return s.isDataDriven()||a||i||this._handleOverridablePaintPropertyUpdate(e,n,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,r){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),vo(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,r,i,a={}){return(!a||!1!==a.validate)&&Hi(this,e.call(He,{key:t,layerType:this.type,objectKey:r,value:i,styleSpec:C,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(t instanceof pt&&Tr(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}};u(Ze,"StyleLayer"),d(),d(),d();var Iv={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},si=class{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}};u(si,"Struct");var Cv=128,Mv=5,Ne=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*Mv),Cv),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function ve(e,t=1){let r=0,i=0;return{members:e.map((e=>{let a=Ev(e.type),n=r=sm(r,Math.max(t,a)),s=e.components||1;return i=Math.max(i,a),r+=a*s,{name:e.name,type:e.type,components:s,offset:n}})),size:sm(r,Math.max(i,t)),alignment:t}}function Ev(e){return Iv[e].BYTES_PER_ELEMENT}function sm(e,t){return Math.ceil(e/t)*t}u(Ne,"StructArray"),u(ve,"createLayout"),u(Ev,"sizeOf"),u(sm,"align");var lm=ae(Pe()),li=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=2*e;return this.int16[i+0]=t,this.int16[i+1]=r,e}};u(li,"StructArrayLayout2i4"),li.prototype.bytesPerElement=4,N("StructArrayLayout2i4",li);var Ji=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=3*e;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=i,e}};u(Ji,"StructArrayLayout3i6"),Ji.prototype.bytesPerElement=6,N("StructArrayLayout3i6",Ji);var ua=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i)}emplace(e,t,r,i,a){let n=4*e;return this.int16[n+0]=t,this.int16[n+1]=r,this.int16[n+2]=i,this.int16[n+3]=a,e}};u(ua,"StructArrayLayout4i8"),ua.prototype.bytesPerElement=8,N("StructArrayLayout4i8",ua);var ca=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,a,n)}emplace(e,t,r,i,a,n,s){let o=6*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=a,this.int16[o+4]=n,this.int16[o+5]=s,e}};u(ca,"StructArrayLayout2i4i12"),ca.prototype.bytesPerElement=12,N("StructArrayLayout2i4i12",ca);var pa=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,a,n)}emplace(e,t,r,i,a,n,s){let o=4*e,l=8*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=a,this.uint8[l+6]=n,this.uint8[l+7]=s,e}};u(pa,"StructArrayLayout2i4ub8"),pa.prototype.bytesPerElement=8,N("StructArrayLayout2i4ub8",pa);var Lr=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=2*e;return this.float32[i+0]=t,this.float32[i+1]=r,e}};u(Lr,"StructArrayLayout2f8"),Lr.prototype.bytesPerElement=8,N("StructArrayLayout2f8",Lr);var ha=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,r,i,a,n,s,o,l,u)}emplace(e,t,r,i,a,n,s,o,l,u,h){let c=10*e;return this.uint16[c+0]=t,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=a,this.uint16[c+4]=n,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,e}};u(ha,"StructArrayLayout10ui20"),ha.prototype.bytesPerElement=20,N("StructArrayLayout10ui20",ha);var ma=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u,h,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,r,i,a,n,s,o,l,u,h,c)}emplace(e,t,r,i,a,n,s,o,l,u,h,c,p){let d=12*e;return this.int16[d+0]=t,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=a,this.uint16[d+4]=n,this.uint16[d+5]=s,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,e}};u(ma,"StructArrayLayout4i4ui4i24"),ma.prototype.bytesPerElement=24,N("StructArrayLayout4i4ui4i24",ma);var fa=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=3*e;return this.float32[a+0]=t,this.float32[a+1]=r,this.float32[a+2]=i,e}};u(fa,"StructArrayLayout3f12"),fa.prototype.bytesPerElement=12,N("StructArrayLayout3f12",fa);var da=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.uint32[r+0]=t,e}};u(da,"StructArrayLayout1ul4"),da.prototype.bytesPerElement=4,N("StructArrayLayout1ul4",da);var ya=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,r,i,a,n,s,o,l)}emplace(e,t,r,i,a,n,s,o,l,u){let h=10*e,c=5*e;return this.int16[h+0]=t,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=a,this.int16[h+4]=n,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,e}};u(ya,"StructArrayLayout6i1ul2ui20"),ya.prototype.bytesPerElement=20,N("StructArrayLayout6i1ul2ui20",ya);var ga=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,a,n)}emplace(e,t,r,i,a,n,s){let o=6*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=a,this.int16[o+4]=n,this.int16[o+5]=s,e}};u(ga,"StructArrayLayout2i2i2i12"),ga.prototype.bytesPerElement=12,N("StructArrayLayout2i2i2i12",ga);var xa=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i,a)}emplace(e,t,r,i,a,n){let s=4*e,o=8*e;return this.float32[s+0]=t,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=a,this.int16[o+7]=n,e}};u(xa,"StructArrayLayout2f1f2i16"),xa.prototype.bytesPerElement=16,N("StructArrayLayout2f1f2i16",xa);var _a=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i)}emplace(e,t,r,i,a){let n=12*e,s=3*e;return this.uint8[n+0]=t,this.uint8[n+1]=r,this.float32[s+1]=i,this.float32[s+2]=a,e}};u(_a,"StructArrayLayout2ub2f12"),_a.prototype.bytesPerElement=12,N("StructArrayLayout2ub2f12",_a);var Qi=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=3*e;return this.uint16[a+0]=t,this.uint16[a+1]=r,this.uint16[a+2]=i,e}};u(Qi,"StructArrayLayout3ui6"),Qi.prototype.bytesPerElement=6,N("StructArrayLayout3ui6",Qi);var ba=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,y){let g=this.length;return this.resize(g+1),this.emplace(g,e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,y)}emplace(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,y,g){let _=24*e,x=12*e,v=48*e;return this.int16[_+0]=t,this.int16[_+1]=r,this.uint16[_+2]=i,this.uint16[_+3]=a,this.uint32[x+2]=n,this.uint32[x+3]=s,this.uint32[x+4]=o,this.uint16[_+10]=l,this.uint16[_+11]=u,this.uint16[_+12]=h,this.float32[x+7]=c,this.float32[x+8]=p,this.uint8[v+36]=d,this.uint8[v+37]=f,this.uint8[v+38]=m,this.uint32[x+10]=y,this.int16[_+22]=g,e}};u(ba,"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48"),ba.prototype.bytesPerElement=48,N("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ba);var va=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,y,g,_,x,v,b,w,S,A,I,M,T){let C=this.length;return this.resize(C+1),this.emplace(C,e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,y,g,_,x,v,b,w,S,A,I,M,T)}emplace(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,y,g,_,x,v,b,w,S,A,I,M,T,C){let P=34*e,k=17*e;return this.int16[P+0]=t,this.int16[P+1]=r,this.int16[P+2]=i,this.int16[P+3]=a,this.int16[P+4]=n,this.int16[P+5]=s,this.int16[P+6]=o,this.int16[P+7]=l,this.uint16[P+8]=u,this.uint16[P+9]=h,this.uint16[P+10]=c,this.uint16[P+11]=p,this.uint16[P+12]=d,this.uint16[P+13]=f,this.uint16[P+14]=m,this.uint16[P+15]=y,this.uint16[P+16]=g,this.uint16[P+17]=_,this.uint16[P+18]=x,this.uint16[P+19]=v,this.uint16[P+20]=b,this.uint16[P+21]=w,this.uint16[P+22]=S,this.uint32[k+12]=A,this.float32[k+13]=I,this.float32[k+14]=M,this.float32[k+15]=T,this.float32[k+16]=C,e}};u(va,"StructArrayLayout8i15ui1ul4f68"),va.prototype.bytesPerElement=68,N("StructArrayLayout8i15ui1ul4f68",va);var ui=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.float32[r+0]=t,e}};u(ui,"StructArrayLayout1f4"),ui.prototype.bytesPerElement=4,N("StructArrayLayout1f4",ui);var wa=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=2*e,n=4*e;return this.uint32[a+0]=t,this.uint16[n+2]=r,this.uint16[n+3]=i,e}};u(wa,"StructArrayLayout1ul2ui8"),wa.prototype.bytesPerElement=8,N("StructArrayLayout1ul2ui8",wa);var Sa=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=2*e;return this.uint16[i+0]=t,this.uint16[i+1]=r,e}};u(Sa,"StructArrayLayout2ui4"),Sa.prototype.bytesPerElement=4,N("StructArrayLayout2ui4",Sa);var Pa=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.uint16[r+0]=t,e}};u(Pa,"StructArrayLayout1ui2"),Pa.prototype.bytesPerElement=2,N("StructArrayLayout1ui2",Pa);var en=class extends Ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i)}emplace(e,t,r,i,a){let n=4*e;return this.float32[n+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,this.float32[n+3]=a,e}};u(en,"StructArrayLayout4f16"),en.prototype.bytesPerElement=16,N("StructArrayLayout4f16",en);var Xo=class extends si{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new lm.default(this.anchorPointX,this.anchorPointY)}};u(Xo,"CollisionBoxStruct"),Xo.prototype.size=20;var Ta=class extends ya{get(e){return new Xo(this,e)}};u(Ta,"CollisionBoxArray"),N("CollisionBoxArray",Ta);var Ko=class extends si{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};u(Ko,"PlacedSymbolStruct"),Ko.prototype.size=48;var Aa=class extends ba{get(e){return new Ko(this,e)}};u(Aa,"PlacedSymbolArray"),N("PlacedSymbolArray",Aa);var Yo=class extends si{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}};u(Yo,"SymbolInstanceStruct"),Yo.prototype.size=68;var Ia=class extends va{get(e){return new Yo(this,e)}};u(Ia,"SymbolInstanceArray"),N("SymbolInstanceArray",Ia);var Ca=class extends ui{getoffsetX(e){return this.float32[1*e+0]}};u(Ca,"GlyphOffsetArray"),N("GlyphOffsetArray",Ca);var Ma=class extends Ji{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}};u(Ma,"SymbolLineVertexArray"),N("SymbolLineVertexArray",Ma);var Jo=class extends si{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};u(Jo,"FeatureIndexStruct"),Jo.prototype.size=8;var Ea=class extends wa{get(e){return new Jo(this,e)}};u(Ea,"FeatureIndexArray"),N("FeatureIndexArray",Ea);var Dr=class extends li{};u(Dr,"PosArray");var Qo=class extends Ji{};u(Qo,"Pos3dArray");var tn=class extends ua{};u(tn,"RasterBoundsArray");var es=class extends li{};u(es,"CircleLayoutArray");var ts=class extends li{};u(ts,"FillLayoutArray");var rs=class extends ca{};u(rs,"FillExtrusionLayoutArray");var is=class extends pa{};u(is,"LineLayoutArray");var ns=class extends Lr{};u(ns,"LineExtLayoutArray");var hr=class extends ha{};u(hr,"PatternLayoutArray");var as=class extends ma{};u(as,"SymbolLayoutArray");var os=class extends fa{};u(os,"SymbolDynamicLayoutArray");var ss=class extends da{};u(ss,"SymbolOpacityArray");var ka=class extends ga{};u(ka,"CollisionBoxLayoutArray");var ls=class extends xa{};u(ls,"CollisionCircleLayoutArray");var us=class extends _a{};u(us,"CollisionVertexArray");var cs=class extends Qi{};u(cs,"QuadTriangleArray");var lt=class extends Qi{};u(lt,"TriangleIndexArray");var zr=class extends Sa{};u(zr,"LineIndexArray");var La=class extends Pa{};u(La,"LineStripIndexArray"),d();var kv=ve([{name:"a_pos",components:2,type:"Int16"}],4),{members:um,size:NA,alignment:qA}=kv;d();var le=class{constructor(e=[]){this.segments=e}prepareSegment(e,t,r,i){let a=this.segments[this.segments.length-1];return e>le.MAX_VERTEX_ARRAY_LENGTH&&Me(`Max vertices per segment is ${le.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!a||a.vertexLength+e>le.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==i)&&(a={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==i&&(a.sortKey=i),this.segments.push(a)),a}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,r,i){return new le([{vertexOffset:e,primitiveOffset:t,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])}};function hc(e,t){return 256*(e=Te(Math.floor(e),0,255))+(t=Te(Math.floor(t),0,255))}u(le,"SegmentVector"),le.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,N("SegmentVector",le),d(),d(),u(hc,"packUint8ToFloat"),d();var Da=ve([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);d();var mm=ae(dc()),ci=class{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,r,i){this.ids.push(fm(e)),this.positions.push(t,r,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let t=fm(e),r=0,i=this.ids.length-1;for(;r<i;){let e=r+i>>1;this.ids[e]>=t?i=e:r=e+1}let a=[];for(;this.ids[r]===t;){let e=this.positions[3*r],t=this.positions[3*r+1],i=this.positions[3*r+2];a.push({index:e,start:t,end:i}),r++}return a}static serialize(e,t){let r=new Float64Array(e.ids),i=new Uint32Array(e.positions);return yc(r,i,0,r.length-1),t&&t.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(e){let t=new ci;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}};function fm(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,mm.default)(String(e))}function yc(e,t,r,i){for(;r<i;){let a=e[r+i>>1],n=r-1,s=i+1;for(;;){do{n++}while(e[n]<a);do{s--}while(e[s]>a);if(n>=s)break;hs(e,n,s),hs(t,3*n,3*s),hs(t,3*n+1,3*s+1),hs(t,3*n+2,3*s+2)}s-r<i-s?(yc(e,t,r,s),r=s+1):(yc(e,t,s+1,i),i=s)}}function hs(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}u(ci,"FeaturePositionMap"),u(fm,"getNumericId"),u(yc,"sort"),u(hs,"swap"),N("FeaturePositionMap",ci),d();var mr=class{constructor(e,t){this.gl=e.gl,this.location=t}};u(mr,"Uniform");var Y=class extends mr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}};u(Y,"Uniform1i");var V=class extends mr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};u(V,"Uniform1f");var ee=class extends mr{constructor(e,t){super(e,t),this.current=[0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1])&&(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}};u(ee,"Uniform2f");var yt=class extends mr{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2])&&(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}};u(yt,"Uniform3f");var Fr=class extends mr{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}};u(Fr,"Uniform4f");var Ut=class extends mr{constructor(e,t){super(e,t),this.current=X.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}};u(Ut,"UniformColor");var Fv=new Float32Array(16),te=class extends mr{constructor(e,t){super(e,t),this.current=Fv}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};function gc(e){return[hc(255*e.r,255*e.g),hc(255*e.b,255*e.a)]}u(te,"UniformMatrix4f"),u(gc,"packColor");var pi=class{constructor(e,t,r){this.value=e,this.uniformNames=t.map((e=>`u_${e}`)),this.type=r}setUniform(e,t,r){e.set(r.constantOr(this.value))}getBinding(e,t,r){return"color"===this.type?new Ut(e,t):new V(e,t)}};u(pi,"ConstantBinder");var Br=class{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,r,i){let a="u_pattern_to"===i?this.patternTo:"u_pattern_from"===i?this.patternFrom:"u_pixel_ratio_to"===i?this.pixelRatioTo:"u_pixel_ratio_from"===i?this.pixelRatioFrom:null;a&&e.set(a)}getBinding(e,t,r){return"u_pattern"===r.substr(0,9)?new Fr(e,t):new V(e,t)}};u(Br,"CrossFadedConstantBinder");var Zt=class{constructor(e,t,r,i){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new i}populatePaintArray(e,t,r,i,a){let n=this.paintVertexArray.length,s=this.expression.evaluate(new de(0),t,{},i,[],a);this.paintVertexArray.resize(e),this._setPaintValue(n,e,s)}updatePaintArray(e,t,r,i){let a=this.expression.evaluate({zoom:0},r,i);this._setPaintValue(e,t,a)}_setPaintValue(e,t,r){if("color"===this.type){let i=gc(r);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i[0],i[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}};u(Zt,"SourceExpressionBinder");var kt=class{constructor(e,t,r,i,a,n){this.expression=e,this.uniformNames=t.map((e=>`u_${e}_t`)),this.type=r,this.useIntegerZoom=i,this.zoom=a,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new n}populatePaintArray(e,t,r,i,a){let n=this.expression.evaluate(new de(this.zoom),t,{},i,[],a),s=this.expression.evaluate(new de(this.zoom+1),t,{},i,[],a),o=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(o,e,n,s)}updatePaintArray(e,t,r,i){let a=this.expression.evaluate({zoom:this.zoom},r,i),n=this.expression.evaluate({zoom:this.zoom+1},r,i);this._setPaintValue(e,t,a,n)}_setPaintValue(e,t,r,i){if("color"===this.type){let a=gc(r),n=gc(i);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,a[0],a[1],n[0],n[1])}else{for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let r=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,i=Te(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,t,r){return new V(e,t)}};u(kt,"CompositeExpressionBinder");var Yt=class{constructor(e,t,r,i,a,n){this.expression=e,this.type=t,this.useIntegerZoom=r,this.zoom=i,this.layerId=n,this.zoomInPaintVertexArray=new a,this.zoomOutPaintVertexArray=new a}populatePaintArray(e,t,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,t.patterns&&t.patterns[this.layerId],r)}updatePaintArray(e,t,r,i,a){this._setPaintValues(e,t,r.patterns&&r.patterns[this.layerId],a)}_setPaintValues(e,t,r,i){if(!i||!r)return;let{min:a,mid:n,max:s}=r,o=i[a],l=i[n],u=i[s];if(o&&l&&u)for(let r=e;r<t;r++)this.zoomInPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],o.tl[0],o.tl[1],o.br[0],o.br[1],l.pixelRatio,o.pixelRatio),this.zoomOutPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Da.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Da.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}};u(Yt,"CrossFadedCompositeBinder");var ms=class{constructor(e,t,r){this.binders={},this._buffers=[];let i=[];for(let a in e.paint._values){if(!r(a))continue;let n=e.paint.get(a);if(!(n instanceof pt&&Tr(n.property.specification)))continue;let s=Bv(a,e.type),o=n.value,l=n.property.specification.type,u=n.property.useIntegerZoom,h=n.property.specification["property-type"],c="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===o.kind)this.binders[a]=c?new Br(o.value,s):new pi(o.value,s,l),i.push(`/u_${a}`);else if("source"===o.kind||c){let r=dm(a,l,"source");this.binders[a]=c?new Yt(o,l,u,t,r,e.id):new Zt(o,s,l,r),i.push(`/a_${a}`)}else{let e=dm(a,l,"composite");this.binders[a]=new kt(o,s,l,u,t,e),i.push(`/z_${a}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Zt||t instanceof kt?t.maxValue:0}populatePaintArrays(e,t,r,i,a){for(let n in this.binders){let s=this.binders[n];(s instanceof Zt||s instanceof kt||s instanceof Yt)&&s.populatePaintArray(e,t,r,i,a)}}setConstantPatternPositions(e,t){for(let r in this.binders){let i=this.binders[r];i instanceof Br&&i.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,r,i,a){let n=!1;for(let s in e){let o=t.getPositions(s);for(let t of o){let o=r.feature(t.index);for(let r in this.binders){let l=this.binders[r];if((l instanceof Zt||l instanceof kt||l instanceof Yt)&&!0===l.expression.isStateDependent){let u=i.paint.get(r);l.expression=u.value,l.updatePaintArray(t.start,t.end,o,e[s],a),n=!0}}}}return n}defines(){let e=[];for(let t in this.binders){let r=this.binders[t];(r instanceof pi||r instanceof Br)&&e.push(...r.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof Zt||r instanceof kt)for(let t=0;t<r.paintVertexAttributes.length;t++)e.push(r.paintVertexAttributes[t].name);else if(r instanceof Yt)for(let t=0;t<Da.members.length;t++)e.push(Da.members[t].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof pi||r instanceof Br||r instanceof kt)for(let t of r.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let r=[];for(let i in this.binders){let a=this.binders[i];if(a instanceof pi||a instanceof Br||a instanceof kt)for(let n of a.uniformNames)if(t[n]){let s=a.getBinding(e,t[n],n);r.push({name:n,property:i,binding:s})}}return r}setUniforms(e,t,r,i){for(let{name:e,property:a,binding:n}of t)this.binders[a].setUniform(n,i,r.get(a),e)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let r=this.binders[t];if(e&&r instanceof Yt){let t=2===e.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(r instanceof Zt||r instanceof kt)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(e){for(let t in this.binders){let r=this.binders[t];(r instanceof Zt||r instanceof kt||r instanceof Yt)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Zt||t instanceof kt||t instanceof Yt)&&t.destroy()}}};u(ms,"ProgramConfiguration");var vt=class{constructor(e,t,r=(()=>!0)){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new ms(i,t,r);this.needsUpload=!1,this._featureMap=new ci,this._bufferOffset=0}populatePaintArrays(e,t,r,i,a,n){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,t,i,a,n);void 0!==t.id&&this._featureMap.add(t.id,r,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,r,i){for(let a of r)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(e,this._featureMap,t,a,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function Bv(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function Rv(e){return{"line-pattern":{source:hr,composite:hr},"fill-pattern":{source:hr,composite:hr},"fill-extrusion-pattern":{source:hr,composite:hr}}[e]}function dm(e,t,r){let i={color:{source:Lr,composite:en},number:{source:ui,composite:Lr}},a=Rv(e);return a&&a[r]||i[t][r]}u(vt,"ProgramConfigurationSet"),u(Bv,"paintAttributeNames"),u(Rv,"getLayoutException"),u(dm,"layoutType"),N("ConstantBinder",pi),N("CrossFadedConstantBinder",Br),N("SourceExpressionBinder",Zt),N("CrossFadedCompositeBinder",Yt),N("CompositeExpressionBinder",kt),N("ProgramConfiguration",ms,{omit:["_buffers"]}),N("ProgramConfigurationSet",vt),d(),d(),d();var O=8192,Ov=15,xc=Math.pow(2,Ov-1)-1,ym=-xc-1;function wt(e){let t=O/e.extent,r=e.loadGeometry();for(let e=0;e<r.length;e++){let i=r[e];for(let e=0;e<i.length;e++){let r=i[e],a=Math.round(r.x*t),n=Math.round(r.y*t);r.x=Te(a,ym,xc),r.y=Te(n,ym,xc),(a<r.x||a>r.x+1||n<r.y||n>r.y+1)&&Me("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function St(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?wt(e):[]}}function fs(e,t,r,i,a){e.emplaceBack(2*t+(i+1)/2,2*r+(a+1)/2)}u(wt,"loadGeometry"),d(),u(St,"toEvaluationFeature"),u(fs,"addCircleVertex");var hi=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new es,this.indexArray=new lt,this.segments=new le,this.programConfigurations=new vt(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,r){let i=this.layers[0],a=[],n=null,s=!1;"circle"===i.type&&(n=i.layout.get("circle-sort-key"),s=!n.isConstant());for(let{feature:t,id:i,index:o,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,u=St(t,e);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),u,r))continue;let h=s?n.evaluate(u,{},r):void 0,c={id:i,properties:t.properties,type:t.type,sourceLayerIndex:l,index:o,geometry:e?u.geometry:wt(t),patterns:{},sortKey:h};a.push(c)}s&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let i of a){let{geometry:a,index:n,sourceLayerIndex:s}=i,o=e[n].feature;this.addFeature(i,a,n,r),t.featureIndex.insert(o,a,n,s,this.index)}}update(e,t,r){!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,um),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,r,i){for(let r of t)for(let t of r){let r=t.x,i=t.y;if(r<0||r>=O||i<0||i>=O)continue;let a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),n=a.vertexLength;fs(this.layoutVertexArray,r,i,-1,-1),fs(this.layoutVertexArray,r,i,1,-1),fs(this.layoutVertexArray,r,i,1,1),fs(this.layoutVertexArray,r,i,-1,1),this.indexArray.emplaceBack(n,n+1,n+2),this.indexArray.emplaceBack(n,n+3,n+2),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{},i)}};u(hi,"CircleBucket"),N("CircleBucket",hi,{omit:["layers"]}),d();var za=ae(Pe());function ds(e,t){for(let r=0;r<e.length;r++)if(rn(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(rn(e,t[r]))return!0;return!!_c(e,t)}function gm(e,t,r){return!(!rn(e,t)&&!bc(t,e,r))}function ys(e,t){if(1===e.length)return bm(t,e[0]);for(let r=0;r<t.length;r++){let i=t[r];for(let t=0;t<i.length;t++)if(rn(e,i[t]))return!0}for(let r=0;r<e.length;r++)if(bm(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(_c(e,t[r]))return!0;return!1}function xm(e,t,r){for(let i=0;i<t.length;i++){let a=t[i];if(e.length>=3)for(let t=0;t<a.length;t++)if(rn(e,a[t]))return!0;if(Vv(e,a,r))return!0}return!1}function Vv(e,t,r){if(e.length>1){if(_c(e,t))return!0;for(let i=0;i<t.length;i++)if(bc(t[i],e,r))return!0}for(let i=0;i<e.length;i++)if(bc(e[i],t,r))return!0;return!1}function _c(e,t){if(0===e.length||0===t.length)return!1;for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1];for(let e=0;e<t.length-1;e++){if(Uv(i,a,t[e],t[e+1]))return!0}}return!1}function Uv(e,t,r,i){return or(e,r,i)!==or(t,r,i)&&or(e,t,r)!==or(e,t,i)}function bc(e,t,r){let i=r*r;if(1===t.length)return e.distSqr(t[0])<i;for(let r=1;r<t.length;r++){if(_m(e,t[r-1],t[r])<i)return!0}return!1}function _m(e,t,r){let i=t.distSqr(r);if(0===i)return e.distSqr(t);let a=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/i;return a<0?e.distSqr(t):a>1?e.distSqr(r):e.distSqr(r.sub(t)._mult(a)._add(t))}function bm(e,t){let r,i,a,n=!1;for(let s=0;s<e.length;s++){r=e[s];for(let e=0,s=r.length-1;e<r.length;s=e++)i=r[e],a=r[s],i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function rn(e,t){let r=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let n=e[i],s=e[a];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(r=!r)}return r}function vm(e,t,r,i,a){for(let n of e)if(t<=n.x&&r<=n.y&&i>=n.x&&a>=n.y)return!0;let n=[new za.default(t,r),new za.default(t,a),new za.default(i,a),new za.default(i,r)];if(e.length>2)for(let t of n)if(rn(e,t))return!0;for(let t=0;t<e.length-1;t++){if(Nv(e[t],e[t+1],n))return!0}return!1}function Nv(e,t,r){let i=r[0],a=r[2];if(e.x<i.x&&t.x<i.x||e.x>a.x&&t.x>a.x||e.y<i.y&&t.y<i.y||e.y>a.y&&t.y>a.y)return!1;let n=or(e,t,r[0]);return n!==or(e,t,r[1])||n!==or(e,t,r[2])||n!==or(e,t,r[3])}u(ds,"polygonIntersectsPolygon"),u(gm,"polygonIntersectsBufferedPoint"),u(ys,"polygonIntersectsMultiPolygon"),u(xm,"polygonIntersectsBufferedMultiLine"),u(Vv,"lineIntersectsBufferedLine"),u(_c,"lineIntersectsLine"),u(Uv,"lineSegmentIntersectsLineSegment"),u(bc,"pointIntersectsBufferedLine"),u(_m,"distToSegmentSquared"),u(bm,"multiPolygonContainsPoint"),u(rn,"polygonContainsPoint"),u(vm,"polygonIntersectsBox"),u(Nv,"edgeIntersectsBox"),d();var gs=ae(Pe());function mi(e,t,r){let i=t.paint.get(e).value;return"constant"===i.kind?i.value:r.programConfigurations.get(t.id).getMaxValue(e)}function Rr(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Or(e,t,r,i,a){if(!t[0]&&!t[1])return e;let n=gs.default.convert(t)._mult(a);"viewport"===r&&n._rotate(-i);let s=[];for(let t=0;t<e.length;t++){let r=e[t];s.push(r.sub(n))}return s}function wm(e,t){let r=[];for(let i=0;i<e.length;i++){let a=e[i],n=[];for(let e=0;e<a.length;e++){let r=a[e-1],i=a[e],s=a[e+1],o=0===e?new gs.default(0,0):i.sub(r)._unit()._perp(),l=e===a.length-1?new gs.default(0,0):s.sub(i)._unit()._perp(),u=o._add(l)._unit(),h=u.x*l.x+u.y*l.y;0!==h&&u._mult(1/h),n.push(u._mult(t)._add(i))}r.push(n)}return r}u(mi,"getMaximumPaintValue"),u(Rr,"translateDistance"),u(Or,"translate"),u(wm,"offsetLine"),d();var Sm,Pm,qv=u((()=>Sm=Sm||new Ve({"circle-sort-key":new W(C.layout_circle["circle-sort-key"])})),"getLayout"),$v=u((()=>Pm=Pm||new Ve({"circle-radius":new W(C.paint_circle["circle-radius"]),"circle-color":new W(C.paint_circle["circle-color"]),"circle-blur":new W(C.paint_circle["circle-blur"]),"circle-opacity":new W(C.paint_circle["circle-opacity"]),"circle-translate":new H(C.paint_circle["circle-translate"]),"circle-translate-anchor":new H(C.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new H(C.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new H(C.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new W(C.paint_circle["circle-stroke-width"]),"circle-stroke-color":new W(C.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new W(C.paint_circle["circle-stroke-opacity"])})),"getPaint"),Tm={get paint(){return $v()},get layout(){return qv()}};d(),d();var ie=1e-6,we="undefined"!=typeof Float32Array?Float32Array:Array,Jt=Math.random,ZI=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Fa={};function Gv(){var e=new we(4);return we!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function jv(e){var t=new we(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Hv(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Zv(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function Wv(e,t,r,i){var a=new we(4);return a[0]=e,a[1]=t,a[2]=r,a[3]=i,a}function Xv(e,t,r,i,a){return e[0]=t,e[1]=r,e[2]=i,e[3]=a,e}function Kv(e,t){if(e===t){var r=t[1];e[1]=t[2],e[2]=r}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function Yv(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r*n-a*i;return s?(s=1/s,e[0]=n*s,e[1]=-i*s,e[2]=-a*s,e[3]=r*s,e):null}function Jv(e,t){var r=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=r,e}function Qv(e){return e[0]*e[3]-e[2]*e[1]}function Am(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=r[0],l=r[1],u=r[2],h=r[3];return e[0]=i*o+n*l,e[1]=a*o+s*l,e[2]=i*u+n*h,e[3]=a*u+s*h,e}function e0(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*o,e[1]=a*l+s*o,e[2]=i*-o+n*l,e[3]=a*-o+s*l,e}function t0(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=r[0],l=r[1];return e[0]=i*o,e[1]=a*o,e[2]=n*l,e[3]=s*l,e}function r0(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=-r,e[3]=i,e}function i0(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function n0(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function a0(e){return Math.hypot(e[0],e[1],e[2],e[3])}function o0(e,t,r,i){return e[2]=i[2]/i[0],r[0]=i[0],r[1]=i[1],r[3]=i[3]-e[2]*r[1],[e,t,r]}function s0(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function Im(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function l0(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function u0(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=t[0],o=t[1],l=t[2],u=t[3];return Math.abs(r-s)<=ie*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-o)<=ie*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-l)<=ie*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-u)<=ie*Math.max(1,Math.abs(n),Math.abs(u))}function c0(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function p0(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e}Ii(Fa,{LDU:()=>o0,add:()=>s0,adjoint:()=>Jv,clone:()=>jv,copy:()=>Hv,create:()=>Gv,determinant:()=>Qv,equals:()=>u0,exactEquals:()=>l0,frob:()=>a0,fromRotation:()=>r0,fromScaling:()=>i0,fromValues:()=>Wv,identity:()=>Zv,invert:()=>Yv,mul:()=>h0,multiply:()=>Am,multiplyScalar:()=>c0,multiplyScalarAndAdd:()=>p0,rotate:()=>e0,scale:()=>t0,set:()=>Xv,str:()=>n0,sub:()=>m0,subtract:()=>Im,transpose:()=>Kv}),d(),u(Gv,"create"),u(jv,"clone"),u(Hv,"copy"),u(Zv,"identity"),u(Wv,"fromValues"),u(Xv,"set"),u(Kv,"transpose"),u(Yv,"invert"),u(Jv,"adjoint"),u(Qv,"determinant"),u(Am,"multiply"),u(e0,"rotate"),u(t0,"scale"),u(r0,"fromRotation"),u(i0,"fromScaling"),u(n0,"str"),u(a0,"frob"),u(o0,"LDU"),u(s0,"add"),u(Im,"subtract"),u(l0,"exactEquals"),u(u0,"equals"),u(c0,"multiplyScalar"),u(p0,"multiplyScalarAndAdd");var h0=Am,m0=Im,Ba={};function f0(){var e=new we(9);return we!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function d0(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function y0(e){var t=new we(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function g0(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function x0(e,t,r,i,a,n,s,o,l){var u=new we(9);return u[0]=e,u[1]=t,u[2]=r,u[3]=i,u[4]=a,u[5]=n,u[6]=s,u[7]=o,u[8]=l,u}function _0(e,t,r,i,a,n,s,o,l,u){return e[0]=t,e[1]=r,e[2]=i,e[3]=a,e[4]=n,e[5]=s,e[6]=o,e[7]=l,e[8]=u,e}function b0(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function v0(e,t){if(e===t){var r=t[1],i=t[2],a=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=a}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function w0(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],h=t[8],c=h*s-o*u,p=-h*n+o*l,d=u*n-s*l,f=r*c+i*p+a*d;return f?(f=1/f,e[0]=c*f,e[1]=(-h*i+a*u)*f,e[2]=(o*i-a*s)*f,e[3]=p*f,e[4]=(h*r-a*l)*f,e[5]=(-o*r+a*n)*f,e[6]=d*f,e[7]=(-u*r+i*l)*f,e[8]=(s*r-i*n)*f,e):null}function S0(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],h=t[8];return e[0]=s*h-o*u,e[1]=a*u-i*h,e[2]=i*o-a*s,e[3]=o*l-n*h,e[4]=r*h-a*l,e[5]=a*n-r*o,e[6]=n*u-s*l,e[7]=i*l-r*u,e[8]=r*s-i*n,e}function P0(e){var t=e[0],r=e[1],i=e[2],a=e[3],n=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*(u*n-s*l)+r*(-u*a+s*o)+i*(l*a-n*o)}function Cm(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=r[0],d=r[1],f=r[2],m=r[3],y=r[4],g=r[5],_=r[6],x=r[7],v=r[8];return e[0]=p*i+d*s+f*u,e[1]=p*a+d*o+f*h,e[2]=p*n+d*l+f*c,e[3]=m*i+y*s+g*u,e[4]=m*a+y*o+g*h,e[5]=m*n+y*l+g*c,e[6]=_*i+x*s+v*u,e[7]=_*a+x*o+v*h,e[8]=_*n+x*l+v*c,e}function T0(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=r[0],d=r[1];return e[0]=i,e[1]=a,e[2]=n,e[3]=s,e[4]=o,e[5]=l,e[6]=p*i+d*s+u,e[7]=p*a+d*o+h,e[8]=p*n+d*l+c,e}function A0(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=Math.sin(r),d=Math.cos(r);return e[0]=d*i+p*s,e[1]=d*a+p*o,e[2]=d*n+p*l,e[3]=d*s-p*i,e[4]=d*o-p*a,e[5]=d*l-p*n,e[6]=u,e[7]=h,e[8]=c,e}function I0(e,t,r){var i=r[0],a=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function C0(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function M0(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function E0(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function k0(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function L0(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r+r,o=i+i,l=a+a,u=r*s,h=i*s,c=i*o,p=a*s,d=a*o,f=a*l,m=n*s,y=n*o,g=n*l;return e[0]=1-c-f,e[3]=h-g,e[6]=p+y,e[1]=h+g,e[4]=1-u-f,e[7]=d-m,e[2]=p-y,e[5]=d+m,e[8]=1-u-c,e}function D0(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],m=t[13],y=t[14],g=t[15],_=r*o-i*s,x=r*l-a*s,v=r*u-n*s,b=i*l-a*o,w=i*u-n*o,S=a*u-n*l,A=h*m-c*f,I=h*y-p*f,M=h*g-d*f,T=c*y-p*m,C=c*g-d*m,P=p*g-d*y,k=_*P-x*C+v*T+b*M-w*I+S*A;return k?(k=1/k,e[0]=(o*P-l*C+u*T)*k,e[1]=(l*M-s*P-u*I)*k,e[2]=(s*C-o*M+u*A)*k,e[3]=(a*C-i*P-n*T)*k,e[4]=(r*P-a*M+n*I)*k,e[5]=(i*M-r*C-n*A)*k,e[6]=(m*S-y*w+g*b)*k,e[7]=(y*v-f*S-g*x)*k,e[8]=(f*w-m*v+g*_)*k,e):null}function z0(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function F0(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function B0(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function R0(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e}function Mm(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function O0(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e}function V0(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e}function U0(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function N0(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=e[4],o=e[5],l=e[6],u=e[7],h=e[8],c=t[0],p=t[1],d=t[2],f=t[3],m=t[4],y=t[5],g=t[6],_=t[7],x=t[8];return Math.abs(r-c)<=ie*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(i-p)<=ie*Math.max(1,Math.abs(i),Math.abs(p))&&Math.abs(a-d)<=ie*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(n-f)<=ie*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(s-m)<=ie*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(o-y)<=ie*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(l-g)<=ie*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(u-_)<=ie*Math.max(1,Math.abs(u),Math.abs(_))&&Math.abs(h-x)<=ie*Math.max(1,Math.abs(h),Math.abs(x))}Ii(Ba,{add:()=>R0,adjoint:()=>S0,clone:()=>y0,copy:()=>g0,create:()=>f0,determinant:()=>P0,equals:()=>N0,exactEquals:()=>U0,frob:()=>B0,fromMat2d:()=>k0,fromMat4:()=>d0,fromQuat:()=>L0,fromRotation:()=>M0,fromScaling:()=>E0,fromTranslation:()=>C0,fromValues:()=>x0,identity:()=>b0,invert:()=>w0,mul:()=>q0,multiply:()=>Cm,multiplyScalar:()=>O0,multiplyScalarAndAdd:()=>V0,normalFromMat4:()=>D0,projection:()=>z0,rotate:()=>A0,scale:()=>I0,set:()=>_0,str:()=>F0,sub:()=>$0,subtract:()=>Mm,translate:()=>T0,transpose:()=>v0}),d(),u(f0,"create"),u(d0,"fromMat4"),u(y0,"clone"),u(g0,"copy"),u(x0,"fromValues"),u(_0,"set"),u(b0,"identity"),u(v0,"transpose"),u(w0,"invert"),u(S0,"adjoint"),u(P0,"determinant"),u(Cm,"multiply"),u(T0,"translate"),u(A0,"rotate"),u(I0,"scale"),u(C0,"fromTranslation"),u(M0,"fromRotation"),u(E0,"fromScaling"),u(k0,"fromMat2d"),u(L0,"fromQuat"),u(D0,"normalFromMat4"),u(z0,"projection"),u(F0,"str"),u(B0,"frob"),u(R0,"add"),u(Mm,"subtract"),u(O0,"multiplyScalar"),u(V0,"multiplyScalarAndAdd"),u(U0,"exactEquals"),u(N0,"equals");var q0=Cm,$0=Mm,$={};function G0(){var e=new we(16);return we!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function j0(e){var t=new we(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function H0(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Z0(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m){var y=new we(16);return y[0]=e,y[1]=t,y[2]=r,y[3]=i,y[4]=a,y[5]=n,y[6]=s,y[7]=o,y[8]=l,y[9]=u,y[10]=h,y[11]=c,y[12]=p,y[13]=d,y[14]=f,y[15]=m,y}function W0(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,y){return e[0]=t,e[1]=r,e[2]=i,e[3]=a,e[4]=n,e[5]=s,e[6]=o,e[7]=l,e[8]=u,e[9]=h,e[10]=c,e[11]=p,e[12]=d,e[13]=f,e[14]=m,e[15]=y,e}function Em(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function X0(e,t){if(e===t){var r=t[1],i=t[2],a=t[3],n=t[6],s=t[7],o=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=n,e[11]=t[14],e[12]=a,e[13]=s,e[14]=o}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function K0(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],m=t[13],y=t[14],g=t[15],_=r*o-i*s,x=r*l-a*s,v=r*u-n*s,b=i*l-a*o,w=i*u-n*o,S=a*u-n*l,A=h*m-c*f,I=h*y-p*f,M=h*g-d*f,T=c*y-p*m,C=c*g-d*m,P=p*g-d*y,k=_*P-x*C+v*T+b*M-w*I+S*A;return k?(k=1/k,e[0]=(o*P-l*C+u*T)*k,e[1]=(a*C-i*P-n*T)*k,e[2]=(m*S-y*w+g*b)*k,e[3]=(p*w-c*S-d*b)*k,e[4]=(l*M-s*P-u*I)*k,e[5]=(r*P-a*M+n*I)*k,e[6]=(y*v-f*S-g*x)*k,e[7]=(h*S-p*v+d*x)*k,e[8]=(s*C-o*M+u*A)*k,e[9]=(i*M-r*C-n*A)*k,e[10]=(f*w-m*v+g*_)*k,e[11]=(c*v-h*w-d*_)*k,e[12]=(o*I-s*T-l*A)*k,e[13]=(r*T-i*I+a*A)*k,e[14]=(m*x-f*b-y*_)*k,e[15]=(h*b-c*x+p*_)*k,e):null}function Y0(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],m=t[13],y=t[14],g=t[15];return e[0]=o*(p*g-d*y)-c*(l*g-u*y)+m*(l*d-u*p),e[1]=-(i*(p*g-d*y)-c*(a*g-n*y)+m*(a*d-n*p)),e[2]=i*(l*g-u*y)-o*(a*g-n*y)+m*(a*u-n*l),e[3]=-(i*(l*d-u*p)-o*(a*d-n*p)+c*(a*u-n*l)),e[4]=-(s*(p*g-d*y)-h*(l*g-u*y)+f*(l*d-u*p)),e[5]=r*(p*g-d*y)-h*(a*g-n*y)+f*(a*d-n*p),e[6]=-(r*(l*g-u*y)-s*(a*g-n*y)+f*(a*u-n*l)),e[7]=r*(l*d-u*p)-s*(a*d-n*p)+h*(a*u-n*l),e[8]=s*(c*g-d*m)-h*(o*g-u*m)+f*(o*d-u*c),e[9]=-(r*(c*g-d*m)-h*(i*g-n*m)+f*(i*d-n*c)),e[10]=r*(o*g-u*m)-s*(i*g-n*m)+f*(i*u-n*o),e[11]=-(r*(o*d-u*c)-s*(i*d-n*c)+h*(i*u-n*o)),e[12]=-(s*(c*y-p*m)-h*(o*y-l*m)+f*(o*p-l*c)),e[13]=r*(c*y-p*m)-h*(i*y-a*m)+f*(i*p-a*c),e[14]=-(r*(o*y-l*m)-s*(i*y-a*m)+f*(i*l-a*o)),e[15]=r*(o*p-l*c)-s*(i*p-a*c)+h*(i*l-a*o),e}function J0(e){var t=e[0],r=e[1],i=e[2],a=e[3],n=e[4],s=e[5],o=e[6],l=e[7],u=e[8],h=e[9],c=e[10],p=e[11],d=e[12],f=e[13],m=e[14],y=e[15];return(t*s-r*n)*(c*y-p*m)-(t*o-i*n)*(h*y-p*f)+(t*l-a*n)*(h*m-c*f)+(r*o-i*s)*(u*y-p*d)-(r*l-a*s)*(u*m-c*d)+(i*l-a*o)*(u*f-h*d)}function km(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=t[9],d=t[10],f=t[11],m=t[12],y=t[13],g=t[14],_=t[15],x=r[0],v=r[1],b=r[2],w=r[3];return e[0]=x*i+v*o+b*c+w*m,e[1]=x*a+v*l+b*p+w*y,e[2]=x*n+v*u+b*d+w*g,e[3]=x*s+v*h+b*f+w*_,x=r[4],v=r[5],b=r[6],w=r[7],e[4]=x*i+v*o+b*c+w*m,e[5]=x*a+v*l+b*p+w*y,e[6]=x*n+v*u+b*d+w*g,e[7]=x*s+v*h+b*f+w*_,x=r[8],v=r[9],b=r[10],w=r[11],e[8]=x*i+v*o+b*c+w*m,e[9]=x*a+v*l+b*p+w*y,e[10]=x*n+v*u+b*d+w*g,e[11]=x*s+v*h+b*f+w*_,x=r[12],v=r[13],b=r[14],w=r[15],e[12]=x*i+v*o+b*c+w*m,e[13]=x*a+v*l+b*p+w*y,e[14]=x*n+v*u+b*d+w*g,e[15]=x*s+v*h+b*f+w*_,e}function Q0(e,t,r){var i,a,n,s,o,l,u,h,c,p,d,f,m=r[0],y=r[1],g=r[2];return t===e?(e[12]=t[0]*m+t[4]*y+t[8]*g+t[12],e[13]=t[1]*m+t[5]*y+t[9]*g+t[13],e[14]=t[2]*m+t[6]*y+t[10]*g+t[14],e[15]=t[3]*m+t[7]*y+t[11]*g+t[15]):(i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=t[9],d=t[10],f=t[11],e[0]=i,e[1]=a,e[2]=n,e[3]=s,e[4]=o,e[5]=l,e[6]=u,e[7]=h,e[8]=c,e[9]=p,e[10]=d,e[11]=f,e[12]=i*m+o*y+c*g+t[12],e[13]=a*m+l*y+p*g+t[13],e[14]=n*m+u*y+d*g+t[14],e[15]=s*m+h*y+f*g+t[15]),e}function e1(e,t,r){var i=r[0],a=r[1],n=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function t1(e,t,r,i){var a,n,s,o,l,u,h,c,p,d,f,m,y,g,_,x,v,b,w,S,A,I,M,T,C=i[0],P=i[1],k=i[2],z=Math.hypot(C,P,k);return z<ie?null:(C*=z=1/z,P*=z,k*=z,a=Math.sin(r),s=1-(n=Math.cos(r)),o=t[0],l=t[1],u=t[2],h=t[3],c=t[4],p=t[5],d=t[6],f=t[7],m=t[8],y=t[9],g=t[10],_=t[11],x=C*C*s+n,v=P*C*s+k*a,b=k*C*s-P*a,w=C*P*s-k*a,S=P*P*s+n,A=k*P*s+C*a,I=C*k*s+P*a,M=P*k*s-C*a,T=k*k*s+n,e[0]=o*x+c*v+m*b,e[1]=l*x+p*v+y*b,e[2]=u*x+d*v+g*b,e[3]=h*x+f*v+_*b,e[4]=o*w+c*S+m*A,e[5]=l*w+p*S+y*A,e[6]=u*w+d*S+g*A,e[7]=h*w+f*S+_*A,e[8]=o*I+c*M+m*T,e[9]=l*I+p*M+y*T,e[10]=u*I+d*M+g*T,e[11]=h*I+f*M+_*T,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function r1(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[4],s=t[5],o=t[6],l=t[7],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=n*a+u*i,e[5]=s*a+h*i,e[6]=o*a+c*i,e[7]=l*a+p*i,e[8]=u*a-n*i,e[9]=h*a-s*i,e[10]=c*a-o*i,e[11]=p*a-l*i,e}function i1(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[0],s=t[1],o=t[2],l=t[3],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a-u*i,e[1]=s*a-h*i,e[2]=o*a-c*i,e[3]=l*a-p*i,e[8]=n*i+u*a,e[9]=s*i+h*a,e[10]=o*i+c*a,e[11]=l*i+p*a,e}function n1(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[0],s=t[1],o=t[2],l=t[3],u=t[4],h=t[5],c=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a+u*i,e[1]=s*a+h*i,e[2]=o*a+c*i,e[3]=l*a+p*i,e[4]=u*a-n*i,e[5]=h*a-s*i,e[6]=c*a-o*i,e[7]=p*a-l*i,e}function a1(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function o1(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function s1(e,t,r){var i,a,n,s=r[0],o=r[1],l=r[2],u=Math.hypot(s,o,l);return u<ie?null:(s*=u=1/u,o*=u,l*=u,i=Math.sin(t),n=1-(a=Math.cos(t)),e[0]=s*s*n+a,e[1]=o*s*n+l*i,e[2]=l*s*n-o*i,e[3]=0,e[4]=s*o*n-l*i,e[5]=o*o*n+a,e[6]=l*o*n+s*i,e[7]=0,e[8]=s*l*n+o*i,e[9]=o*l*n-s*i,e[10]=l*l*n+a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function l1(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function u1(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function c1(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Lm(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=i+i,l=a+a,u=n+n,h=i*o,c=i*l,p=i*u,d=a*l,f=a*u,m=n*u,y=s*o,g=s*l,_=s*u;return e[0]=1-(d+m),e[1]=c+_,e[2]=p-g,e[3]=0,e[4]=c-_,e[5]=1-(h+m),e[6]=f+y,e[7]=0,e[8]=p+g,e[9]=f-y,e[10]=1-(h+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function p1(e,t){var r=new we(3),i=-t[0],a=-t[1],n=-t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=i*i+a*a+n*n+s*s;return c>0?(r[0]=2*(o*s+h*i+l*n-u*a)/c,r[1]=2*(l*s+h*a+u*i-o*n)/c,r[2]=2*(u*s+h*n+o*a-l*i)/c):(r[0]=2*(o*s+h*i+l*n-u*a),r[1]=2*(l*s+h*a+u*i-o*n),r[2]=2*(u*s+h*n+o*a-l*i)),Lm(e,t,r),e}function h1(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Dm(e,t){var r=t[0],i=t[1],a=t[2],n=t[4],s=t[5],o=t[6],l=t[8],u=t[9],h=t[10];return e[0]=Math.hypot(r,i,a),e[1]=Math.hypot(n,s,o),e[2]=Math.hypot(l,u,h),e}function m1(e,t){var r=new we(3);Dm(r,t);var i=1/r[0],a=1/r[1],n=1/r[2],s=t[0]*i,o=t[1]*a,l=t[2]*n,u=t[4]*i,h=t[5]*a,c=t[6]*n,p=t[8]*i,d=t[9]*a,f=t[10]*n,m=s+h+f,y=0;return m>0?(y=2*Math.sqrt(m+1),e[3]=.25*y,e[0]=(c-d)/y,e[1]=(p-l)/y,e[2]=(o-u)/y):s>h&&s>f?(y=2*Math.sqrt(1+s-h-f),e[3]=(c-d)/y,e[0]=.25*y,e[1]=(o+u)/y,e[2]=(p+l)/y):h>f?(y=2*Math.sqrt(1+h-s-f),e[3]=(p-l)/y,e[0]=(o+u)/y,e[1]=.25*y,e[2]=(c+d)/y):(y=2*Math.sqrt(1+f-s-h),e[3]=(o-u)/y,e[0]=(p+l)/y,e[1]=(c+d)/y,e[2]=.25*y),e}function f1(e,t,r,i){var a=t[0],n=t[1],s=t[2],o=t[3],l=a+a,u=n+n,h=s+s,c=a*l,p=a*u,d=a*h,f=n*u,m=n*h,y=s*h,g=o*l,_=o*u,x=o*h,v=i[0],b=i[1],w=i[2];return e[0]=(1-(f+y))*v,e[1]=(p+x)*v,e[2]=(d-_)*v,e[3]=0,e[4]=(p-x)*b,e[5]=(1-(c+y))*b,e[6]=(m+g)*b,e[7]=0,e[8]=(d+_)*w,e[9]=(m-g)*w,e[10]=(1-(c+f))*w,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function d1(e,t,r,i,a){var n=t[0],s=t[1],o=t[2],l=t[3],u=n+n,h=s+s,c=o+o,p=n*u,d=n*h,f=n*c,m=s*h,y=s*c,g=o*c,_=l*u,x=l*h,v=l*c,b=i[0],w=i[1],S=i[2],A=a[0],I=a[1],M=a[2],T=(1-(m+g))*b,C=(d+v)*b,P=(f-x)*b,k=(d-v)*w,z=(1-(p+g))*w,E=(y+_)*w,F=(f+x)*S,D=(y-_)*S,B=(1-(p+m))*S;return e[0]=T,e[1]=C,e[2]=P,e[3]=0,e[4]=k,e[5]=z,e[6]=E,e[7]=0,e[8]=F,e[9]=D,e[10]=B,e[11]=0,e[12]=r[0]+A-(T*A+k*I+F*M),e[13]=r[1]+I-(C*A+z*I+D*M),e[14]=r[2]+M-(P*A+E*I+B*M),e[15]=1,e}function y1(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r+r,o=i+i,l=a+a,u=r*s,h=i*s,c=i*o,p=a*s,d=a*o,f=a*l,m=n*s,y=n*o,g=n*l;return e[0]=1-c-f,e[1]=h+g,e[2]=p-y,e[3]=0,e[4]=h-g,e[5]=1-u-f,e[6]=d+m,e[7]=0,e[8]=p+y,e[9]=d-m,e[10]=1-u-c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function g1(e,t,r,i,a,n,s){var o=1/(r-t),l=1/(a-i),u=1/(n-s);return e[0]=2*n*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*n*l,e[6]=0,e[7]=0,e[8]=(r+t)*o,e[9]=(a+i)*l,e[10]=(s+n)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*n*2*u,e[15]=0,e}function zm(e,t,r,i,a){var n,s=1/Math.tan(t/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(n=1/(i-a),e[10]=(a+i)*n,e[14]=2*a*i*n):(e[10]=-1,e[14]=-2*i),e}Ii($,{add:()=>I1,adjoint:()=>Y0,clone:()=>j0,copy:()=>H0,create:()=>G0,determinant:()=>J0,equals:()=>k1,exactEquals:()=>E1,frob:()=>A1,fromQuat:()=>y1,fromQuat2:()=>p1,fromRotation:()=>s1,fromRotationTranslation:()=>Lm,fromRotationTranslationScale:()=>f1,fromRotationTranslationScaleOrigin:()=>d1,fromScaling:()=>o1,fromTranslation:()=>a1,fromValues:()=>Z0,fromXRotation:()=>l1,fromYRotation:()=>u1,fromZRotation:()=>c1,frustum:()=>g1,getRotation:()=>m1,getScaling:()=>Dm,getTranslation:()=>h1,identity:()=>Em,invert:()=>K0,lookAt:()=>S1,mul:()=>L1,multiply:()=>km,multiplyScalar:()=>C1,multiplyScalarAndAdd:()=>M1,ortho:()=>v1,orthoNO:()=>Fm,orthoZO:()=>w1,perspective:()=>x1,perspectiveFromFieldOfView:()=>b1,perspectiveNO:()=>zm,perspectiveZO:()=>_1,rotate:()=>t1,rotateX:()=>r1,rotateY:()=>i1,rotateZ:()=>n1,scale:()=>e1,set:()=>W0,str:()=>T1,sub:()=>D1,subtract:()=>Bm,targetTo:()=>P1,translate:()=>Q0,transpose:()=>X0}),d(),u(G0,"create"),u(j0,"clone"),u(H0,"copy"),u(Z0,"fromValues"),u(W0,"set"),u(Em,"identity"),u(X0,"transpose"),u(K0,"invert"),u(Y0,"adjoint"),u(J0,"determinant"),u(km,"multiply"),u(Q0,"translate"),u(e1,"scale"),u(t1,"rotate"),u(r1,"rotateX"),u(i1,"rotateY"),u(n1,"rotateZ"),u(a1,"fromTranslation"),u(o1,"fromScaling"),u(s1,"fromRotation"),u(l1,"fromXRotation"),u(u1,"fromYRotation"),u(c1,"fromZRotation"),u(Lm,"fromRotationTranslation"),u(p1,"fromQuat2"),u(h1,"getTranslation"),u(Dm,"getScaling"),u(m1,"getRotation"),u(f1,"fromRotationTranslationScale"),u(d1,"fromRotationTranslationScaleOrigin"),u(y1,"fromQuat"),u(g1,"frustum"),u(zm,"perspectiveNO");var x1=zm;function _1(e,t,r,i,a){var n,s=1/Math.tan(t/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(n=1/(i-a),e[10]=a*n,e[14]=a*i*n):(e[10]=-1,e[14]=-i),e}function b1(e,t,r,i){var a=Math.tan(t.upDegrees*Math.PI/180),n=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),o=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+o),u=2/(a+n);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(s-o)*l*.5,e[9]=(a-n)*u*.5,e[10]=i/(r-i),e[11]=-1,e[12]=0,e[13]=0,e[14]=i*r/(r-i),e[15]=0,e}function Fm(e,t,r,i,a,n,s){var o=1/(t-r),l=1/(i-a),u=1/(n-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*o,e[13]=(a+i)*l,e[14]=(s+n)*u,e[15]=1,e}u(_1,"perspectiveZO"),u(b1,"perspectiveFromFieldOfView"),u(Fm,"orthoNO");var v1=Fm;function w1(e,t,r,i,a,n,s){var o=1/(t-r),l=1/(i-a),u=1/(n-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+r)*o,e[13]=(a+i)*l,e[14]=n*u,e[15]=1,e}function S1(e,t,r,i){var a,n,s,o,l,u,h,c,p,d,f=t[0],m=t[1],y=t[2],g=i[0],_=i[1],x=i[2],v=r[0],b=r[1],w=r[2];return Math.abs(f-v)<ie&&Math.abs(m-b)<ie&&Math.abs(y-w)<ie?Em(e):(h=f-v,c=m-b,p=y-w,a=_*(p*=d=1/Math.hypot(h,c,p))-x*(c*=d),n=x*(h*=d)-g*p,s=g*c-_*h,(d=Math.hypot(a,n,s))?(a*=d=1/d,n*=d,s*=d):(a=0,n=0,s=0),o=c*s-p*n,l=p*a-h*s,u=h*n-c*a,(d=Math.hypot(o,l,u))?(o*=d=1/d,l*=d,u*=d):(o=0,l=0,u=0),e[0]=a,e[1]=o,e[2]=h,e[3]=0,e[4]=n,e[5]=l,e[6]=c,e[7]=0,e[8]=s,e[9]=u,e[10]=p,e[11]=0,e[12]=-(a*f+n*m+s*y),e[13]=-(o*f+l*m+u*y),e[14]=-(h*f+c*m+p*y),e[15]=1,e)}function P1(e,t,r,i){var a=t[0],n=t[1],s=t[2],o=i[0],l=i[1],u=i[2],h=a-r[0],c=n-r[1],p=s-r[2],d=h*h+c*c+p*p;d>0&&(h*=d=1/Math.sqrt(d),c*=d,p*=d);var f=l*p-u*c,m=u*h-o*p,y=o*c-l*h;return(d=f*f+m*m+y*y)>0&&(f*=d=1/Math.sqrt(d),m*=d,y*=d),e[0]=f,e[1]=m,e[2]=y,e[3]=0,e[4]=c*y-p*m,e[5]=p*f-h*y,e[6]=h*m-c*f,e[7]=0,e[8]=h,e[9]=c,e[10]=p,e[11]=0,e[12]=a,e[13]=n,e[14]=s,e[15]=1,e}function T1(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function A1(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function I1(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function Bm(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function C1(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function M1(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e[9]=t[9]+r[9]*i,e[10]=t[10]+r[10]*i,e[11]=t[11]+r[11]*i,e[12]=t[12]+r[12]*i,e[13]=t[13]+r[13]*i,e[14]=t[14]+r[14]*i,e[15]=t[15]+r[15]*i,e}function E1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function k1(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=e[4],o=e[5],l=e[6],u=e[7],h=e[8],c=e[9],p=e[10],d=e[11],f=e[12],m=e[13],y=e[14],g=e[15],_=t[0],x=t[1],v=t[2],b=t[3],w=t[4],S=t[5],A=t[6],I=t[7],M=t[8],T=t[9],C=t[10],P=t[11],k=t[12],z=t[13],E=t[14],F=t[15];return Math.abs(r-_)<=ie*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(i-x)<=ie*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-v)<=ie*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(n-b)<=ie*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(s-w)<=ie*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(o-S)<=ie*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(l-A)<=ie*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(u-I)<=ie*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(h-M)<=ie*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(c-T)<=ie*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(p-C)<=ie*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(d-P)<=ie*Math.max(1,Math.abs(d),Math.abs(P))&&Math.abs(f-k)<=ie*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(m-z)<=ie*Math.max(1,Math.abs(m),Math.abs(z))&&Math.abs(y-E)<=ie*Math.max(1,Math.abs(y),Math.abs(E))&&Math.abs(g-F)<=ie*Math.max(1,Math.abs(g),Math.abs(F))}u(w1,"orthoZO"),u(S1,"lookAt"),u(P1,"targetTo"),u(T1,"str"),u(A1,"frob"),u(I1,"add"),u(Bm,"subtract"),u(C1,"multiplyScalar"),u(M1,"multiplyScalarAndAdd"),u(E1,"exactEquals"),u(k1,"equals");var L1=km,D1=Bm,Pt={};function Rm(){var e=new we(3);return we!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function z1(e){var t=new we(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Om(e){var t=e[0],r=e[1],i=e[2];return Math.hypot(t,r,i)}function F1(e,t,r){var i=new we(3);return i[0]=e,i[1]=t,i[2]=r,i}function B1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function R1(e,t,r,i){return e[0]=t,e[1]=r,e[2]=i,e}function O1(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Vm(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Um(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Nm(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function V1(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function U1(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function N1(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function q1(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function $1(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function G1(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function j1(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e}function qm(e,t){var r=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2];return Math.hypot(r,i,a)}function $m(e,t){var r=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2];return r*r+i*i+a*a}function Gm(e){var t=e[0],r=e[1],i=e[2];return t*t+r*r+i*i}function H1(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Z1(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function W1(e,t){var r=t[0],i=t[1],a=t[2],n=r*r+i*i+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function jm(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function X1(e,t,r){var i=t[0],a=t[1],n=t[2],s=r[0],o=r[1],l=r[2];return e[0]=a*l-n*o,e[1]=n*s-i*l,e[2]=i*o-a*s,e}function K1(e,t,r,i){var a=t[0],n=t[1],s=t[2];return e[0]=a+i*(r[0]-a),e[1]=n+i*(r[1]-n),e[2]=s+i*(r[2]-s),e}function Y1(e,t,r,i,a,n){var s=n*n,o=s*(2*n-3)+1,l=s*(n-2)+n,u=s*(n-1),h=s*(3-2*n);return e[0]=t[0]*o+r[0]*l+i[0]*u+a[0]*h,e[1]=t[1]*o+r[1]*l+i[1]*u+a[1]*h,e[2]=t[2]*o+r[2]*l+i[2]*u+a[2]*h,e}function J1(e,t,r,i,a,n){var s=1-n,o=s*s,l=n*n,u=o*s,h=3*n*o,c=3*l*s,p=l*n;return e[0]=t[0]*u+r[0]*h+i[0]*c+a[0]*p,e[1]=t[1]*u+r[1]*h+i[1]*c+a[1]*p,e[2]=t[2]*u+r[2]*h+i[2]*c+a[2]*p,e}function Q1(e,t){t=t||1;var r=2*Jt()*Math.PI,i=2*Jt()-1,a=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*a,e[1]=Math.sin(r)*a,e[2]=i*t,e}function ew(e,t,r){var i=t[0],a=t[1],n=t[2],s=r[3]*i+r[7]*a+r[11]*n+r[15];return s=s||1,e[0]=(r[0]*i+r[4]*a+r[8]*n+r[12])/s,e[1]=(r[1]*i+r[5]*a+r[9]*n+r[13])/s,e[2]=(r[2]*i+r[6]*a+r[10]*n+r[14])/s,e}function tw(e,t,r){var i=t[0],a=t[1],n=t[2];return e[0]=i*r[0]+a*r[3]+n*r[6],e[1]=i*r[1]+a*r[4]+n*r[7],e[2]=i*r[2]+a*r[5]+n*r[8],e}function rw(e,t,r){var i=r[0],a=r[1],n=r[2],s=r[3],o=t[0],l=t[1],u=t[2],h=a*u-n*l,c=n*o-i*u,p=i*l-a*o,d=a*p-n*c,f=n*h-i*p,m=i*c-a*h,y=2*s;return h*=y,c*=y,p*=y,d*=2,f*=2,m*=2,e[0]=o+h+d,e[1]=l+c+f,e[2]=u+p+m,e}function iw(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[0],n[1]=a[1]*Math.cos(i)-a[2]*Math.sin(i),n[2]=a[1]*Math.sin(i)+a[2]*Math.cos(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function nw(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[2]*Math.sin(i)+a[0]*Math.cos(i),n[1]=a[1],n[2]=a[2]*Math.cos(i)-a[0]*Math.sin(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function aw(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[0]*Math.cos(i)-a[1]*Math.sin(i),n[1]=a[0]*Math.sin(i)+a[1]*Math.cos(i),n[2]=a[2],e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function ow(e,t){var r=e[0],i=e[1],a=e[2],n=t[0],s=t[1],o=t[2],l=Math.sqrt(r*r+i*i+a*a)*Math.sqrt(n*n+s*s+o*o),u=l&&jm(e,t)/l;return Math.acos(Math.min(Math.max(u,-1),1))}function sw(e){return e[0]=0,e[1]=0,e[2]=0,e}function lw(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function uw(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function cw(e,t){var r=e[0],i=e[1],a=e[2],n=t[0],s=t[1],o=t[2];return Math.abs(r-n)<=ie*Math.max(1,Math.abs(r),Math.abs(n))&&Math.abs(i-s)<=ie*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-o)<=ie*Math.max(1,Math.abs(a),Math.abs(o))}Ii(Pt,{add:()=>O1,angle:()=>ow,bezier:()=>J1,ceil:()=>V1,clone:()=>z1,copy:()=>B1,create:()=>Rm,cross:()=>X1,dist:()=>fw,distance:()=>qm,div:()=>mw,divide:()=>Nm,dot:()=>jm,equals:()=>cw,exactEquals:()=>uw,floor:()=>U1,forEach:()=>xw,fromValues:()=>F1,hermite:()=>Y1,inverse:()=>Z1,len:()=>yw,length:()=>Om,lerp:()=>K1,max:()=>q1,min:()=>N1,mul:()=>hw,multiply:()=>Um,negate:()=>H1,normalize:()=>W1,random:()=>Q1,rotateX:()=>iw,rotateY:()=>nw,rotateZ:()=>aw,round:()=>$1,scale:()=>G1,scaleAndAdd:()=>j1,set:()=>R1,sqrDist:()=>dw,sqrLen:()=>gw,squaredDistance:()=>$m,squaredLength:()=>Gm,str:()=>lw,sub:()=>pw,subtract:()=>Vm,transformMat3:()=>tw,transformMat4:()=>ew,transformQuat:()=>rw,zero:()=>sw}),d(),u(Rm,"create"),u(z1,"clone"),u(Om,"length"),u(F1,"fromValues"),u(B1,"copy"),u(R1,"set"),u(O1,"add"),u(Vm,"subtract"),u(Um,"multiply"),u(Nm,"divide"),u(V1,"ceil"),u(U1,"floor"),u(N1,"min"),u(q1,"max"),u($1,"round"),u(G1,"scale"),u(j1,"scaleAndAdd"),u(qm,"distance"),u($m,"squaredDistance"),u(Gm,"squaredLength"),u(H1,"negate"),u(Z1,"inverse"),u(W1,"normalize"),u(jm,"dot"),u(X1,"cross"),u(K1,"lerp"),u(Y1,"hermite"),u(J1,"bezier"),u(Q1,"random"),u(ew,"transformMat4"),u(tw,"transformMat3"),u(rw,"transformQuat"),u(iw,"rotateX"),u(nw,"rotateY"),u(aw,"rotateZ"),u(ow,"angle"),u(sw,"zero"),u(lw,"str"),u(uw,"exactEquals"),u(cw,"equals");var pw=Vm,hw=Um,mw=Nm,fw=qm,dw=$m,yw=Om,gw=Gm,xw=function(){var e=Rm();return function(t,r,i,a,n,s){var o,l;for(r||(r=3),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],n(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2];return t}}(),Je={};function Hm(){var e=new we(4);return we!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function _w(e){var t=new we(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function bw(e,t,r,i){var a=new we(4);return a[0]=e,a[1]=t,a[2]=r,a[3]=i,a}function vw(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function ww(e,t,r,i,a){return e[0]=t,e[1]=r,e[2]=i,e[3]=a,e}function Sw(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function Zm(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function Wm(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function Xm(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function Pw(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function Tw(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function Aw(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e}function Iw(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e}function Cw(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function Mw(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function Ew(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e}function Km(e,t){var r=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2],n=t[3]-e[3];return Math.hypot(r,i,a,n)}function Ym(e,t){var r=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2],n=t[3]-e[3];return r*r+i*i+a*a+n*n}function Jm(e){var t=e[0],r=e[1],i=e[2],a=e[3];return Math.hypot(t,r,i,a)}function Qm(e){var t=e[0],r=e[1],i=e[2],a=e[3];return t*t+r*r+i*i+a*a}function kw(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function Lw(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function Dw(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r*r+i*i+a*a+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=i*s,e[2]=a*s,e[3]=n*s,e}function zw(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Fw(e,t,r,i){var a=r[0]*i[1]-r[1]*i[0],n=r[0]*i[2]-r[2]*i[0],s=r[0]*i[3]-r[3]*i[0],o=r[1]*i[2]-r[2]*i[1],l=r[1]*i[3]-r[3]*i[1],u=r[2]*i[3]-r[3]*i[2],h=t[0],c=t[1],p=t[2],d=t[3];return e[0]=c*u-p*l+d*o,e[1]=-h*u+p*s-d*n,e[2]=h*l-c*s+d*a,e[3]=-h*o+c*n-p*a,e}function Bw(e,t,r,i){var a=t[0],n=t[1],s=t[2],o=t[3];return e[0]=a+i*(r[0]-a),e[1]=n+i*(r[1]-n),e[2]=s+i*(r[2]-s),e[3]=o+i*(r[3]-o),e}function Rw(e,t){var r,i,a,n,s,o;t=t||1;do{s=(r=2*Jt()-1)*r+(i=2*Jt()-1)*i}while(s>=1);do{o=(a=2*Jt()-1)*a+(n=2*Jt()-1)*n}while(o>=1);var l=Math.sqrt((1-s)/o);return e[0]=t*r,e[1]=t*i,e[2]=t*a*l,e[3]=t*n*l,e}function Ow(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3];return e[0]=r[0]*i+r[4]*a+r[8]*n+r[12]*s,e[1]=r[1]*i+r[5]*a+r[9]*n+r[13]*s,e[2]=r[2]*i+r[6]*a+r[10]*n+r[14]*s,e[3]=r[3]*i+r[7]*a+r[11]*n+r[15]*s,e}function Vw(e,t,r){var i=t[0],a=t[1],n=t[2],s=r[0],o=r[1],l=r[2],u=r[3],h=u*i+o*n-l*a,c=u*a+l*i-s*n,p=u*n+s*a-o*i,d=-s*i-o*a-l*n;return e[0]=h*u+d*-s+c*-l-p*-o,e[1]=c*u+d*-o+p*-s-h*-l,e[2]=p*u+d*-l+h*-o-c*-s,e[3]=t[3],e}function Uw(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function Nw(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function qw(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function $w(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=t[0],o=t[1],l=t[2],u=t[3];return Math.abs(r-s)<=ie*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-o)<=ie*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-l)<=ie*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-u)<=ie*Math.max(1,Math.abs(n),Math.abs(u))}Ii(Je,{add:()=>Sw,ceil:()=>Pw,clone:()=>_w,copy:()=>vw,create:()=>Hm,cross:()=>Fw,dist:()=>Zw,distance:()=>Km,div:()=>Hw,divide:()=>Xm,dot:()=>zw,equals:()=>$w,exactEquals:()=>qw,floor:()=>Tw,forEach:()=>Yw,fromValues:()=>bw,inverse:()=>Lw,len:()=>Xw,length:()=>Jm,lerp:()=>Bw,max:()=>Iw,min:()=>Aw,mul:()=>jw,multiply:()=>Wm,negate:()=>kw,normalize:()=>Dw,random:()=>Rw,round:()=>Cw,scale:()=>Mw,scaleAndAdd:()=>Ew,set:()=>ww,sqrDist:()=>Ww,sqrLen:()=>Kw,squaredDistance:()=>Ym,squaredLength:()=>Qm,str:()=>Nw,sub:()=>Gw,subtract:()=>Zm,transformMat4:()=>Ow,transformQuat:()=>Vw,zero:()=>Uw}),d(),u(Hm,"create"),u(_w,"clone"),u(bw,"fromValues"),u(vw,"copy"),u(ww,"set"),u(Sw,"add"),u(Zm,"subtract"),u(Wm,"multiply"),u(Xm,"divide"),u(Pw,"ceil"),u(Tw,"floor"),u(Aw,"min"),u(Iw,"max"),u(Cw,"round"),u(Mw,"scale"),u(Ew,"scaleAndAdd"),u(Km,"distance"),u(Ym,"squaredDistance"),u(Jm,"length"),u(Qm,"squaredLength"),u(kw,"negate"),u(Lw,"inverse"),u(Dw,"normalize"),u(zw,"dot"),u(Fw,"cross"),u(Bw,"lerp"),u(Rw,"random"),u(Ow,"transformMat4"),u(Vw,"transformQuat"),u(Uw,"zero"),u(Nw,"str"),u(qw,"exactEquals"),u($w,"equals");var Gw=Zm,jw=Wm,Hw=Xm,Zw=Km,Ww=Ym,Xw=Jm,Kw=Qm,Yw=function(){var e=Hm();return function(t,r,i,a,n,s){var o,l;for(r||(r=4),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],e[3]=t[o+3],n(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2],t[o+3]=e[3];return t}}(),nn={};function ef(){var e=new we(2);return we!=Float32Array&&(e[0]=0,e[1]=0),e}function Jw(e){var t=new we(2);return t[0]=e[0],t[1]=e[1],t}function Qw(e,t){var r=new we(2);return r[0]=e,r[1]=t,r}function e2(e,t){return e[0]=t[0],e[1]=t[1],e}function t2(e,t,r){return e[0]=t,e[1]=r,e}function r2(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function tf(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function rf(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function nf(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function i2(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function n2(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function a2(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e}function o2(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e}function s2(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function l2(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function u2(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e}function af(e,t){var r=t[0]-e[0],i=t[1]-e[1];return Math.hypot(r,i)}function of(e,t){var r=t[0]-e[0],i=t[1]-e[1];return r*r+i*i}function sf(e){var t=e[0],r=e[1];return Math.hypot(t,r)}function lf(e){var t=e[0],r=e[1];return t*t+r*r}function c2(e,t){return e[0]=-t[0],e[1]=-t[1],e}function p2(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function h2(e,t){var r=t[0],i=t[1],a=r*r+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e}function m2(e,t){return e[0]*t[0]+e[1]*t[1]}function f2(e,t,r){var i=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=i,e}function d2(e,t,r,i){var a=t[0],n=t[1];return e[0]=a+i*(r[0]-a),e[1]=n+i*(r[1]-n),e}function y2(e,t){t=t||1;var r=2*Jt()*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e}function g2(e,t,r){var i=t[0],a=t[1];return e[0]=r[0]*i+r[2]*a,e[1]=r[1]*i+r[3]*a,e}function x2(e,t,r){var i=t[0],a=t[1];return e[0]=r[0]*i+r[2]*a+r[4],e[1]=r[1]*i+r[3]*a+r[5],e}function _2(e,t,r){var i=t[0],a=t[1];return e[0]=r[0]*i+r[3]*a+r[6],e[1]=r[1]*i+r[4]*a+r[7],e}function b2(e,t,r){var i=t[0],a=t[1];return e[0]=r[0]*i+r[4]*a+r[12],e[1]=r[1]*i+r[5]*a+r[13],e}function v2(e,t,r,i){var a=t[0]-r[0],n=t[1]-r[1],s=Math.sin(i),o=Math.cos(i);return e[0]=a*o-n*s+r[0],e[1]=a*s+n*o+r[1],e}function w2(e,t){var r=e[0],i=e[1],a=t[0],n=t[1],s=Math.sqrt(r*r+i*i)*Math.sqrt(a*a+n*n),o=s&&(r*a+i*n)/s;return Math.acos(Math.min(Math.max(o,-1),1))}function S2(e){return e[0]=0,e[1]=0,e}function P2(e){return"vec2("+e[0]+", "+e[1]+")"}function T2(e,t){return e[0]===t[0]&&e[1]===t[1]}function A2(e,t){var r=e[0],i=e[1],a=t[0],n=t[1];return Math.abs(r-a)<=ie*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-n)<=ie*Math.max(1,Math.abs(i),Math.abs(n))}Ii(nn,{add:()=>r2,angle:()=>w2,ceil:()=>i2,clone:()=>Jw,copy:()=>e2,create:()=>ef,cross:()=>f2,dist:()=>k2,distance:()=>af,div:()=>E2,divide:()=>nf,dot:()=>m2,equals:()=>A2,exactEquals:()=>T2,floor:()=>n2,forEach:()=>z2,fromValues:()=>Qw,inverse:()=>p2,len:()=>I2,length:()=>sf,lerp:()=>d2,max:()=>o2,min:()=>a2,mul:()=>M2,multiply:()=>rf,negate:()=>c2,normalize:()=>h2,random:()=>y2,rotate:()=>v2,round:()=>s2,scale:()=>l2,scaleAndAdd:()=>u2,set:()=>t2,sqrDist:()=>L2,sqrLen:()=>D2,squaredDistance:()=>of,squaredLength:()=>lf,str:()=>P2,sub:()=>C2,subtract:()=>tf,transformMat2:()=>g2,transformMat2d:()=>x2,transformMat3:()=>_2,transformMat4:()=>b2,zero:()=>S2}),d(),u(ef,"create"),u(Jw,"clone"),u(Qw,"fromValues"),u(e2,"copy"),u(t2,"set"),u(r2,"add"),u(tf,"subtract"),u(rf,"multiply"),u(nf,"divide"),u(i2,"ceil"),u(n2,"floor"),u(a2,"min"),u(o2,"max"),u(s2,"round"),u(l2,"scale"),u(u2,"scaleAndAdd"),u(af,"distance"),u(of,"squaredDistance"),u(sf,"length"),u(lf,"squaredLength"),u(c2,"negate"),u(p2,"inverse"),u(h2,"normalize"),u(m2,"dot"),u(f2,"cross"),u(d2,"lerp"),u(y2,"random"),u(g2,"transformMat2"),u(x2,"transformMat2d"),u(_2,"transformMat3"),u(b2,"transformMat4"),u(v2,"rotate"),u(w2,"angle"),u(S2,"zero"),u(P2,"str"),u(T2,"exactEquals"),u(A2,"equals");var I2=sf,C2=tf,M2=rf,E2=nf,k2=af,L2=of,D2=lf,z2=function(){var e=ef();return function(t,r,i,a,n,s){var o,l;for(r||(r=2),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],n(e,e,s),t[o]=e[0],t[o+1]=e[1];return t}}(),uf=ae(Pe()),xs=class extends Ze{constructor(e){super(e,Tm)}createBucket(e){return new hi(e)}queryRadius(e){let t=e;return mi("circle-radius",this,t)+mi("circle-stroke-width",this,t)+Rr(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,r,i,a,n,s,o){let l=Or(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),n.angle,s),u=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r),h="map"===this.paint.get("circle-pitch-alignment"),c=h?l:F2(l,o),p=h?u*s:u;for(let e of i)for(let t of e){let e=h?t:cf(t,o),r=p,i=Je.transformMat4([],[t.x,t.y,0,1],o);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?r*=i[3]/n.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(r*=n.cameraToCenterDistance/i[3]),gm(c,e,r))return!0}return!1}};function cf(e,t){let r=Je.transformMat4([],[e.x,e.y,0,1],t);return new uf.default(r[0]/r[3],r[1]/r[3])}function F2(e,t){return e.map((e=>cf(e,t)))}u(xs,"CircleStyleLayer"),u(cf,"projectPoint"),u(F2,"projectQueryGeometry"),d(),d();var Ra=class extends hi{};u(Ra,"HeatmapBucket"),N("HeatmapBucket",Ra,{omit:["layers"]}),d();var pf,B2=u((()=>pf=pf||new Ve({"heatmap-radius":new W(C.paint_heatmap["heatmap-radius"]),"heatmap-weight":new W(C.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new H(C.paint_heatmap["heatmap-intensity"]),"heatmap-color":new oi(C.paint_heatmap["heatmap-color"]),"heatmap-opacity":new H(C.paint_heatmap["heatmap-opacity"])})),"getPaint"),hf={get paint(){return B2()}};function vc(e,{width:t,height:r},i,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*r*i)throw new RangeError(`mismatched image size. expected: ${a.length} but got: ${t*r*i}`)}else a=new Uint8Array(t*r*i);return e.width=t,e.height=r,e.data=a,e}function mf(e,{width:t,height:r},i){if(t===e.width&&r===e.height)return;let a=vc({},{width:t,height:r},i);wc(e,a,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},i),e.width=t,e.height=r,e.data=a.data}function wc(e,t,r,i,a,n){if(0===a.width||0===a.height)return t;if(a.width>e.width||a.height>e.height||r.x>e.width-a.width||r.y>e.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||i.x>t.width-a.width||i.y>t.height-a.height)throw new RangeError("out of range destination coordinates for image copy");let s=e.data,o=t.data;if(s===o)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<a.height;l++){let u=((r.y+l)*e.width+r.x)*n,h=((i.y+l)*t.width+i.x)*n;for(let e=0;e<a.width*n;e++)o[h+e]=s[u+e]}return t}d(),d(),u(vc,"createImage"),u(mf,"resizeImage"),u(wc,"copyImage");var fr=class{constructor(e,t){vc(this,e,1,t)}resize(e){mf(this,e,1)}clone(){return new fr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,a){wc(e,t,r,i,a,1)}};u(fr,"AlphaImage");var Se=class{constructor(e,t){vc(this,e,4,t)}resize(e){mf(this,e,4)}replace(e,t){t?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new Se({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,a){wc(e,t,r,i,a,4)}};function _s(e){let t={},r=e.resolution||256,i=e.clips?e.clips.length:1,a=e.image||new Se({width:r,height:i});if(!zp(r))throw new Error(`width is not a power of 2 - ${r}`);let n=u(((r,i,n)=>{t[e.evaluationKey]=n;let s=e.expression.evaluate(t);a.data[r+i+0]=Math.floor(255*s.r/s.a),a.data[r+i+1]=Math.floor(255*s.g/s.a),a.data[r+i+2]=Math.floor(255*s.b/s.a),a.data[r+i+3]=Math.floor(255*s.a)}),"renderPixel");if(e.clips)for(let t=0,a=0;t<i;++t,a+=4*r)for(let i=0,s=0;i<r;i++,s+=4){let o=i/(r-1),{start:l,end:u}=e.clips[t];n(a,s,l*(1-o)+u*o)}else for(let e=0,t=0;e<r;e++,t+=4){n(0,t,e/(r-1))}return a}u(Se,"RGBAImage"),N("AlphaImage",fr),N("RGBAImage",Se),u(_s,"renderColorRamp");var bs=class extends Ze{createBucket(e){return new Ra(e)}constructor(e){super(e,hf),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=_s({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}};u(bs,"HeatmapStyleLayer"),d(),d();var ff,R2=u((()=>ff=ff||new Ve({"hillshade-illumination-direction":new H(C.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new H(C.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new H(C.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new H(C.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new H(C.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new H(C.paint_hillshade["hillshade-accent-color"])})),"getPaint"),df={get paint(){return R2()}},vs=class extends Ze{constructor(e){super(e,df)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}};u(vs,"HillshadeStyleLayer"),d(),d(),d();var O2=ve([{name:"a_pos",components:2,type:"Int16"}],4),{members:yf,size:ZC,alignment:WC}=O2,xf=ae(Ap());function Sc(e,t,r,i,a){gf(e,t,r||0,i||e.length-1,a||V2)}function gf(e,t,r,i,a){for(;i>r;){if(i-r>600){var n=i-r+1,s=t-r+1,o=Math.log(n),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(n-l)/n)*(s-n/2<0?-1:1);gf(e,t,Math.max(r,Math.floor(t-s*l/n+u)),Math.min(i,Math.floor(t+(n-s)*l/n+u)),a)}var h=e[t],c=r,p=i;for(Oa(e,r,t),a(e[i],h)>0&&Oa(e,r,i);c<p;){for(Oa(e,c,p),c++,p--;a(e[c],h)<0;)c++;for(;a(e[p],h)>0;)p--}0===a(e[r],h)?Oa(e,r,p):Oa(e,++p,i),p<=t&&(r=p+1),t<=p&&(i=p-1)}}function Oa(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function V2(e,t){return e<t?-1:e>t?1:0}function Va(e,t){let r=e.length;if(r<=1)return[e];let i,a,n=[];for(let t=0;t<r;t++){let r=Vp(e[t]);0!==r&&(e[t].area=Math.abs(r),void 0===a&&(a=r<0),a===r<0?(i&&n.push(i),i=[e[t]]):i.push(e[t]))}if(i&&n.push(i),t>1)for(let e=0;e<n.length;e++)n[e].length<=t||(Sc(n[e],t,1,n[e].length-1,U2),n[e]=n[e].slice(0,t));return n}function U2(e,t){return t.area-e.area}function an(e,t,r){let i=r.patternDependencies,a=!1;for(let r of t){let t=r.paint.get(`${e}-pattern`);t.isConstant()||(a=!0);let n=t.constantOr(null);n&&(a=!0,i[n.to]=!0,i[n.from]=!0)}return a}function on(e,t,r,i,a){let n=a.patternDependencies;for(let s of t){let t=s.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:i-1},r,{},a.availableImages),o=t.evaluate({zoom:i},r,{},a.availableImages),l=t.evaluate({zoom:i+1},r,{},a.availableImages);e=e&&e.name?e.name:e,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,n[e]=!0,n[o]=!0,n[l]=!0,r.patterns[s.id]={min:e,mid:o,max:l}}}return r}d(),d(),u(Sc,"quickselect"),u(gf,"quickselectStep"),u(Oa,"swap"),u(V2,"defaultCompare"),u(Va,"classifyRings"),u(U2,"compareAreas"),d(),u(an,"hasPattern"),u(on,"addPatternDependencies");var N2=500,Ua=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ts,this.indexArray=new lt,this.indexArray2=new zr,this.programConfigurations=new vt(e.layers,e.zoom),this.segments=new le,this.segments2=new le,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,r){this.hasPattern=an("fill",this.layers,t);let i=this.layers[0].layout.get("fill-sort-key"),a=!i.isConstant(),n=[];for(let{feature:s,id:o,index:l,sourceLayerIndex:u}of e){let e=this.layers[0]._featureFilter.needGeometry,h=St(s,e);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),h,r))continue;let c=a?i.evaluate(h,{},r,t.availableImages):void 0,p={id:o,properties:s.properties,type:s.type,sourceLayerIndex:u,index:l,geometry:e?h.geometry:wt(s),patterns:{},sortKey:c};n.push(p)}a&&n.sort(((e,t)=>e.sortKey-t.sortKey));for(let i of n){let{geometry:a,index:n,sourceLayerIndex:s}=i;if(this.hasPattern){let e=on("fill",this.layers,i,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(i,a,n,r,{});let o=e[n].feature;t.featureIndex.insert(o,a,n,s,this.index)}}update(e,t,r){!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,r)}addFeatures(e,t,r){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,yf),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,r,i,a){for(let e of Va(t,N2)){let t=0;for(let r of e)t+=r.length;let r=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),i=r.vertexLength,a=[],n=[];for(let t of e){if(0===t.length)continue;t!==e[0]&&n.push(a.length/2);let r=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),i=r.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(i+t.length-1,i),a.push(t[0].x),a.push(t[0].y);for(let e=1;e<t.length;e++)this.layoutVertexArray.emplaceBack(t[e].x,t[e].y),this.indexArray2.emplaceBack(i+e-1,i+e),a.push(t[e].x),a.push(t[e].y);r.vertexLength+=t.length,r.primitiveLength+=t.length}let s=(0,xf.default)(a,n);for(let e=0;e<s.length;e+=3)this.indexArray.emplaceBack(i+s[e],i+s[e+1],i+s[e+2]);r.vertexLength+=t,r.primitiveLength+=s.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,a,i)}};u(Ua,"FillBucket"),N("FillBucket",Ua,{omit:["layers","patternFeatures"]}),d();var _f,bf,q2=u((()=>_f=_f||new Ve({"fill-sort-key":new W(C.layout_fill["fill-sort-key"])})),"getLayout"),$2=u((()=>bf=bf||new Ve({"fill-antialias":new H(C.paint_fill["fill-antialias"]),"fill-opacity":new W(C.paint_fill["fill-opacity"]),"fill-color":new W(C.paint_fill["fill-color"]),"fill-outline-color":new W(C.paint_fill["fill-outline-color"]),"fill-translate":new H(C.paint_fill["fill-translate"]),"fill-translate-anchor":new H(C.paint_fill["fill-translate-anchor"]),"fill-pattern":new pr(C.paint_fill["fill-pattern"])})),"getPaint"),vf={get paint(){return $2()},get layout(){return q2()}},ws=class extends Ze{constructor(e){super(e,vf)}recalculate(e,t){super.recalculate(e,t);let r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Ua(e)}queryRadius(){return Rr(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,r,i,a,n,s){return ys(Or(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),n.angle,s),i)}isTileClipped(){return!0}};u(ws,"FillStyleLayer"),d(),d(),d();var G2=ve([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),wf=ve([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Sf,size:MM,alignment:EM}=G2,Mf=ae(Ap()),Ef=ae(Na()),rS=Ef.default.VectorTileFeature.types,iS=500,Ac=Math.pow(2,13);function qa(e,t,r,i,a,n,s,o){e.emplaceBack(t,r,2*Math.floor(i*Ac)+s,a*Ac*2,n*Ac*2,Math.round(o))}u(qa,"addVertex");var $a=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new rs,this.centroidVertexArray=new Dr,this.indexArray=new lt,this.programConfigurations=new vt(e.layers,e.zoom),this.segments=new le,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,r){this.features=[],this.hasPattern=an("fill-extrusion",this.layers,t);for(let{feature:i,id:a,index:n,sourceLayerIndex:s}of e){let e=this.layers[0]._featureFilter.needGeometry,o=St(i,e);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),o,r))continue;let l={id:a,sourceLayerIndex:s,index:n,geometry:e?o.geometry:wt(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(on("fill-extrusion",this.layers,l,this.zoom,t)):this.addFeature(l,l.geometry,n,r,{}),t.featureIndex.insert(i,l.geometry,n,s,this.index,!0)}}addFeatures(e,t,r){for(let e of this.features){let{geometry:i}=e;this.addFeature(e,i,e.index,t,r)}}update(e,t,r){!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Sf),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,wf.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,r,i,a){let n={x:0,y:0,vertexCount:0};for(let r of Va(t,iS)){let t=0;for(let e of r)t+=e.length;let i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let e of r){if(0===e.length||aS(e))continue;let t=0;for(let r=0;r<e.length;r++){let a=e[r];if(r>=1){let s=e[r-1];if(!nS(a,s)){i.vertexLength+4>le.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let e=a.sub(s)._perp()._unit(),r=s.dist(a);t+r>32768&&(t=0),qa(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,0,t),qa(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,1,t),n.x+=2*a.x,n.y+=2*a.y,n.vertexCount+=2,t+=r,qa(this.layoutVertexArray,s.x,s.y,e.x,e.y,0,0,t),qa(this.layoutVertexArray,s.x,s.y,e.x,e.y,0,1,t),n.x+=2*s.x,n.y+=2*s.y,n.vertexCount+=2;let o=i.vertexLength;this.indexArray.emplaceBack(o,o+2,o+1),this.indexArray.emplaceBack(o+1,o+2,o+3),i.vertexLength+=4,i.primitiveLength+=2}}}}if(i.vertexLength+t>le.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray)),"Polygon"!==rS[e.type])continue;let a=[],s=[],o=i.vertexLength;for(let e of r)if(0!==e.length){e!==r[0]&&s.push(a.length/2);for(let t=0;t<e.length;t++){let r=e[t];qa(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),n.x+=r.x,n.y+=r.y,n.vertexCount+=1,a.push(r.x),a.push(r.y)}}let l=(0,Mf.default)(a,s);for(let e=0;e<l.length;e+=3)this.indexArray.emplaceBack(o+l[e],o+l[e+2],o+l[e+1]);i.primitiveLength+=l.length/3,i.vertexLength+=t}for(let e=0;e<n.vertexCount;e++)this.centroidVertexArray.emplaceBack(Math.floor(n.x/n.vertexCount),Math.floor(n.y/n.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,a,i)}};function nS(e,t){return e.x===t.x&&(e.x<0||e.x>O)||e.y===t.y&&(e.y<0||e.y>O)}function aS(e){return e.every((e=>e.x<0))||e.every((e=>e.x>O))||e.every((e=>e.y<0))||e.every((e=>e.y>O))}u($a,"FillExtrusionBucket"),N("FillExtrusionBucket",$a,{omit:["layers","features"]}),u(nS,"isBoundaryEdge"),u(aS,"isEntirelyOutside"),d();var kf,oS=u((()=>kf=kf||new Ve({"fill-extrusion-opacity":new H(C["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new W(C["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new H(C["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new H(C["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new pr(C["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new W(C["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new W(C["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new H(C["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})),"getPaint"),Lf={get paint(){return oS()}},Ps=ae(Pe()),Ts=class extends Ze{constructor(e){super(e,Lf)}createBucket(e){return new $a(e)}queryRadius(){return Rr(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,t,r,i,a,n,s,o){let l=Or(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),n.angle,s),u=this.paint.get("fill-extrusion-height").evaluate(t,r),h=this.paint.get("fill-extrusion-base").evaluate(t,r),c=uS(l,o,n,0),p=lS(i,h,u,o);return sS(p[0],p[1],c)}};function Ga(e,t){return e.x*t.x+e.y*t.y}function Df(e,t){if(1===e.length){let r,i=0,a=t[i++];for(;!r||a.equals(r);)if(r=t[i++],!r)return 1/0;for(;i<t.length;i++){let n=t[i],s=e[0],o=r.sub(a),l=n.sub(a),u=s.sub(a),h=Ga(o,o),c=Ga(o,l),p=Ga(l,l),d=Ga(u,o),f=Ga(u,l),m=h*p-c*c,y=(p*d-c*f)/m,g=(h*f-c*d)/m,_=1-y-g,x=a.z*_+r.z*y+n.z*g;if(isFinite(x))return x}return 1/0}{let e=1/0;for(let r of t)e=Math.min(e,r.z);return e}}function sS(e,t,r){let i=1/0;ys(r,t)&&(i=Df(r,t[0]));for(let a=0;a<t.length;a++){let n=t[a],s=e[a];for(let e=0;e<n.length-1;e++){let t=n[e],a=n[e+1],o=s[e],l=[t,a,s[e+1],o,t];ds(r,l)&&(i=Math.min(i,Df(r,l)))}}return i!==1/0&&i}function lS(e,t,r,i){let a=[],n=[],s=i[8]*t,o=i[9]*t,l=i[10]*t,u=i[11]*t,h=i[8]*r,c=i[9]*r,p=i[10]*r,d=i[11]*r;for(let t of e){let e=[],r=[];for(let a of t){let t=a.x,n=a.y,f=i[0]*t+i[4]*n+i[12],m=i[1]*t+i[5]*n+i[13],y=i[2]*t+i[6]*n+i[14],g=i[3]*t+i[7]*n+i[15],_=f+s,x=m+o,v=y+l,b=g+u,w=f+h,S=m+c,A=y+p,I=g+d,M=new Ps.default(_/b,x/b);M.z=v/b,e.push(M);let T=new Ps.default(w/I,S/I);T.z=A/I,r.push(T)}a.push(e),n.push(r)}return[a,n]}function uS(e,t,r,i){let a=[];for(let r of e){let e=[r.x,r.y,i,1];Je.transformMat4(e,e,t),a.push(new Ps.default(e[0]/e[3],e[1]/e[3]))}return a}u(Ts,"FillExtrusionStyleLayer"),u(Ga,"dot"),u(Df,"getIntersectionDistance"),u(sS,"checkIntersection"),u(lS,"projectExtrusion"),u(uS,"projectQueryGeometry"),d(),d(),d();var cS=ve([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:zf,size:hE,alignment:mE}=cS;d();var pS=ve([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ff,size:yE,alignment:gE}=pS,Bf=ae(Na()),hS=Bf.default.VectorTileFeature.types,Rf=63,mS=Math.cos(Math.PI/180*37.5),fS=15,dS=20,yS=15,Of=.5,Vf=Math.pow(2,yS-1)/Of,ja=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new is,this.layoutVertexArray2=new ns,this.indexArray=new lt,this.programConfigurations=new vt(e.layers,e.zoom),this.segments=new le,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,r){this.hasPattern=an("line",this.layers,t);let i=this.layers[0].layout.get("line-sort-key"),a=!i.isConstant(),n=[];for(let{feature:t,id:s,index:o,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,u=St(t,e);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),u,r))continue;let h=a?i.evaluate(u,{},r):void 0,c={id:s,properties:t.properties,type:t.type,sourceLayerIndex:l,index:o,geometry:e?u.geometry:wt(t),patterns:{},sortKey:h};n.push(c)}a&&n.sort(((e,t)=>e.sortKey-t.sortKey));for(let i of n){let{geometry:a,index:n,sourceLayerIndex:s}=i;if(this.hasPattern){let e=on("line",this.layers,i,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(i,a,n,r,{});let o=e[n].feature;t.featureIndex.insert(o,a,n,s,this.index)}}update(e,t,r){!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,r)}addFeatures(e,t,r){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Ff)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,zf),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}}addFeature(e,t,r,i,a){let n=this.layers[0].layout,s=n.get("line-join").evaluate(e,{}),o=n.get("line-cap"),l=n.get("line-miter-limit"),u=n.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let r of t)this.addLine(r,e,s,o,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,a,i)}addLine(e,t,r,i,a,n){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s="Polygon"===hS[t.type],o=e.length;for(;o>=2&&e[o-1].equals(e[o-2]);)o--;let l=0;for(;l<o-1&&e[l].equals(e[l+1]);)l++;if(o<(s?3:2))return;"bevel"===r&&(a=1.05);let u,h,c,p,d,f=this.overscaling<=16?fS*O/(512*this.overscaling):0,m=this.segments.prepareSegment(10*o,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,s&&(u=e[o-2],d=e[l].sub(u)._unit()._perp());for(let t=l;t<o;t++){if(c=t===o-1?s?e[l+1]:void 0:e[t+1],c&&e[t].equals(c))continue;d&&(p=d),u&&(h=u),u=e[t],d=c?c.sub(u)._unit()._perp():p,p=p||d;let y=p.add(d);(0!==y.x||0!==y.y)&&y._unit();let g=p.x*d.x+p.y*d.y,_=y.x*d.x+y.y*d.y,x=0!==_?1/_:1/0,v=2*Math.sqrt(2-2*_),b=_<mS&&h&&c,w=p.x*d.y-p.y*d.x>0;if(b&&t>l){let e=u.dist(h);if(e>2*f){let t=u.sub(u.sub(h)._mult(f/e)._round());this.updateDistance(h,t),this.addCurrentVertex(t,p,0,0,m),h=t}}let S=h&&c,A=S?r:s?"butt":i;if(S&&"round"===A&&(x<n?A="miter":x<=2&&(A="fakeround")),"miter"===A&&x>a&&(A="bevel"),"bevel"===A&&(x>2&&(A="flipbevel"),x<a&&(A="miter")),h&&this.updateDistance(h,u),"miter"===A)y._mult(x),this.addCurrentVertex(u,y,0,0,m);else if("flipbevel"===A){if(x>100)y=d.mult(-1);else{let e=x*p.add(d).mag()/p.sub(d).mag();y._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(u,y,0,0,m),this.addCurrentVertex(u,y.mult(-1),0,0,m)}else if("bevel"===A||"fakeround"===A){let e=-Math.sqrt(x*x-1),t=w?e:0,r=w?0:e;if(h&&this.addCurrentVertex(u,p,t,r,m),"fakeround"===A){let e=Math.round(180*v/Math.PI/dS);for(let t=1;t<e;t++){let r=t/e;if(.5!==r){let e=r-.5;r+=r*e*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*e*e+(.848013+g*(.215638*g-1.06021)))}let i=d.sub(p)._mult(r)._add(p)._unit()._mult(w?-1:1);this.addHalfVertex(u,i.x,i.y,!1,w,0,m)}}c&&this.addCurrentVertex(u,d,-t,-r,m)}else if("butt"===A)this.addCurrentVertex(u,y,0,0,m);else if("square"===A){let e=h?1:-1;this.addCurrentVertex(u,y,e,e,m)}else"round"===A&&(h&&(this.addCurrentVertex(u,p,0,0,m),this.addCurrentVertex(u,p,1,1,m,!0)),c&&(this.addCurrentVertex(u,d,-1,-1,m,!0),this.addCurrentVertex(u,d,0,0,m)));if(b&&t<o-1){let e=u.dist(c);if(e>2*f){let t=u.add(c.sub(u)._mult(f/e)._round());this.updateDistance(u,t),this.addCurrentVertex(t,d,0,0,m),u=t}}}}addCurrentVertex(e,t,r,i,a,n=!1){let s=t.x+t.y*r,o=t.y-t.x*r,l=-t.x+t.y*i,u=-t.y-t.x*i;this.addHalfVertex(e,s,o,n,!1,r,a),this.addHalfVertex(e,l,u,n,!0,-i,a),this.distance>Vf/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,r,i,a,n))}addHalfVertex({x:e,y:t},r,i,a,n,s,o){let l=(this.lineClips?this.scaledDistance*(Vf-1):this.scaledDistance)*Of;if(this.layoutVertexArray.emplaceBack((e<<1)+(a?1:0),(t<<1)+(n?1:0),Math.round(Rf*r)+128,Math.round(Rf*i)+128,1+(0===s?0:s<0?-1:1)|(63&l)<<2,l>>6),this.lineClips){let e=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(e,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),n?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}};u(ja,"LineBucket"),N("LineBucket",ja,{omit:["layers","patternFeatures"]}),d();var Uf,Nf,gS=u((()=>Uf=Uf||new Ve({"line-cap":new H(C.layout_line["line-cap"]),"line-join":new W(C.layout_line["line-join"]),"line-miter-limit":new H(C.layout_line["line-miter-limit"]),"line-round-limit":new H(C.layout_line["line-round-limit"]),"line-sort-key":new W(C.layout_line["line-sort-key"])})),"getLayout"),xS=u((()=>Nf=Nf||new Ve({"line-opacity":new W(C.paint_line["line-opacity"]),"line-color":new W(C.paint_line["line-color"]),"line-translate":new H(C.paint_line["line-translate"]),"line-translate-anchor":new H(C.paint_line["line-translate-anchor"]),"line-width":new W(C.paint_line["line-width"]),"line-gap-width":new W(C.paint_line["line-gap-width"]),"line-offset":new W(C.paint_line["line-offset"]),"line-blur":new W(C.paint_line["line-blur"]),"line-dasharray":new ai(C.paint_line["line-dasharray"]),"line-pattern":new pr(C.paint_line["line-pattern"]),"line-gradient":new oi(C.paint_line["line-gradient"])})),"getPaint"),Ic={get paint(){return xS()},get layout(){return gS()}},Cc=class extends W{possiblyEvaluate(e,t){return t=new de(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,i){return t=R({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,i)}};u(Cc,"LineFloorwidthProperty");var As,Is=class extends Ze{constructor(e){super(e,Ic),this.gradientVersion=0,As||((As=new Cc(Ic.paint.properties["line-width"].specification)).useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression.expression instanceof Pr,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=As.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new ja(e)}queryRadius(e){let t=e,r=qf(mi("line-width",this,t),mi("line-gap-width",this,t)),i=mi("line-offset",this,t);return r/2+Math.abs(i)+Rr(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,r,i,a,n,s){let o=Or(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),n.angle,s),l=s/2*qf(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),u=this.paint.get("line-offset").evaluate(t,r);return u&&(i=wm(i,u*s)),xm(o,i,l)}isTileClipped(){return!0}};function qf(e,t){return t>0?t+2*e:e}u(Is,"LineStyleLayer"),u(qf,"getLineWidth"),d(),d(),d();var $f=ve([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Gf=ve([{name:"a_projected_pos",components:3,type:"Float32"}],4),ek=ve([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),jf=ve([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),tk=ve([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Mc=ve([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Hf=ve([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),rk=ve([{name:"triangle",components:3,type:"Uint16"}]),ik=ve([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),nk=ve([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),ak=ve([{type:"Float32",name:"offsetX"}]),ok=ve([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Wa=ae(Pe());function _S(e,t,r){let i=t.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?e=e.toLocaleUpperCase():"lowercase"===i&&(e=e.toLocaleLowerCase()),bt.applyArabicShaping&&(e=bt.applyArabicShaping(e)),e}function Zf(e,t,r){return e.sections.forEach((e=>{e.text=_S(e.text,t,r)})),e}function Wf(e){let t={},r={},i=[],a=0;function n(t){i.push(e[t]),a++}function s(e,t,a){let n=r[e];return delete r[e],r[t]=n,i[n].geometry[0].pop(),i[n].geometry[0]=i[n].geometry[0].concat(a[0]),n}function o(e,r,a){let n=t[r];return delete t[r],t[e]=n,i[n].geometry[0].shift(),i[n].geometry[0]=a[0].concat(i[n].geometry[0]),n}function l(e,t,r){let i=r?t[0][t[0].length-1]:t[0][0];return`${e}:${i.x}:${i.y}`}u(n,"add"),u(s,"mergeFromRight"),u(o,"mergeFromLeft"),u(l,"getKey");for(let u=0;u<e.length;u++){let h=e[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){n(u);continue}let d=l(p,c),f=l(p,c,!0);if(d in r&&f in t&&r[d]!==t[f]){let e=o(d,f,c),a=s(d,f,i[e].geometry);delete t[d],delete r[f],r[l(p,i[a].geometry,!0)]=a,i[e].geometry=null}else d in r?s(d,f,c):f in t?o(d,f,c):(n(u),t[d]=a-1,r[f]=a-1)}return i.filter((e=>e.geometry))}d(),u(_S,"transformTextInternal"),u(Zf,"transformText"),d(),u(Wf,"mergeLines"),d(),d();var Xf={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};d();var fi=24;d();var rd=ae(Lc()),id=3;function RS(e,t,r){1===e&&r.readMessage(OS,t)}function OS(e,t,r){if(3===e){let{id:e,bitmap:i,width:a,height:n,left:s,top:o,advance:l}=r.readMessage(VS,{});t.push({id:e,bitmap:new fr({width:a+2*id,height:n+2*id},i),metrics:{width:a,height:n,left:s,top:o,advance:l}})}}function VS(e,t,r){1===e?t.id=r.readVarint():2===e?t.bitmap=r.readBytes():3===e?t.width=r.readVarint():4===e?t.height=r.readVarint():5===e?t.left=r.readSVarint():6===e?t.top=r.readSVarint():7===e&&(t.advance=r.readVarint())}function nd(e){return new rd.default(e).readFields(RS,[])}function Ha(e){let t=0,r=0;for(let i of e)t+=i.w*i.h,r=Math.max(r,i.w);e.sort(((e,t)=>t.h-e.h));let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],a=0,n=0;for(let t of e)for(let e=i.length-1;e>=0;e--){let r=i[e];if(!(t.w>r.w||t.h>r.h)){if(t.x=r.x,t.y=r.y,n=Math.max(n,t.y+t.h),a=Math.max(a,t.x+t.w),t.w===r.w&&t.h===r.h){let t=i.pop();e<i.length&&(i[e]=t)}else t.h===r.h?(r.x+=t.w,r.w-=t.w):t.w===r.w?(r.y+=t.h,r.h-=t.h):(i.push({x:r.x+t.w,y:r.y,w:r.w-t.w,h:t.h}),r.y+=t.h,r.h-=t.h);break}}return{w:a,h:n,fill:t/(a*n)||0}}u(RS,"readFontstacks"),u(OS,"readFontstack"),u(VS,"readGlyph"),u(nd,"parseGlyphPbf"),d(),d(),u(Ha,"potpack");var Tt=1,cn=class{constructor(e,{pixelRatio:t,version:r,stretchX:i,stretchY:a,content:n}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=i,this.stretchY=a,this.content=n,this.version=r}get tl(){return[this.paddedRect.x+Tt,this.paddedRect.y+Tt]}get br(){return[this.paddedRect.x+this.paddedRect.w-Tt,this.paddedRect.y+this.paddedRect.h-Tt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Tt)/this.pixelRatio,(this.paddedRect.h-2*Tt)/this.pixelRatio]}};u(cn,"ImagePosition");var Be,Dc=class{constructor(e,t){let r={},i={};this.haveRenderCallbacks=[];let a=[];this.addImages(e,r,a),this.addImages(t,i,a);let{w:n,h:s}=Ha(a),o=new Se({width:n||1,height:s||1});for(let t in e){let i=e[t],a=r[t].paddedRect;Se.copy(i.data,o,{x:0,y:0},{x:a.x+Tt,y:a.y+Tt},i.data)}for(let e in t){let r=t[e],a=i[e].paddedRect,n=a.x+Tt,s=a.y+Tt,l=r.data.width,u=r.data.height;Se.copy(r.data,o,{x:0,y:0},{x:n,y:s},r.data),Se.copy(r.data,o,{x:0,y:u-1},{x:n,y:s-1},{width:l,height:1}),Se.copy(r.data,o,{x:0,y:0},{x:n,y:s+u},{width:l,height:1}),Se.copy(r.data,o,{x:l-1,y:0},{x:n-1,y:s},{width:1,height:u}),Se.copy(r.data,o,{x:0,y:0},{x:n+l,y:s},{width:1,height:u})}this.image=o,this.iconPositions=r,this.patternPositions=i}addImages(e,t,r){for(let i in e){let a=e[i],n={x:0,y:0,w:a.data.width+2*Tt,h:a.data.height+2*Tt};r.push(n),t[i]=new cn(n,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let r in e.updatedImages)this.patchUpdatedImage(this.iconPositions[r],e.getImage(r),t),this.patchUpdatedImage(this.patternPositions[r],e.getImage(r),t)}patchUpdatedImage(e,t,r){if(!e||!t||e.version===t.version)return;e.version=t.version;let[i,a]=e.tl;r.update(t.data,void 0,{x:i,y:a})}};u(Dc,"ImageAtlas"),N("ImagePosition",cn),N("ImageAtlas",Dc),function(e){e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly"}(Be||(Be={}));var zk={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Fk={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Es(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}u(Es,"getAnchorAlignment");var od=ae(Na());d();var ad=255,Za=128,ks=ad*Za;function zc(e,t){let{expression:r}=t;if("constant"===r.kind){return{kind:"constant",layoutSize:r.evaluate(new de(e+1))}}if("source"===r.kind)return{kind:"source"};{let{zoomStops:t,interpolationType:i}=r,a=0;for(;a<t.length&&t[a]<=e;)a++;a=Math.max(0,a-1);let n=a;for(;n<t.length&&t[n]<e+1;)n++;n=Math.min(t.length-1,n);let s=t[a],o=t[n];return"composite"===r.kind?{kind:"composite",minZoom:s,maxZoom:o,interpolationType:i}:{kind:"camera",minZoom:s,maxZoom:o,minSize:r.evaluate(new de(s)),maxSize:r.evaluate(new de(o)),interpolationType:i}}}function pn(e,{uSize:t,uSizeT:r},{lowerSize:i,upperSize:a}){return"source"===e.kind?i/Za:"composite"===e.kind?Le.number(i/Za,a/Za,r):t}function di(e,t){let r=0,i=0;if("constant"===e.kind)i=e.layoutSize;else if("source"!==e.kind){let{interpolationType:a,minZoom:n,maxZoom:s}=e,o=a?Te(ct.interpolationFactor(a,t,n,s),0,1):0;"camera"===e.kind?i=Le.number(e.minSize,e.maxSize,o):r=o}return{uSizeT:r,uSize:i}}function hn(e,t,r){let i="never",a=e.get(t);return a?i=a:e.get(r)&&(i="always"),i}u(zc,"getSizeData"),u(pn,"evaluateSizeForFeature"),u(di,"evaluateSizeForZoom"),d(),u(hn,"getOverlapMode");var NS=od.default.VectorTileFeature.types,qS=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ls(e,t,r,i,a,n,s,o,l,u,h,c,p){let d=o?Math.min(ks,Math.round(o[0])):0,f=o?Math.min(ks,Math.round(o[1])):0;e.emplaceBack(t,r,Math.round(32*i),Math.round(32*a),n,s,(d<<1)+(l?1:0),f,16*u,16*h,256*c,256*p)}function yi(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function $S(e){for(let t of e.sections)if(tm(t.text))return!0;return!1}u(Ls,"addVertex"),u(yi,"addDynamicAttributes"),u($S,"containsRTLText");var Xa=class{constructor(e){this.layoutVertexArray=new as,this.indexArray=new lt,this.programConfigurations=e,this.segments=new le,this.dynamicLayoutVertexArray=new os,this.opacityVertexArray=new ss,this.hasVisibleVertices=!1,this.placedSymbolArray=new Aa}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$f.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Gf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,qS,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(e))}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};u(Xa,"SymbolBuffers"),N("SymbolBuffers",Xa);var Ka=class{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new le,this.collisionVertexArray=new us}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,jf.members,!0)}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};u(Ka,"CollisionBuffers"),N("CollisionBuffers",Ka);var Wt=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=$.identity([]),this.placementViewportMatrix=$.identity([]);let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=zc(this.zoom,t["text-size"]),this.iconSizeData=zc(this.zoom,t["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),a=r.get("symbol-z-order");this.canOverlap="never"!==hn(r,"text-overlap","text-allow-overlap")||"never"!==hn(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==a&&!i.isConstant();let n="viewport-y"===a||"auto"===a&&!this.sortFeaturesByKey;this.sortFeaturesByY=n&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((e=>Be[e]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Xa(new vt(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new Xa(new vt(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new Ca,this.lineVertexArray=new Ma,this.symbolInstances=new Ia}calculateGlyphDependencies(e,t,r,i,a){for(let n=0;n<e.length;n++)if(t[e.charCodeAt(n)]=!0,(r||i)&&a){let r=Xf[e.charAt(n)];r&&(t[r.charCodeAt(0)]=!0)}}populate(e,t,r){let i=this.layers[0],a=i.layout,n=a.get("text-font"),s=a.get("text-field"),o=a.get("icon-image"),l=("constant"!==s.value.kind||s.value.value instanceof st&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==n.value.kind||n.value.value.length>0),u="constant"!==o.value.kind||!!o.value.value||Object.keys(o.parameters).length>0,h=a.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=t.iconDependencies,p=t.glyphDependencies,d=t.availableImages,f=new de(this.zoom);for(let{feature:t,id:s,index:o,sourceLayerIndex:m}of e){let e,y,g=i._featureFilter.needGeometry,_=St(t,g);if(!i._featureFilter.filter(f,_,r))continue;if(g||(_.geometry=wt(t)),l){let t=i.getValueAndResolveTokens("text-field",_,r,d),a=st.factory(t);$S(a)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===sa()||this.hasRTLText&&bt.isParsed())&&(e=Zf(a,i,_))}if(u){let e=i.getValueAndResolveTokens("icon-image",_,r,d);y=e instanceof ut?e:ut.fromString(e)}if(!e&&!y)continue;let x=this.sortFeaturesByKey?h.evaluate(_,{},r):void 0,v={id:s,text:e,icon:y,index:o,sourceLayerIndex:m,geometry:_.geometry,properties:t.properties,type:NS[t.type],sortKey:x};if(this.features.push(v),y&&(c[y.name]=!0),e){let t=n.evaluate(_,{},r).join(","),i="viewport"!==a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Be.vertical)>=0;for(let r of e.sections)if(r.image)c[r.image.name]=!0;else{let a=lc(e.toString()),n=r.fontStack||t,s=p[n]=p[n]||{};this.calculateGlyphDependencies(r.text,s,i,this.allowVerticalPlacement,a)}}}"line"===a.get("symbol-placement")&&(this.features=Wf(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,r){!this.stateDependentLayers.length||(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,r),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,r))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let r=this.lineVertexArray.length;if(void 0!==e.segment){let r=e.dist(t[e.segment+1]),i=e.dist(t[e.segment]),a={};for(let i=e.segment+1;i<t.length;i++)a[i]={x:t[i].x,y:t[i].y,tileUnitDistanceFromAnchor:r},i<t.length-1&&(r+=t[i+1].dist(t[i]));for(let r=e.segment||0;r>=0;r--)a[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:i},r>0&&(i+=t[r-1].dist(t[r]));for(let e=0;e<t.length;e++){let t=a[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,t,r,i,a,n,s,o,l,u,h,c){let p=e.indexArray,d=e.layoutVertexArray,f=e.segments.prepareSegment(4*t.length,d,p,this.canOverlap?n.sortKey:void 0),m=this.glyphOffsetArray.length,y=f.vertexLength,g=this.allowVerticalPlacement&&s===Be.vertical?Math.PI/2:0,_=n.text&&n.text.sections;for(let i=0;i<t.length;i++){let{tl:a,tr:s,bl:l,br:u,tex:h,pixelOffsetTL:m,pixelOffsetBR:y,minFontScaleX:x,minFontScaleY:v,glyphOffset:b,isSDF:w,sectionIndex:S}=t[i],A=f.vertexLength,I=b[1];Ls(d,o.x,o.y,a.x,I+a.y,h.x,h.y,r,w,m.x,m.y,x,v),Ls(d,o.x,o.y,s.x,I+s.y,h.x+h.w,h.y,r,w,y.x,m.y,x,v),Ls(d,o.x,o.y,l.x,I+l.y,h.x,h.y+h.h,r,w,m.x,y.y,x,v),Ls(d,o.x,o.y,u.x,I+u.y,h.x+h.w,h.y+h.h,r,w,y.x,y.y,x,v),yi(e.dynamicLayoutVertexArray,o,g),p.emplaceBack(A,A+1,A+2),p.emplaceBack(A+1,A+2,A+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),(i===t.length-1||S!==t[i+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,n,n.index,{},c,_&&_[S])}e.placedSymbolArray.emplaceBack(o.x,o.y,m,this.glyphOffsetArray.length-m,y,l,u,o.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,h)}_addCollisionDebugVertex(e,t,r,i,a,n){return t.emplaceBack(0,0),e.emplaceBack(r.x,r.y,i,a,Math.round(n.x),Math.round(n.y))}addCollisionDebugVertices(e,t,r,i,a,n,s){let o=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=o.vertexLength,u=a.layoutVertexArray,h=a.collisionVertexArray,c=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,h,n,c,p,new Wa.default(e,t)),this._addCollisionDebugVertex(u,h,n,c,p,new Wa.default(r,t)),this._addCollisionDebugVertex(u,h,n,c,p,new Wa.default(r,i)),this._addCollisionDebugVertex(u,h,n,c,p,new Wa.default(e,i)),o.vertexLength+=4;let d=a.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(e,t,r,i){for(let a=e;a<t;a++){let e=this.collisionBoxArray.get(a),t=e.x1,n=e.y1,s=e.x2,o=e.y2;this.addCollisionDebugVertices(t,n,s,o,i?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ka(ka,Mc.members,zr),this.iconCollisionBox=new Ka(ka,Mc.members,zr);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,r,i,a,n,s,o,l){let u={};for(let i=t;i<r;i++){let t=e.get(i);u.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},u.textFeatureIndex=t.featureIndex;break}for(let t=i;t<a;t++){let r=e.get(t);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let t=n;t<s;t++){let r=e.get(t);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let t=o;t<l;t++){let r=e.get(t);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let r=e.placedSymbolArray.get(t),i=r.vertexStartIndex+4*r.numGlyphs;for(let t=r.vertexStartIndex;t<i;t+=4)e.indexArray.emplaceBack(t,t+1,t+2),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let t=Math.sin(e),r=Math.cos(e),i=[],a=[],n=[];for(let e=0;e<this.symbolInstances.length;++e){n.push(e);let s=this.symbolInstances.get(e);i.push(0|Math.round(t*s.anchorX+r*s.anchorY)),a.push(s.featureIndex)}return n.sort(((e,t)=>i[e]-i[t]||a[t]-a[e])),n}addToSortKeyRanges(e,t){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===t?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach(((e,t,r)=>{e>=0&&r.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)})),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};function sd(e,t){return t.replace(/{([^{}]+)}/g,((t,r)=>r in e?String(e[r]):""))}u(Wt,"SymbolBucket"),N("SymbolBucket",Wt,{omit:["layers","collisionBoxArray","features","compareText"]}),Wt.MAX_GLYPHS=65535,Wt.addDynamicAttributes=yi,d(),u(sd,"resolveTokens"),d();var ld,ud,GS=u((()=>ld=ld||new Ve({"symbol-placement":new H(C.layout_symbol["symbol-placement"]),"symbol-spacing":new H(C.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new H(C.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new W(C.layout_symbol["symbol-sort-key"]),"symbol-z-order":new H(C.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new H(C.layout_symbol["icon-allow-overlap"]),"icon-overlap":new H(C.layout_symbol["icon-overlap"]),"icon-ignore-placement":new H(C.layout_symbol["icon-ignore-placement"]),"icon-optional":new H(C.layout_symbol["icon-optional"]),"icon-rotation-alignment":new H(C.layout_symbol["icon-rotation-alignment"]),"icon-size":new W(C.layout_symbol["icon-size"]),"icon-text-fit":new H(C.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new H(C.layout_symbol["icon-text-fit-padding"]),"icon-image":new W(C.layout_symbol["icon-image"]),"icon-rotate":new W(C.layout_symbol["icon-rotate"]),"icon-padding":new W(C.layout_symbol["icon-padding"]),"icon-keep-upright":new H(C.layout_symbol["icon-keep-upright"]),"icon-offset":new W(C.layout_symbol["icon-offset"]),"icon-anchor":new W(C.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new H(C.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new H(C.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new H(C.layout_symbol["text-rotation-alignment"]),"text-field":new W(C.layout_symbol["text-field"]),"text-font":new W(C.layout_symbol["text-font"]),"text-size":new W(C.layout_symbol["text-size"]),"text-max-width":new W(C.layout_symbol["text-max-width"]),"text-line-height":new H(C.layout_symbol["text-line-height"]),"text-letter-spacing":new W(C.layout_symbol["text-letter-spacing"]),"text-justify":new W(C.layout_symbol["text-justify"]),"text-radial-offset":new W(C.layout_symbol["text-radial-offset"]),"text-variable-anchor":new H(C.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new W(C.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new W(C.layout_symbol["text-anchor"]),"text-max-angle":new H(C.layout_symbol["text-max-angle"]),"text-writing-mode":new H(C.layout_symbol["text-writing-mode"]),"text-rotate":new W(C.layout_symbol["text-rotate"]),"text-padding":new H(C.layout_symbol["text-padding"]),"text-keep-upright":new H(C.layout_symbol["text-keep-upright"]),"text-transform":new W(C.layout_symbol["text-transform"]),"text-offset":new W(C.layout_symbol["text-offset"]),"text-allow-overlap":new H(C.layout_symbol["text-allow-overlap"]),"text-overlap":new H(C.layout_symbol["text-overlap"]),"text-ignore-placement":new H(C.layout_symbol["text-ignore-placement"]),"text-optional":new H(C.layout_symbol["text-optional"])})),"getLayout"),jS=u((()=>ud=ud||new Ve({"icon-opacity":new W(C.paint_symbol["icon-opacity"]),"icon-color":new W(C.paint_symbol["icon-color"]),"icon-halo-color":new W(C.paint_symbol["icon-halo-color"]),"icon-halo-width":new W(C.paint_symbol["icon-halo-width"]),"icon-halo-blur":new W(C.paint_symbol["icon-halo-blur"]),"icon-translate":new H(C.paint_symbol["icon-translate"]),"icon-translate-anchor":new H(C.paint_symbol["icon-translate-anchor"]),"text-opacity":new W(C.paint_symbol["text-opacity"]),"text-color":new W(C.paint_symbol["text-color"],{runtimeType:Rt,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new W(C.paint_symbol["text-halo-color"]),"text-halo-width":new W(C.paint_symbol["text-halo-width"]),"text-halo-blur":new W(C.paint_symbol["text-halo-blur"]),"text-translate":new H(C.paint_symbol["text-translate"]),"text-translate-anchor":new H(C.paint_symbol["text-translate-anchor"])})),"getPaint"),Ds={get paint(){return jS()},get layout(){return GS()}};d();var Ya=class{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Li,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){e(this.defaultValue.value._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};u(Ya,"FormatSectionOverride"),N("FormatSectionOverride",Ya,{omit:["defaultValue"]});var gi=class extends Ze{constructor(e){super(e,Ds)}recalculate(e,t){if(super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){let e=this.layout.get("text-writing-mode");if(e){let t=[];for(let r of e)t.indexOf(r)<0&&t.push(r);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,r,i){let a=this.layout.get(e).evaluate(t,{},r,i),n=this._unevaluatedLayout._values[e];return n.isDataDriven()||ia(n.value)||!a?a:sd(t.properties,a)}createBucket(e){return new Wt(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Ds.paint.overridableProperties){if(!gi.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),r=new Ya(t),i=new ti(r,t.property.specification),a=null;a="constant"===t.value.kind||"source"===t.value.kind?new Ar("source",i):new Ir("composite",i,t.value.zoomStops),this.paint._values[e]=new pt(t.property,a,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,r){return!(!this.layout||t.isDataDriven()||r.isDataDriven())&&gi.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let r=e.get("text-field"),i=Ds.paint.properties[t],a=!1,n=u((e=>{for(let t of e)if(i.overrides&&i.overrides.hasOverride(t))return void(a=!0)}),"checkSections");if("constant"===r.value.kind&&r.value.value instanceof st)n(r.value.value.sections);else if("source"===r.value.kind){let e=u((t=>{if(!a)if(t instanceof Xt&&Ke(t.value)===zi){let e=t.value;n(e.sections)}else t instanceof Jr?n(t.sections):t.eachChild(e)}),"checkExpression"),t=r.value;t._styleExpression&&e(t._styleExpression.expression)}return a}};u(gi,"SymbolStyleLayer"),d(),d();var cd,HS=u((()=>cd=cd||new Ve({"background-color":new H(C.paint_background["background-color"]),"background-pattern":new ai(C.paint_background["background-pattern"]),"background-opacity":new H(C.paint_background["background-opacity"])})),"getPaint"),pd={get paint(){return HS()}},zs=class extends Ze{constructor(e){super(e,pd)}};u(zs,"BackgroundStyleLayer"),d(),d();var hd,ZS=u((()=>hd=hd||new Ve({"raster-opacity":new H(C.paint_raster["raster-opacity"]),"raster-hue-rotate":new H(C.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new H(C.paint_raster["raster-brightness-min"]),"raster-brightness-max":new H(C.paint_raster["raster-brightness-max"]),"raster-saturation":new H(C.paint_raster["raster-saturation"]),"raster-contrast":new H(C.paint_raster["raster-contrast"]),"raster-resampling":new H(C.paint_raster["raster-resampling"]),"raster-fade-duration":new H(C.paint_raster["raster-fade-duration"])})),"getPaint"),md={get paint(){return ZS()}},Fs=class extends Ze{constructor(e){super(e,md)}};function fd(e){let t=[],r=e.id;return void 0===r&&t.push({message:`layers.${r}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${r}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t}u(Fs,"RasterStyleLayer"),d(),u(fd,"validateCustomStyleLayer");var Bs=class extends Ze{constructor(e){super(e,{}),this.onAdd=u((e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}),"onAdd"),this.onRemove=u((e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}),"onRemove"),this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Rs(e){if("custom"===e.type)return new Bs(e);switch(e.type){case"background":return new zs(e);case"circle":return new xs(e);case"fill":return new ws(e);case"fill-extrusion":return new Ts(e);case"heatmap":return new bs(e);case"hillshade":return new vs(e);case"line":return new Is(e);case"raster":return new Fs(e);case"symbol":return new gi(e)}}function mn(e){let t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){let r=[];for(let{id:i,url:a}of e){let e=`${i}${a}`;-1===r.indexOf(e)&&(r.push(e),t.push({id:i,url:a}))}}return t}function dd(e,t,r,i){let a=mn(e),n=a.length,s=r>1?"@2x":"",o={},l={},u={};for(let{id:e,url:r}of a){let a=t.transformRequest(t.normalizeSpriteURL(r,s,".json"),Oe.SpriteJSON),h=`${e}_${a.url}`;o[h]=wr(a,((t,r)=>{delete o[h],l[e]=r,yd(i,l,u,t,n)}));let c=t.transformRequest(t.normalizeSpriteURL(r,s,".png"),Oe.SpriteImage),p=`${e}_${c.url}`;o[p]=mt.getImage(c,((t,r)=>{delete o[p],u[e]=r,yd(i,l,u,t,n)}))}return{cancel(){for(let e of Object.values(o))e.cancel()}}}function yd(e,t,r,i,a){if(i)return void e(i);if(a!==Object.values(t).length||a!==Object.values(r).length)return;let n={};for(let e in t){n[e]={};let i=ne.getImageCanvasContext(r[e]),a=t[e];for(let t in a){let{width:r,height:s,x:o,y:l,sdf:u,pixelRatio:h,stretchX:c,stretchY:p,content:d}=a[t],f={width:r,height:s,x:o,y:l,context:i};n[e][t]={data:null,pixelRatio:h,sdf:u,stretchX:c,stretchY:p,content:d,spriteData:f}}}e(null,n)}u(Bs,"CustomStyleLayer"),u(Rs,"createStyleLayer"),d(),d(),u(mn,"coerceSpriteToArray"),u(dd,"loadSprite"),u(yd,"doOnceCompleted"),d(),d();var xe=class{constructor(e,t,r,i){this.context=e,this.format=r,this.texture=e.gl.createTexture(),this.update(t,i)}update(e,t,r){let{width:i,height:a}=e,n=!(this.size&&this.size[0]===i&&this.size[1]===a||r),{context:s}=this,{gl:o}=s;if(this.useMipmap=Boolean(t&&t.useMipmap),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA&&(!t||!1!==t.premultiply)),n)this.size=[i,a],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Ft(e)?o.texImage2D(o.TEXTURE_2D,0,this.format,this.format,o.UNSIGNED_BYTE,e):o.texImage2D(o.TEXTURE_2D,0,this.format,i,a,0,this.format,o.UNSIGNED_BYTE,e.data);else{let{x:t,y:n}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Ft(e)?o.texSubImage2D(o.TEXTURE_2D,0,t,n,o.RGBA,o.UNSIGNED_BYTE,e):o.texSubImage2D(o.TEXTURE_2D,0,t,n,i,a,o.RGBA,o.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&o.generateMipmap(o.TEXTURE_2D)}bind(e,t,r){let{context:i}=this,{gl:a}=i;a.bindTexture(a.TEXTURE_2D,this.texture),r===a.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(r=a.LINEAR),e!==this.filter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,r||e),this.filter=e),t!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,t),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}};function gd(e){let{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}u(xe,"Texture"),d(),u(gd,"renderStyleImage");var Os=1,Vs=class extends fe{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new Se({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,callback:t}of this.requestors)this._notify(e,t);this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let e=t.spriteData;t.data=new Se({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,t){let r=!0,i=t.data||t.spriteData;return this._validateStretch(t.stretchX,i&&i.width)||(this.fire(new Z(new Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(t.stretchY,i&&i.height)||(this.fire(new Z(new Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(t.content,t)||(this.fire(new Z(new Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let r=0;for(let i of e){if(i[0]<r||i[1]<i[0]||t<i[1])return!1;r=i[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;let r=t.spriteData,i=r&&r.width||t.data.width,a=r&&r.height||t.data.height;return!(e[0]<0||i<e[0]||e[1]<0||a<e[1]||e[2]<0||i<e[2]||e[3]<0||a<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,r=!0){let i=this.getImage(e);if(r&&(i.data.width!==t.data.width||i.data.height!==t.data.height))throw new Error(`size mismatch between old image (${i.data.width}x${i.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=i.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e,t){let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?this._notify(e,t):this.requestors.push({ids:e,callback:t})}_notify(e,t){let r={};for(let t of e){let e=this.getImage(t);e||(this.fire(new z("styleimagemissing",{id:t})),e=this.getImage(t)),e?r[t]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:Me(`Image "${t}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}t(null,r)}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let t=this.patterns[e],r=this.getImage(e);if(!r)return null;if(t&&t.position.version===r.version)return t.position;if(t)t.position.version=r.version;else{let t={w:r.data.width+2*Os,h:r.data.height+2*Os,x:0,y:0},i=new cn(t,r);this.patterns[e]={bin:t,position:i}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new xe(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let t in this.patterns)e.push(this.patterns[t].bin);let{w:t,h:r}=Ha(e),i=this.atlasImage;i.resize({width:t||1,height:r||1});for(let e in this.patterns){let{bin:t}=this.patterns[e],r=t.x+Os,a=t.y+Os,n=this.getImage(e).data,s=n.width,o=n.height;Se.copy(n,i,{x:0,y:0},{x:r,y:a},{width:s,height:o}),Se.copy(n,i,{x:0,y:o-1},{x:r,y:a-1},{width:s,height:1}),Se.copy(n,i,{x:0,y:0},{x:r,y:a+o},{width:s,height:1}),Se.copy(n,i,{x:s-1,y:0},{x:r-1,y:a},{width:1,height:o}),Se.copy(n,i,{x:0,y:0},{x:r+s,y:a},{width:1,height:o})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this.callbackDispatchedThisFrame[t])continue;this.callbackDispatchedThisFrame[t]=!0;let e=this.getImage(t);e||Me(`Image with ID: "${t}" was not found`),gd(e)&&this.updateImage(t,e)}}};function xd(e,t,r,i,a){let n=256*t,s=n+255,o=i.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${n}-${s}`),Oe.Glyphs);Po(o,((e,t)=>{if(e)a(e);else if(t){let e={};for(let r of nd(t))e[r.id]=r;a(null,e)}}))}u(Vs,"ImageManager"),d(),d(),u(xd,"loadGlyphRange"),d();var Ja=1e20,Qa=class{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:i=.25,fontFamily:a="sans-serif",fontWeight:n="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=i,this.radius=r;let o=this.size=e+4*t,l=this._createCanvas(o),u=this.ctx=l.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${n} ${e}px ${a}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(o*o),this.gridInner=new Float64Array(o*o),this.f=new Float64Array(o),this.z=new Float64Array(o+1),this.v=new Uint16Array(o)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:a,actualBoundingBoxRight:n}=this.ctx.measureText(e),s=Math.ceil(r),o=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(n-a))),l=Math.min(this.size-this.buffer,s+Math.ceil(i)),u=o+2*this.buffer,h=l+2*this.buffer,c=Math.max(u*h,0),p=new Uint8ClampedArray(c),d={data:p,width:u,height:h,glyphWidth:o,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===o||0===l)return d;let{ctx:f,buffer:m,gridInner:y,gridOuter:g}=this;f.clearRect(m,m,o,l),f.fillText(e,m,m+s);let _=f.getImageData(m,m,o,l);g.fill(Ja,0,c),y.fill(0,0,c);for(let e=0;e<l;e++)for(let t=0;t<o;t++){let r=_.data[4*(e*o+t)+3]/255;if(0===r)continue;let i=(e+m)*u+t+m;if(1===r)g[i]=0,y[i]=Ja;else{let e=.5-r;g[i]=e>0?e*e:0,y[i]=e<0?e*e:0}}_d(g,0,0,u,h,u,this.f,this.v,this.z),_d(y,m,m,o,l,u,this.f,this.v,this.z);for(let e=0;e<c;e++){let t=Math.sqrt(g[e])-Math.sqrt(y[e]);p[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return d}};function _d(e,t,r,i,a,n,s,o,l){for(let u=t;u<t+i;u++)bd(e,r*n+u,n,a,s,o,l);for(let u=r;u<r+a;u++)bd(e,u*n+t,1,i,s,o,l)}function bd(e,t,r,i,a,n,s){n[0]=0,s[0]=-Ja,s[1]=Ja,a[0]=e[t];for(let o=1,l=0,u=0;o<i;o++){a[o]=e[t+o*r];let i=o*o;do{let e=n[l];u=(a[o]-a[e]+i-e*e)/(o-e)/2}while(u<=s[l]&&--l>-1);l++,n[l]=o,s[l]=u,s[l+1]=Ja}for(let o=0,l=0;o<i;o++){for(;s[l+1]<o;)l++;let i=n[l],u=o-i;e[t+o*r]=a[i]+u*u}}u(Qa,"TinySDF"),u(_d,"edt"),u(bd,"edt1d");var Us=class{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}getGlyphs(e,t){let r=[];for(let t in e)for(let i of e[t])r.push({stack:t,id:i});_o(r,(({stack:e,id:t},r)=>{let i=this.entries[e];i||(i=this.entries[e]={glyphs:{},requests:{},ranges:{}});let a=i.glyphs[t];if(void 0!==a)return void r(null,{stack:e,id:t,glyph:a});if(a=this._tinySDF(i,e,t),a)return i.glyphs[t]=a,void r(null,{stack:e,id:t,glyph:a});let n=Math.floor(t/256);if(256*n>65535)return void r(new Error("glyphs > 65535 not supported"));if(i.ranges[n])return void r(null,{stack:e,id:t,glyph:a});if(!this.url)return void r(new Error("glyphsUrl is not set"));let s=i.requests[n];s||(s=i.requests[n]=[],Us.loadGlyphRange(e,n,this.url,this.requestManager,((e,t)=>{if(t){for(let e in t)this._doesCharSupportLocalGlyph(+e)||(i.glyphs[+e]=t[+e]);i.ranges[n]=!0}for(let r of s)r(e,t);delete i.requests[n]}))),s.push(((i,a)=>{i?r(i):a&&r(null,{stack:e,id:t,glyph:a[t]||null})}))}),((e,r)=>{if(e)t(e);else if(r){let e={};for(let{stack:t,id:i,glyph:a}of r)(e[t]||(e[t]={}))[i]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.metrics};t(null,e)}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(he["CJK Unified Ideographs"](e)||he["Hangul Syllables"](e)||he.Hiragana(e)||he.Katakana(e))}_tinySDF(e,t,r){let i=this.localIdeographFontFamily;if(!i||!this._doesCharSupportLocalGlyph(r))return;let a=e.tinySDF;if(!a){let r="400";/bold/i.test(t)?r="900":/medium/i.test(t)?r="500":/light/i.test(t)&&(r="200"),a=e.tinySDF=new Us.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:i,fontWeight:r})}let n=a.draw(String.fromCharCode(r));return{id:r,bitmap:new fr({width:n.width||30,height:n.height||30},n.data),metrics:{width:n.glyphWidth||24,height:n.glyphHeight||24,left:n.glyphLeft||0,top:n.glyphTop-27||-8,advance:n.glyphAdvance||24}}}},fn=Us;u(fn,"GlyphManager"),fn.loadGlyphRange=xd,fn.TinySDF=Qa,d();var Fc=class{constructor(){this.specification=C.light.position}possiblyEvaluate(e,t){return Up(e.expression.evaluate(t))}interpolate(e,t,r){return{x:Le.number(e.x,t.x,r),y:Le.number(e.y,t.y,r),z:Le.number(e.z,t.z,r)}}};u(Fc,"LightPositionProperty");var Bc,vd="-transition",Ns=class extends fe{constructor(e){super(),Bc=Bc||new Ve({anchor:new H(C.light.anchor),position:new Fc,color:new H(C.light.color),intensity:new H(C.light.intensity)}),this._transitionable=new Yi(Bc),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(Xh,e,t))for(let t in e){let r=e[t];t.endsWith(vd)?this._transitionable.setTransition(t.slice(0,-vd.length),r):this._transitionable.setValue(t,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,r){return(!r||!1!==r.validate)&&Hi(this,e.call(He,R({value:t,style:{glyphs:!0,sprite:!0},styleSpec:C})))}};u(Ns,"Light"),d();var qs=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let r=e.join(",")+String(t);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,r){let i=[],a=e.length%2==1?-e[e.length-1]*r:0,n=e[0]*r,s=!0;i.push({left:a,right:n,isDash:s,zeroLength:0===e[0]});let o=e[0];for(let t=1;t<e.length;t++){s=!s;let l=e[t];a=o*r,o+=l,n=o*r,i.push({left:a,right:n,isDash:s,zeroLength:0===l})}return i}addRoundDash(e,t,r){let i=t/2;for(let t=-r;t<=r;t++){let a=this.nextRow+r+t,n=this.width*a,s=0,o=e[s];for(let a=0;a<this.width;a++){a/o.right>1&&(o=e[++s]);let l,u=Math.abs(a-o.left),h=Math.abs(a-o.right),c=Math.min(u,h),p=t/r*(i+1);if(o.isDash){let e=i-Math.abs(p);l=Math.sqrt(c*c+e*e)}else l=i-Math.sqrt(c*c+p*p);this.data[n+a]=Math.max(0,Math.min(255,l+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let r=e[t],i=e[t+1];r.zeroLength?e.splice(t,1):i&&i.isDash===r.isDash&&(i.left=r.left,e.splice(t,1))}let t=e[0],r=e[e.length-1];t.isDash===r.isDash&&(t.left=r.left-this.width,r.right=t.right+this.width);let i=this.width*this.nextRow,a=0,n=e[a];for(let t=0;t<this.width;t++){t/n.right>1&&(n=e[++a]);let r=Math.abs(t-n.left),s=Math.abs(t-n.right),o=Math.min(r,s),l=n.isDash?o:-o;this.data[i+t]=Math.max(0,Math.min(255,l+128))}}addDash(e,t){let r=t?7:0,i=2*r+1;if(this.nextRow+i>this.height)return Me("LineAtlas out of space"),null;let a=0;for(let t=0;t<e.length;t++)a+=e[t];if(0!==a){let i=this.width/a,n=this.getDashRanges(e,this.width,i);t?this.addRoundDash(n,i,r):this.addRegularDash(n)}let n={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:a};return this.nextRow+=i,this.dirty=!0,n}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};u(qs,"LineAtlas"),d(),d(),d();var $s=class{constructor(e){this._callback=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}};u($s,"ThrottledInvoker");var Gs=class{constructor(e,t,r){this.receive=u((e=>{let t=e.data,r=t.id;if(r&&(!t.targetMapId||this.mapId===t.targetMapId))if("<cancel>"===t.type){delete this.tasks[r];let e=this.cancelCallbacks[r];delete this.cancelCallbacks[r],e&&e()}else xt()||t.mustQueue?(this.tasks[r]=t,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,t)}),"receive"),this.process=u((()=>{if(!this.taskQueue.length)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),t&&this.processTask(e,t)}),"process"),this.target=e,this.parent=t,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new $s(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=xt()?e:window}send(e,t,r,i,a=!1){let n=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[n]=r);let s=Xr(this.globalScope)?void 0:[];return this.target.postMessage({id:n,type:e,hasCallback:!!r,targetMapId:i,mustQueue:a,sourceMapId:this.mapId,data:Zi(t,s)},s),{cancel:()=>{r&&delete this.callbacks[n],this.target.postMessage({id:n,type:"<cancel>",targetMapId:i,sourceMapId:this.mapId})}}}processTask(e,t){if("<response>"===t.type){let r=this.callbacks[e];delete this.callbacks[e],r&&(t.error?r(Wi(t.error)):r(null,Wi(t.data)))}else{let r=!1,i=Xr(this.globalScope)?void 0:[],a=t.hasCallback?(t,a)=>{r=!0,delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:t?Zi(t):null,data:Zi(a,i)},i)}:e=>{r=!0},n=null,s=Wi(t.data);if(this.parent[t.type])n=this.parent[t.type](t.sourceMapId,s,a);else if(this.parent.getWorkerSource){let e=t.type.split(".");n=this.parent.getWorkerSource(t.sourceMapId,e[0],s.source)[e[1]](s,a)}else a(new Error(`Could not find function ${t.type}`));!r&&n&&n.cancel&&(this.cancelCallbacks[e]=n.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}};u(Gs,"Actor");var xi=class{constructor(e,t,r){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=r;let i=this.workerPool.acquire(r);for(let e=0;e<i.length;e++){let a=i[e],n=new xi.Actor(a,t,r);n.name=`Worker ${e}`,this.actors.push(n)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t,r){r=r||function(){},_o(this.actors,((r,i)=>{r.send(e,t,i)}),r)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach((e=>{e.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}};function js(e,t,r){let i=u((function(t,i){if(t)return r(t);if(i){let t=Gt(R(i,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);i.vector_layers&&(t.vectorLayers=i.vector_layers,t.vectorLayerIds=t.vectorLayers.map((e=>e.id))),r(null,t)}}),"loaded");return e.url?wr(t.transformRequest(e.url,Oe.Source),i):ne.frame((()=>i(null,e)))}u(xi,"Dispatcher"),xi.Actor=Gs,d(),d(),d(),u(js,"loadTileJson"),d(),d(),d();var _i=6371008.8,K=class{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new K(nr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,r=this.lat*t,i=e.lat*t,a=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((e.lng-this.lng)*t);return _i*Math.acos(Math.min(a,1))}static convert(e){if(e instanceof K)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new K(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new K(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};u(K,"LngLat");var Qe=class{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof K?new K(e.lng,e.lat):K.convert(e),this}setSouthWest(e){return this._sw=e instanceof K?new K(e.lng,e.lat):K.convert(e),this}extend(e){let t,r,i=this._sw,a=this._ne;if(e instanceof K)t=e,r=e;else{if(!(e instanceof Qe)){if(Array.isArray(e)){if(4===e.length||e.every(Array.isArray)){let t=e;return this.extend(Qe.convert(t))}{let t=e;return this.extend(K.convert(t))}}return e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(K.convert(e)):this}if(t=e._sw,r=e._ne,!t||!r)return this}return i||a?(i.lng=Math.min(t.lng,i.lng),i.lat=Math.min(t.lat,i.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new K(t.lng,t.lat),this._ne=new K(r.lng,r.lat)),this}getCenter(){return new K((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new K(this.getWest(),this.getNorth())}getSouthEast(){return new K(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:t,lat:r}=K.convert(e),i=this._sw.lat<=r&&r<=this._ne.lat,a=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=t&&t>=this._ne.lng),i&&a}static convert(e){return e instanceof Qe||!e?e:new Qe(e)}static fromLngLat(e,t=0){let r=360*t/40075017,i=r/Math.cos(Math.PI/180*e.lat);return new Qe(new K(e.lng-i,e.lat-r),new K(e.lng+i,e.lat+r))}};u(Qe,"LngLatBounds"),d();var wd=2*Math.PI*_i;function Sd(e){return wd*Math.cos(e*Math.PI/180)}function Vr(e){return(180+e)/360}function Ur(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Rc(e,t){return e/Sd(t)}function WS(e){return 360*e-180}function Oc(e){let t=180-360*e;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function XS(e,t){return e*Sd(Oc(t))}function KS(e){return 1/Math.cos(e*Math.PI/180)}u(Sd,"circumferenceAtLatitude"),u(Vr,"mercatorXfromLng"),u(Ur,"mercatorYfromLat"),u(Rc,"mercatorZfromAltitude"),u(WS,"lngFromMercatorX"),u(Oc,"latFromMercatorY"),u(XS,"altitudeFromMercatorZ"),u(KS,"mercatorScale");var Ee=class{constructor(e,t,r=0){this.x=+e,this.y=+t,this.z=+r}static fromLngLat(e,t=0){let r=K.convert(e);return new Ee(Vr(r.lng),Ur(r.lat),Rc(t,r.lat))}toLngLat(){return new K(WS(this.x),Oc(this.y))}toAltitude(){return XS(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/wd*KS(Oc(this.y))}};u(Ee,"MercatorCoordinate");var dn=class{constructor(e,t,r){this.bounds=Qe.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let t=Math.pow(2,e.z),r=Math.floor(Vr(this.bounds.getWest())*t),i=Math.floor(Ur(this.bounds.getNorth())*t),a=Math.ceil(Vr(this.bounds.getEast())*t),n=Math.ceil(Ur(this.bounds.getSouth())*t);return e.x>=r&&e.x<a&&e.y>=i&&e.y<n}};u(dn,"TileBounds");var yn=class extends fe{constructor(e,t,r,i){if(super(),this.load=u((()=>{this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this._tileJSONRequest=js(this._options,this.map._requestManager,((e,t)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new Z(e)):t&&(R(this,t),t.bounds&&(this.tileBounds=new dn(t.bounds,this.minzoom,this.maxzoom)),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})))}))}),"load"),this.serialize=u((()=>R({},this._options)),"serialize"),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,R(this,Gt(t,["url","scheme","tileSize","promoteId"])),this._options=R({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(i)}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.cancel(),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(e,t){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(r,Oe.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function a(r,i){return delete e.request,e.aborted?t(null):r&&404!==r.status?t(r):(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),t(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}i.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=t:e.request=e.actor.send("reloadTile",i,a.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",i,a.bind(this))),u(a,"done")}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id},void 0)}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}};u(yn,"VectorTileSource"),d();var Vc,Nr=class extends fe{constructor(e,t,r,i){super(),this.id=e,this.dispatcher=r,this.setEventedParent(i),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=R({type:"raster"},t),R(this,Gt(t,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this._tileJSONRequest=js(this._options,this.map._requestManager,((e,t)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new Z(e)):t&&(R(this,t),t.bounds&&(this.tileBounds=new dn(t.bounds,this.minzoom,this.maxzoom)),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return R({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,t){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=mt.getImage(this.map._requestManager.transformRequest(r,Oe.Tile),((r,i,a)=>{if(delete e.request,e.aborted)e.state="unloaded",t(null);else if(r)e.state="errored",t(r);else if(i){this.map._refreshExpiredTiles&&a&&e.setExpiryData(a);let r=this.map.painter.context,n=r.gl;e.texture=this.map.painter.getTileTexture(i.width),e.texture?e.texture.update(i,{useMipmap:!0}):(e.texture=new xe(r,i,n.RGBA,{useMipmap:!0}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),r.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax)),e.state="loaded",t(null)}}),this.map._refreshExpiredTiles)}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t()}unloadTile(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}hasTransition(){return!1}};function Pd(){return null==Vc&&(Vc="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),Vc}function Td(e,t,r){var i=Ad(256*e,256*(t=Math.pow(2,r)-t-1),r),a=Ad(256*(e+1),256*(t+1),r);return i[0]+","+i[1]+","+a[0]+","+a[1]}function Ad(e,t,r){var i=2*Math.PI*6378137/256/Math.pow(2,r);return[e*i-2*Math.PI*6378137/2,t*i-2*Math.PI*6378137/2]}u(Nr,"RasterTileSource"),d(),d(),u(Pd,"offscreenCanvasSupported"),d(),d(),u(Td,"getTileBBox"),u(Ad,"getMercCoords");var Id=ae(Pe()),gn=class{constructor(e,t,r){if(e<0||e>25||r<0||r>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))throw new Error(`x=${t}, y=${r}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=t,this.y=r,this.key=eo(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,r){let i=Td(this.x,this.y,this.z),a=YS(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,a).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=Math.pow(2,this.z);return new Id.default((e.x*t-this.x)*O,(e.y*t-this.y)*O)}toString(){return`${this.z}/${this.x}/${this.y}`}};u(gn,"CanonicalTileID");var xn=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=eo(e,t.z,t.z,t.x,t.y)}};u(xn,"UnwrappedTileID");var De=class{constructor(e,t,r,i,a){if(e<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${r}`);this.overscaledZ=e,this.wrap=t,this.canonical=new gn(r,+i,+a),this.key=eo(t,e,r,i,a)}clone(){return new De(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let t=this.canonical.z-e;return e>this.canonical.z?new De(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new De(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?eo(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):eo(this.wrap*+t,e,e,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new De(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,r=2*this.canonical.x,i=2*this.canonical.y;return[new De(t,this.wrap,t,r,i),new De(t,this.wrap,t,r+1,i),new De(t,this.wrap,t,r,i+1),new De(t,this.wrap,t,r+1,i+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new De(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new De(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new xn(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Ee(e.x-this.wrap,e.y))}};function eo(e,t,r,i,a){(e*=2)<0&&(e=-1*e-1);let n=1<<r;return(n*n*e+n*a+i).toString(36)+r.toString(36)+t.toString(36)}function YS(e,t,r){let i,a="";for(let n=e;n>0;n--)i=1<<n-1,a+=(t&i?1:0)+(r&i?2:0);return a}u(De,"OverscaledTileID"),u(eo,"calculateKey"),u(YS,"getQuadkey"),N("CanonicalTileID",gn),N("OverscaledTileID",De,{omit:["posMatrix"]}),d();var Uc=class{constructor(e,t,r){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return void Me(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;let i=this.dim=t.height-2;this.data=new Uint32Array(t.data.buffer),this.encoding=r||"mapbox";for(let e=0;e<i;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(i,e)]=this.data[this._idx(i-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,i)]=this.data[this._idx(e,i-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(i,-1)]=this.data[this._idx(i-1,0)],this.data[this._idx(-1,i)]=this.data[this._idx(0,i-1)],this.data[this._idx(i,i)]=this.data[this._idx(i-1,i-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let e=0;e<i;e++)for(let t=0;t<i;t++){let r=this.get(e,t);r>this.max&&(this.max=r),r<this.min&&(this.min=r)}}get(e,t){let r=new Uint8Array(this.data.buffer),i=4*this._idx(e,t);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(r[i],r[i+1],r[i+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}_unpackMapbox(e,t,r){return(256*e*256+256*t+r)/10-1e4}_unpackTerrarium(e,t,r){return 256*e+t+r/256-32768}getPixels(){return new Se({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,r){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=t*this.dim,a=t*this.dim+this.dim,n=r*this.dim,s=r*this.dim+this.dim;switch(t){case-1:i=a-1;break;case 1:a=i+1}switch(r){case-1:n=s-1;break;case 1:s=n+1}let o=-t*this.dim,l=-r*this.dim;for(let t=n;t<s;t++)for(let r=i;r<a;r++)this.data[this._idx(r,t)]=e.data[this._idx(r+o,t+l)]}};u(Uc,"DEMData"),N("DEMData",Uc);var _n=class extends Nr{constructor(e,t,r,i){super(e,t,r,i),this.type="raster-dem",this.maxzoom=22,this._options=R({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,t){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function i(r,i){if(delete e.request,e.aborted)e.state="unloaded",t(null);else if(r)e.state="errored",t(r);else if(i){this.map._refreshExpiredTiles&&e.setExpiryData(i),delete i.cacheControl,delete i.expires;let t=Ft(i)&&Pd()?i:ne.getImageData(i,1),r={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:t,encoding:this.encoding};(!e.actor||"expired"===e.state)&&(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",r,a.bind(this)))}}function a(r,i){r&&(e.state="errored",t(r)),i&&(e.dem=i,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",t(null))}e.request=mt.getImage(this.map._requestManager.transformRequest(r,Oe.Tile),i.bind(this),this.map._refreshExpiredTiles),e.neighboringTiles=this._getNeighboringTiles(e.tileID),u(i,"imageLoaded"),u(a,"done")}_getNeighboringTiles(e){let t=e.canonical,r=Math.pow(2,t.z),i=(t.x-1+r)%r,a=0===t.x?e.wrap-1:e.wrap,n=(t.x+1+r)%r,s=t.x+1===r?e.wrap+1:e.wrap,o={};return o[new De(e.overscaledZ,a,t.z,i,t.y).key]={backfilled:!1},o[new De(e.overscaledZ,s,t.z,n,t.y).key]={backfilled:!1},t.y>0&&(o[new De(e.overscaledZ,a,t.z,i,t.y-1).key]={backfilled:!1},o[new De(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},o[new De(e.overscaledZ,s,t.z,n,t.y-1).key]={backfilled:!1}),t.y+1<r&&(o[new De(e.overscaledZ,a,t.z,i,t.y+1).key]={backfilled:!1},o[new De(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},o[new De(e.overscaledZ,s,t.z,n,t.y+1).key]={backfilled:!1}),o}unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&e.actor.send("removeDEMTile",{uid:e.uid,source:this.id})}};u(_n,"RasterDEMTileSource"),d();var bn=class extends fe{constructor(e,t,r,i){super(),this.load=u((()=>{this._updateWorkerData()}),"load"),this.serialize=u((()=>R({},this._options,{type:this.type,data:this._data})),"serialize"),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=r.getActor(),this.setEventedParent(i),this._data=t.data,this._options=R({},t),this._collectResourceTiming=t.collectResourceTiming,void 0!==t.maxzoom&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;let a=O/this.tileSize;this.workerOptions=R({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(void 0!==t.buffer?t.buffer:128)*a,tolerance:(void 0!==t.tolerance?t.tolerance:.375)*a,extent:O,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:void 0!==t.clusterMaxZoom?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:O,radius:(t.clusterRadius||50)*a,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(void 0!==e.clusterRadius&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),void 0!==e.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},t),this}getClusterChildren(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},t),this}getClusterLeaves(e,t,r,i){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:t,offset:r},i),this}_updateWorkerData(e){let t=R({},this.workerOptions);e?t.dataDiff=e:"string"==typeof this._data?(t.request=this.map._requestManager.transformRequest(ne.resolveURL(this._data),Oe.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new z("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,t,((e,t)=>{if(this._pendingLoads--,this._removed||t&&t.abandoned)return void this.fire(new z("dataabort",{dataType:"source"}));let r=null;if(t&&t.resourceTiming&&t.resourceTiming[this.id]&&(r=t.resourceTiming[this.id].slice(0)),e)return void this.fire(new Z(e));let i={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&R(i,{resourceTiming:r}),this.fire(new z("data",{...i,sourceDataType:"metadata"})),this.fire(new z("data",{...i,sourceDataType:"content"}))}))}loaded(){return 0===this._pendingLoads}loadTile(e,t){let r=e.actor?"reloadTile":"loadTile";e.actor=this.actor;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.request=this.actor.send(r,i,((i,a)=>(delete e.request,e.unloadVectorData(),e.aborted?t(null):i?t(i):(e.loadVectorData(a,this.map.painter,"reloadTile"===r),t(null)))))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}};u(bn,"GeoJSONSource"),d(),d(),d();var qr=ve([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),Lt=class extends fe{constructor(e,t,r,i){super(),this.load=u(((e,t)=>{this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=mt.getImage(this.map._requestManager.transformRequest(this.url,Oe.Image),((r,i)=>{this._request=null,this._loaded=!0,r?this.fire(new Z(r)):i&&(this.image=i,e&&(this.coordinates=e),t&&t(),this._finishLoading())}))}),"load"),this.prepare=u((()=>{if(0===Object.keys(this.tiles).length||!this.image)return;let e=this.map.painter.context,t=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=le.simpleSegment(0,0,4,2)),this.texture||(this.texture=new xe(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}),"prepare"),this.serialize=u((()=>({type:"image",url:this.options.url,coordinates:this.coordinates})),"serialize"),this.id=e,this.dispatcher=r,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=t}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=e.url,this.load(e.coordinates,(()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(e){this.coordinates=e;let t=e.map(Ee.fromLngLat);this.tileID=JS(t),this.minzoom=this.maxzoom=this.tileID.z;let r=t.map((e=>this.tileID.getTilePoint(e)._round()));return this._boundsArray=new tn,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,O,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,O),this._boundsArray.emplaceBack(r[2].x,r[2].y,O,O),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}hasTransition(){return!1}};function JS(e){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let n of e)t=Math.min(t,n.x),r=Math.min(r,n.y),i=Math.max(i,n.x),a=Math.max(a,n.y);let n=i-t,s=a-r,o=Math.max(n,s),l=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),u=Math.pow(2,l);return new gn(l,Math.floor((t+i)/2*u),Math.floor((r+a)/2*u))}u(Lt,"ImageSource"),u(JS,"getCoordinatesCenterTileID");var vn=class extends Lt{constructor(e,t,r,i){super(e,t,r,i),this.load=u((()=>{this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,Oe.Source).url);Hp(this.urls,((e,t)=>{this._loaded=!0,e?this.fire(new Z(e)):t&&(this.video=t,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}),"load"),this.prepare=u((()=>{if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=le.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new xe(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}),"prepare"),this.serialize=u((()=>({type:"video",urls:this.urls,coordinates:this.coordinates})),"serialize"),this.roundZoom=!0,this.type="video",this.options=t}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new Z(new U(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}};u(vn,"VideoSource"),d();var wn=class extends Lt{constructor(e,t,r,i){super(e,t,r,i),this.load=u((()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new Z(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}),"load"),this.prepare=u((()=>{let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let t=this.map.painter.context,r=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,qr.members)),this.boundsSegments||(this.boundsSegments=le.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new xe(t,this.canvas,r.RGBA,{premultiply:!0});let i=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,i=!0)}i&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}),"prepare"),this.serialize=u((()=>({type:"canvas",coordinates:this.coordinates})),"serialize"),t.coordinates?(!Array.isArray(t.coordinates)||4!==t.coordinates.length||t.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e)))))&&this.fire(new Z(new U(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new Z(new U(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&"boolean"!=typeof t.animate&&this.fire(new Z(new U(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?"string"!=typeof t.canvas&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new Z(new U(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new Z(new U(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t,this.animate=void 0===t.animate||t.animate}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};u(wn,"CanvasSource");var Cd={},Md=u(((e,t,r,i)=>{let a=new(Nc(t.type))(e,t,r,i);if(a.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${a.id}`);return a}),"create"),Nc=u((e=>{switch(e){case"geojson":return bn;case"image":return Lt;case"raster":return Nr;case"raster-dem":return _n;case"vector":return yn;case"video":return vn;case"canvas":return wn}return Cd[e]}),"getSourceType"),Ed=u(((e,t)=>{Cd[e]=t}),"setSourceType");function QS(e,t){let r=$.create();return $.translate(r,r,[1,1,0]),$.scale(r,r,[.5*e.width,.5*e.height,1]),$.multiply(r,r,e.calculatePosMatrix(t.toUnwrapped()))}function eP(e,t,r){if(e)for(let i of e){let e=t[i];if(e&&e.source===r&&"fill-extrusion"===e.type)return!0}else for(let e in t){let i=t[e];if(i.source===r&&"fill-extrusion"===i.type)return!0}return!1}function kd(e,t,r,i,a,n){let s=eP(a&&a.layers,t,e.id),o=n.maxPitchScaleFactor(),l=e.tilesIn(i,o,s);l.sort(zd);let u=[];for(let i of l)u.push({wrappedTileID:i.tileID.wrapped().key,queryResults:i.tile.queryRenderedFeatures(t,r,e._state,i.queryGeometry,i.cameraQueryGeometry,i.scale,a,n,o,QS(e.transform,i.tileID))});let h=tP(u);for(let t in h)h[t].forEach((t=>{let r=t.feature,i=e.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=i}));return h}function Ld(e,t,r,i,a,n,s){let o={},l=n.queryRenderedSymbols(i),u=[];for(let e of Object.keys(l).map(Number))u.push(s[e]);u.sort(zd);for(let r of u){let i=r.featureIndex.lookupSymbolFeatures(l[r.bucketInstanceId],t,r.bucketIndex,r.sourceLayerIndex,a.filter,a.layers,a.availableImages,e);for(let e in i){let t=o[e]=o[e]||[],a=i[e];a.sort(((e,t)=>{let i=r.featureSortOrder;if(i){let r=i.indexOf(e.featureIndex);return i.indexOf(t.featureIndex)-r}return t.featureIndex-e.featureIndex}));for(let e of a)t.push(e)}}for(let t in o)o[t].forEach((i=>{let a=i.feature,n=e[t],s=r[n.source].getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.state=s}));return o}function Dd(e,t){let r=e.getRenderableIds().map((t=>e.getTileByID(t))),i=[],a={};for(let e=0;e<r.length;e++){let n=r[e],s=n.tileID.canonical.key;a[s]||(a[s]=!0,n.querySourceFeatures(i,t))}return i}function zd(e,t){let r=e.tileID,i=t.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function tP(e){let t={},r={};for(let i of e){let e=i.queryResults,a=i.wrappedTileID,n=r[a]=r[a]||{};for(let r in e){let i=e[r],a=n[r]=n[r]||{},s=t[r]=t[r]||[];for(let e of i)a[e.featureIndex]||(a[e.featureIndex]=!0,s.push(e))}}return t}function Fd(e,t){let r={};if(!t)return r;for(let i of e){let e=i.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(0!==e.length){i.layers=e,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(let t of e)r[t.id]=i}}return r}d(),u(QS,"getPixelPosMatrix"),u(eP,"queryIncludes3DLayer"),u(kd,"queryRenderedFeatures"),u(Ld,"queryRenderedSymbols"),u(Dd,"querySourceFeatures"),u(zd,"sortTilesIn"),u(tP,"mergeRenderedFeatureLayers"),d(),d(),d(),u(Fd,"deserialize"),d(),d();var Hs=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}};u(Hs,"DictionaryCoder");var Bd=ae(Na()),Rd=ae(Lc());d();var Sn=class{constructor(e,t,r,i,a){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=r,e._y=i,this.properties=e.properties,this.id=a}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)"_geometry"===t||"_vectorTileFeature"===t||(e[t]=this[t]);return e}};u(Sn,"GeoJSONFeature");var qc=class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new cr(O,16,0),this.grid3D=new cr(O,16,0),this.featureIndexArray=new Ea,this.promoteId=t}insert(e,t,r,i,a,n){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,a);let o=n?this.grid3D:this.grid;for(let e=0;e<t.length;e++){let r=t[e],i=[1/0,1/0,-1/0,-1/0];for(let e=0;e<r.length;e++){let t=r[e];i[0]=Math.min(i[0],t.x),i[1]=Math.min(i[1],t.y),i[2]=Math.max(i[2],t.x),i[3]=Math.max(i[3],t.y)}i[0]<O&&i[1]<O&&i[2]>=0&&i[3]>=0&&o.insert(s,i[0],i[1],i[2],i[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Bd.default.VectorTile(new Rd.default(this.rawTileData)).layers,this.sourceLayerCoder=new Hs(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,r,i){this.loadVTLayers();let a=e.params||{},n=O/e.tileSize/e.scale,s=na(a.filter),o=e.queryGeometry,l=e.queryPadding*n,u=Vd(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=Vd(e.cameraQueryGeometry),p=this.grid3D.query(c.minX-l,c.minY-l,c.maxX+l,c.maxY+l,((t,r,i,a)=>vm(e.cameraQueryGeometry,t-l,r-l,i+l,a+l)));for(let e of p)h.push(e);h.sort(rP);let d,f={};for(let l=0;l<h.length;l++){let u=h[l];if(u===d)continue;d=u;let c=this.featureIndexArray.get(u),p=null;this.loadMatchingFeature(f,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,s,a.layers,a.availableImages,t,r,i,((t,r,i)=>(p||(p=wt(t)),r.queryIntersectsFeature(o,t,i,p,this.z,e.transform,n,e.pixelPosMatrix))))}return f}loadMatchingFeature(e,t,r,i,a,n,s,o,l,u,h){let c=this.bucketLayerIDs[t];if(n&&!Bp(n,c))return;let p=this.sourceLayerCoder.decode(r),d=this.vtLayers[p].feature(i);if(a.needGeometry){let e=St(d,!0);if(!a.filter(new de(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!a.filter(new de(this.tileID.overscaledZ),d))return;let f=this.getId(d,p);for(let t=0;t<c.length;t++){let r=c[t];if(n&&n.indexOf(r)<0)continue;let a=o[r];if(!a)continue;let p={};f&&u&&(p=u.getState(a.sourceLayer||"_geojsonTileLayer",f));let m=R({},l[r]);m.paint=Od(m.paint,a.paint,d,p,s),m.layout=Od(m.layout,a.layout,d,p,s);let y=!h||h(d,a,p);if(!y)continue;let g=new Sn(d,this.z,this.x,this.y,f);g.layer=m;let _=e[r];void 0===_&&(_=e[r]=[]),_.push({featureIndex:i,feature:g,intersectionZ:y})}}lookupSymbolFeatures(e,t,r,i,a,n,s,o){let l={};this.loadVTLayers();let u=na(a);for(let a of e)this.loadMatchingFeature(l,r,i,a,u,n,s,o,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let r of t)if(e===r)return!0;return!1}getId(e,t){let r=e.id;if(this.promoteId){let i="string"==typeof this.promoteId?this.promoteId:this.promoteId[t];r=e.properties[i],"boolean"==typeof r&&(r=Number(r))}return r}};function Od(e,t,r,i,a){return Rn(e,((e,n)=>{let s=t instanceof kr?t.get(n):null;return s&&s.evaluate?s.evaluate(r,i,a):s}))}function Vd(e){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let n of e)t=Math.min(t,n.x),r=Math.min(r,n.y),i=Math.max(i,n.x),a=Math.max(a,n.y);return{minX:t,minY:r,maxX:i,maxY:a}}function rP(e,t){return t-e}u(qc,"FeatureIndex"),N("FeatureIndex",qc,{omit:["rawTileData","sourceLayerCoder"]}),u(Od,"evaluateProperties"),u(Vd,"getBounds"),u(rP,"topDownFeatureComparator");var iP=3e4,Pn=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=bo(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,t,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=Fd(e.buckets,t.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let t=this.buckets[e];if(t instanceof Wt){if(this.hasSymbolBuckets=!0,!r)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let t=this.buckets[e];if(t instanceof Wt&&t.hasRTLText){this.hasRTLText=!0,om();break}}this.queryPadding=0;for(let e in this.buckets){let r=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(r))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new Ta}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let r=this.buckets[t];r.uploadPending()&&r.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new xe(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new xe(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,r,i,a,n,s,o,l,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:a,scale:n,tileSize:this.tileSize,pixelPosMatrix:u,transform:o,params:s,queryPadding:this.queryPadding*l},e,t,r):{}}querySourceFeatures(e,t){let r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;let i=r.loadVTLayers(),a=t&&t.sourceLayer?t.sourceLayer:"",n=i._geojsonTileLayer||i[a];if(!n)return;let s=na(t&&t.filter),{z:o,x:l,y:u}=this.tileID.canonical,h={z:o,x:l,y:u};for(let t=0;t<n.length;t++){let i=n.feature(t);if(s.needGeometry){let e=St(i,!0);if(!s.filter(new de(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new de(this.tileID.overscaledZ),i))continue;let c=r.getId(i,a),p=new Sn(i,o,l,u,c);p.tile=h,e.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let t=Np(e.cacheControl);t["max-age"]&&(this.expirationTime=Date.now()+1e3*t["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),r=!1;if(this.expirationTime>e)r=!1;else if(t)if(this.expirationTime<t)r=!0;else{let i=this.expirationTime-t;i?this.expirationTime=e+Math.max(i,iP):r=!0}else r=!0;r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(e).length)return;let r=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!t.style.hasLayer(i))continue;let a=this.buckets[i],n=a.layers[0].sourceLayer||"_geojsonTileLayer",s=r[n],o=e[n];if(!s||!o||0===Object.keys(o).length)continue;a.update(o,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let l=t&&t.style&&t.style.getLayer(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ne.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=ne.now()+e}setDependencies(e,t){let r={};for(let e of t)r[e]=!0;this.dependencies[e]=r}hasDependency(e,t){for(let r of e){let e=this.dependencies[r];if(e)for(let r of t)if(e[r])return!0}return!1}};u(Pn,"Tile"),d();var Zs=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,r){let i=e.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);let a={value:t,timeout:void 0};if(void 0!==r&&(a.timeout=setTimeout((()=>{this.remove(e,a)}),r)),this.data[i].push(a),this.order.push(i),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let r=e.wrapped().key,i=void 0===t?0:this.data[r].indexOf(t),a=this.data[r][i];return this.data[r].splice(i,1),a.timeout&&clearTimeout(a.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(a.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let r in this.data)for(let i of this.data[r])e(i.value)||t.push(i);for(let e of t)this.remove(e.value.tileID,e)}};u(Zs,"TileCache");var $c=ae(Pe());d();var Ws=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,r){let i=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][i]=this.stateChanges[e][i]||{},R(this.stateChanges[e][i],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(let t in this.state[e])t!==i&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][i]){this.deletedStates[e][i]={};for(let t in this.state[e][i])r[t]||(this.deletedStates[e][i][t]=null)}else for(let t in r)this.deletedStates[e]&&this.deletedStates[e][i]&&null===this.deletedStates[e][i][t]&&delete this.deletedStates[e][i][t]}removeFeatureState(e,t,r){if(null===this.deletedStates[e])return;let i=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},r&&void 0!==t)null!==this.deletedStates[e][i]&&(this.deletedStates[e][i]=this.deletedStates[e][i]||{},this.deletedStates[e][i][r]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][i])for(r in this.deletedStates[e][i]={},this.stateChanges[e][i])this.deletedStates[e][i][r]=null;else this.deletedStates[e][i]=null;else this.deletedStates[e]=null}getState(e,t){let r=String(t),i=this.state[e]||{},a=this.stateChanges[e]||{},n=R({},i[r],a[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){let r=this.deletedStates[e][t];if(null===r)return{};for(let e in r)delete n[e]}return n}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){let r={};for(let e in this.stateChanges){this.state[e]=this.state[e]||{};let t={};for(let r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),R(this.state[e][r],this.stateChanges[e][r]),t[r]=this.state[e][r];r[e]=t}for(let e in this.deletedStates){this.state[e]=this.state[e]||{};let t={};if(null===this.deletedStates[e])for(let r in this.state[e])t[r]={},this.state[e][r]={};else for(let r in this.deletedStates[e]){if(null===this.deletedStates[e][r])this.state[e][r]={};else for(let t of Object.keys(this.deletedStates[e][r]))delete this.state[e][r][t];t[r]=this.state[e][r]}r[e]=r[e]||{},R(r[e],t)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(let i in e)e[i].setFeatureState(r,t)}};u(Ws,"SourceFeatureState");var At=class extends fe{constructor(e,t,r){super(),this.id=e,this.dispatcher=r,this.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=Md(e,t,r,this),this._tiles={},this._cache=new Zs(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ws,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let e in this._tiles){let t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,t){return this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,(()=>{}))}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,(()=>{})),this._source.fire(new z("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let t in this._tiles){let r=this._tiles[t];r.upload(e),r.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(Ud).map((e=>e.key))}getRenderableIds(e){let t=[];for(let r in this._tiles)this._isIdRenderable(r,e)&&t.push(this._tiles[r]);return e?t.sort(((e,t)=>{let r=e.tileID,i=t.tileID,a=new $c.default(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),n=new $c.default(i.canonical.x,i.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-i.overscaledZ||n.y-a.y||n.x-a.x})).map((e=>e.tileID.key)):t.map((e=>e.tileID)).sort(Ud).map((e=>e.key))}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(e,"reloading")}}_reloadTile(e,t){let r=this._tiles[e];!r||("loading"!==r.state&&(r.state=t),this._loadTile(r,this._tileLoaded.bind(this,r,e,t)))}_tileLoaded(e,t,r,i){if(i)return e.state="errored",void(404!==i.status?this._source.fire(new Z(i,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=ne.now(),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new z("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let t=this.getRenderableIds();for(let i=0;i<t.length;i++){let a=t[i];if(e.neighboringTiles&&e.neighboringTiles[a]){let t=this.getTileByID(a);r(e,t),r(t,e)}}function r(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x,i=t.tileID.canonical.y-e.tileID.canonical.y,a=Math.pow(2,e.tileID.canonical.z),n=t.tileID.key;0===r&&0===i||Math.abs(i)>1||(Math.abs(r)>1&&(1===Math.abs(r+a)?r+=a:1===Math.abs(r-a)&&(r-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,i),e.neighboringTiles&&e.neighboringTiles[n]&&(e.neighboringTiles[n].backfilled=!0)))}u(r,"fillBorder")}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,r,i){for(let a in this._tiles){let n=this._tiles[a];if(i[a]||!n.hasData()||n.tileID.overscaledZ<=t||n.tileID.overscaledZ>r)continue;let s=n.tileID;for(;n&&n.tileID.overscaledZ>t+1;){let e=n.tileID.scaledTo(n.tileID.overscaledZ-1);n=this._tiles[e.key],n&&n.hasData()&&(s=e)}let o=s;for(;o.overscaledZ>t;)if(o=o.scaledTo(o.overscaledZ-1),e[o.key]){i[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let r=this._loadedParentTiles[e.key];return r&&r.tileID.overscaledZ>=t?r:null}for(let r=e.overscaledZ-1;r>=t;r--){let t=e.scaledTo(r),i=this._getLoadedTile(t);if(i)return i}}_getLoadedTile(e){let t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let t=(Math.ceil(e.width/this._source.tileSize)+1)*(Math.ceil(e.height/this._source.tileSize)+1),r=null===this._maxTileCacheZoomLevels?ot.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,i=Math.floor(t*r),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._cache.setMaxSize(a)}handleWrapJump(e){let t=(e-(void 0===this._prevLng?e:this._prevLng))/360,r=Math.round(t);if(this._prevLng=e,r){let e={};for(let t in this._tiles){let i=this._tiles[t];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+r),e[i.tileID.key]=i}this._tiles=e;for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e in this._tiles){let t=this._tiles[e];this._setTileReloadTimer(e,t)}}}update(e,t){if(this.transform=e,this.terrain=t,!this._sourceLoaded||this._paused)return;let r;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new De(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:t}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[];let i=e.coveringZoomLevel(this._source),a=Math.max(i-At.maxOverzooming,this._source.minzoom),n=Math.max(i+At.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let e={};for(let t of r)if(t.canonical.z>this._source.minzoom){let r=t.scaledTo(t.canonical.z-1);e[r.key]=r;let i=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[i.key]=i}r=r.concat(Object.values(e))}let s=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new z("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let o=this._updateRetainedTiles(r,i);if(Nd(this._source.type)){let e={},s={},l=Object.keys(o),u=ne.now();for(let t of l){let r=o[t],i=this._tiles[t];if(!i||0!==i.fadeEndTime&&i.fadeEndTime<=u)continue;let n=this.findLoadedParent(r,a);n&&(this._addTile(n.tileID),e[n.tileID.key]=n.tileID),s[t]=r}this._retainLoadedChildren(s,i,n,o);for(let t in e)o[t]||(this._coveredTiles[t]=!0,o[t]=e[t]);if(t){let e={},t={};for(let i of r)this._tiles[i.key].hasData()?e[i.key]=i:t[i.key]=i;for(let r in t){let i=t[r].children(this._source.maxzoom);this._tiles[i[0].key]&&this._tiles[i[1].key]&&this._tiles[i[2].key]&&this._tiles[i[3].key]&&(e[i[0].key]=o[i[0].key]=i[0],e[i[1].key]=o[i[1].key]=i[1],e[i[2].key]=o[i[2].key]=i[2],e[i[3].key]=o[i[3].key]=i[3],delete t[r])}for(let r in t){let i=this.findLoadedParent(t[r],this._source.minzoom);if(i){e[i.tileID.key]=o[i.tileID.key]=i.tileID;for(let t in e)e[t].isChildOf(i.tileID)&&delete e[t]}}for(let t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}for(let e in o)this._tiles[e].clearFadeHold();let l=Dp(this._tiles,o);for(let e of l){let t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):(!t.hasSymbolBuckets||t.symbolFadeFinished())&&this._removeTile(e)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let r={},i={},a=Math.max(t-At.maxOverzooming,this._source.minzoom),n=Math.max(t+At.maxUnderzooming,this._source.minzoom),s={};for(let i of e){let e=this._addTile(i);r[i.key]=i,!e.hasData()&&t<this._source.maxzoom&&(s[i.key]=i)}this._retainLoadedChildren(s,t,n,r);for(let n of e){let e=this._tiles[n.key];if(e.hasData())continue;if(t+1>this._source.maxzoom){let e=n.children(this._source.maxzoom)[0],t=this.getTile(e);if(t&&t.hasData()){r[e.key]=e;continue}}else{let e=n.children(this._source.maxzoom);if(r[e[0].key]&&r[e[1].key]&&r[e[2].key]&&r[e[3].key])continue}let s=e.wasRequested();for(let t=n.overscaledZ-1;t>=a;--t){let a=n.scaledTo(t);if(i[a.key])break;if(i[a.key]=!0,e=this.getTile(a),!e&&s&&(e=this._addTile(a)),e){let t=e.hasData();if((s||t)&&(r[a.key]=a),s=e.wasRequested(),t)break}}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let t,r=[],i=this._tiles[e].tileID;for(;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){t=this._loadedParentTiles[i.key];break}r.push(i.key);let e=i.scaledTo(i.overscaledZ-1);if(t=this._getLoadedTile(e),t)break;i=e}for(let e of r)this._loadedParentTiles[e]=t}}_addTile(e){let t=this._tiles[e.key];if(t)return t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));let r=t;return t||(t=new Pn(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))),t.uses++,this._tiles[e.key]=t,r||this._source.fire(new z("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let r=t.getExpiryTimeout();r&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),r))}_removeTile(e){let t=this._tiles[e];!t||(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(t.uses>0)&&(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,t,r){let i=[],a=this.transform;if(!a)return i;let n=r?a.getCameraQueryGeometry(e):e,s=e.map((e=>a.pointCoordinate(e,this.terrain))),o=n.map((e=>a.pointCoordinate(e,this.terrain))),l=this.getIds(),u=1/0,h=1/0,c=-1/0,p=-1/0;for(let e of o)u=Math.min(u,e.x),h=Math.min(h,e.y),c=Math.max(c,e.x),p=Math.max(p,e.y);for(let e=0;e<l.length;e++){let r=this._tiles[l[e]];if(r.holdingForFade())continue;let n=r.tileID,d=Math.pow(2,a.zoom-r.tileID.overscaledZ),f=t*r.queryPadding*O/r.tileSize/d,m=[n.getTilePoint(new Ee(u,h)),n.getTilePoint(new Ee(c,p))];if(m[0].x-f<O&&m[0].y-f<O&&m[1].x+f>=0&&m[1].y+f>=0){let e=s.map((e=>n.getTilePoint(e))),t=o.map((e=>n.getTilePoint(e)));i.push({tile:r,tileID:n,queryGeometry:e,cameraQueryGeometry:t,scale:d})}}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));for(let e of t)e.posMatrix=this.transform.calculatePosMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(Nd(this._source.type)){let e=ne.now();for(let t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,r){e=e||"_geojsonTileLayer",this._state.updateState(e,t,r)}removeFeatureState(e,t,r){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,t,r)}getFeatureState(e,t){return e=e||"_geojsonTileLayer",this._state.getState(e,t)}setDependencies(e,t,r){let i=this._tiles[e];i&&i.setDependencies(t,r)}reloadTilesForDependencies(e,t){for(let r in this._tiles)this._tiles[r].hasDependency(e,t)&&this._reloadTile(r,"reloading");this._cache.filter((r=>!r.hasDependency(e,t)))}};function Ud(e,t){let r=Math.abs(2*e.wrap)-+(e.wrap<0),i=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||i-r||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Nd(e){return"raster"===e||"image"===e||"video"===e}u(At,"SourceCache"),At.maxOverzooming=10,At.maxUnderzooming=3,u(Ud,"compareTileId"),u(Nd,"isRasterType"),d(),d(),d(),d();var qd='(()=>{var Lf=Object.create;var jn=Object.defineProperty;var Ff=Object.getOwnPropertyDescriptor;var Mf=Object.getOwnPropertyNames;var Df=Object.getPrototypeOf,Vf=Object.prototype.hasOwnProperty;var ol=t=>jn(t,"__esModule",{value:!0});var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),al=(t,e)=>{ol(t);for(var r in e)jn(t,r,{get:e[r],enumerable:!0})},Bf=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Mf(e))!Vf.call(t,n)&&n!=="default"&&jn(t,n,{get:()=>e[n],enumerable:!(r=Ff(e,n))||r.enumerable});return t},J=t=>Bf(ol(jn(t!=null?Lf(Df(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var ge=_e((Xx,sl)=>{"use strict";sl.exports=Yt;function Yt(t,e){this.x=t,this.y=e}Yt.prototype={clone:function(){return new Yt(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};Yt.convert=function(t){return t instanceof Yt?t:Array.isArray(t)?new Yt(t[0],t[1]):t}});var Bo=_e((Qx,ul)=>{"use strict";ul.exports=ll;function ll(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}ll.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-i/o}var a=0,s=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:s=r,r=(s-a)*.5+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}}});var Mu=_e((A0,Da)=>{function Hm(t,e){var r,n,i,o,a,s,l,u,c,p;for(r=t.length&3,n=t.length-r,i=e,a=3432918353,l=461845907,p=0;p<n;)c=t.charCodeAt(p)&255|(t.charCodeAt(++p)&255)<<8|(t.charCodeAt(++p)&255)<<16|(t.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c,i=i<<13|i>>>19,o=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,r){case 3:c^=(t.charCodeAt(p+2)&255)<<16;case 2:c^=(t.charCodeAt(p+1)&255)<<8;case 1:c^=t.charCodeAt(p)&255,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}typeof Da!="undefined"&&(Da.exports=Hm)});var Du=_e((C0,Va)=>{function Km(t,e){for(var r=t.length,n=e^r,i=0,o;r>=4;)o=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^o,r-=4,++i;switch(r){case 3:n^=(t.charCodeAt(i+2)&255)<<16;case 2:n^=(t.charCodeAt(i+1)&255)<<8;case 1:n^=t.charCodeAt(i)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}typeof Va!==void 0&&(Va.exports=Km)});var Ba=_e((I0,Zi)=>{var Vu=Mu(),Ym=Du();Zi.exports=Vu;Zi.exports.murmur3=Vu;Zi.exports.murmur2=Ym});var ts=_e((S1,es)=>{"use strict";es.exports=Qi;es.exports.default=Qi;function Qi(t,e,r){r=r||2;var n=e&&e.length,i=n?e[0]*r:t.length,o=bc(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,l,u,c,p,f,y;if(n&&(o=zd(t,e,o,r)),t.length>80*r){s=u=t[0],l=c=t[1];for(var m=r;m<i;m+=r)p=t[m],f=t[m+1],p<s&&(s=p),f<l&&(l=f),p>u&&(u=p),f>c&&(c=f);y=Math.max(u-s,c-l),y=y!==0?32767/y:0}return bn(o,a,r,s,l,y,0),a}function bc(t,e,r,n,i){var o,a;if(i===Qa(t,e,r,n)>0)for(o=e;o<r;o+=n)a=Sc(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=Sc(o,t[o],t[o+1],a);return a&&eo(a,a.next)&&(Pn(a),a=a.next),a}function Jt(t,e){if(!t)return t;e||(e=t);var r=t,n;do if(n=!1,!r.steiner&&(eo(r,r.next)||ae(r.prev,r,r.next)===0)){if(Pn(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function bn(t,e,r,n,i,o,a){if(!!t){!a&&o&&$d(t,n,i,o);for(var s=t,l,u;t.prev!==t.next;){if(l=t.prev,u=t.next,o?Dd(t,n,i,o):Md(t)){e.push(l.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),Pn(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=Vd(Jt(t),e,r),bn(t,e,r,n,i,o,2)):a===2&&Bd(t,e,r,n,i,o):bn(Jt(t),e,r,n,i,o,1);break}}}}function Md(t){var e=t.prev,r=t,n=t.next;if(ae(e,r,n)>=0)return!1;for(var i=e.x,o=r.x,a=n.x,s=e.y,l=r.y,u=n.y,c=i<o?i<a?i:a:o<a?o:a,p=s<l?s<u?s:u:l<u?l:u,f=i>o?i>a?i:a:o>a?o:a,y=s>l?s>u?s:u:l>u?l:u,m=n.next;m!==e;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&Sr(i,s,o,l,a,u,m.x,m.y)&&ae(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Dd(t,e,r,n){var i=t.prev,o=t,a=t.next;if(ae(i,o,a)>=0)return!1;for(var s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=s<l?s<u?s:u:l<u?l:u,m=c<p?c<f?c:f:p<f?p:f,d=s>l?s>u?s:u:l>u?l:u,h=c>p?c>f?c:f:p>f?p:f,g=Ya(y,m,e,r,n),v=Ya(d,h,e,r,n),b=t.prevZ,x=t.nextZ;b&&b.z>=g&&x&&x.z<=v;){if(b.x>=y&&b.x<=d&&b.y>=m&&b.y<=h&&b!==i&&b!==a&&Sr(s,c,l,p,u,f,b.x,b.y)&&ae(b.prev,b,b.next)>=0||(b=b.prevZ,x.x>=y&&x.x<=d&&x.y>=m&&x.y<=h&&x!==i&&x!==a&&Sr(s,c,l,p,u,f,x.x,x.y)&&ae(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;b&&b.z>=g;){if(b.x>=y&&b.x<=d&&b.y>=m&&b.y<=h&&b!==i&&b!==a&&Sr(s,c,l,p,u,f,b.x,b.y)&&ae(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;x&&x.z<=v;){if(x.x>=y&&x.x<=d&&x.y>=m&&x.y<=h&&x!==i&&x!==a&&Sr(s,c,l,p,u,f,x.x,x.y)&&ae(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Vd(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!eo(i,o)&&vc(i,n,n.next,o)&&vn(i,o)&&vn(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),Pn(n),Pn(n.next),n=t=o),n=n.next}while(n!==t);return Jt(n)}function Bd(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&qd(a,s)){var l=Pc(a,s);a=Jt(a,a.next),l=Jt(l,l.next),bn(a,e,r,n,i,o,0),bn(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function zd(t,e,r,n){var i=[],o,a,s,l,u;for(o=0,a=e.length;o<a;o++)s=e[o]*n,l=o<a-1?e[o+1]*n:t.length,u=bc(t,s,l,n,!1),u===u.next&&(u.steiner=!0),i.push(jd(u));for(i.sort(Rd),o=0;o<i.length;o++)r=Od(i[o],r);return r}function Rd(t,e){return t.x-e.x}function Od(t,e){var r=Nd(t,e);if(!r)return e;var n=Pc(r,t);return Jt(n,n.next),Jt(r,r.next)}function Nd(t,e){var r=e,n=t.x,i=t.y,o=-1/0,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x<r.next.x?r:r.next,s===n))return a}r=r.next}while(r!==e);if(!a)return null;var l=a,u=a.x,c=a.y,p=1/0,f;r=a;do n>=r.x&&r.x>=u&&n!==r.x&&Sr(i<c?n:o,i,u,c,i<c?o:n,i,r.x,r.y)&&(f=Math.abs(i-r.y)/(n-r.x),vn(r,t)&&(f<p||f===p&&(r.x>a.x||r.x===a.x&&Ud(a,r)))&&(a=r,p=f)),r=r.next;while(r!==l);return a}function Ud(t,e){return ae(t.prev,t,e.prev)<0&&ae(e.next,t,t.next)<0}function $d(t,e,r,n){var i=t;do i.z===0&&(i.z=Ya(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Gd(i)}function Gd(t){var e,r,n,i,o,a,s,l,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e<u&&(s++,n=n.nextZ,!!n);e++);for(l=u;s>0||l>0&&n;)s!==0&&(l===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1);return t}function Ya(t,e,r,n,i){return t=(t-r)*i|0,e=(e-n)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function jd(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Sr(t,e,r,n,i,o,a,s){return(i-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(n-s)>=(r-a)*(e-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function qd(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Zd(t,e)&&(vn(t,e)&&vn(e,t)&&Jd(t,e)&&(ae(t.prev,t,e.prev)||ae(t,e.prev,e))||eo(t,e)&&ae(t.prev,t,t.next)>0&&ae(e.prev,e,e.next)>0)}function ae(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function eo(t,e){return t.x===e.x&&t.y===e.y}function vc(t,e,r,n){var i=ro(ae(t,e,r)),o=ro(ae(t,e,n)),a=ro(ae(r,n,t)),s=ro(ae(r,n,e));return!!(i!==o&&a!==s||i===0&&to(t,r,e)||o===0&&to(t,n,e)||a===0&&to(r,t,n)||s===0&&to(r,e,n))}function to(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ro(t){return t>0?1:t<0?-1:0}function Zd(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&vc(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function vn(t,e){return ae(t.prev,t,t.next)<0?ae(t,e,t.next)>=0&&ae(t,t.prev,e)>=0:ae(t,e,t.prev)<0||ae(t,t.next,e)<0}function Jd(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==t);return n}function Pc(t,e){var r=new Xa(t.i,t.x,t.y),n=new Xa(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Sc(t,e,r,n){var i=new Xa(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Pn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Xa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Qi.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(Qa(t,0,o,r));if(i)for(var s=0,l=e.length;s<l;s++){var u=e[s]*r,c=s<l-1?e[s+1]*r:t.length;a-=Math.abs(Qa(t,u,c,r))}var p=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,y=n[s+1]*r,m=n[s+2]*r;p+=Math.abs((t[f]-t[m])*(t[y+1]-t[f+1])-(t[f]-t[y])*(t[m+1]-t[f+1]))}return a===0&&p===0?0:Math.abs((p-a)/a)};function Qa(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}Qi.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}});var is=_e((oP,Ec)=>{"use strict";var eg=ge();Ec.exports=Ir;function Ir(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(tg,this,e)}function tg(t,e,r){t==1?e.id=r.readVarint():t==2?rg(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function rg(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}Ir.types=["Unknown","Point","LineString","Polygon"];Ir.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=[],s;t.pos<e;){if(n<=0){var l=t.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new eg(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};Ir.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=c&7,n=c>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,s,u]};Ir.prototype.toGeoJSON=function(t,e,r){var n=this.extent*Math.pow(2,r),i=this.extent*t,o=this.extent*e,a=this.loadGeometry(),s=Ir.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var d=y[m],h=180-(d.y+o)*360/n;y[m]=[(d.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(h*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=ng(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var f={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(f.id=this.id),f};function ng(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=ig(t[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[t[o]]):n.push(t[o]))}return n&&r.push(n),r}function ig(t){for(var e=0,r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}});var os=_e((aP,Fc)=>{"use strict";var og=is();Fc.exports=Lc;function Lc(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ag,this,e),this.length=this._features.length}function ag(t,e,r){t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(sg(r))}function sg(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}Lc.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new og(this._pbf,e,this.extent,this._keys,this._values)}});var Dc=_e((sP,Mc)=>{"use strict";var lg=os();Mc.exports=ug;function ug(t,e){this.layers=t.readFields(cg,{},e)}function cg(t,e,r){if(t===3){var n=new lg(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var It=_e((lP,no)=>{no.exports.VectorTile=Dc();no.exports.VectorTileFeature=is();no.exports.VectorTileLayer=os()});var rp=_e(ps=>{ps.read=function(t,e,r,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,f=r?-1:1,y=t[e+p];for(p+=f,o=y&(1<<-c)-1,y>>=-c,c+=s;c>0;o=o*256+t[e+p],p+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+t[e+p],p+=f,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(y?-1:1)*a*Math.pow(2,o-n)};ps.write=function(t,e,r,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:o-1,m=n?1:-1,d=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?e+=f/l:e+=f*Math.pow(2,1-p),e*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*l-1)*Math.pow(2,i),a=a+p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[r+y]=s&255,y+=m,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+y]=a&255,y+=m,a/=256,u-=8);t[r+y-m]|=d*128}});var An=_e((GS,sp)=>{"use strict";sp.exports=H;var ao=rp();function H(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}H.Varint=0;H.Fixed64=1;H.Bytes=2;H.Fixed32=5;var fs=(1<<16)*(1<<16),np=1/fs,Tg=12,ip=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");H.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=so(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=ap(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=so(this.buf,this.pos)+so(this.buf,this.pos+4)*fs;return this.pos+=8,t},readSFixed64:function(){var t=so(this.buf,this.pos)+ap(this.buf,this.pos+4)*fs;return this.pos+=8,t},readFloat:function(){var t=ao.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ao.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,Eg(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Tg&&ip?jg(this.buf,e,t):Gg(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==H.Bytes)return t.push(this.readVarint(e));var r=pt(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==H.Bytes)return t.push(this.readSVarint());var e=pt(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==H.Bytes)return t.push(this.readBoolean());var e=pt(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==H.Bytes)return t.push(this.readFloat());var e=pt(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==H.Bytes)return t.push(this.readDouble());var e=pt(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==H.Bytes)return t.push(this.readFixed32());var e=pt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==H.Bytes)return t.push(this.readSFixed32());var e=pt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==H.Bytes)return t.push(this.readFixed64());var e=pt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==H.Bytes)return t.push(this.readSFixed64());var e=pt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===H.Varint)for(;this.buf[this.pos++]>127;);else if(e===H.Bytes)this.pos=this.readVarint()+this.pos;else if(e===H.Fixed32)this.pos+=4;else if(e===H.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Fr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Fr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Fr(this.buf,t&-1,this.pos),Fr(this.buf,Math.floor(t*np),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Fr(this.buf,t&-1,this.pos),Fr(this.buf,Math.floor(t*np),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Lg(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=qg(this.buf,t,this.pos);var r=this.pos-e;r>=128&&op(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),ao.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ao.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&op(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,H.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Dg,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Vg,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Rg,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Bg,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,zg,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Og,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Ng,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Ug,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,$g,e)},writeBytesField:function(t,e){this.writeTag(t,H.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,H.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,H.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,H.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,H.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,H.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,H.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,H.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,H.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,H.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function Eg(t,e,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return Lr(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function pt(t){return t.type===H.Bytes?t.readVarint()+t.pos:t.pos+1}function Lr(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Lg(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),Fg(r,n,e),Mg(n,e)}function Fg(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Mg(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127)))))}function op(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Dg(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Vg(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Bg(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function zg(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Rg(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Og(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function Ng(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Ug(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function $g(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function so(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Fr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function ap(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Gg(t,e,r){for(var n="",i=e;i<r;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=t[i+1],(l&192)==128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=t[i+1],u=t[i+2],(l&192)==128&&(u&192)==128&&(a=(o&15)<<12|(l&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=t[i+1],u=t[i+2],c=t[i+3],(l&192)==128&&(u&192)==128&&(c&192)==128&&(a=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function jg(t,e,r){return ip.decode(t.subarray(e,r))}function qg(t,e,r){for(var n=0,i,o;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):o=i;continue}else o&&(t[r++]=239,t[r++]=191,t[r++]=189,o=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=i&63|128)}return r}});var of=_e((MA,nf)=>{nf.exports=Ao;function Ao(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)Ao(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)Ao(t.geometries[n],e);else if(r==="Feature")Ao(t.geometry,e);else if(r==="Polygon")tf(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)tf(t.coordinates[n],e);return t}function tf(t,e){if(t.length!==0){rf(t[0],e);for(var r=1;r<t.length;r++)rf(t[r],!e)}}function rf(t,e){for(var r=0,n=0,i=0,o=t.length,a=o-1;i<o;a=i++){var s=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+s;n+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+n>=0!=!!e&&t.reverse()}});var cf=_e((BA,uf)=>{"use strict";var kx=ge(),Tx=It().VectorTileFeature;uf.exports=lf;function lf(t,e){this.options=e||{},this.features=t,this.length=t.length}lf.prototype.feature=function(t){return new Co(this.features[t],this.options.extent)};function Co(t,e){this.id=typeof t.id=="number"?t.id:void 0,this.type=t.type,this.rawGeometry=t.type===1?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}Co.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new kx(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};Co.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]};Co.prototype.toGeoJSON=Tx.prototype.toGeoJSON});var yf=_e((zA,Vn)=>{var Ex=An(),pf=cf();Vn.exports=Bs;Vn.exports.fromVectorTileJs=Bs;Vn.exports.fromGeojsonVt=Lx;Vn.exports.GeoJSONWrapper=pf;function Bs(t){var e=new Ex;return Fx(t,e),e.finish()}function Lx(t,e){e=e||{};var r={};for(var n in t)r[n]=new pf(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Bs({layers:r})}function Fx(t,e){for(var r in t.layers)e.writeMessage(3,Mx,t.layers[r])}function Mx(t,e){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,Dx,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)e.writeMessage(4,zx,o[r])}function Dx(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Vx,t),e.writeVarintField(3,r.type),e.writeMessage(4,Bx,r)}function Vx(t,e){var r=t.feature,n=t.keys,i=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var l=r.properties[s],u=o[s];if(l!==null){typeof u=="undefined"&&(n.push(s),u=n.length-1,o[s]=u),e.writeVarint(u);var c=typeof l;c!=="string"&&c!=="boolean"&&c!=="number"&&(l=JSON.stringify(l));var p=c+":"+l,f=a[p];typeof f=="undefined"&&(i.push(l),f=i.length-1,a[p]=f),e.writeVarint(f)}}}function zs(t,e){return(e<<3)+(t&7)}function ff(t){return t<<1^t>>31}function Bx(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;s<a;s++){var l=r[s],u=1;n===1&&(u=l.length),e.writeVarint(zs(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint(zs(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(ff(f)),e.writeVarint(ff(y)),i+=f,o+=y}n===3&&e.writeVarint(zs(7,1))}}function zx(t,e){var r=typeof t;r==="string"?e.writeStringField(1,t):r==="boolean"?e.writeBooleanField(7,t):r==="number"&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}});var zf=J(ge()),cl=J(Bo());function pl(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Rf(t,e,r,n){let i=new cl.default(t,e,r,n);return function(o){return i.solve(o)}}var eb=Rf(.25,.1,.25,1);function nt(t,e,r){return Math.min(r,Math.max(e,t))}function fl(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function Ae(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function yl(t){return Math.log(t)/Math.LN2%1==0}function Gr(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function ml(t,e,r){let n={};for(let i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function it(t){return Array.isArray(t)?t.map(it):typeof t=="object"&&t?Gr(t,it):t}function hl(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}var dl={};function ce(t){dl[t]||(typeof console!="undefined"&&console.warn(t),dl[t]=!0)}function ot(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function gl(t){let e=0;for(let r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}function Ee(){return typeof WorkerGlobalScope!="undefined"&&typeof self!="undefined"&&self instanceof WorkerGlobalScope}var zo=null;function Ro(t){if(zo==null){let e=t.navigator?t.navigator.userAgent:null;zo=!!t.safari||!!(e&&(/\\b(iPad|iPhone|iPod)\\b/.test(e)||!!e.match("Safari")&&!e.match("Chrome")))}return zo}function jr(t){return typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap}var ht=3,dt=class{constructor(e,r,n){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],r=a[1],n=a[2],this.d=r+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[ht+u],p=a[ht+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[ht+i.length],l=a[ht+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=n,this.scale=r/e,this.uid=0;let o=n/r*e;this.min=-o,this.max=e+o}insert(e,r,n,i,o){this._forEachCell(r,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,n,i,o,a){this.cells[o].push(a)}query(e,r,n,i,o){let a=this.min,s=this.max;if(e<=a&&r<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(e,r,n,i,this._queryCell,l,u,o),l}}_queryCell(e,r,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let f=0;f<u.length;f++){let y=u[f];if(s[y]===void 0){let m=y*4;(l?l(p[m+0],p[m+1],p[m+2],p[m+3]):e<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&i>=p[m+1])?(s[y]=!0,a.push(c[y])):s[y]=!1}}}}_forEachCell(e,r,n,i,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),f=this._convertToCellCoord(i);for(let y=u;y<=p;y++)for(let m=c;m<=f;m++){let d=this.d*m+y;if(!(l&&!l(this._convertFromCellCoord(y),this._convertFromCellCoord(m),this._convertFromCellCoord(y+1),this._convertFromCellCoord(m+1)))&&o.call(this,e,r,n,i,d,a,s,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=ht+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(r+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=r;for(let a=0;a<e.length;a++){let s=e[a];i[ht+a]=o,i.set(s,o),o+=s.length}return i[ht+e.length]=o,i.set(this.keys,o),o+=this.keys.length,i[ht+e.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(e,r){let n=e.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(e){return new dt(e.buffer)}};var xl=J(Bo()),Of=8,Nf={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Uf={"*":{type:"source"}},$f=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Gf={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},jf={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},qf={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Zf={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},Jf={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Wf={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Hf={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},Kf=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],Yf={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Xf={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qf={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ey={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ty={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ry={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ny={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},iy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},oy={type:"array",value:"*"},ay={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},sy={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},ly={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},uy={type:"array",value:"*",minimum:1},cy={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},py={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},fy=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],yy={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},my={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},hy={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},dy={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},gy={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},xy={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},by={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},vy={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},Py={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},Sy={"*":{type:"string"}},S={$version:Of,$root:Nf,sources:Uf,source:$f,source_vector:Gf,source_raster:jf,source_raster_dem:qf,source_geojson:Zf,source_video:Jf,source_image:Wf,layer:Hf,layout:Kf,layout_background:Yf,layout_fill:Xf,layout_circle:Qf,layout_heatmap:ey,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:ty,layout_symbol:ry,layout_raster:ny,layout_hillshade:iy,filter:oy,filter_operator:ay,geometry_type:sy,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:ly,expression:uy,light:cy,terrain:py,paint:fy,paint_fill:yy,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:my,paint_circle:hy,paint_heatmap:dy,paint_symbol:gy,paint_raster:xy,paint_hillshade:by,paint_background:vy,transition:Py,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:Sy},wy=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var D=class{constructor(e,r,n,i){this.message=(e?`${e}: `:"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function Xt(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var We=class extends Error{constructor(e,r){super(r);this.message=r,this.key=e}},qn=class{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new qn(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},Qt={kind:"null"},M={kind:"number"},G={kind:"string"},U={kind:"boolean"},Re={kind:"color"},er={kind:"object"},$={kind:"value"},_y={kind:"error"},Zn={kind:"collator"},tr={kind:"formatted"},Jn={kind:"padding"},qr={kind:"resolvedImage"},Wn={kind:"variableAnchorOffsetCollection"};function Ve(t,e){return{kind:"array",itemType:t,N:e}}function re(t){if(t.kind==="array"){let e=re(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var Ay=[Qt,M,G,U,Re,tr,er,Ve($),Jn,qr,Wn];function Zr(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Zr(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of Ay)if(!Zr(r,e))return null}}return`Expected ${re(t)} but found ${re(e)} instead.`}function Oo(t,e){return e.some(r=>r.kind===t.kind)}function Jr(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function Wr(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var bl=.96422,vl=1,Pl=.82521,Sl=4/29,rr=6/29,wl=3*rr*rr,Cy=rr*rr*rr,Iy=Math.PI/180,ky=180/Math.PI;function _l(t){return t=t%360,t<0&&(t+=360),t}function Al([t,e,r,n]){t=No(t),e=No(e),r=No(r);let i,o,a=Uo((.2225045*t+.7168786*e+.0606169*r)/vl);t===e&&e===r?i=o=a:(i=Uo((.4360747*t+.3850649*e+.1430804*r)/bl),o=Uo((.0139322*t+.0971045*e+.7141733*r)/Pl));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function No(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Uo(t){return t>Cy?Math.pow(t,1/3):t/wl+Sl}function Cl([t,e,r,n]){let i=(t+16)/116,o=isNaN(e)?i:i+e/500,a=isNaN(r)?i:i-r/200;return i=vl*Go(i),o=bl*Go(o),a=Pl*Go(a),[$o(3.1338561*o-1.6168667*i-.4906146*a),$o(-.9787684*o+1.9161415*i+.033454*a),$o(.0719453*o-.2289914*i+1.4052427*a),n]}function $o(t){return t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055,t<0?0:t>1?1:t}function Go(t){return t>rr?t*t*t:wl*(t-Sl)}function Ty(t){let[e,r,n,i]=Al(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?_l(Math.atan2(n,r)*ky):NaN,o,e,i]}function Ey([t,e,r,n]){return t=isNaN(t)?0:t*Iy,Cl([r,Math.cos(t)*e,Math.sin(t)*e,n])}function Ly([t,e,r,n]){t=_l(t),e/=100,r/=100;function i(o){let a=(o+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4),n]}function Fy(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=My[t];if(e){let[i,o,a]=e;return[i/255,o/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let o=t.length<6?1:2,a=1;return[Hn(t.slice(a,a+=o)),Hn(t.slice(a,a+=o)),Hn(t.slice(a,a+=o)),Hn(t.slice(a,a+o)||"ff")]}if(t.startsWith("rgb")){let i=/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,o=t.match(i);if(o){let[a,s,l,u,c,p,f,y,m,d,h,g]=o,v=[u||" ",f||" ",d].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let b=[l,p,m].join(""),x=b==="%%%"?100:b===""?255:0;if(x){let P=[nr(+s/x,0,1),nr(+c/x,0,1),nr(+y/x,0,1),h?Il(+h,g):1];if(kl(P))return P}}return}}let r=/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,n=t.match(r);if(n){let[i,o,a,s,l,u,c,p,f]=n,y=[a||" ",l||" ",c].join("");if(y===" "||y===" /"||y===",,"||y===",,,"){let m=[+o,nr(+s,0,100),nr(+u,0,100),p?Il(+p,f):1];if(kl(m))return Ly(m)}}}function Hn(t){return parseInt(t.padEnd(2,t),16)/255}function Il(t,e){return nr(e?t/100:t,0,1)}function nr(t,e,r){return Math.min(Math.max(e,t),r)}function kl(t){return!t.some(Number.isNaN)}var My={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},q=class{constructor(e,r,n,i=1,o=!0){this.r=e,this.g=r,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,r,n,i]))}static parse(e){if(e instanceof q)return e;if(typeof e!="string")return;let r=Fy(e);if(r)return new q(...r,!1)}get rgb(){let{r:e,g:r,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[e/o,r/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",Ty(this.rgb))}get lab(){return this.overwriteGetter("lab",Al(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return`rgba(${[e,r,n].map(o=>Math.round(o*255)).join(",")},${i})`}};q.black=new q(0,0,0,1);q.white=new q(1,1,1,1);q.transparent=new q(0,0,0,0);q.red=new q(1,0,0,1);var Kn=class{constructor(e,r,n){e?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Yn=class{constructor(e,r,n,i,o){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o}},ve=class{constructor(e){this.sections=e}static fromString(e){return new ve([new Yn(e,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof ve?e:ve.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Le=class{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Le)return e;if(typeof e=="number")return new Le([e,e,e,e]);if(!!Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new Le(e)}}toString(){return JSON.stringify(this.values)}},Dy=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),He=class{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof He)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!=0)){for(let r=0;r<e.length;r+=2){let n=e[r],i=e[r+1];if(typeof n!="string"||!Dy.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new He(e)}}toString(){return JSON.stringify(this.values)}},Ce=class{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Ce({name:e,available:!1}):null}};function Tl(t,e,r,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?typeof n=="undefined"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,r,n]:[t,e,r]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function Xn(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof q||t instanceof Kn||t instanceof ve||t instanceof Le||t instanceof He||t instanceof Ce)return!0;if(Array.isArray(t)){for(let e of t)if(!Xn(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!Xn(t[e]))return!1;return!0}else return!1}function pe(t){if(t===null)return Qt;if(typeof t=="string")return G;if(typeof t=="boolean")return U;if(typeof t=="number")return M;if(t instanceof q)return Re;if(t instanceof Kn)return Zn;if(t instanceof ve)return tr;if(t instanceof Le)return Jn;if(t instanceof He)return Wn;if(t instanceof Ce)return qr;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=pe(n);if(!r)r=i;else{if(r===i)continue;r=$;break}}return Ve(r||$,e)}else return er}function Hr(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof q||t instanceof ve||t instanceof Le||t instanceof He||t instanceof Ce?t.toString():JSON.stringify(t)}var at=class{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`\'literal\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Xn(e[1]))return r.error("invalid value");let n=e[1],i=pe(n),o=r.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new at(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},se=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}},Qn={string:G,number:M,boolean:U,object:er},Oe=class{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=1,i,o=e[0];if(o==="array"){let s;if(e.length>2){let u=e[1];if(typeof u!="string"||!(u in Qn)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=Qn[u],n++}else s=$;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=e[2],n++}i=Ve(s,l)}else{if(!Qn[o])throw new Error(`Types doesn\'t contain name = ${o}`);i=Qn[o]}let a=[];for(;n<e.length;n++){let s=r.parse(e[n],n,$);if(!s)return null;a.push(s)}return new Oe(i,a)}evaluate(e){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(e);if(Zr(this.type,pe(n))){if(r===this.args.length-1)throw new se(`Expected value to be of type ${re(this.type)}, but found ${re(pe(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},El={"to-boolean":U,"to-color":Re,"to-number":M,"to-string":G},st=class{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[0];if(!El[n])throw new Error(`Can\'t parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=El[n],o=[];for(let a=1;a<e.length;a++){let s=r.parse(e[a],a,$);if(!s)return null;o.push(s)}return new st(i,o)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(e),n=null,r instanceof q)return r;if(typeof r=="string"){let o=e.parseColor(r);if(o)return o}else if(Array.isArray(r)&&(r.length<3||r.length>4?n=`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:n=Tl(r[0],r[1],r[2],r[3]),!n))return new q(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new se(n||`Could not parse color from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=Le.parse(r);if(i)return i}throw new se(`Could not parse padding from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=He.parse(r);if(i)return i}throw new se(`Could not parse variableAnchorOffsetCollection from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(e),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new se(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return ve.fromString(Hr(this.args[0].evaluate(e)));case"resolvedImage":return Ce.fromString(Hr(this.args[0].evaluate(e)));default:return Hr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Vy=["Unknown","Point","LineString","Polygon"],jo=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Vy[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=q.parse(e)),r}},Kr=class{constructor(e,r,n=[],i,o=new qn,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>`[${s}]`).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(e,r,n,i,o={}){return r?this.concat(r,n,i)._parse(e,o):this._parse(e,o)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,o,a){return a==="assert"?new Oe(o,[i]):a==="coerce"?new st(o,[i]):i}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=e[0];if(typeof i!="string")return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let o=this.registry[i];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if((s.kind==="color"||s.kind==="formatted"||s.kind==="resolvedImage")&&(l.kind==="value"||l.kind==="string"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="padding"&&(l.kind==="value"||l.kind==="number"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="variableAnchorOffsetCollection"&&(l.kind==="value"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof at)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new jo;try{a=new at(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e=="undefined"?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,n){let i=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new Kr(this.registry,this._isConstant,i,r||null,o,this.errors)}error(e,...r){let n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new We(n,e))}checkSubtype(e,r){let n=Zr(e,r);return n&&this.error(n),n}},Yr=class{constructor(e,r,n){this.type=Zn,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,U);if(!i)return null;let o=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,U);if(!o)return null;let a=null;return n.locale&&(a=r.parse(n.locale,1,G),!a)?null:new Yr(i,o,a)}evaluate(e){return new Kn(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},gt=8192;function qo(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function By(t){return(180+t)/360}function zy(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ei(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Ry(t,e){let r=By(t[0]),n=zy(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*gt),Math.round(n*i*gt)]}function Oy(t,e,r){let n=t[0]-e[0],i=t[1]-e[1],o=t[0]-r[0],a=t[1]-r[1];return n*a-o*i==0&&n*o<=0&&i*a<=0}function Ny(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function Zo(t,e){let r=!1;for(let n=0,i=e.length;n<i;n++){let o=e[n];for(let a=0,s=o.length;a<s-1;a++){if(Oy(t,o[a],o[a+1]))return!1;Ny(t,o[a],o[a+1])&&(r=!r)}}return r}function Uy(t,e){for(let r=0;r<e.length;r++)if(Zo(t,e[r]))return!0;return!1}function $y(t,e){return t[0]*e[1]-t[1]*e[0]}function Ll(t,e,r,n){let i=t[0]-r[0],o=t[1]-r[1],a=e[0]-r[0],s=e[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function Gy(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return $y(o,i)===0?!1:!!(Ll(t,e,r,n)&&Ll(r,n,t,e))}function jy(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(Gy(t,e,n[i],n[i+1]))return!0;return!1}function Fl(t,e){for(let r=0;r<t.length;++r)if(!Zo(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if(jy(t[r],t[r+1],e))return!1;return!0}function qy(t,e){for(let r=0;r<e.length;r++)if(Fl(t,e[r]))return!0;return!1}function Jo(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=[];for(let a=0;a<t[i].length;a++){let s=Ry(t[i][a],r);qo(e,s),o.push(s)}n.push(o)}return n}function Ml(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=Jo(t[i],e,r);n.push(o)}return n}function Dl(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){let i=n*.5,o=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;o===0&&(o=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=o}qo(e,t)}function Zy(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function Vl(t,e,r,n){let i=Math.pow(2,n.z)*gt,o=[n.x*gt,n.y*gt],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];Dl(u,e,r,i),a.push(u)}return a}function Bl(t,e,r,n){let i=Math.pow(2,n.z)*gt,o=[n.x*gt,n.y*gt],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];qo(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){Zy(e);for(let s of a)for(let l of s)Dl(l,e,r,i)}return a}function Jy(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=Jo(e.coordinates,n,i),a=Vl(t.geometry(),r,n,i);if(!ei(r,n))return!1;for(let s of a)if(!Zo(s,o))return!1}if(e.type==="MultiPolygon"){let o=Ml(e.coordinates,n,i),a=Vl(t.geometry(),r,n,i);if(!ei(r,n))return!1;for(let s of a)if(!Uy(s,o))return!1}return!0}function Wy(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=Jo(e.coordinates,n,i),a=Bl(t.geometry(),r,n,i);if(!ei(r,n))return!1;for(let s of a)if(!Fl(s,o))return!1}if(e.type==="MultiPolygon"){let o=Ml(e.coordinates,n,i),a=Bl(t.geometry(),r,n,i);if(!ei(r,n))return!1;for(let s of a)if(!qy(s,o))return!1}return!0}var xt=class{constructor(e,r){this.type=U,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'within\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Xn(e[1])){let n=e[1];if(n.type==="FeatureCollection")for(let i=0;i<n.features.length;++i){let o=n.features[i].geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new xt(n,n.features[i].geometry)}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new xt(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new xt(n,n)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Jy(e,this.geometries);if(e.geometryType()==="LineString")return Wy(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Xr=class{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=e[1];return r.scope.has(n)?new Xr(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Fe=class{constructor(e,r,n,i){this.name=e,this.type=r,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let n=e[0],i=Fe.definitions[n];if(!i)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new Kr(r.registry,ti,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<e.length;y++){let m=e[y],d=Array.isArray(u)?u[y-1]:u.type,h=l.parse(m,1+p.length,d);if(!h){f=!0;break}p.push(h)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error(`Expected ${u.length} arguments, but found ${p.length} instead.`);continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,d=p[y];l.concat(y+1).checkSubtype(m,d.type)}if(l.errors.length===0)return new Fe(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>Hy(f)).join(" | "),p=[];for(let f=1;f<e.length;f++){let y=r.parse(e[f],1+p.length);if(!y)return null;p.push(re(y.type))}r.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,r){Fe.definitions=r;for(let n in r)e[n]=Fe}};function Hy(t){return Array.isArray(t)?`(${t.map(re).join(", ")})`:`(${re(t.type)}...)`}function ti(t){if(t instanceof Xr)return ti(t.boundExpression);if(t instanceof Fe&&t.name==="error")return!1;if(t instanceof Yr)return!1;if(t instanceof xt)return!1;let e=t instanceof st||t instanceof Oe,r=!0;return t.eachChild(n=>{e?r=r&&ti(n):r=r&&n instanceof at}),r?ri(t)&&ni(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function ri(t){if(t instanceof Fe){if(t.name==="get"&&t.args.length===1)return!1;if(t.name==="feature-state")return!1;if(t.name==="has"&&t.args.length===1)return!1;if(t.name==="properties"||t.name==="geometry-type"||t.name==="id")return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof xt)return!1;let e=!0;return t.eachChild(r=>{e&&!ri(r)&&(e=!1)}),e}function Qr(t){if(t instanceof Fe&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!Qr(r)&&(e=!1)}),e}function ni(t,e){if(t instanceof Fe&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!ni(n,e)&&(r=!1)}),r}function ii(t,e){let r=t.length-1,n=0,i=r,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=t[o],s=t[o+1],a<=e){if(o===r||e<s)return o;n=o+1}else if(a>e)i=o-1;else throw new se("Input is not a number.");return 0}var Ft=class{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");let n=r.parse(e[1],1,M);if(!n)return null;let i=[],o=null;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);for(let a=1;a<e.length;a+=2){let s=a===1?-1/0:e[a],l=e[a+1],u=a,c=a+1;if(typeof s!="number")return r.error(\'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',u);if(i.length&&i[i.length-1][0]>=s)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let p=r.parse(l,c,o);if(!p)return null;o=o||p.type,i.push([s,p])}return new Ft(o,n,i)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=ii(r,i);return n[a].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Ky(t){return t==="rgb"||t==="hcl"||t==="lab"}function Mt(t,e,r){return t+r*(e-t)}function Yy(t,e,r,n="rgb"){switch(n){case"rgb":{let[i,o,a,s]=oi(t.rgb,e.rgb,r);return new q(i,o,a,s,!1)}case"hcl":{let[i,o,a,s]=t.hcl,[l,u,c,p]=e.hcl,f,y;if(!isNaN(i)&&!isNaN(l)){let v=l-i;l>i&&v>180?v-=360:l<i&&i-l>180&&(v+=360),f=i+r*v}else isNaN(i)?isNaN(l)?f=NaN:(f=l,(a===1||a===0)&&(y=u)):(f=i,(c===1||c===0)&&(y=o));let[m,d,h,g]=Ey([f,y!=null?y:Mt(o,u,r),Mt(a,c,r),Mt(s,p,r)]);return new q(m,d,h,g,!1)}case"lab":{let[i,o,a,s]=Cl(oi(t.lab,e.lab,r));return new q(i,o,a,s,!1)}}}function oi(t,e,r){return t.map((n,i)=>Mt(n,e[i],r))}function Xy(t,e,r){return new Le(oi(t.values,e.values,r))}function Qy(t,e,r){let n=t.values,i=e.values;if(n.length!==i.length)throw new se(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);let o=[];for(let a=0;a<n.length;a+=2){if(n[a]!==i[a])throw new se(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${n[a]}, to[${a}]: ${i[a]}`);o.push(n[a]);let[s,l]=n[a+1],[u,c]=i[a+1];o.push([Mt(s,u,r),Mt(l,c,r)])}return new He(o)}var Ne={number:Mt,color:Yy,array:oi,padding:Xy,variableAnchorOffsetCollection:Qy},Be=class{constructor(e,r,n,i,o){this.type=e,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(e,r,n,i){let o=0;if(e.name==="exponential")o=Wo(r,e.base,n,i);else if(e.name==="linear")o=Wo(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new xl.default(a[0],a[1],a[2],a[3]).solve(Wo(r,1,n,i))}return o}static parse(e,r){let[n,i,o,...a]=e;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(i[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,M),!o)return null;let s=[],l=null;n==="interpolate-hcl"||n==="interpolate-lab"?l=Re:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],f=u+3,y=u+4;if(typeof c!="number")return r.error(\'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',f);if(s.length&&s[s.length-1][0]>=c)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',f);let m=r.parse(p,y,l);if(!m)return null;l=l||m.type,s.push([c,m])}return!Wr(l,M)&&!Wr(l,Re)&&!Wr(l,Jn)&&!Wr(l,Wn)&&!Wr(l,Ve(M))?r.error(`Type ${re(l)} is not interpolatable.`):new Be(l,n,i,o,s)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=ii(r,i),s=r[a],l=r[a+1],u=Be.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(e),p=n[a+1].evaluate(e);switch(this.operator){case"interpolate":return Ne[this.type.kind](c,p,u);case"interpolate-hcl":return Ne.color(c,p,u,"hcl");case"interpolate-lab":return Ne.color(c,p,u,"lab")}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Wo(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var ir=class{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of e.slice(1)){let l=r.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return i&&o.some(s=>Zr(i,s.type))?new ir($,o):new ir(n,o)}evaluate(e){let r=null,n=0,i;for(let o of this.args)if(n++,r=o.evaluate(e),r&&r instanceof Ce&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},en=class{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return r.error(`Expected string, but found ${typeof a} instead.`,o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(e[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return i?new en(n,i):null}outputDefined(){return this.result.outputDefined()}},ai=class{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,M),i=r.parse(e[2],2,Ve(r.expectedType||$));if(!n||!i)return null;let o=i.type;return new ai(o.itemType,n,i)}evaluate(e){let r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new se(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new se(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new se(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},si=class{constructor(e,r){this.type=U,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,$),i=r.parse(e[2],2,$);return!n||!i?null:Oo(n.type,[U,G,M,Qt,$])?new si(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${re(n.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!Jr(r,["boolean","string","number","null"]))throw new se(`Expected first argument to be of type boolean, string, number or null, but found ${re(pe(r))} instead.`);if(!Jr(n,["string","array"]))throw new se(`Expected second argument to be of type array or string, but found ${re(pe(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},tn=class{constructor(e,r,n){this.type=M,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,$),i=r.parse(e[2],2,$);if(!n||!i)return null;if(!Oo(n.type,[U,G,M,Qt,$]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${re(n.type)} instead`);if(e.length===4){let o=r.parse(e[3],3,M);return o?new tn(n,i,o):null}else return new tn(n,i)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!Jr(r,["boolean","string","number","null"]))throw new se(`Expected first argument to be of type boolean, string, number or null, but found ${re(pe(r))} instead.`);if(!Jr(n,["string","array"]))throw new se(`Expected second argument to be of type array or string, but found ${re(pe(n))} instead.`);if(this.fromIndex){let i=this.fromIndex.evaluate(e);return n.indexOf(r,i)}return n.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},li=class{constructor(e,r,n,i,o,a){this.inputType=e,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=pe(m);else if(f.checkSubtype(n,pe(m)))return null;if(typeof o[String(m)]!="undefined")return f.error("Branch labels must be unique.");o[String(m)]=a.length}let y=r.parse(p,u,i);if(!y)return null;i=i||y.type,a.push(y)}let s=r.parse(e[1],1,$);if(!s)return null;let l=r.parse(e[e.length-1],e.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new li(n,i,s,o,a,l)}evaluate(e){let r=this.input.evaluate(e);return(pe(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},ui=class{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let s=r.parse(e[a],a,U);if(!s)return null;let l=r.parse(e[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new ui(n,i,o)}evaluate(e){for(let[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},rn=class{constructor(e,r,n,i){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,$),i=r.parse(e[2],2,M);if(!n||!i)return null;if(!Oo(n.type,[Ve($),G,$]))return r.error(`Expected first argument to be of type array or string, but found ${re(n.type)} instead`);if(e.length===4){let o=r.parse(e[3],3,M);return o?new rn(n.type,n,i,o):null}else return new rn(n.type,n,i)}evaluate(e){let r=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!Jr(r,["string","array"]))throw new se(`Expected first argument to be of type array or string, but found ${re(pe(r))} instead.`);if(this.endIndex){let i=this.endIndex.evaluate(e);return r.slice(n,i)}return r.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function zl(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function em(t,e,r){return e===r}function tm(t,e,r){return e!==r}function rm(t,e,r){return e<r}function nm(t,e,r){return e>r}function im(t,e,r){return e<=r}function om(t,e,r){return e>=r}function Rl(t,e,r,n){return n.compare(e,r)===0}function am(t,e,r,n){return!Rl(t,e,r,n)}function sm(t,e,r,n){return n.compare(e,r)<0}function lm(t,e,r,n){return n.compare(e,r)>0}function um(t,e,r,n){return n.compare(e,r)<=0}function cm(t,e,r,n){return n.compare(e,r)>=0}function or(t,e,r){let n=t!=="=="&&t!=="!=";return class Ol{constructor(o,a,s){this.type=U,this.lhs=o,this.rhs=a,this.collator=s,this.hasUntypedArgument=o.type.kind==="value"||a.type.kind==="value"}static parse(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");let s=o[0],l=a.parse(o[1],1,$);if(!l)return null;if(!zl(s,l.type))return a.concat(1).error(`"${s}" comparisons are not supported for type \'${re(l.type)}\'.`);let u=a.parse(o[2],2,$);if(!u)return null;if(!zl(s,u.type))return a.concat(2).error(`"${s}" comparisons are not supported for type \'${re(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error(`Cannot compare types \'${re(l.type)}\' and \'${re(u.type)}\'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Oe(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Oe(l.type,[u])));let c=null;if(o.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(c=a.parse(o[3],3,Zn),!c)return null}return new Ol(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=pe(a),u=pe(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new se(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let l=pe(a),u=pe(s);if(l.kind!=="string"||u.kind!=="string")return e(o,a,s)}return this.collator?r(o,a,s,this.collator.evaluate(o)):e(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var pm=or("==",em,Rl),fm=or("!=",tm,am),ym=or("<",rm,sm),mm=or(">",nm,lm),hm=or("<=",im,um),dm=or(">=",om,cm),ci=class{constructor(e,r,n,i,o){this.type=G,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let n=r.parse(e[1],1,M);if(!n)return null;let i=e[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=r.parse(i.locale,1,G),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,G),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,M),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,M),!l)?null:new ci(n,o,a,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},ar=class{constructor(e){this.type=tr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],o=!1;for(let a=1;a<=e.length-1;++a){let s=e[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,M),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Ve(G)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,Re),!c))return null;let p=i[i.length-1];p.scale=l,p.font=u,p.textColor=c}else{let l=r.parse(e[a],1,$);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");o=!0,i.push({content:l,scale:null,font:null,textColor:null})}}return new ar(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return pe(i)===qr?new Yn("",i,null,null,null):new Yn(Hr(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null)};return new ve(this.sections.map(r))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}},pi=class{constructor(e){this.type=qr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,G);return n?new pi(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Ce.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},fi=class{constructor(e){this.type=M,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${re(n.type)} instead.`):new fi(n):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return r.length;if(Array.isArray(r))return r.length;throw new se(`Expected value to be of type string or array, but found ${re(pe(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},Dt={"==":pm,"!=":fm,">":mm,"<":ym,">=":dm,"<=":hm,array:Oe,at:ai,boolean:Oe,case:ui,coalesce:ir,collator:Yr,format:ar,image:pi,in:si,"index-of":tn,interpolate:Be,"interpolate-hcl":Be,"interpolate-lab":Be,length:fi,let:en,literal:at,match:li,number:Oe,"number-format":ci,object:Oe,slice:rn,step:Ft,string:Oe,"to-boolean":st,"to-color":st,"to-number":st,"to-string":st,var:Xr,within:xt};function Nl(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);let o=i?i.evaluate(t):1,a=Tl(e,r,n,o);if(a)throw new se(a);return new q(e/255,r/255,n/255,o,!1)}function Ul(t,e){return t in e}function Ho(t,e){let r=e[t];return typeof r=="undefined"?null:r}function gm(t,e,r,n){for(;r<=n;){let i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}function Vt(t){return{type:t}}Fe.register(Dt,{error:[_y,[G],(t,[e])=>{throw new se(e.evaluate(t))}],typeof:[G,[$],(t,[e])=>re(pe(e.evaluate(t)))],"to-rgba":[Ve(M,4),[Re],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[Re,[M,M,M],Nl],rgba:[Re,[M,M,M,M],Nl],has:{type:U,overloads:[[[G],(t,[e])=>Ul(e.evaluate(t),t.properties())],[[G,er],(t,[e,r])=>Ul(e.evaluate(t),r.evaluate(t))]]},get:{type:$,overloads:[[[G],(t,[e])=>Ho(e.evaluate(t),t.properties())],[[G,er],(t,[e,r])=>Ho(e.evaluate(t),r.evaluate(t))]]},"feature-state":[$,[G],(t,[e])=>Ho(e.evaluate(t),t.featureState||{})],properties:[er,[],t=>t.properties()],"geometry-type":[G,[],t=>t.geometryType()],id:[$,[],t=>t.id()],zoom:[M,[],t=>t.globals.zoom],"heatmap-density":[M,[],t=>t.globals.heatmapDensity||0],"line-progress":[M,[],t=>t.globals.lineProgress||0],accumulated:[$,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[M,Vt(M),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[M,Vt(M),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:M,overloads:[[[M,M],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[M],(t,[e])=>-e.evaluate(t)]]},"/":[M,[M,M],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[M,[M,M],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[M,[],()=>Math.LN2],pi:[M,[],()=>Math.PI],e:[M,[],()=>Math.E],"^":[M,[M,M],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[M,[M],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[M,[M],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[M,[M],(t,[e])=>Math.log(e.evaluate(t))],log2:[M,[M],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[M,[M],(t,[e])=>Math.sin(e.evaluate(t))],cos:[M,[M],(t,[e])=>Math.cos(e.evaluate(t))],tan:[M,[M],(t,[e])=>Math.tan(e.evaluate(t))],asin:[M,[M],(t,[e])=>Math.asin(e.evaluate(t))],acos:[M,[M],(t,[e])=>Math.acos(e.evaluate(t))],atan:[M,[M],(t,[e])=>Math.atan(e.evaluate(t))],min:[M,Vt(M),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[M,Vt(M),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[M,[M],(t,[e])=>Math.abs(e.evaluate(t))],round:[M,[M],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[M,[M],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[M,[M],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[G,$],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[$],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[G],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[$],(t,[e])=>e.value in t.properties()],"filter-has-id":[U,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[U,[Ve(G)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Ve($)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[G,Ve($)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[G,Ve($)],(t,[e,r])=>gm(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Vt(U),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Vt(U),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[U,[U],(t,[e])=>!e.evaluate(t)],"is-supported-script":[U,[G],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[G,[G],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[G,[G],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[G,Vt($),(t,e)=>e.map(r=>Hr(r.evaluate(t))).join("")],"resolved-locale":[G,[Zn],(t,[e])=>e.evaluate(t).resolvedLocale()]});function Ko(t){return{result:"success",value:t}}function sr(t){return{result:"error",value:t}}function bt(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function $l(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Yo(t){return!!t.expression&&t.expression.interpolated}function Z(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function yi(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function xm(t){return t}function Gl(t,e){let r=e.type==="color",n=t.stops&&typeof t.stops[0][0]=="object",i=n||t.property!==void 0,o=n||!i,a=t.type||(Yo(e)?"exponential":"interval");if(r||e.type==="padding"){let c=r?q.parse:Le.parse;t=Xt({},t),t.stops&&(t.stops=t.stops.map(p=>[p[0],c(p[1])])),t.default?t.default=c(t.default):t.default=c(e.default)}if(t.colorSpace&&!Ky(t.colorSpace))throw new Error(`Unknown color space: "${t.colorSpace}"`);let s,l,u;if(a==="exponential")s=jl;else if(a==="interval")s=vm;else if(a==="categorical"){s=bm,l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}else if(a==="identity")s=Pm;else throw new Error(`Unknown function type "${a}"`);if(n){let c={},p=[];for(let m=0;m<t.stops.length;m++){let d=t.stops[m],h=d[0].zoom;c[h]===void 0&&(c[h]={zoom:h,type:t.type,property:t.property,default:t.default,stops:[]},p.push(h)),c[h].stops.push([d[0].value,d[1]])}let f=[];for(let m of p)f.push([c[m].zoom,Gl(c[m],e)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:Be.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},d){return jl({stops:f,base:t.base},e,m).evaluate(m,d)}}}else if(o){let c=a==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:Be.interpolationFactor.bind(void 0,c),zoomStops:t.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(t,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let f=p&&p.properties?p.properties[t.property]:void 0;return f===void 0?nn(t.default,e.default):s(t,e,f,l,u)}}}function nn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function bm(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return nn(o,t.default,e.default)}function vm(t,e,r){if(Z(r)!=="number")return nn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let i=ii(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function jl(t,e,r){let n=t.base!==void 0?t.base:1;if(Z(r)!=="number")return nn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let o=ii(t.stops.map(c=>c[0]),r),a=Sm(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=Ne[e.type]||xm;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(p===void 0||f===void 0))return u(p,f,a,t.colorSpace)}}:u(s,l,a,t.colorSpace)}function Pm(t,e,r){switch(e.type){case"color":r=q.parse(r);break;case"formatted":r=ve.fromString(r.toString());break;case"resolvedImage":r=Ce.fromString(r.toString());break;case"padding":r=Le.parse(r);break;default:Z(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return nn(r,t.default,e.default)}function Sm(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var lr=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new jo,this._defaultValue=r?_m(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,i,o,a){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new se(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(s)} instead.`);return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console!="undefined"&&console.warn(s.message)),this._defaultValue}}};function on(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Dt}function Bt(t,e){let r=new Kr(Dt,ti,[],e?wm(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Ko(new lr(n,e)):sr(r.errors)}var zt=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Qr(r.expression)}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}},Rt=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Qr(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}interpolationFactor(e,r,n){return this.interpolationType?Be.interpolationFactor(this.interpolationType,e,r,n):0}};function ql(t,e){let r=Bt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=ri(n);if(!i&&!bt(e))return sr([new We("","data expressions not supported")]);let o=ni(n,["zoom"]);if(!o&&!$l(e))return sr([new We("","zoom expressions not supported")]);let a=mi(n);if(!a&&!o)return sr([new We("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof We)return sr([a]);if(a instanceof Be&&!Yo(e))return sr([new We("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return Ko(i?new zt("constant",r.value):new zt("source",r.value));let s=a instanceof Be?a.interpolation:void 0;return Ko(i?new Rt("camera",r.value,a.labels,s):new Rt("composite",r.value,a.labels,s))}var ur=class{constructor(e,r){this._parameters=e,this._specification=r,Xt(this,Gl(this._parameters,this._specification))}static deserialize(e){return new ur(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function Zl(t,e){if(yi(t))return new ur(t,e);if(on(t)){let r=ql(t,e);if(r.result==="error")throw new Error(r.value.map(n=>`${n.key}: ${n.message}`).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=q.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=Le.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)&&(r=He.parse(t)),{kind:"constant",evaluate:()=>r}}}function mi(t){let e=null;if(t instanceof en)e=mi(t.result);else if(t instanceof ir){for(let r of t.args)if(e=mi(r),e)break}else(t instanceof Ft||t instanceof Be)&&t.input instanceof Fe&&t.input.name==="zoom"&&(e=t);return e instanceof We||t.eachChild(r=>{let n=mi(r);n instanceof We?e=n:!e&&n?e=new We("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&n&&e!==n&&(e=new We("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function wm(t){let e={color:Re,string:G,number:M,enum:G,boolean:U,formatted:tr,padding:Jn,resolvedImage:qr,variableAnchorOffsetCollection:Wn};return t.type==="array"?Ve(e[t.value]||$,t.length):e[t.type]}function _m(t){return t.type==="color"&&yi(t.default)?new q(0,0,0,0):t.type==="color"?q.parse(t.default)||null:t.type==="padding"?Le.parse(t.default)||null:t.type==="variableAnchorOffsetCollection"?He.parse(t.default)||null:t.default===void 0?null:t.default}function Xo(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let e of t.slice(1))if(!Xo(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var Am={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function an(t){if(t==null)return{filter:()=>!0,needGeometry:!1};Xo(t)||(t=hi(t));let e=Bt(t,Am);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=Jl(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r}}}function Cm(t,e){return t<e?-1:t>e?1:0}function Jl(t){if(!Array.isArray(t))return!1;if(t[0]==="within")return!0;for(let e=1;e<t.length;e++)if(Jl(t[e]))return!0;return!1}function hi(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?Qo(t[1],t[2],"=="):e==="!="?di(Qo(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Qo(t[1],t[2],e):e==="any"?Im(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(hi)):e==="none"?["all"].concat(t.slice(1).map(hi).map(di)):e==="in"?Wl(t[1],t.slice(2)):e==="!in"?di(Wl(t[1],t.slice(2))):e==="has"?Hl(t[1]):e==="!has"?di(Hl(t[1])):e==="within"?t:!0}function Qo(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Im(t){return["any"].concat(t.map(hi))}function Wl(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Cm)]]:["filter-in-small",t,["literal",e]]}}function Hl(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function di(t){return["!",t]}function ea(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t===void 0||t===null)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(let o of t)i+=`${ea(o)},`;return`${i}]`}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+=`${JSON.stringify(r[i])}:${ea(t[r[i]])},`;return`${n}}`}function km(t){let e="";for(let r of wy)e+=`/${ea(t[r])}`;return e}function Kl(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||km(t[i]);e&&(e[t[i].id]=o);let a=r[o];a||(a=r[o]=[]),a.push(t[i])}let n=[];for(let i in r)n.push(r[i]);return n}function Yl(t){let e=t.key,r=t.value;return r?[new D(e,r,"constants have been deprecated as of v8")]:[]}function fe(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Ot(t){if(Array.isArray(t))return t.map(Ot);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Ot(t[r]);return e}return fe(t)}function Ue(t){let e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec,l=[],u=Z(r);if(u!=="object")return[new D(e,r,`object expected, ${u} found`)];for(let c in r){let p=c.split(".")[0],f=n[p]||n["*"],y;if(i[p])y=i[p];else if(n[p])y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new D(e,r[c],`unknown property "${c}"`));continue}l=l.concat(y({key:(e&&`${e}.`)+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new D(e,r,`missing required property "${c}"`));return l}function ta(t){let e=t.value,r=t.valueSpec,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.key,s=t.arrayElementValidator||n;if(Z(e)!=="array")return[new D(a,e,`array expected, ${Z(e)} found`)];if(r.length&&e.length!==r.length)return[new D(a,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new D(a,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),Z(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:o,key:`${a}[${c}]`}));return u}function ra(t){let e=t.key,r=t.value,n=t.valueSpec,i=Z(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new D(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new D(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new D(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Xl(t){let e=t.valueSpec,r=fe(t.value.type),n,i={},o,a,s=r!=="categorical"&&t.value.property===void 0,l=!s,u=Z(t.value.stops)==="array"&&Z(t.value.stops[0])==="array"&&Z(t.value.stops[0][0])==="object",c=Ue({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:p,default:m}});return r==="identity"&&s&&c.push(new D(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&c.push(new D(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!Yo(t.valueSpec)&&c.push(new D(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!bt(t.valueSpec)?c.push(new D(t.key,t.value,"property functions not supported")):s&&!$l(t.valueSpec)&&c.push(new D(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new D(t.key,t.value,\'"property" property is required\')),c;function p(d){if(r==="identity")return[new D(d.key,d.value,\'identity function may not have a "stops" property\')];let h=[],g=d.value;return h=h.concat(ta({key:d.key,value:g,valueSpec:d.valueSpec,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec,arrayElementValidator:f})),Z(g)==="array"&&g.length===0&&h.push(new D(d.key,g,"array must have at least one stop")),h}function f(d){let h=[],g=d.value,v=d.key;if(Z(g)!=="array")return[new D(v,g,`array expected, ${Z(g)} found`)];if(g.length!==2)return[new D(v,g,`array length 2 expected, length ${g.length} found`)];if(u){if(Z(g[0])!=="object")return[new D(v,g,`object expected, ${Z(g[0])} found`)];if(g[0].zoom===void 0)return[new D(v,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new D(v,g,"object stop key must have value")];if(a&&a>fe(g[0].zoom))return[new D(v,g[0].zoom,"stop zoom values must appear in ascending order")];fe(g[0].zoom)!==a&&(a=fe(g[0].zoom),o=void 0,i={}),h=h.concat(Ue({key:`${v}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec,objectElementValidators:{zoom:ra,value:y}}))}else h=h.concat(y({key:`${v}[0]`,value:g[0],valueSpec:{},validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec},g));return on(Ot(g[1]))?h.concat([new D(`${v}[1]`,g[1],"expressions are not allowed in function stops.")]):h.concat(d.validateSpec({key:`${v}[1]`,value:g[1],valueSpec:e,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec}))}function y(d,h){let g=Z(d.value),v=fe(d.value),b=d.value!==null?d.value:h;if(!n)n=g;else if(g!==n)return[new D(d.key,b,`${g} stop domain type must match previous stop domain type ${n}`)];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new D(d.key,b,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let x=`number expected, ${g} found`;return bt(e)&&r===void 0&&(x+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new D(d.key,b,x)]}return r==="categorical"&&g==="number"&&(!isFinite(v)||Math.floor(v)!==v)?[new D(d.key,b,`integer expected, found ${v}`)]:r!=="categorical"&&g==="number"&&o!==void 0&&v<o?[new D(d.key,b,"stop domain values must appear in ascending order")]:(o=v,r==="categorical"&&v in i?[new D(d.key,b,"stop domain values must be unique")]:(i[v]=!0,[]))}function m(d){return d.validateSpec({key:d.key,value:d.value,valueSpec:e,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec})}}function cr(t){let e=(t.expressionContext==="property"?ql:Bt)(Ot(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new D(`${t.key}${n.key}`,t.value,n.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new D(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!Qr(r))return[new D(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!Qr(r))return[new D(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!ni(r,["zoom","feature-state"]))return[new D(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!ri(r))return[new D(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Tm(t){let e=t.value,r=t.key,n=Z(e);return n!=="boolean"?[new D(r,e,`boolean expected, ${n} found`)]:[]}function Em(t){let e=t.key,r=t.value,n=Z(r);return n!=="string"?[new D(e,r,`color expected, ${n} found`)]:q.parse(String(r))?[]:[new D(e,r,`color expected, "${r}" found`)]}function sn(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(fe(r))===-1&&i.push(new D(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(fe(r))===-1&&i.push(new D(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function na(t){return Xo(Ot(t.value))?cr(Xt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ql(t)}function Ql(t){let e=t.value,r=t.key;if(Z(e)!=="array")return[new D(r,e,`array expected, ${Z(e)} found`)];let n=t.styleSpec,i,o=[];if(e.length<1)return[new D(r,e,"filter array must have at least 1 element")];switch(o=o.concat(sn({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),fe(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&fe(e[1])==="$type"&&o.push(new D(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new D(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=Z(e[1]),i!=="string"&&o.push(new D(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=Z(e[a]),fe(e[1])==="$type"?o=o.concat(sn({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new D(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(Ql({key:`${r}[${a}]`,value:e[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=Z(e[1]),e.length!==2?o.push(new D(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):i!=="string"&&o.push(new D(`${r}[1]`,e[1],`string expected, ${i} found`));break;case"within":i=Z(e[1]),e.length!==2?o.push(new D(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):i!=="object"&&o.push(new D(`${r}[1]`,e[1],`object expected, ${i} found`));break}return o}function eu(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=t.valueSpec||l[s];if(!c)return[new D(r,a,`unknown property "${s}"`)];let p;if(Z(a)==="string"&&bt(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new D(r,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \\`{ "type": "identity", "property": ${JSON.stringify(p[1])} }\\`.`)];let f=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new D(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&yi(Ot(a))&&fe(a.type)==="identity"&&f.push(new D(r,a,\'"text-font" does not support identity functions\'))),f.concat(n({key:t.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function tu(t){return eu(t,"paint")}function ru(t){return eu(t,"layout")}function nu(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;!r.type&&!r.ref&&e.push(new D(n,r,\'either "type" or "ref" is required\'));let a=fe(r.type),s=fe(r.ref);if(r.id){let l=fe(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];fe(c.id)===l&&e.push(new D(n,r.id,`duplicate layer id "${r.id}", previously used at line ${c.id.__line__}`))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new D(n,r[u],`"${u}" is prohibited for ref layers`))});let l;i.layers.forEach(u=>{fe(u.id)===s&&(l=u)}),l?l.ref?e.push(new D(n,r.ref,"ref cannot reference another ref layer")):a=fe(l.type):e.push(new D(n,r.ref,`ref layer "${s}" not found`))}else if(a!=="background")if(!r.source)e.push(new D(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&fe(l.type);l?u==="vector"&&a==="raster"?e.push(new D(n,r.source,`layer "${r.id}" requires a raster source`)):u==="raster"&&a!=="raster"?e.push(new D(n,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new D(n,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&a!=="hillshade"?e.push(new D(n,r.source,"raster-dem source can only be used with layer type \'hillshade\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new D(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new D(n,r.source,`source "${r.source}" not found`))}return e=e.concat(Ue({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:na,layout(l){return Ue({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return ru(Xt({layerType:a},u))}}})},paint(l){return Ue({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return tu(Xt({layerType:a},u))}}})}}})),e}function Nt(t){let e=t.value,r=t.key,n=Z(e);return n!=="string"?[new D(r,e,`string expected, ${n} found`)]:[]}var iu={promoteId:Lm};function ou(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new D(r,e,\'"type" is required\')];let a=fe(e.type),s;switch(a){case"vector":case"raster":case"raster-dem":return s=Ue({key:r,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:iu,validateSpec:o}),s;case"geojson":if(s=Ue({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:iu}),e.cluster)for(let l in e.clusterProperties){let[u,c]=e.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...cr({key:`${r}.${l}.map`,value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...cr({key:`${r}.${l}.reduce`,value:p,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Ue({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Ue({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new D(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return sn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:o,styleSpec:n})}}function Lm({key:t,value:e}){if(Z(e)==="string")return Nt({key:t,value:e});{let r=[];for(let n in e)r.push(...Nt({key:`${t}.${n}`,value:e[n]}));return r}}function au(t){let e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=Z(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new D("light",e,`object expected, ${a} found`)]),o;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new D(s,e[s],`unknown property "${s}"`)])}return o}function su(t){let e=t.value,r=t.styleSpec,n=r.terrain,i=t.style,o=[],a=Z(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new D("terrain",e,`object expected, ${a} found`)]),o;for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new D(s,e[s],`unknown property "${s}"`)]);return o}function Fm(t){return Nt(t).length===0?[]:cr(t)}function Mm(t){return Nt(t).length===0?[]:cr(t)}function Dm(t){let e=t.key,r=t.value;if(Z(r)==="array"){if(r.length<1||r.length>4)return[new D(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return ra({key:e,value:r,valueSpec:{}})}function Vm(t){let e=t.key,r=t.value,n=Z(r),i=t.styleSpec;if(n!=="array"||r.length<1||r.length%2!=0)return[new D(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(sn({key:`${e}[${a}]`,value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(ta({key:`${e}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function lu(t){let e=[],r=t.value,n=t.key;if(Array.isArray(r)){let i=[],o=[];for(let a in r){r[a].id&&i.includes(r[a].id)&&e.push(new D(n,r,`all the sprites\' ids must be unique, but ${r[a].id} is duplicated`)),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new D(n,r,`all the sprites\' URLs must be unique, but ${r[a].url} is duplicated`)),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Ue({key:`${n}[${a}]`,value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Nt({key:n,value:r})}var uu={"*"(){return[]},array:ta,boolean:Tm,number:ra,color:Em,constants:Yl,enum:sn,filter:na,function:Xl,layer:nu,object:Ue,source:ou,light:au,terrain:su,string:Nt,formatted:Fm,resolvedImage:Mm,padding:Dm,variableAnchorOffsetCollection:Vm,sprite:lu};function ln(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=ln,r.expression&&yi(fe(e))?Xl(t):r.expression&&on(Ot(e))?cr(t):r.type&&uu[r.type]?uu[r.type](t):Ue(Xt({},t,{valueSpec:r.type?n[r.type]:r}))}function cu(t){let e=t.value,r=t.key,n=Nt(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new D(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&n.push(new D(r,e,\'"glyphs" url must include a "{range}" token\'))),n}function Ke(t,e=S){let r=[];return r=r.concat(ln({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:ln,objectElementValidators:{glyphs:cu,"*"(){return[]}}})),t.constants&&(r=r.concat(Yl({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:ln}))),pu(r)}Ke.source=ut(lt(ou));Ke.sprite=ut(lt(lu));Ke.glyphs=ut(lt(cu));Ke.light=ut(lt(au));Ke.terrain=ut(lt(su));Ke.layer=ut(lt(nu));Ke.filter=ut(lt(na));Ke.paintProperty=ut(lt(tu));Ke.layoutProperty=ut(lt(ru));function lt(t){return function(e){return t({...e,validateSpec:ln})}}function pu(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function ut(t){return function(...e){return pu(t.apply(this,e))}}var fu={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};var un=class extends Error{constructor(e,r,n,i){super(`AJAXError: ${r} (${e}): ${n}`);this.status=e,this.statusText=r,this.url=n,this.body=i}},yu=Ee()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Bm=t=>fu.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))],zm=t=>/^file:/.test(t)||/^file:/.test(yu())&&!/^\\w+:/.test(t);function mu(t,e){let r=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:yu(),signal:r.signal}),i=!1,o=!1;t.type==="json"&&n.headers.set("Accept","application/json");let a=(l,u,c)=>{if(!o){if(l&&l.message!=="SecurityError"&&ce(l),u&&c)return s(u);fetch(n).then(p=>p.ok?s(p):p.blob().then(f=>e(new un(p.status,p.statusText,t.url,f)))).catch(p=>{p.code!==20&&e(new Error(p.message))})}},s=l=>{(t.type==="arrayBuffer"||t.type==="image"?l.arrayBuffer():t.type==="json"?l.json():l.text()).then(u=>{o||(i=!0,e(null,u,l.headers.get("Cache-Control"),l.headers.get("Expires")))}).catch(u=>{o||e(new Error(u.message))})};return a(null,null),{cancel:()=>{o=!0,i||r.abort()}}}function Rm(t,e){let r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(r.responseType="arraybuffer");for(let n in t.headers)r.setRequestHeader(n,t.headers[n]);return t.type==="json"&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials=t.credentials==="include",r.onerror=()=>{e(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||r.status===0)&&r.response!==null){let n=r.response;if(t.type==="json")try{n=JSON.parse(r.response)}catch(i){return e(i)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else{let n=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});e(new un(r.status,r.statusText,t.url,n))}},r.send(t.body),{cancel:()=>r.abort()}}var hu=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(Ee()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!Ee())return(Bm(t.url)||mu)(t,e)}if(!zm(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return mu(t,e);if(Ee()&&self.worker&&self.worker.actor){let r=!0;return self.worker.actor.send("getResource",t,e,void 0,r)}}return Rm(t,e)},du=function(t,e){return hu(Ae(t,{type:"json"}),e)},ia=function(t,e){return hu(Ae(t,{type:"arrayBuffer"}),e)};var vt={};function k(t,e,r={}){if(vt[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),vt[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}k("Object",Object);k("TransferableGridIndex",dt);k("Color",q);k("Error",Error);k("AJAXError",un);k("ResolvedImage",Ce);k("StylePropertyFunction",ur);k("StyleExpression",lr,{omit:["_evaluator"]});k("ZoomDependentExpression",Rt);k("ZoomConstantExpression",zt);k("CompoundExpression",Fe,{omit:["_evaluate"]});for(let t in Dt)Dt[t]._classRegistryKey||k(`Expression_${t}`,Dt[t]);function gu(t){return t&&typeof ArrayBuffer!="undefined"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function pr(t,e){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(gu(t)||jr(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){let r=t;return e&&e.push(r.buffer),r}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){let r=[];for(let n of t)r.push(pr(n,e));return r}if(typeof t=="object"){let r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error("can\'t serialize object of unregistered class");if(!vt[n])throw new Error(`${n} is not registered.`);let i=r.serialize?r.serialize(t,e):{};if(r.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won\'t survive transfer of $name property")}else{for(let o in t){if(!t.hasOwnProperty(o)||vt[n].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=vt[n].shallow.indexOf(o)>=0?a:pr(a,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(i.$name=n),i}throw new Error(`can\'t serialize object of type ${typeof t}`)}function fr(t){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||gu(t)||jr(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(fr);if(typeof t=="object"){let e=t.$name||"Object";if(!vt[e])throw new Error(`can\'t deserialize unregistered class ${e}`);let{klass:r}=vt[e];if(!r)throw new Error(`can\'t deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);let n=Object.create(r.prototype);for(let i of Object.keys(t)){if(i==="$name")continue;let o=t[i];n[i]=vt[e].shallow.indexOf(i)>=0?o:fr(o)}return n}throw new Error(`can\'t deserialize object of type ${typeof t}`)}var oa=class{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel!="undefined"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}};var aa=class{constructor(e,r,n){this.receive=e=>{let r=e.data,n=r.id;if(!!n&&!(r.targetMapId&&this.mapId!==r.targetMapId))if(r.type==="<cancel>"){delete this.tasks[n];let i=this.cancelCallbacks[n];delete this.cancelCallbacks[n],i&&i()}else Ee()||r.mustQueue?(this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger()):this.processTask(n,r)};this.process=()=>{if(!this.taskQueue.length)return;let e=this.taskQueue.shift(),r=this.tasks[e];delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!!r&&this.processTask(e,r)};this.target=e,this.parent=r,this.mapId=n,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new oa(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Ee()?e:window}send(e,r,n,i,o=!1){let a=Math.round(Math.random()*1e18).toString(36).substring(0,10);n&&(this.callbacks[a]=n);let s=Ro(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:e,hasCallback:!!n,targetMapId:i,mustQueue:o,sourceMapId:this.mapId,data:pr(r,s)},s),{cancel:()=>{n&&delete this.callbacks[a],this.target.postMessage({id:a,type:"<cancel>",targetMapId:i,sourceMapId:this.mapId})}}}processTask(e,r){if(r.type==="<response>"){let n=this.callbacks[e];delete this.callbacks[e],n&&(r.error?n(fr(r.error)):n(null,fr(r.data)))}else{let n=!1,i=Ro(this.globalScope)?void 0:[],o=r.hasCallback?(l,u)=>{n=!0,delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:l?pr(l):null,data:pr(u,i)},i)}:l=>{n=!0},a=null,s=fr(r.data);if(this.parent[r.type])a=this.parent[r.type](r.sourceMapId,s,o);else if(this.parent.getWorkerSource){let l=r.type.split(".");a=this.parent.getWorkerSource(r.sourceMapId,l[0],s.source)[l[1]](s,o)}else o(new Error(`Could not find function ${r.type}`));!n&&a&&a.cancel&&(this.cancelCallbacks[e]=a.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}};function xu(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function sa(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var gi=class{constructor(e,r={}){Ae(this,r),this.type=e}},xi=class extends gi{constructor(e,r={}){super("error",Ae({error:e},r))}},cn=class{on(e,r){return this._listeners=this._listeners||{},xu(e,r,this._listeners),this}off(e,r){return sa(e,r,this._listeners),sa(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},xu(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new gi(e,r||{}));let n=e.type;if(this.listens(n)){e.target=this;let i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let s of i)s.call(this,e);let o=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let s of o)sa(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(Ae(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof xi&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}};var Pt=Ke,Sb=Pt.source,wb=Pt.light,_b=Pt.terrain,Ab=Pt.filter,bu=Pt.paintProperty,vu=Pt.layoutProperty;function Pu(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new xi(new Error(n.message))),r=!0;return r}var la=class{constructor(){this.first=!0}update(e,r){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=n,!0):!1)}};var V={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function pn(t){for(let e of t)if(bi(e.charCodeAt(0)))return!0;return!1}function Su(t){for(let e of t)if(!Om(e.charCodeAt(0)))return!1;return!0}function Om(t){return!(V.Arabic(t)||V["Arabic Supplement"](t)||V["Arabic Extended-A"](t)||V["Arabic Presentation Forms-A"](t)||V["Arabic Presentation Forms-B"](t))}function wu(t){return t<11904?!1:!!(V["Bopomofo Extended"](t)||V.Bopomofo(t)||V["CJK Compatibility Forms"](t)||V["CJK Compatibility Ideographs"](t)||V["CJK Compatibility"](t)||V["CJK Radicals Supplement"](t)||V["CJK Strokes"](t)||V["CJK Symbols and Punctuation"](t)||V["CJK Unified Ideographs Extension A"](t)||V["CJK Unified Ideographs"](t)||V["Enclosed CJK Letters and Months"](t)||V["Halfwidth and Fullwidth Forms"](t)||V.Hiragana(t)||V["Ideographic Description Characters"](t)||V["Kangxi Radicals"](t)||V["Katakana Phonetic Extensions"](t)||V.Katakana(t)||V["Vertical Forms"](t)||V["Yi Radicals"](t)||V["Yi Syllables"](t))}function bi(t){return t===746||t===747?!0:t<4352?!1:!!(V["Bopomofo Extended"](t)||V.Bopomofo(t)||V["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||V["CJK Compatibility Ideographs"](t)||V["CJK Compatibility"](t)||V["CJK Radicals Supplement"](t)||V["CJK Strokes"](t)||V["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||V["CJK Unified Ideographs Extension A"](t)||V["CJK Unified Ideographs"](t)||V["Enclosed CJK Letters and Months"](t)||V["Hangul Compatibility Jamo"](t)||V["Hangul Jamo Extended-A"](t)||V["Hangul Jamo Extended-B"](t)||V["Hangul Jamo"](t)||V["Hangul Syllables"](t)||V.Hiragana(t)||V["Ideographic Description Characters"](t)||V.Kanbun(t)||V["Kangxi Radicals"](t)||V["Katakana Phonetic Extensions"](t)||V.Katakana(t)&&t!==12540||V["Halfwidth and Fullwidth Forms"](t)&&t!==65288&&t!==65289&&t!==65293&&!(t>=65306&&t<=65310)&&t!==65339&&t!==65341&&t!==65343&&!(t>=65371&&t<=65503)&&t!==65507&&!(t>=65512&&t<=65519)||V["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||V["Unified Canadian Aboriginal Syllabics"](t)||V["Unified Canadian Aboriginal Syllabics Extended"](t)||V["Vertical Forms"](t)||V["Yijing Hexagram Symbols"](t)||V["Yi Syllables"](t)||V["Yi Radicals"](t))}function Nm(t){return!!(V["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||V["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||V["Letterlike Symbols"](t)||V["Number Forms"](t)||V["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||V["Control Pictures"](t)&&t!==9251||V["Optical Character Recognition"](t)||V["Enclosed Alphanumerics"](t)||V["Geometric Shapes"](t)||V["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||V["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||V["CJK Symbols and Punctuation"](t)||V.Katakana(t)||V["Private Use Area"](t)||V["CJK Compatibility Forms"](t)||V["Small Form Variants"](t)||V["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}function ua(t){return!(bi(t)||Nm(t))}function _u(t){return V.Arabic(t)||V["Arabic Supplement"](t)||V["Arabic Extended-A"](t)||V["Arabic Presentation Forms-A"](t)||V["Arabic Presentation Forms-B"](t)}function Au(t){return t>=1424&&t<=2303||V["Arabic Presentation Forms-A"](t)||V["Arabic Presentation Forms-B"](t)}function Um(t,e){return!(!e&&Au(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||V.Khmer(t))}function Cu(t){for(let e of t)if(Au(e.charCodeAt(0)))return!0;return!1}function Iu(t,e){for(let r of t)if(!Um(r.charCodeAt(0),e))return!1;return!0}var $m=typeof performance!="undefined"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),vi,ca,Gm={now:$m,frame(t){let e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){let e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0,t.width,t.height),r},resolveURL(t){return vi||(vi=document.createElement("a")),vi.href=t,vi.href},hardwareConcurrency:typeof navigator!="undefined"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(ca==null&&(ca=matchMedia("(prefers-reduced-motion: reduce)")),ca.matches):!1}};var pa={unavailable:"unavailable",deferred:"deferred",loading:"loading",loaded:"loaded",error:"error"};var Pi=pa.unavailable,ku=null;var Bb=new cn,Tu=function(){return Pi};var ie={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded(){return Pi===pa.loaded||ie.applyArabicShaping!=null},isLoading(){return Pi===pa.loading},setState(t){if(!Ee())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Pi=t.pluginStatus,ku=t.pluginURL},isParsed(){if(!Ee())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return ie.applyArabicShaping!=null&&ie.processBidirectionalText!=null&&ie.processStyledBidirectionalText!=null},getPluginURL(){if(!Ee())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return ku}};var j=class{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new la,this.transition={})}isSupportedScript(e){return Iu(e,ie.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,r=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}};var fn=class{constructor(e,r){this.property=e,this.value=r,this.expression=Zl(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}},Si=class{constructor(e){this.property=e,this.value=new fn(e,void 0)}transitioned(e,r){return new ya(this.property,this.value,r,Ae({},e.transition,this.transition),e.now)}untransitioned(){return new ya(this.property,this.value,null,{},0)}},fa=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return it(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Si(this._values[e].property)),this._values[e].value=new fn(this._values[e].property,r===null?void 0:it(r))}getTransition(e){return it(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Si(this._values[e].property)),this._values[e].transition=it(r)||void 0}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n);let i=this.getTransition(r);i!==void 0&&(e[`${r}-transition`]=i)}return e}transitioned(e,r){let n=new ma(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(e,r._values[i]);return n}untransitioned(){let e=new ma(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},ya=class{constructor(e,r,n,i,o){this.property=e,this.value=r,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(e,r,n){let i=e.now||0,o=this.value.possiblyEvaluate(e,r,n),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(e,r,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,r,n),o,pl(s))}}else return o}},ma=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new Ut(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},ha=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return it(this._values[e].value)}setValue(e,r){this._values[e]=new fn(this._values[e].property,r===null?void 0:it(r))}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){let i=new Ut(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},Ie=class{constructor(e,r,n){this.property=e,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,n,i){return this.property.evaluate(this.value,this.parameters,e,r,n,i)}},Ut=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},z=class{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,n){let i=this.specification.type,o=Ne[i];return o?o(e,r,n):e}},R=class{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,n,i){return e.expression.kind==="constant"||e.expression.kind==="camera"?new Ie(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new Ie(this,e.expression,r)}interpolate(e,r,n){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Ie(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=Ne[i];if(o){let a=o(e.value.value,r.value.value,n);return new Ie(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,r,n,i,o,a){return e.kind==="constant"?e.value:e.evaluate(r,n,i,o,a)}},St=class extends R{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new Ie(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,r);return new Ie(this,{kind:"constant",value:l},r)}else if(e.expression.kind==="camera"){let o=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Ie(this,{kind:"constant",value:o},r)}else return new Ie(this,e.expression,r)}evaluate(e,r,n,i,o,a){if(e.kind==="source"){let s=e.evaluate(r,n,i,o,a);return this._calculate(s,s,s,r)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},n,i),e.evaluate({zoom:Math.floor(r.zoom)},n,i),e.evaluate({zoom:Math.floor(r.zoom)+1},n,i),r):e.value}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},yr=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i);return this._calculate(o,o,o,r)}else return this._calculate(e.expression.evaluate(new j(Math.floor(r.zoom-1),r)),e.expression.evaluate(new j(Math.floor(r.zoom),r)),e.expression.evaluate(new j(Math.floor(r.zoom+1),r)),r)}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},mr=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},oe=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in e){let n=e[r];n.specification.overridable&&this.overridableProperties.push(r);let i=this.defaultPropertyValues[r]=new fn(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Si(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};k("DataDrivenProperty",R);k("DataConstantProperty",z);k("CrossFadedDataDrivenProperty",St);k("CrossFadedProperty",yr);k("ColorRampProperty",mr);var wi="-transition",ye=class extends cn{constructor(e,r){super();if(this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new ha(r.layout)),r.paint)){this._transitionablePaint=new fa(r.paint);for(let n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(let n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ut(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.layout.${e}`;if(this._validate(vu,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(wi)?this._transitionablePaint.getTransition(e.slice(0,-wi.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.paint.${e}`;if(this._validate(bu,i,e,r,n))return!1}if(e.endsWith(wi))return this._transitionablePaint.setTransition(e.slice(0,-wi.length),r||void 0),!1;{let i=this._transitionablePaint._values[e],o=i.property.specification["property-type"]==="cross-faded-data-driven",a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);let l=this._transitionablePaint._values[e].value;return l.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,l)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,n){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),ml(e,(r,n)=>r!==void 0&&!(n==="layout"&&!Object.keys(r).length)&&!(n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,i,o={}){return o&&o.validate===!1?!1:Pu(this,e.call(Pt,{key:r,layerType:this.type,objectKey:n,value:i,styleSpec:S,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let r=this.paint.get(e);if(!(!(r instanceof Ie)||!bt(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};var jm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},hr=class{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},qm=128,Zm=5,ne=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*Zm),qm),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function ee(t,e=1){let r=0,n=0,i=t.map(a=>{let s=Jm(a.type),l=r=Eu(r,Math.max(e,s)),u=a.components||1;return n=Math.max(n,s),r+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=Eu(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function Jm(t){return jm[t].BYTES_PER_ELEMENT}function Eu(t,e){return Math.ceil(t/e)*e}var Lu=J(ge()),dr=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.int16[i+0]=r,this.int16[i+1]=n,e}};dr.prototype.bytesPerElement=4;k("StructArrayLayout2i4",dr);var _i=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.int16[o+0]=r,this.int16[o+1]=n,this.int16[o+2]=i,e}};_i.prototype.bytesPerElement=6;k("StructArrayLayout3i6",_i);var da=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.int16[a+0]=r,this.int16[a+1]=n,this.int16[a+2]=i,this.int16[a+3]=o,e}};da.prototype.bytesPerElement=8;k("StructArrayLayout4i8",da);var Ai=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};Ai.prototype.bytesPerElement=12;k("StructArrayLayout2i4i12",Ai);var Ci=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*4,u=e*8;return this.int16[l+0]=r,this.int16[l+1]=n,this.uint8[u+4]=i,this.uint8[u+5]=o,this.uint8[u+6]=a,this.uint8[u+7]=s,e}};Ci.prototype.bytesPerElement=8;k("StructArrayLayout2i4ub8",Ci);var $t=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.float32[i+0]=r,this.float32[i+1]=n,e}};$t.prototype.bytesPerElement=8;k("StructArrayLayout2f8",$t);var Ii=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,r,n,i,o,a,s,l,u,c)}emplace(e,r,n,i,o,a,s,l,u,c,p){let f=e*10;return this.uint16[f+0]=r,this.uint16[f+1]=n,this.uint16[f+2]=i,this.uint16[f+3]=o,this.uint16[f+4]=a,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=u,this.uint16[f+8]=c,this.uint16[f+9]=p,e}};Ii.prototype.bytesPerElement=20;k("StructArrayLayout10ui20",Ii);var ki=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f){let y=this.length;return this.resize(y+1),this.emplace(y,e,r,n,i,o,a,s,l,u,c,p,f)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y){let m=e*12;return this.int16[m+0]=r,this.int16[m+1]=n,this.int16[m+2]=i,this.int16[m+3]=o,this.uint16[m+4]=a,this.uint16[m+5]=s,this.uint16[m+6]=l,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=p,this.int16[m+10]=f,this.int16[m+11]=y,e}};ki.prototype.bytesPerElement=24;k("StructArrayLayout4i4ui4i24",ki);var Ti=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.float32[o+0]=r,this.float32[o+1]=n,this.float32[o+2]=i,e}};Ti.prototype.bytesPerElement=12;k("StructArrayLayout3f12",Ti);var Ei=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint32[n+0]=r,e}};Ei.prototype.bytesPerElement=4;k("StructArrayLayout1ul4",Ei);var Li=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,r,n,i,o,a,s,l,u)}emplace(e,r,n,i,o,a,s,l,u,c){let p=e*10,f=e*5;return this.int16[p+0]=r,this.int16[p+1]=n,this.int16[p+2]=i,this.int16[p+3]=o,this.int16[p+4]=a,this.int16[p+5]=s,this.uint32[f+3]=l,this.uint16[p+8]=u,this.uint16[p+9]=c,e}};Li.prototype.bytesPerElement=20;k("StructArrayLayout6i1ul2ui20",Li);var Fi=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};Fi.prototype.bytesPerElement=12;k("StructArrayLayout2i2i2i12",Fi);var ga=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,n,i,o)}emplace(e,r,n,i,o,a){let s=e*4,l=e*8;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=i,this.int16[l+6]=o,this.int16[l+7]=a,e}};ga.prototype.bytesPerElement=16;k("StructArrayLayout2f1f2i16",ga);var Mi=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*12,s=e*3;return this.uint8[a+0]=r,this.uint8[a+1]=n,this.float32[s+1]=i,this.float32[s+2]=o,e}};Mi.prototype.bytesPerElement=12;k("StructArrayLayout2ub2f12",Mi);var Di=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.uint16[o+0]=r,this.uint16[o+1]=n,this.uint16[o+2]=i,e}};Di.prototype.bytesPerElement=6;k("StructArrayLayout3ui6",Di);var Vi=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g){let v=this.length;return this.resize(v+1),this.emplace(v,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g,v){let b=e*24,x=e*12,P=e*48;return this.int16[b+0]=r,this.int16[b+1]=n,this.uint16[b+2]=i,this.uint16[b+3]=o,this.uint32[x+2]=a,this.uint32[x+3]=s,this.uint32[x+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+12]=p,this.float32[x+7]=f,this.float32[x+8]=y,this.uint8[P+36]=m,this.uint8[P+37]=d,this.uint8[P+38]=h,this.uint32[x+10]=g,this.int16[b+22]=v,e}};Vi.prototype.bytesPerElement=48;k("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Vi);var Bi=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g,v,b,x,P,w,_,T,I,E,A,F){let L=this.length;return this.resize(L+1),this.emplace(L,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g,v,b,x,P,w,_,T,I,E,A,F)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g,v,b,x,P,w,_,T,I,E,A,F,L){let C=e*34,B=e*17;return this.int16[C+0]=r,this.int16[C+1]=n,this.int16[C+2]=i,this.int16[C+3]=o,this.int16[C+4]=a,this.int16[C+5]=s,this.int16[C+6]=l,this.int16[C+7]=u,this.uint16[C+8]=c,this.uint16[C+9]=p,this.uint16[C+10]=f,this.uint16[C+11]=y,this.uint16[C+12]=m,this.uint16[C+13]=d,this.uint16[C+14]=h,this.uint16[C+15]=g,this.uint16[C+16]=v,this.uint16[C+17]=b,this.uint16[C+18]=x,this.uint16[C+19]=P,this.uint16[C+20]=w,this.uint16[C+21]=_,this.uint16[C+22]=T,this.uint32[B+12]=I,this.float32[B+13]=E,this.float32[B+14]=A,this.float32[B+15]=F,this.float32[B+16]=L,e}};Bi.prototype.bytesPerElement=68;k("StructArrayLayout8i15ui1ul4f68",Bi);var gr=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.float32[n+0]=r,e}};gr.prototype.bytesPerElement=4;k("StructArrayLayout1f4",gr);var zi=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*2,a=e*4;return this.uint32[o+0]=r,this.uint16[a+2]=n,this.uint16[a+3]=i,e}};zi.prototype.bytesPerElement=8;k("StructArrayLayout1ul2ui8",zi);var Ri=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.uint16[i+0]=r,this.uint16[i+1]=n,e}};Ri.prototype.bytesPerElement=4;k("StructArrayLayout2ui4",Ri);var xa=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint16[n+0]=r,e}};xa.prototype.bytesPerElement=2;k("StructArrayLayout1ui2",xa);var yn=class extends ne{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.float32[a+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,this.float32[a+3]=o,e}};yn.prototype.bytesPerElement=16;k("StructArrayLayout4f16",yn);var ba=class extends hr{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Lu.default(this.anchorPointX,this.anchorPointY)}};ba.prototype.size=20;var Oi=class extends Li{get(e){return new ba(this,e)}};k("CollisionBoxArray",Oi);var va=class extends hr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};va.prototype.size=48;var Ni=class extends Vi{get(e){return new va(this,e)}};k("PlacedSymbolArray",Ni);var Pa=class extends hr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}};Pa.prototype.size=68;var Ui=class extends Bi{get(e){return new Pa(this,e)}};k("SymbolInstanceArray",Ui);var $i=class extends gr{getoffsetX(e){return this.float32[e*1+0]}};k("GlyphOffsetArray",$i);var Gi=class extends _i{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};k("SymbolLineVertexArray",Gi);var Sa=class extends hr{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};Sa.prototype.size=8;var ji=class extends zi{get(e){return new Sa(this,e)}};k("FeatureIndexArray",ji);var wa=class extends dr{};var _a=class extends dr{},Aa=class extends dr{},Ca=class extends Ai{};var Ia=class extends Ci{},ka=class extends $t{},wt=class extends Ii{},Ta=class extends ki{},Ea=class extends Ti{},La=class extends Ei{},qi=class extends Fi{};var Fa=class extends Mi{};var $e=class extends Di{},Gt=class extends Ri{};var Wm=ee([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Fu,size:h0,alignment:d0}=Wm;var le=class{constructor(e=[]){this.segments=e}prepareSegment(e,r,n,i){let o=this.segments[this.segments.length-1];return e>le.MAX_VERTEX_ARRAY_LENGTH&&ce(`Max vertices per segment is ${le.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!o||o.vertexLength+e>le.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i)&&(o={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},i!==void 0&&(o.sortKey=i),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,n,i){return new le([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};le.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;k("SegmentVector",le);function Ma(t,e){return t=nt(Math.floor(t),0,255),e=nt(Math.floor(e),0,255),256*t+e}var mn=ee([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Bu=J(Ba());var xr=class{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(zu(e)),this.positions.push(r,n,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=zu(e),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=r?i=a:n=a+1}let o=[];for(;this.ids[n]===r;){let a=this.positions[3*n],s=this.positions[3*n+1],l=this.positions[3*n+2];o.push({index:a,start:s,end:l}),n++}return o}static serialize(e,r){let n=new Float64Array(e.ids),i=new Uint32Array(e.positions);return za(n,i,0,n.length-1),r&&r.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(e){let r=new xr;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function zu(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,Bu.default)(String(t))}function za(t,e,r,n){for(;r<n;){let i=t[r+n>>1],o=r-1,a=n+1;for(;;){do o++;while(t[o]<i);do a--;while(t[a]>i);if(o>=a)break;Ji(t,o,a),Ji(e,3*o,3*a),Ji(e,3*o+1,3*a+1),Ji(e,3*o+2,3*a+2)}a-r<n-a?(za(t,e,r,a),r=a+1):(za(t,e,a+1,n),n=a)}}function Ji(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}k("FeaturePositionMap",xr);var Wi=class{constructor(e,r){this.gl=e.gl,this.location=r}};var hn=class extends Wi{constructor(e,r){super(e,r);this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var Ra=class extends Wi{constructor(e,r){super(e,r);this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},Oa=class extends Wi{constructor(e,r){super(e,r);this.current=q.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}},L0=new Float32Array(16);function Na(t){return[Ma(255*t.r,255*t.g),Ma(255*t.b,255*t.a)]}var br=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>`u_${i}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new Oa(e,r):new hn(e,r)}},jt=class{constructor(e,r){this.uniformNames=r.map(n=>`u_${n}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,r,n){return n.substr(0,9)==="u_pattern"?new Ra(e,r):new hn(e,r)}},et=class{constructor(e,r,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:`a_${o}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new j(0),r,{},i,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(e,r,o)}_setPaintValue(e,r,n){if(this.type==="color"){let i=Na(n);for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=e;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},Ge=class{constructor(e,r,n,i,o,a){this.expression=e,this.uniformNames=r.map(s=>`u_${s}_t`),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:`a_${s}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,r,n,i,o){let a=this.expression.evaluate(new j(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new j(this.zoom+1),r,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(e,r,o,a)}_setPaintValue(e,r,n,i){if(this.type==="color"){let o=Na(n),a=Na(i);for(let s=e;s<r;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){let n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,i=nt(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,r,n){return new hn(e,r)}},ct=class{constructor(e,r,n,i,o,a){this.expression=e,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,r,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(e,r,n,i,o){this._setPaintValues(e,r,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(e,r,n,i){if(!i||!n)return;let{min:o,mid:a,max:s}=n,l=i[o],u=i[a],c=i[s];if(!(!l||!u||!c))for(let p=e;p<r;p++)this.zoomInPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],u.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],u.pixelRatio,c.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,mn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,mn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Ua=class{constructor(e,r,n){this.binders={},this._buffers=[];let i=[];for(let o in e.paint._values){if(!n(o))continue;let a=e.paint.get(o);if(!(a instanceof Ie)||!bt(a.property.specification))continue;let s=Xm(o,e.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],f=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=f?new jt(l.value,s):new br(l.value,s,u),i.push(`/u_${o}`);else if(l.kind==="source"||f){let y=Ru(o,u,"source");this.binders[o]=f?new ct(l,u,c,r,y,e.id):new et(l,s,u,y),i.push(`/a_${o}`)}else{let y=Ru(o,u,"composite");this.binders[o]=new Ge(l,s,u,c,r,y),i.push(`/z_${o}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){let r=this.binders[e];return r instanceof et||r instanceof Ge?r.maxValue:0}populatePaintArrays(e,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof et||s instanceof Ge||s instanceof ct)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof jt&&i.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,n,i,o){let a=!1;for(let s in e){let l=r.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let f=this.binders[p];if((f instanceof et||f instanceof Ge||f instanceof ct)&&f.expression.isStateDependent===!0){let y=i.paint.get(p);f.expression=y.value,f.updatePaintArray(u.start,u.end,c,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let r in this.binders){let n=this.binders[r];(n instanceof br||n instanceof jt)&&e.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return e}getBinderAttributes(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof et||n instanceof Ge)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof ct)for(let i=0;i<mn.members.length;i++)e.push(mn.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof br||n instanceof jt||n instanceof Ge)for(let i of n.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof br||o instanceof jt||o instanceof Ge){for(let a of o.uniformNames)if(r[a]){let s=o.getBinding(e,r[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(e,r,n,i){for(let{name:o,property:a,binding:s}of r)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let r in this.binders){let n=this.binders[r];if(e&&n instanceof ct){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof et||n instanceof Ge)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let r in this.binders){let n=this.binders[r];(n instanceof et||n instanceof Ge||n instanceof ct)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof et||r instanceof Ge||r instanceof ct)&&r.destroy()}}},ze=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new Ua(i,r,n);this.needsUpload=!1,this._featureMap=new xr,this._bufferOffset=0}populatePaintArrays(e,r,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,r,i,o,a);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,r,o,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(!!this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function Xm(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Qm(t){return{"line-pattern":{source:wt,composite:wt},"fill-pattern":{source:wt,composite:wt},"fill-extrusion-pattern":{source:wt,composite:wt}}[t]}function Ru(t,e,r){let n={color:{source:$t,composite:yn},number:{source:gr,composite:$t}},i=Qm(t);return i&&i[r]||n[e][r]}k("ConstantBinder",br);k("CrossFadedConstantBinder",jt);k("SourceExpressionBinder",et);k("CrossFadedCompositeBinder",ct);k("CompositeExpressionBinder",Ge);k("ProgramConfiguration",Ua,{omit:["_buffers"]});k("ProgramConfigurationSet",ze);var W=8192;var eh=15,$a=Math.pow(2,eh-1)-1,Ou=-$a-1;function Me(t){let e=W/t.extent,r=t.loadGeometry();for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=nt(s,Ou,$a),a.y=nt(l,Ou,$a),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function je(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Me(t):[]}}function Hi(t,e,r,n,i){t.emplaceBack(e*2+(n+1)/2,r*2+(i+1)/2)}var vr=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new _a,this.indexArray=new $e,this.segments=new le,this.programConfigurations=new ze(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){let i=this.layers[0],o=[],a=null,s=!1;i.type==="circle"&&(a=i.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:u,index:c,sourceLayerIndex:p}of e){let f=this.layers[0]._featureFilter.needGeometry,y=je(l,f);if(!this.layers[0]._featureFilter.filter(new j(this.zoom),y,n))continue;let m=s?a.evaluate(y,{},n):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:c,geometry:f?y.geometry:Me(l),patterns:{},sortKey:m};o.push(d)}s&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:p}=l,f=e[c].feature;this.addFeature(l,u,c,n),r.featureIndex.insert(f,u,c,p,this.index)}}update(e,r,n){!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fu),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,n,i){for(let o of r)for(let a of o){let s=a.x,l=a.y;if(s<0||s>=W||l<0||l>=W)continue;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),c=u.vertexLength;Hi(this.layoutVertexArray,s,l,-1,-1),Hi(this.layoutVertexArray,s,l,1,-1),Hi(this.layoutVertexArray,s,l,1,1),Hi(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};k("CircleBucket",vr,{omit:["layers"]});var dn=J(ge());function Nu(t,e){for(let r=0;r<t.length;r++)if(Pr(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Pr(t,e[r]))return!0;return!!Ga(t,e)}function Uu(t,e,r){return!!(Pr(t,e)||ja(e,t,r))}function Ki(t,e){if(t.length===1)return Gu(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(Pr(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(Gu(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Ga(t,e[r]))return!0;return!1}function $u(t,e,r){for(let n=0;n<e.length;n++){let i=e[n];if(t.length>=3){for(let o=0;o<i.length;o++)if(Pr(t,i[o]))return!0}if(th(t,i,r))return!0}return!1}function th(t,e,r){if(t.length>1){if(Ga(t,e))return!0;for(let n=0;n<e.length;n++)if(ja(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(ja(t[n],e,r))return!0;return!1}function Ga(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(rh(n,i,a,s))return!0}}return!1}function rh(t,e,r,n){return ot(t,r,n)!==ot(e,r,n)&&ot(t,e,r)!==ot(t,e,n)}function ja(t,e,r){let n=r*r;if(e.length===1)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++){let o=e[i-1],a=e[i];if(qa(t,o,a)<n)return!0}return!1}function qa(t,e,r){let n=e.distSqr(r);if(n===0)return t.distSqr(e);let i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return i<0?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function Gu(t,e){let r=!1,n,i,o;for(let a=0;a<t.length;a++){n=t[a];for(let s=0,l=n.length-1;s<n.length;l=s++)i=n[s],o=n[l],i.y>e.y!=o.y>e.y&&e.x<(o.x-i.x)*(e.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function Pr(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){let o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function ju(t,e,r,n,i){for(let a of t)if(e<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new dn.default(e,r),new dn.default(e,i),new dn.default(n,i),new dn.default(n,r)];if(t.length>2){for(let a of o)if(Pr(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(nh(s,l,o))return!0}return!1}function nh(t,e,r){let n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;let o=ot(t,e,r[0]);return o!==ot(t,e,r[1])||o!==ot(t,e,r[2])||o!==ot(t,e,r[3])}var Yi=J(ge());function qt(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function _t(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function At(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=Yi.default.convert(e)._mult(i);r==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<t.length;s++){let l=t[s];a.push(l.sub(o))}return a}function qu(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],u=i[a+1],c=a===0?new Yi.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new Yi.default(0,0):u.sub(l)._unit()._perp(),f=c._add(p)._unit(),y=f.x*p.x+f.y*p.y;y!==0&&f._mult(1/y),o.push(f._mult(e)._add(l))}r.push(o)}return r}var Zu,ih=()=>Zu=Zu||new oe({"circle-sort-key":new R(S.layout_circle["circle-sort-key"])}),Ju,oh=()=>Ju=Ju||new oe({"circle-radius":new R(S.paint_circle["circle-radius"]),"circle-color":new R(S.paint_circle["circle-color"]),"circle-blur":new R(S.paint_circle["circle-blur"]),"circle-opacity":new R(S.paint_circle["circle-opacity"]),"circle-translate":new z(S.paint_circle["circle-translate"]),"circle-translate-anchor":new z(S.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new z(S.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new z(S.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new R(S.paint_circle["circle-stroke-width"]),"circle-stroke-color":new R(S.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new R(S.paint_circle["circle-stroke-opacity"])}),Wu={get paint(){return oh()},get layout(){return ih()}};var X=1e-6,qe=typeof Float32Array!="undefined"?Float32Array:Array,gn=Math.random;var wv=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var xn={};al(xn,{add:()=>Gh,adjoint:()=>yh,clone:()=>sh,copy:()=>lh,create:()=>ah,determinant:()=>mh,equals:()=>Jh,exactEquals:()=>Zh,frob:()=>$h,fromQuat:()=>Fh,fromQuat2:()=>Ih,fromRotation:()=>wh,fromRotationTranslation:()=>Yu,fromRotationTranslationScale:()=>Eh,fromRotationTranslationScaleOrigin:()=>Lh,fromScaling:()=>Sh,fromTranslation:()=>Ph,fromValues:()=>uh,fromXRotation:()=>_h,fromYRotation:()=>Ah,fromZRotation:()=>Ch,frustum:()=>Mh,getRotation:()=>Th,getScaling:()=>Xu,getTranslation:()=>kh,identity:()=>Hu,invert:()=>fh,lookAt:()=>Oh,mul:()=>Wh,multiply:()=>Ku,multiplyScalar:()=>jh,multiplyScalarAndAdd:()=>qh,ortho:()=>zh,orthoNO:()=>ec,orthoZO:()=>Rh,perspective:()=>Dh,perspectiveFromFieldOfView:()=>Bh,perspectiveNO:()=>Qu,perspectiveZO:()=>Vh,rotate:()=>gh,rotateX:()=>xh,rotateY:()=>bh,rotateZ:()=>vh,scale:()=>dh,set:()=>ch,str:()=>Uh,sub:()=>Hh,subtract:()=>tc,targetTo:()=>Nh,translate:()=>hh,transpose:()=>ph});function ah(){var t=new qe(16);return qe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function sh(t){var e=new qe(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function lh(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function uh(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d){var h=new qe(16);return h[0]=t,h[1]=e,h[2]=r,h[3]=n,h[4]=i,h[5]=o,h[6]=a,h[7]=s,h[8]=l,h[9]=u,h[10]=c,h[11]=p,h[12]=f,h[13]=y,h[14]=m,h[15]=d,h}function ch(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t[9]=c,t[10]=p,t[11]=f,t[12]=y,t[13]=m,t[14]=d,t[15]=h,t}function Hu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ph(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function fh(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],f=e[10],y=e[11],m=e[12],d=e[13],h=e[14],g=e[15],v=r*s-n*a,b=r*l-i*a,x=r*u-o*a,P=n*l-i*s,w=n*u-o*s,_=i*u-o*l,T=c*d-p*m,I=c*h-f*m,E=c*g-y*m,A=p*h-f*d,F=p*g-y*d,L=f*g-y*h,C=v*L-b*F+x*A+P*E-w*I+_*T;return C?(C=1/C,t[0]=(s*L-l*F+u*A)*C,t[1]=(i*F-n*L-o*A)*C,t[2]=(d*_-h*w+g*P)*C,t[3]=(f*w-p*_-y*P)*C,t[4]=(l*E-a*L-u*I)*C,t[5]=(r*L-i*E+o*I)*C,t[6]=(h*x-m*_-g*b)*C,t[7]=(c*_-f*x+y*b)*C,t[8]=(a*F-s*E+u*T)*C,t[9]=(n*E-r*F-o*T)*C,t[10]=(m*w-d*x+g*v)*C,t[11]=(p*x-c*w-y*v)*C,t[12]=(s*I-a*A-l*T)*C,t[13]=(r*A-n*I+i*T)*C,t[14]=(d*b-m*P-h*v)*C,t[15]=(c*P-p*b+f*v)*C,t):null}function yh(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],f=e[10],y=e[11],m=e[12],d=e[13],h=e[14],g=e[15];return t[0]=s*(f*g-y*h)-p*(l*g-u*h)+d*(l*y-u*f),t[1]=-(n*(f*g-y*h)-p*(i*g-o*h)+d*(i*y-o*f)),t[2]=n*(l*g-u*h)-s*(i*g-o*h)+d*(i*u-o*l),t[3]=-(n*(l*y-u*f)-s*(i*y-o*f)+p*(i*u-o*l)),t[4]=-(a*(f*g-y*h)-c*(l*g-u*h)+m*(l*y-u*f)),t[5]=r*(f*g-y*h)-c*(i*g-o*h)+m*(i*y-o*f),t[6]=-(r*(l*g-u*h)-a*(i*g-o*h)+m*(i*u-o*l)),t[7]=r*(l*y-u*f)-a*(i*y-o*f)+c*(i*u-o*l),t[8]=a*(p*g-y*d)-c*(s*g-u*d)+m*(s*y-u*p),t[9]=-(r*(p*g-y*d)-c*(n*g-o*d)+m*(n*y-o*p)),t[10]=r*(s*g-u*d)-a*(n*g-o*d)+m*(n*u-o*s),t[11]=-(r*(s*y-u*p)-a*(n*y-o*p)+c*(n*u-o*s)),t[12]=-(a*(p*h-f*d)-c*(s*h-l*d)+m*(s*f-l*p)),t[13]=r*(p*h-f*d)-c*(n*h-i*d)+m*(n*f-i*p),t[14]=-(r*(s*h-l*d)-a*(n*h-i*d)+m*(n*l-i*s)),t[15]=r*(s*f-l*p)-a*(n*f-i*p)+c*(n*l-i*s),t}function mh(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],p=t[10],f=t[11],y=t[12],m=t[13],d=t[14],h=t[15],g=e*a-r*o,v=e*s-n*o,b=e*l-i*o,x=r*s-n*a,P=r*l-i*a,w=n*l-i*s,_=u*m-c*y,T=u*d-p*y,I=u*h-f*y,E=c*d-p*m,A=c*h-f*m,F=p*h-f*d;return g*F-v*A+b*E+x*I-P*T+w*_}function Ku(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],f=e[9],y=e[10],m=e[11],d=e[12],h=e[13],g=e[14],v=e[15],b=r[0],x=r[1],P=r[2],w=r[3];return t[0]=b*n+x*s+P*p+w*d,t[1]=b*i+x*l+P*f+w*h,t[2]=b*o+x*u+P*y+w*g,t[3]=b*a+x*c+P*m+w*v,b=r[4],x=r[5],P=r[6],w=r[7],t[4]=b*n+x*s+P*p+w*d,t[5]=b*i+x*l+P*f+w*h,t[6]=b*o+x*u+P*y+w*g,t[7]=b*a+x*c+P*m+w*v,b=r[8],x=r[9],P=r[10],w=r[11],t[8]=b*n+x*s+P*p+w*d,t[9]=b*i+x*l+P*f+w*h,t[10]=b*o+x*u+P*y+w*g,t[11]=b*a+x*c+P*m+w*v,b=r[12],x=r[13],P=r[14],w=r[15],t[12]=b*n+x*s+P*p+w*d,t[13]=b*i+x*l+P*f+w*h,t[14]=b*o+x*u+P*y+w*g,t[15]=b*a+x*c+P*m+w*v,t}function hh(t,e,r){var n=r[0],i=r[1],o=r[2],a,s,l,u,c,p,f,y,m,d,h,g;return e===t?(t[12]=e[0]*n+e[4]*i+e[8]*o+e[12],t[13]=e[1]*n+e[5]*i+e[9]*o+e[13],t[14]=e[2]*n+e[6]*i+e[10]*o+e[14],t[15]=e[3]*n+e[7]*i+e[11]*o+e[15]):(a=e[0],s=e[1],l=e[2],u=e[3],c=e[4],p=e[5],f=e[6],y=e[7],m=e[8],d=e[9],h=e[10],g=e[11],t[0]=a,t[1]=s,t[2]=l,t[3]=u,t[4]=c,t[5]=p,t[6]=f,t[7]=y,t[8]=m,t[9]=d,t[10]=h,t[11]=g,t[12]=a*n+c*i+m*o+e[12],t[13]=s*n+p*i+d*o+e[13],t[14]=l*n+f*i+h*o+e[14],t[15]=u*n+y*i+g*o+e[15]),t}function dh(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function gh(t,e,r,n){var i=n[0],o=n[1],a=n[2],s=Math.hypot(i,o,a),l,u,c,p,f,y,m,d,h,g,v,b,x,P,w,_,T,I,E,A,F,L,C,B;return s<X?null:(s=1/s,i*=s,o*=s,a*=s,l=Math.sin(r),u=Math.cos(r),c=1-u,p=e[0],f=e[1],y=e[2],m=e[3],d=e[4],h=e[5],g=e[6],v=e[7],b=e[8],x=e[9],P=e[10],w=e[11],_=i*i*c+u,T=o*i*c+a*l,I=a*i*c-o*l,E=i*o*c-a*l,A=o*o*c+u,F=a*o*c+i*l,L=i*a*c+o*l,C=o*a*c-i*l,B=a*a*c+u,t[0]=p*_+d*T+b*I,t[1]=f*_+h*T+x*I,t[2]=y*_+g*T+P*I,t[3]=m*_+v*T+w*I,t[4]=p*E+d*A+b*F,t[5]=f*E+h*A+x*F,t[6]=y*E+g*A+P*F,t[7]=m*E+v*A+w*F,t[8]=p*L+d*C+b*B,t[9]=f*L+h*C+x*B,t[10]=y*L+g*C+P*B,t[11]=m*L+v*C+w*B,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function xh(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=a*i+c*n,t[6]=s*i+p*n,t[7]=l*i+f*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=p*i-s*n,t[11]=f*i-l*n,t}function bh(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],p=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=a*i-c*n,t[2]=s*i-p*n,t[3]=l*i-f*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+p*i,t[11]=l*n+f*i,t}function vh(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],p=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*n,t[1]=a*i+c*n,t[2]=s*i+p*n,t[3]=l*i+f*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=p*i-s*n,t[7]=f*i-l*n,t}function Ph(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function Sh(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function wh(t,e,r){var n=r[0],i=r[1],o=r[2],a=Math.hypot(n,i,o),s,l,u;return a<X?null:(a=1/a,n*=a,i*=a,o*=a,s=Math.sin(e),l=Math.cos(e),u=1-l,t[0]=n*n*u+l,t[1]=i*n*u+o*s,t[2]=o*n*u-i*s,t[3]=0,t[4]=n*i*u-o*s,t[5]=i*i*u+l,t[6]=o*i*u+n*s,t[7]=0,t[8]=n*o*u+i*s,t[9]=i*o*u-n*s,t[10]=o*o*u+l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function _h(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ah(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ch(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Yu(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,u=o+o,c=n*s,p=n*l,f=n*u,y=i*l,m=i*u,d=o*u,h=a*s,g=a*l,v=a*u;return t[0]=1-(y+d),t[1]=p+v,t[2]=f-g,t[3]=0,t[4]=p-v,t[5]=1-(c+d),t[6]=m+h,t[7]=0,t[8]=f+g,t[9]=m-h,t[10]=1-(c+y),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Ih(t,e){var r=new qe(3),n=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=n*n+i*i+o*o+a*a;return p>0?(r[0]=(s*a+c*n+l*o-u*i)*2/p,r[1]=(l*a+c*i+u*n-s*o)*2/p,r[2]=(u*a+c*o+s*i-l*n)*2/p):(r[0]=(s*a+c*n+l*o-u*i)*2,r[1]=(l*a+c*i+u*n-s*o)*2,r[2]=(u*a+c*o+s*i-l*n)*2),Yu(t,e,r),t}function kh(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Xu(t,e){var r=e[0],n=e[1],i=e[2],o=e[4],a=e[5],s=e[6],l=e[8],u=e[9],c=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(l,u,c),t}function Th(t,e){var r=new qe(3);Xu(r,e);var n=1/r[0],i=1/r[1],o=1/r[2],a=e[0]*n,s=e[1]*i,l=e[2]*o,u=e[4]*n,c=e[5]*i,p=e[6]*o,f=e[8]*n,y=e[9]*i,m=e[10]*o,d=a+c+m,h=0;return d>0?(h=Math.sqrt(d+1)*2,t[3]=.25*h,t[0]=(p-y)/h,t[1]=(f-l)/h,t[2]=(s-u)/h):a>c&&a>m?(h=Math.sqrt(1+a-c-m)*2,t[3]=(p-y)/h,t[0]=.25*h,t[1]=(s+u)/h,t[2]=(f+l)/h):c>m?(h=Math.sqrt(1+c-a-m)*2,t[3]=(f-l)/h,t[0]=(s+u)/h,t[1]=.25*h,t[2]=(p+y)/h):(h=Math.sqrt(1+m-a-c)*2,t[3]=(s-u)/h,t[0]=(f+l)/h,t[1]=(p+y)/h,t[2]=.25*h),t}function Eh(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3],l=i+i,u=o+o,c=a+a,p=i*l,f=i*u,y=i*c,m=o*u,d=o*c,h=a*c,g=s*l,v=s*u,b=s*c,x=n[0],P=n[1],w=n[2];return t[0]=(1-(m+h))*x,t[1]=(f+b)*x,t[2]=(y-v)*x,t[3]=0,t[4]=(f-b)*P,t[5]=(1-(p+h))*P,t[6]=(d+g)*P,t[7]=0,t[8]=(y+v)*w,t[9]=(d-g)*w,t[10]=(1-(p+m))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Lh(t,e,r,n,i){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,p=s+s,f=o*u,y=o*c,m=o*p,d=a*c,h=a*p,g=s*p,v=l*u,b=l*c,x=l*p,P=n[0],w=n[1],_=n[2],T=i[0],I=i[1],E=i[2],A=(1-(d+g))*P,F=(y+x)*P,L=(m-b)*P,C=(y-x)*w,B=(1-(f+g))*w,O=(h+v)*w,N=(m+b)*_,K=(h-v)*_,Y=(1-(f+d))*_;return t[0]=A,t[1]=F,t[2]=L,t[3]=0,t[4]=C,t[5]=B,t[6]=O,t[7]=0,t[8]=N,t[9]=K,t[10]=Y,t[11]=0,t[12]=r[0]+T-(A*T+C*I+N*E),t[13]=r[1]+I-(F*T+B*I+K*E),t[14]=r[2]+E-(L*T+O*I+Y*E),t[15]=1,t}function Fh(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,p=n*s,f=i*a,y=i*s,m=i*l,d=o*a,h=o*s,g=o*l;return t[0]=1-p-m,t[1]=c+g,t[2]=f-h,t[3]=0,t[4]=c-g,t[5]=1-u-m,t[6]=y+d,t[7]=0,t[8]=f+h,t[9]=y-d,t[10]=1-u-p,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Mh(t,e,r,n,i,o,a){var s=1/(r-e),l=1/(i-n),u=1/(o-a);return t[0]=o*2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t}function Qu(t,e,r,n,i){var o=1/Math.tan(e/2),a;return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(a=1/(n-i),t[10]=(i+n)*a,t[14]=2*i*n*a):(t[10]=-1,t[14]=-2*n),t}var Dh=Qu;function Vh(t,e,r,n,i){var o=1/Math.tan(e/2),a;return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(a=1/(n-i),t[10]=i*a,t[14]=i*n*a):(t[10]=-1,t[14]=-n),t}function Bh(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((a-s)*l*.5),t[9]=(i-o)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function ec(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(a+o)*u,t[15]=1,t}var zh=ec;function Rh(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=o*u,t[15]=1,t}function Oh(t,e,r,n){var i,o,a,s,l,u,c,p,f,y,m=e[0],d=e[1],h=e[2],g=n[0],v=n[1],b=n[2],x=r[0],P=r[1],w=r[2];return Math.abs(m-x)<X&&Math.abs(d-P)<X&&Math.abs(h-w)<X?Hu(t):(c=m-x,p=d-P,f=h-w,y=1/Math.hypot(c,p,f),c*=y,p*=y,f*=y,i=v*f-b*p,o=b*c-g*f,a=g*p-v*c,y=Math.hypot(i,o,a),y?(y=1/y,i*=y,o*=y,a*=y):(i=0,o=0,a=0),s=p*a-f*o,l=f*i-c*a,u=c*o-p*i,y=Math.hypot(s,l,u),y?(y=1/y,s*=y,l*=y,u*=y):(s=0,l=0,u=0),t[0]=i,t[1]=s,t[2]=c,t[3]=0,t[4]=o,t[5]=l,t[6]=p,t[7]=0,t[8]=a,t[9]=u,t[10]=f,t[11]=0,t[12]=-(i*m+o*d+a*h),t[13]=-(s*m+l*d+u*h),t[14]=-(c*m+p*d+f*h),t[15]=1,t)}function Nh(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=n[0],l=n[1],u=n[2],c=i-r[0],p=o-r[1],f=a-r[2],y=c*c+p*p+f*f;y>0&&(y=1/Math.sqrt(y),c*=y,p*=y,f*=y);var m=l*f-u*p,d=u*c-s*f,h=s*p-l*c;return y=m*m+d*d+h*h,y>0&&(y=1/Math.sqrt(y),m*=y,d*=y,h*=y),t[0]=m,t[1]=d,t[2]=h,t[3]=0,t[4]=p*h-f*d,t[5]=f*m-c*h,t[6]=c*d-p*m,t[7]=0,t[8]=c,t[9]=p,t[10]=f,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t}function Uh(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function $h(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function Gh(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function tc(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function jh(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function qh(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function Zh(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function Jh(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=t[9],f=t[10],y=t[11],m=t[12],d=t[13],h=t[14],g=t[15],v=e[0],b=e[1],x=e[2],P=e[3],w=e[4],_=e[5],T=e[6],I=e[7],E=e[8],A=e[9],F=e[10],L=e[11],C=e[12],B=e[13],O=e[14],N=e[15];return Math.abs(r-v)<=X*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-b)<=X*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-x)<=X*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-P)<=X*Math.max(1,Math.abs(o),Math.abs(P))&&Math.abs(a-w)<=X*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-_)<=X*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(l-T)<=X*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-I)<=X*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-E)<=X*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(p-A)<=X*Math.max(1,Math.abs(p),Math.abs(A))&&Math.abs(f-F)<=X*Math.max(1,Math.abs(f),Math.abs(F))&&Math.abs(y-L)<=X*Math.max(1,Math.abs(y),Math.abs(L))&&Math.abs(m-C)<=X*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(d-B)<=X*Math.max(1,Math.abs(d),Math.abs(B))&&Math.abs(h-O)<=X*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(g-N)<=X*Math.max(1,Math.abs(g),Math.abs(N))}var Wh=Ku,Hh=tc;var Zt={};al(Zt,{add:()=>ed,ceil:()=>td,clone:()=>Kh,copy:()=>Xh,create:()=>rc,cross:()=>fd,dist:()=>_d,distance:()=>ac,div:()=>wd,divide:()=>oc,dot:()=>pd,equals:()=>vd,exactEquals:()=>bd,floor:()=>rd,forEach:()=>kd,fromValues:()=>Yh,inverse:()=>ud,len:()=>Cd,length:()=>lc,lerp:()=>yd,max:()=>id,min:()=>nd,mul:()=>Sd,multiply:()=>ic,negate:()=>ld,normalize:()=>cd,random:()=>md,round:()=>od,scale:()=>ad,scaleAndAdd:()=>sd,set:()=>Qh,sqrDist:()=>Ad,sqrLen:()=>Id,squaredDistance:()=>sc,squaredLength:()=>uc,str:()=>xd,sub:()=>Pd,subtract:()=>nc,transformMat4:()=>hd,transformQuat:()=>dd,zero:()=>gd});function rc(){var t=new qe(4);return qe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Kh(t){var e=new qe(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Yh(t,e,r,n){var i=new qe(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function Xh(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Qh(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function ed(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function nc(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function ic(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function oc(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function td(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function rd(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function nd(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function id(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function od(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function ad(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function sd(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}function ac(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.hypot(r,n,i,o)}function sc(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o}function lc(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function uc(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function ld(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function ud(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function cd(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a,t}function pd(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function fd(t,e,r,n){var i=r[0]*n[1]-r[1]*n[0],o=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],l=r[1]*n[3]-r[3]*n[1],u=r[2]*n[3]-r[3]*n[2],c=e[0],p=e[1],f=e[2],y=e[3];return t[0]=p*u-f*l+y*s,t[1]=-(c*u)+f*a-y*o,t[2]=c*l-p*a+y*i,t[3]=-(c*s)+p*o-f*i,t}function yd(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t}function md(t,e){e=e||1;var r,n,i,o,a,s;do r=gn()*2-1,n=gn()*2-1,a=r*r+n*n;while(a>=1);do i=gn()*2-1,o=gn()*2-1,s=i*i+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return t[0]=e*r,t[1]=e*n,t[2]=e*i*l,t[3]=e*o*l,t}function hd(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function dd(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,p=u*i+l*n-a*o,f=u*o+a*i-s*n,y=-a*n-s*i-l*o;return t[0]=c*u+y*-a+p*-l-f*-s,t[1]=p*u+y*-s+f*-a-c*-l,t[2]=f*u+y*-l+c*-s-p*-a,t[3]=e[3],t}function gd(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function xd(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function bd(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function vd(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(r-a)<=X*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=X*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=X*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=X*Math.max(1,Math.abs(o),Math.abs(u))}var Pd=nc,Sd=ic,wd=oc,_d=ac,Ad=sc,Cd=lc,Id=uc,kd=function(){var t=rc();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),i?l=Math.min(i*r+n,e.length):l=e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}();var cc=J(ge()),Za=class extends ye{constructor(e){super(e,Wu)}createBucket(e){return new vr(e)}queryRadius(e){let r=e;return qt("circle-radius",this,r)+qt("circle-stroke-width",this,r)+_t(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s,l){let u=At(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,s),c=this.paint.get("circle-radius").evaluate(r,n),p=this.paint.get("circle-stroke-width").evaluate(r,n),f=c+p,y=this.paint.get("circle-pitch-alignment")==="map",m=y?u:Td(u,l),d=y?f*s:f;for(let h of i)for(let g of h){let v=y?g:pc(g,l),b=d,x=Zt.transformMat4([],[g.x,g.y,0,1],l);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=x[3]/a.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=a.cameraToCenterDistance/x[3]),Uu(m,v,b))return!0}return!1}};function pc(t,e){let r=Zt.transformMat4([],[t.x,t.y,0,1],e);return new cc.default(r[0]/r[3],r[1]/r[3])}function Td(t,e){return t.map(r=>pc(r,e))}var Xi=class extends vr{};k("HeatmapBucket",Xi,{omit:["layers"]});var fc,Ed=()=>fc=fc||new oe({"heatmap-radius":new R(S.paint_heatmap["heatmap-radius"]),"heatmap-weight":new R(S.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new z(S.paint_heatmap["heatmap-intensity"]),"heatmap-color":new mr(S.paint_heatmap["heatmap-color"]),"heatmap-opacity":new z(S.paint_heatmap["heatmap-opacity"])}),yc={get paint(){return Ed()}};function Ja(t,{width:e,height:r},n,i){if(!i)i=new Uint8Array(e*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`);return t.width=e,t.height=r,t.data=i,t}function mc(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=Ja({},{width:e,height:r},n);Wa(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function Wa(t,e,r,n,i,o){if(i.width===0||i.height===0)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let u=((r.y+l)*t.width+r.x)*o,c=((n.y+l)*e.width+n.x)*o;for(let p=0;p<i.width*o;p++)s[c+p]=a[u+p]}return e}var Ct=class{constructor(e,r){Ja(this,e,1,r)}resize(e){mc(this,e,1)}clone(){return new Ct({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){Wa(e,r,n,i,o,1)}},he=class{constructor(e,r){Ja(this,e,4,r)}resize(e){mc(this,e,4)}replace(e,r){r?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new he({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){Wa(e,r,n,i,o,4)}};k("AlphaImage",Ct);k("RGBAImage",he);function hc(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new he({width:r,height:n});if(!yl(r))throw new Error(`width is not a power of 2 - ${r}`);let o=(a,s,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);i.data[a+s+0]=Math.floor(u.r*255/u.a),i.data[a+s+1]=Math.floor(u.g*255/u.a),i.data[a+s+2]=Math.floor(u.b*255/u.a),i.data[a+s+3]=Math.floor(u.a*255)};if(t.clips)for(let a=0,s=0;a<n;++a,s+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let c=l/(r-1),{start:p,end:f}=t.clips[a],y=p*(1-c)+f*c;o(s,u,y)}else for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1);o(0,s,l)}return i}var Ha=class extends ye{createBucket(e){return new Xi(e)}constructor(e){super(e,yc);this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=hc({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var dc,Ld=()=>dc=dc||new oe({"hillshade-illumination-direction":new z(S.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new z(S.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new z(S.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new z(S.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new z(S.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new z(S.paint_hillshade["hillshade-accent-color"])}),gc={get paint(){return Ld()}};var Ka=class extends ye{constructor(e){super(e,gc)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Fd=ee([{name:"a_pos",components:2,type:"Int16"}],4);var{members:xc,size:b1,alignment:v1}=Fd;var _c=J(ts());function rs(t,e,r,n,i){wc(t,e,r||0,n||t.length-1,i||Wd)}function wc(t,e,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=e-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(r,Math.floor(e-a*l/o+u)),p=Math.min(n,Math.floor(e+(o-a)*l/o+u));wc(t,e,c,p,i)}var f=t[e],y=r,m=n;for(Sn(t,r,e),i(t[n],f)>0&&Sn(t,r,n);y<m;){for(Sn(t,y,m),y++,m--;i(t[y],f)<0;)y++;for(;i(t[m],f)>0;)m--}i(t[r],f)===0?Sn(t,r,m):(m++,Sn(t,m,n)),m<=e&&(r=m+1),e<=m&&(n=m-1)}}function Sn(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Wd(t,e){return t<e?-1:t>e?1:0}function wr(t,e){let r=t.length;if(r<=1)return[t];let n=[],i,o;for(let a=0;a<r;a++){let s=gl(t[a]);s!==0&&(t[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[t[a]]):i.push(t[a]))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(rs(n[a],e,1,n[a].length-1,Hd),n[a]=n[a].slice(0,e));return n}function Hd(t,e){return e.area-t.area}function _r(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get(`${t}-pattern`);a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Ar(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get(`${t}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var Kd=500,Cr=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Aa,this.indexArray=new $e,this.indexArray2=new Gt,this.programConfigurations=new ze(e.layers,e.zoom),this.segments=new le,this.segments2=new le,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=_r("fill",this.layers,r);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=je(s,p);if(!this.layers[0]._featureFilter.filter(new j(this.zoom),f,n))continue;let y=o?i.evaluate(f,{},n,r.availableImages):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:Me(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Ar("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,xc),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,n,i,o){for(let a of wr(r,Kd)){let s=0;for(let y of a)s+=y.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),u=l.vertexLength,c=[],p=[];for(let y of a){if(y.length===0)continue;y!==a[0]&&p.push(c.length/2);let m=this.segments2.prepareSegment(y.length,this.layoutVertexArray,this.indexArray2),d=m.vertexLength;this.layoutVertexArray.emplaceBack(y[0].x,y[0].y),this.indexArray2.emplaceBack(d+y.length-1,d),c.push(y[0].x),c.push(y[0].y);for(let h=1;h<y.length;h++)this.layoutVertexArray.emplaceBack(y[h].x,y[h].y),this.indexArray2.emplaceBack(d+h-1,d+h),c.push(y[h].x),c.push(y[h].y);m.vertexLength+=y.length,m.primitiveLength+=y.length}let f=(0,_c.default)(c,p);for(let y=0;y<f.length;y+=3)this.indexArray.emplaceBack(u+f[y],u+f[y+1],u+f[y+2]);l.vertexLength+=s,l.primitiveLength+=f.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};k("FillBucket",Cr,{omit:["layers","patternFeatures"]});var Ac,Yd=()=>Ac=Ac||new oe({"fill-sort-key":new R(S.layout_fill["fill-sort-key"])}),Cc,Xd=()=>Cc=Cc||new oe({"fill-antialias":new z(S.paint_fill["fill-antialias"]),"fill-opacity":new R(S.paint_fill["fill-opacity"]),"fill-color":new R(S.paint_fill["fill-color"]),"fill-outline-color":new R(S.paint_fill["fill-outline-color"]),"fill-translate":new z(S.paint_fill["fill-translate"]),"fill-translate-anchor":new z(S.paint_fill["fill-translate-anchor"]),"fill-pattern":new St(S.paint_fill["fill-pattern"])}),Ic={get paint(){return Xd()},get layout(){return Yd()}};var ns=class extends ye{constructor(e){super(e,Ic)}recalculate(e,r){super.recalculate(e,r);let n=this.paint._values["fill-outline-color"];n.value.kind==="constant"&&n.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Cr(e)}queryRadius(){return _t(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s){let l=At(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,s);return Ki(l,i)}isTileClipped(){return!0}};var Qd=ee([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),kc=ee([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:Tc,size:rP,alignment:nP}=Qd;var Vc=J(ts()),Bc=J(It());var pg=Bc.default.VectorTileFeature.types,fg=500,as=Math.pow(2,13);function wn(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*as)*2+a,i*as*2,o*as*2,Math.round(s))}var kr=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ca,this.centroidVertexArray=new wa,this.indexArray=new $e,this.programConfigurations=new ze(e.layers,e.zoom),this.segments=new le,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=_r("fill-extrusion",this.layers,r);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of e){let l=this.layers[0]._featureFilter.needGeometry,u=je(i,l);if(!this.layers[0]._featureFilter.filter(new j(this.zoom),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:Me(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Ar("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{}),r.featureIndex.insert(i,c.geometry,a,s,this.index,!0)}}addFeatures(e,r,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,r,n)}}update(e,r,n){!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Tc),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,kc.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,n,i,o){let a={x:0,y:0,vertexCount:0};for(let s of wr(r,fg)){let l=0;for(let m of s)l+=m.length;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let m of s){if(m.length===0||mg(m))continue;let d=0;for(let h=0;h<m.length;h++){let g=m[h];if(h>=1){let v=m[h-1];if(!yg(g,v)){u.vertexLength+4>le.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let b=g.sub(v)._perp()._unit(),x=v.dist(g);d+x>32768&&(d=0),wn(this.layoutVertexArray,g.x,g.y,b.x,b.y,0,0,d),wn(this.layoutVertexArray,g.x,g.y,b.x,b.y,0,1,d),a.x+=2*g.x,a.y+=2*g.y,a.vertexCount+=2,d+=x,wn(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,0,d),wn(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,1,d),a.x+=2*v.x,a.y+=2*v.y,a.vertexCount+=2;let P=u.vertexLength;this.indexArray.emplaceBack(P,P+2,P+1),this.indexArray.emplaceBack(P+1,P+2,P+3),u.vertexLength+=4,u.primitiveLength+=2}}}}if(u.vertexLength+l>le.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),pg[e.type]!=="Polygon")continue;let c=[],p=[],f=u.vertexLength;for(let m of s)if(m.length!==0){m!==s[0]&&p.push(c.length/2);for(let d=0;d<m.length;d++){let h=m[d];wn(this.layoutVertexArray,h.x,h.y,0,0,1,1,0),a.x+=h.x,a.y+=h.y,a.vertexCount+=1,c.push(h.x),c.push(h.y)}}let y=(0,Vc.default)(c,p);for(let m=0;m<y.length;m+=3)this.indexArray.emplaceBack(f+y[m],f+y[m+2],f+y[m+1]);u.primitiveLength+=y.length/3,u.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};k("FillExtrusionBucket",kr,{omit:["layers","features"]});function yg(t,e){return t.x===e.x&&(t.x<0||t.x>W)||t.y===e.y&&(t.y<0||t.y>W)}function mg(t){return t.every(e=>e.x<0)||t.every(e=>e.x>W)||t.every(e=>e.y<0)||t.every(e=>e.y>W)}var zc,hg=()=>zc=zc||new oe({"fill-extrusion-opacity":new z(S["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new R(S["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new z(S["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new z(S["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new St(S["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new R(S["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new R(S["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new z(S["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),Rc={get paint(){return hg()}};var io=J(ge());var ss=class extends ye{constructor(e){super(e,Rc)}createBucket(e){return new kr(e)}queryRadius(){return _t(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,n,i,o,a,s,l){let u=At(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),c=this.paint.get("fill-extrusion-height").evaluate(r,n),p=this.paint.get("fill-extrusion-base").evaluate(r,n),f=xg(u,l,a,0),y=gg(i,p,c,l),m=y[0],d=y[1];return dg(m,d,f)}};function _n(t,e){return t.x*e.x+t.y*e.y}function Oc(t,e){if(t.length===1){let r=0,n=e[r++],i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){let o=e[r],a=t[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=_n(s,s),p=_n(s,l),f=_n(l,l),y=_n(u,s),m=_n(u,l),d=c*f-p*p,h=(f*y-p*m)/d,g=(c*m-p*y)/d,v=1-h-g,b=n.z*v+i.z*h+o.z*g;if(isFinite(b))return b}return 1/0}else{let r=1/0;for(let n of e)r=Math.min(r,n.z);return r}}function dg(t,e,r){let n=1/0;Ki(r,e)&&(n=Oc(r,e[0]));for(let i=0;i<e.length;i++){let o=e[i],a=t[i];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],f=[l,u,p,c,l];Nu(r,f)&&(n=Math.min(n,Oc(r,f)))}}return n===1/0?!1:n}function gg(t,e,r,n){let i=[],o=[],a=n[8]*e,s=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,p=n[9]*r,f=n[10]*r,y=n[11]*r;for(let m of t){let d=[],h=[];for(let g of m){let v=g.x,b=g.y,x=n[0]*v+n[4]*b+n[12],P=n[1]*v+n[5]*b+n[13],w=n[2]*v+n[6]*b+n[14],_=n[3]*v+n[7]*b+n[15],T=x+a,I=P+s,E=w+l,A=_+u,F=x+c,L=P+p,C=w+f,B=_+y,O=new io.default(T/A,I/A);O.z=E/A,d.push(O);let N=new io.default(F/B,L/B);N.z=C/B,h.push(N)}i.push(d),o.push(h)}return[i,o]}function xg(t,e,r,n){let i=[];for(let o of t){let a=[o.x,o.y,n,1];Zt.transformMat4(a,a,e),i.push(new io.default(a[0]/a[3],a[1]/a[3]))}return i}var bg=ee([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Nc,size:OP,alignment:NP}=bg;var vg=ee([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Uc,size:GP,alignment:jP}=vg;var $c=J(It());var Pg=$c.default.VectorTileFeature.types,Gc=63,Sg=Math.cos(75/2*(Math.PI/180)),wg=15,_g=20,Ag=15,jc=1/2,qc=Math.pow(2,Ag-1)/jc,Tr=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Ia,this.layoutVertexArray2=new ka,this.indexArray=new $e,this.programConfigurations=new ze(e.layers,e.zoom),this.segments=new le,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=_r("line",this.layers,r);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=je(s,p);if(!this.layers[0]._featureFilter.filter(new j(this.zoom),f,n))continue;let y=o?i.evaluate(f,{},n):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:Me(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Ar("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Uc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Nc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(!!e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let r=+e.properties.mapbox_clip_start,n=+e.properties.mapbox_clip_end;return{start:r,end:n}}}addFeature(e,r,n,i,o){let a=this.layers[0].layout,s=a.get("line-join").evaluate(e,{}),l=a.get("line-cap"),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let p of r)this.addLine(p,e,s,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,r,n,i,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let g=0;g<e.length-1;g++)this.totalDistance+=e[g].dist(e[g+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=Pg[r.type]==="Polygon",l=e.length;for(;l>=2&&e[l-1].equals(e[l-2]);)l--;let u=0;for(;u<l-1&&e[u].equals(e[u+1]);)u++;if(l<(s?3:2))return;n==="bevel"&&(o=1.05);let c=this.overscaling<=16?wg*W/(512*this.overscaling):0,p=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),f,y,m,d,h;this.e1=this.e2=-1,s&&(f=e[l-2],h=e[u].sub(f)._unit()._perp());for(let g=u;g<l;g++){if(m=g===l-1?s?e[u+1]:void 0:e[g+1],m&&e[g].equals(m))continue;h&&(d=h),f&&(y=f),f=e[g],h=m?m.sub(f)._unit()._perp():d,d=d||h;let v=d.add(h);(v.x!==0||v.y!==0)&&v._unit();let b=d.x*h.x+d.y*h.y,x=v.x*h.x+v.y*h.y,P=x!==0?1/x:1/0,w=2*Math.sqrt(2-2*x),_=x<Sg&&y&&m,T=d.x*h.y-d.y*h.x>0;if(_&&g>u){let A=f.dist(y);if(A>2*c){let F=f.sub(f.sub(y)._mult(c/A)._round());this.updateDistance(y,F),this.addCurrentVertex(F,d,0,0,p),y=F}}let I=y&&m,E=I?n:s?"butt":i;if(I&&E==="round"&&(P<a?E="miter":P<=2&&(E="fakeround")),E==="miter"&&P>o&&(E="bevel"),E==="bevel"&&(P>2&&(E="flipbevel"),P<o&&(E="miter")),y&&this.updateDistance(y,f),E==="miter")v._mult(P),this.addCurrentVertex(f,v,0,0,p);else if(E==="flipbevel"){if(P>100)v=h.mult(-1);else{let A=P*d.add(h).mag()/d.sub(h).mag();v._perp()._mult(A*(T?-1:1))}this.addCurrentVertex(f,v,0,0,p),this.addCurrentVertex(f,v.mult(-1),0,0,p)}else if(E==="bevel"||E==="fakeround"){let A=-Math.sqrt(P*P-1),F=T?A:0,L=T?0:A;if(y&&this.addCurrentVertex(f,d,F,L,p),E==="fakeround"){let C=Math.round(w*180/Math.PI/_g);for(let B=1;B<C;B++){let O=B/C;if(O!==.5){let K=O-.5,Y=1.0904+b*(-3.2452+b*(3.55645-b*1.43519)),Q=.848013+b*(-1.06021+b*.215638);O=O+O*K*(O-1)*(Y*K*K+Q)}let N=h.sub(d)._mult(O)._add(d)._unit()._mult(T?-1:1);this.addHalfVertex(f,N.x,N.y,!1,T,0,p)}}m&&this.addCurrentVertex(f,h,-F,-L,p)}else if(E==="butt")this.addCurrentVertex(f,v,0,0,p);else if(E==="square"){let A=y?1:-1;this.addCurrentVertex(f,v,A,A,p)}else E==="round"&&(y&&(this.addCurrentVertex(f,d,0,0,p),this.addCurrentVertex(f,d,1,1,p,!0)),m&&(this.addCurrentVertex(f,h,-1,-1,p,!0),this.addCurrentVertex(f,h,0,0,p)));if(_&&g<l-1){let A=f.dist(m);if(A>2*c){let F=f.add(m.sub(f)._mult(c/A)._round());this.updateDistance(f,F),this.addCurrentVertex(F,h,0,0,p),f=F}}}}addCurrentVertex(e,r,n,i,o,a=!1){let s=r.x+r.y*n,l=r.y-r.x*n,u=-r.x+r.y*i,c=-r.y-r.x*i;this.addHalfVertex(e,s,l,a,!1,n,o),this.addHalfVertex(e,u,c,a,!0,-i,o),this.distance>qc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,n,i,o,a))}addHalfVertex({x:e,y:r},n,i,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(qc-1):this.scaledDistance)*jc;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(Gc*n)+128,Math.round(Gc*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,y=this.lineClips.end-this.lineClips.start,m=f/y;this.layoutVertexArray2.emplaceBack(m,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,p),l.primitiveLength++),a?this.e2=p:this.e1=p}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}};k("LineBucket",Tr,{omit:["layers","patternFeatures"]});var Zc,Cg=()=>Zc=Zc||new oe({"line-cap":new z(S.layout_line["line-cap"]),"line-join":new R(S.layout_line["line-join"]),"line-miter-limit":new z(S.layout_line["line-miter-limit"]),"line-round-limit":new z(S.layout_line["line-round-limit"]),"line-sort-key":new R(S.layout_line["line-sort-key"])}),Jc,Ig=()=>Jc=Jc||new oe({"line-opacity":new R(S.paint_line["line-opacity"]),"line-color":new R(S.paint_line["line-color"]),"line-translate":new z(S.paint_line["line-translate"]),"line-translate-anchor":new z(S.paint_line["line-translate-anchor"]),"line-width":new R(S.paint_line["line-width"]),"line-gap-width":new R(S.paint_line["line-gap-width"]),"line-offset":new R(S.paint_line["line-offset"]),"line-blur":new R(S.paint_line["line-blur"]),"line-dasharray":new yr(S.paint_line["line-dasharray"]),"line-pattern":new St(S.paint_line["line-pattern"]),"line-gradient":new mr(S.paint_line["line-gradient"])}),ls={get paint(){return Ig()},get layout(){return Cg()}};var Wc=class extends R{possiblyEvaluate(e,r){return r=new j(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,n,i){return r=Ae({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},oo,us=class extends ye{constructor(e){super(e,ls);this.gradientVersion=0,oo||(oo=new Wc(ls.paint.properties["line-width"].specification),oo.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=r._styleExpression.expression instanceof Ft,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=oo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Tr(e)}queryRadius(e){let r=e,n=Hc(qt("line-width",this,r),qt("line-gap-width",this,r)),i=qt("line-offset",this,r);return n/2+Math.abs(i)+_t(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s){let l=At(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),u=s/2*Hc(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),c=this.paint.get("line-offset").evaluate(r,n);return c&&(i=qu(i,c*s)),$u(l,i,u)}isTileClipped(){return!0}};function Hc(t,e){return e>0?e+2*t:t}var Kc=ee([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Yc=ee([{name:"a_projected_pos",components:3,type:"Float32"}],4),IS=ee([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Xc=ee([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),kS=ee([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),cs=ee([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),TS=ee([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),ES=ee([{name:"triangle",components:3,type:"Uint16"}]),LS=ee([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),FS=ee([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),MS=ee([{type:"Float32",name:"offsetX"}]),DS=ee([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var kn=J(ge());function kg(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),ie.applyArabicShaping&&(t=ie.applyArabicShaping(t)),t}function Qc(t,e,r){return t.sections.forEach(n=>{n.text=kg(n.text,e,r)}),t}function ep(t){let e={},r={},n=[],i=0;function o(u){n.push(t[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=e[c];return delete e[c],e[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return`${u}:${f.x}:${f.y}`}for(let u=0;u<t.length;u++){let c=t[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in e&&r[y]!==e[m]){let d=s(y,m,p),h=a(y,m,n[d].geometry);delete e[y],delete r[m],r[l(f,n[h].geometry,!0)]=h,n[d].geometry=null}else y in r?a(y,m,p):m in e?s(y,m,p):(o(u),e[y]=i-1,r[m]=i-1)}return n.filter(u=>u.geometry)}var Er={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function tp(t){let e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;(!n||!ua(n)||Er[t[r+1]])&&(!i||!ua(i)||Er[t[r-1]])&&Er[t[r]]?e+=Er[t[r]]:e+=t[r]}return e}var ue=24;var Zg=J(An()),Jg=3;var lo=Jg;function Cn(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,l)=>l.h-s.h);let n=Math.max(Math.ceil(Math.sqrt(e/.95)),r),i=[{x:0,y:0,w:n,h:1/0}],o=0,a=0;for(let s of t)for(let l=i.length-1;l>=0;l--){let u=i[l];if(!(s.w>u.w||s.h>u.h)){if(s.x=u.x,s.y=u.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===u.w&&s.h===u.h){let c=i.pop();l<i.length&&(i[l]=c)}else s.h===u.h?(u.x+=s.w,u.w-=s.w):s.w===u.w?(u.y+=s.h,u.h-=s.h):(i.push({x:u.x+s.w,y:u.y,w:u.w-s.w,h:s.h}),u.y+=s.h,u.h-=s.h);break}}return{w:o,h:a,fill:e/(o*a)||0}}var xe=1;var ys=class{constructor(e,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n}get tl(){return[this.paddedRect.x+xe,this.paddedRect.y+xe]}get br(){return[this.paddedRect.x+this.paddedRect.w-xe,this.paddedRect.y+this.paddedRect.h-xe]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-xe*2)/this.pixelRatio,(this.paddedRect.h-xe*2)/this.pixelRatio]}},uo=class{constructor(e,r){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,n,o),this.addImages(r,i,o);let{w:a,h:s}=Cn(o),l=new he({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;he.copy(c.data,l,{x:0,y:0},{x:p.x+xe,y:p.y+xe},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+xe,y=p.y+xe,m=c.data.width,d=c.data.height;he.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),he.copy(c.data,l,{x:0,y:d-1},{x:f,y:y-1},{width:m,height:1}),he.copy(c.data,l,{x:0,y:0},{x:f,y:y+d},{width:m,height:1}),he.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:d}),he.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:d})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(e,r,n){for(let i in e){let o=e[i],a={x:0,y:0,w:o.data.width+2*xe,h:o.data.height+2*xe};n.push(a),r[i]=new ys(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),r)}patchUpdatedImage(e,r,n){if(!e||!r||e.version===r.version)return;e.version=r.version;let[i,o]=e.tl;n.update(r.data,void 0,{x:i,y:o})}};k("ImagePosition",ys);k("ImageAtlas",uo);var de;(function(i){i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly"})(de||(de={}));var Mr=-17;function Wg(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var lp=57344,up=63743,Dr=class{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){let n=new Dr;return n.scale=e||1,n.fontStack=r,n}static forImage(e){let r=new Dr;return r.imageName=e,r}},Wt=class{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){let n=new Wt;for(let i=0;i<e.sections.length;i++){let o=e.sections[i];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=tp(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&co[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&co[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){let n=new Wt;return n.text=this.text.substring(e,r),n.sectionIndex=this.sectionIndex.slice(e,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(Dr.forText(e.scale,e.fontStack||r));let n=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(n)}addImageSection(e){let r=e.image?e.image.name:"";if(r.length===0){ce("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){ce(`Reached maximum number of images ${up-lp+2}`);return}this.text+=String.fromCharCode(n),this.sections.push(Dr.forImage(r)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=up?null:++this.imageSectionID:(this.imageSectionID=lp,this.imageSectionID)}};function Hg(t,e){let r=[],n=t.text,i=0;for(let o of e)r.push(t.substring(i,o)),i=o;return i<n.length&&r.push(t.substring(i,n.length)),r}function In(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d){let h=Wt.fromFeature(t,i);p===2&&h.verticalizePunctuation();let g,{processBidirectionalText:v,processStyledBidirectionalText:b}=ie;if(v&&h.sections.length===1){g=[];let w=v(h.toString(),ms(h,u,o,e,n,y,m));for(let _ of w){let T=new Wt;T.text=_,T.sections=h.sections;for(let I=0;I<_.length;I++)T.sectionIndex.push(0);g.push(T)}}else if(b){g=[];let w=b(h.text,h.sectionIndex,ms(h,u,o,e,n,y,m));for(let _ of w){let T=new Wt;T.text=_[0],T.sectionIndex=_[1],T.sections=h.sections,g.push(T)}}else g=Hg(h,ms(h,u,o,e,n,y,m));let x=[],P={positionedLines:x,text:h.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return Qg(P,e,r,n,g,a,s,l,p,u,f,d),Wg(x)?!1:P}var co={[9]:!0,[10]:!0,[11]:!0,[12]:!0,[13]:!0,[32]:!0},Kg={[10]:!0,[32]:!0,[38]:!0,[40]:!0,[41]:!0,[43]:!0,[45]:!0,[47]:!0,[173]:!0,[183]:!0,[8203]:!0,[8208]:!0,[8211]:!0,[8231]:!0};function cp(t,e,r,n,i,o){if(e.imageName){let a=n[e.imageName];return a?a.displaySize[0]*e.scale*ue/o+i:0}else{let a=r[e.fontStack],s=a&&a[t];return s?s.metrics.advance*e.scale+i:0}}function Yg(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=cp(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function pp(t,e,r,n){let i=Math.pow(t-e,2);return n?t<e?i/2:i*2:i+Math.abs(r)*r}function Xg(t,e,r){let n=0;return t===10&&(n-=1e4),r&&(n+=150),(t===40||t===65288)&&(n+=50),(e===41||e===65289)&&(n+=50),n}function fp(t,e,r,n,i,o){let a=null,s=pp(e,r,i,o);for(let l of n){let u=e-l.x,c=pp(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function yp(t){return t?yp(t.priorBreak).concat(t.index):[]}function ms(t,e,r,n,i,o,a){if(o!=="point")return[];if(!t)return[];let s=[],l=Yg(t,e,r,n,i,a),u=t.text.indexOf("\\u200B")>=0,c=0;for(let p=0;p<t.length();p++){let f=t.getSection(p),y=t.getCharCode(p);if(co[y]||(c+=cp(y,f,n,i,e,a)),p<t.length()-1){let m=wu(y);(Kg[y]||m||f.imageName)&&s.push(fp(p+1,c,l,s,Xg(y,t.getCharCode(p+1),m&&u),!1))}}return yp(fp(t.length(),c,l,s,0,!0))}function mp(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0;break}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0;break}return{horizontalAlign:e,verticalAlign:r}}function Qg(t,e,r,n,i,o,a,s,l,u,c,p){let f=0,y=Mr,m=0,d=0,h=s==="right"?1:s==="left"?0:.5,g=0;for(let P of i){P.trim();let w=P.getMaxScale(),_=(w-1)*ue,T={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=T;let I=T.positionedGlyphs,E=0;if(!P.length()){y+=o,++g;continue}for(let F=0;F<P.length();F++){let L=P.getSection(F),C=P.getSectionIndex(F),B=P.getCharCode(F),O=0,N=null,K=null,Y=null,Q=ue,me=!(l===1||!c&&!bi(B)||c&&(co[B]||_u(B)));if(L.imageName){let Te=n[L.imageName];if(!Te)continue;Y=L.imageName,t.iconsInText=t.iconsInText||!0,K=Te.paddedRect;let te=Te.displaySize;L.scale=L.scale*ue/p,N={width:te[0],height:te[1],left:xe,top:-lo,advance:me?te[1]:te[0]};let Se=ue-te[1]*L.scale;O=_+Se,Q=N.advance;let Je=me?te[0]*L.scale-ue*w:te[1]*L.scale-ue*w;Je>0&&Je>E&&(E=Je)}else{let Te=r[L.fontStack],te=Te&&Te[B];if(te&&te.rect)K=te.rect,N=te.metrics;else{let Se=e[L.fontStack],Je=Se&&Se[B];if(!Je)continue;N=Je.metrics}O=(w-L.scale)*ue}me?(t.verticalizable=!0,I.push({glyph:B,imageName:Y,x:f,y:y+O,vertical:me,scale:L.scale,fontStack:L.fontStack,sectionIndex:C,metrics:N,rect:K}),f+=Q*L.scale+u):(I.push({glyph:B,imageName:Y,x:f,y:y+O,vertical:me,scale:L.scale,fontStack:L.fontStack,sectionIndex:C,metrics:N,rect:K}),f+=N.advance*L.scale+u)}if(I.length!==0){let F=f-u;m=Math.max(F,m),ex(I,0,I.length-1,h,E)}f=0;let A=o*w+E;T.lineOffset=Math.max(E,_),y+=A,d=Math.max(A,d),++g}let v=y-Mr,{horizontalAlign:b,verticalAlign:x}=mp(a);tx(t.positionedLines,h,b,x,m,d,o,v,i.length),t.top+=-x*v,t.bottom=t.top+v,t.left+=-b*m,t.right=t.left+m}function ex(t,e,r,n,i){if(!n&&!i)return;let o=t[r],a=o.metrics.advance*o.scale,s=(t[r].x+a)*n;for(let l=e;l<=r;l++)t[l].x-=s,t[l].y+=i}function tx(t,e,r,n,i,o,a,s,l){let u=(e-r)*i,c=0;o!==a?c=-s*n-Mr:c=(-n*l+.5)*a;for(let p of t)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function hp(t,e,r){let{horizontalAlign:n,verticalAlign:i}=mp(r),o=e[0],a=e[1],s=o-t.displaySize[0]*n,l=s+t.displaySize[0],u=a-t.displaySize[1]*i,c=u+t.displaySize[1];return{image:t,top:u,bottom:c,left:s,right:l}}function hs(t,e,r,n,i,o){let a=t.image,s;if(a.content){let h=a.content,g=a.pixelRatio||1;s=[h[0]/g,h[1]/g,a.displaySize[0]-h[2]/g,a.displaySize[1]-h[3]/g]}let l=e.left*o,u=e.right*o,c,p,f,y;r==="width"||r==="both"?(y=i[0]+l-n[3],p=i[0]+u+n[1]):(y=i[0]+(l+u-a.displaySize[0])/2,p=y+a.displaySize[0]);let m=e.top*o,d=e.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+d+n[2]):(c=i[1]+(m+d-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var dp=J(It());var Vr=255,kt=128,tt=Vr*kt;function ds(t,e){let{expression:r}=e;if(r.kind==="constant"){let n=r.evaluate(new j(t+1));return{kind:"constant",layoutSize:n}}else{if(r.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=r,o=0;for(;o<n.length&&n[o]<=t;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<t+1;)a++;a=Math.min(n.length-1,a);let s=n[o],l=n[a];if(r.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let u=r.evaluate(new j(s)),c=r.evaluate(new j(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}}function gs(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var rx=dp.default.VectorTileFeature.types,nx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function po(t,e,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(tt,Math.round(s[0])):0,m=s?Math.min(tt,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(n*32),Math.round(i*32),o,a,(y<<1)+(l?1:0),m,u*16,c*16,p*256,f*256)}function gp(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function ix(t){for(let e of t.sections)if(Cu(e.text))return!0;return!1}var fo=class{constructor(e){this.layoutVertexArray=new Ta,this.indexArray=new $e,this.programConfigurations=e,this.segments=new le,this.dynamicLayoutVertexArray=new Ea,this.opacityVertexArray=new La,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ni}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Kc.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Yc.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,nx,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(e))}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};k("SymbolBuffers",fo);var yo=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new le,this.collisionVertexArray=new Fa}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Xc.members,!0)}destroy(){!this.layoutVertexBuffer||(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};k("CollisionBuffers",yo);var rt=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(l=>l.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=xn.identity([]),this.placementViewportMatrix=xn.identity([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ds(this.zoom,n["text-size"]),this.iconSizeData=ds(this.zoom,n["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=gs(i,"text-overlap","text-allow-overlap")!=="never"||gs(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>de[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new fo(new ze(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new fo(new ze(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new $i,this.lineVertexArray=new Gi,this.symbolInstances=new Ui}calculateGlyphDependencies(e,r,n,i,o){for(let a=0;a<e.length;a++)if(r[e.charCodeAt(a)]=!0,(n||i)&&o){let s=Er[e.charAt(a)];s&&(r[s.charCodeAt(0)]=!0)}}populate(e,r,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof ve&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,y=r.glyphDependencies,m=r.availableImages,d=new j(this.zoom);for(let{feature:h,id:g,index:v,sourceLayerIndex:b}of e){let x=i._featureFilter.needGeometry,P=je(h,x);if(!i._featureFilter.filter(d,P,n))continue;x||(P.geometry=Me(h));let w;if(u){let E=i.getValueAndResolveTokens("text-field",P,n,m),A=ve.factory(E);ix(A)&&(this.hasRTLText=!0),(!this.hasRTLText||Tu()==="unavailable"||this.hasRTLText&&ie.isParsed())&&(w=Qc(A,i,P))}let _;if(c){let E=i.getValueAndResolveTokens("icon-image",P,n,m);E instanceof Ce?_=E:_=Ce.fromString(E)}if(!w&&!_)continue;let T=this.sortFeaturesByKey?p.evaluate(P,{},n):void 0,I={id:g,text:w,icon:_,index:v,sourceLayerIndex:b,geometry:P.geometry,properties:h.properties,type:rx[h.type],sortKey:T};if(this.features.push(I),_&&(f[_.name]=!0),w){let E=a.evaluate(P,{},n).join(","),A=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(de.vertical)>=0;for(let F of w.sections)if(F.image)f[F.image.name]=!0;else{let L=pn(w.toString()),C=F.fontStack||E,B=y[C]=y[C]||{};this.calculateGlyphDependencies(F.text,B,A,this.allowVerticalPlacement,L)}}}o.get("symbol-placement")==="line"&&(this.features=ep(this.features)),this.sortFeaturesByKey&&this.features.sort((h,g)=>h.sortKey-g.sortKey)}update(e,r,n){!this.stateDependentLayers.length||(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){let n=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(r[e.segment+1]),o=e.dist(r[e.segment]),a={};for(let s=e.segment+1;s<r.length;s++)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:i},s<r.length-1&&(i+=r[s+1].dist(r[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=r[s-1].dist(r[s]));for(let s=0;s<r.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,r,n,i,o,a,s,l,u,c,p,f){let y=e.indexArray,m=e.layoutVertexArray,d=e.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),h=this.glyphOffsetArray.length,g=d.vertexLength,v=this.allowVerticalPlacement&&s===de.vertical?Math.PI/2:0,b=a.text&&a.text.sections;for(let x=0;x<r.length;x++){let{tl:P,tr:w,bl:_,br:T,tex:I,pixelOffsetTL:E,pixelOffsetBR:A,minFontScaleX:F,minFontScaleY:L,glyphOffset:C,isSDF:B,sectionIndex:O}=r[x],N=d.vertexLength,K=C[1];po(m,l.x,l.y,P.x,K+P.y,I.x,I.y,n,B,E.x,E.y,F,L),po(m,l.x,l.y,w.x,K+w.y,I.x+I.w,I.y,n,B,A.x,E.y,F,L),po(m,l.x,l.y,_.x,K+_.y,I.x,I.y+I.h,n,B,E.x,A.y,F,L),po(m,l.x,l.y,T.x,K+T.y,I.x+I.w,I.y+I.h,n,B,A.x,A.y,F,L),gp(e.dynamicLayoutVertexArray,l,v),y.emplaceBack(N,N+1,N+2),y.emplaceBack(N+1,N+2,N+3),d.vertexLength+=4,d.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(C[0]),(x===r.length-1||O!==r[x+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,b&&b[O])}e.placedSymbolArray.emplaceBack(l.x,l.y,h,this.glyphOffsetArray.length-h,g,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,p)}_addCollisionDebugVertex(e,r,n,i,o,a){return r.emplaceBack(0,0),e.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,r,n,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,f=s.anchorX,y=s.anchorY;this._addCollisionDebugVertex(c,p,a,f,y,new kn.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new kn.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new kn.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new kn.default(e,i)),l.vertexLength+=4;let m=o.indexArray;m.emplaceBack(u,u+1),m.emplaceBack(u+1,u+2),m.emplaceBack(u+2,u+3),m.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(e,r,n,i){for(let o=e;o<r;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,u=a.x2,c=a.y2;this.addCollisionDebugVertices(s,l,u,c,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new yo(qi,cs.members,Gt),this.iconCollisionBox=new yo(qi,cs.members,Gt);for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,n,i,o,a,s,l,u){let c={};for(let p=r;p<n;p++){let f=e.get(p);c.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.textFeatureIndex=f.featureIndex;break}for(let p=i;p<o;p++){let f=e.get(p);c.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalTextFeatureIndex=f.featureIndex;break}for(let p=a;p<s;p++){let f=e.get(p);c.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.iconFeatureIndex=f.featureIndex;break}for(let p=l;p<u;p++){let f=e.get(p);c.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalIconFeatureIndex=f.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){let n=e.placedSymbolArray.get(r),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)e.indexArray.emplaceBack(o,o+1,o+2),e.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(e),n=Math.cos(e),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(r*l.anchorX+n*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(e,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(!!this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};k("SymbolBucket",rt,{omit:["layers","collisionBoxArray","features","compareText"]});rt.MAX_GLYPHS=65535;rt.addDynamicAttributes=gp;function xp(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>n in t?String(t[n]):"")}var bp,ox=()=>bp=bp||new oe({"symbol-placement":new z(S.layout_symbol["symbol-placement"]),"symbol-spacing":new z(S.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new z(S.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new R(S.layout_symbol["symbol-sort-key"]),"symbol-z-order":new z(S.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new z(S.layout_symbol["icon-allow-overlap"]),"icon-overlap":new z(S.layout_symbol["icon-overlap"]),"icon-ignore-placement":new z(S.layout_symbol["icon-ignore-placement"]),"icon-optional":new z(S.layout_symbol["icon-optional"]),"icon-rotation-alignment":new z(S.layout_symbol["icon-rotation-alignment"]),"icon-size":new R(S.layout_symbol["icon-size"]),"icon-text-fit":new z(S.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new z(S.layout_symbol["icon-text-fit-padding"]),"icon-image":new R(S.layout_symbol["icon-image"]),"icon-rotate":new R(S.layout_symbol["icon-rotate"]),"icon-padding":new R(S.layout_symbol["icon-padding"]),"icon-keep-upright":new z(S.layout_symbol["icon-keep-upright"]),"icon-offset":new R(S.layout_symbol["icon-offset"]),"icon-anchor":new R(S.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new z(S.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new z(S.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new z(S.layout_symbol["text-rotation-alignment"]),"text-field":new R(S.layout_symbol["text-field"]),"text-font":new R(S.layout_symbol["text-font"]),"text-size":new R(S.layout_symbol["text-size"]),"text-max-width":new R(S.layout_symbol["text-max-width"]),"text-line-height":new z(S.layout_symbol["text-line-height"]),"text-letter-spacing":new R(S.layout_symbol["text-letter-spacing"]),"text-justify":new R(S.layout_symbol["text-justify"]),"text-radial-offset":new R(S.layout_symbol["text-radial-offset"]),"text-variable-anchor":new z(S.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new R(S.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new R(S.layout_symbol["text-anchor"]),"text-max-angle":new z(S.layout_symbol["text-max-angle"]),"text-writing-mode":new z(S.layout_symbol["text-writing-mode"]),"text-rotate":new R(S.layout_symbol["text-rotate"]),"text-padding":new z(S.layout_symbol["text-padding"]),"text-keep-upright":new z(S.layout_symbol["text-keep-upright"]),"text-transform":new R(S.layout_symbol["text-transform"]),"text-offset":new R(S.layout_symbol["text-offset"]),"text-allow-overlap":new z(S.layout_symbol["text-allow-overlap"]),"text-overlap":new z(S.layout_symbol["text-overlap"]),"text-ignore-placement":new z(S.layout_symbol["text-ignore-placement"]),"text-optional":new z(S.layout_symbol["text-optional"])}),vp,ax=()=>vp=vp||new oe({"icon-opacity":new R(S.paint_symbol["icon-opacity"]),"icon-color":new R(S.paint_symbol["icon-color"]),"icon-halo-color":new R(S.paint_symbol["icon-halo-color"]),"icon-halo-width":new R(S.paint_symbol["icon-halo-width"]),"icon-halo-blur":new R(S.paint_symbol["icon-halo-blur"]),"icon-translate":new z(S.paint_symbol["icon-translate"]),"icon-translate-anchor":new z(S.paint_symbol["icon-translate-anchor"]),"text-opacity":new R(S.paint_symbol["text-opacity"]),"text-color":new R(S.paint_symbol["text-color"],{runtimeType:Re,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new R(S.paint_symbol["text-halo-color"]),"text-halo-width":new R(S.paint_symbol["text-halo-width"]),"text-halo-blur":new R(S.paint_symbol["text-halo-blur"]),"text-translate":new z(S.paint_symbol["text-translate"]),"text-translate-anchor":new z(S.paint_symbol["text-translate-anchor"])}),mo={get paint(){return ax()},get layout(){return ox()}};var ho=class{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Qt,this.defaultValue=e}evaluate(e){if(e.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let r=this.defaultValue.value;e(r._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};k("FormatSectionOverride",ho,{omit:["defaultValue"]});var Br=class extends ye{constructor(e){super(e,mo)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let i=[];for(let o of n)i.indexOf(o)<0&&i.push(o);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,n,i){let o=this.layout.get(e).evaluate(r,{},n,i),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!on(a.value)&&o?xp(r.properties,o):o}createBucket(e){return new rt(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of mo.paint.overridableProperties){if(!Br.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new ho(r),i=new lr(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new zt("source",i):o=new Rt("composite",i,r.value.zoomStops),this.paint._values[e]=new Ie(r.property,o,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!this.layout||r.isDataDriven()||n.isDataDriven()?!1:Br.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let n=e.get("text-field"),i=mo.paint.properties[r],o=!1,a=s=>{for(let l of s)if(i.overrides&&i.overrides.hasOverride(l)){o=!0;return}};if(n.value.kind==="constant"&&n.value.value instanceof ve)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof at&&pe(u.value)===tr){let c=u.value;a(c.sections)}else u instanceof ar?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};function Pp(t,e,r,n=1){let i=t.get("icon-padding").evaluate(e,{},r),o=i&&i.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}var Sp,sx=()=>Sp=Sp||new oe({"background-color":new z(S.paint_background["background-color"]),"background-pattern":new yr(S.paint_background["background-pattern"]),"background-opacity":new z(S.paint_background["background-opacity"])}),wp={get paint(){return sx()}};var xs=class extends ye{constructor(e){super(e,wp)}};var _p,lx=()=>_p=_p||new oe({"raster-opacity":new z(S.paint_raster["raster-opacity"]),"raster-hue-rotate":new z(S.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new z(S.paint_raster["raster-brightness-min"]),"raster-brightness-max":new z(S.paint_raster["raster-brightness-max"]),"raster-saturation":new z(S.paint_raster["raster-saturation"]),"raster-contrast":new z(S.paint_raster["raster-contrast"]),"raster-resampling":new z(S.paint_raster["raster-resampling"]),"raster-fade-duration":new z(S.paint_raster["raster-fade-duration"])}),Ap={get paint(){return lx()}};var bs=class extends ye{constructor(e){super(e,Ap)}};var vs=class extends ye{constructor(e){super(e,{});this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)};this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)};this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Cp(t){if(t.type==="custom")return new vs(t);switch(t.type){case"background":return new xs(t);case"circle":return new Za(t);case"fill":return new ns(t);case"fill-extrusion":return new ss(t);case"heatmap":return new Ha(t);case"hillshade":return new Ka(t);case"line":return new us(t);case"raster":return new bs(t);case"symbol":return new Br(t)}}var Ps=class{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(e,r){for(let i of e){this._layerConfigs[i.id]=i;let o=this._layers[i.id]=Cp(i);o._featureFilter=an(o.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let i of r)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource={};let n=Kl(Object.values(this._layerConfigs),this.keyCache);for(let i of n){let o=i.map(p=>this._layers[p.id]),a=o[0];if(a.visibility==="none")continue;let s=a.source||"",l=this.familiesBySource[s];l||(l=this.familiesBySource[s]={});let u=a.sourceLayer||"_geojsonTileLayer",c=l[u];c||(c=l[u]=[]),c.push(o)}}};var Qp=J(It()),ef=J(An());var Tn=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){let n=e[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}};var Ip=J(It()),kp=J(An());var Ss=class{constructor(e,r,n,i,o){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=n,e._y=i,this.properties=e.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let r in this)r==="_geometry"||r==="_vectorTileFeature"||(e[r]=this[r]);return e}};var go=class{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new dt(W,16,0),this.grid3D=new dt(W,16,0),this.featureIndexArray=new ji,this.promoteId=r}insert(e,r,n,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,o);let l=a?this.grid3D:this.grid;for(let u=0;u<r.length;u++){let c=r[u],p=[1/0,1/0,-1/0,-1/0];for(let f=0;f<c.length;f++){let y=c[f];p[0]=Math.min(p[0],y.x),p[1]=Math.min(p[1],y.y),p[2]=Math.max(p[2],y.x),p[3]=Math.max(p[3],y.y)}p[0]<W&&p[1]<W&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ip.default.VectorTile(new kp.default(this.rawTileData)).layers,this.sourceLayerCoder=new Tn(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,n,i){this.loadVTLayers();let o=e.params||{},a=W/e.tileSize/e.scale,s=an(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=Ep(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=Ep(e.cameraQueryGeometry),y=this.grid3D.query(f.minX-u,f.minY-u,f.maxX+u,f.maxY+u,(h,g,v,b)=>ju(e.cameraQueryGeometry,h-u,g-u,v+u,b+u));for(let h of y)p.push(h);p.sort(ux);let m={},d;for(let h=0;h<p.length;h++){let g=p[h];if(g===d)continue;d=g;let v=this.featureIndexArray.get(g),b=null;this.loadMatchingFeature(m,v.bucketIndex,v.sourceLayerIndex,v.featureIndex,s,o.layers,o.availableImages,r,n,i,(x,P,w)=>(b||(b=Me(x)),P.queryIntersectsFeature(l,x,w,b,this.z,e.transform,a,e.pixelPosMatrix)))}return m}loadMatchingFeature(e,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!hl(a,f))return;let y=this.sourceLayerCoder.decode(n),d=this.vtLayers[y].feature(i);if(o.needGeometry){let g=je(d,!0);if(!o.filter(new j(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!o.filter(new j(this.tileID.overscaledZ),d))return;let h=this.getId(d,y);for(let g=0;g<f.length;g++){let v=f[g];if(a&&a.indexOf(v)<0)continue;let b=l[v];if(!b)continue;let x={};h&&c&&(x=c.getState(b.sourceLayer||"_geojsonTileLayer",h));let P=Ae({},u[v]);P.paint=Tp(P.paint,b.paint,d,x,s),P.layout=Tp(P.layout,b.layout,d,x,s);let w=!p||p(d,b,x);if(!w)continue;let _=new Ss(d,this.z,this.x,this.y,h);_.layer=P;let T=e[v];T===void 0&&(T=e[v]=[]),T.push({featureIndex:i,feature:_,intersectionZ:w})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=an(o);for(let p of e)this.loadMatchingFeature(u,n,i,p,c,a,s,l,r);return u}hasLayer(e){for(let r of this.bucketLayerIDs)for(let n of r)if(e===n)return!0;return!1}getId(e,r){let n=e.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=e.properties[i],typeof n=="boolean"&&(n=Number(n))}return n}};k("FeatureIndex",go,{omit:["rawTileData","sourceLayerCoder"]});function Tp(t,e,r,n,i){return Gr(t,(o,a)=>{let s=e instanceof Ut?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function Ep(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(let o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y);return{minX:e,minY:r,maxX:n,maxY:i}}function ux(t,e){return e-t}var Lp=J(ge());var Ye=class extends Lp.default{constructor(e,r,n,i){super(e,r);this.angle=n,i!==void 0&&(this.segment=i)}clone(){return new Ye(this.x,this.y,this.angle,this.segment)}};k("Anchor",Ye);function ws(t,e,r,n,i){if(e.segment===void 0||r===0)return!0;let o=e,a=e.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;let l=[],u=0;for(;s<r/2;){let c=t[a-1],p=t[a],f=t[a+1];if(!f)return!1;let y=c.angleTo(p)-p.angleTo(f);for(y=Math.abs((y+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:s,angleDelta:y}),u+=y;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=p.dist(f)}return!0}function Fp(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Mp(t,e,r){return t?3/5*e*r:0}function Dp(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Vp(t,e,r,n,i,o){let a=Mp(r,i,o),s=Dp(r,n)*o,l=0,u=Fp(t)/2;for(let c=0;c<t.length-1;c++){let p=t[c],f=t[c+1],y=p.dist(f);if(l+y>u){let m=(u-l)/y,d=Ne.number(p.x,f.x,m),h=Ne.number(p.y,f.y,m),g=new Ye(d,h,f.angleTo(p),c);return g._round(),!a||ws(t,g,s,a,e)?g:void 0}l+=y}}function Bp(t,e,r,n,i,o,a,s,l){let u=Mp(n,o,a),c=Dp(n,i),p=c*a,f=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-p<e/4&&(e=p+e/4);let y=o*2,m=f?e/2*s%e:(c/2+y)*a*s%e;return zp(t,m,e,u,r,p,f,!1,l)}function zp(t,e,r,n,i,o,a,s,l){let u=o/2,c=Fp(t),p=0,f=e-r,y=[];for(let m=0;m<t.length-1;m++){let d=t[m],h=t[m+1],g=d.dist(h),v=h.angleTo(d);for(;f+r<p+g;){f+=r;let b=(f-p)/g,x=Ne.number(d.x,h.x,b),P=Ne.number(d.y,h.y,b);if(x>=0&&x<l&&P>=0&&P<l&&f-u>=0&&f+u<=c){let w=new Ye(x,P,v,m);w._round(),(!n||ws(t,w,o,n,i))&&y.push(w)}}p+=g}return!s&&!y.length&&!a&&(y=zp(t,p/2,r,n,i,o,a,!0,l)),y}var ft=J(ge());function Rp(t,e,r,n,i){let o=[];for(let a=0;a<t.length;a++){let s=t[a],l;for(let u=0;u<s.length-1;u++){let c=s[u],p=s[u+1];c.x<e&&p.x<e||(c.x<e?c=new ft.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new ft.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round()),!(c.y<r&&p.y<r)&&(c.y<r?c=new ft.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new ft.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round()),!(c.x>=n&&p.x>=n)&&(c.x>=n?c=new ft.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new ft.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round()),!(c.y>=i&&p.y>=i)&&(c.y>=i?c=new ft.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new ft.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}var Pe=J(ge());var zr=xe;function _s(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*zr,l=o.paddedRect.h-2*zr,u=t.right-t.left,c=t.bottom-t.top,p=o.stretchX||[[0,s]],f=o.stretchY||[[0,l]],y=(A,F)=>A+F[1]-F[0],m=p.reduce(y,0),d=f.reduce(y,0),h=s-m,g=l-d,v=0,b=m,x=0,P=d,w=0,_=h,T=0,I=g;if(o.content&&n){let A=o.content;v=xo(p,0,A[0]),x=xo(f,0,A[1]),b=xo(p,A[0],A[2]),P=xo(f,A[1],A[3]),w=A[0]-v,T=A[1]-x,_=A[2]-A[0]-b,I=A[3]-A[1]-P}let E=(A,F,L,C)=>{let B=bo(A.stretch-v,b,u,t.left),O=vo(A.fixed-w,_,A.stretch,m),N=bo(F.stretch-x,P,c,t.top),K=vo(F.fixed-T,I,F.stretch,d),Y=bo(L.stretch-v,b,u,t.left),Q=vo(L.fixed-w,_,L.stretch,m),me=bo(C.stretch-x,P,c,t.top),Te=vo(C.fixed-T,I,C.stretch,d),te=new Pe.default(B,N),Se=new Pe.default(Y,N),Je=new Pe.default(Y,me),Nn=new Pe.default(B,me),Mo=new Pe.default(O/a,K/a),Do=new Pe.default(Q/a,Te/a),$r=e*Math.PI/180;if($r){let be=Math.sin($r),Xe=Math.cos($r),Qe=[Xe,-be,be,Xe];te._matMult(Qe),Se._matMult(Qe),Nn._matMult(Qe),Je._matMult(Qe)}let Un=A.stretch+A.fixed,Vo=L.stretch+L.fixed,$n=F.stretch+F.fixed,De=C.stretch+C.fixed,Kt={x:o.paddedRect.x+zr+Un,y:o.paddedRect.y+zr+$n,w:Vo-Un,h:De-$n},Gn=_/a/u,we=I/a/c;return{tl:te,tr:Se,bl:Nn,br:Je,tex:Kt,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Mo,pixelOffsetBR:Do,minFontScaleX:Gn,minFontScaleY:we,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(E({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let A=Op(p,h,m),F=Op(f,g,d);for(let L=0;L<A.length-1;L++){let C=A[L],B=A[L+1];for(let O=0;O<F.length-1;O++){let N=F[O],K=F[O+1];i.push(E(C,N,B,K))}}}return i}function xo(t,e,r){let n=0;for(let i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function Op(t,e,r){let n=[{fixed:-zr,stretch:0}];for(let[i,o]of t){let a=n[n.length-1];n.push({fixed:i-a.stretch,stretch:a.stretch}),n.push({fixed:i-a.stretch,stretch:a.stretch+(o-i)})}return n.push({fixed:e+zr,stretch:r}),n}function bo(t,e,r,n){return t/e*r+n}function vo(t,e,r,n){return t-e*r/n}function Np(t,e,r,n,i,o,a,s){let l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(let c of e.positionedLines)for(let p of c.positionedGlyphs){if(!p.rect)continue;let f=p.rect||{},m=lo+1,d=!0,h=1,g=0,v=(i||s)&&p.vertical,b=p.metrics.advance*p.scale/2;if(s&&e.verticalizable){let Y=(p.scale-1)*ue,Q=(ue-p.metrics.width*p.scale)/2;g=c.lineOffset/2-(p.imageName?-Q:Y)}if(p.imageName){let Y=a[p.imageName];d=Y.sdf,h=Y.pixelRatio,m=xe/h}let x=i?[p.x+b,p.y]:[0,0],P=i?[0,0]:[p.x+b+r[0],p.y+r[1]-g],w=[0,0];v&&(w=P,P=[0,0]);let _=(p.metrics.left-m)*p.scale-b+P[0],T=(-p.metrics.top-m)*p.scale+P[1],I=_+f.w*p.scale/h,E=T+f.h*p.scale/h,A=new Pe.default(_,T),F=new Pe.default(I,T),L=new Pe.default(_,E),C=new Pe.default(I,E);if(v){let Y=new Pe.default(-b,b-Mr),Q=-Math.PI/2,me=ue/2-b,Te=p.imageName?me:0,te=new Pe.default(5-Mr-me,-Te),Se=new Pe.default(...w);A._rotateAround(Q,Y)._add(te)._add(Se),F._rotateAround(Q,Y)._add(te)._add(Se),L._rotateAround(Q,Y)._add(te)._add(Se),C._rotateAround(Q,Y)._add(te)._add(Se)}if(l){let Y=Math.sin(l),Q=Math.cos(l),me=[Q,-Y,Y,Q];A._matMult(me),F._matMult(me),L._matMult(me),C._matMult(me)}let B=new Pe.default(0,0),O=new Pe.default(0,0),N=0,K=0;u.push({tl:A,tr:F,bl:L,br:C,tex:f,writingMode:e.writingMode,glyphOffset:x,sectionIndex:p.sectionIndex,isSDF:d,pixelOffsetTL:B,pixelOffsetBR:O,minFontScaleX:N,minFontScaleY:K})}return u}var En=J(ge()),Rr=class{constructor(e,r,n,i,o,a,s,l,u,c){if(this.boxStartIndex=e.length,u){let p=a.top,f=a.bottom,y=a.collisionPadding;y&&(p-=y[1],f+=y[3]);let m=f-p;m>0&&(m=Math.max(10,m),this.circleDiameter=m)}else{let p=a.top*s-l[0],f=a.bottom*s+l[2],y=a.left*s-l[3],m=a.right*s+l[1],d=a.collisionPadding;if(d&&(y-=d[0]*s,p-=d[1]*s,m+=d[2]*s,f+=d[3]*s),c){let h=new En.default(y,p),g=new En.default(m,p),v=new En.default(y,f),b=new En.default(m,f),x=c*Math.PI/180;h._rotate(x),g._rotate(x),v._rotate(x),b._rotate(x),y=Math.min(h.x,g.x,v.x,b.x),m=Math.max(h.x,g.x,v.x,b.x),p=Math.min(h.y,g.y,v.y,b.y),f=Math.max(h.y,g.y,v.y,b.y)}e.emplaceBack(r.x,r.y,y,p,m,f,n,i,o)}this.boxEndIndex=e.length}};var Po=class{constructor(e=[],r=cx){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=r[a],l=a+1;if(l<this.length&&n(r[l],s)<0&&(a=l,s=r[l]),n(s,o)>=0)break;r[e]=s,e=a}r[e]=o}};function cx(t,e){return t<e?-1:t>e?1:0}var As=J(ge());function Up(t,e=1,r=!1){let n=1/0,i=1/0,o=-1/0,a=-1/0,s=t[0];for(let d=0;d<s.length;d++){let h=s[d];(!d||h.x<n)&&(n=h.x),(!d||h.y<i)&&(i=h.y),(!d||h.x>o)&&(o=h.x),(!d||h.y>a)&&(a=h.y)}let l=o-n,u=a-i,c=Math.min(l,u),p=c/2,f=new Po([],px);if(c===0)return new As.default(n,i);for(let d=n;d<o;d+=c)for(let h=i;h<a;h+=c)f.push(new Or(d+p,h+p,p,t));let y=yx(t),m=f.length;for(;f.length;){let d=f.pop();(d.d>y.d||!y.d)&&(y=d,r&&console.log("found best %d after %d probes",Math.round(1e4*d.d)/1e4,m)),!(d.max-y.d<=e)&&(p=d.h/2,f.push(new Or(d.p.x-p,d.p.y-p,p,t)),f.push(new Or(d.p.x+p,d.p.y-p,p,t)),f.push(new Or(d.p.x-p,d.p.y+p,p,t)),f.push(new Or(d.p.x+p,d.p.y+p,p,t)),m+=4)}return r&&(console.log(`num probes: ${m}`),console.log(`best distance: ${y.d}`)),y.p}function px(t,e){return e.max-t.max}function Or(t,e,r,n){this.p=new As.default(t,e),this.h=r,this.d=fx(this.p,n),this.max=this.d+this.h*Math.SQRT2}function fx(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){let o=e[i];for(let a=0,s=o.length,l=s-1;a<s;l=a++){let u=o[a],c=o[l];u.y>t.y!=c.y>t.y&&t.x<(c.x-u.x)*(t.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,qa(t,u,c))}}return(r?1:-1)*Math.sqrt(n)}function yx(t){let e=0,r=0,n=0,i=t[0];for(let o=0,a=i.length,s=a-1;o<a;s=o++){let l=i[o],u=i[s],c=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*c,n+=(l.y+u.y)*c,e+=c*3}return new Or(r/e,n/e,0,t)}var Cs=J(Ba());var Nr=7,Is=Number.POSITIVE_INFINITY;function mx(t,e){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.sqrt(2);switch(i){case"top-right":case"top-left":s=l-Nr;break;case"bottom-right":case"bottom-left":s=-l+Nr;break;case"bottom":s=-o+Nr;break;case"top":s=o-Nr;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}function n(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-Nr;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+Nr;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return e[1]!==Is?n(t,e[0],e[1]):r(t,e[0])}function $p(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=W/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0].layout,n=t.bucket.layers[0]._unevaluatedLayout._values,i={layoutIconSize:n["icon-size"].possiblyEvaluate(new j(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new j(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new j(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:u,maxZoom:c}=t.bucket.textSizeData;i.compositeTextSizes=[n["text-size"].possiblyEvaluate(new j(u),t.canonical),n["text-size"].possiblyEvaluate(new j(c),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:u,maxZoom:c}=t.bucket.iconSizeData;i.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new j(u),t.canonical),n["icon-size"].possiblyEvaluate(new j(c),t.canonical)]}let o=r.get("text-line-height")*ue,a=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",s=r.get("text-keep-upright"),l=r.get("text-size");for(let u of t.bucket.features){let c=r.get("text-font").evaluate(u,{},t.canonical).join(","),p=l.evaluate(u,{},t.canonical),f=i.layoutTextSize.evaluate(u,{},t.canonical),y=i.layoutIconSize.evaluate(u,{},t.canonical),m={horizontal:{},vertical:void 0},d=u.text,h=[0,0];if(d){let x=d.toString(),P=r.get("text-letter-spacing").evaluate(u,{},t.canonical)*ue,w=Su(x)?P:0,_=r.get("text-anchor").evaluate(u,{},t.canonical),T=r.get("text-variable-anchor");if(!T){let L=r.get("text-radial-offset").evaluate(u,{},t.canonical);L?h=mx(_,[L*ue,Is]):h=r.get("text-offset").evaluate(u,{},t.canonical).map(C=>C*ue)}let I=a?"center":r.get("text-justify").evaluate(u,{},t.canonical),E=r.get("symbol-placement"),A=E==="point"?r.get("text-max-width").evaluate(u,{},t.canonical)*ue:0,F=()=>{t.bucket.allowVerticalPlacement&&pn(x)&&(m.vertical=In(d,t.glyphMap,t.glyphPositions,t.imagePositions,c,A,o,_,"left",w,h,de.vertical,!0,E,f,p))};if(!a&&T){let L=I==="auto"?T.map(B=>Gp(B)):[I],C=!1;for(let B=0;B<L.length;B++){let O=L[B];if(!m.horizontal[O])if(C)m.horizontal[O]=m.horizontal[0];else{let N=In(d,t.glyphMap,t.glyphPositions,t.imagePositions,c,A,o,"center",O,w,h,de.horizontal,!1,E,f,p);N&&(m.horizontal[O]=N,C=N.positionedLines.length===1)}}F()}else{I==="auto"&&(I=Gp(_));let L=In(d,t.glyphMap,t.glyphPositions,t.imagePositions,c,A,o,_,I,w,h,de.horizontal,!1,E,f,p);L&&(m.horizontal[I]=L),F(),pn(x)&&a&&s&&(m.vertical=In(d,t.glyphMap,t.glyphPositions,t.imagePositions,c,A,o,_,I,w,h,de.vertical,!1,E,f,p))}}let g,v=!1;if(u.icon&&u.icon.name){let x=t.imageMap[u.icon.name];x&&(g=hp(t.imagePositions[u.icon.name],r.get("icon-offset").evaluate(u,{},t.canonical),r.get("icon-anchor").evaluate(u,{},t.canonical)),v=!!x.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=v:t.bucket.sdfIcons!==v&&ce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(x.pixelRatio!==t.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let b=qp(m.horizontal)||m.vertical;t.bucket.iconsInText=b?b.iconsInText:!1,(b||g)&&hx(t.bucket,u,m,g,t.imageMap,i,f,y,h,v,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function Gp(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function hx(t,e,r,n,i,o,a,s,l,u,c){let p=o.textMaxSize.evaluate(e,{});p===void 0&&(p=a);let f=t.layers[0].layout,y=f.get("icon-offset").evaluate(e,{},c),m=qp(r.horizontal),d=24,h=a/d,g=t.tilePixelRatio*h,v=t.tilePixelRatio*p/d,b=t.tilePixelRatio*s,x=t.tilePixelRatio*f.get("symbol-spacing"),P=f.get("text-padding")*t.tilePixelRatio,w=Pp(f,e,c,t.tilePixelRatio),_=f.get("text-max-angle")/180*Math.PI,T=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",I=f.get("icon-rotation-alignment")==="map"&&f.get("symbol-placement")!=="point",E=f.get("symbol-placement"),A=x/2,F=f.get("icon-text-fit"),L;n&&F!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(L=hs(n,r.vertical,F,f.get("icon-text-fit-padding"),y,h)),m&&(n=hs(n,m,F,f.get("icon-text-fit-padding"),y,h)));let C=(B,O)=>{O.x<0||O.x>=W||O.y<0||O.y>=W||dx(t,O,B,r,n,i,L,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[P,P,P,P],T,l,b,w,I,y,e,o,u,c,a)};if(E==="line")for(let B of Rp(e.geometry,0,0,W,W)){let O=Bp(B,x,_,r.vertical||m,n,d,v,t.overscaling,W);for(let N of O){let K=m;(!K||!gx(t,K.text,A,N))&&C(B,N)}}else if(E==="line-center"){for(let B of e.geometry)if(B.length>1){let O=Vp(B,_,r.vertical||m,n,d,v);O&&C(B,O)}}else if(e.type==="Polygon")for(let B of wr(e.geometry,0)){let O=Up(B,16);C(B[0],new Ye(O.x,O.y,0))}else if(e.type==="LineString")for(let B of e.geometry)C(B,new Ye(B[0].x,B[0].y,0));else if(e.type==="Point")for(let B of e.geometry)for(let O of B)C([O],new Ye(O.x,O.y,0))}function jp(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let d=Np(e,r,s,i,o,a,n,t.allowVerticalPlacement),h=t.textSizeData,g=null;h.kind==="source"?(g=[kt*i.layout.get("text-size").evaluate(a,{})],g[0]>tt&&ce(`${t.layerIds[0]}: Value for "text-size" is >= ${Vr}. Reduce your "text-size".`)):h.kind==="composite"&&(g=[kt*y.compositeTextSizes[0].evaluate(a,{},m),kt*y.compositeTextSizes[1].evaluate(a,{},m)],(g[0]>tt||g[1]>tt)&&ce(`${t.layerIds[0]}: Value for "text-size" is >= ${Vr}. Reduce your "text-size".`)),t.addSymbols(t.text,d,g,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let v of c)p[v]=t.text.placedSymbolArray.length-1;return d.length*4}function qp(t){for(let e in t)return t[e];return null}function dx(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g,v,b,x,P,w,_,T){let I=t.addToLineVertexArray(e,r),E,A,F,L,C=0,B=0,O=0,N=0,K=-1,Y=-1,Q={},me=(0,Cs.default)(""),Te=0,te=0;if(s._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Te,te]=s.layout.get("text-offset").evaluate(x,{},_).map(we=>we*ue):(Te=s.layout.get("text-radial-offset").evaluate(x,{},_)*ue,te=Is),t.allowVerticalPlacement&&n.vertical){let be=s.layout.get("text-rotate").evaluate(x,{},_)+90,Xe=n.vertical;F=new Rr(l,e,u,c,p,Xe,f,y,m,be),a&&(L=new Rr(l,e,u,c,p,a,h,g,m,be))}if(i){let we=s.layout.get("icon-rotate").evaluate(x,{}),be=s.layout.get("icon-text-fit")!=="none",Xe=_s(i,we,w,be),Qe=a?_s(a,we,w,be):void 0;A=new Rr(l,e,u,c,p,i,h,g,!1,we),C=Xe.length*4;let il=t.iconSizeData,Lt=null;il.kind==="source"?(Lt=[kt*s.layout.get("icon-size").evaluate(x,{})],Lt[0]>tt&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Vr}. Reduce your "icon-size".`)):il.kind==="composite"&&(Lt=[kt*P.compositeIconSizes[0].evaluate(x,{},_),kt*P.compositeIconSizes[1].evaluate(x,{},_)],(Lt[0]>tt||Lt[1]>tt)&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Vr}. Reduce your "icon-size".`)),t.addSymbols(t.icon,Xe,Lt,b,v,x,de.none,e,I.lineStartIndex,I.lineLength,-1,_),K=t.icon.placedSymbolArray.length-1,Qe&&(B=Qe.length*4,t.addSymbols(t.icon,Qe,Lt,b,v,x,de.vertical,e,I.lineStartIndex,I.lineLength,-1,_),Y=t.icon.placedSymbolArray.length-1)}let Se=Object.keys(n.horizontal);for(let we of Se){let be=n.horizontal[we];if(!E){me=(0,Cs.default)(be.text);let Qe=s.layout.get("text-rotate").evaluate(x,{},_);E=new Rr(l,e,u,c,p,be,f,y,m,Qe)}let Xe=be.positionedLines.length===1;if(O+=jp(t,e,be,o,s,m,x,d,I,n.vertical?de.horizontal:de.horizontalOnly,Xe?Se:[we],Q,K,P,_),Xe)break}n.vertical&&(N+=jp(t,e,n.vertical,o,s,m,x,d,I,de.vertical,["vertical"],Q,Y,P,_));let Je=E?E.boxStartIndex:t.collisionBoxArray.length,Nn=E?E.boxEndIndex:t.collisionBoxArray.length,Mo=F?F.boxStartIndex:t.collisionBoxArray.length,Do=F?F.boxEndIndex:t.collisionBoxArray.length,$r=A?A.boxStartIndex:t.collisionBoxArray.length,Un=A?A.boxEndIndex:t.collisionBoxArray.length,Vo=L?L.boxStartIndex:t.collisionBoxArray.length,$n=L?L.boxEndIndex:t.collisionBoxArray.length,De=-1,Kt=(we,be)=>we&&we.circleDiameter?Math.max(we.circleDiameter,be):be;De=Kt(E,De),De=Kt(F,De),De=Kt(A,De),De=Kt(L,De);let Gn=De>-1?1:0;Gn&&(De*=T/ue),t.glyphOffsetArray.length>=rt.MAX_GLYPHS&&ce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),x.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,Q.right>=0?Q.right:-1,Q.center>=0?Q.center:-1,Q.left>=0?Q.left:-1,Q.vertical||-1,K,Y,me,Je,Nn,Mo,Do,$r,Un,Vo,$n,u,O,N,C,B,Gn,0,f,Te,te,De)}function gx(t,e,r,n){let i=t.compareText;if(!(e in i))i[e]=[];else{let o=i[e];for(let a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}return i[e].push(n),!1}var So=1,wo=class{constructor(e){let r={},n=[];for(let s in e){let l=e[s],u=r[s]={};for(let c in l){let p=l[+c];if(!p||p.bitmap.width===0||p.bitmap.height===0)continue;let f={x:0,y:0,w:p.bitmap.width+2*So,h:p.bitmap.height+2*So};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=Cn(n),a=new Ct({width:i||1,height:o||1});for(let s in e){let l=e[s];for(let u in l){let c=l[+u];if(!c||c.bitmap.width===0||c.bitmap.height===0)continue;let p=r[s][u].rect;Ct.copy(c.bitmap,a,{x:0,y:0},{x:p.x+So,y:p.y+So},c.bitmap)}}this.image=a,this.positions=r}};k("GlyphAtlas",wo);function Zp(t,e,r){e=Math.pow(2,r)-e-1;var n=Jp(t*256,e*256,r),i=Jp((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function Jp(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=t*n-2*Math.PI*6378137/2,o=e*n-2*Math.PI*6378137/2;return[i,o]}var Kp=J(ge());var ks=63710088e-1,yt=class{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new yt(fl(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,n=this.lat*r,i=e.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-this.lng)*r);return ks*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof yt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new yt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new yt(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var Wp=2*Math.PI*ks;function Hp(t){return Wp*Math.cos(t*Math.PI/180)}function xx(t){return(180+t)/360}function bx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function vx(t,e){return t/Hp(e)}function Px(t){return t*360-180}function Ts(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Sx(t,e){return t*Hp(Ts(e))}function wx(t){return 1/Math.cos(t*Math.PI/180)}var Ln=class{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=yt.convert(e);return new Ln(xx(n.lng),bx(n.lat),vx(r,n.lat))}toLngLat(){return new yt(Px(this.x),Ts(this.y))}toAltitude(){return Sx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Wp*wx(Ts(this.y))}};var Es=class{constructor(e,r,n){if(e<0||e>25||n<0||n>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=n,this.key=Fn(0,e,e,r,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,n){let i=Zp(this.x,this.y,this.z),o=_x(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){let r=Math.pow(2,this.z);return new Kp.default((e.x*r-this.x)*W,(e.y*r-this.y)*W)}toString(){return`${this.z}/${this.x}/${this.y}`}},Yp=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Fn(e,r.z,r.z,r.x,r.y)}},ke=class{constructor(e,r,n,i,o){if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Es(n,+i,+o),this.key=Fn(r,e,n,i,o)}clone(){return new ke(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new ke(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ke(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?Fn(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Fn(this.wrap*+r,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new ke(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new ke(r,this.wrap,r,n,i),new ke(r,this.wrap,r,n+1,i),new ke(r,this.wrap,r,n,i+1),new ke(r,this.wrap,r,n+1,i+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new ke(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new ke(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Yp(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Ln(e.x-this.wrap,e.y))}};function Fn(t,e,r,n,i){t*=2,t<0&&(t=t*-1-1);let o=1<<r;return(o*o*t+o*i+n).toString(36)+r.toString(36)+e.toString(36)}function _x(t,e,r){let n="",i;for(let o=t;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(r&i?2:0);return n}k("CanonicalTileID",Es);k("OverscaledTileID",ke,{omit:["posMatrix"]});var Ls=class{constructor(e){this.tileID=new ke(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(e,r,n,i,o){this.status="parsing",this.data=e,this.collisionBoxArray=new Oi;let a=new Tn(Object.keys(e.layers).sort()),s=new go(this.tileID,this.promoteId);s.bucketLayerIDs=[];let l={},u={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},c=r.familiesBySource[this.source];for(let x in c){let P=e.layers[x];if(!P)continue;P.version===1&&ce(`Vector tile source "${this.source}" layer "${x}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let w=a.encode(x),_=[];for(let T=0;T<P.length;T++){let I=P.feature(T),E=s.getId(I,x);_.push({feature:I,id:E,index:T,sourceLayerIndex:w})}for(let T of c[x]){let I=T[0];if(I.source!==this.source&&ce(`layer.source = ${I.source} does not equal this.source = ${this.source}`),I.minzoom&&this.zoom<Math.floor(I.minzoom)||I.maxzoom&&this.zoom>=I.maxzoom||I.visibility==="none")continue;Fs(T,this.zoom,n),(l[I.id]=I.createBucket({index:s.bucketLayerIDs.length,layers:T,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:w,sourceID:this.source})).populate(_,u,this.tileID.canonical),s.bucketLayerIDs.push(T.map(A=>A.id))}}let p,f,y,m,d=Gr(u.glyphDependencies,x=>Object.keys(x).map(Number));this.inFlightDependencies.forEach(x=>x==null?void 0:x.cancel()),this.inFlightDependencies=[];let h=++this.dependencySentinel;Object.keys(d).length?this.inFlightDependencies.push(i.send("getGlyphs",{uid:this.uid,stacks:d,source:this.source,tileID:this.tileID,type:"glyphs"},(x,P)=>{h===this.dependencySentinel&&(p||(p=x,f=P,b.call(this)))})):f={};let g=Object.keys(u.iconDependencies);g.length?this.inFlightDependencies.push(i.send("getImages",{icons:g,source:this.source,tileID:this.tileID,type:"icons"},(x,P)=>{h===this.dependencySentinel&&(p||(p=x,y=P,b.call(this)))})):y={};let v=Object.keys(u.patternDependencies);v.length?this.inFlightDependencies.push(i.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},(x,P)=>{h===this.dependencySentinel&&(p||(p=x,m=P,b.call(this)))})):m={},b.call(this);function b(){if(p)return o(p);if(f&&y&&m){let x=new wo(f),P=new uo(y,m);for(let w in l){let _=l[w];_ instanceof rt?(Fs(_.layers,this.zoom,n),$p({bucket:_,glyphMap:f,glyphPositions:x.positions,imageMap:y,imagePositions:P.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):_.hasPattern&&(_ instanceof Tr||_ instanceof Cr||_ instanceof kr)&&(Fs(_.layers,this.zoom,n),_.addFeatures(u,this.tileID.canonical,P.patternPositions))}this.status="done",o(null,{buckets:Object.values(l).filter(w=>!w.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:x.image,imageAtlas:P,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?y:null,glyphPositions:this.returnDependencies?x.positions:null})}}}};function Fs(t,e,r){let n=new j(e);for(let i of t)i.recalculate(n,r)}var Xp;(function(n){n.create="create",n.load="load",n.fullLoad="fullLoad"})(Xp||(Xp={}));var Ax=60,gA=1e3/Ax;var Mn=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return e.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}};function Cx(t,e){let r=ia(t.request,(n,i,o,a)=>{n?e(n):i&&e(null,{vectorTile:new Qp.default.VectorTile(new ef.default(i)),rawData:i,cacheControl:o,expires:a})});return()=>{r.cancel(),e()}}var Dn=class{constructor(e,r,n,i){this.actor=e,this.layerIndex=r,this.availableImages=n,this.loadVectorData=i||Cx,this.loading={},this.loaded={}}loadTile(e,r){let n=e.uid;this.loading||(this.loading={});let i=e&&e.request&&e.request.collectResourceTiming?new Mn(e.request):!1,o=this.loading[n]=new Ls(e);o.abort=this.loadVectorData(e,(a,s)=>{if(delete this.loading[n],a||!s)return o.status="done",this.loaded[n]=o,r(a);let l=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl);let c={};if(i){let p=i.finish();p&&(c.resourceTiming=JSON.parse(JSON.stringify(p)))}o.vectorTile=s.vectorTile,o.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,(p,f)=>{if(p||!f)return r(p);r(null,Ae({rawTileData:l.slice(0)},f,u,c))}),this.loaded=this.loaded||{},this.loaded[n]=o})}reloadTile(e,r){let n=this.loaded,i=e.uid,o=this;if(n&&n[i]){let a=n[i];a.showCollisionBoxes=e.showCollisionBoxes,a.status==="parsing"?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,r):a.status==="done"&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,r):r())}}abortTile(e,r){let n=this.loading,i=e.uid;n&&n[i]&&n[i].abort&&(n[i].abort(),delete n[i]),r()}removeTile(e,r){let n=this.loaded,i=e.uid;n&&n[i]&&delete n[i],r()}};var _o=class{constructor(e,r,n){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium"){ce(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);return}this.stride=r.height;let i=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=n||"mapbox";for(let o=0;o<i;o++)this.data[this._idx(-1,o)]=this.data[this._idx(0,o)],this.data[this._idx(i,o)]=this.data[this._idx(i-1,o)],this.data[this._idx(o,-1)]=this.data[this._idx(o,0)],this.data[this._idx(o,i)]=this.data[this._idx(o,i-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(i,-1)]=this.data[this._idx(i-1,0)],this.data[this._idx(-1,i)]=this.data[this._idx(0,i-1)],this.data[this._idx(i,i)]=this.data[this._idx(i-1,i-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let o=0;o<i;o++)for(let a=0;a<i;a++){let s=this.get(o,a);s>this.max&&(this.max=s),s<this.min&&(this.min=s)}}get(e,r){let n=new Uint8Array(this.data.buffer),i=this._idx(e,r)*4;return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(n[i],n[i+1],n[i+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,n){return(e*256*256+r*256+n)/10-1e4}_unpackTerrarium(e,r,n){return e*256+r+n/256-32768}getPixels(){return new he({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=r*this.dim,o=r*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(r){case-1:i=o-1;break;case 1:o=i+1;break}switch(n){case-1:a=s-1;break;case 1:s=a+1;break}let l=-r*this.dim,u=-n*this.dim;for(let c=a;c<s;c++)for(let p=i;p<o;p++)this.data[this._idx(p,c)]=e.data[this._idx(p+l,c+u)]}};k("DEMData",_o);var Ms=class{constructor(){this.loaded={}}loadTile(e,r){let{uid:n,encoding:i,rawImageData:o}=e,a=jr(o)?this.getImageData(o):o,s=new _o(n,a,i);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)}getImageData(e){(!this.offscreenCanvas||!this.offscreenCanvasContext)&&(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);let r=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new he({width:r.width,height:r.height},r.data)}removeTile(e){let r=this.loaded,n=e.uid;r&&r[n]&&delete r[n]}};var Tf=J(of());var Ds=J(ge()),af=J(It());var Ix=af.default.VectorTileFeature.prototype.toGeoJSON,sf=class{constructor(e){this._feature=e,this.extent=W,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(this._feature.type===1){let e=[];for(let r of this._feature.geometry)e.push([new Ds.default(r[0],r[1])]);return e}else{let e=[];for(let r of this._feature.geometry){let n=[];for(let i of r)n.push(new Ds.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return Ix.call(this,e,r,n)}},Vs=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=W,this.length=e.length,this._features=e}feature(e){return new sf(this._features[e])}};var Ef=J(yf());var mf=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Rs=1,Bn=8,Ur=class{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,n]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==Rs)throw new Error(`Got v${i} data when expected v${Rs}.`);let o=mf[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new Ur(s,a,o,e)}constructor(e,r=64,n=Float64Array,i){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=mf.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,Bn,e),this.coords=new this.ArrayType(this.data,Bn+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(Bn+a+s+l),this.ids=new this.IndexArrayType(this.data,Bn,e),this.coords=new this.ArrayType(this.data,Bn+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Rs<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Os(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,f=l.pop()||0;if(p-f<=s){for(let h=f;h<=p;h++){let g=a[2*h],v=a[2*h+1];g>=e&&g<=n&&v>=r&&v<=i&&u.push(o[h])}continue}let y=f+p>>1,m=a[2*y],d=a[2*y+1];m>=e&&m<=n&&d>=r&&d<=i&&u.push(o[y]),(c===0?e<=m:r<=d)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=d)&&(l.push(y+1),l.push(p),l.push(1-c))}return u}within(e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],l=[],u=n*n;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,f=s.pop()||0;if(p-f<=a){for(let h=f;h<=p;h++)df(o[2*h],o[2*h+1],e,r)<=u&&l.push(i[h]);continue}let y=f+p>>1,m=o[2*y],d=o[2*y+1];df(m,d,e,r)<=u&&l.push(i[y]),(c===0?e-n<=m:r-n<=d)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?e+n>=m:r+n>=d)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function Os(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;hf(t,e,a,n,i,o),Os(t,e,r,n,a-1,1-o),Os(t,e,r,a+1,i,1-o)}function hf(t,e,r,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=r-n+1,p=Math.log(u),f=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*f*(u-f)/u)*(c-u/2<0?-1:1),m=Math.max(n,Math.floor(r-c*f/u+y)),d=Math.min(i,Math.floor(r+(u-c)*f/u+y));hf(t,e,r,m,d,o)}let a=e[2*r+o],s=n,l=i;for(zn(t,e,n,r),e[2*i+o]>a&&zn(t,e,n,i);s<l;){for(zn(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?zn(t,e,n,l):(l++,zn(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function zn(t,e,r,n){Ns(t,r,n),Ns(e,2*r,2*n),Ns(e,2*r+1,2*n+1)}function Ns(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function df(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var Rx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},gf=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),Ht=2,Tt=3,Us=4,Et=5,xf=6,Io=class{constructor(e){this.options=Object.assign(Object.create(Rx),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o=`prepare ${e.length} points`;r&&console.time(o),this.points=e;let a=[];for(let l=0;l<e.length;l++){let u=e[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=gf(ko(c)),y=gf(To(p));a.push(f,y,1/0,l,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this._createTree(a);r&&console.timeEnd(o);for(let l=i;l>=n;l--){let u=+Date.now();s=this.trees[l]=this._createTree(this._cluster(s,l)),r&&console.log("z%d: %d clusters in %dms",l,s.numItems,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(e,r){let n=((e[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,e[1])),o=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,o=180;else if(n>o){let p=this.getClusters([n,i,180,a],r),f=this.getClusters([-180,i,o,a],r);return p.concat(f)}let s=this.trees[this._limitZoom(r)],l=s.range(ko(n),To(a),ko(o),To(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+Et]>1?bf(u,f,this.clusterProps):this.points[u[f+Tt]])}return c}getChildren(e){let r=this._getOriginId(e),n=this._getOriginZoom(e),i="No cluster with the specified id.",o=this.trees[n];if(!o)throw new Error(i);let a=o.data;if(r*this.stride>=a.length)throw new Error(i);let s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=a[r*this.stride],u=a[r*this.stride+1],c=o.within(l,u,s),p=[];for(let f of c){let y=f*this.stride;a[y+Us]===e&&p.push(a[y+Et]>1?bf(a,y,this.clusterProps):this.points[a[y+Tt]])}if(p.length===0)throw new Error(i);return p}getLeaves(e,r,n){r=r||10,n=n||0;let i=[];return this._appendLeaves(i,e,r,n,0),i}getTile(e,r,n){let i=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:a,radius:s}=this.options,l=s/a,u=(n-l)/o,c=(n+1+l)/o,p={features:[]};return this._addTileFeatures(i.range((r-l)/o,u,(r+1+l)/o,c),i.data,r,n,o,p),r===0&&this._addTileFeatures(i.range(1-l/o,u,1,c),i.data,o,n,o,p),r===o-1&&this._addTileFeatures(i.range(0,u,l/o,c),i.data,-1,n,o,p),p.features.length?p:null}getClusterExpansionZoom(e){let r=this._getOriginZoom(e)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(e);if(r++,n.length!==1)break;e=n[0].properties.cluster_id}return r}_appendLeaves(e,r,n,i,o){let a=this.getChildren(r);for(let s of a){let l=s.properties;if(l&&l.cluster?o+l.point_count<=i?o+=l.point_count:o=this._appendLeaves(e,l.cluster_id,n,i,o):o<i?o++:e.push(s),e.length===n)break}return o}_createTree(e){let r=new Ur(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)r.add(e[n],e[n+1]);return r.finish(),r.data=e,r}_addTileFeatures(e,r,n,i,o,a){for(let s of e){let l=s*this.stride,u=r[l+Et]>1,c,p,f;if(u)c=vf(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let d=this.points[r[l+Tt]];c=d.properties;let[h,g]=d.geometry.coordinates;p=ko(h),f=To(g)}let y={type:1,geometry:[[Math.round(this.options.extent*(p*o-n)),Math.round(this.options.extent*(f*o-i))]],tags:c},m;u||this.options.generateId?m=r[l+Tt]:m=this.points[r[l+Tt]].id,m!==void 0&&(y.id=m),a.features.push(y)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,r){let{radius:n,extent:i,reduce:o,minPoints:a}=this.options,s=n/(i*Math.pow(2,r)),l=e.data,u=[],c=this.stride;for(let p=0;p<l.length;p+=c){if(l[p+Ht]<=r)continue;l[p+Ht]=r;let f=l[p],y=l[p+1],m=e.within(l[p],l[p+1],s),d=l[p+Et],h=d;for(let g of m){let v=g*c;l[v+Ht]>r&&(h+=l[v+Et])}if(h>d&&h>=a){let g=f*d,v=y*d,b,x=-1,P=((p/c|0)<<5)+(r+1)+this.points.length;for(let w of m){let _=w*c;if(l[_+Ht]<=r)continue;l[_+Ht]=r;let T=l[_+Et];g+=l[_]*T,v+=l[_+1]*T,l[_+Us]=P,o&&(b||(b=this._map(l,p,!0),x=this.clusterProps.length,this.clusterProps.push(b)),o(b,this._map(l,_)))}l[p+Us]=P,u.push(g/h,v/h,1/0,P,-1,h),o&&u.push(x)}else{for(let g=0;g<c;g++)u.push(l[p+g]);if(h>1)for(let g of m){let v=g*c;if(!(l[v+Ht]<=r)){l[v+Ht]=r;for(let b=0;b<c;b++)u.push(l[v+b])}}}}return u}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,r,n){if(e[r+Et]>1){let a=this.clusterProps[e[r+xf]];return n?Object.assign({},a):a}let i=this.points[e[r+Tt]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function bf(t,e,r){return{type:"Feature",id:t[e+Tt],properties:vf(t,e,r),geometry:{type:"Point",coordinates:[Ox(t[e]),Nx(t[e+1])]}}}function vf(t,e,r){let n=t[e+Et],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,o=t[e+xf],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Tt],point_count:n,point_count_abbreviated:i})}function ko(t){return t/360+.5}function To(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Ox(t){return(t-.5)*360}function Nx(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Rn(t,e,r,n){for(var i=n,o=r-e>>1,a=r-e,s,l=t[e],u=t[e+1],c=t[r],p=t[r+1],f=e+3;f<r;f+=3){var y=Ux(t[f],t[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){var m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-e>3&&Rn(t,e,s,n),t[s+2]=i,r-s>3&&Rn(t,s,r,n))}function Ux(t,e,r,n,i,o){var a=i-r,s=o-n;if(a!==0||s!==0){var l=((t-r)*a+(e-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return a=t-r,s=e-n,a*a+s*s}function mt(t,e,r,n){var i={id:typeof t=="undefined"?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return $x(i),i}function $x(t){var e=t.geometry,r=t.type;if(r==="Point"||r==="MultiPoint"||r==="LineString")$s(t,e);else if(r==="Polygon"||r==="MultiLineString")for(var n=0;n<e.length;n++)$s(t,e[n]);else if(r==="MultiPolygon")for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)$s(t,e[n][i])}function $s(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Gs(t,e){var r=[];if(t.type==="FeatureCollection")for(var n=0;n<t.features.length;n++)Eo(r,t.features[n],e,n);else t.type==="Feature"?Eo(r,t,e):Eo(r,{geometry:t},e);return r}function Eo(t,e,r,n){if(!!e.geometry){var i=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),o==="Point")Pf(i,s);else if(o==="MultiPoint")for(var u=0;u<i.length;u++)Pf(i[u],s);else if(o==="LineString")js(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(u=0;u<i.length;u++)s=[],js(i[u],s,a,!1),t.push(mt(l,"LineString",s,e.properties));return}else qs(i,s,a,!1);else if(o==="Polygon")qs(i,s,a,!0);else if(o==="MultiPolygon")for(u=0;u<i.length;u++){var c=[];qs(i[u],c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(u=0;u<e.geometry.geometries.length;u++)Eo(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");t.push(mt(l,o,s,e.properties))}}function Pf(t,e){e.push(Sf(t[0])),e.push(wf(t[1])),e.push(0)}function js(t,e,r,n){for(var i,o,a=0,s=0;s<t.length;s++){var l=Sf(t[s][0]),u=wf(t[s][1]);e.push(l),e.push(u),e.push(0),s>0&&(n?a+=(i*u-l*o)/2:a+=Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=e.length-3;e[2]=1,Rn(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function qs(t,e,r,n){for(var i=0;i<t.length;i++){var o=[];js(t[i],o,r,n),e.push(o)}}function Sf(t){return t/360+.5}function wf(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Ze(t,e,r,n,i,o,a,s){if(r/=e,n/=e,o>=r&&a<n)return t;if(a<r||o>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],p=c.geometry,f=c.type,y=i===0?c.minX:c.minY,m=i===0?c.maxX:c.maxY;if(y>=r&&m<n){l.push(c);continue}else if(m<r||y>=n)continue;var d=[];if(f==="Point"||f==="MultiPoint")Gx(p,d,r,n,i);else if(f==="LineString")_f(p,d,r,n,i,!1,s.lineMetrics);else if(f==="MultiLineString")Zs(p,d,r,n,i,!1);else if(f==="Polygon")Zs(p,d,r,n,i,!0);else if(f==="MultiPolygon")for(var h=0;h<p.length;h++){var g=[];Zs(p[h],g,r,n,i,!0),g.length&&d.push(g)}if(d.length){if(s.lineMetrics&&f==="LineString"){for(h=0;h<d.length;h++)l.push(mt(c.id,f,d[h],c.tags));continue}(f==="LineString"||f==="MultiLineString")&&(d.length===1?(f="LineString",d=d[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=d.length===3?"Point":"MultiPoint"),l.push(mt(c.id,f,d,c.tags))}}return l.length?l:null}function Gx(t,e,r,n,i){for(var o=0;o<t.length;o+=3){var a=t[o+i];a>=r&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function _f(t,e,r,n,i,o,a){for(var s=Af(t),l=i===0?jx:qx,u=t.start,c,p,f=0;f<t.length-3;f+=3){var y=t[f],m=t[f+1],d=t[f+2],h=t[f+3],g=t[f+4],v=i===0?y:m,b=i===0?h:g,x=!1;a&&(c=Math.sqrt(Math.pow(y-h,2)+Math.pow(m-g,2))),v<r?b>r&&(p=l(s,y,m,h,g,r),a&&(s.start=u+c*p)):v>n?b<n&&(p=l(s,y,m,h,g,n),a&&(s.start=u+c*p)):Js(s,y,m,d),b<r&&v>=r&&(p=l(s,y,m,h,g,r),x=!0),b>n&&v<=n&&(p=l(s,y,m,h,g,n),x=!0),!o&&x&&(a&&(s.end=u+c*p),e.push(s),s=Af(t)),a&&(u+=c)}var P=t.length-3;y=t[P],m=t[P+1],d=t[P+2],v=i===0?y:m,v>=r&&v<=n&&Js(s,y,m,d),P=s.length-3,o&&P>=3&&(s[P]!==s[0]||s[P+1]!==s[1])&&Js(s,s[0],s[1],s[2]),s.length&&e.push(s)}function Af(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Zs(t,e,r,n,i,o){for(var a=0;a<t.length;a++)_f(t[a],e,r,n,i,o,!1)}function Js(t,e,r,n){t.push(e),t.push(r),t.push(n)}function jx(t,e,r,n,i,o){var a=(o-e)/(n-e);return t.push(o),t.push(r+(i-r)*a),t.push(1),a}function qx(t,e,r,n,i,o){var a=(o-r)/(i-r);return t.push(e+(n-e)*a),t.push(o),t.push(1),a}function Ws(t,e){var r=e.buffer/e.extent,n=t,i=Ze(t,1,-1-r,r,0,-1,2,e),o=Ze(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=Ze(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=Cf(i,1).concat(n)),o&&(n=n.concat(Cf(o,-1)))),n}function Cf(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Hs(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(var s=0;s<i.geometry.length;s++)a.push(Hs(i.geometry[s],e))}else if(o==="MultiPolygon")for(a=[],s=0;s<i.geometry.length;s++){for(var l=[],u=0;u<i.geometry[s].length;u++)l.push(Hs(i.geometry[s][u],e));a.push(l)}r.push(mt(i.id,o,a,i.tags))}return r}function Hs(t,e){var r=[];r.size=t.size,t.start!==void 0&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function Lo(t,e){if(t.transformed)return t;var r=1<<t.z,n=t.x,i=t.y,o,a,s;for(o=0;o<t.features.length;o++){var l=t.features[o],u=l.geometry,c=l.type;if(l.geometry=[],c===1)for(a=0;a<u.length;a+=2)l.geometry.push(If(u[a],u[a+1],e,r,n,i));else for(a=0;a<u.length;a++){var p=[];for(s=0;s<u[a].length;s+=2)p.push(If(u[a][s],u[a][s+1],e,r,n,i));l.geometry.push(p)}}return t.transformed=!0,t}function If(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function Ks(t,e,r,n,i){for(var o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,Zx(a,t[s],o,i);var l=t[s].minX,u=t[s].minY,c=t[s].maxX,p=t[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),p>a.maxY&&(a.maxY=p)}return a}function Zx(t,e,r,n){var i=e.geometry,o=e.type,a=[];if(o==="Point"||o==="MultiPoint")for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),t.numPoints++,t.numSimplified++;else if(o==="LineString")Ys(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(s=0;s<i.length;s++)Ys(a,i[s],t,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(var l=0;l<i.length;l++){var u=i[l];for(s=0;s<u.length;s++)Ys(a,u[s],t,r,!0,s===0)}if(a.length){var c=e.tags||null;if(o==="LineString"&&n.lineMetrics){c={};for(var p in e.tags)c[p]=e.tags[p];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var f={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:c};e.id!==null&&(f.id=e.id),t.features.push(f)}}function Ys(t,e,r,n,i,o){var a=n*n;if(n>0&&e.size<(i?a:n)){r.numPoints+=e.length/3;return}for(var s=[],l=0;l<e.length;l+=3)(n===0||e[l+2]>a)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;i&&Jx(s,o),t.push(s)}function Jx(t,e){for(var r=0,n=0,i=t.length,o=i-2;n<i;o=n,n+=2)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],s=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=s}}function Xs(t,e){return new Fo(t,e)}function Fo(t,e){e=this.options=Wx(Object.create(this.options),e);var r=e.debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=Gs(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=Ws(n,e),n.length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}Fo.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};Fo.prototype.splitTile=function(t,e,r,n,i,o,a){for(var s=[t,e,r,n],l=this.options,u=l.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var c=1<<e,p=Qs(e,r,n),f=this.tiles[p];if(!f&&(u>1&&console.time("creation"),f=this.tiles[p]=Ks(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var y="z"+e;this.stats[y]=(this.stats[y]||0)+1,this.total++}if(f.source=t,i){if(e===l.maxZoom||e===i)continue;var m=1<<i-e;if(r!==Math.floor(o/m)||n!==Math.floor(a/m))continue}else if(e===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue;if(f.source=null,t.length!==0){u>1&&console.time("clipping");var d=.5*l.buffer/l.extent,h=.5-d,g=.5+d,v=1+d,b,x,P,w,_,T;b=x=P=w=null,_=Ze(t,c,r-d,r+g,0,f.minX,f.maxX,l),T=Ze(t,c,r+h,r+v,0,f.minX,f.maxX,l),t=null,_&&(b=Ze(_,c,n-d,n+g,1,f.minY,f.maxY,l),x=Ze(_,c,n+h,n+v,1,f.minY,f.maxY,l),_=null),T&&(P=Ze(T,c,n-d,n+g,1,f.minY,f.maxY,l),w=Ze(T,c,n+h,n+v,1,f.minY,f.maxY,l),T=null),u>1&&console.timeEnd("clipping"),s.push(b||[],e+1,r*2,n*2),s.push(x||[],e+1,r*2,n*2+1),s.push(P||[],e+1,r*2+1,n*2),s.push(w||[],e+1,r*2+1,n*2+1)}}};Fo.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<<t;e=(e%a+a)%a;var s=Qs(t,e,r);if(this.tiles[s])return Lo(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l=t,u=e,c=r,p;!p&&l>0;)l--,u=Math.floor(u/2),c=Math.floor(c/2),p=this.tiles[Qs(l,u,c)];return!p||!p.source?null:(o>1&&console.log("found parent tile z%d-%d-%d",l,u,c),o>1&&console.time("drilling down"),this.splitTile(p.source,l,u,c,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?Lo(this.tiles[s],i):null)};function Qs(t,e,r){return((1<<t)*r+e)*32+t}function Wx(t,e){for(var r in e)t[r]=e[r];return t}function On(t,e){return e?t.properties[e]:t.id}function el(t,e){if(t==null)return!0;if(t.type==="Feature")return On(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=On(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function tl(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(On(t,e),t);else for(let n of t.features)r.set(On(n,e),n);return r}function kf(t,e,r){var n,i,o,a;if(e.removeAll&&t.clear(),e.remove)for(let s of e.remove)t.delete(s);if(e.add)for(let s of e.add){let l=On(s,r);l!=null&&t.set(l,s)}if(e.update)for(let s of e.update){let l=t.get(s.id);if(l==null)continue;let u=s.newGeometry||s.removeAllProperties,c=!s.removeAllProperties&&(((n=s.removeProperties)==null?void 0:n.length)>0||((i=s.addOrUpdateProperties)==null?void 0:i.length)>0);if((u||c)&&(l={...l},t.set(s.id,l),c&&(l.properties={...l.properties})),s.newGeometry&&(l.geometry=s.newGeometry),s.removeAllProperties)l.properties={};else if(((o=s.removeProperties)==null?void 0:o.length)>0)for(let p of s.removeProperties)Object.prototype.hasOwnProperty.call(l.properties,p)&&delete l.properties[p];if(((a=s.addOrUpdateProperties)==null?void 0:a.length)>0)for(let{key:p,value:f}of s.addOrUpdateProperties)l.properties[p]=f}}function Hx(t,e){let r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);let n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return e(null,null);let i=new Vs(n.features),o=(0,Ef.default)(i);(o.byteOffset!==0||o.byteLength!==o.buffer.byteLength)&&(o=new Uint8Array(o)),e(null,{vectorTile:i,rawData:o.buffer})}var rl=class extends Dn{constructor(e,r,n,i){super(e,r,n,Hx);this._dataUpdateable=new Map;this.loadGeoJSON=(e,r)=>{let{promoteId:n}=e;if(e.request)return du(e.request,(i,o,a,s)=>{this._dataUpdateable=el(o,n)?tl(o,n):void 0,r(i,o,a,s)});if(typeof e.data=="string")try{let i=JSON.parse(e.data);this._dataUpdateable=el(i,n)?tl(i,n):void 0,r(null,i)}catch(i){r(new Error(`Input data given to \'${e.source}\' is not a valid GeoJSON object.`))}else e.dataDiff?this._dataUpdateable?(kf(this._dataUpdateable,e.dataDiff,n),r(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):r(new Error(`Cannot update existing geojson data in ${e.source}`)):r(new Error(`Input data given to \'${e.source}\' is not a valid GeoJSON object.`));return{cancel:()=>{}}};i&&(this.loadGeoJSON=i)}loadData(e,r){var i;(i=this._pendingRequest)==null||i.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});let n=e&&e.request&&e.request.collectResourceTiming?new Mn(e.request):!1;this._pendingCallback=r,this._pendingRequest=this.loadGeoJSON(e,(o,a)=>{if(delete this._pendingCallback,delete this._pendingRequest,o||!a)return r(o);if(typeof a!="object")return r(new Error(`Input data given to \'${e.source}\' is not a valid GeoJSON object.`));{(0,Tf.default)(a,!0);try{if(e.filter){let l=Bt(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(l.result==="error")throw new Error(l.value.map(c=>`${c.key}: ${c.message}`).join(", "));let u=a.features.filter(c=>l.value.evaluate({zoom:0},c));a={type:"FeatureCollection",features:u}}this._geoJSONIndex=e.cluster?new Io(Kx(e)).load(a.features):Xs(a,e.geojsonVtOptions)}catch(l){return r(l)}this.loaded={};let s={};if(n){let l=n.finish();l&&(s.resourceTiming={},s.resourceTiming[e.source]=JSON.parse(JSON.stringify(l)))}r(null,s)}})}reloadTile(e,r){let n=this.loaded,i=e.uid;return n&&n[i]?super.reloadTile(e,r):this.loadTile(e,r)}removeSource(e,r){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),r()}getClusterExpansionZoom(e,r){try{r(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(n){r(n)}}getClusterChildren(e,r){try{r(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(n){r(n)}}getClusterLeaves(e,r){try{r(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(n){r(n)}}};function Kx({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;let r={},n={},i={accumulated:null,zoom:0},o={properties:null},a=Object.keys(e);for(let s of a){let[l,u]=e[s],c=Bt(u),p=Bt(typeof l=="string"?[l,["accumulated"],["get",s]]:l);r[s]=c.value,n[s]=p.value}return t.map=s=>{o.properties=s;let l={};for(let u of a)l[u]=r[u].evaluate(i,o);return l},t.reduce=(s,l)=>{o.properties=l;for(let u of a)i.accumulated=s[u],s[u]=n[u].evaluate(i,o)},t}var nl=class{constructor(e){this.self=e,this.actor=new aa(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Dn,geojson:rl},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(r,n)=>{if(this.workerSourceTypes[r])throw new Error(`Worker source with name "${r}" already registered.`);this.workerSourceTypes[r]=n},this.self.registerRTLTextPlugin=r=>{if(ie.isParsed())throw new Error("RTL text plugin already registered.");ie.applyArabicShaping=r.applyArabicShaping,ie.processBidirectionalText=r.processBidirectionalText,ie.processStyledBidirectionalText=r.processStyledBidirectionalText}}setReferrer(e,r){this.referrer=r}setImages(e,r,n){this.availableImages[e]=r;for(let i in this.workerSources[e]){let o=this.workerSources[e][i];for(let a in o)o[a].availableImages=r}n()}setLayers(e,r,n){this.getLayerIndex(e).replace(r),n()}updateLayers(e,r,n){this.getLayerIndex(e).update(r.layers,r.removedIds),n()}loadTile(e,r,n){this.getWorkerSource(e,r.type,r.source).loadTile(r,n)}loadDEMTile(e,r,n){this.getDEMWorkerSource(e,r.source).loadTile(r,n)}reloadTile(e,r,n){this.getWorkerSource(e,r.type,r.source).reloadTile(r,n)}abortTile(e,r,n){this.getWorkerSource(e,r.type,r.source).abortTile(r,n)}removeTile(e,r,n){this.getWorkerSource(e,r.type,r.source).removeTile(r,n)}removeDEMTile(e,r){this.getDEMWorkerSource(e,r.source).removeTile(r)}removeSource(e,r,n){if(!this.workerSources[e]||!this.workerSources[e][r.type]||!this.workerSources[e][r.type][r.source])return;let i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],i.removeSource!==void 0?i.removeSource(r,n):n()}loadWorkerSource(e,r,n){try{this.self.importScripts(r.url),n()}catch(i){n(i.toString())}}syncRTLPluginState(e,r,n){try{ie.setState(r);let i=ie.getPluginURL();if(ie.isLoaded()&&!ie.isParsed()&&i!=null){this.self.importScripts(i);let o=ie.isParsed(),a=o?void 0:new Error(`RTL Text Plugin failed to import scripts from ${i}`);n(a,o)}}catch(i){n(i.toString())}}getAvailableImages(e){let r=this.availableImages[e];return r||(r=[]),r}getLayerIndex(e){let r=this.layerIndexes[e];return r||(r=this.layerIndexes[e]=new Ps),r}getWorkerSource(e,r,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][r]||(this.workerSources[e][r]={}),!this.workerSources[e][r][n]){let i={send:(o,a,s)=>{this.actor.send(o,a,s,e)}};this.workerSources[e][r][n]=new this.workerSourceTypes[r](i,this.getLayerIndex(e),this.getAvailableImages(e))}return this.workerSources[e][r][n]}getDEMWorkerSource(e,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]=new Ms),this.demWorkerSources[e][r]}};Ee()&&(self.worker=new nl(self));})();\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\n',nP=u((()=>URL.createObjectURL(new Blob([qd],{type:"text/javascript"}))),"getWorkerURL");function $d(){return new Worker(nP())}u($d,"workerFactory");var Xs="mapboxgl_preloaded_worker_pool",Qt=class{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Qt.workerCount;)this.workers.push($d());return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],0===this.numActive()&&(this.workers.forEach((e=>{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Xs]}numActive(){return Object.keys(this.active).length}};u(Qt,"WorkerPool");var to,aP=Math.floor(ne.hardwareConcurrency/2);function Gc(){return to||(to=new Qt),to}function Gd(){Gc().acquire(Xs)}function jd(){let e=to;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(Xs),to=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))}Qt.workerCount=Xr(globalThis)?Math.max(Math.min(aP,3),1):1,u(Gc,"getGlobalWorkerPool"),u(Gd,"prewarm"),u(jd,"clearPrewarmedResources"),d(),d(),d();var er=ae(Pe());d();var yr=ae(Pe());function jc(e,t,r,i,a){let n=[];for(let s=0;s<e.length;s++){let o,l=e[s];for(let e=0;e<l.length-1;e++){let s=l[e],u=l[e+1];s.x<t&&u.x<t||(s.x<t?s=new yr.default(t,s.y+(u.y-s.y)*((t-s.x)/(u.x-s.x)))._round():u.x<t&&(u=new yr.default(t,s.y+(u.y-s.y)*((t-s.x)/(u.x-s.x)))._round()),!(s.y<r&&u.y<r)&&(s.y<r?s=new yr.default(s.x+(u.x-s.x)*((r-s.y)/(u.y-s.y)),r)._round():u.y<r&&(u=new yr.default(s.x+(u.x-s.x)*((r-s.y)/(u.y-s.y)),r)._round()),!(s.x>=i&&u.x>=i)&&(s.x>=i?s=new yr.default(i,s.y+(u.y-s.y)*((i-s.x)/(u.x-s.x)))._round():u.x>=i&&(u=new yr.default(i,s.y+(u.y-s.y)*((i-s.x)/(u.x-s.x)))._round()),!(s.y>=a&&u.y>=a)&&(s.y>=a?s=new yr.default(s.x+(u.x-s.x)*((a-s.y)/(u.y-s.y)),a)._round():u.y>=a&&(u=new yr.default(s.x+(u.x-s.x)*((a-s.y)/(u.y-s.y)),a)._round()),(!o||!s.equals(o[o.length-1]))&&(o=[s],n.push(o)),o.push(u)))))}}return n}u(jc,"clipLine"),d();var Ks=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=Te(e,0,1);let t=1,r=this._distances[t],i=e*this.paddedLength+this.padding;for(;r<i&&t<this._distances.length;)r=this._distances[++t];let a=t-1,n=this._distances[a],s=r-n,o=s>0?(i-n)/s:0;return this.points[a].mult(1-o).add(this.points[t].mult(o))}};function Ys(e,t){let r=!0;return"always"===e||("never"===e||"never"===t)&&(r=!1),r}u(Ks,"PathInterpolator"),d(),u(Ys,"overlapAllowed");var ro=class{constructor(e,t,r){let i=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(t/r);for(let e=0;e<this.xCellCount*this.yCellCount;e++)i.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,r,i,a){this._forEachCell(t,r,i,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(a)}insertCircle(e,t,r,i){this._forEachCell(t-i,r-i,t+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(r),this.circles.push(i)}_insertBoxCell(e,t,r,i,a,n){this.boxCells[a].push(n)}_insertCircleCell(e,t,r,i,a,n){this.circleCells[a].push(n)}_query(e,t,r,i,a,n,s){if(r<0||e>this.width||i<0||t>this.height)return[];let o=[];if(e<=0&&t<=0&&this.width<=r&&this.height<=i){if(a)return[{key:null,x1:e,y1:t,x2:r,y2:i}];for(let e=0;e<this.boxKeys.length;e++)o.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],r=this.circles[3*e+1],i=this.circles[3*e+2];o.push({key:this.circleKeys[e],x1:t-i,y1:r-i,x2:t+i,y2:r+i})}}else{let l={hitTest:a,overlapMode:n,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,r,i,this._queryCell,o,l,s)}return o}query(e,t,r,i){return this._query(e,t,r,i,!1,null)}hitTest(e,t,r,i,a,n){return this._query(e,t,r,i,!0,a,n).length>0}hitTestCircle(e,t,r,i,a){let n=e-r,s=e+r,o=t-r,l=t+r;if(s<0||n>this.width||l<0||o>this.height)return!1;let u=[],h={hitTest:!0,overlapMode:i,circle:{x:e,y:t,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(n,o,s,l,this._queryCellCircle,u,h,a),u.length>0}_queryCell(e,t,r,i,a,n,s,o){let{seenUids:l,hitTest:u,overlapMode:h}=s,c=this.boxCells[a];if(null!==c){let a=this.bboxes;for(let s of c)if(!l.box[s]){l.box[s]=!0;let c=4*s,p=this.boxKeys[s];if(e<=a[c+2]&&t<=a[c+3]&&r>=a[c+0]&&i>=a[c+1]&&(!o||o(p))&&(!u||!Ys(h,p.overlapMode))&&(n.push({key:p,x1:a[c],y1:a[c+1],x2:a[c+2],y2:a[c+3]}),u))return!0}}let p=this.circleCells[a];if(null!==p){let a=this.circles;for(let s of p)if(!l.circle[s]){l.circle[s]=!0;let c=3*s,p=this.circleKeys[s];if(this._circleAndRectCollide(a[c],a[c+1],a[c+2],e,t,r,i)&&(!o||o(p))&&(!u||!Ys(h,p.overlapMode))){let e=a[c],t=a[c+1],r=a[c+2];if(n.push({key:p,x1:e-r,y1:t-r,x2:e+r,y2:t+r}),u)return!0}}}return!1}_queryCellCircle(e,t,r,i,a,n,s,o){let{circle:l,seenUids:u,overlapMode:h}=s,c=this.boxCells[a];if(null!==c){let e=this.bboxes;for(let t of c)if(!u.box[t]){u.box[t]=!0;let r=4*t,i=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[r+0],e[r+1],e[r+2],e[r+3])&&(!o||o(i))&&!Ys(h,i.overlapMode))return n.push(!0),!0}}let p=this.circleCells[a];if(null!==p){let e=this.circles;for(let t of p)if(!u.circle[t]){u.circle[t]=!0;let r=3*t,i=this.circleKeys[t];if(this._circlesCollide(e[r],e[r+1],e[r+2],l.x,l.y,l.radius)&&(!o||o(i))&&!Ys(h,i.overlapMode))return n.push(!0),!0}}}_forEachCell(e,t,r,i,a,n,s,o){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),h=this._convertToXCellCoord(r),c=this._convertToYCellCoord(i);for(let p=l;p<=h;p++)for(let l=u;l<=c;l++){let u=this.xCellCount*l+p;if(a.call(this,e,t,r,i,u,n,s,o))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,r,i,a,n){let s=i-e,o=a-t,l=r+n;return l*l>s*s+o*o}_circleAndRectCollide(e,t,r,i,a,n,s){let o=(n-i)/2,l=Math.abs(e-(i+o));if(l>o+r)return!1;let u=(s-a)/2,h=Math.abs(t-(a+u));if(h>u+r)return!1;if(l<=o||h<=u)return!0;let c=l-o,p=h-u;return c*c+p*p<=r*r}};u(ro,"GridIndex"),d();var Tn=ae(Pe());function io(e,t,r,i,a){let n=$.create();return t?($.scale(n,n,[1/a,1/a,1]),r||$.rotateZ(n,n,i.angle)):$.multiply(n,i.labelPlaneMatrix,e),n}function Js(e,t,r,i,a){if(t){let t=$.clone(e);return $.scale(t,t,[a,a,1]),r||$.rotateZ(t,t,-i.angle),t}return i.glCoordMatrix}function It(e,t,r){let i;r?(i=[e.x,e.y,r(e.x,e.y),1],Je.transformMat4(i,i,t)):(i=[e.x,e.y,0,1],el(i,i,t));let a=i[3];return{point:new Tn.default(i[0]/a,i[1]/a),signedDistanceFromCamera:a}}function no(e,t){return.5+e/t*.5}function oP(e,t){let r=e[0]/e[3],i=e[1]/e[3];return r>=-t[0]&&r<=t[0]&&i>=-t[1]&&i<=t[1]}function Hd(e,t,r,i,a,n,s,o,l,u){let h=i?e.textSizeData:e.iconSizeData,c=di(h,r.transform.zoom),p=[256/r.width*2+1,256/r.height*2+1],d=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;d.clear();let f=e.lineVertexArray,m=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,y=r.transform.width/r.transform.height,g=!1;for(let i=0;i<m.length;i++){let _,x=m.get(i);if(x.hidden||x.writingMode===Be.vertical&&!g){bi(x.numGlyphs,d);continue}if(g=!1,u?(_=[x.anchorX,x.anchorY,u(x.anchorX,x.anchorY),1],Je.transformMat4(_,_,t)):(_=[x.anchorX,x.anchorY,0,1],el(_,_,t)),!oP(_,p)){bi(x.numGlyphs,d);continue}let v=_[3],b=no(r.transform.cameraToCenterDistance,v),w=pn(h,c,x),S=s?w/b:w*b,A=new Tn.default(x.anchorX,x.anchorY),I=It(A,a,u).point,M={projections:{},offsets:{}},T=Wd(x,S,!1,o,t,a,n,e.glyphOffsetArray,f,d,I,A,M,y,l,u);g=T.useVertical,(T.notEnoughRoom||g||T.needsFlipping&&Wd(x,S,!0,o,t,a,n,e.glyphOffsetArray,f,d,I,A,M,y,l,u).notEnoughRoom)&&bi(x.numGlyphs,d)}i?e.text.dynamicLayoutVertexBuffer.updateData(d):e.icon.dynamicLayoutVertexBuffer.updateData(d)}function Hc(e,t,r,i,a,n,s,o,l,u,h,c,p){let d=o.glyphStartIndex+o.numGlyphs,f=o.lineStartIndex,m=o.lineStartIndex+o.lineLength,y=t.getoffsetX(o.glyphStartIndex),g=t.getoffsetX(d-1),_=Qs(e*y,r,i,a,n,s,o.segment,f,m,l,u,h,c,p);if(!_)return null;let x=Qs(e*g,r,i,a,n,s,o.segment,f,m,l,u,h,c,p);return x?{first:_,last:x}:null}function Zd(e,t,r,i){if(e===Be.horizontal){if(Math.abs(r.y-t.y)>Math.abs(r.x-t.x)*i)return{useVertical:!0}}return(e===Be.vertical?t.y<r.y:t.x>r.x)?{needsFlipping:!0}:null}function Wd(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m){let y,g=t/24,_=e.lineOffsetX*g,x=e.lineOffsetY*g;if(e.numGlyphs>1){let t=e.glyphStartIndex+e.numGlyphs,a=e.lineStartIndex,u=e.lineStartIndex+e.lineLength,v=Hc(g,o,_,x,r,h,c,e,l,n,p,f,m);if(!v)return{notEnoughRoom:!0};let b=It(v.first.point,s,m).point,w=It(v.last.point,s,m).point;if(i&&!r){let t=Zd(e.writingMode,b,w,d);if(t)return t}y=[v.first];for(let i=e.glyphStartIndex+1;i<t-1;i++)y.push(Qs(g*o.getoffsetX(i),_,x,r,h,c,e.segment,a,u,l,n,p,f,m));y.push(v.last)}else{if(i&&!r){let t=It(c,a,m).point,r=e.lineStartIndex+e.segment+1,i=new Tn.default(l.getx(r),l.gety(r)),n=It(i,a,m),s=n.signedDistanceFromCamera>0?n.point:Xd(c,i,t,1,a,m),o=Zd(e.writingMode,t,s,d);if(o)return o}let t=Qs(g*o.getoffsetX(e.glyphStartIndex),_,x,r,h,c,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,l,n,p,f,m);if(!t)return{notEnoughRoom:!0};y=[t]}for(let e of y)yi(u,e.point,e.angle);return{}}function Xd(e,t,r,i,a,n){let s=It(e.add(e.sub(t)._unit()),a,n).point,o=r.sub(s);return r.add(o._mult(i/o.mag()))}function Zc(e,t){let{projectionCache:r,lineVertexArray:i,labelPlaneMatrix:a,tileAnchorPoint:n,distanceFromAnchor:s,getElevation:o,previousVertex:l,direction:u,absOffsetX:h}=t;if(r.projections[e])return r.projections[e];let c=new Tn.default(i.getx(e),i.gety(e)),p=It(c,a,o);if(p.signedDistanceFromCamera>0)return r.projections[e]=p.point,p.point;let d=e-u;return Xd(0===s?n:new Tn.default(i.getx(d),i.gety(d)),c,l,h-s+1,a,o)}function Wc(e,t,r){return e._unit()._perp()._mult(t*r)}function sP(e,t,r,i,a,n,s,o){let{projectionCache:l,direction:u}=o;if(l.offsets[e])return l.offsets[e];let h=r.add(t);if(e+u<i||e+u>=a)return l.offsets[e]=h,h;let c=Zc(e+u,o),p=Wc(c.sub(r),s,u),d=r.add(p),f=c.add(p);return l.offsets[e]=Op(n,h,d,f)||h,l.offsets[e]}function Qs(e,t,r,i,a,n,s,o,l,u,h,c,p,d){let f=i?e-t:e+t,m=f>0?1:-1,y=0;i&&(m*=-1,y=Math.PI),m<0&&(y+=Math.PI);let g,_,x,v=m>0?o+s:o+s+1,b=a,w=a,S=0,A=0,I=Math.abs(f),M=[];for(;S+A<=I;){if(v+=m,v<o||v>=l)return null;S+=A,w=b,_=g;let e={projectionCache:c,lineVertexArray:u,labelPlaneMatrix:h,tileAnchorPoint:n,distanceFromAnchor:S,getElevation:d,previousVertex:w,direction:m,absOffsetX:I};if(b=Zc(v,e),0===r)M.push(w),x=b.sub(w);else{let t,i=b.sub(w);if(0===i.mag()){t=Wc(Zc(v+m,e).sub(b),r,m)}else t=Wc(i,r,m);_||(_=w.add(t)),g=sP(v,t,b,o,l,_,r,e),M.push(_),x=g.sub(_)}A=x.mag()}let T=(I-S)/A,C=x._mult(T)._add(_||w),P=y+Math.atan2(b.y-w.y,b.x-w.x);return M.push(C),{point:C,angle:p?P:0,path:M}}u(io,"getLabelPlaneMatrix"),u(Js,"getGlCoordMatrix"),u(It,"project"),u(no,"getPerspectiveRatio"),u(oP,"isVisible"),u(Hd,"updateLineLabels"),u(Hc,"placeFirstAndLastGlyph"),u(Zd,"requiresOrientationChange"),u(Wd,"placeGlyphsAlongLine"),u(Xd,"projectTruncatedLineSegment"),u(Zc,"projectVertexToViewport"),u(Wc,"transformToOffsetNormal"),u(sP,"findOffsetIntersectionPoint"),u(Qs,"placeGlyphAlongLine");var lP=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function bi(e,t){for(let r=0;r<e;r++){let e=t.length;t.resize(e+4),t.float32.set(lP,3*e)}}function el(e,t,r){let i=t[0],a=t[1];return e[0]=r[0]*i+r[4]*a+r[12],e[1]=r[1]*i+r[5]*a+r[13],e[3]=r[3]*i+r[7]*a+r[15],e}u(bi,"hideGlyphs"),u(el,"xyTransformMat4");var tt=100,tl=class{constructor(e,t=new ro(e.width+2*tt,e.height+2*tt,25),r=new ro(e.width+2*tt,e.height+2*tt,25)){this.transform=e,this.grid=t,this.ignoredGrid=r,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+tt,this.screenBottomBoundary=e.height+tt,this.gridRightBoundary=e.width+2*tt,this.gridBottomBoundary=e.height+2*tt,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,r,i,a,n){let s=this.projectAndGetPerspectiveRatio(i,e.anchorPointX,e.anchorPointY,n),o=r*s.perspectiveRatio,l=e.x1*o+s.point.x,u=e.y1*o+s.point.y,h=e.x2*o+s.point.x,c=e.y2*o+s.point.y;return!this.isInsideGrid(l,u,h,c)||"always"!==t&&this.grid.hitTest(l,u,h,c,t,a)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,u,h,c],offscreen:this.isOffscreen(l,u,h,c)}}placeCollisionCircles(e,t,r,i,a,n,s,o,l,u,h,c,p,d){let f=[],m=new er.default(t.anchorX,t.anchorY),y=It(m,n,d),g=no(this.transform.cameraToCenterDistance,y.signedDistanceFromCamera),_=(u?a/g:a*g)/fi,x=It(m,s,d).point,v=Hc(_,i,t.lineOffsetX*_,t.lineOffsetY*_,!1,x,m,t,r,s,{projections:{},offsets:{}},!1,d),b=!1,w=!1,S=!0;if(v){let t=.5*c*g+p,r=new er.default(-tt,-tt),i=new er.default(this.screenRightBoundary,this.screenBottomBoundary),a=new Ks,n=v.first,s=v.last,u=[];for(let e=n.path.length-1;e>=1;e--)u.push(n.path[e]);for(let e=1;e<s.path.length;e++)u.push(s.path[e]);let m=2.5*t;if(o){let e=u.map((e=>It(e,o,d)));u=e.some((e=>e.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let y=[];if(u.length>0){let e=u[0].clone(),t=u[0].clone();for(let r=1;r<u.length;r++)e.x=Math.min(e.x,u[r].x),e.y=Math.min(e.y,u[r].y),t.x=Math.max(t.x,u[r].x),t.y=Math.max(t.y,u[r].y);y=e.x>=r.x&&t.x<=i.x&&e.y>=r.y&&t.y<=i.y?[u]:t.x<r.x||e.x>i.x||t.y<r.y||e.y>i.y?[]:jc([u],r.x,r.y,i.x,i.y)}for(let r of y){a.reset(r,.25*t);let i=0;i=a.length<=.5*t?1:Math.ceil(a.paddedLength/m)+1;for(let r=0;r<i;r++){let n=r/Math.max(i-1,1),s=a.lerp(n),o=s.x+tt,u=s.y+tt;f.push(o,u,t,0);let c=o-t,p=u-t,d=o+t,m=u+t;if(S=S&&this.isOffscreen(c,p,d,m),w=w||this.isInsideGrid(c,p,d,m),"always"!==e&&this.grid.hitTestCircle(o,u,t,e,h)&&(b=!0,!l))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!l&&b||!w||g<this.perspectiveRatioCutoff?[]:f,offscreen:S,collisionDetected:b}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let t=[],r=1/0,i=1/0,a=-1/0,n=-1/0;for(let s of e){let e=new er.default(s.x+tt,s.y+tt);r=Math.min(r,e.x),i=Math.min(i,e.y),a=Math.max(a,e.x),n=Math.max(n,e.y),t.push(e)}let s=this.grid.query(r,i,a,n).concat(this.ignoredGrid.query(r,i,a,n)),o={},l={};for(let e of s){let r=e.key;(void 0===o[r.bucketInstanceId]&&(o[r.bucketInstanceId]={}),o[r.bucketInstanceId][r.featureIndex])||(!ds(t,[new er.default(e.x1,e.y1),new er.default(e.x2,e.y1),new er.default(e.x2,e.y2),new er.default(e.x1,e.y2)])||(o[r.bucketInstanceId][r.featureIndex]=!0,void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]=[]),l[r.bucketInstanceId].push(r.featureIndex)))}return l}insertCollisionBox(e,t,r,i,a,n){let s={bucketInstanceId:i,featureIndex:a,collisionGroupID:n,overlapMode:t};(r?this.ignoredGrid:this.grid).insert(s,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,r,i,a,n){let s=r?this.ignoredGrid:this.grid,o={bucketInstanceId:i,featureIndex:a,collisionGroupID:n,overlapMode:t};for(let t=0;t<e.length;t+=4)s.insertCircle(o,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,t,r,i){let a;return i?(a=[t,r,i(t,r),1],Je.transformMat4(a,a,e)):(a=[t,r,0,1],el(a,a,e)),{point:new er.default((a[0]/a[3]+1)/2*this.transform.width+tt,(-a[1]/a[3]+1)/2*this.transform.height+tt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/a[3]*.5}}isOffscreen(e,t,r,i){return r<tt||e>=this.screenRightBoundary||i<tt||t>this.screenBottomBoundary}isInsideGrid(e,t,r,i){return r>=0&&e<this.gridRightBoundary&&i>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=$.identity([]);return $.translate(e,e,[-tt,-tt,0]),e}};u(tl,"CollisionIndex"),d(),d();var Kd=ae(Pe()),vi=class extends Kd.default{constructor(e,t,r,i){super(e,t),this.angle=r,void 0!==i&&(this.segment=i)}clone(){return new vi(this.x,this.y,this.angle,this.segment)}};u(vi,"Anchor"),N("Anchor",vi),d(),d(),d();var uP=ae(Pe());d();var cP=ae(Pe());d();var pP=ae(e_()),hP=ae(Pe()),mP=ae(dc()),An=7,fP=Number.POSITIVE_INFINITY;function rl(e,t){function r(e,t){let r=0,i=0;t<0&&(t=0);let a=t/Math.sqrt(2);switch(e){case"top-right":case"top-left":i=a-An;break;case"bottom-right":case"bottom-left":i=-a+An;break;case"bottom":i=-t+An;break;case"top":i=t-An}switch(e){case"top-right":case"bottom-right":r=-a;break;case"top-left":case"bottom-left":r=a;break;case"left":r=t;break;case"right":r=-t}return[r,i]}function i(e,t,r){let i=0,a=0;switch(t=Math.abs(t),r=Math.abs(r),e){case"top-right":case"top-left":case"top":a=r-An;break;case"bottom-right":case"bottom-left":case"bottom":a=-r+An}switch(e){case"top-right":case"bottom-right":case"right":i=-t;break;case"top-left":case"bottom-left":case"left":i=t}return[i,a]}return u(r,"fromRadialOffset"),u(i,"fromTextOffset"),t[1]!==fP?i(e,t[0],t[1]):r(e,t[0])}function Yd(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function et(e,t,r){return t*(O/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}u(rl,"evaluateVariableOffset"),u(Yd,"getAnchorJustification"),d(),u(et,"pixelsToTileUnits");var il=ae(Pe()),nl=class{constructor(e,t,r,i){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):i&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}};u(nl,"OpacityState");var wi=class{constructor(e,t,r,i,a){this.text=new nl(e?e.text:null,t,r,a),this.icon=new nl(e?e.icon:null,t,i,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}};u(wi,"JointOpacityState");var al=class{constructor(e,t,r){this.text=e,this.icon=t,this.skipFade=r}};u(al,"JointPlacement");var Xc=class{constructor(){this.invProjMatrix=$.create(),this.viewportMatrix=$.create(),this.circles=[]}};u(Xc,"CollisionCircleArray");var Kc=class{constructor(e,t,r,i,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=a}};u(Kc,"RetainedQueryData");var Yc=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}};function Jd(e,t,r,i,a){let{horizontalAlign:n,verticalAlign:s}=Es(e),o=-(n-.5)*t,l=-(s-.5)*r,u=rl(e,i);return new il.default(o+u[0]*a,l+u[1]*a)}function Jc(e,t,r,i,a,n){let{x1:s,x2:o,y1:l,y2:u,anchorPointX:h,anchorPointY:c}=e,p=new il.default(t,r);return i&&p._rotate(a?n:-n),{x1:s+p.x,y1:l+p.y,x2:o+p.x,y2:u+p.y,anchorPointX:h,anchorPointY:c}}u(Yc,"CollisionGroups"),u(Jd,"calculateVariableLayoutShift"),u(Jc,"shiftVariableCollisionBox");var ol=class{constructor(e,t,r,i,a){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new tl(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new Yc(i),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,t,r,i){let a=r.getBucket(t),n=r.latestFeatureIndex;if(!a||!n||t.id!==a.layerIds[0])return;let s=r.collisionBoxArray,o=a.layers[0].layout,l=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/O,h=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),c="map"===o.get("text-pitch-alignment"),p="map"===o.get("text-rotation-alignment"),d=et(r,1,this.transform.zoom),f=io(h,c,p,this.transform,d),m=null;if(c){let e=Js(h,c,p,this.transform,d);m=$.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[a.bucketInstanceId]=new Kc(a.bucketInstanceId,n,a.sourceLayerIndex,a.index,r.tileID);let y={bucket:a,layout:o,posMatrix:h,textLabelPlaneMatrix:f,labelToScreenMatrix:m,scale:l,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:di(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(i)for(let t of a.sortKeyRanges){let{sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:a}=t;e.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:a,parameters:y})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:y})}attemptAnchorPlacement(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m){let y=[c.textOffset0,c.textOffset1],g=Jd(e,r,i,y,a),_=this.collisionIndex.placeCollisionBox(Jc(t,g.x,g.y,n,s,this.transform.angle),h,o,l,u.predicate,m);if((!f||0!==this.collisionIndex.placeCollisionBox(Jc(f,g.x,g.y,n,s,this.transform.angle),h,o,l,u.predicate,m).box.length)&&_.box.length>0){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[c.crossTileID]&&this.prevPlacement.placements[c.crossTileID]&&this.prevPlacement.placements[c.crossTileID].text&&(t=this.prevPlacement.variableOffsets[c.crossTileID].anchor),0===c.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[c.crossTileID]={textOffset:y,width:r,height:i,anchor:e,textBoxScale:a,prevAnchor:t},this.markUsedJustification(p,e,c,d),p.allowVerticalPlacement&&(this.markUsedOrientation(p,d,c),this.placedOrientations[c.crossTileID]=d),{shift:g,placedGlyphBoxes:_}}}placeLayerBucketPart(e,t,r){let{bucket:i,layout:a,posMatrix:n,textLabelPlaneMatrix:s,labelToScreenMatrix:o,textPixelRatio:l,holdingForFade:h,collisionBoxArray:c,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,f=a.get("text-optional"),m=a.get("icon-optional"),y=hn(a,"text-overlap","text-allow-overlap"),g="always"===y,_=hn(a,"icon-overlap","icon-allow-overlap"),x="always"===_,v="map"===a.get("text-rotation-alignment"),b="map"===a.get("text-pitch-alignment"),w="none"!==a.get("icon-text-fit"),S="viewport-y"===a.get("symbol-z-order"),A=g&&(x||!i.hasIconData()||m),I=x&&(g||!i.hasTextData()||f);!i.collisionArrays&&c&&i.deserializeCollisionBoxes(c);let M=this.retainedQueryData[i.bucketInstanceId].tileID,T=this.terrain?(e,t)=>this.terrain.getElevation(M,e,t):null,C=u(((e,c)=>{if(t[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new al(!1,!1,!1));let x=!1,S=!1,M=!0,C=null,P={box:null,offscreen:null},k={box:null,offscreen:null},z=null,E=null,F=null,D=0,B=0,L=0;c.textFeatureIndex?D=c.textFeatureIndex:e.useRuntimeCollisionCircles&&(D=e.featureIndex),c.verticalTextFeatureIndex&&(B=c.verticalTextFeatureIndex);let R=c.textBox;if(R){let t=u((t=>{let r=Be.horizontal;if(i.allowVerticalPlacement&&!t&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(i,r,e))}return r}),"updatePreviousOrientationIfNotPlaced"),r=u(((t,r)=>{if(i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&c.verticalTextBox){for(let e of i.writingModes)if(e===Be.vertical?(P=r(),k=P):P=t(),P&&P.box&&P.box.length)break}else P=t()}),"placeTextForPlacementModes");if(a.get("text-variable-anchor")){let s=a.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){let t=this.prevPlacement.variableOffsets[e.crossTileID];s.indexOf(t.anchor)>0&&(s=s.filter((e=>e!==t.anchor)),s.unshift(t.anchor))}let o=u(((t,r,a)=>{let o=t.x2-t.x1,u=t.y2-t.y1,h=e.textBoxScale,c=w&&"never"===_?r:null,p={box:[],offscreen:!1},f="never"!==y?2*s.length:s.length;for(let r=0;r<f;++r){let f=s[r%s.length],m=r>=s.length?y:"never",g=this.attemptAnchorPlacement(f,t,o,u,h,v,b,l,n,d,m,e,i,a,c,T);if(g&&(p=g.placedGlyphBoxes,p&&p.box&&p.box.length)){x=!0,C=g.shift;break}}return p}),"placeBoxForVariableAnchors");r(u((()=>o(R,c.iconBox,Be.horizontal)),"placeHorizontal"),u((()=>{let t=c.verticalTextBox,r=P&&P.box&&P.box.length;return i.allowVerticalPlacement&&!r&&e.numVerticalGlyphVertices>0&&t?o(t,c.verticalIconBox,Be.vertical):{box:null,offscreen:null}}),"placeVertical")),P&&(x=P.box,M=P.offscreen);let h=t(P&&P.box);if(!x&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(i,t.anchor,e,h))}}else{let a=u(((t,r)=>{let a=this.collisionIndex.placeCollisionBox(t,y,l,n,d.predicate,T);return a&&a.box&&a.box.length&&(this.markUsedOrientation(i,r,e),this.placedOrientations[e.crossTileID]=r),a}),"placeBox");r(u((()=>a(R,Be.horizontal)),"placeHorizontal"),u((()=>{let t=c.verticalTextBox;return i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&t?a(t,Be.vertical):{box:null,offscreen:null}}),"placeVertical")),t(P&&P.box&&P.box.length)}}if(z=P,x=z&&z.box&&z.box.length>0,M=z&&z.offscreen,e.useRuntimeCollisionCircles){let t=i.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),l=pn(i.textSizeData,p,t),u=a.get("text-padding"),h=e.collisionCircleDiameter;E=this.collisionIndex.placeCollisionCircles(y,t,i.lineVertexArray,i.glyphOffsetArray,l,n,s,o,r,b,d.predicate,h,u,T),E.circles.length&&E.collisionDetected&&!r&&Me("Collisions detected, but collision boxes are not shown"),x=g||E.circles.length>0&&!E.collisionDetected,M=M&&E.offscreen}if(c.iconFeatureIndex&&(L=c.iconFeatureIndex),c.iconBox){let e=u((e=>{let t=w&&C?Jc(e,C.x,C.y,v,b,this.transform.angle):e;return this.collisionIndex.placeCollisionBox(t,_,l,n,d.predicate,T)}),"placeIconFeature");k&&k.box&&k.box.length&&c.verticalIconBox?(F=e(c.verticalIconBox),S=F.box.length>0):(F=e(c.iconBox),S=F.box.length>0),M=M&&F.offscreen}let V=f||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,O=m||0===e.numIconVertices;if(V||O?O?V||(S=S&&x):x=S&&x:S=x=S&&x,x&&z&&z.box&&(k&&k.box&&B?this.collisionIndex.insertCollisionBox(z.box,y,a.get("text-ignore-placement"),i.bucketInstanceId,B,d.ID):this.collisionIndex.insertCollisionBox(z.box,y,a.get("text-ignore-placement"),i.bucketInstanceId,D,d.ID)),S&&F&&this.collisionIndex.insertCollisionBox(F.box,_,a.get("icon-ignore-placement"),i.bucketInstanceId,L,d.ID),E&&(x&&this.collisionIndex.insertCollisionCircles(E.circles,y,a.get("text-ignore-placement"),i.bucketInstanceId,D,d.ID),r)){let e=i.bucketInstanceId,t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Xc);for(let e=0;e<E.circles.length;e+=4)t.circles.push(E.circles[e+0]),t.circles.push(E.circles[e+1]),t.circles.push(E.circles[e+2]),t.circles.push(E.collisionDetected?1:0)}if(0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===i.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new al(x||A,S||I,M||i.justReloaded),t[e.crossTileID]=!0}),"placeSymbol");if(S){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");let t=i.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){let r=t[e];C(i.symbolInstances.get(r),i.collisionArrays[r])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)C(i.symbolInstances.get(t),i.collisionArrays[t]);if(r&&i.bucketInstanceId in this.collisionCircleArrays){let e=this.collisionCircleArrays[i.bucketInstanceId];$.invert(e.invProjMatrix,n),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}i.justReloaded=!1}markUsedJustification(e,t,r,i){let a,n={left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex};a=i===Be.vertical?r.verticalPlacedTextSymbolIndex:n[Yd(t)];let s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let t of s)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:r.crossTileID)}markUsedOrientation(e,t,r){let i=t===Be.horizontal||t===Be.horizontalOnly?t:0,a=t===Be.vertical?t:0,n=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let t of n)e.text.placedSymbolArray.get(t).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,r=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let i=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},n=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],n=a[e];n?(this.opacities[e]=new wi(n,i,t.text,t.icon),r=r||t.text!==n.text.placed||t.icon!==n.icon.placed):(this.opacities[e]=new wi(null,i,t.text,t.icon,t.skipFade),r=r||t.text||t.icon)}for(let e in a){let t=a[e];if(!this.opacities[e]){let a=new wi(t,i,!1,!1);a.isHidden()||(this.opacities[e]=a,r=r||t.text.placed||t.icon.placed)}}for(let e in n)!this.variableOffsets[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.variableOffsets[e]=n[e]);for(let e in s)!this.placedOrientations[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.placedOrientations[e]=s[e]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let r={};for(let i of t){let t=i.getBucket(e);t&&i.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r,i.collisionBoxArray)}}updateBucketOpacities(e,t,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let i=e.layers[0].layout,a=new wi(null,0,!1,!1,!0),n=i.get("text-allow-overlap"),s=i.get("icon-allow-overlap"),o=i.get("text-variable-anchor"),l="map"===i.get("text-rotation-alignment"),h="map"===i.get("text-pitch-alignment"),c="none"!==i.get("icon-text-fit"),p=new wi(null,0,n&&(s||!e.hasIconData()||i.get("icon-optional")),s&&(n||!e.hasTextData()||i.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);let d=u(((e,t,r)=>{for(let i=0;i<t/4;i++)e.opacityVertexArray.emplaceBack(r);e.hasVisibleVertices=e.hasVisibleVertices||r!==ao}),"addOpacities");for(let r=0;r<e.symbolInstances.length;r++){let i=e.symbolInstances.get(r),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:s,crossTileID:u}=i,f=t[u],m=this.opacities[u];f?m=a:m||(m=p,this.opacities[u]=m),t[u]=!0;let y=n>0||s>0,g=i.numIconVertices>0,_=this.placedOrientations[i.crossTileID],x=_===Be.vertical,v=_===Be.horizontal||_===Be.horizontalOnly;if(y){let t=Qd(m.text),r=x?ao:t;d(e.text,n,r);let a=v?ao:t;d(e.text,s,a);let o=m.text.isHidden();[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=o||x?1:0)})),i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=o||v?1:0);let l=this.variableOffsets[i.crossTileID];l&&this.markUsedJustification(e,l.anchor,i,_);let u=this.placedOrientations[i.crossTileID];u&&(this.markUsedJustification(e,"left",i,u),this.markUsedOrientation(e,u,i))}if(g){let t=Qd(m.icon),r=!(c&&i.verticalPlacedIconSymbolIndex&&x);if(i.placedIconSymbolIndex>=0){let a=r?t:ao;d(e.icon,i.numIconVertices,a),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=m.icon.isHidden()}if(i.verticalPlacedIconSymbolIndex>=0){let a=r?ao:t;d(e.icon,i.numVerticalIconVertices,a),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden()}}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let t=e.collisionArrays[r];if(t){let r=new il.default(0,0);if(t.textBox||t.verticalTextBox){let i=!0;if(o){let e=this.variableOffsets[u];e?(r=Jd(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),l&&r._rotate(h?this.transform.angle:-this.transform.angle)):i=!1}t.textBox&&sl(e.textCollisionBox.collisionVertexArray,m.text.placed,!i||x,r.x,r.y),t.verticalTextBox&&sl(e.textCollisionBox.collisionVertexArray,m.text.placed,!i||v,r.x,r.y)}let i=Boolean(!v&&t.verticalIconBox);t.iconBox&&sl(e.iconCollisionBox.collisionVertexArray,m.icon.placed,i,c?r.x:0,c?r.y:0),t.verticalIconBox&&sl(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!i,c?r.x:0,c?r.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){let t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let r=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}};function sl(e,t,r,i,a){e.emplaceBack(t?1:0,r?1:0,i||0,a||0),e.emplaceBack(t?1:0,r?1:0,i||0,a||0),e.emplaceBack(t?1:0,r?1:0,i||0,a||0),e.emplaceBack(t?1:0,r?1:0,i||0,a||0)}u(ol,"Placement"),u(sl,"updateCollisionVertices");var dP=Math.pow(2,25),yP=Math.pow(2,24),gP=Math.pow(2,17),xP=Math.pow(2,16),_P=Math.pow(2,9),bP=Math.pow(2,8),vP=Math.pow(2,1);function Qd(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;let t=e.placed?1:0,r=Math.floor(127*e.opacity);return r*dP+t*yP+r*gP+t*xP+r*_P+t*bP+r*vP+t}u(Qd,"packOpacity");var ao=0,Qc=class{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,r,i,a){let n=this._bucketParts;for(;this._currentTileIndex<e.length;){let r=e[this._currentTileIndex];if(t.getBucketParts(n,i,r,this._sortAcrossTiles),this._currentTileIndex++,a())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,n.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<n.length;){let e=n[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,r),this._currentPartIndex++,a())return!0}return!1}};u(Qc,"LayerPlacement");var ll=class{constructor(e,t,r,i,a,n,s,o){this.placement=new ol(e,t,n,s,o),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(e,t,r){let i=ne.now(),a=u((()=>!this._forceFullPlacement&&ne.now()-i>2),"shouldPausePlacement");for(;this._currentPlacementIndex>=0;){let i=t[e[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if("symbol"===i.type&&(!i.minzoom||i.minzoom<=n)&&(!i.maxzoom||i.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new Qc(i)),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};u(ll,"PauseablePlacement"),d(),d();var ey=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ep=1,oo=8,Si=class{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[t,r]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");let i=r>>4;if(i!==ep)throw new Error(`Got v${i} data when expected v${ep}.`);let a=ey[15&r];if(!a)throw new Error("Unrecognized array type.");let[n]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new Si(s,n,a,e)}constructor(e,t=64,r=Float64Array,i){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=ey.indexOf(this.ArrayType),n=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-s%8)%8;if(a<0)throw new Error(`Unexpected typed array class: ${r}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,oo,e),this.coords=new this.ArrayType(this.data,oo+s+o,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(oo+n+s+o),this.ids=new this.IndexArrayType(this.data,oo,e),this.coords=new this.ArrayType(this.data,oo+s+o,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(ep<<4)+a]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=t,r}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return tp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,r,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:s}=this,o=[0,a.length-1,0],l=[];for(;o.length;){let u=o.pop()||0,h=o.pop()||0,c=o.pop()||0;if(h-c<=s){for(let s=c;s<=h;s++){let o=n[2*s],u=n[2*s+1];o>=e&&o<=r&&u>=t&&u<=i&&l.push(a[s])}continue}let p=c+h>>1,d=n[2*p],f=n[2*p+1];d>=e&&d<=r&&f>=t&&f<=i&&l.push(a[p]),(0===u?e<=d:t<=f)&&(o.push(c),o.push(p-1),o.push(1-u)),(0===u?r>=d:i>=f)&&(o.push(p+1),o.push(h),o.push(1-u))}return l}within(e,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:a,nodeSize:n}=this,s=[0,i.length-1,0],o=[],l=r*r;for(;s.length;){let u=s.pop()||0,h=s.pop()||0,c=s.pop()||0;if(h-c<=n){for(let r=c;r<=h;r++)ry(a[2*r],a[2*r+1],e,t)<=l&&o.push(i[r]);continue}let p=c+h>>1,d=a[2*p],f=a[2*p+1];ry(d,f,e,t)<=l&&o.push(i[p]),(0===u?e-r<=d:t-r<=f)&&(s.push(c),s.push(p-1),s.push(1-u)),(0===u?e+r>=d:t+r>=f)&&(s.push(p+1),s.push(h),s.push(1-u))}return o}};function tp(e,t,r,i,a,n){if(a-i<=r)return;let s=i+a>>1;ty(e,t,s,i,a,n),tp(e,t,r,i,s-1,1-n),tp(e,t,r,s+1,a,1-n)}function ty(e,t,r,i,a,n){for(;a>i;){if(a-i>600){let s=a-i+1,o=r-i+1,l=Math.log(s),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(s-u)/s)*(o-s/2<0?-1:1);ty(e,t,r,Math.max(i,Math.floor(r-o*u/s+h)),Math.min(a,Math.floor(r+(s-o)*u/s+h)),n)}let s=t[2*r+n],o=i,l=a;for(so(e,t,i,r),t[2*a+n]>s&&so(e,t,i,a);o<l;){for(so(e,t,o,l),o++,l--;t[2*o+n]<s;)o++;for(;t[2*l+n]>s;)l--}t[2*i+n]===s?so(e,t,i,l):(l++,so(e,t,l,a)),l<=r&&(i=l+1),r<=l&&(a=l-1)}}function so(e,t,r,i){rp(e,r,i),rp(t,2*r,2*i),rp(t,2*r+1,2*i+1)}function rp(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function ry(e,t,r,i){let a=e-r,n=t-i;return a*a+n*n}u(Si,"KDBush"),u(tp,"sort"),u(ty,"select"),u(so,"swapItem"),u(rp,"swap"),u(ry,"sqDist");var lo=512/O/2,wP=128,ip=class{constructor(e,t,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let i=new Map;for(let e=0;e<t.length;e++){let r=t.get(e),a=r.key,n=i.get(a);n?n.push(r):i.set(a,[r])}for(let[e,t]of i){let r={positions:t.map((e=>({x:Math.floor(e.anchorX*lo),y:Math.floor(e.anchorY*lo)}))),crossTileIDs:t.map((e=>e.crossTileID))};if(r.positions.length>wP){let e=new Si(r.positions.length,16,Uint16Array);for(let{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,t){let{x:r,y:i,z:a}=this.tileID.canonical,{x:n,y:s,z:o}=t.canonical,l=o-a,u=lo/Math.pow(2,l),h=(n*O+e.anchorX)*u,c=(s*O+e.anchorY)*u,p=r*O*lo,d=i*O*lo;return{x:Math.floor(h-p),y:Math.floor(c-d)}}findMatches(e,t,r){let i=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){let n=e.get(a);if(n.crossTileID)continue;let s=this._symbolsByKey[n.key];if(!s)continue;let o=this.getScaledCoordinates(n,t);if(s.index){let e=s.index.range(o.x-i,o.y-i,o.x+i,o.y+i).sort();for(let t of e){let e=s.crossTileIDs[t];if(!r[e]){r[e]=!0,n.crossTileID=e;break}}}else if(s.positions)for(let e=0;e<s.positions.length;e++){let t=s.positions[e],a=s.crossTileIDs[e];if(Math.abs(t.x-o.x)<=i&&Math.abs(t.y-o.y)<=i&&!r[a]){r[a]=!0,n.crossTileID=a;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}};u(ip,"TileLayerIndex");var np=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}};u(np,"CrossTileIDs");var ap=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(0!==t)for(let e in this.indexes){let r=this.indexes[e],i={};for(let e in r){let a=r[e];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),i[a.tileID.key]=a}this.indexes[e]=i}this.lng=e}addBucket(e,t,r){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++){t.symbolInstances.get(e).crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let i=this.usedCrossTileIDs[e.overscaledZ];for(let r in this.indexes){let a=this.indexes[r];if(Number(r)>e.overscaledZ)for(let r in a){let n=a[r];n.tileID.isChildOf(e)&&n.findMatches(t.symbolInstances,e,i)}else{let n=a[e.scaledTo(Number(r)).key];n&&n.findMatches(t.symbolInstances,e,i)}}for(let e=0;e<t.symbolInstances.length;e++){let a=t.symbolInstances.get(e);a.crossTileID||(a.crossTileID=r.generate(),i[a.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ip(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let r of t.getCrossTileIDsLists())for(let t of r)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let r in this.indexes){let i=this.indexes[r];for(let a in i)e[i[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[a]),delete i[a],t=!0)}return t}};u(ap,"CrossTileSymbolLayerIndex");var In=class{constructor(){this.layerIndexes={},this.crossTileIDs=new np,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,r){let i=this.layerIndexes[e.id];void 0===i&&(i=this.layerIndexes[e.id]=new ap);let a=!1,n={};i.handleWrapJump(r);for(let r of t){let t=r.getBucket(e);!t||e.id!==t.layerIds[0]||(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(r.tileID,t,this.crossTileIDs)&&(a=!0),n[t.bucketInstanceId]=!0)}return i.removeStaleBuckets(n)&&(a=!0),a}pruneUnusedLayers(e){let t={};e.forEach((e=>{t[e]=!0}));for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}};u(In,"CrossTileSymbolIndex");var ul=u(((e,t)=>Hi(e,t&&t.filter((e=>"source.canvas"!==e.identifier)))),"emitValidationErrors"),SP=Gt(Ae,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),PP=Gt(Ae,["setCenter","setZoom","setBearing","setPitch"]),TP=Dh(),tr=class extends fe{constructor(e,t={}){super(),this.map=e,this.dispatcher=new xi(Gc(),this,e._getMapId()),this.imageManager=new Vs,this.imageManager.setEventedParent(this),this.glyphManager=new fn(e._requestManager,t.localIdeographFontFamily),this.lineAtlas=new qs(256,512),this.crossTileSymbolIndex=new In,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new Xi,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",So());let r=this;this._rtlTextPluginCallback=tr.registerForPluginStateChange((e=>{let t={pluginStatus:e.pluginStatus,pluginURL:e.pluginURL};r.dispatcher.broadcast("syncRTLPluginState",t,((e,t)=>{if(cc(e),t&&t.every((e=>e)))for(let e in r.sourceCaches){let t=r.sourceCaches[e].getSource().type;("vector"===t||"geojson"===t)&&r.sourceCaches[e].reload()}}))})),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let t=this.sourceCaches[e.sourceId];if(!t)return;let r=t.getSource();if(r&&r.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===r.id&&this._validateLayer(t)}}))}loadURL(e,t={},r){this.fire(new z("dataloading",{dataType:"style"})),t.validate="boolean"!=typeof t.validate||t.validate;let i=this.map._requestManager.transformRequest(e,Oe.Style);this._request=wr(i,((e,i)=>{this._request=null,e?this.fire(new Z(e)):i&&this._load(i,t,r)}))}loadJSON(e,t={},r){this.fire(new z("dataloading",{dataType:"style"})),this._request=ne.frame((()=>{this._request=null,t.validate=!1!==t.validate,this._load(e,t,r)}))}loadEmpty(){this.fire(new z("dataloading",{dataType:"style"})),this._load(TP,{validate:!1})}_load(e,t,r){let i=t.transformStyle?t.transformStyle(r,e):e;if(!t.validate||!ul(this,He(i))){this._loaded=!0,this.stylesheet=i;for(let e in i.sources)this.addSource(e,i.sources[e],{validate:!1});i.sprite?this._loadSprite(i.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(i.glyphs),this._createLayers(),this.light=new Ns(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new z("data",{dataType:"style"})),this.fire(new z("style.load"))}}_createLayers(){let e=$u(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",e),this._order=e.map((e=>e.id)),this._layers={},this._serializedLayers=null;for(let t of e){let e=Rs(t);e.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=e}}_loadSprite(e,t=!1,r){this.imageManager.setLoaded(!1),this._spriteRequest=dd(e,this.map._requestManager,this.map.getPixelRatio(),((e,i)=>{if(this._spriteRequest=null,e)this.fire(new Z(e));else if(i)for(let e in i){this._spritesImagesIds[e]=[];let r=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter((e=>!(e in i))):[];for(let e of r)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(let r in i[e]){let a="default"===e?r:`${e}:${r}`;this._spritesImagesIds[e].push(a),a in this.imageManager.images?this.imageManager.updateImage(a,i[e][r],!1):this.imageManager.addImage(a,i[e][r]),t&&(this._changedImages[a]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),t&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new z("data",{dataType:"style"})),r&&r(e)}))}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new z("data",{dataType:"style"}))}_validateLayer(e){let t=this.sourceCaches[e.source];if(!t)return;let r=e.sourceLayer;if(!r)return;let i=t.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new Z(new Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e){let t=this._serializedAllLayers();if(!e||0===e.length)return Object.values(t);let r=[];for(let i of e)t[i]&&r.push(t[i]);return r}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let r of t){let t=this._layers[r];"custom"!==t.type&&(e[r]=t.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(this._changed){let t=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);(t.length||r.length)&&this._updateWorkerLayers(t,r);for(let e in this._updatedSources){let t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}let r={};for(let e in this.sourceCaches){let t=this.sourceCaches[e];r[e]=t.used,t.used=!1}for(let t of this._order){let r=this._layers[t];r.recalculate(e,this._availableImages),!r.isHidden(e.zoom)&&r.source&&(this.sourceCaches[r.source].used=!0)}for(let e in r){let t=this.sourceCaches[e];r[e]!==t.used&&t.fire(new z("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,t&&this.fire(new z("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(e),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){this._checkLoaded();let r=this.serialize();if(e=t.transformStyle?t.transformStyle(r,e):e,ul(this,He(e)))return!1;(e=gt(e)).layers=$u(e.layers);let i=th(r,e).filter((e=>!(e.command in PP)));if(0===i.length)return!1;let a=i.filter((e=>!(e.command in SP)));if(a.length>0)throw new Error(`Unimplemented: ${a.map((e=>e.command)).join(", ")}.`);for(let e of i)"setTransition"!==e.command&&this[e.command].apply(this,e.args);return this.stylesheet=e,!0}addImage(e,t){if(this.getImage(e))return this.fire(new Z(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,t),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new Z(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new z("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!t.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(t).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(t.type)>=0&&this._validate(He.source,`sources.${e}`,t,null,r))return;this.map&&this.map._collectResourceTiming&&(t.collectResourceTiming=!0);let i=this.sourceCaches[e]=new At(e,t,this.dispatcher);i.style=this,i.setEventedParent(this,(()=>({isSourceLoaded:i.loaded(),source:i.serialize(),sourceId:e}))),i.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(let t in this._layers)if(this._layers[t].source===e)return this.fire(new Z(new Error(`Source "${e}" cannot be removed while layer "${t}" is using it.`)));let t=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],t.fire(new z("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error(`There is no source with this ID=${e}`);let r=this.sourceCaches[e].getSource();if("geojson"!==r.type)throw new Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,t,r={}){this._checkLoaded();let i,a=e.id;if(this.getLayer(a))return void this.fire(new Z(new Error(`Layer "${a}" already exists on this map.`)));if("custom"===e.type){if(ul(this,fd(e)))return;i=Rs(e)}else{if("object"==typeof e.source&&(this.addSource(a,e.source),e=R(e=gt(e),{source:a})),this._validate(He.layer,`layers.${a}`,e,{arrayIndex:-1},r))return;i=Rs(e),this._validateLayer(i),i.setEventedParent(this,{layer:{id:a}})}let n=t?this._order.indexOf(t):this._order.length;if(t&&-1===n)this.fire(new Z(new Error(`Cannot add layer "${a}" before non-existing layer "${t}".`)));else{if(this._order.splice(n,0,a),this._layerOrderChanged=!0,this._layers[a]=i,this._removedLayers[a]&&i.source&&"custom"!==i.type){let e=this._removedLayers[a];delete this._removedLayers[a],e.type!==i.type?this._updatedSources[i.source]="clear":(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause())}this._updateLayer(i),i.onAdd&&i.onAdd(this.map)}}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new Z(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===t)return;let r=this._order.indexOf(e);this._order.splice(r,1);let i=t?this._order.indexOf(t):this._order.length;t&&-1===i?this.fire(new Z(new Error(`Cannot move layer "${e}" before non-existing layer "${t}".`))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t)return void this.fire(new Z(new Error(`Cannot remove non-existing layer "${e}".`)));t.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,r){this._checkLoaded();let i=this.getLayer(e);i?i.minzoom===t&&i.maxzoom===r||(null!=t&&(i.minzoom=t),null!=r&&(i.maxzoom=r),this._updateLayer(i)):this.fire(new Z(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,t,r={}){this._checkLoaded();let i=this.getLayer(e);if(i){if(!ar(i.filter,t)){if(null==t)return i.filter=void 0,void this._updateLayer(i);this._validate(He.filter,`layers.${i.id}.filter`,t,null,r)||(i.filter=gt(t),this._updateLayer(i))}}else this.fire(new Z(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return gt(this.getLayer(e).filter)}setLayoutProperty(e,t,r,i={}){this._checkLoaded();let a=this.getLayer(e);a?ar(a.getLayoutProperty(t),r)||(a.setLayoutProperty(t,r,i),this._updateLayer(a)):this.fire(new Z(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,t){let r=this.getLayer(e);if(r)return r.getLayoutProperty(t);this.fire(new Z(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,t,r,i={}){this._checkLoaded();let a=this.getLayer(e);a?ar(a.getPaintProperty(t),r)||(a.setPaintProperty(t,r,i)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new Z(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let r=e.source,i=e.sourceLayer,a=this.sourceCaches[r];if(void 0===a)return void this.fire(new Z(new Error(`The source '${r}' does not exist in the map's style.`)));let n=a.getSource().type;"geojson"===n&&i?this.fire(new Z(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==n||i?(void 0===e.id&&this.fire(new Z(new Error("The feature id parameter must be provided."))),a.setFeatureState(i,e.id,t)):this.fire(new Z(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,t){this._checkLoaded();let r=e.source,i=this.sourceCaches[r];if(void 0===i)return void this.fire(new Z(new Error(`The source '${r}' does not exist in the map's style.`)));let a=i.getSource().type,n="vector"===a?e.sourceLayer:void 0;"vector"!==a||n?t&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new Z(new Error("A feature id is required to remove its specific state property."))):i.removeFeatureState(n,e.id,t):this.fire(new Z(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let t=e.source,r=e.sourceLayer,i=this.sourceCaches[t];if(void 0!==i){if("vector"!==i.getSource().type||r)return void 0===e.id&&this.fire(new Z(new Error("The feature id parameter must be provided."))),i.getFeatureState(r,e.id);this.fire(new Z(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new Z(new Error(`The source '${t}' does not exist in the map's style.`)))}getTransition(){return R({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=Rn(this.sourceCaches,(e=>e.serialize())),t=this._serializeByIds(this._order),r=this.stylesheet;return vo({version:r.version,name:r.name,metadata:r.metadata,light:r.light,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,transition:r.transition,sources:e,layers:t},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.sourceCaches[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=u((e=>"fill-extrusion"===this._layers[e].type),"isLayer3D"),r={},i=[];for(let a=this._order.length-1;a>=0;a--){let n=this._order[a];if(t(n)){r[n]=a;for(let t of e){let e=t[n];if(e)for(let t of e)i.push(t)}}}i.sort(((e,t)=>t.intersectionZ-e.intersectionZ));let a=[];for(let n=this._order.length-1;n>=0;n--){let s=this._order[n];if(t(s))for(let e=i.length-1;e>=0;e--){let t=i[e].feature;if(r[t.layer.id]<n)break;a.push(t),i.pop()}else for(let t of e){let e=t[s];if(e)for(let t of e)a.push(t.feature)}}return a}queryRenderedFeatures(e,t,r){t&&t.filter&&this._validate(He.filter,"queryRenderedFeatures.filter",t.filter,null,t);let i={};if(t&&t.layers){if(!Array.isArray(t.layers))return this.fire(new Z(new Error("parameters.layers must be an Array."))),[];for(let e of t.layers){let t=this._layers[e];if(!t)return this.fire(new Z(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];i[t.source]=!0}}let a=[];t.availableImages=this._availableImages;let n=this._serializedAllLayers();for(let s in this.sourceCaches)t.layers&&!i[s]||a.push(kd(this.sourceCaches[s],this._layers,n,e,t,r));return this.placement&&a.push(Ld(this._layers,n,this.sourceCaches,e,t,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,t){t&&t.filter&&this._validate(He.filter,"querySourceFeatures.filter",t.filter,null,t);let r=this.sourceCaches[e];return r?Dd(r,t):[]}addSourceType(e,t,r){return Nc(e)?r(new Error(`A source type called "${e}" already exists.`)):(Ed(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},r):r(null,null))}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let r=this.light.getLight(),i=!1;for(let t in e)if(!ar(e[t],r[t])){i=!0;break}if(!i)return;let a={now:ne.now(),transition:R({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(a)}_validate(e,t,r,i,a={}){return(!a||!1!==a.validate)&&ul(this,e.call(He,R({key:t,style:this.serialize(),value:r,styleSpec:C},i)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),Go.off("pluginStateChange",this._rtlTextPluginCallback);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.sourceCaches){let t=this.sourceCaches[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let t in this.sourceCaches)this.sourceCaches[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,t,r,i,a=!1){let n=!1,s=!1,o={};for(let t of this._order){let r=this._layers[t];if("symbol"!==r.type)continue;if(!o[r.source]){let e=this.sourceCaches[r.source];o[r.source]=e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}let i=this.crossTileSymbolIndex.addLayer(r,o[r.source],e.center.lng);n=n||i}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((a=a||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ne.now(),e.zoom))&&(this.pauseablePlacement=new ll(e,this.map.terrain,this._order,a,t,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,o),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ne.now()),s=!0),n&&this.pauseablePlacement.placement.setStale()),s||n)for(let e of this._order){let t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,o[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ne.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,t,r){this.imageManager.getImages(t.icons,r),this._updateTilesForChangedImages();let i=this.sourceCaches[t.source];i&&i.setDependencies(t.tileID.key,t.type,t.icons)}getGlyphs(e,t,r){this.glyphManager.getGlyphs(t.stacks,r);let i=this.sourceCaches[t.source];i&&i.setDependencies(t.tileID.key,t.type,[""])}getResource(e,t,r){return Mi(t,r)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),(!e||!this._validate(He.glyphs,"glyphs",e,null,t))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,t,r={},i){this._checkLoaded();let a=[{id:e,url:t}],n=[...mn(this.stylesheet.sprite),...a];this._validate(He.sprite,"sprite",n,null,r)||(this.stylesheet.sprite=n,this._loadSprite(a,!0,i))}removeSprite(e){this._checkLoaded();let t=mn(this.stylesheet.sprite);if(t.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(let t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;t.splice(t.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=t.length>0?t:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new z("data",{dataType:"style"}))}else this.fire(new Z(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return mn(this.stylesheet.sprite)}setSprite(e,t={},r){this._checkLoaded(),(!e||!this._validate(He.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}};u(tr,"Style"),tr.registerForPluginStateChange=im,d(),d();var cl=ve([{name:"a_pos",type:"Int16",components:2}]);d(),d();var iy="#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n";d();var ny="#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}";d();var ay="uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var oy="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";d();var sy="uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var ly="uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}";d();var uy="varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var cy="uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}";d();var py="void main() {gl_FragColor=vec4(1.0);}";d();var hy="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";d();var my="uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var fy="uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}";d();var dy="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}";d();var yy="uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}";d();var gy="varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}";d();var xy="attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}";d();var _y="varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}";d();var by="attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}";d();var vy="uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}";d();var wy="attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}";d();var Sy="#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Py="attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}";d();var Ty="varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Ay="attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";d();var Iy="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Cy="uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";d();var My="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Ey="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}";d();var ky="varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Ly="uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}";d();var Dy="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var zy="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}";d();var Fy="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var By="uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}";d();var Ry="uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Oy="uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}";d();var Vy="uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Uy="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";d();var Ny="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var qy="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";d();var $y="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Gy="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}";d();var jy="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Hy="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}";d();var Zy="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Wy="uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}";d();var Xy="uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Ky="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}";d();var Yy="#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Jy="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}";d();var Qy="#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var eg="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}";d();var tg="varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}";d();var rg="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}";d();var ig="uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}";d();var pl="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}",Pi={prelude:ze(iy,ny),background:ze(ay,oy),backgroundPattern:ze(sy,ly),circle:ze(uy,cy),clippingMask:ze(py,hy),heatmap:ze(my,fy),heatmapTexture:ze(dy,yy),collisionBox:ze(gy,xy),collisionCircle:ze(_y,by),debug:ze(vy,wy),fill:ze(Sy,Py),fillOutline:ze(Ty,Ay),fillOutlinePattern:ze(Iy,Cy),fillPattern:ze(My,Ey),fillExtrusion:ze(ky,Ly),fillExtrusionPattern:ze(Dy,zy),hillshadePrepare:ze(Fy,By),hillshade:ze(Ry,Oy),line:ze(Vy,Uy),lineGradient:ze(Ny,qy),linePattern:ze($y,Gy),lineSDF:ze(jy,Hy),raster:ze(Zy,Wy),symbolIcon:ze(Xy,Ky),symbolSDF:ze(Yy,Jy),symbolTextAndIcon:ze(Qy,eg),terrain:ze(ig,pl),terrainDepth:ze(tg,pl),terrainCoords:ze(rg,pl)};function ze(e,t){let r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=t.match(/attribute ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=n?n.concat(a):a,o={};return{fragmentSource:e=e.replace(r,((e,t,r,i,a)=>(o[a]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nvarying ${r} ${i} ${a};\n#else\nuniform ${r} ${i} u_${a};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${a}\n ${r} ${i} ${a} = u_${a};\n#endif\n`))),vertexSource:t=t.replace(r,((e,t,r,i,a)=>{let n="float"===i?"vec2":"vec4",s=a.match(/color/)?"color":n;return o[a]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${r} ${n} a_${a};\nvarying ${r} ${i} ${a};\n#else\nuniform ${r} ${i} u_${a};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = a_${a};\n#else\n ${r} ${i} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = unpack_mix_${s}(a_${a}, u_${a}_t);\n#else\n ${r} ${i} ${a} = u_${a};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${r} ${n} a_${a};\n#else\nuniform ${r} ${i} u_${a};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${a}\n ${r} ${i} ${a} = a_${a};\n#else\n ${r} ${i} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${r} ${i} ${a} = unpack_mix_${s}(a_${a}, u_${a}_t);\n#else\n ${r} ${i} ${a} = u_${a};\n#endif\n`})),staticAttributes:i,staticUniforms:s}}u(ze,"compile"),d(),d();var hl=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,r,i,a,n,s,o,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==i.length;for(let e=0;!u&&e<i.length;e++)this.boundPaintVertexBuffers[e]!==i[e]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==r||u||this.boundIndexBuffer!==a||this.boundVertexOffset!==n||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==o||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,r,i,a,n,s,o,l):(e.bindVertexArray.set(this.vao),s&&s.bind(),a&&a.dynamicDraw&&a.bind(),o&&o.bind(),l&&l.bind())}freshBind(e,t,r,i,a,n,s,o){let l=e.numAttributes,u=this.context,h=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=n,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=o,t.enableAttributes(h,e);for(let t of r)t.enableAttributes(h,e);n&&n.enableAttributes(h,e),s&&s.enableAttributes(h,e),o&&o.enableAttributes(h,e),t.bind(),t.setVertexAttribPointers(h,e,a);for(let t of r)t.bind(),t.setVertexAttribPointers(h,e,a);n&&(n.bind(),n.setVertexAttribPointers(h,e,a)),i&&i.bind(),s&&(s.bind(),s.setVertexAttribPointers(h,e,a)),o&&(o.bind(),o.setVertexAttribPointers(h,e,a)),u.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};u(hl,"VertexArrayObject"),d();var ng=u(((e,t)=>({u_depth:new Y(e,t.u_depth),u_terrain:new Y(e,t.u_terrain),u_terrain_dim:new V(e,t.u_terrain_dim),u_terrain_matrix:new te(e,t.u_terrain_matrix),u_terrain_unpack:new Fr(e,t.u_terrain_unpack),u_terrain_exaggeration:new V(e,t.u_terrain_exaggeration)})),"terrainPreludeUniforms"),ag=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_texture:new Y(e,t.u_texture),u_ele_delta:new V(e,t.u_ele_delta)})),"terrainUniforms"),og=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_ele_delta:new V(e,t.u_ele_delta)})),"terrainDepthUniforms"),sg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_texture:new Y(e,t.u_texture),u_terrain_coords_id:new V(e,t.u_terrain_coords_id),u_ele_delta:new V(e,t.u_ele_delta)})),"terrainCoordsUniforms"),lg=u(((e,t)=>({u_matrix:e,u_texture:0,u_ele_delta:t})),"terrainUniformValues"),ug=u(((e,t)=>({u_matrix:e,u_ele_delta:t})),"terrainDepthUniformValues"),cg=u(((e,t,r)=>({u_matrix:e,u_terrain_coords_id:t/255,u_texture:0,u_ele_delta:r})),"terrainCoordsUniformValues");function op(e){let t=[];for(let r=0;r<e.length;r++){if(null===e[r])continue;let i=e[r].split(" ");t.push(i.pop())}return t}u(op,"getTokenizedAttributesAndUniforms");var ml=class{constructor(e,t,r,i,a,n){let s=e.gl;this.program=s.createProgram();let o=op(t.staticAttributes),l=r?r.getBinderAttributes():[],u=o.concat(l),h=Pi.prelude.staticUniforms?op(Pi.prelude.staticUniforms):[],c=t.staticUniforms?op(t.staticUniforms):[],p=r?r.getBinderUniforms():[],d=h.concat(c).concat(p),f=[];for(let e of d)f.indexOf(e)<0&&f.push(e);let m=r?r.defines():[];a&&m.push("#define OVERDRAW_INSPECTOR;"),n&&m.push("#define TERRAIN3D;");let y=m.concat(Pi.prelude.fragmentSource,t.fragmentSource).join("\n"),g=m.concat(Pi.prelude.vertexSource,t.vertexSource).join("\n"),_=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);s.shaderSource(_,y),s.compileShader(_),s.attachShader(this.program,_);let x=s.createShader(s.VERTEX_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);s.shaderSource(x,g),s.compileShader(x),s.attachShader(this.program,x),this.attributes={};let v={};this.numAttributes=u.length;for(let e=0;e<this.numAttributes;e++)u[e]&&(s.bindAttribLocation(this.program,e,u[e]),this.attributes[u[e]]=e);s.linkProgram(this.program),s.deleteShader(x),s.deleteShader(_);for(let e=0;e<f.length;e++){let t=f[e];if(t&&!v[t]){let e=s.getUniformLocation(this.program,t);e&&(v[t]=e)}}this.fixedUniforms=i(e,v),this.terrainUniforms=ng(e,v),this.binderUniforms=r?r.getUniforms(e,v):[]}draw(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,y,g){let _=e.gl;if(this.failedToCreate)return;e.program.set(this.program),e.setDepthMode(r),e.setStencilMode(i),e.setColorMode(a),e.setCullFace(n);for(let e in this.fixedUniforms)this.fixedUniforms[e].set(s[e]);f&&f.setUniforms(e,this.binderUniforms,p,{zoom:d});let x=0;switch(t){case _.LINES:x=2;break;case _.TRIANGLES:x=3;break;case _.LINE_STRIP:x=1}for(let r of c.get()){let i=r.vaos||(r.vaos={});(i[l]||(i[l]=new hl)).bind(e,this,u,f?f.getPaintVertexBuffers():[],h,r.vertexOffset,m,y,g),_.drawElements(t,r.primitiveLength*x,_.UNSIGNED_SHORT,r.primitiveOffset*x*2)}}};function fl(e,t,r){let i=1/et(r,1,t.transform.tileZoom),a=Math.pow(2,r.tileID.overscaledZ),n=r.tileSize*Math.pow(2,t.transform.tileZoom)/a,s=n*(r.tileID.canonical.x+r.tileID.wrap*a),o=n*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[i,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,o>>16],u_pixel_coord_lower:[65535&s,65535&o]}}function pg(e,t,r,i){let a=r.imageManager.getPattern(e.from.toString()),n=r.imageManager.getPattern(e.to.toString()),{width:s,height:o}=r.imageManager.getPixelSize(),l=Math.pow(2,i.tileID.overscaledZ),u=i.tileSize*Math.pow(2,r.transform.tileZoom)/l,h=u*(i.tileID.canonical.x+i.tileID.wrap*l),c=u*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:n.tl,u_pattern_br_b:n.br,u_texsize:[s,o],u_mix:t.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:n.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/et(i,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,c>>16],u_pixel_coord_lower:[65535&h,65535&c]}}u(ml,"Program"),d(),d(),d(),u(fl,"patternUniformValues"),u(pg,"bgPatternUniformValues");var hg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_lightpos:new yt(e,t.u_lightpos),u_lightintensity:new V(e,t.u_lightintensity),u_lightcolor:new yt(e,t.u_lightcolor),u_vertical_gradient:new V(e,t.u_vertical_gradient),u_opacity:new V(e,t.u_opacity)})),"fillExtrusionUniforms"),mg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_lightpos:new yt(e,t.u_lightpos),u_lightintensity:new V(e,t.u_lightintensity),u_lightcolor:new yt(e,t.u_lightcolor),u_vertical_gradient:new V(e,t.u_vertical_gradient),u_height_factor:new V(e,t.u_height_factor),u_image:new Y(e,t.u_image),u_texsize:new ee(e,t.u_texsize),u_pixel_coord_upper:new ee(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ee(e,t.u_pixel_coord_lower),u_scale:new yt(e,t.u_scale),u_fade:new V(e,t.u_fade),u_opacity:new V(e,t.u_opacity)})),"fillExtrusionPatternUniforms"),sp=u(((e,t,r,i)=>{let a=t.style.light,n=a.properties.get("position"),s=[n.x,n.y,n.z],o=Ba.create();"viewport"===a.properties.get("anchor")&&Ba.fromRotation(o,-t.transform.angle),Pt.transformMat3(s,s,o);let l=a.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+r,u_opacity:i}}),"fillExtrusionUniformValues"),fg=u(((e,t,r,i,a,n,s)=>R(sp(e,t,r,i),fl(n,t,s),{u_height_factor:-Math.pow(2,a.overscaledZ)/s.tileSize/8})),"fillExtrusionPatternUniformValues");d();var dg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix)})),"fillUniforms"),yg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_image:new Y(e,t.u_image),u_texsize:new ee(e,t.u_texsize),u_pixel_coord_upper:new ee(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ee(e,t.u_pixel_coord_lower),u_scale:new yt(e,t.u_scale),u_fade:new V(e,t.u_fade)})),"fillPatternUniforms"),gg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_world:new ee(e,t.u_world)})),"fillOutlineUniforms"),xg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_world:new ee(e,t.u_world),u_image:new Y(e,t.u_image),u_texsize:new ee(e,t.u_texsize),u_pixel_coord_upper:new ee(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ee(e,t.u_pixel_coord_lower),u_scale:new yt(e,t.u_scale),u_fade:new V(e,t.u_fade)})),"fillOutlinePatternUniforms"),lp=u((e=>({u_matrix:e})),"fillUniformValues"),up=u(((e,t,r,i)=>R(lp(e),fl(r,t,i))),"fillPatternUniformValues"),_g=u(((e,t)=>({u_matrix:e,u_world:t})),"fillOutlineUniformValues"),bg=u(((e,t,r,i,a)=>R(up(e,t,r,i),{u_world:a})),"fillOutlinePatternUniformValues");d();var vg=u(((e,t)=>({u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_scale_with_map:new Y(e,t.u_scale_with_map),u_pitch_with_map:new Y(e,t.u_pitch_with_map),u_extrude_scale:new ee(e,t.u_extrude_scale),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_matrix:new te(e,t.u_matrix)})),"circleUniforms"),wg=u(((e,t,r,i)=>{let a,n,s=e.transform;if("map"===i.paint.get("circle-pitch-alignment")){let e=et(r,1,s.zoom);a=!0,n=[e,e]}else a=!1,n=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(t.posMatrix,r,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+a,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:n}}),"circleUniformValues");d();var Sg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_pixels_to_tile_units:new V(e,t.u_pixels_to_tile_units),u_extrude_scale:new ee(e,t.u_extrude_scale),u_overscale_factor:new V(e,t.u_overscale_factor)})),"collisionUniforms"),Pg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_inv_matrix:new te(e,t.u_inv_matrix),u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_viewport_size:new ee(e,t.u_viewport_size)})),"collisionCircleUniforms"),Tg=u(((e,t,r)=>{let i=et(r,1,t.zoom),a=Math.pow(2,t.zoom-r.tileID.overscaledZ),n=r.tileID.overscaleFactor();return{u_matrix:e,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:i,u_extrude_scale:[t.pixelsToGLUnits[0]/(i*a),t.pixelsToGLUnits[1]/(i*a)],u_overscale_factor:n}}),"collisionUniformValues"),Ag=u(((e,t,r)=>({u_matrix:e,u_inv_matrix:t,u_camera_to_center_distance:r.cameraToCenterDistance,u_viewport_size:[r.width,r.height]})),"collisionCircleUniformValues");d();var Ig=u(((e,t)=>({u_color:new Ut(e,t.u_color),u_matrix:new te(e,t.u_matrix),u_overlay:new Y(e,t.u_overlay),u_overlay_scale:new V(e,t.u_overlay_scale)})),"debugUniforms"),cp=u(((e,t,r=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:r})),"debugUniformValues");d();var Cg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix)})),"clippingMaskUniforms"),pp=u((e=>({u_matrix:e})),"clippingMaskUniformValues");d();var Mg=u(((e,t)=>({u_extrude_scale:new V(e,t.u_extrude_scale),u_intensity:new V(e,t.u_intensity),u_matrix:new te(e,t.u_matrix)})),"heatmapUniforms"),Eg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_world:new ee(e,t.u_world),u_image:new Y(e,t.u_image),u_color_ramp:new Y(e,t.u_color_ramp),u_opacity:new V(e,t.u_opacity)})),"heatmapTextureUniforms"),kg=u(((e,t,r,i)=>({u_matrix:e,u_extrude_scale:et(t,1,r),u_intensity:i})),"heatmapUniformValues"),Lg=u(((e,t,r,i)=>{let a=$.create();$.ortho(a,0,e.width,e.height,0,0,1);let n=e.context.gl;return{u_matrix:a,u_world:[n.drawingBufferWidth,n.drawingBufferHeight],u_image:r,u_color_ramp:i,u_opacity:t.paint.get("heatmap-opacity")}}),"heatmapTextureUniformValues");d();var Dg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_image:new Y(e,t.u_image),u_latrange:new ee(e,t.u_latrange),u_light:new ee(e,t.u_light),u_shadow:new Ut(e,t.u_shadow),u_highlight:new Ut(e,t.u_highlight),u_accent:new Ut(e,t.u_accent)})),"hillshadeUniforms"),zg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_image:new Y(e,t.u_image),u_dimension:new ee(e,t.u_dimension),u_zoom:new V(e,t.u_zoom),u_unpack:new Fr(e,t.u_unpack)})),"hillshadePrepareUniforms"),Fg=u(((e,t,r,i)=>{let a=r.paint.get("hillshade-shadow-color"),n=r.paint.get("hillshade-highlight-color"),s=r.paint.get("hillshade-accent-color"),o=r.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===r.paint.get("hillshade-illumination-anchor")&&(o-=e.transform.angle);let l=!e.options.moving;return{u_matrix:i?i.posMatrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:AP(e,t.tileID),u_light:[r.paint.get("hillshade-exaggeration"),o],u_shadow:a,u_highlight:n,u_accent:s}}),"hillshadeUniformValues"),Bg=u(((e,t)=>{let r=t.stride,i=$.create();return $.ortho(i,0,O,-O,0,0,1),$.translate(i,i,[0,-O,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}}),"hillshadeUniformPrepareValues");function AP(e,t){let r=Math.pow(2,t.canonical.z),i=t.canonical.y;return[new Ee(0,i/r).toLngLat().lat,new Ee(0,(i+1)/r).toLngLat().lat]}u(AP,"getTileLatRange"),d();var Rg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_ratio:new V(e,t.u_ratio),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_units_to_pixels:new ee(e,t.u_units_to_pixels)})),"lineUniforms"),Og=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_ratio:new V(e,t.u_ratio),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_units_to_pixels:new ee(e,t.u_units_to_pixels),u_image:new Y(e,t.u_image),u_image_height:new V(e,t.u_image_height)})),"lineGradientUniforms"),Vg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_texsize:new ee(e,t.u_texsize),u_ratio:new V(e,t.u_ratio),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_image:new Y(e,t.u_image),u_units_to_pixels:new ee(e,t.u_units_to_pixels),u_scale:new yt(e,t.u_scale),u_fade:new V(e,t.u_fade)})),"linePatternUniforms"),Ug=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_ratio:new V(e,t.u_ratio),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_units_to_pixels:new ee(e,t.u_units_to_pixels),u_patternscale_a:new ee(e,t.u_patternscale_a),u_patternscale_b:new ee(e,t.u_patternscale_b),u_sdfgamma:new V(e,t.u_sdfgamma),u_image:new Y(e,t.u_image),u_tex_y_a:new V(e,t.u_tex_y_a),u_tex_y_b:new V(e,t.u_tex_y_b),u_mix:new V(e,t.u_mix)})),"lineSDFUniforms"),dl=u(((e,t,r,i)=>{let a=e.transform;return{u_matrix:jg(e,t,r,i),u_ratio:1/et(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}}),"lineUniformValues"),Ng=u(((e,t,r,i,a)=>R(dl(e,t,r,a),{u_image:0,u_image_height:i})),"lineGradientUniformValues"),qg=u(((e,t,r,i,a)=>{let n=e.transform,s=Gg(t,n);return{u_matrix:jg(e,t,r,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/et(t,1,n.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[s,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}}),"linePatternUniformValues"),$g=u(((e,t,r,i,a,n)=>{let s=e.transform,o=e.lineAtlas,l=Gg(t,s),u="round"===r.layout.get("line-cap"),h=o.getDash(i.from,u),c=o.getDash(i.to,u),p=h.width*a.fromScale,d=c.width*a.toScale;return R(dl(e,t,r,n),{u_patternscale_a:[l/p,-h.height/2],u_patternscale_b:[l/d,-c.height/2],u_sdfgamma:o.width/(256*Math.min(p,d)*e.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:c.y,u_mix:a.t})}),"lineSDFUniformValues");function Gg(e,t){return 1/et(e,1,t.tileZoom)}function jg(e,t,r,i){return e.translatePosMatrix(i?i.posMatrix:t.tileID.posMatrix,t,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}u(Gg,"calculateTileRatio"),u(jg,"calculateMatrix"),d();var Hg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_tl_parent:new ee(e,t.u_tl_parent),u_scale_parent:new V(e,t.u_scale_parent),u_buffer_scale:new V(e,t.u_buffer_scale),u_fade_t:new V(e,t.u_fade_t),u_opacity:new V(e,t.u_opacity),u_image0:new Y(e,t.u_image0),u_image1:new Y(e,t.u_image1),u_brightness_low:new V(e,t.u_brightness_low),u_brightness_high:new V(e,t.u_brightness_high),u_saturation_factor:new V(e,t.u_saturation_factor),u_contrast_factor:new V(e,t.u_contrast_factor),u_spin_weights:new yt(e,t.u_spin_weights)})),"rasterUniforms"),Zg=u(((e,t,r,i,a)=>({u_matrix:e,u_tl_parent:t,u_scale_parent:r,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:MP(a.paint.get("raster-saturation")),u_contrast_factor:CP(a.paint.get("raster-contrast")),u_spin_weights:IP(a.paint.get("raster-hue-rotate"))})),"rasterUniformValues");function IP(e){e*=Math.PI/180;let t=Math.sin(e),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}function CP(e){return e>0?1/(1-e):1+e}function MP(e){return e>0?1-1/(1.001-e):-e}u(IP,"spinWeights"),u(CP,"contrastFactor"),u(MP,"saturationFactor"),d();var Wg=u(((e,t)=>({u_is_size_zoom_constant:new Y(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Y(e,t.u_is_size_feature_constant),u_size_t:new V(e,t.u_size_t),u_size:new V(e,t.u_size),u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_pitch:new V(e,t.u_pitch),u_rotate_symbol:new Y(e,t.u_rotate_symbol),u_aspect_ratio:new V(e,t.u_aspect_ratio),u_fade_change:new V(e,t.u_fade_change),u_matrix:new te(e,t.u_matrix),u_label_plane_matrix:new te(e,t.u_label_plane_matrix),u_coord_matrix:new te(e,t.u_coord_matrix),u_is_text:new Y(e,t.u_is_text),u_pitch_with_map:new Y(e,t.u_pitch_with_map),u_texsize:new ee(e,t.u_texsize),u_texture:new Y(e,t.u_texture)})),"symbolIconUniforms"),Xg=u(((e,t)=>({u_is_size_zoom_constant:new Y(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Y(e,t.u_is_size_feature_constant),u_size_t:new V(e,t.u_size_t),u_size:new V(e,t.u_size),u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_pitch:new V(e,t.u_pitch),u_rotate_symbol:new Y(e,t.u_rotate_symbol),u_aspect_ratio:new V(e,t.u_aspect_ratio),u_fade_change:new V(e,t.u_fade_change),u_matrix:new te(e,t.u_matrix),u_label_plane_matrix:new te(e,t.u_label_plane_matrix),u_coord_matrix:new te(e,t.u_coord_matrix),u_is_text:new Y(e,t.u_is_text),u_pitch_with_map:new Y(e,t.u_pitch_with_map),u_texsize:new ee(e,t.u_texsize),u_texture:new Y(e,t.u_texture),u_gamma_scale:new V(e,t.u_gamma_scale),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_is_halo:new Y(e,t.u_is_halo)})),"symbolSDFUniforms"),Kg=u(((e,t)=>({u_is_size_zoom_constant:new Y(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Y(e,t.u_is_size_feature_constant),u_size_t:new V(e,t.u_size_t),u_size:new V(e,t.u_size),u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_pitch:new V(e,t.u_pitch),u_rotate_symbol:new Y(e,t.u_rotate_symbol),u_aspect_ratio:new V(e,t.u_aspect_ratio),u_fade_change:new V(e,t.u_fade_change),u_matrix:new te(e,t.u_matrix),u_label_plane_matrix:new te(e,t.u_label_plane_matrix),u_coord_matrix:new te(e,t.u_coord_matrix),u_is_text:new Y(e,t.u_is_text),u_pitch_with_map:new Y(e,t.u_pitch_with_map),u_texsize:new ee(e,t.u_texsize),u_texsize_icon:new ee(e,t.u_texsize_icon),u_texture:new Y(e,t.u_texture),u_texture_icon:new Y(e,t.u_texture_icon),u_gamma_scale:new V(e,t.u_gamma_scale),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_is_halo:new Y(e,t.u_is_halo)})),"symbolTextAndIconUniforms"),hp=u(((e,t,r,i,a,n,s,o,l,u)=>{let h=a.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:h.width/h.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_matrix:n,u_label_plane_matrix:s,u_coord_matrix:o,u_is_text:+l,u_pitch_with_map:+i,u_texsize:u,u_texture:0}}),"symbolIconUniformValues"),mp=u(((e,t,r,i,a,n,s,o,l,u,h)=>{let c=a.transform;return R(hp(e,t,r,i,a,n,s,o,l,u),{u_gamma_scale:i?Math.cos(c._pitch)*c.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:+h})}),"symbolSDFUniformValues"),Yg=u(((e,t,r,i,a,n,s,o,l,u)=>R(mp(e,t,r,i,a,n,s,o,!0,l,!0),{u_texsize_icon:u,u_texture_icon:1})),"symbolTextAndIconUniformValues");d();var Jg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_opacity:new V(e,t.u_opacity),u_color:new Ut(e,t.u_color)})),"backgroundUniforms"),Qg=u(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_opacity:new V(e,t.u_opacity),u_image:new Y(e,t.u_image),u_pattern_tl_a:new ee(e,t.u_pattern_tl_a),u_pattern_br_a:new ee(e,t.u_pattern_br_a),u_pattern_tl_b:new ee(e,t.u_pattern_tl_b),u_pattern_br_b:new ee(e,t.u_pattern_br_b),u_texsize:new ee(e,t.u_texsize),u_mix:new V(e,t.u_mix),u_pattern_size_a:new ee(e,t.u_pattern_size_a),u_pattern_size_b:new ee(e,t.u_pattern_size_b),u_scale_a:new V(e,t.u_scale_a),u_scale_b:new V(e,t.u_scale_b),u_pixel_coord_upper:new ee(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ee(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new V(e,t.u_tile_units_to_pixels)})),"backgroundPatternUniforms"),ex=u(((e,t,r)=>({u_matrix:e,u_opacity:t,u_color:r})),"backgroundUniformValues"),tx=u(((e,t,r,i,a,n)=>R(pg(i,n,r,a),{u_matrix:e,u_opacity:t})),"backgroundPatternUniformValues"),rx={fillExtrusion:hg,fillExtrusionPattern:mg,fill:dg,fillPattern:yg,fillOutline:gg,fillOutlinePattern:xg,circle:vg,collisionBox:Sg,collisionCircle:Pg,debug:Ig,clippingMask:Cg,heatmap:Mg,heatmapTexture:Eg,hillshade:Dg,hillshadePrepare:zg,line:Rg,lineGradient:Og,linePattern:Vg,lineSDF:Ug,raster:Hg,symbolIcon:Wg,symbolSDF:Xg,symbolTextAndIcon:Kg,background:Jg,backgroundPattern:Qg,terrain:ag,terrainDepth:og,terrainCoords:sg};d(),d();var yl=class{constructor(e,t,r){this.context=e;let i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};u(yl,"IndexBuffer"),d();var EP={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},gl=class{constructor(e,t,r,i){this.length=t.length,this.attributes=r,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let r=0;r<this.attributes.length;r++){let i=this.attributes[r],a=t.attributes[i.name];void 0!==a&&e.enableVertexAttribArray(a)}}setVertexAttribPointers(e,t,r){for(let i=0;i<this.attributes.length;i++){let a=this.attributes[i],n=t.attributes[a.name];void 0!==n&&e.vertexAttribPointer(n,a.components,e[EP[a.type]],!1,this.itemSize,a.offset+this.itemSize*(r||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};u(gl,"VertexBuffer"),d(),d(),d();var fp=new WeakMap;function Cn(e){if(fp.has(e))return fp.get(e);{let t=e.getParameter(e.VERSION).startsWith("WebGL 2.0");return fp.set(e,t),t}}u(Cn,"isWebGL2");var ge=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}};u(ge,"BaseValue");var xl=class extends ge{getDefault(){return X.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}};u(xl,"ClearColor");var _l=class extends ge{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}};u(_l,"ClearDepth");var bl=class extends ge{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}};u(bl,"ClearStencil");var vl=class extends ge{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}};u(vl,"ColorMask");var wl=class extends ge{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}};u(wl,"DepthMask");var Sl=class extends ge{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}};u(Sl,"StencilMask");var Pl=class extends ge{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;e.func===t.func&&e.ref===t.ref&&e.mask===t.mask&&!this.dirty||(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}};u(Pl,"StencilFunc");var Tl=class extends ge{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&!this.dirty||(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}};u(Tl,"StencilOp");var Al=class extends ge{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}};u(Al,"StencilTest");var Il=class extends ge{getDefault(){return[0,1]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}};u(Il,"DepthRange");var Cl=class extends ge{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}};u(Cl,"DepthTest");var Ml=class extends ge{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}};u(Ml,"DepthFunc");var El=class extends ge{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}};u(El,"Blend");var kl=class extends ge{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}};u(kl,"BlendFunc");var Ll=class extends ge{getDefault(){return X.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}};u(Ll,"BlendColor");var Dl=class extends ge{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}};u(Dl,"BlendEquation");var zl=class extends ge{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}};u(zl,"CullFace");var Fl=class extends ge{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}};u(Fl,"CullFaceSide");var Bl=class extends ge{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}};u(Bl,"FrontFace");var Rl=class extends ge{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};u(Rl,"ProgramValue");var Ol=class extends ge{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}};u(Ol,"ActiveTextureUnit");var Vl=class extends ge{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}};u(Vl,"Viewport");var Ul=class extends ge{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}};u(Ul,"BindFramebuffer");var Nl=class extends ge{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}};u(Nl,"BindRenderbuffer");var ql=class extends ge{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}};u(ql,"BindTexture");var $l=class extends ge{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}};u($l,"BindVertexBuffer");var Gl=class extends ge{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}};u(Gl,"BindElementBuffer");var jl=class extends ge{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;let r=this.gl;Cn(r)?r.bindVertexArray(e):null==(t=r.getExtension("OES_vertex_array_object"))||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}};u(jl,"BindVertexArray");var Hl=class extends ge{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}};u(Hl,"PixelStoreUnpack");var Zl=class extends ge{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}};u(Zl,"PixelStoreUnpackPremultiplyAlpha");var Wl=class extends ge{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}};u(Wl,"PixelStoreUnpackFlipY");var uo=class extends ge{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}};u(uo,"FramebufferAttachment");var Xl=class extends uo{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}};u(Xl,"ColorAttachment");var Kl=class extends uo{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}};u(Kl,"DepthAttachment");var Yl=class extends uo{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}};u(Yl,"DepthStencilAttachment");var Jl=class{constructor(e,t,r,i,a){this.context=e,this.width=t,this.height=r;let n=e.gl,s=this.framebuffer=n.createFramebuffer();if(this.colorAttachment=new Xl(e,s),i)this.depthAttachment=a?new Yl(e,s):new Kl(e,s);else if(a)throw new Error("Stencil cannot be setted without depth");if(n.checkFramebufferStatus(n.FRAMEBUFFER)!==n.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}};u(Jl,"Framebuffer"),d();var kP=0,ix=1,LP=771,Fe=class{constructor(e,t,r){this.blendFunction=e,this.blendColor=t,this.mask=r}};u(Fe,"ColorMode"),Fe.Replace=[ix,kP],Fe.disabled=new Fe(Fe.Replace,X.transparent,[!1,!1,!1,!1]),Fe.unblended=new Fe(Fe.Replace,X.transparent,[!0,!0,!0,!0]),Fe.alphaBlended=new Fe([ix,LP],X.transparent,[!0,!0,!0,!0]);var Ql=class{constructor(e){var t,r;if(this.gl=e,this.clearColor=new xl(this),this.clearDepth=new _l(this),this.clearStencil=new bl(this),this.colorMask=new vl(this),this.depthMask=new wl(this),this.stencilMask=new Sl(this),this.stencilFunc=new Pl(this),this.stencilOp=new Tl(this),this.stencilTest=new Al(this),this.depthRange=new Il(this),this.depthTest=new Cl(this),this.depthFunc=new Ml(this),this.blend=new El(this),this.blendFunc=new kl(this),this.blendColor=new Ll(this),this.blendEquation=new Dl(this),this.cullFace=new zl(this),this.cullFaceSide=new Fl(this),this.frontFace=new Bl(this),this.program=new Rl(this),this.activeTexture=new Ol(this),this.viewport=new Vl(this),this.bindFramebuffer=new Ul(this),this.bindRenderbuffer=new Nl(this),this.bindTexture=new ql(this),this.bindVertexBuffer=new $l(this),this.bindElementBuffer=new Gl(this),this.bindVertexArray=new jl(this),this.pixelStoreUnpack=new Hl(this),this.pixelStoreUnpackPremultiplyAlpha=new Zl(this),this.pixelStoreUnpackFlipY=new Wl(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),Cn(e)){this.HALF_FLOAT=e.HALF_FLOAT;let i=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!=(t=e.RGBA16F)?t:null==i?void 0:i.RGBA16F_EXT,this.RGB16F=null!=(r=e.RGB16F)?r:null==i?void 0:i.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let t=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==t?void 0:t.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new yl(this,e,t)}createVertexBuffer(e,t,r){return new gl(this,e,t,r)}createRenderbuffer(e,t,r){let i=this.gl,a=i.createRenderbuffer();return this.bindRenderbuffer.set(a),i.renderbufferStorage(i.RENDERBUFFER,e,t,r),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,r,i){return new Jl(this,e,t,r,i)}clear({color:e,depth:t,stencil:r}){let i=this.gl,a=0;e&&(a|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(a|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==r&&(a|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(a)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){ar(e.blendFunction,Fe.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return Cn(this.gl)?this.gl.createVertexArray():null==(e=this.gl.getExtension("OES_vertex_array_object"))?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return Cn(this.gl)?this.gl.deleteVertexArray(e):null==(t=this.gl.getExtension("OES_vertex_array_object"))?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}};u(Ql,"Context"),d();var DP=519,Q=class{constructor(e,t,r){this.func=e,this.mask=t,this.range=r}};u(Q,"DepthMode"),Q.ReadOnly=!1,Q.ReadWrite=!0,Q.disabled=new Q(DP,Q.ReadOnly,[0,1]),d();var zP=519,dp=7680,me=class{constructor(e,t,r,i,a,n){this.test=e,this.ref=t,this.mask=r,this.fail=i,this.depthFail=a,this.pass=n}};u(me,"StencilMode"),me.disabled=new me({func:zP,mask:0},0,0,dp,dp,dp),d();var nx=1029,ax=2305,ue=class{constructor(e,t,r){this.enable=e,this.mode=t,this.frontFace=r}};u(ue,"CullFaceMode"),ue.disabled=new ue(!1,nx,ax),ue.backCCW=new ue(!0,nx,ax),d();var eu,gp=ae(Pe());function yp(e,t,r,i,a,n,s){let o=e.context,l=o.gl,u=e.useProgram("collisionBox"),h=[],c=0,p=0;for(let d=0;d<i.length;d++){let f=i[d],m=t.getTile(f),y=m.getBucket(r);if(!y)continue;let g=f.posMatrix;(0!==a[0]||0!==a[1])&&(g=e.translatePosMatrix(f.posMatrix,m,a,n));let _=s?y.textCollisionBox:y.iconCollisionBox,x=y.collisionCircleArray;if(x.length>0){let t=$.create(),r=g;$.mul(t,y.placementInvProjMatrix,e.transform.glCoordMatrix),$.mul(t,t,y.placementViewportMatrix),h.push({circleArray:x,circleOffset:p,transform:r,invTransform:t,coord:f}),c+=x.length/4,p=c}!_||u.draw(o,l.LINES,Q.disabled,me.disabled,e.colorModeForRenderPass(),ue.disabled,Tg(g,e.transform,m),e.style.map.terrain&&e.style.map.terrain.getTerrainData(f),r.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,null,e.transform.zoom,null,null,_.collisionVertexBuffer)}if(!s||!h.length)return;let d=e.useProgram("collisionCircle"),f=new ls;f.resize(4*c),f._trim();let m=0;for(let e of h)for(let t=0;t<e.circleArray.length/4;t++){let r=4*t,i=e.circleArray[r+0],a=e.circleArray[r+1],n=e.circleArray[r+2],s=e.circleArray[r+3];f.emplace(m++,i,a,n,s,0),f.emplace(m++,i,a,n,s,1),f.emplace(m++,i,a,n,s,2),f.emplace(m++,i,a,n,s,3)}(!eu||eu.length<2*c)&&(eu=FP(c));let y=o.createIndexBuffer(eu,!0),g=o.createVertexBuffer(f,Hf.members,!0);for(let t of h){let i=Ag(t.transform,t.invTransform,e.transform);d.draw(o,l.TRIANGLES,Q.disabled,me.disabled,e.colorModeForRenderPass(),ue.disabled,i,e.style.map.terrain&&e.style.map.terrain.getTerrainData(t.coord),r.id,g,y,le.simpleSegment(0,2*t.circleOffset,t.circleArray.length,t.circleArray.length/2),null,e.transform.zoom,null,null,null)}g.destroy(),y.destroy()}function FP(e){let t=2*e,r=new cs;r.resize(t),r._trim();for(let e=0;e<t;e++){let t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}d(),u(yp,"drawCollisionDebug"),u(FP,"createQuadTriangles");var BP=$.identity(new Float32Array(16));function ox(e,t,r,i,a){if("translucent"!==e.renderPass)return;let n=me.disabled,s=e.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&OP(i,e,r,t,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),a),0!==r.paint.get("icon-opacity").constantOr(1)&&sx(e,t,r,i,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),n,s),0!==r.paint.get("text-opacity").constantOr(1)&&sx(e,t,r,i,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),n,s),t.map.showCollisionBoxes&&(yp(e,t,r,i,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),yp(e,t,r,i,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))}function RP(e,t,r,i,a,n){let{horizontalAlign:s,verticalAlign:o}=Es(e),l=-(s-.5)*t,u=-(o-.5)*r,h=rl(e,i);return new gp.default((l/a+h[0])*n,(u/a+h[1])*n)}function OP(e,t,r,i,a,n,s){let o=t.transform,l="map"===a,u="map"===n;for(let a of e){let e=i.getTile(a),n=e.getBucket(r);if(!n||!n.text||!n.text.segments.get().length)continue;let h=di(n.textSizeData,o.zoom),c=et(e,1,t.transform.zoom),p=io(a.posMatrix,u,l,t.transform,c),d="none"!==r.layout.get("icon-text-fit")&&n.hasIconData();if(h){let r=Math.pow(2,o.zoom-e.tileID.overscaledZ),i=t.style.map.terrain?(e,r)=>t.style.map.terrain.getElevation(a,e,r):null;VP(n,l,u,s,o,p,a.posMatrix,r,h,d,i)}}}function VP(e,t,r,i,a,n,s,o,l,u,h){let c=e.text.placedSymbolArray,p=e.text.dynamicLayoutVertexArray,d=e.icon.dynamicLayoutVertexArray,f={};p.clear();for(let d=0;d<c.length;d++){let m=c.get(d),y=e.allowVerticalPlacement&&!m.placedOrientation,g=m.hidden||!m.crossTileID||y?null:i[m.crossTileID];if(g){let i=new gp.default(m.anchorX,m.anchorY),c=It(i,r?s:n,h),d=no(a.cameraToCenterDistance,c.signedDistanceFromCamera),y=pn(e.textSizeData,l,m)*d/fi;r&&(y*=e.tilePixelRatio/o);let{width:_,height:x,anchor:v,textOffset:b,textBoxScale:w}=g,S=RP(v,_,x,b,w,y),A=r?It(i.add(S),n,h).point:c.point.add(t?S.rotate(-a.angle):S),I=e.allowVerticalPlacement&&m.placedOrientation===Be.vertical?Math.PI/2:0;for(let e=0;e<m.numGlyphs;e++)yi(p,A,I);u&&m.associatedIconIndex>=0&&(f[m.associatedIconIndex]={shiftedAnchor:A,angle:I})}else bi(m.numGlyphs,p)}if(u){d.clear();let t=e.icon.placedSymbolArray;for(let e=0;e<t.length;e++){let r=t.get(e);if(r.hidden)bi(r.numGlyphs,d);else{let t=f[e];if(t)for(let e=0;e<r.numGlyphs;e++)yi(d,t.shiftedAnchor,t.angle);else bi(r.numGlyphs,d)}}e.icon.dynamicLayoutVertexBuffer.updateData(d)}e.text.dynamicLayoutVertexBuffer.updateData(p)}function UP(e,t,r){return r.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function sx(e,t,r,i,a,n,s,o,l,u,h,c){let p=e.context,d=p.gl,f=e.transform,m="map"===o,y="map"===l,g="viewport"!==o&&"point"!==r.layout.get("symbol-placement"),_=m&&!y&&!g,x=!r.layout.get("symbol-sort-key").isConstant(),v=!1,b=e.depthModeForSublayer(0,Q.ReadOnly),w=r.layout.get("text-variable-anchor"),S=[];for(let o of i){let i=t.getTile(o),l=i.getBucket(r);if(!l)continue;let h=a?l.text:l.icon;if(!h||!h.segments.get().length||!h.hasVisibleVertices)continue;let c,p,b,A,I=h.programConfigurations.get(r.id),M=a||l.sdfIcons,T=a?l.textSizeData:l.iconSizeData,C=y||0!==f.pitch,P=e.useProgram(UP(M,a,l),I),k=di(T,f.zoom),z=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),E=[0,0],F=null;if(a){if(p=i.glyphAtlasTexture,b=d.LINEAR,c=i.glyphAtlasTexture.size,l.iconsInText){E=i.imageAtlasTexture.size,F=i.imageAtlasTexture;let t="composite"===T.kind||"camera"===T.kind;A=C||e.options.rotating||e.options.zooming||t?d.LINEAR:d.NEAREST}}else{let t=1!==r.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;p=i.imageAtlasTexture,b=M||e.options.rotating||e.options.zooming||t||C?d.LINEAR:d.NEAREST,c=i.imageAtlasTexture.size}let D=et(i,1,e.transform.zoom),B=io(o.posMatrix,y,m,e.transform,D),L=Js(o.posMatrix,y,m,e.transform,D),R=w&&l.hasTextData(),V="none"!==r.layout.get("icon-text-fit")&&R&&l.hasIconData();if(g){let t=e.style.map.terrain?(t,r)=>e.style.map.terrain.getElevation(o,t,r):null,i="map"===r.layout.get("text-rotation-alignment");Hd(l,o.posMatrix,e,a,B,L,y,u,i,t)}let O,U=e.translatePosMatrix(o.posMatrix,i,n,s),$=g||a&&w||V?BP:B,q=e.translatePosMatrix(L,i,n,s,!0),N=M&&0!==r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1);O=M?l.iconsInText?Yg(T.kind,k,_,y,e,U,$,q,c,E):mp(T.kind,k,_,y,e,U,$,q,a,c,!0):hp(T.kind,k,_,y,e,U,$,q,a,c);let j={program:P,buffers:h,uniformValues:O,atlasTexture:p,atlasTextureIcon:F,atlasInterpolation:b,atlasInterpolationIcon:A,isSDF:M,hasHalo:N};if(x&&l.canOverlap){v=!0;let e=h.segments.get();for(let t of e)S.push({segments:new le([t]),sortKey:t.sortKey,state:j,terrainData:z})}else S.push({segments:h.segments,sortKey:0,state:j,terrainData:z})}v&&S.sort(((e,t)=>e.sortKey-t.sortKey));for(let t of S){let i=t.state;if(p.activeTexture.set(d.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,d.CLAMP_TO_EDGE),i.atlasTextureIcon&&(p.activeTexture.set(d.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),i.isSDF){let a=i.uniformValues;i.hasHalo&&(a.u_is_halo=1,lx(i.buffers,t.segments,r,e,i.program,b,h,c,a,t.terrainData)),a.u_is_halo=0}lx(i.buffers,t.segments,r,e,i.program,b,h,c,i.uniformValues,t.terrainData)}}function lx(e,t,r,i,a,n,s,o,l,u){let h=i.context,c=h.gl;a.draw(h,c.TRIANGLES,n,s,o,ue.disabled,l,u,r.id,e.layoutVertexBuffer,e.indexBuffer,t,r.paint,i.transform.zoom,e.programConfigurations.get(r.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function ux(e,t,r,i){if("translucent"!==e.renderPass)return;let a=r.paint.get("circle-opacity"),n=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),o=!r.layout.get("circle-sort-key").isConstant();if(0===a.constantOr(1)&&(0===n.constantOr(1)||0===s.constantOr(1)))return;let l=e.context,u=l.gl,h=e.depthModeForSublayer(0,Q.ReadOnly),c=me.disabled,p=e.colorModeForRenderPass(),d=[];for(let a=0;a<i.length;a++){let n=i[a],s=t.getTile(n),l=s.getBucket(r);if(!l)continue;let u=l.programConfigurations.get(r.id),h=e.useProgram("circle",u),c=l.layoutVertexBuffer,p=l.indexBuffer,f=e.style.map.terrain&&e.style.map.terrain.getTerrainData(n),m={programConfiguration:u,program:h,layoutVertexBuffer:c,indexBuffer:p,uniformValues:wg(e,n,s,r),terrainData:f};if(o){let e=l.segments.get();for(let t of e)d.push({segments:new le([t]),sortKey:t.sortKey,state:m})}else d.push({segments:l.segments,sortKey:0,state:m})}o&&d.sort(((e,t)=>e.sortKey-t.sortKey));for(let t of d){let{programConfiguration:i,program:a,layoutVertexBuffer:n,indexBuffer:s,uniformValues:o,terrainData:d}=t.state,f=t.segments;a.draw(l,u.TRIANGLES,h,c,p,ue.disabled,o,d,r.id,n,s,f,r.paint,e.transform.zoom,i)}}function cx(e,t,r,i){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){let a=e.context,n=a.gl,s=me.disabled,o=new Fe([n.ONE,n.ONE],X.transparent,[!0,!0,!0,!0]);NP(a,e,r),a.clear({color:X.transparent});for(let l=0;l<i.length;l++){let u=i[l];if(t.hasRenderableParent(u))continue;let h=t.getTile(u),c=h.getBucket(r);if(!c)continue;let p=c.programConfigurations.get(r.id),d=e.useProgram("heatmap",p),{zoom:f}=e.transform;d.draw(a,n.TRIANGLES,Q.disabled,s,o,ue.disabled,kg(u.posMatrix,h,f,r.paint.get("heatmap-intensity")),null,r.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,r.paint,e.transform.zoom,p)}a.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),$P(e,r))}function NP(e,t,r){let i=e.gl;e.activeTexture.set(i.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let a=r.heatmapFbo;if(a)i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer);else{let n=i.createTexture();i.bindTexture(i.TEXTURE_2D,n),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),a=r.heatmapFbo=e.createFramebuffer(t.width/4,t.height/4,!1,!1),qP(e,t,n,a)}}function qP(e,t,r,i){var a,n;let s=e.gl,o=null!=(a=e.HALF_FLOAT)?a:s.UNSIGNED_BYTE,l=null!=(n=e.RGBA16F)?n:s.RGBA;s.texImage2D(s.TEXTURE_2D,0,l,t.width/4,t.height/4,0,s.RGBA,o,null),i.colorAttachment.set(r)}function $P(e,t){let r=e.context,i=r.gl,a=t.heatmapFbo;if(!a)return;r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(i.TEXTURE1);let n=t.colorRampTexture;n||(n=t.colorRampTexture=new xe(r,t.colorRamp,i.RGBA)),n.bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,i.TRIANGLES,Q.disabled,me.disabled,e.colorModeForRenderPass(),ue.disabled,Lg(e,t,0,1),null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom)}function px(e,t,r,i){if("translucent"!==e.renderPass)return;let a=r.paint.get("line-opacity"),n=r.paint.get("line-width");if(0===a.constantOr(1)||0===n.constantOr(1))return;let s=e.depthModeForSublayer(0,Q.ReadOnly),o=e.colorModeForRenderPass(),l=r.paint.get("line-dasharray"),u=r.paint.get("line-pattern"),h=u.constantOr(1),c=r.paint.get("line-gradient"),p=r.getCrossfadeParameters(),d=h?"linePattern":l?"lineSDF":c?"lineGradient":"line",f=e.context,m=f.gl,y=!0;for(let a of i){let i=t.getTile(a);if(h&&!i.patternsLoaded())continue;let n=i.getBucket(r);if(!n)continue;let g=n.programConfigurations.get(r.id),_=e.context.program.get(),x=e.useProgram(d,g),v=y||x.program!==_,b=e.style.map.terrain&&e.style.map.terrain.getTerrainData(a),w=u.constantOr(null);if(w&&i.imageAtlas){let e=i.imageAtlas,t=e.patternPositions[w.to.toString()],r=e.patternPositions[w.from.toString()];t&&r&&g.setConstantPatternPositions(t,r)}let S=b?a:null,A=h?qg(e,i,r,p,S):l?$g(e,i,r,l,p,S):c?Ng(e,i,r,n.lineClipsArray.length,S):dl(e,i,r,S);if(h)f.activeTexture.set(m.TEXTURE0),i.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),g.updatePaintBuffers(p);else if(l&&(v||e.lineAtlas.dirty))f.activeTexture.set(m.TEXTURE0),e.lineAtlas.bind(f);else if(c){let i=n.gradients[r.id],s=i.texture;if(r.gradientVersion!==i.version){let o=256;if(r.stepInterpolant){let r=t.getSource().maxzoom,i=a.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-a.canonical.z):1;o=Te(Fp(n.maxLineLength/O*1024*i),256,f.maxTextureSize)}i.gradient=_s({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:o,image:i.gradient||void 0,clips:n.lineClipsArray}),i.texture?i.texture.update(i.gradient):i.texture=new xe(f,i.gradient,m.RGBA),i.version=r.gradientVersion,s=i.texture}f.activeTexture.set(m.TEXTURE0),s.bind(r.stepInterpolant?m.NEAREST:m.LINEAR,m.CLAMP_TO_EDGE)}x.draw(f,m.TRIANGLES,s,e.stencilModeForClipping(a),o,ue.disabled,A,b,r.id,n.layoutVertexBuffer,n.indexBuffer,n.segments,r.paint,e.transform.zoom,g,n.layoutVertexBuffer2),y=!1}}function tu(e,t,r,i,a){if(!r||!i||!i.imageAtlas)return;let n=i.imageAtlas.patternPositions,s=n[r.to.toString()],o=n[r.from.toString()];if(!s||!o){let e=a.getPaintProperty(t);s=n[e],o=n[e]}s&&o&&e.setConstantPatternPositions(s,o)}function hx(e,t,r,i){let a=r.paint.get("fill-color"),n=r.paint.get("fill-opacity");if(0===n.constantOr(1))return;let s=e.colorModeForRenderPass(),o=r.paint.get("fill-pattern"),l=e.opaquePassEnabledForLayer()&&!o.constantOr(1)&&1===a.constantOr(X.transparent).a&&1===n.constantOr(0)?"opaque":"translucent";if(e.renderPass===l){let a=e.depthModeForSublayer(1,"opaque"===e.renderPass?Q.ReadWrite:Q.ReadOnly);mx(e,t,r,i,a,s,!1)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){let a=e.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,Q.ReadOnly);mx(e,t,r,i,a,s,!0)}}function mx(e,t,r,i,a,n,s){let o,l,u,h,c,p=e.context.gl,d="fill-pattern",f=r.paint.get(d),m=f&&f.constantOr(1),y=r.getCrossfadeParameters();s?(l=m&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",o=p.LINES):(l=m?"fillPattern":"fill",o=p.TRIANGLES);let g=f.constantOr(null);for(let f of i){let i=t.getTile(f);if(m&&!i.patternsLoaded())continue;let _=i.getBucket(r);if(!_)continue;let x=_.programConfigurations.get(r.id),v=e.useProgram(l,x),b=e.style.map.terrain&&e.style.map.terrain.getTerrainData(f);m&&(e.context.activeTexture.set(p.TEXTURE0),i.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),x.updatePaintBuffers(y)),tu(x,d,g,i,r);let w=b?f:null,S=w?w.posMatrix:f.posMatrix,A=e.translatePosMatrix(S,i,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(s){h=_.indexBuffer2,c=_.segments2;let t=[p.drawingBufferWidth,p.drawingBufferHeight];u="fillOutlinePattern"===l&&m?bg(A,e,y,i,t):_g(A,t)}else h=_.indexBuffer,c=_.segments,u=m?up(A,e,y,i):lp(A);v.draw(e.context,o,a,e.stencilModeForClipping(f),n,ue.disabled,u,b,r.id,_.layoutVertexBuffer,h,c,r.paint,e.transform.zoom,x)}}function fx(e,t,r,i){let a=r.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===e.renderPass){let n=new Q(e.context.gl.LEQUAL,Q.ReadWrite,e.depthRangeFor3D);if(1!==a||r.paint.get("fill-extrusion-pattern").constantOr(1))xp(e,t,r,i,n,me.disabled,Fe.disabled),xp(e,t,r,i,n,e.stencilModeFor3D(),e.colorModeForRenderPass());else{let a=e.colorModeForRenderPass();xp(e,t,r,i,n,me.disabled,a)}}}function xp(e,t,r,i,a,n,s){let o=e.context,l=o.gl,u="fill-extrusion-pattern",h=r.paint.get(u),c=h.constantOr(1),p=r.getCrossfadeParameters(),d=r.paint.get("fill-extrusion-opacity"),f=h.constantOr(null);for(let h of i){let i=t.getTile(h),m=i.getBucket(r);if(!m)continue;let y=e.style.map.terrain&&e.style.map.terrain.getTerrainData(h),g=m.programConfigurations.get(r.id),_=e.useProgram(c?"fillExtrusionPattern":"fillExtrusion",g);c&&(e.context.activeTexture.set(l.TEXTURE0),i.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),g.updatePaintBuffers(p)),tu(g,u,f,i,r);let x=e.translatePosMatrix(h.posMatrix,i,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),v=r.paint.get("fill-extrusion-vertical-gradient"),b=c?fg(x,e,v,d,h,p,i):sp(x,e,v,d);_.draw(o,o.gl.TRIANGLES,a,n,s,ue.backCCW,b,y,r.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,r.paint,e.transform.zoom,g,e.style.map.terrain&&m.centroidVertexBuffer)}}function dx(e,t,r,i){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;let a=e.context,n=e.depthModeForSublayer(0,Q.ReadOnly),s=e.colorModeForRenderPass(),[o,l]="translucent"===e.renderPass?e.stencilConfigForOverlap(i):[{},i];for(let i of l){let a=t.getTile(i);void 0!==a.needsHillshadePrepare&&a.needsHillshadePrepare&&"offscreen"===e.renderPass?jP(e,a,r,n,me.disabled,s):"translucent"===e.renderPass&&GP(e,i,a,r,n,o[i.overscaledZ],s)}a.viewport.set([0,0,e.width,e.height])}function GP(e,t,r,i,a,n,s){let o=e.context,l=o.gl,u=r.fbo;if(!u)return;let h=e.useProgram("hillshade"),c=e.style.map.terrain&&e.style.map.terrain.getTerrainData(t);o.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,u.colorAttachment.get());let p=c?t:null;h.draw(o,l.TRIANGLES,a,n,s,ue.disabled,Fg(e,r,i,p),c,i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}function jP(e,t,r,i,a,n){let s=e.context,o=s.gl,l=t.dem;if(l&&l.data){let u=l.dim,h=l.stride,c=l.getPixels();if(s.activeTexture.set(o.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||e.getTileTexture(h),t.demTexture){let e=t.demTexture;e.update(c,{premultiply:!1}),e.bind(o.NEAREST,o.CLAMP_TO_EDGE)}else t.demTexture=new xe(s,c,o.RGBA,{premultiply:!1}),t.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE);s.activeTexture.set(o.TEXTURE0);let p=t.fbo;if(!p){let e=new xe(s,{width:u,height:u,data:null},o.RGBA);e.bind(o.LINEAR,o.CLAMP_TO_EDGE),p=t.fbo=s.createFramebuffer(u,u,!0,!1),p.colorAttachment.set(e.texture)}s.bindFramebuffer.set(p.framebuffer),s.viewport.set([0,0,u,u]),e.useProgram("hillshadePrepare").draw(s,o.TRIANGLES,i,a,n,ue.disabled,Bg(t.tileID,l),null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function yx(e,t,r,i){if("translucent"!==e.renderPass||0===r.paint.get("raster-opacity")||!i.length)return;let a=e.context,n=a.gl,s=t.getSource(),o=e.useProgram("raster"),l=e.colorModeForRenderPass(),[u,h]=s instanceof Lt?[{},i]:e.stencilConfigForOverlap(i),c=h[h.length-1].overscaledZ,p=!e.options.moving;for(let i of h){let h=e.depthModeForSublayer(i.overscaledZ-c,1===r.paint.get("raster-opacity")?Q.ReadWrite:Q.ReadOnly,n.LESS),d=t.getTile(i);d.registerFadeDuration(r.paint.get("raster-fade-duration"));let f,m,y=t.findLoadedParent(i,0),g=HP(d,y,t,r,e.transform,e.style.map.terrain),_="nearest"===r.paint.get("raster-resampling")?n.NEAREST:n.LINEAR;a.activeTexture.set(n.TEXTURE0),d.texture.bind(_,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),a.activeTexture.set(n.TEXTURE1),y?(y.texture.bind(_,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),f=Math.pow(2,y.tileID.overscaledZ-d.tileID.overscaledZ),m=[d.tileID.canonical.x*f%1,d.tileID.canonical.y*f%1]):d.texture.bind(_,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST);let x=e.style.map.terrain&&e.style.map.terrain.getTerrainData(i),v=x?i:null,b=v?v.posMatrix:e.transform.calculatePosMatrix(i.toUnwrapped(),p),w=Zg(b,m||[0,0],f||1,g,r);s instanceof Lt?o.draw(a,n.TRIANGLES,h,me.disabled,l,ue.disabled,w,x,r.id,s.boundsBuffer,e.quadTriangleIndexBuffer,s.boundsSegments):o.draw(a,n.TRIANGLES,h,u[i.overscaledZ],l,ue.disabled,w,x,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}}function HP(e,t,r,i,a,n){let s=i.paint.get("raster-fade-duration");if(!n&&s>0){let i=ne.now(),n=(i-e.timeAdded)/s,o=t?(i-t.timeAdded)/s:-1,l=r.getSource(),u=a.coveringZoomLevel({tileSize:l.tileSize,roundZoom:l.roundZoom}),h=!t||Math.abs(t.tileID.overscaledZ-u)>Math.abs(e.tileID.overscaledZ-u),c=h&&e.refreshedUponExpiration?1:Te(h?n:1-o,0,1);return e.refreshedUponExpiration&&n>=1&&(e.refreshedUponExpiration=!1),t?{opacity:1,mix:1-c}:{opacity:c,mix:0}}return{opacity:1,mix:0}}function gx(e,t,r,i){let a=r.paint.get("background-color"),n=r.paint.get("background-opacity");if(0===n)return;let s=e.context,o=s.gl,l=e.transform,u=l.tileSize,h=r.paint.get("background-pattern");if(e.isPatternMissing(h))return;let c=!h&&1===a.a&&1===n&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==c)return;let p=me.disabled,d=e.depthModeForSublayer(0,"opaque"===c?Q.ReadWrite:Q.ReadOnly),f=e.colorModeForRenderPass(),m=e.useProgram(h?"backgroundPattern":"background"),y=i||l.coveringTiles({tileSize:u,terrain:e.style.map.terrain});h&&(s.activeTexture.set(o.TEXTURE0),e.imageManager.bind(e.context));let g=r.getCrossfadeParameters();for(let t of y){let l=i?t.posMatrix:e.transform.calculatePosMatrix(t.toUnwrapped()),c=h?tx(l,n,e,h,{tileID:t,tileSize:u},g):ex(l,n,a),y=e.style.map.terrain&&e.style.map.terrain.getTerrainData(t);m.draw(s,o.TRIANGLES,d,p,f,ue.disabled,c,y,r.id,e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments)}}u(ox,"drawSymbols"),u(RP,"calculateVariableRenderShift"),u(OP,"updateVariableAnchors"),u(VP,"updateVariableAnchorsForBucket"),u(UP,"getSymbolProgramName"),u(sx,"drawLayerSymbols"),u(lx,"drawSymbolElements"),d(),u(ux,"drawCircles"),d(),u(cx,"drawHeatmap"),u(NP,"bindFramebuffer"),u(qP,"bindTextureToFramebuffer"),u($P,"renderTextureToMap"),d(),u(px,"drawLine"),d(),d(),u(tu,"updatePatternPositionsInProgram"),u(hx,"drawFill"),u(mx,"drawFillTiles"),d(),u(fx,"drawFillExtrusion"),u(xp,"drawExtrusionTiles"),d(),u(dx,"drawHillshade"),u(GP,"renderHillshade"),u(jP,"prepareHillshade"),d(),u(yx,"drawRaster"),u(HP,"getFadeValues"),d(),u(gx,"drawBackground"),d();var ZP=new X(1,0,0,1),WP=new X(0,1,0,1),XP=new X(0,0,1,1),KP=new X(1,0,1,1),YP=new X(0,1,1,1);function xx(e){let t=e.transform.padding;_x(e,e.transform.height-(t.top||0),3,ZP),_x(e,t.bottom||0,3,WP),bx(e,t.left||0,3,XP),bx(e,e.transform.width-(t.right||0),3,KP);let r=e.transform.centerPoint;JP(e,r.x,e.transform.height-r.y,YP)}function JP(e,t,r,i){ru(e,t-1,r-10,2,20,i),ru(e,t-10,r-1,20,2,i)}function _x(e,t,r,i){ru(e,0,t+r/2,e.transform.width,r,i)}function bx(e,t,r,i){ru(e,t-r/2,0,r,e.transform.height,i)}function ru(e,t,r,i,a,n){let s=e.context,o=s.gl;o.enable(o.SCISSOR_TEST),o.scissor(t*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio,a*e.pixelRatio),s.clear({color:n}),o.disable(o.SCISSOR_TEST)}function vx(e,t,r){for(let i=0;i<r.length;i++)QP(e,t,r[i])}function QP(e,t,r){let i=e.context,a=i.gl,n=r.posMatrix,s=e.useProgram("debug"),o=Q.disabled,l=me.disabled,u=e.colorModeForRenderPass(),h="$debug",c=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r);i.activeTexture.set(a.TEXTURE0);let p=t.getTileByID(r.key).latestRawTileData,d=p&&p.byteLength||0,f=Math.floor(d/1024),m=t.getTile(r).tileSize,y=512/Math.min(m,512)*(r.overscaledZ/e.transform.zoom)*.5,g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=` => ${r.overscaledZ}`),eT(e,`${g} ${f}kB`),s.draw(i,a.TRIANGLES,o,l,Fe.alphaBlended,ue.disabled,cp(n,X.transparent,y),null,h,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),s.draw(i,a.LINE_STRIP,o,l,u,ue.disabled,cp(n,X.red),c,h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function eT(e,t){e.initDebugOverlayCanvas();let r=e.debugOverlayCanvas,i=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,r.width,r.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}function wx(e,t){let r=null,i=Object.values(e._layers).flatMap((r=>r.source&&!r.isHidden(t)?[e.sourceCaches[r.source]]:[])),a=i.filter((e=>"vector"===e.getSource().type)),n=i.filter((e=>"vector"!==e.getSource().type)),s=u((e=>{(!r||r.getSource().maxzoom<e.getSource().maxzoom)&&(r=e)}),"considerSource");return a.forEach((e=>s(e))),r||n.forEach((e=>s(e))),r}function Sx(e,t,r){let i=e.context,a=r.implementation;if("offscreen"===e.renderPass){let t=a.prerender;t&&(e.setCustomLayerDefaults(),i.setColorMode(e.colorModeForRenderPass()),t.call(a,i.gl,e.transform.customLayerMatrix()),i.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),i.setColorMode(e.colorModeForRenderPass()),i.setStencilMode(me.disabled);let t="3d"===a.renderingMode?new Q(e.context.gl.LEQUAL,Q.ReadWrite,e.depthRangeFor3D):e.depthModeForSublayer(0,Q.ReadOnly);i.setDepthMode(t),a.render(i.gl,e.transform.customLayerMatrix()),i.setDirty(),e.setBaseState(),i.bindFramebuffer.set(null)}}function Px(e,t){let r=e.context,i=r.gl,a=Fe.unblended,n=new Q(i.LEQUAL,Q.ReadWrite,[0,1]),s=t.getTerrainMesh(),o=t.sourceCache.getRenderableTiles(),l=e.useProgram("terrainDepth");r.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:X.transparent,depth:1});for(let u of o){let o=t.getTerrainData(u.tileID),h=e.transform.calculatePosMatrix(u.tileID.toUnwrapped()),c=ug(h,t.getMeshFrameDelta(e.transform.zoom));l.draw(r,i.TRIANGLES,n,me.disabled,a,ue.backCCW,c,o,"terrain",s.vertexBuffer,s.indexBuffer,s.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}function Tx(e,t){let r=e.context,i=r.gl,a=Fe.unblended,n=new Q(i.LEQUAL,Q.ReadWrite,[0,1]),s=t.getTerrainMesh(),o=t.getCoordsTexture(),l=t.sourceCache.getRenderableTiles(),u=e.useProgram("terrainCoords");r.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:X.transparent,depth:1}),t.coordsIndex=[];for(let h of l){let l=t.getTerrainData(h.tileID);r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,o.texture);let c=e.transform.calculatePosMatrix(h.tileID.toUnwrapped()),p=cg(c,255-t.coordsIndex.length,t.getMeshFrameDelta(e.transform.zoom));u.draw(r,i.TRIANGLES,n,me.disabled,a,ue.backCCW,p,l,"terrain",s.vertexBuffer,s.indexBuffer,s.segments),t.coordsIndex.push(h.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}function _p(e,t,r){let i=e.context,a=i.gl,n=e.colorModeForRenderPass(),s=new Q(a.LEQUAL,Q.ReadWrite,e.depthRangeFor3D),o=e.useProgram("terrain"),l=t.getTerrainMesh();i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height]);for(let u of r){let r=e.renderToTexture.getTexture(u),h=t.getTerrainData(u.tileID);i.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r.texture);let c=e.transform.calculatePosMatrix(u.tileID.toUnwrapped()),p=lg(c,t.getMeshFrameDelta(e.transform.zoom));o.draw(i,a.TRIANGLES,s,me.disabled,n,ue.backCCW,p,h,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}u(xx,"drawDebugPadding"),u(JP,"drawCrosshair"),u(_x,"drawHorizontalLine"),u(bx,"drawVerticalLine"),u(ru,"drawDebugSSRect"),u(vx,"drawDebug"),u(QP,"drawDebugTile"),u(eT,"drawTextToOverlay"),u(wx,"selectDebugSource"),d(),u(Sx,"drawCustom"),d(),u(Px,"drawDepth"),u(Tx,"drawCoords"),u(_p,"drawTerrain");var iu=class{constructor(e,t){this.context=new Ql(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:$.create(),renderTime:0},this.setup(),this.numSublayers=At.maxUnderzooming+At.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new In}resize(e,t,r){if(this.width=Math.floor(e*r),this.height=Math.floor(t*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.setupRemoteFrameRendering(this.width,this.height),this.style)for(let e of this.style._order)this.style._layers[e].resize()}setup(){let e=this.context,t=new Dr;t.emplaceBack(0,0),t.emplaceBack(O,0),t.emplaceBack(0,O),t.emplaceBack(O,O),this.tileExtentBuffer=e.createVertexBuffer(t,cl.members),this.tileExtentSegments=le.simpleSegment(0,0,4,2);let r=new Dr;r.emplaceBack(0,0),r.emplaceBack(O,0),r.emplaceBack(0,O),r.emplaceBack(O,O),this.debugBuffer=e.createVertexBuffer(r,cl.members),this.debugSegments=le.simpleSegment(0,0,4,5);let i=new tn;i.emplaceBack(0,0,0,0),i.emplaceBack(O,0,O,0),i.emplaceBack(0,O,0,O),i.emplaceBack(O,O,O,O),this.rasterBoundsBuffer=e.createVertexBuffer(i,qr.members),this.rasterBoundsSegments=le.simpleSegment(0,0,4,2);let a=new Dr;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,cl.members),this.viewportSegments=le.simpleSegment(0,0,4,2);let n=new La;n.emplaceBack(0),n.emplaceBack(1),n.emplaceBack(3),n.emplaceBack(2),n.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(n);let s=new lt;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let o=this.context.gl;this.stencilClearMode=new me({func:o.ALWAYS,mask:0},0,255,o.ZERO,o.ZERO,o.ZERO),this.setupRemoteFrameRendering(this.width,this.height)}setupRemoteFrameRendering(e,t){if(null==e||null==t)return;let r=this.context.gl;r.bindFramebuffer(r.FRAMEBUFFER,null),this.webGLRenderTargetFrameBuffer&&(r.deleteFramebuffer(this.webGLRenderTargetFrameBuffer),r.deleteRenderbuffer(this.webGLRenderTargetRenderBuffer),r.deleteTexture(this.webGLRenderTargetTexture)),this.webGLRenderTargetFrameBuffer=r.createFramebuffer(),this.webGLRenderTargetRenderBuffer=r.createRenderbuffer(),r.bindFramebuffer(r.FRAMEBUFFER,this.webGLRenderTargetFrameBuffer),this.webGLRenderTargetTexture=r.createTexture(),r.bindTexture(r.TEXTURE_2D,this.webGLRenderTargetTexture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e,t,0,r.RGBA,r.UNSIGNED_BYTE,null),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,this.webGLRenderTargetTexture,0),r.bindRenderbuffer(r.RENDERBUFFER,this.webGLRenderTargetRenderBuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e,t),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,this.webGLRenderTargetRenderBuffer),r.checkFramebufferStatus(r.FRAMEBUFFER)!==r.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is not complete")}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=$.create();$.ortho(r,0,this.width,this.height,0,0,1),$.scale(r,r,[t.drawingBufferWidth,t.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,t.TRIANGLES,Q.disabled,this.stencilClearMode,Fe.disabled,ue.disabled,pp(r),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source;let r=this.context,i=r.gl;this.nextStencilID+t.length>256&&this.clearStencil(),r.setColorMode(Fe.disabled),r.setDepthMode(Q.disabled);let a=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let e of t){let t=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,n=this.style.map.terrain&&this.style.map.terrain.getTerrainData(e);a.draw(r,i.TRIANGLES,Q.disabled,new me({func:i.ALWAYS,mask:0},t,255,i.KEEP,i.KEEP,i.REPLACE),Fe.disabled,ue.disabled,pp(e.posMatrix),n,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new me({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new me({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){let t=this.context.gl,r=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),i=r[r.length-1].overscaledZ,a=r[0].overscaledZ-i+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let e={};for(let r=0;r<a;r++)e[r+i]=new me({func:t.GEQUAL,mask:255},r+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=a,[e,r]}return[{[i]:me.disabled},r]}colorModeForRenderPass(){let e=this.context.gl;if(this._showOverdrawInspector){let t=1/8;return new Fe([e.CONSTANT_COLOR,e.ONE],new X(t,t,t,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Fe.unblended:Fe.alphaBlended}depthModeForSublayer(e,t,r){if(!this.opaquePassEnabledForLayer())return Q.disabled;let i=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Q(r||this.context.gl.LEQUAL,t,[i,i])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,t){this.style=e,this.options=t,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(ne.now()),this.imageManager.beginFrame();let r=this.style._order,i=this.style.sourceCaches,a={},n={},s={};for(let e in i){let t=i[e];t.used&&t.prepare(this.context),a[e]=t.getVisibleCoordinates(),n[e]=a[e].slice().reverse(),s[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<r.length;e++){let t=r[e];if(this.style._layers[t].is3D()){this.opaquePassCutoff=e;break}}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;let e=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!$.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||e.length)&&($.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,Px(this,this.style.map.terrain),Tx(this,this.style.map.terrain))}this.renderPass="offscreen";for(let e of r){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let r=n[t.source];"custom"!==t.type&&!r.length||this.renderLayer(this,i[t.source],t,r)}if(this.context.bindFramebuffer.set(this.webGLRenderTargetFrameBuffer),this.context.clear({color:t.showOverdrawInspector?X.black:X.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=t.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){let e=this.style._layers[r[this.currentLayer]],t=i[e.source],n=a[e.source];this._renderTileClippingMasks(e,n),this.renderLayer(this,t,e,n)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){let e=this.style._layers[r[this.currentLayer]],t=i[e.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(e))continue;let o=("symbol"===e.type?s:n)[e.source];this._renderTileClippingMasks(e,a[e.source]),this.renderLayer(this,t,e,o)}if(this.options.showTileBoundaries){let e=wx(this.style,this.transform.zoom);e&&vx(this,e,e.getVisibleCoordinates())}this.options.showPadding&&xx(this),this.context.setDefault(),this.setCustomLayerDefaults(),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null)}renderLayer(e,t,r,i){if(!r.isHidden(this.transform.zoom)&&("background"===r.type||"custom"===r.type||(i||[]).length))switch(this.id=r.id,r.type){case"symbol":ox(e,t,r,i,this.style.placement.variableOffsets);break;case"circle":ux(e,t,r,i);break;case"heatmap":cx(e,t,r,i);break;case"line":px(e,t,r,i);break;case"fill":hx(e,t,r,i);break;case"fill-extrusion":fx(e,t,r,i);break;case"hillshade":dx(e,t,r,i);break;case"raster":yx(e,t,r,i);break;case"background":gx(e,t,r,i);break;case"custom":Sx(e,t,r)}}translatePosMatrix(e,t,r,i,a){if(!r[0]&&!r[1])return e;let n=a?"map"===i?this.transform.angle:0:"viewport"===i?-this.transform.angle:0;if(n){let e=Math.sin(n),t=Math.cos(n);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}let s=[a?r[0]:et(t,r[0],this.transform.zoom),a?r[1]:et(t,r[1],this.transform.zoom),0],o=new Float32Array(16);return $.translate(o,e,s),o}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),r=this.imageManager.getPattern(e.to.toString());return!t||!r}useProgram(e,t){this.cache=this.cache||{};let r=e+(t?t.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[r]||(this.cache[r]=new ml(this.context,Pi[e],t,rx[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[r]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(null==this.debugOverlayCanvas){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new xe(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}};u(iu,"Painter"),d();var Ge=ae(Pe());d();var Mn=class{constructor(e,t){this.points=e,this.planes=t}static fromInvProjectionMatrix(e,t,r){let i=Math.pow(2,r),a=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((r=>{let a=1/(r=Je.transformMat4([],r,e))[3]/t*i;return Je.mul(r,r,[a,a,1/r[3],a])})),n=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{let t=Pt.sub([],a[e[0]],a[e[1]]),r=Pt.sub([],a[e[2]],a[e[1]]),i=Pt.normalize([],Pt.cross([],t,r)),n=-Pt.dot(i,a[e[1]]);return i.concat(n)}));return new Mn(a,n)}};u(Mn,"Frustum");var Ti=class{constructor(e,t){this.min=e,this.max=t,this.center=Pt.scale([],Pt.add([],this.min,this.max),.5)}quadrant(e){let t=[e%2==0,e<2],r=Pt.clone(this.min),i=Pt.clone(this.max);for(let e=0;e<t.length;e++)r[e]=t[e]?this.min[e]:this.center[e],i[e]=t[e]?this.center[e]:this.max[e];return i[2]=this.max[2],new Ti(r,i)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){let t=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],r=!0;for(let i=0;i<e.planes.length;i++){let a=e.planes[i],n=0;for(let e=0;e<t.length;e++)Je.dot(a,t[e])>=0&&n++;if(0===n)return 0;n!==t.length&&(r=!1)}if(r)return 2;for(let t=0;t<3;t++){let r=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let a=0;a<e.points.length;a++){let n=e.points[a][t]-this.min[t];r=Math.min(r,n),i=Math.max(i,n)}if(i<0||r>this.max[t]-this.min[t])return 0}return 1}};u(Ti,"Aabb"),d();var Ax=ae(Pe()),En=class{constructor(e=0,t=0,r=0,i=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(r)||r<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=r,this.right=i}interpolate(e,t,r){return null!=t.top&&null!=e.top&&(this.top=Le.number(e.top,t.top,r)),null!=t.bottom&&null!=e.bottom&&(this.bottom=Le.number(e.bottom,t.bottom,r)),null!=t.left&&null!=e.left&&(this.left=Le.number(e.left,t.left,r)),null!=t.right&&null!=e.right&&(this.right=Le.number(e.right,t.right,r)),this}getCenter(e,t){let r=Te((this.left+e-this.right)/2,0,e),i=Te((this.top+t-this.bottom)/2,0,t);return new Ax.default(r,i)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new En(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};u(En,"EdgeInsets");var kn=class{constructor(e,t,r,i,a){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=void 0===a||!!a,this._minZoom=e||0,this._maxZoom=t||22,this._minPitch=null==r?0:r,this._maxPitch=null==i?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new K(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.698132,this._pitch=0,this._unmodified=!0,this._edgeInsets=new En,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let e=new kn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Ge.default(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let t=-nr(e,-180,180)*Math.PI/180;this.angle!==t&&(this._unmodified=!1,this.angle=t,this._calcMatrices(),this.rotationMatrix=Fa.create(),Fa.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let t=Te(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==t&&(this._unmodified=!1,this._pitch=t,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this.tileZoom=Math.max(0,Math.floor(t)),this.scale=this.zoomScale(t),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,r){this._unmodified=!1,this._edgeInsets.interpolate(e,t,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(e){let t=[new xn(0,e)];if(this._renderWorldCopies){let r=this.pointCoordinate(new Ge.default(0,0)),i=this.pointCoordinate(new Ge.default(this.width,0)),a=this.pointCoordinate(new Ge.default(this.width,this.height)),n=this.pointCoordinate(new Ge.default(0,this.height)),s=Math.floor(Math.min(r.x,i.x,a.x,n.x)),o=Math.floor(Math.max(r.x,i.x,a.x,n.x)),l=1;for(let r=s-l;r<=o+l;r++)0!==r&&t.push(new xn(r,e))}return t}coveringTiles(e){var t,r;let i=this.coveringZoomLevel(e),a=i;if(void 0!==e.minzoom&&i<e.minzoom)return[];void 0!==e.maxzoom&&i>e.maxzoom&&(i=e.maxzoom);let n=this.pointCoordinate(this.getCameraPoint()),s=Ee.fromLngLat(this.center),o=Math.pow(2,i),l=[o*n.x,o*n.y,0],h=[o*s.x,o*s.y,0],c=Mn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i),p=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=i);let d=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,f=u((e=>({aabb:new Ti([e*o,0,0],[(e+1)*o,o,0]),zoom:0,x:0,y:0,wrap:e,fullyVisible:!1})),"newRootTile"),m=[],y=[],g=i,_=e.reparseOverscaled?a:i;if(this._renderWorldCopies)for(let e=1;e<=3;e++)m.push(f(-e)),m.push(f(e));for(m.push(f(0));m.length>0;){let i=m.pop(),a=i.x,n=i.y,s=i.fullyVisible;if(!s){let e=i.aabb.intersects(c);if(0===e)continue;s=2===e}let o=e.terrain?l:h,u=i.aabb.distanceX(o),f=i.aabb.distanceY(o),x=Math.max(Math.abs(u),Math.abs(f)),v=d+(1<<g-i.zoom)-2;if(i.zoom===g||x>v&&i.zoom>=p){let e=g-i.zoom,t=l[0]-.5-(a<<e),r=l[1]-.5-(n<<e);y.push({tileID:new De(i.zoom===g?_:i.zoom,i.wrap,i.zoom,a,n),distanceSq:nn.sqrLen([h[0]-.5-a,h[1]-.5-n]),tileDistanceToCamera:Math.sqrt(t*t+r*r)})}else for(let o=0;o<4;o++){let l=(a<<1)+o%2,u=(n<<1)+(o>>1),h=i.zoom+1,c=i.aabb.quadrant(o);if(e.terrain){let a=new De(h,i.wrap,h,l,u),n=e.terrain.getMinMaxElevation(a),s=null!=(t=n.minElevation)?t:this.elevation,o=null!=(r=n.maxElevation)?r:this.elevation;c=new Ti([c.min[0],c.min[1],s],[c.max[0],c.max[1],o])}m.push({aabb:c,zoom:h,x:l,y:u,wrap:i.wrap,fullyVisible:s})}}return y.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let t=Te(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new Ge.default(Vr(e.lng)*this.worldSize,Ur(t)*this.worldSize)}calculateZMercatorFromAltitude(e){let{lat:t}=this.center,r=_i,i=this.tileSize,a=t*Math.PI/180,n=(e+r)/(2*Math.cos(a)*Math.PI*r/(i*Math.pow(2,20))),s=Math.log2(i/n);return Math.abs(s)}unproject(e){return new Ee(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(e){this.freezeElevation||(this.elevation=e?this.getElevation(this._center,e):0)}getElevation(e,t){let r=Ee.fromLngLat(e.wrap()),i=(1<<this.tileZoom)*O,a=r.x*i,n=r.y*i,s=Math.floor(a/O),o=Math.floor(n/O),l=new De(this.tileZoom,0,this.tileZoom,s,o);return t.getElevation(l,a%O,n%O,O)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){let t=this.pointLocation(this.centerPoint,e),r=this.getElevation(t,e);if(!(this.elevation-r))return;let i=this.getCameraPosition(),a=Ee.fromLngLat(i.lngLat,i.altitude),n=Ee.fromLngLat(t,r),s=a.x-n.x,o=a.y-n.y,l=a.z-n.z,u=Math.sqrt(s*s+o*o+l*l),h=this.scaleZoom(this.cameraToCenterDistance/u/this.tileSize);this._elevation=r,this._center=t,this.zoom=h}setLocationAtPoint(e,t){let r=this.pointCoordinate(t),i=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(e),n=new Ee(a.x-(r.x-i.x),a.y-(r.y-i.y));this.center=this.coordinateLocation(n),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,t){return t?this.coordinatePoint(this.locationCoordinate(e),this.getElevation(e,t),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,t){return this.coordinateLocation(this.pointCoordinate(e,t))}locationCoordinate(e){return Ee.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,t){if(t){let r=t.pointCoordinate(e);if(null!=r)return r}let r=[e.x,e.y,0,1],i=[e.x,e.y,1,1];Je.transformMat4(r,r,this.pixelMatrixInverse),Je.transformMat4(i,i,this.pixelMatrixInverse);let a=r[3],n=i[3],s=r[0]/a,o=i[0]/n,l=r[1]/a,u=i[1]/n,h=r[2]/a,c=i[2]/n,p=h===c?0:(0-h)/(c-h);return new Ee(Le.number(s,o,p)/this.worldSize,Le.number(l,u,p)/this.worldSize)}coordinatePoint(e,t=0,r=this.pixelMatrix){let i=[e.x*this.worldSize,e.y*this.worldSize,t,1];return Je.transformMat4(i,i,r),new Ge.default(i[0]/i[3],i[1]/i[3])}getBounds(){let e=Math.max(0,this.height/2-this.getHorizon());return(new Qe).extend(this.pointLocation(new Ge.default(0,e))).extend(this.pointLocation(new Ge.default(this.width,e))).extend(this.pointLocation(new Ge.default(this.width,this.height))).extend(this.pointLocation(new Ge.default(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new Qe([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,t=!1){let r=e.key,i=t?this._alignedPosMatrixCache:this._posMatrixCache;if(i[r])return i[r];let a=e.canonical,n=this.worldSize/this.zoomScale(a.z),s=a.x+Math.pow(2,a.z)*e.wrap,o=$.identity(new Float64Array(16));return $.translate(o,o,[s*n,a.y*n,0]),$.scale(o,o,[n/O,n/O,1]),$.multiply(o,t?this.alignedProjMatrix:this.projMatrix,o),i[r]=new Float32Array(o),i[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,t,r,i,a=-90,n=90,s=-180,o=180,l=this.size,u=this._unmodified;if(this.latRange){let t=this.latRange;a=Ur(t[1])*this.worldSize,n=Ur(t[0])*this.worldSize,e=n-a<l.y?l.y/(n-a):0}if(this.lngRange){let e=this.lngRange;s=nr(Vr(e[0])*this.worldSize,0,this.worldSize),o=nr(Vr(e[1])*this.worldSize,0,this.worldSize),o<s&&(o+=this.worldSize),t=o-s<l.x?l.x/(o-s):0}let h=this.point,c=Math.max(t||0,e||0);if(c)return this.center=this.unproject(new Ge.default(t?(o+s)/2:h.x,e?(n+a)/2:h.y)),this.zoom+=this.scaleZoom(c),this._unmodified=u,void(this._constraining=!1);if(this.latRange){let e=h.y,t=l.y/2;e-t<a&&(i=a+t),e+t>n&&(i=n-t)}if(this.lngRange){let e=(s+o)/2,t=nr(h.x,e-this.worldSize/2,e+this.worldSize/2),i=l.x/2;t-i<s&&(r=s+i),t+i>o&&(r=o-i)}(void 0!==r||void 0!==i)&&(this.center=this.unproject(new Ge.default(void 0!==r?r:h.x,void 0!==i?i:h.y)).wrap()),this._unmodified=u,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this._fov/2,t=this.centerOffset,r=this.point.x,i=this.point.y;this.cameraToCenterDistance=.5/Math.tan(e)*this.height,this._pixelPerMeter=Rc(1,this.center.lat)*this.worldSize;let a=$.identity(new Float64Array(16));$.scale(a,a,[this.width/2,-this.height/2,1]),$.translate(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=$.identity(new Float64Array(16)),$.scale(a,a,[1,-1,1]),$.translate(a,a,[-1,-1,0]),$.scale(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);let n=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,s=Math.PI/2+this._pitch,o=this._fov*(.5+t.y/this.height),l=Math.sin(o)*n/Math.sin(Te(Math.PI-s-o,.01,Math.PI-.01)),u=this.getHorizon(),h=2*Math.atan(u/this.cameraToCenterDistance)*(.5+t.y/(2*u)),c=Math.sin(h)*n/Math.sin(Te(Math.PI-s-h,.01,Math.PI-.01)),p=Math.min(l,c),d=1.01*(Math.cos(Math.PI/2-this._pitch)*p+n),f=this.height/50;a=new Float64Array(16),$.perspective(a,this._fov,this.width/this.height,f,d),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,$.scale(a,a,[1,-1,1]),$.translate(a,a,[0,0,-this.cameraToCenterDistance]),$.rotateX(a,a,this._pitch),$.rotateZ(a,a,this.angle),$.translate(a,a,[-r,-i,0]),this.mercatorMatrix=$.scale([],a,[this.worldSize,this.worldSize,this.worldSize]),$.scale(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=$.multiply(new Float64Array(16),this.labelPlaneMatrix,a),this.projMatrix=a,this.invProjMatrix=$.invert([],a),this.pixelMatrix3D=$.multiply(new Float64Array(16),this.labelPlaneMatrix,a);let m=this.width%2/2,y=this.height%2/2,g=Math.cos(this.angle),_=Math.sin(this.angle),x=r-Math.round(r)+g*m+_*y,v=i-Math.round(i)+g*y+_*m,b=new Float64Array(a);if($.translate(b,b,[x>.5?x-1:x,v>.5?v-1:v,0]),this.alignedProjMatrix=b,a=$.invert(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new Ge.default(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return Je.transformMat4(t,t,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=this._pitch,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Ge.default(0,t))}getCameraQueryGeometry(e){let t=this.getCameraPoint();if(1===e.length)return[e[0],t];{let r=t.x,i=t.y,a=t.x,n=t.y;for(let t of e)r=Math.min(r,t.x),i=Math.min(i,t.y),a=Math.max(a,t.x),n=Math.max(n,t.y);return[new Ge.default(r,i),new Ge.default(a,i),new Ge.default(a,n),new Ge.default(r,n),new Ge.default(r,i)]}}setCameraPosition(e){let{lng:t,lat:r,altitude:i,pitch:a,bearing:n}=e,s=a*(Math.PI/180),o=.5/Math.tan(this._fov/2)*this.height,l=Math.abs(Math.cos(s)*o)/i*(2*Math.PI*6378137*Math.abs(Math.cos(r*(Math.PI/180)))),u=Math.tan(s)*o,h=new Ge.default(this.width/2,this.height/2+u),c=new K(t,r);this.zoom=Math.log(l/this.tileSize)/Math.LN2,this.pitch=a,this.bearing=n,this.setLocationAtPoint(c,h)}getCameraAltitude(){let e=this._pitch,t=Math.cos(e)*this.cameraToCenterDistance,r=Math.tan(e)*this.cameraToCenterDistance,i=this.pointLocation(this.centerPoint.add(new Ge.default(0,r))),a=2*Math.PI*6378137;return t/(this.worldSize/(a*Math.abs(Math.cos(i.lat*(Math.PI/180)))))}};function Ix(e,t){let r=!1,i=null,a=u((()=>{i=null,r&&(e(),i=setTimeout(a,t),r=!1)}),"later");return()=>(r=!0,i||a(),i)}u(kn,"Transform"),d(),d(),u(Ix,"throttle");var nu=class{constructor(e){this._getCurrentHash=u((()=>{let e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((e=>e.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")}),"_getCurrentHash"),this._onHashChange=u((()=>{let e=this._getCurrentHash();if(e.length>=3&&!e.some((e=>isNaN(e)))){let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0}return!1}),"_onHashChange"),this._updateHashUnthrottled=u((()=>{let e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch(e){}}),"_updateHashUnthrottled"),this._updateHash=Ix(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(e){let t=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,i),n=Math.round(t.lng*a)/a,s=Math.round(t.lat*a)/a,o=this._map.getBearing(),l=this._map.getPitch(),u="";if(u+=e?`/${n}/${s}/${r}`:`${r}/${s}/${n}`,(o||l)&&(u+="/"+Math.round(10*o)/10),l&&(u+=`/${Math.round(l)}`),this._hashName){let e=this._hashName,t=!1,r=window.location.hash.slice(1).split("&").map((r=>{let i=r.split("=")[0];return i===e?(t=!0,`${i}=${u}`):r})).filter((e=>e));return t||r.push(`${e}=${u}`),`#${r.join("&")}`}return`#${u}`}};u(nu,"Hash"),d(),d();var Cx=ae(Pe()),au={linearity:.3,easing:zu(0,0,.3,1)},tT=R({deceleration:2500,maxSpeed:1400},au),rT=R({deceleration:20,maxSpeed:1400},au),iT=R({deceleration:1e3,maxSpeed:360},au),nT=R({deceleration:1e3,maxSpeed:90},au),ou=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ne.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=ne.now();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let t={zoom:0,bearing:0,pitch:0,pan:new Cx.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of this._inertiaBuffer)t.zoom+=e.zoomDelta||0,t.bearing+=e.bearingDelta||0,t.pitch+=e.pitchDelta||0,e.panDelta&&t.pan._add(e.panDelta),e.around&&(t.around=e.around),e.pinchAround&&(t.pinchAround=e.pinchAround);let r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,i={};if(t.pan.mag()){let a=lu(t.pan.mag(),r,R({},tT,e||{}));i.offset=t.pan.mult(a.amount/t.pan.mag()),i.center=this._map.transform.center,su(i,a)}if(t.zoom){let e=lu(t.zoom,r,rT);i.zoom=this._map.transform.zoom+e.amount,su(i,e)}if(t.bearing){let e=lu(t.bearing,r,iT);i.bearing=this._map.transform.bearing+Te(e.amount,-179,179),su(i,e)}if(t.pitch){let e=lu(t.pitch,r,nT);i.pitch=this._map.transform.pitch+e.amount,su(i,e)}if(i.zoom||i.bearing){let e=void 0===t.pinchAround?t.around:t.pinchAround;i.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),R(i,{noMoveStart:!0})}};function su(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function lu(e,t,r){let{maxSpeed:i,linearity:a,deceleration:n}=r,s=Te(e*a/(t/1e3),-i,i),o=Math.abs(s)/(n*a);return{easing:r.easing,duration:1e3*o,amount:s*(o/2)}}u(ou,"HandlerInertia"),u(su,"extendDuration"),u(lu,"calculateEasing");var Mx=ae(Pe()),uu=u((e=>e.zoom||e.drag||e.pitch||e.rotate),"isMoving"),bp=class extends z{};function vp(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}u(bp,"RenderFrameEvent"),u(vp,"hasChange");var cu=class{constructor(e,t){this.handleWindowEvent=u((e=>{this.handleEvent(e,`${e.type}Window`)}),"handleWindowEvent"),this.handleEvent=u(((e,t)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;let r="renderFrame"===e.type?void 0:e,i={needsRenderFrame:!1},a={},n={},s=e.touches,o=s?this._getMapTouches(s):void 0,l=o?F.touchPos(this._el,o):F.mousePos(this._el,e);for(let{handlerName:s,handler:u,allowed:h}of this._handlers){if(!u.isEnabled())continue;let c;this._blockedByActive(n,h,s)?u.reset():u[t||e.type]&&(c=u[t||e.type](e,l,o),this.mergeHandlerResult(i,a,c,s,r),c&&c.needsRenderFrame&&this._triggerRenderFrame()),(c||u.isActive())&&(n[s]=u)}let u={};for(let e in this._previousActiveHandlers)n[e]||(u[e]=r);this._previousActiveHandlers=n,(Object.keys(u).length||vp(i))&&(this._changes.push([i,a,u]),this._triggerRenderFrame()),(Object.keys(n).length||vp(i))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:h}=i;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))}),"handleEvent"),this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ou(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={};let r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]]}destroy(){}_addDefaultHandlers(e){}_add(e,t,r){this._handlers.push({handlerName:e,handler:t,allowed:r}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||!1}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(uu(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,r){for(let i in e)if(i!==r&&(!t||t.indexOf(i)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let r of e){let e=r.target;this._el.contains(e)&&t.push(r)}return t}mergeHandlerResult(e,t,r,i,a){if(!r)return;R(e,r);let n={handlerName:i,originalEvent:r.originalEvent||a};void 0!==r.zoomDelta&&(t.zoom=n),void 0!==r.panDelta&&(t.drag=n),void 0!==r.pitchDelta&&(t.pitch=n),void 0!==r.bearingDelta&&(t.rotate=n)}_applyChanges(){let e={},t={},r={};for(let[i,a,n]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new Mx.default(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),void 0!==i.around&&(e.around=i.around),void 0!==i.pinchAround&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),R(t,a),R(r,n);this._updateMapTransform(e,t,r),this._changes=[]}_updateMapTransform(e,t,r){let i=this._map,a=i._getTransformForUpdate(),n=i.terrain;if(!(vp(e)||n&&this._terrainMovement))return this._fireEvents(t,r,!0);let{panDelta:s,zoomDelta:o,bearingDelta:l,pitchDelta:u,around:h,pinchAround:c}=e;void 0!==c&&(h=c),i._stop(!0),h=h||i.transform.centerPoint;let p=a.pointLocation(s?h.sub(s):h);l&&(a.bearing+=l),u&&(a.pitch+=u),o&&(a.zoom+=o),n?this._terrainMovement||!t.drag&&!t.zoom?t.drag&&this._terrainMovement?a.center=a.pointLocation(a.centerPoint.sub(s)):a.setLocationAtPoint(p,h):(this._terrainMovement=!0,a.freezeElevation=!0,a.setLocationAtPoint(p,h),this._map.once("moveend",(()=>{a.freezeElevation=!1,this._terrainMovement=!1,a.recalculateZoom(i.terrain)}))):a.setLocationAtPoint(p,h),i._applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,r,!0)}_fireEvents(e,t,r){let i=uu(this._eventsInProgress),a=uu(e),n={};for(let t in e){let{originalEvent:r}=e[t];this._eventsInProgress[t]||(n[`${t}start`]=r),this._eventsInProgress[t]=e[t]}!i&&a&&this._fireEvent("movestart",a.originalEvent);for(let e in n)this._fireEvent(e,n[e]);a&&this._fireEvent("move",a.originalEvent);for(let t in e){let{originalEvent:r}=e[t];this._fireEvent(t,r)}let s,o={};for(let e in this._eventsInProgress){let{handlerName:r,originalEvent:i}=this._eventsInProgress[e];this._handlersById[r].isActive()||(delete this._eventsInProgress[e],s=t[r]||i,o[`${e}end`]=s)}for(let e in o)this._fireEvent(e,o[e]);let l=uu(this._eventsInProgress);if(r&&(i||a)&&!l){this._updatingCamera=!0;let e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),t=u((e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap),"shouldSnapToNorth");e?(t(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:s})):(this._map.fire(new z("moveend",{originalEvent:s})),t(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new z(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{delete this._frameId,this.handleEvent(new bp("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}};u(cu,"HandlerManager"),d();var rr=ae(Pe()),pu=class extends fe{constructor(e,t){super(),this._renderFrameCallback=u((()=>{let e=Math.min((ne.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}),"_renderFrameCallback"),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=t.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new K(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(e,t,r){return e=rr.default.convert(e).mult(-1),this.panTo(this.transform.center,R({offset:e},t),r)}panTo(e,t,r){return this.easeTo(R({center:e},t),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,r){return this.easeTo(R({zoom:e},t),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,r){return this.easeTo(R({bearing:e},t),r)}resetNorth(e,t){return this.rotateTo(0,R({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(R({bearing:0,pitch:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}cameraForBounds(e,t){e=Qe.convert(e);let r=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,t)}_cameraForBoxAndBearing(e,t,r,i){let a={top:0,bottom:0,right:0,left:0};if("number"==typeof(i=R({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding){let e=i.padding;i.padding={top:e,bottom:e,right:e,left:e}}i.padding=R(a,i.padding);let n=this.transform,s=n.padding,o=n.project(K.convert(e)),l=n.project(K.convert(t)),u=o.rotate(-r*Math.PI/180),h=l.rotate(-r*Math.PI/180),c=new rr.default(Math.max(u.x,h.x),Math.max(u.y,h.y)),p=new rr.default(Math.min(u.x,h.x),Math.min(u.y,h.y)),d=c.sub(p),f=(n.width-(s.left+s.right+i.padding.left+i.padding.right))/d.x,m=(n.height-(s.top+s.bottom+i.padding.top+i.padding.bottom))/d.y;if(m<0||f<0)return void Me("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let y=Math.min(n.scaleZoom(n.scale*Math.min(f,m)),i.maxZoom),g=rr.default.convert(i.offset),_=(i.padding.left-i.padding.right)/2,x=(i.padding.top-i.padding.bottom)/2,v=new rr.default(_,x).rotate(r*Math.PI/180),b=g.add(v).mult(n.scale/n.zoomScale(y));return{center:n.unproject(o.add(l).div(2).sub(b)),zoom:y,bearing:r}}fitBounds(e,t,r){return this._fitInternal(this.cameraForBounds(e,t),t,r)}fitScreenCoordinates(e,t,r,i,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(rr.default.convert(e)),this.transform.pointLocation(rr.default.convert(t)),r,i),i,a)}_fitInternal(e,t,r){return e?(delete(t=R(e,t)).padding,t.linear?this.easeTo(t,r):this.flyTo(t,r)):this}jumpTo(e,t){this.stop();let r=this._getTransformForUpdate(),i=!1,a=!1,n=!1;return"zoom"in e&&r.zoom!==+e.zoom&&(i=!0,r.zoom=+e.zoom),void 0!==e.center&&(r.center=K.convert(e.center)),"bearing"in e&&r.bearing!==+e.bearing&&(a=!0,r.bearing=+e.bearing),"pitch"in e&&r.pitch!==+e.pitch&&(n=!0,r.pitch=+e.pitch),null!=e.padding&&!r.isPaddingEqual(e.padding)&&(r.padding=e.padding),this._applyUpdatedTransform(r),this.fire(new z("movestart",t)).fire(new z("move",t)),i&&this.fire(new z("zoomstart",t)).fire(new z("zoom",t)).fire(new z("zoomend",t)),a&&this.fire(new z("rotatestart",t)).fire(new z("rotate",t)).fire(new z("rotateend",t)),n&&this.fire(new z("pitchstart",t)).fire(new z("pitch",t)).fire(new z("pitchend",t)),this.fire(new z("moveend",t))}calculateCameraOptionsFromTo(e,t,r,i=0){let a=Ee.fromLngLat(e,t),n=Ee.fromLngLat(r,i),s=n.x-a.x,o=n.y-a.y,l=n.z-a.z,u=Math.hypot(s,o,l);if(0===u)throw new Error("Can't calculate camera options with same From and To");let h=Math.hypot(s,o),c=this.transform.scaleZoom(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=180*Math.atan2(s,-o)/Math.PI,d=180*Math.acos(h/u)/Math.PI;return d=l<0?90-d:90+d,{center:n.toLngLat(),zoom:c,pitch:d,bearing:p}}easeTo(e,t){this._stop(!1,e.easeId),(!1===(e=R({offset:[0,0],duration:500,easing:Fu},e)).animate||!e.essential&&ne.prefersReducedMotion)&&(e.duration=0);let r=this._getTransformForUpdate(),i=this.getZoom(),a=this.getBearing(),n=this.getPitch(),s=this.getPadding(),o="zoom"in e?+e.zoom:i,l="bearing"in e?this._normalizeBearing(e.bearing,a):a,u="pitch"in e?+e.pitch:n,h="padding"in e?e.padding:r.padding;console.log("aaaa",o),console.log("new zoom",o);let c=rr.default.convert(e.offset),p=r.centerPoint.add(c),d=r.pointLocation(p),f=K.convert(e.center||d);this._normalizeCenter(f);let m,y,g=r.project(d),_=r.project(f).sub(g),x=r.zoomScale(o-i);e.around&&(m=K.convert(e.around),y=r.locationPoint(m));let v={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||o!==i,this._rotating=this._rotating||a!==l,this._pitching=this._pitching||u!==n,this._padding=!r.isPaddingEqual(h),this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,v),this.terrain&&this._prepareElevation(f),this._ease((d=>{if(this._zooming&&(r.zoom=Le.number(i,o,d)),this._rotating&&(r.bearing=Le.number(a,l,d)),this._pitching&&(r.pitch=Te(Le.number(n,u,d),this.transform.minPitch,this.transform.maxPitch)),this._padding&&(r.interpolatePadding(s,h,d),p=r.centerPoint.add(c)),this.terrain&&!e.freezeElevation&&this._updateElevation(d),m)r.setLocationAtPoint(m,y);else{let e=r.zoomScale(r.zoom-i),t=o>i?Math.min(2,x):Math.max(.5,x),a=Math.pow(t,1-d),n=r.unproject(g.add(_.mult(d*a)).mult(e));r.setLocationAtPoint(r.renderWorldCopies?n.wrap():n,p)}this._applyUpdatedTransform(r),this._fireMoveEvents(t)}),(e=>{this.terrain&&this._finalizeElevation(),this._afterEase(t,e)}),e),this}_prepareEase(e,t,r={}){this._moving=!0,!t&&!r.moving&&this.fire(new z("movestart",e)),this._zooming&&!r.zooming&&this.fire(new z("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new z("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new z("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(e,this.terrain),this.transform.freezeElevation=!0}_updateElevation(e){let t=this.transform.getElevation(this._elevationCenter,this.terrain);if(e<1&&t!==this._elevationTarget){let r=this._elevationTarget-this._elevationStart,i=(t-(r*e+this._elevationStart))/(1-e);this._elevationStart+=e*(r-i),this._elevationTarget=t}this.transform.elevation=Le.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(e){if(!this.transformCameraUpdate)return;let t=e.clone(),{center:r,zoom:i,pitch:a,bearing:n,elevation:s}=this.transformCameraUpdate(t);r&&(t.center=r),void 0!==i&&(t.zoom=i),void 0!==a&&(t.pitch=a),void 0!==n&&(t.bearing=n),void 0!==s&&(t.elevation=s),this.transform.apply(t)}_fireMoveEvents(e){this.fire(new z("move",e)),this._zooming&&this.fire(new z("zoom",e)),this._rotating&&this.fire(new z("rotate",e)),this._pitching&&this.fire(new z("pitch",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let r=this._zooming,i=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new z("zoomend",e)),i&&this.fire(new z("rotateend",e)),a&&this.fire(new z("pitchend",e)),this.fire(new z("moveend",e))}flyTo(e,t){if(!e.essential&&ne.prefersReducedMotion){let r=Gt(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,t)}this.stop(),e=R({offset:[0,0],speed:1.2,curve:1.42,easing:Fu},e);let r=this._getTransformForUpdate(),i=this.getZoom(),a=this.getBearing(),n=this.getPitch(),s=this.getPadding(),o="zoom"in e?Te(+e.zoom,r.minZoom,r.maxZoom):i,l="bearing"in e?this._normalizeBearing(e.bearing,a):a,h="pitch"in e?+e.pitch:n,c="padding"in e?e.padding:r.padding,p=r.zoomScale(o-i),d=rr.default.convert(e.offset),f=r.centerPoint.add(d),m=r.pointLocation(f),y=K.convert(e.center||m);this._normalizeCenter(y);let g=r.project(m),_=r.project(y).sub(g),x=e.curve,v=Math.max(r.width,r.height),b=v/p,w=_.mag();if("minZoom"in e){let t=Te(Math.min(e.minZoom,i,o),r.minZoom,r.maxZoom),a=v/r.zoomScale(t-i);x=Math.sqrt(a/w*2)}let S=x*x;function A(e){let t=(b*b-v*v+(e?-1:1)*S*S*w*w)/(2*(e?b:v)*S*w);return Math.log(Math.sqrt(t*t+1)-t)}function I(e){return(Math.exp(e)-Math.exp(-e))/2}function M(e){return(Math.exp(e)+Math.exp(-e))/2}function T(e){return I(e)/M(e)}u(A,"zoomOutFactor"),u(I,"sinh"),u(M,"cosh"),u(T,"tanh");let C=A(!1),P=u((function(e){return M(C)/M(C+x*e)}),"w"),k=u((function(e){return v*((M(C)*T(C+x*e)-I(C))/S)/w}),"u"),z=(A(!0)-C)/x;if(Math.abs(w)<1e-6||!isFinite(z)){if(Math.abs(v-b)<1e-6)return this.easeTo(e,t);let r=b<v?-1:1;z=Math.abs(Math.log(b/v))/x,k=u((function(){return 0}),"u"),P=u((function(e){return Math.exp(r*x*e)}),"w")}if("duration"in e)e.duration=+e.duration;else{let t="screenSpeed"in e?+e.screenSpeed/x:+e.speed;e.duration=1e3*z/t}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==l,this._pitching=h!==n,this._padding=!r.isPaddingEqual(c),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(y),this._ease((u=>{let p=u*z,m=1/P(p);r.zoom=1===u?o:i+r.scaleZoom(m),this._rotating&&(r.bearing=Le.number(a,l,u)),this._pitching&&(r.pitch=Le.number(n,h,u)),this._padding&&(r.interpolatePadding(s,c,u),f=r.centerPoint.add(d)),this.terrain&&!e.freezeElevation&&this._updateElevation(u);let x=1===u?y:r.unproject(g.add(_.mult(k(p))).mult(m));r.setLocationAtPoint(r.renderWorldCopies?x.wrap():x,f),this._applyUpdatedTransform(r),this._fireMoveEvents(t)}),(()=>{this.terrain&&this._finalizeElevation(),this._afterEase(t)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}if(!e){let e=this.handlers;e&&e.stop(!1)}return this}_ease(e,t,r){!1===r.animate||0===r.duration?(e(1),t()):(this._easeStart=ne.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=nr(e,-180,180);let r=Math.abs(e-t);return Math.abs(e-360-t)<r&&(e-=360),Math.abs(e+360-t)<r&&(e+=360),e}_normalizeCenter(e){let t=this.transform;if(!t.renderWorldCopies||t.lngRange)return;let r=e.lng-t.center.lng;e.lng+=r>180?-360:r<-180?360:0}queryTerrainElevation(e){return this.terrain?this.transform.getElevation(K.convert(e),this.terrain)-this.transform.elevation:null}};u(pu,"Camera");var gr=ae(Pe());d();var Ln=class{constructor(e={}){this._toggleAttribution=u((()=>{this._container.classList.contains("outdoor-compact")&&(this._container.classList.contains("outdoor-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("outdoor-compact-show")):(this._container.classList.add("outdoor-compact-show"),this._container.removeAttribute("open")))}),"_toggleAttribution"),this._updateData=u((e=>{e&&("metadata"===e.sourceDataType||"visibility"===e.sourceDataType||"style"===e.dataType||"terrain"===e.type)&&this._updateAttributions()}),"_updateData"),this._updateCompact=u((()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):!this._container.classList.contains("outdoor-compact")&&!this._container.classList.contains("outdoor-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("outdoor-compact","outdoor-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("outdoor-compact")&&this._container.classList.remove("outdoor-compact","outdoor-compact-show"))}),"_updateCompact"),this._updateCompactMinimize=u((()=>{this._container.classList.contains("outdoor-compact")&&this._container.classList.contains("outdoor-compact-show")&&this._container.classList.remove("outdoor-compact-show")}),"_updateCompactMinimize"),this.options=e,this.position=this.options.position||this.getDefaultPosition()}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options&&this.options.compact,this._container=F.create("details",`outdoor-ctrl-attrib outdoor-ctrl-attrib-${this.position}`),this._compactButton=F.create("summary","outdoor-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=F.create("div","outdoor-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._attributions=[],this._container}onRemove(){F.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let r=this._map._getUIString(`AttributionControl.${t}`);e.title=r,e.setAttribute("aria-label",r)}get attributions(){return[...this._attributions]}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((e=>"string"!=typeof e?"":e))):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.sourceCaches;for(let r in t){let i=t[r];if(i.used||i.usedForTerrain){let t=i.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter((e=>String(e).trim())),e.sort(((e,t)=>e.length-t.length)),e=e.filter(((t,r)=>{for(let i=r+1;i<e.length;i++)if(e[i].indexOf(t)>=0)return!1;return!0})),this._attributions=e;let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=r,this._container.classList.remove("outdoor-attrib-empty")):this._container.classList.add("outdoor-attrib-empty"),this._updateCompact(),this._editLink=null)}show(){this._container.classList.remove("outdoor-ctrl-attrib-hide")}hide(){this._container.classList.add("outdoor-ctrl-attrib-hide")}setPosition(e){this._container.classList.remove(`outdoor-ctrl-attrib-${this.position}`),this.position=e,this._container.classList.add(`outdoor-ctrl-attrib-${this.position}`)}};u(Ln,"AttributionControl"),d();var Dn=class{constructor(e={}){this._updateCompact=u((()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}}),"_updateCompact"),this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=F.create("div","maplibregl-ctrl");let t=F.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){F.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};u(Dn,"LogoControl"),d();var aT=ae(Pe()),zn=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r,i={}){let a=F.mousePos(t.getCanvasContainer(),r);super(e,R({point:a,lngLat:t.unproject(a),originalEvent:r},i)),this._defaultPrevented=!1,this.target=t}};u(zn,"MapMouseEvent"),d();var Nt,hu=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,r=t?this._queue.concat(t):this._queue;for(let t of r)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];for(let r of t)if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};u(hu,"TaskQueue"),d(),function(e){e.create="create",e.load="load",e.fullLoad="fullLoad"}(Nt||(Nt={}));var mu=null,co=[],oT=60,wp=1e3/oT,Sp="loadTime",Pp="fullLoadTime",$r={mark(e){performance.mark(e)},frame(e){let t=e;if(null!=mu){let e=t-mu;co.push(e)}mu=t},clearMetrics(){mu=null,co=[],performance.clearMeasures(Sp),performance.clearMeasures(Pp);for(let e in Nt)performance.clearMarks(Nt[e])},getPerformanceMetrics(){performance.measure(Sp,Nt.create,Nt.load),performance.measure(Pp,Nt.create,Nt.fullLoad);let e=performance.getEntriesByName(Sp)[0].duration,t=performance.getEntriesByName(Pp)[0].duration,r=co.length,i=1/(co.reduce(((e,t)=>e+t),0)/r/1e3),a=co.filter((e=>e>wp)).reduce(((e,t)=>e+(t-wp)/wp),0);return{loadTime:e,fullLoadTime:t,fps:i,percentDroppedFrames:a/(r+a)*100,totalFrames:r}}};d();var Ex={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};d(),d();var kx=ve([{name:"a_pos3d",type:"Int16",components:3}]);d();var fu=class extends fe{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,t){this.sourceCache.update(e,t),this._renderableTilesKeys=[];let r={};for(let i of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t}))r[i.key]=!0,this._renderableTilesKeys.push(i.key),this._tiles[i.key]||(i.posMatrix=new Float64Array(16),$.ortho(i.posMatrix,0,O,0,O,0,1),this._tiles[i.key]=new Pn(i,this.tileSize));for(let e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(e){for(let t in this._tiles){let r=this._tiles[t];(!e||r.tileID.equals(e)||r.tileID.isChildOf(e)||e.isChildOf(r.tileID))&&(r.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let t={};for(let r of this._renderableTilesKeys){let i=this._tiles[r].tileID;if(i.canonical.equals(e.canonical)){let i=e.clone();i.posMatrix=new Float64Array(16),$.ortho(i.posMatrix,0,O,0,O,0,1),t[r]=i}else if(i.canonical.isChildOf(e.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16);let n=i.canonical.z-e.canonical.z,s=i.canonical.x-(i.canonical.x>>n<<n),o=i.canonical.y-(i.canonical.y>>n<<n),l=O>>n;$.ortho(a.posMatrix,0,l,0,l,0,1),$.translate(a.posMatrix,a.posMatrix,[-s*l,-o*l,0]),t[r]=a}else if(e.canonical.isChildOf(i.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16);let n=e.canonical.z-i.canonical.z,s=e.canonical.x-(e.canonical.x>>n<<n),o=e.canonical.y-(e.canonical.y>>n<<n),l=O>>n;$.ortho(a.posMatrix,0,O,0,O,0,1),$.translate(a.posMatrix,a.posMatrix,[s*l,o*l,0]),$.scale(a.posMatrix,a.posMatrix,[1/2**n,1/2**n,0]),t[r]=a}}return t}getSourceTile(e,t){let r=this.sourceCache._source,i=e.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(i).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!a||!a.dem)&&t)for(;i>=r.minzoom&&(!a||!a.dem);)a=this.sourceCache.getTileByID(e.scaledTo(i--).key);return a}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter((t=>t.timeAdded>=e))}};u(fu,"TerrainSourceCache");var du=class{constructor(e,t,r){this.painter=e,this.sourceCache=new fu(t),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,t,r,i=O){var a;if(!(t>=0&&t<i&&r>=0&&r<i))return 0;let n=this.getTerrainData(e),s=null==(a=n.tile)?void 0:a.dem;if(!s)return 0;let o=nn.transformMat4([],[t/i*O,r/i*O],n.u_terrain_matrix),l=[o[0]*s.dim,o[1]*s.dim],u=Math.floor(l[0]),h=Math.floor(l[1]),c=l[0]-u,p=l[1]-h;return s.get(u,h)*(1-c)*(1-p)+s.get(u+1,h)*c*(1-p)+s.get(u,h+1)*(1-c)*p+s.get(u+1,h+1)*c*p}getElevation(e,t,r,i=O){return this.getDEMElevation(e,t,r,i)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let e=this.painter.context,t=new Se({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new xe(e,t,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new xe(e,new Se({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=$.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let e=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new xe(e,t.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),t.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let r=t&&t+t.tileID.key+e.key;if(r&&!this._demMatrixCache[r]){let r=this.sourceCache.sourceCache._source.maxzoom,i=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=r?i=e.canonical.z-r:Me("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>i<<i),n=e.canonical.y-(e.canonical.y>>i<<i),s=$.fromScaling(new Float64Array(16),[1/(O<<i),1/(O<<i),0]);$.translate(s,s,[a*O,n*O,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:t&&t.dem&&t.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:t&&t.dem&&t.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t&&t.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(e){let t=this.painter,r=t.width/devicePixelRatio,i=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==r||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new xe(t.context,{width:r,height:i,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new xe(t.context,{width:r,height:i,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(r,i,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,r,i))),this._fbo.colorAttachment.set("coords"===e?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let t=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,r=0;e<this._coordsTextureSize;e++)for(let i=0;i<this._coordsTextureSize;i++,r+=4)t[r+0]=255&i,t[r+1]=255&e,t[r+2]=i>>8<<4|e>>8,t[r+3]=0;let r=new Se({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),i=new xe(e,r,e.gl.RGBA,{premultiply:!1});return i.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(e){let t=new Uint8Array(4),r=this.painter.context,i=r.gl;r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),r.bindFramebuffer.set(null);let a=t[0]+(t[2]>>4<<8),n=t[1]+((15&t[2])<<8),s=this.coordsIndex[255-t[3]],o=s&&this.sourceCache.getTileByID(s);if(!o)return null;let l=this._coordsTextureSize,u=(1<<o.tileID.canonical.z)*l;return new Ee((o.tileID.canonical.x*l+a)/u,(o.tileID.canonical.y*l+n)/u,this.getElevation(o.tileID,a,n,l))}getTerrainMesh(){if(this._mesh)return this._mesh;let e=this.painter.context,t=new Qo,r=new lt,i=this.meshSize,a=O/i,n=i*i;for(let e=0;e<=i;e++)for(let r=0;r<=i;r++)t.emplaceBack(r*a,e*a,0);for(let e=0;e<n;e+=i+1)for(let t=0;t<i;t++)r.emplaceBack(t+e,i+t+e+1,i+t+e+2),r.emplaceBack(t+e,i+t+e+2,t+e+1);let s=t.length,o=s+2*(i+1);for(let e of[0,1])for(let r=0;r<=i;r++)for(let i of[0,1])t.emplaceBack(r*a,e*O,i);for(let e=0;e<2*i;e+=2)r.emplaceBack(o+e,o+e+1,o+e+3),r.emplaceBack(o+e,o+e+3,o+e+2),r.emplaceBack(s+e,s+e+3,s+e+1),r.emplaceBack(s+e,s+e+2,s+e+3);let l=t.length,u=l+2*(i+1);for(let e of[0,1])for(let r=0;r<=i;r++)for(let i of[0,1])t.emplaceBack(e*O,r*a,i);for(let e=0;e<2*i;e+=2)r.emplaceBack(l+e,l+e+1,l+e+3),r.emplaceBack(l+e,l+e+3,l+e+2),r.emplaceBack(u+e,u+e+3,u+e+1),r.emplaceBack(u+e,u+e+2,u+e+3);return this._mesh={indexBuffer:e.createIndexBuffer(r),vertexBuffer:e.createVertexBuffer(t,kx.members),segments:le.simpleSegment(0,0,t.length,r.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*_i/Math.pow(2,e)/5}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,r={minElevation:null,maxElevation:null};return t&&t.dem&&(r.minElevation=t.dem.min*this.exaggeration,r.maxElevation=t.dem.max*this.exaggeration),r}};u(du,"Terrain"),d(),d();var yu=class{constructor(e,t,r){this._context=e,this._size=t,this._tileSize=r,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let t=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),r=new xe(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return r.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(r.texture),{id:e,fbo:t,texture:r,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((t=>e.id!==t)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((e=>!e.inUse))}};u(yu,"RenderPool");var Fn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0},gu=class{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new yu(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter((r=>!e._layers[r].isHidden(t))),this._coordsDescendingInv={};for(let t in e.sourceCaches){this._coordsDescendingInv[t]={};let r=e.sourceCaches[t].getVisibleCoordinates();for(let e of r){let r=this.terrain.sourceCache.getTerrainCoords(e);for(let e in r)this._coordsDescendingInv[t][e]||(this._coordsDescendingInv[t][e]=[]),this._coordsDescendingInv[t][e].push(r[e])}}this._coordsDescendingInvStr={};for(let t of e._order){let r=e._layers[t],i=r.source;if(Fn[r.type]&&!this._coordsDescendingInvStr[i]){this._coordsDescendingInvStr[i]={};for(let e in this._coordsDescendingInv[i])this._coordsDescendingInvStr[i][e]=this._coordsDescendingInv[i][e].map((e=>e.key)).sort().join()}}for(let e of this._renderableTiles)for(let t in this._coordsDescendingInvStr){let r=this._coordsDescendingInvStr[t][e.tileID.key];r&&r!==e.rttCoords[t]&&(e.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;let t=e.type,r=this.painter,i=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Fn[t]&&((!this._prevType||!Fn[this._prevType])&&this._stacks.push([]),this._prevType=t,this._stacks[this._stacks.length-1].push(e.id),!i))return!0;if(Fn[this._prevType]||Fn[t]&&i){this._prevType=t;let e=this._stacks.length-1,i=this._stacks[e]||[];for(let t of this._renderableTiles){if(this.pool.isFull()&&(_p(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(t),t.rtt[e]){let r=this.pool.getObjectForId(t.rtt[e].id);if(r.stamp===t.rtt[e].stamp){this.pool.useObject(r);continue}}let a=this.pool.getOrCreateFreeObject();this.pool.useObject(a),this.pool.stampObject(a),t.rtt[e]={id:a.id,stamp:a.stamp},r.context.bindFramebuffer.set(a.fbo.framebuffer),r.context.clear({color:X.transparent,stencil:0}),r.currentStencilSource=void 0;for(let e=0;e<i.length;e++){let n=r.style._layers[i[e]],s=n.source?this._coordsDescendingInv[n.source][t.tileID.key]:[t.tileID];r.context.viewport.set([0,0,a.fbo.width,a.fbo.height]),r._renderTileClippingMasks(n,s),r.renderLayer(r,r.style.sourceCaches[n.source],n,s),n.source&&(t.rttCoords[n.source]=this._coordsDescendingInvStr[n.source][t.tileID.key])}}return _p(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Fn[t]}return!1}};u(gu,"RenderToTexture");var sT=xo.version,xu=-2,Lx=22,Gr=0,Dx=90,_u=90,lT={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:xu,maxZoom:Lx,minPitch:Gr,maxPitch:Dx,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:ot.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},bu=class extends pu{constructor(e){if($r.mark(Nt.create),null!=(e=R({},lT,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<Gr)throw new Error(`minPitch must be greater than or equal to ${Gr}`);if(null!=e.maxPitch&&e.maxPitch>_u)throw new Error(`maxPitch must be less than or equal to ${_u}`);if(super(new kn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._cooperativeGesturesOnWheel=u((e=>{this._onCooperativeGesture(e,e[this._metaKey],1)}),"_cooperativeGesturesOnWheel"),this._contextLost=u((e=>{e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new z("webglcontextlost",{originalEvent:e}))}),"_contextLost"),this._contextRestored=u((e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new z("webglcontextrestored",{originalEvent:e}))}),"_contextRestored"),this._onMapScroll=u((e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}),"_onMapScroll"),this._onWindowOnline=u((()=>{this._update()}),"_onWindowOnline"),this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._metaKey=0===navigator.platform.indexOf("Mac")?"metaKey":"ctrlKey",this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new hu,this._controls=[],this._mapId=bo(),this._locale=R({},Ex,e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=mt.addThrottleControl((()=>this.isMoving())),this._requestManager=new To(e.transformRequest),this._canvas=e.canvas,this._canvasContainer=e.canvasContainer,"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let e=!1;this._resizeObserver=new ResizeObserver((t=>{e?this._trackResize&&this.resize(t)._update():e=!0})),this._resizeObserver.observe(this._container)}this.handlers=new cu(this,e),this._cooperativeGestures&&this._setupCooperativeGestures();let t="string"==typeof e.hash&&e.hash||void 0;this._hash=e.hash&&new nu(t).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,R({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Ln({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new Dn,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new z(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new z(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new z("sourcedataabort",e))}))}_getMapId(){return this._mapId}addControl(e,t){return void 0===t&&(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),e&&e.onAdd?this:this.fire(new Z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")))}removeControl(e){if(!e||!e.onRemove)return this.fire(new Z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,r,i){return null==i&&this.terrain&&(i=this.transform.getElevation(r,this.terrain)),super.calculateCameraOptionsFromTo(e,t,r,i)}resize(e){var t;let r=this._containerDimensions(),i=r[0],a=r[1],n=this._getClampedPixelRatio(i,a);if(this.painter.resize(i,a,n),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let t=this._getClampedPixelRatio(i,a);this._resizeCanvas(i,a,t),this.painter.resize(i,a,t)}this.transform.resize(i,a),null==(t=this._requestedCameraState)||t.resize(i,a);let s=!this._moving;return s&&(this.stop(),this.fire(new z("movestart",e)).fire(new z("move",e))),this.fire(new z("resize",e)),s&&this.fire(new z("moveend",e)),this}_getClampedPixelRatio(e,t){let{0:r,1:i}=this._maxCanvasSize,a=this.getPixelRatio(),n=e*a,s=t*a,o=n>r?r/n:1,l=s>i?i/s:1;return Math.min(o,l)*a}getPixelRatio(){var e;return null!=(e=this._overridePixelRatio)?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(Qe.convert(e)),this._update()}setMinZoom(e){if((e=null==e?xu:e)>=xu&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error(`minZoom must be between ${xu} and the current maxZoom, inclusive`)}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=null==e?Lx:e)>=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?Gr:e)<Gr)throw new Error(`minPitch must be greater than or equal to ${Gr}`);if(e>=Gr&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error(`minPitch must be between ${Gr} and the current maxPitch, inclusive`)}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=null==e?Dx:e)>_u)throw new Error(`maxPitch must be less than or equal to ${_u}`);if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(e){return this._cooperativeGestures=e,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(e){return this.transform.locationPoint(K.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(gr.default.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null==(e=this.handlers)?void 0:e.isMoving())}isZooming(){return this._zooming||!1}isRotating(){var e;return this._rotating||(null==(e=this.handlers)?void 0:e.isRotating())}_createDelegatedListener(e,t,r){if("mouseenter"===e||"mouseover"===e){let i=!1;return{layer:t,listener:r,delegates:{mousemove:u((a=>{let n=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];n.length?i||(i=!0,r.call(this,new zn(e,this,a.originalEvent,{features:n}))):i=!1}),"mousemove"),mouseout:u((()=>{i=!1}),"mouseout")}}}if("mouseleave"===e||"mouseout"===e){let i=!1;return{layer:t,listener:r,delegates:{mousemove:u((a=>{(this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[]).length?i=!0:i&&(i=!1,r.call(this,new zn(e,this,a.originalEvent)))}),"mousemove"),mouseout:u((t=>{i&&(i=!1,r.call(this,new zn(e,this,t.originalEvent)))}),"mouseout")}}}{let i=u((e=>{let i=this.getLayer(t)?this.queryRenderedFeatures(e.point,{layers:[t]}):[];i.length&&(e.features=i,r.call(this,e),delete e.features)}),"delegate");return{layer:t,listener:r,delegates:{[e]:i}}}}on(e,t,r){if(void 0===r)return super.on(e,t);let i=this._createDelegatedListener(e,t,r);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(i);for(let e in i.delegates)this.on(e,i.delegates[e]);return this}once(e,t,r){if(void 0===r)return super.once(e,t);let i=this._createDelegatedListener(e,t,r);for(let e in i.delegates)this.once(e,i.delegates[e]);return this}off(e,t,r){if(void 0===r)return super.off(e,t);let i=u((i=>{let a=i[e];for(let e=0;e<a.length;e++){let i=a[e];if(i.layer===t&&i.listener===r){for(let e in i.delegates)this.off(e,i.delegates[e]);return a.splice(e,1),this}}}),"removeDelegatedListener");return this._delegatedListeners&&this._delegatedListeners[e]&&i(this._delegatedListeners),this}queryRenderedFeatures(e,t){if(!this.style)return[];let r,i=e instanceof gr.default||Array.isArray(e),a=i?e:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(i?{}:e)||{},a instanceof gr.default||"number"==typeof a[0])r=[gr.default.convert(a)];else{let e=gr.default.convert(a[0]),t=gr.default.convert(a[1]);r=[e,new gr.default(t.x,e.y),t,new gr.default(e.x,t.y),e]}return this.style.queryRenderedFeatures(r,t,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return!1!==(t=R({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(e,t)));let r=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new tr(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,r):this.style.loadJSON(e,t,r),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new tr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,t){if("string"==typeof e){let r=e,i=this._requestManager.transformRequest(r,Oe.Style);wr(i,((e,r)=>{e?this.fire(new Z(e)):r&&this._updateDiff(r,t)}))}else"object"==typeof e&&this._updateDiff(e,t)}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(r){Me(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():Me("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style&&this.style.sourceCaches[e];if(void 0!==t)return t.loaded();this.fire(new Z(new Error(`There is no source with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){let t=this.style.sourceCaches[e.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);for(let t in this.style._layers){let r=this.style._layers[t];"hillshade"===r.type&&r.source===e.source&&Me("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new du(this.painter,t,e),this.painter.renderToTexture=new gu(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=t=>{"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId===e.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.updateElevation(this.terrain);return this.fire(new z("terrain",{terrain:e})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let t in e){let r=e[t]._tiles;for(let e in r){let t=r[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}addSourceType(e,t,r){return this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,r)}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(e,t,r={}){let{pixelRatio:i=1,sdf:a=!1,stretchX:n,stretchY:s,content:o}=r;this._lazyInitEmptyStyle();if(!(t instanceof HTMLImageElement||Ft(t))){if(void 0===t.width||void 0===t.height)return this.fire(new Z(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:r,height:l,data:u}=t,h=t;return this.style.addImage(e,{data:new Se({width:r,height:l},new Uint8Array(u)),pixelRatio:i,stretchX:n,stretchY:s,content:o,sdf:a,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e),this}}{let{width:r,height:l,data:u}=ne.getImageData(t);this.style.addImage(e,{data:new Se({width:r,height:l},u),pixelRatio:i,stretchX:n,stretchY:s,content:o,sdf:a,version:0})}}updateImage(e,t){let r=this.style.getImage(e);if(!r)return this.fire(new Z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let i=t instanceof HTMLImageElement||Ft(t)?ne.getImageData(t):t,{width:a,height:n,data:s}=i;if(void 0===a||void 0===n)return this.fire(new Z(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==r.data.width||n!==r.data.height)return this.fire(new Z(new Error("The width and height of the updated image must be that same as the previous version of the image")));let o=!(t instanceof HTMLImageElement||Ft(t));return r.data.replace(s,o),this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new Z(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e,t){mt.getImage(this._requestManager.transformRequest(e,Oe.Image),t)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,t,r){return this.style.setLayerZoomRange(e,t,r),this._update(!0)}setFilter(e,t,r={}){return this.style.setFilter(e,t,r),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,r,i={}){return this.style.setPaintProperty(e,t,r,i),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,r,i={}){return this.style.setLayoutProperty(e,t,r,i),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,r,(e=>{e||this._update(!0)})),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,(e=>{e||this._update(!0)})),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){this._container;let e=this._containerDimensions(),t=this._getClampedPixelRatio(e[0],e[1]);this._resizeCanvas(e[0],e[1],t)}_setupCooperativeGestures(){let e=this._container;this._cooperativeGesturesScreen=F.create("div","maplibregl-cooperative-gesture-screen",e);let t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map");let r="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map";this._cooperativeGesturesScreen.innerHTML=`\n <div class="maplibregl-desktop-message">${t}</div>\n <div class="maplibregl-mobile-message">${r}</div>\n `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){F.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(e,t,r){}_setupPainter(){let e={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},t=null;this._canvas.addEventListener("webglcontextcreationerror",(r=>{t={requestedAttributes:e},r&&(t.statusMessage=r.statusMessage,t.type=r.type)}),{once:!0});let r=this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e);if(!r){let e="Failed to initialize WebGL";throw t?(t.message=e,new Error(JSON.stringify(t))):new Error(e)}this.painter=new iu(r,this.transform),On.testSupport(r)}_onCooperativeGesture(e,t,r){return!t&&r<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")}),100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this.transform.zoom,i=ne.now();this.style.zoomHistory.update(e,i);let a=new de(e,{now:i,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=a.crossFadingFactor();(1!==n||n!==this._crossFadingFactor)&&(r=!0,this._crossFadingFactor=n),this.style.update(a)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:!1,zooming:!1,moving:!1,fadeDuration:t,showPadding:this.showPadding}),this.fire(new z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,$r.mark(Nt.load),this.fire(new z("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let i=this._sourcesDirty||this._styleDirty||this._placementDirty;return i||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new z("idle")),this._loaded&&!this._fullyLoaded&&!i&&(this._fullyLoaded=!0,$r.mark(Nt.fullLoad)),this._fullyLoaded=!0,this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),mt.removeThrottleControl(this._imageQueueHandle),null==(e=this._resizeObserver)||e.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),F.remove(this._canvasContainer),F.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),$r.clearMetrics(),this._removed=!0,this.fire(new z("remove"))}triggerRepaintSync(){this._render(performance.now())}triggerRepaint(){this.style&&!this._frame&&(this._frame=ne.frame((e=>{$r.frame(e),this._frame=null,this._render(e)})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return sT}getCameraTargetElevation(){return this.transform.elevation}};u(bu,"Map"),d(),d(),d();var jr=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){!this.isEnabled()||this._lastPoint||!this._moveStateManager.isValidStartEvent(e)||(this._moveStateManager.startMove(e),this._lastPoint=t.length?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let i=t.length?t[0]:t;return!this._moved&&i.dist(r)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=i,this._move(r,i))}dragEnd(e){!this.isEnabled()||!this._lastPoint||!this._moveStateManager.isValidEndEvent(e)||(this._moved&&F.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};u(jr,"DragHandler"),d();var uT=0,cT=2,pT={[uT]:1,[cT]:2};function hT(e,t){let r=pT[t];return void 0===e.buttons||(e.buttons&r)!==r}u(hT,"buttonNoLongerPressed");var po=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=F.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!hT(e,this._eventButton)}isValidEndEvent(e){return F.mouseButton(e)===this._eventButton}};u(po,"MouseMoveStateManager");var ho=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){let t=e.targetTouches[0].identifier;this._firstTouch=t}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}};u(ho,"OneFingerTouchMoveStateManager");var zx=0,Fx=2,Bx=u((e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=function(e){e.preventDefault()}}),"assignEvents"),Rx=u((({enable:e,clickTolerance:t,bearingDegreesPerPixelMoved:r=.8})=>{let i=new po({checkCorrectEvent:e=>F.mouseButton(e)===zx&&e.ctrlKey||F.mouseButton(e)===Fx});return new jr({clickTolerance:t,move:(e,t)=>({bearingDelta:(t.x-e.x)*r}),moveStateManager:i,enable:e,assignEvents:Bx})}),"generateMouseRotationHandler"),Ox=u((({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:r=-.5})=>{let i=new po({checkCorrectEvent:e=>F.mouseButton(e)===zx&&e.ctrlKey||F.mouseButton(e)===Fx});return new jr({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*r}),moveStateManager:i,enable:e,assignEvents:Bx})}),"generateMousePitchHandler");d();var Vx=u((e=>{e.touchstart=e.dragStart,e.touchmoveWindow=e.dragMove,e.touchend=e.dragEnd}),"assignEvents"),Ux=u((({enable:e,clickTolerance:t,bearingDegreesPerPixelMoved:r=.8})=>{let i=new ho;return new jr({clickTolerance:t,move:(e,t)=>({bearingDelta:(t.x-e.x)*r}),moveStateManager:i,enable:e,assignEvents:Vx})}),"generateOneFingerTouchRotationHandler"),Nx=u((({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:r=-.5})=>{let i=new ho;return new jr({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*r}),moveStateManager:i,enable:e,assignEvents:Vx})}),"generateOneFingerTouchPitchHandler"),mT={showCompass:!0,showZoom:!0,visualizePitch:!1},vu=class{constructor(e){this._updateZoomButtons=u((()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),r=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}),"_updateZoomButtons"),this._rotateCompassArrow=u((()=>{let e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e}),"_rotateCompassArrow"),this._setButtonTitle=u(((e,t)=>{let r=this._map._getUIString(`NavigationControl.${t}`);e.title=r,e.setAttribute("aria-label",r)}),"_setButtonTitle"),this.options=R({},mT,e),this._container=F.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),F.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),F.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=F.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Tp(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){F.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let r=F.create("button",e,this._container);return r.type="button",r.addEventListener("click",t),r}};u(vu,"NavigationControl");var Hr,Tp=class{constructor(e,t,r=!1){this.mousedown=u((e=>{this.startMouse(R({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),F.mousePos(this.element,e)),F.addEventListener(window,"mousemove",this.mousemove),F.addEventListener(window,"mouseup",this.mouseup)}),"mousedown"),this.mousemove=u((e=>{this.moveMouse(e,F.mousePos(this.element,e))}),"mousemove"),this.mouseup=u((e=>{this.mouseRotate.dragEnd(e),this.mousePitch&&this.mousePitch.dragEnd(e),this.offTemp()}),"mouseup"),this.touchstart=u((e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=F.touchPos(this.element,e.targetTouches)[0],this.startTouch(e,this._startPos),F.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),F.addEventListener(window,"touchend",this.touchend))}),"touchstart"),this.touchmove=u((e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=F.touchPos(this.element,e.targetTouches)[0],this.moveTouch(e,this._lastPos))}),"touchmove"),this.touchend=u((e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()}),"touchend"),this.reset=u((()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}),"reset"),this._clickTolerance=10;let i=e.dragRotate._mouseRotate.getClickTolerance(),a=e.dragRotate._mousePitch.getClickTolerance();this.element=t,this.mouseRotate=Rx({clickTolerance:i,enable:!0}),this.touchRotate=Ux({clickTolerance:i,enable:!0}),this.map=e,r&&(this.mousePitch=Ox({clickTolerance:a,enable:!0}),this.touchPitch=Nx({clickTolerance:a,enable:!0})),F.addEventListener(t,"mousedown",this.mousedown),F.addEventListener(t,"touchstart",this.touchstart,{passive:!1}),F.addEventListener(t,"touchcancel",this.reset)}startMouse(e,t){this.mouseRotate.dragStart(e,t),this.mousePitch&&this.mousePitch.dragStart(e,t),F.disableDrag()}startTouch(e,t){this.touchRotate.dragStart(e,t),this.touchPitch&&this.touchPitch.dragStart(e,t),F.disableDrag()}moveMouse(e,t){let r=this.map,{bearingDelta:i}=this.mouseRotate.dragMove(e,t)||{};if(i&&r.setBearing(r.getBearing()+i),this.mousePitch){let{pitchDelta:i}=this.mousePitch.dragMove(e,t)||{};i&&r.setPitch(r.getPitch()+i)}}moveTouch(e,t){let r=this.map,{bearingDelta:i}=this.touchRotate.dragMove(e,t)||{};if(i&&r.setBearing(r.getBearing()+i),this.touchPitch){let{pitchDelta:i}=this.touchPitch.dragMove(e,t)||{};i&&r.setPitch(r.getPitch()+i)}}off(){let e=this.element;F.removeEventListener(e,"mousedown",this.mousedown),F.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),F.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),F.removeEventListener(window,"touchend",this.touchend),F.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){F.enableDrag(),F.removeEventListener(window,"mousemove",this.mousemove),F.removeEventListener(window,"mouseup",this.mouseup),F.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),F.removeEventListener(window,"touchend",this.touchend)}};function qx(e,t=!1){void 0===Hr||t?void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((t=>{Hr="denied"!==t.state,e(Hr)})).catch((()=>{Hr=!!window.navigator.geolocation,e(Hr)})):(Hr=!!window.navigator.geolocation,e(Hr)):e(Hr)}u(Tp,"MouseRotateWrapper"),d(),d(),u(qx,"checkGeolocationSupport"),d();var Pu=ae(Pe());function wu(e,t,r){if(e=new K(e.lng,e.lat),t){let i=new K(e.lng-360,e.lat),a=new K(e.lng+360,e.lat),n=r.locationPoint(e).distSqr(t);r.locationPoint(i).distSqr(t)<n?e=i:r.locationPoint(a).distSqr(t)<n&&(e=a)}for(;Math.abs(e.lng-r.center.lng)>180;){let t=r.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e}d(),u(wu,"smartWrap"),d();var mo={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Su(e,t,r){let i=e.classList;for(let e in mo)i.remove(`maplibregl-${r}-anchor-${e}`);i.add(`maplibregl-${r}-anchor-${t}`)}u(Su,"applyAnchorClass");var Ai=class extends fe{constructor(e){if(super(),this._onKeyPress=u((e=>{let t=e.code,r=e.charCode||e.keyCode;("Space"===t||"Enter"===t||32===r||13===r)&&this.togglePopup()}),"_onKeyPress"),this._onMapClick=u((e=>{let t=e.originalEvent.target,r=this._element;this._popup&&(t===r||r.contains(t))&&this.togglePopup()}),"_onMapClick"),this._update=u((e=>{if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=wu(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let t="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?t=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(t=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r=`rotateX(${this._map.getPitch()}deg)`),(!e||"moveend"===e.type)&&(this._pos=this._pos.round()),F.setTransform(this._element,`${mo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${t}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{let e=this._map.unproject(this._pos),t=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=e.distanceTo(this._lngLat)>20*t?"0.2":"1.0",this._opacityTimeout=null}),100))}),"_update"),this._onMove=u((e=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}!this._isDragging||(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new z("dragstart"))),this.fire(new z("drag")))}),"_onMove"),this._onUp=u((()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new z("dragend")),this._state="inactive"}),"_onUp"),this._addDragHandler=u((e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}),"_addDragHandler"),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=Pu.default.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=F.create("div"),this._element.setAttribute("aria-label","Map marker");let t=F.createNS("http://www.w3.org/2000/svg","svg"),r=41,i=27;t.setAttributeNS(null,"display","block"),t.setAttributeNS(null,"height",`${r}px`),t.setAttributeNS(null,"width",`${i}px`),t.setAttributeNS(null,"viewBox",`0 0 ${i} ${r}`);let a=F.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");let n=F.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"fill-rule","nonzero");let s=F.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000");let o=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let e of o){let t=F.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),s.appendChild(t)}let l=F.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"fill",this._color);let u=F.createNS("http://www.w3.org/2000/svg","path");u.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),l.appendChild(u);let h=F.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"opacity","0.25"),h.setAttributeNS(null,"fill","#000000");let c=F.createNS("http://www.w3.org/2000/svg","path");c.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),h.appendChild(c);let p=F.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"transform","translate(6.0, 7.0)"),p.setAttributeNS(null,"fill","#FFFFFF");let d=F.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"transform","translate(8.0, 8.0)");let f=F.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#000000"),f.setAttributeNS(null,"opacity","0.25"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962");let m=F.createNS("http://www.w3.org/2000/svg","circle");m.setAttributeNS(null,"fill","#FFFFFF"),m.setAttributeNS(null,"cx","5.5"),m.setAttributeNS(null,"cy","5.5"),m.setAttributeNS(null,"r","5.4999962"),d.appendChild(f),d.appendChild(m),n.appendChild(s),n.appendChild(l),n.appendChild(h),n.appendChild(p),n.appendChild(d),t.appendChild(n),t.setAttributeNS(null,"height",r*this._scale+"px"),t.setAttributeNS(null,"width",i*this._scale+"px"),this._element.appendChild(t),this._offset=Pu.default.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()})),Su(this._element,this._anchor,"marker"),e&&e.className)for(let t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),F.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=K.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let t=38.1,r=13.5,i=Math.sqrt(Math.pow(r,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[i,-1*(t-r+i)],"bottom-right":[-i,-1*(t-r+i)],left:[r,-1*(t-r)],right:[-r,-1*(t-r)]}:this._offset}this._popup=e,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return e?(e.isOpen()?e.remove():e.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(e){return this._offset=Pu.default.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}};u(Ai,"Marker");var fT={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Tu=0,fo=!1,Au=class extends fe{constructor(e){super(),this._onSuccess=u((e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new z("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),(!this.options.trackUserLocation||"ACTIVE_LOCK"===this._watchState)&&this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new z("geolocate",e)),this._finish()}}),"_onSuccess"),this._updateCamera=u((e=>{let t=new K(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,i=R({bearing:this._map.getBearing()},this.options.fitBoundsOptions),a=Qe.fromLngLat(t,r);this._map.fitBounds(a,i,{geolocateSource:!0})}),"_updateCamera"),this._updateMarker=u((e=>{if(e){let t=new K(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}),"_updateMarker"),this._onZoom=u((()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}),"_onZoom"),this._onError=u((e=>{if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&fo)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new z("error",e)),this._finish()}}),"_onError"),this._finish=u((()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}),"_finish"),this._setupUI=u((e=>{if(this._map){if(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=F.create("button","maplibregl-ctrl-geolocate",this._container),F.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){Me("Geolocation support is not available so the GeolocateControl will be disabled.");let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=F.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ai({element:this._dotElement}),this._circleElement=F.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ai({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(e=>{let t=e.originalEvent&&"resize"===e.originalEvent.type;!e.geolocateSource&&"ACTIVE_LOCK"===this._watchState&&!t&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new z("trackuserlocationend")))}))}}),"_setupUI"),this.options=R({},fT,e)}onAdd(e){return this._map=e,this._container=F.create("div","maplibregl-ctrl maplibregl-ctrl-group"),qx(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),F.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Tu=0,fo=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),r=e.coords;return t&&(r.longitude<t.getWest()||r.longitude>t.getEast()||r.latitude<t.getSouth()||r.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){let e=this._map.getBounds(),t=e.getSouthEast(),r=e.getNorthEast(),i=t.distanceTo(r),a=this._map._container.clientHeight,n=Math.ceil(this._accuracy/(i/a)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}trigger(){if(!this._setup)return Me("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Tu--,fo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new z("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Tu>1?(e={maximumAge:6e5,timeout:0},fo=!0):(e=this.options.positionOptions,fo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};u(Au,"GeolocateControl"),d();var dT={maxWidth:100,unit:"metric"},Iu=class{constructor(e){this._onMove=u((()=>{$x(this._map,this._container,this.options)}),"_onMove"),this.setUnit=u((e=>{this.options.unit=e,$x(this._map,this._container,this.options)}),"setUnit"),this.options=R({},dT,e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=F.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){F.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}};function $x(e,t,r){let i=r&&r.maxWidth||100,a=e._container.clientHeight/2,n=e.unproject([0,a]),s=e.unproject([i,a]),o=n.distanceTo(s);if(r&&"imperial"===r.unit){let r=3.2808*o;if(r>5280){yo(t,i,r/5280,e._getUIString("ScaleControl.Miles"))}else yo(t,i,r,e._getUIString("ScaleControl.Feet"))}else if(r&&"nautical"===r.unit){yo(t,i,o/1852,e._getUIString("ScaleControl.NauticalMiles"))}else o>=1e3?yo(t,i,o/1e3,e._getUIString("ScaleControl.Kilometers")):yo(t,i,o,e._getUIString("ScaleControl.Meters"))}function yo(e,t,r,i){let a=gT(r),n=a/r;e.style.width=t*n+"px",e.innerHTML=`${a} ${i}`}function yT(e){let t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}function gT(e){let t=Math.pow(10,`${Math.floor(e)}`.length-1),r=e/t;return r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:yT(r),t*r}u(Iu,"ScaleControl"),u($x,"updateScale"),u(yo,"setScale"),u(yT,"getDecimalRoundNum"),u(gT,"getRoundNum"),d();var Cu=class extends fe{constructor(e={}){super(),this._onFullscreenChange=u((()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()}),"_onFullscreenChange"),this._onClickFullscreen=u((()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()}),"_onClickFullscreen"),this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:Me("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=F.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){F.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=F.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);F.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new z("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new z("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}};u(Cu,"FullscreenControl"),d();var Mu=class{constructor(e){this._toggleTerrain=u((()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}),"_toggleTerrain"),this._updateTerrainIcon=u((()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}),"_updateTerrainIcon"),this.options=e}onAdd(e){return this._map=e,this._container=F.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=F.create("button","maplibregl-ctrl-terrain",this._container),F.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){F.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}};u(Mu,"TerrainControl"),d();var We=ae(Pe()),xT={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},_T=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Eu=class extends fe{constructor(e){super(),this.remove=u((()=>(this._content&&F.remove(this._content),this._container&&(F.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new z("close")),this)),"remove"),this._onMouseUp=u((e=>{this._update(e.point)}),"_onMouseUp"),this._onMouseMove=u((e=>{this._update(e.point)}),"_onMouseMove"),this._onDrag=u((e=>{this._update(e.point)}),"_onDrag"),this._update=u((e=>{let t=this._lngLat||this._trackPointer;if(!this._map||!t||!this._content)return;if(!this._container){if(this._container=F.create("div","maplibregl-popup",this._map.getContainer()),this._tip=F.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let e of this.options.className.split(" "))this._container.classList.add(e);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=wu(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!e)return;let r=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),i=this.options.anchor,a=Gx(this.options.offset);if(!i){let e,t=this._container.offsetWidth,n=this._container.offsetHeight;e=r.y+a.bottom.y<n?["top"]:r.y>this._map.transform.height-n?["bottom"]:[],r.x<t/2?e.push("left"):r.x>this._map.transform.width-t/2&&e.push("right"),i=0===e.length?"bottom":e.join("-")}let n=r.add(a[i]).round();F.setTransform(this._container,`${mo[i]} translate(${n.x}px,${n.y}px)`),Su(this._container,i,"popup")}),"_update"),this._onClose=u((()=>{this.remove()}),"_onClose"),this.options=R(Object.create(xT),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new z("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=K.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t,r=document.createDocumentFragment(),i=document.createElement("body");for(i.innerHTML=e;t=i.firstChild,t;)r.appendChild(t);return this.setDOMContent(r)}getMaxWidth(){var e;return null==(e=this._container)?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=F.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){this._container&&this._container.classList.add(e)}removeClassName(e){this._container&&this._container.classList.remove(e)}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}_createCloseButton(){this.options.closeButton&&(this._closeButton=F.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(_T);e&&e.focus()}};function Gx(e){if(e){if("number"==typeof e){let t=Math.round(Math.sqrt(.5*Math.pow(e,2)));return{center:new We.default(0,0),top:new We.default(0,e),"top-left":new We.default(t,t),"top-right":new We.default(-t,t),bottom:new We.default(0,-e),"bottom-left":new We.default(t,-t),"bottom-right":new We.default(-t,-t),left:new We.default(e,0),right:new We.default(-e,0)}}if(e instanceof We.default||Array.isArray(e)){let t=We.default.convert(e);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:We.default.convert(e.center||[0,0]),top:We.default.convert(e.top||[0,0]),"top-left":We.default.convert(e["top-left"]||[0,0]),"top-right":We.default.convert(e["top-right"]||[0,0]),bottom:We.default.convert(e.bottom||[0,0]),"bottom-left":We.default.convert(e["bottom-left"]||[0,0]),"bottom-right":We.default.convert(e["bottom-right"]||[0,0]),left:We.default.convert(e.left||[0,0]),right:We.default.convert(e.right||[0,0])}}return Gx(new We.default(0,0))}u(Eu,"Popup"),u(Gx,"normalizeOffset");var Hx=ae(Pe());d();var jx={extend:(e,...t)=>R(e,...t),run(e){e()},logToElement(e,t=!1,r="log"){let i=window.document.getElementById(r);i&&(t&&(i.innerHTML=""),i.innerHTML+=`<br>${e}`)}},bT=xo.version,_e=class{static get version(){return bT}static get workerCount(){return Qt.workerCount}static set workerCount(e){Qt.workerCount=e}static get maxParallelImageRequests(){return ot.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(e){ot.MAX_PARALLEL_IMAGE_REQUESTS=e}static get workerUrl(){return ot.WORKER_URL}static set workerUrl(e){console.log("setting worker url",e),ot.WORKER_URL=e}static addProtocol(e,t){ot.REGISTERED_PROTOCOLS[e]=t}static removeProtocol(e){delete ot.REGISTERED_PROTOCOLS[e]}};u(_e,"MapLibreGL"),_e.Map=bu,_e.NavigationControl=vu,_e.GeolocateControl=Au,_e.AttributionControl=Ln,_e.LogoControl=Dn,_e.ScaleControl=Iu,_e.FullscreenControl=Cu,_e.TerrainControl=Mu,_e.Popup=Eu,_e.Marker=Ai,_e.Style=tr,_e.LngLat=K,_e.LngLatBounds=Qe,_e.Point=Hx.default,_e.MercatorCoordinate=Ee,_e.Evented=fe,_e.AJAXError=vr,_e.config=ot,_e.CanvasSource=wn,_e.GeoJSONSource=bn,_e.ImageSource=Lt,_e.RasterDEMTileSource=_n,_e.RasterTileSource=Nr,_e.VectorTileSource=yn,_e.VideoSource=vn,_e.setRTLTextPlugin=nm,_e.getRTLTextPluginStatus=sa,_e.prewarm=Gd,_e.clearPrewarmedResources=jd,jx.extend(_e,{isSafari:Xr,getPerformanceMetrics:$r.getPerformanceMetrics});var sG=_e;export{sG as default};
|