@mappedin/mappedin-js 6.0.0-alpha.8 → 6.0.0-rc.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.
Files changed (69) hide show
  1. package/LICENSE.txt +104 -0
  2. package/README.md +137 -157
  3. package/THIRD_PARTY_LICENSES.txt +14468 -0
  4. package/lib/esm/GLTFExporter-OD4NIP5J.js +2 -0
  5. package/lib/esm/GLTFExporter-OD4NIP5J.js.map +7 -0
  6. package/lib/esm/GLTFLoader-2KHURE2O.js +2 -0
  7. package/lib/esm/GLTFLoader-2KHURE2O.js.map +7 -0
  8. package/lib/esm/browser-MJVP6R3A.js +2 -0
  9. package/lib/esm/browser-MJVP6R3A.js.map +7 -0
  10. package/lib/esm/chunk-2RJ5UTHX.js +3 -0
  11. package/lib/esm/chunk-2RJ5UTHX.js.map +7 -0
  12. package/lib/esm/chunk-J66EV4D7.js +2 -0
  13. package/lib/esm/chunk-J66EV4D7.js.map +7 -0
  14. package/lib/esm/chunk-LLHXGTB2.js +2 -0
  15. package/lib/esm/chunk-LLHXGTB2.js.map +7 -0
  16. package/lib/esm/chunk-R6ACEBVD.js +747 -0
  17. package/lib/esm/chunk-R6ACEBVD.js.map +7 -0
  18. package/lib/esm/chunk-ROCNZJLL.js +2 -0
  19. package/lib/esm/chunk-ROCNZJLL.js.map +7 -0
  20. package/lib/esm/chunk-SWYBY4H7.js +2269 -0
  21. package/lib/esm/chunk-SWYBY4H7.js.map +7 -0
  22. package/lib/esm/chunk-TJG5BXTK.js +3820 -0
  23. package/lib/esm/chunk-TJG5BXTK.js.map +7 -0
  24. package/lib/esm/fonts/roboto-regular.ttf +0 -0
  25. package/lib/esm/index.css +2 -0
  26. package/lib/esm/index.css.map +7 -0
  27. package/lib/esm/index.d.ts +38908 -0
  28. package/lib/esm/index.js +2 -0
  29. package/lib/esm/index.js.map +7 -0
  30. package/lib/esm/inspector-KMBZXTF5.js +483 -0
  31. package/lib/esm/inspector-KMBZXTF5.js.map +7 -0
  32. package/lib/esm/inspector-T3HA7VGW.css +2 -0
  33. package/lib/esm/inspector-T3HA7VGW.css.map +7 -0
  34. package/lib/esm/internal-LZTQU5W2.js +2 -0
  35. package/lib/esm/internal-LZTQU5W2.js.map +7 -0
  36. package/lib/esm/internal-VKD5KMH3.css +2 -0
  37. package/lib/esm/internal-VKD5KMH3.css.map +7 -0
  38. package/lib/esm/outdoor-context-v5-DPTEYL6O.js +2 -0
  39. package/lib/esm/outdoor-context-v5-DPTEYL6O.js.map +7 -0
  40. package/lib/esm/roboto-regular-R5KXKW73.js +2 -0
  41. package/lib/esm/roboto-regular-R5KXKW73.js.map +7 -0
  42. package/lib/esm/text3d-AEQ2USTW.js +253 -0
  43. package/lib/esm/text3d-AEQ2USTW.js.map +7 -0
  44. package/lib/esm/workers/collision-worker.csp.js +1 -0
  45. package/lib/esm/workers/maplibre-worker.csp.js +2 -0
  46. package/lib/index-rn.js +4288 -0
  47. package/lib/index.css +2 -0
  48. package/package.json +34 -64
  49. package/lib/esm/get-venue/index.d.ts +0 -2466
  50. package/lib/esm/get-venue/index.js +0 -1
  51. package/lib/esm/navigator/index.d.ts +0 -243
  52. package/lib/esm/navigator/index.js +0 -1
  53. package/lib/esm/renderer/Arrival-HFFQMV6K.js +0 -1
  54. package/lib/esm/renderer/Chalet-4T7G2EOB.js +0 -1
  55. package/lib/esm/renderer/HelveticaNeue-SYBCLCMV.js +0 -1
  56. package/lib/esm/renderer/Helvetiker-YQQ7YLDG.js +0 -1
  57. package/lib/esm/renderer/Lato-VOB7DTFK.js +0 -1
  58. package/lib/esm/renderer/MyriadPro-3UT6I6O6.js +0 -1
  59. package/lib/esm/renderer/ProximaNova-JID4Q6QR.js +0 -1
  60. package/lib/esm/renderer/SimonCircular-EOKJ3PHU.js +0 -1
  61. package/lib/esm/renderer/browser-IFEP2NKH.js +0 -1
  62. package/lib/esm/renderer/chunk-6MFNIXKK.js +0 -1
  63. package/lib/esm/renderer/chunk-K7MHFVG3.js +0 -1
  64. package/lib/esm/renderer/index.css +0 -1
  65. package/lib/esm/renderer/index.d.ts +0 -5261
  66. package/lib/esm/renderer/index.js +0 -1
  67. package/lib/mappedin.css +0 -1
  68. package/lib/mappedin.js +0 -1
  69. package/lib/node/index.js +0 -1
@@ -0,0 +1,747 @@
1
+ import{a as d}from"./chunk-LLHXGTB2.js";import{b as or,c as Bn,d as ie}from"./chunk-ROCNZJLL.js";var le=or((ED,bd)=>{"use strict";d();bd.exports=Pi;function Pi(r,e){this.x=r,this.y=e}Pi.prototype={clone:function(){return new Pi(this.x,this.y)},add:function(r){return this.clone()._add(r)},sub:function(r){return this.clone()._sub(r)},multByPoint:function(r){return this.clone()._multByPoint(r)},divByPoint:function(r){return this.clone()._divByPoint(r)},mult:function(r){return this.clone()._mult(r)},div:function(r){return this.clone()._div(r)},rotate:function(r){return this.clone()._rotate(r)},rotateAround:function(r,e){return this.clone()._rotateAround(r,e)},matMult:function(r){return this.clone()._matMult(r)},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(r){return this.x===r.x&&this.y===r.y},dist:function(r){return Math.sqrt(this.distSqr(r))},distSqr:function(r){var e=r.x-this.x,t=r.y-this.y;return e*e+t*t},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith:function(r){return this.angleWithSep(r.x,r.y)},angleWithSep:function(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult:function(r){var e=r[0]*this.x+r[1]*this.y,t=r[2]*this.x+r[3]*this.y;return this.x=e,this.y=t,this},_add:function(r){return this.x+=r.x,this.y+=r.y,this},_sub:function(r){return this.x-=r.x,this.y-=r.y,this},_mult:function(r){return this.x*=r,this.y*=r,this},_div:function(r){return this.x/=r,this.y/=r,this},_multByPoint:function(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint:function(r){return this.x/=r.x,this.y/=r.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var r=this.y;return this.y=this.x,this.x=-r,this},_rotate:function(r){var e=Math.cos(r),t=Math.sin(r),n=e*this.x-t*this.y,i=t*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(r,e){var t=Math.cos(r),n=Math.sin(r),i=e.x+t*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+t*(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}};Pi.convert=function(r){return r instanceof Pi?r:Array.isArray(r)?new Pi(r[0],r[1]):r}});var Pd=or((DD,wd)=>{"use strict";d();wd.exports=vd;function vd(r,e,t,n){this.cx=3*r,this.bx=3*(t-r)-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=r,this.p1y=e,this.p2x=t,this.p2y=n}vd.prototype={sampleCurveX:function(r){return((this.ax*r+this.bx)*r+this.cx)*r},sampleCurveY:function(r){return((this.ay*r+this.by)*r+this.cy)*r},sampleCurveDerivativeX:function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},solveCurveX:function(r,e){if(e===void 0&&(e=1e-6),r<0)return 0;if(r>1)return 1;for(var t=r,n=0;n<8;n++){var i=this.sampleCurveX(t)-r;if(Math.abs(i)<e)return t;var o=this.sampleCurveDerivativeX(t);if(Math.abs(o)<1e-6)break;t=t-i/o}var a=0,s=1;for(t=r,n=0;n<20&&(i=this.sampleCurveX(t),!(Math.abs(i-r)<e));n++)r>i?a=t:s=t,t=(s-a)*.5+a;return t},solve:function(r,e){return this.sampleCurveY(this.solveCurveX(r,e))}}});var c_=or((eF,Cm)=>{d();function EA(r,e){var t,n,i,o,a,s,l,u,c,p;for(t=r.length&3,n=r.length-t,i=e,a=3432918353,l=461845907,p=0;p<n;)c=r.charCodeAt(p)&255|(r.charCodeAt(++p)&255)<<8|(r.charCodeAt(++p)&255)<<16|(r.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,t){case 3:c^=(r.charCodeAt(p+2)&255)<<16;case 2:c^=(r.charCodeAt(p+1)&255)<<8;case 1:c^=r.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^=r.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 Cm<"u"&&(Cm.exports=EA)});var p_=or((rF,Am)=>{d();function LA(r,e){for(var t=r.length,n=e^t,i=0,o;t>=4;)o=r.charCodeAt(i)&255|(r.charCodeAt(++i)&255)<<8|(r.charCodeAt(++i)&255)<<16|(r.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,t-=4,++i;switch(t){case 3:n^=(r.charCodeAt(i+2)&255)<<16;case 2:n^=(r.charCodeAt(i+1)&255)<<8;case 1:n^=r.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 Am!==void 0&&(Am.exports=LA)});var Im=or((iF,bu)=>{d();var h_=c_(),DA=p_();bu.exports=h_;bu.exports.murmur3=h_;bu.exports.murmur2=DA});var Gm=or((T3,J_)=>{"use strict";d();var bI=le();J_.exports=Ki;function Ki(r,e,t,n,i){this.properties={},this.extent=t,this.type=0,this._pbf=r,this._geometry=-1,this._keys=n,this._values=i,r.readFields(vI,this,e)}function vI(r,e,t){r==1?e.id=t.readVarint():r==2?wI(t,e):r==3?e.type=t.readVarint():r==4&&(e._geometry=t.pos)}function wI(r,e){for(var t=r.readVarint()+r.pos;r.pos<t;){var n=e._keys[r.readVarint()],i=e._values[r.readVarint()];e.properties[n]=i}}Ki.types=["Unknown","Point","LineString","Polygon"];Ki.prototype.loadGeometry=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,t=1,n=0,i=0,o=0,a=[],s;r.pos<e;){if(n<=0){var l=r.readVarint();t=l&7,n=l>>3}if(n--,t===1||t===2)i+=r.readSVarint(),o+=r.readSVarint(),t===1&&(s&&a.push(s),s=[]),s.push(new bI(i,o));else if(t===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+t)}return s&&a.push(s),a};Ki.prototype.bbox=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,t=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;r.pos<e;){if(n<=0){var c=r.readVarint();t=c&7,n=c>>3}if(n--,t===1||t===2)i+=r.readSVarint(),o+=r.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<l&&(l=o),o>u&&(u=o);else if(t!==7)throw new Error("unknown command "+t)}return[a,l,s,u]};Ki.prototype.toGeoJSON=function(r,e,t){var n=this.extent*Math.pow(2,t),i=this.extent*r,o=this.extent*e,a=this.loadGeometry(),s=Ki.types[this.type],l,u;function c(m){for(var f=0;f<m.length;f++){var y=m[f],g=180-(y.y+o)*360/n;m[f]=[(y.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(g*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=PI(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 h={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(h.id=this.id),h};function PI(r){var e=r.length;if(e<=1)return[r];for(var t=[],n,i,o=0;o<e;o++){var a=SI(r[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&t.push(n),n=[r[o]]):n.push(r[o]))}return n&&t.push(n),t}function SI(r){for(var e=0,t=0,n=r.length,i=n-1,o,a;t<n;i=t++)o=r[t],a=r[i],e+=(a.x-o.x)*(o.y+a.y);return e}});var Zm=or((C3,ex)=>{"use strict";d();var TI=Gm();ex.exports=Q_;function Q_(r,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=r,this._keys=[],this._values=[],this._features=[],r.readFields(MI,this,e),this.length=this._features.length}function MI(r,e,t){r===15?e.version=t.readVarint():r===1?e.name=t.readString():r===5?e.extent=t.readVarint():r===2?e._features.push(t.pos):r===3?e._keys.push(t.readString()):r===4&&e._values.push(CI(t))}function CI(r){for(var e=null,t=r.readVarint()+r.pos;r.pos<t;){var n=r.readVarint()>>3;e=n===1?r.readString():n===2?r.readFloat():n===3?r.readDouble():n===4?r.readVarint64():n===5?r.readVarint():n===6?r.readSVarint():n===7?r.readBoolean():null}return e}Q_.prototype.feature=function(r){if(r<0||r>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[r];var e=this._pbf.readVarint()+this._pbf.pos;return new TI(this._pbf,e,this.extent,this._keys,this._values)}});var rx=or((I3,tx)=>{"use strict";d();var AI=Zm();tx.exports=II;function II(r,e){this.layers=r.readFields(EI,{},e)}function EI(r,e,t){if(r===3){var n=new AI(t,t.readVarint()+t.pos);n.length&&(e[n.name]=n)}}});var Za=or((L3,Bu)=>{d();Bu.exports.VectorTile=rx();Bu.exports.VectorTileFeature=Gm();Bu.exports.VectorTileLayer=Zm()});var Mx=or(Xm=>{d();Xm.read=function(r,e,t,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=t?i-1:0,h=t?-1:1,m=r[e+p];for(p+=h,o=m&(1<<-c)-1,m>>=-c,c+=s;c>0;o=o*256+r[e+p],p+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+r[e+p],p+=h,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(m?-1:1)*a*Math.pow(2,o-n)};Xm.write=function(r,e,t,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:o-1,f=n?1:-1,y=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+=h/l:e+=h*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;r[t+m]=s&255,m+=f,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;r[t+m]=a&255,m+=f,a/=256,u-=8);r[t+m-f]|=y*128}});var Km=or((PV,Lx)=>{"use strict";d();Lx.exports=Re;var Nu=Mx();function Re(r){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(r)?r:new Uint8Array(r||0),this.pos=0,this.type=0,this.length=this.buf.length}Re.Varint=0;Re.Fixed64=1;Re.Bytes=2;Re.Fixed32=5;var Ym=65536*65536,Cx=1/Ym,XI=12,Ex=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");Re.prototype={destroy:function(){this.buf=null},readFields:function(r,e,t){for(t=t||this.length;this.pos<t;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,r(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(r,e){return this.readFields(r,e,this.readVarint()+this.pos)},readFixed32:function(){var r=Gu(this.buf,this.pos);return this.pos+=4,r},readSFixed32:function(){var r=Ix(this.buf,this.pos);return this.pos+=4,r},readFixed64:function(){var r=Gu(this.buf,this.pos)+Gu(this.buf,this.pos+4)*Ym;return this.pos+=8,r},readSFixed64:function(){var r=Gu(this.buf,this.pos)+Ix(this.buf,this.pos+4)*Ym;return this.pos+=8,r},readFloat:function(){var r=Nu.read(this.buf,this.pos,!0,23,4);return this.pos+=4,r},readDouble:function(){var r=Nu.read(this.buf,this.pos,!0,52,8);return this.pos+=8,r},readVarint:function(r){var e=this.buf,t,n;return n=e[this.pos++],t=n&127,n<128||(n=e[this.pos++],t|=(n&127)<<7,n<128)||(n=e[this.pos++],t|=(n&127)<<14,n<128)||(n=e[this.pos++],t|=(n&127)<<21,n<128)?t:(n=e[this.pos],t|=(n&15)<<28,YI(t,r,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var r=this.readVarint();return r%2===1?(r+1)/-2:r/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=XI&&Ex?cE(this.buf,e,r):uE(this.buf,e,r)},readBytes:function(){var r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e},readPackedVarint:function(r,e){if(this.type!==Re.Bytes)return r.push(this.readVarint(e));var t=Zr(this);for(r=r||[];this.pos<t;)r.push(this.readVarint(e));return r},readPackedSVarint:function(r){if(this.type!==Re.Bytes)return r.push(this.readSVarint());var e=Zr(this);for(r=r||[];this.pos<e;)r.push(this.readSVarint());return r},readPackedBoolean:function(r){if(this.type!==Re.Bytes)return r.push(this.readBoolean());var e=Zr(this);for(r=r||[];this.pos<e;)r.push(this.readBoolean());return r},readPackedFloat:function(r){if(this.type!==Re.Bytes)return r.push(this.readFloat());var e=Zr(this);for(r=r||[];this.pos<e;)r.push(this.readFloat());return r},readPackedDouble:function(r){if(this.type!==Re.Bytes)return r.push(this.readDouble());var e=Zr(this);for(r=r||[];this.pos<e;)r.push(this.readDouble());return r},readPackedFixed32:function(r){if(this.type!==Re.Bytes)return r.push(this.readFixed32());var e=Zr(this);for(r=r||[];this.pos<e;)r.push(this.readFixed32());return r},readPackedSFixed32:function(r){if(this.type!==Re.Bytes)return r.push(this.readSFixed32());var e=Zr(this);for(r=r||[];this.pos<e;)r.push(this.readSFixed32());return r},readPackedFixed64:function(r){if(this.type!==Re.Bytes)return r.push(this.readFixed64());var e=Zr(this);for(r=r||[];this.pos<e;)r.push(this.readFixed64());return r},readPackedSFixed64:function(r){if(this.type!==Re.Bytes)return r.push(this.readSFixed64());var e=Zr(this);for(r=r||[];this.pos<e;)r.push(this.readSFixed64());return r},skip:function(r){var e=r&7;if(e===Re.Varint)for(;this.buf[this.pos++]>127;);else if(e===Re.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Re.Fixed32)this.pos+=4;else if(e===Re.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(r,e){this.writeVarint(r<<3|e)},realloc:function(r){for(var e=this.length||16;e<this.pos+r;)e*=2;if(e!==this.length){var t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(r){this.realloc(4),Qi(this.buf,r,this.pos),this.pos+=4},writeSFixed32:function(r){this.realloc(4),Qi(this.buf,r,this.pos),this.pos+=4},writeFixed64:function(r){this.realloc(8),Qi(this.buf,r&-1,this.pos),Qi(this.buf,Math.floor(r*Cx),this.pos+4),this.pos+=8},writeSFixed64:function(r){this.realloc(8),Qi(this.buf,r&-1,this.pos),Qi(this.buf,Math.floor(r*Cx),this.pos+4),this.pos+=8},writeVarint:function(r){if(r=+r||0,r>268435455||r<0){KI(r,this);return}this.realloc(4),this.buf[this.pos++]=r&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=(r>>>=7)&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=(r>>>=7)&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=r>>>7&127)))},writeSVarint:function(r){this.writeVarint(r<0?-r*2-1:r*2)},writeBoolean:function(r){this.writeVarint(!!r)},writeString:function(r){r=String(r),this.realloc(r.length*4),this.pos++;var e=this.pos;this.pos=pE(this.buf,r,this.pos);var t=this.pos-e;t>=128&&Ax(e,t,this),this.pos=e-1,this.writeVarint(t),this.pos+=t},writeFloat:function(r){this.realloc(4),Nu.write(this.buf,r,this.pos,!0,23,4),this.pos+=4},writeDouble:function(r){this.realloc(8),Nu.write(this.buf,r,this.pos,!0,52,8),this.pos+=8},writeBytes:function(r){var e=r.length;this.writeVarint(e),this.realloc(e);for(var t=0;t<e;t++)this.buf[this.pos++]=r[t]},writeRawMessage:function(r,e){this.pos++;var t=this.pos;r(e,this);var n=this.pos-t;n>=128&&Ax(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeMessage:function(r,e,t){this.writeTag(r,Re.Bytes),this.writeRawMessage(e,t)},writePackedVarint:function(r,e){e.length&&this.writeMessage(r,eE,e)},writePackedSVarint:function(r,e){e.length&&this.writeMessage(r,tE,e)},writePackedBoolean:function(r,e){e.length&&this.writeMessage(r,iE,e)},writePackedFloat:function(r,e){e.length&&this.writeMessage(r,rE,e)},writePackedDouble:function(r,e){e.length&&this.writeMessage(r,nE,e)},writePackedFixed32:function(r,e){e.length&&this.writeMessage(r,oE,e)},writePackedSFixed32:function(r,e){e.length&&this.writeMessage(r,aE,e)},writePackedFixed64:function(r,e){e.length&&this.writeMessage(r,sE,e)},writePackedSFixed64:function(r,e){e.length&&this.writeMessage(r,lE,e)},writeBytesField:function(r,e){this.writeTag(r,Re.Bytes),this.writeBytes(e)},writeFixed32Field:function(r,e){this.writeTag(r,Re.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(r,e){this.writeTag(r,Re.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(r,e){this.writeTag(r,Re.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(r,e){this.writeTag(r,Re.Fixed64),this.writeSFixed64(e)},writeVarintField:function(r,e){this.writeTag(r,Re.Varint),this.writeVarint(e)},writeSVarintField:function(r,e){this.writeTag(r,Re.Varint),this.writeSVarint(e)},writeStringField:function(r,e){this.writeTag(r,Re.Bytes),this.writeString(e)},writeFloatField:function(r,e){this.writeTag(r,Re.Fixed32),this.writeFloat(e)},writeDoubleField:function(r,e){this.writeTag(r,Re.Fixed64),this.writeDouble(e)},writeBooleanField:function(r,e){this.writeVarintField(r,!!e)}};function YI(r,e,t){var n=t.buf,i,o;if(o=n[t.pos++],i=(o&112)>>4,o<128||(o=n[t.pos++],i|=(o&127)<<3,o<128)||(o=n[t.pos++],i|=(o&127)<<10,o<128)||(o=n[t.pos++],i|=(o&127)<<17,o<128)||(o=n[t.pos++],i|=(o&127)<<24,o<128)||(o=n[t.pos++],i|=(o&1)<<31,o<128))return Ji(r,i,e);throw new Error("Expected varint not more than 10 bytes")}function Zr(r){return r.type===Re.Bytes?r.readVarint()+r.pos:r.pos+1}function Ji(r,e,t){return t?e*4294967296+(r>>>0):(e>>>0)*4294967296+(r>>>0)}function KI(r,e){var t,n;if(r>=0?(t=r%4294967296|0,n=r/4294967296|0):(t=~(-r%4294967296),n=~(-r/4294967296),t^4294967295?t=t+1|0:(t=0,n=n+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),JI(t,n,e),QI(n,e)}function JI(r,e,t){t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos]=r&127}function QI(r,e){var t=(r&7)<<4;e.buf[e.pos++]|=t|((r>>>=3)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127)))))}function Ax(r,e,t){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(n);for(var i=t.pos-1;i>=r;i--)t.buf[i+n]=t.buf[i]}function eE(r,e){for(var t=0;t<r.length;t++)e.writeVarint(r[t])}function tE(r,e){for(var t=0;t<r.length;t++)e.writeSVarint(r[t])}function rE(r,e){for(var t=0;t<r.length;t++)e.writeFloat(r[t])}function nE(r,e){for(var t=0;t<r.length;t++)e.writeDouble(r[t])}function iE(r,e){for(var t=0;t<r.length;t++)e.writeBoolean(r[t])}function oE(r,e){for(var t=0;t<r.length;t++)e.writeFixed32(r[t])}function aE(r,e){for(var t=0;t<r.length;t++)e.writeSFixed32(r[t])}function sE(r,e){for(var t=0;t<r.length;t++)e.writeFixed64(r[t])}function lE(r,e){for(var t=0;t<r.length;t++)e.writeSFixed64(r[t])}function Gu(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+r[e+3]*16777216}function Qi(r,e,t){r[t]=e,r[t+1]=e>>>8,r[t+2]=e>>>16,r[t+3]=e>>>24}function Ix(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+(r[e+3]<<24)}function uE(r,e,t){for(var n="",i=e;i<t;){var o=r[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>t)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=r[i+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=r[i+1],u=r[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=r[i+1],u=r[i+2],c=r[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 cE(r,e,t){return Ex.decode(r.subarray(e,t))}function pE(r,e,t){for(var n=0,i,o;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){r[t++]=239,r[t++]=191,r[t++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===e.length?(r[t++]=239,r[t++]=191,r[t++]=189):o=i;continue}else o&&(r[t++]=239,r[t++]=191,r[t++]=189,o=null);i<128?r[t++]=i:(i<2048?r[t++]=i>>6|192:(i<65536?r[t++]=i>>12|224:(r[t++]=i>>18|240,r[t++]=i>>12&63|128),r[t++]=i>>6&63|128),r[t++]=i&63|128)}return t}});d();var tl={name:"@packages/internal",private:!0,version:"6.0.1-beta.51",dependencies:{"@turf/boolean-point-in-polygon":"6.5.0","@turf/destination":"6.5.0","@turf/distance":"6.5.0"},files:["./common/","./outdoor-context-4/","./geojson-navigator/","./quad-tree/","./shave-text","./clipper-lib"]};d();d();var my=ie(le(),1),fy=ie(Pd(),1);d();d();var dh;function rl(){return dh==null&&(dh=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),dh}var nl;function yh(){if(nl==null&&(nl=!1,rl())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let i=0;i<5*5;i++){let o=i*4;t.fillStyle=`rgb(${o},${o+1},${o+2})`,t.fillRect(i%5,Math.floor(i/5),1,1)}let n=t.getImageData(0,0,5,5).data;for(let i=0;i<5*5*4;i++)if(i%4!==3&&n[i]!==i){nl=!0;break}}}return nl||!1}d();d();var oe=1e-6,Pe=typeof Float32Array<"u"?Float32Array:Array,St=Math.random;var VD=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var Qr={};Bn(Qr,{LDU:()=>Xw,add:()=>Yw,adjoint:()=>jw,clone:()=>Rw,copy:()=>Fw,create:()=>kw,determinant:()=>Nw,equals:()=>Jw,exactEquals:()=>Kw,frob:()=>Ww,fromRotation:()=>$w,fromScaling:()=>Hw,fromValues:()=>Bw,identity:()=>zw,invert:()=>Uw,mul:()=>tP,multiply:()=>Sd,multiplyScalar:()=>Qw,multiplyScalarAndAdd:()=>eP,rotate:()=>Gw,scale:()=>Zw,set:()=>Ow,str:()=>qw,sub:()=>rP,subtract:()=>Td,transpose:()=>Vw});d();function kw(){var r=new Pe(4);return Pe!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r}function Rw(r){var e=new Pe(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function Fw(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function zw(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r}function Bw(r,e,t,n){var i=new Pe(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}function Ow(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}function Vw(r,e){if(r===e){var t=e[1];r[1]=e[2],r[2]=t}else r[0]=e[0],r[1]=e[2],r[2]=e[1],r[3]=e[3];return r}function Uw(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=t*o-i*n;return a?(a=1/a,r[0]=o*a,r[1]=-n*a,r[2]=-i*a,r[3]=t*a,r):null}function jw(r,e){var t=e[0];return r[0]=e[3],r[1]=-e[1],r[2]=-e[2],r[3]=t,r}function Nw(r){return r[0]*r[3]-r[2]*r[1]}function Sd(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=t[0],l=t[1],u=t[2],c=t[3];return r[0]=n*s+o*l,r[1]=i*s+a*l,r[2]=n*u+o*c,r[3]=i*u+a*c,r}function Gw(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(t),l=Math.cos(t);return r[0]=n*l+o*s,r[1]=i*l+a*s,r[2]=n*-s+o*l,r[3]=i*-s+a*l,r}function Zw(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=t[0],l=t[1];return r[0]=n*s,r[1]=i*s,r[2]=o*l,r[3]=a*l,r}function $w(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=-t,r[3]=n,r}function Hw(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=e[1],r}function qw(r){return"mat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function Ww(r){return Math.hypot(r[0],r[1],r[2],r[3])}function Xw(r,e,t,n){return r[2]=n[2]/n[0],t[0]=n[0],t[1]=n[1],t[3]=n[3]-r[2]*t[1],[r,e,t]}function Yw(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function Td(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}function Kw(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function Jw(r,e){var t=r[0],n=r[1],i=r[2],o=r[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(t-a)<=oe*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(n-s)<=oe*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=oe*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=oe*Math.max(1,Math.abs(o),Math.abs(u))}function Qw(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function eP(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r}var tP=Sd,rP=Td;var Rr={};Bn(Rr,{add:()=>TP,adjoint:()=>pP,clone:()=>iP,copy:()=>oP,create:()=>gh,determinant:()=>hP,equals:()=>IP,exactEquals:()=>AP,frob:()=>SP,fromMat2d:()=>xP,fromMat4:()=>nP,fromQuat:()=>bP,fromRotation:()=>gP,fromScaling:()=>_P,fromTranslation:()=>yP,fromValues:()=>aP,identity:()=>lP,invert:()=>cP,mul:()=>EP,multiply:()=>Md,multiplyScalar:()=>MP,multiplyScalarAndAdd:()=>CP,normalFromMat4:()=>vP,projection:()=>wP,rotate:()=>fP,scale:()=>dP,set:()=>sP,str:()=>PP,sub:()=>LP,subtract:()=>Cd,translate:()=>mP,transpose:()=>uP});d();function gh(){var r=new Pe(9);return Pe!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function nP(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r}function iP(r){var e=new Pe(9);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e}function oP(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function aP(r,e,t,n,i,o,a,s,l){var u=new Pe(9);return u[0]=r,u[1]=e,u[2]=t,u[3]=n,u[4]=i,u[5]=o,u[6]=a,u[7]=s,u[8]=l,u}function sP(r,e,t,n,i,o,a,s,l,u){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=o,r[5]=a,r[6]=s,r[7]=l,r[8]=u,r}function lP(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function uP(r,e){if(r===e){var t=e[1],n=e[2],i=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=n,r[7]=i}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}function cP(r,e){var t=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=c*a-s*u,h=-c*o+s*l,m=u*o-a*l,f=t*p+n*h+i*m;return f?(f=1/f,r[0]=p*f,r[1]=(-c*n+i*u)*f,r[2]=(s*n-i*a)*f,r[3]=h*f,r[4]=(c*t-i*l)*f,r[5]=(-s*t+i*o)*f,r[6]=m*f,r[7]=(-u*t+n*l)*f,r[8]=(a*t-n*o)*f,r):null}function pP(r,e){var t=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];return r[0]=a*c-s*u,r[1]=i*u-n*c,r[2]=n*s-i*a,r[3]=s*l-o*c,r[4]=t*c-i*l,r[5]=i*o-t*s,r[6]=o*u-a*l,r[7]=n*l-t*u,r[8]=t*a-n*o,r}function hP(r){var e=r[0],t=r[1],n=r[2],i=r[3],o=r[4],a=r[5],s=r[6],l=r[7],u=r[8];return e*(u*o-a*l)+t*(-u*i+a*s)+n*(l*i-o*s)}function Md(r,e,t){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],h=t[0],m=t[1],f=t[2],y=t[3],g=t[4],_=t[5],x=t[6],b=t[7],v=t[8];return r[0]=h*n+m*a+f*u,r[1]=h*i+m*s+f*c,r[2]=h*o+m*l+f*p,r[3]=y*n+g*a+_*u,r[4]=y*i+g*s+_*c,r[5]=y*o+g*l+_*p,r[6]=x*n+b*a+v*u,r[7]=x*i+b*s+v*c,r[8]=x*o+b*l+v*p,r}function mP(r,e,t){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],h=t[0],m=t[1];return r[0]=n,r[1]=i,r[2]=o,r[3]=a,r[4]=s,r[5]=l,r[6]=h*n+m*a+u,r[7]=h*i+m*s+c,r[8]=h*o+m*l+p,r}function fP(r,e,t){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],h=Math.sin(t),m=Math.cos(t);return r[0]=m*n+h*a,r[1]=m*i+h*s,r[2]=m*o+h*l,r[3]=m*a-h*n,r[4]=m*s-h*i,r[5]=m*l-h*o,r[6]=u,r[7]=c,r[8]=p,r}function dP(r,e,t){var n=t[0],i=t[1];return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=i*e[3],r[4]=i*e[4],r[5]=i*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function yP(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=e[0],r[7]=e[1],r[8]=1,r}function gP(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=-t,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function _P(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=e[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function xP(r,e){return r[0]=e[0],r[1]=e[1],r[2]=0,r[3]=e[2],r[4]=e[3],r[5]=0,r[6]=e[4],r[7]=e[5],r[8]=1,r}function bP(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=t+t,s=n+n,l=i+i,u=t*a,c=n*a,p=n*s,h=i*a,m=i*s,f=i*l,y=o*a,g=o*s,_=o*l;return r[0]=1-p-f,r[3]=c-_,r[6]=h+g,r[1]=c+_,r[4]=1-u-f,r[7]=m-y,r[2]=h-g,r[5]=m+y,r[8]=1-u-p,r}function vP(r,e){var t=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],h=e[10],m=e[11],f=e[12],y=e[13],g=e[14],_=e[15],x=t*s-n*a,b=t*l-i*a,v=t*u-o*a,P=n*l-i*s,S=n*u-o*s,T=i*u-o*l,C=c*y-p*f,A=c*g-h*f,E=c*_-m*f,k=p*g-h*y,R=p*_-m*y,V=h*_-m*g,M=x*V-b*R+v*k+P*E-S*A+T*C;return M?(M=1/M,r[0]=(s*V-l*R+u*k)*M,r[1]=(l*E-a*V-u*A)*M,r[2]=(a*R-s*E+u*C)*M,r[3]=(i*R-n*V-o*k)*M,r[4]=(t*V-i*E+o*A)*M,r[5]=(n*E-t*R-o*C)*M,r[6]=(y*T-g*S+_*P)*M,r[7]=(g*v-f*T-_*b)*M,r[8]=(f*S-y*v+_*x)*M,r):null}function wP(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}function PP(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function SP(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])}function TP(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r}function Cd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r}function MP(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r}function CP(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r}function AP(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]}function IP(r,e){var t=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],l=r[6],u=r[7],c=r[8],p=e[0],h=e[1],m=e[2],f=e[3],y=e[4],g=e[5],_=e[6],x=e[7],b=e[8];return Math.abs(t-p)<=oe*Math.max(1,Math.abs(t),Math.abs(p))&&Math.abs(n-h)<=oe*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-m)<=oe*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(o-f)<=oe*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(a-y)<=oe*Math.max(1,Math.abs(a),Math.abs(y))&&Math.abs(s-g)<=oe*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-_)<=oe*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(u-x)<=oe*Math.max(1,Math.abs(u),Math.abs(x))&&Math.abs(c-b)<=oe*Math.max(1,Math.abs(c),Math.abs(b))}var EP=Md,LP=Cd;var F={};Bn(F,{add:()=>dS,adjoint:()=>VP,clone:()=>kP,copy:()=>RP,create:()=>DP,determinant:()=>UP,equals:()=>xS,exactEquals:()=>_S,frob:()=>fS,fromQuat:()=>iS,fromQuat2:()=>QP,fromRotation:()=>XP,fromRotationTranslation:()=>Ed,fromRotationTranslationScale:()=>rS,fromRotationTranslationScaleOrigin:()=>nS,fromScaling:()=>WP,fromTranslation:()=>qP,fromValues:()=>FP,fromXRotation:()=>YP,fromYRotation:()=>KP,fromZRotation:()=>JP,frustum:()=>oS,getRotation:()=>tS,getScaling:()=>Ld,getTranslation:()=>eS,identity:()=>Ad,invert:()=>OP,lookAt:()=>pS,mul:()=>bS,multiply:()=>Id,multiplyScalar:()=>yS,multiplyScalarAndAdd:()=>gS,ortho:()=>uS,orthoNO:()=>kd,orthoZO:()=>cS,perspective:()=>aS,perspectiveFromFieldOfView:()=>lS,perspectiveNO:()=>Dd,perspectiveZO:()=>sS,rotate:()=>GP,rotateX:()=>ZP,rotateY:()=>$P,rotateZ:()=>HP,scale:()=>NP,set:()=>zP,str:()=>mS,sub:()=>vS,subtract:()=>Rd,targetTo:()=>hS,translate:()=>jP,transpose:()=>BP});d();function DP(){var r=new Pe(16);return Pe!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function kP(r){var e=new Pe(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function RP(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function FP(r,e,t,n,i,o,a,s,l,u,c,p,h,m,f,y){var g=new Pe(16);return g[0]=r,g[1]=e,g[2]=t,g[3]=n,g[4]=i,g[5]=o,g[6]=a,g[7]=s,g[8]=l,g[9]=u,g[10]=c,g[11]=p,g[12]=h,g[13]=m,g[14]=f,g[15]=y,g}function zP(r,e,t,n,i,o,a,s,l,u,c,p,h,m,f,y,g){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=o,r[5]=a,r[6]=s,r[7]=l,r[8]=u,r[9]=c,r[10]=p,r[11]=h,r[12]=m,r[13]=f,r[14]=y,r[15]=g,r}function Ad(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function BP(r,e){if(r===e){var t=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=o,r[11]=e[14],r[12]=i,r[13]=a,r[14]=s}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}function OP(r,e){var t=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],h=e[10],m=e[11],f=e[12],y=e[13],g=e[14],_=e[15],x=t*s-n*a,b=t*l-i*a,v=t*u-o*a,P=n*l-i*s,S=n*u-o*s,T=i*u-o*l,C=c*y-p*f,A=c*g-h*f,E=c*_-m*f,k=p*g-h*y,R=p*_-m*y,V=h*_-m*g,M=x*V-b*R+v*k+P*E-S*A+T*C;return M?(M=1/M,r[0]=(s*V-l*R+u*k)*M,r[1]=(i*R-n*V-o*k)*M,r[2]=(y*T-g*S+_*P)*M,r[3]=(h*S-p*T-m*P)*M,r[4]=(l*E-a*V-u*A)*M,r[5]=(t*V-i*E+o*A)*M,r[6]=(g*v-f*T-_*b)*M,r[7]=(c*T-h*v+m*b)*M,r[8]=(a*R-s*E+u*C)*M,r[9]=(n*E-t*R-o*C)*M,r[10]=(f*S-y*v+_*x)*M,r[11]=(p*v-c*S-m*x)*M,r[12]=(s*A-a*k-l*C)*M,r[13]=(t*k-n*A+i*C)*M,r[14]=(y*b-f*P-g*x)*M,r[15]=(c*P-p*b+h*x)*M,r):null}function VP(r,e){var t=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],h=e[10],m=e[11],f=e[12],y=e[13],g=e[14],_=e[15];return r[0]=s*(h*_-m*g)-p*(l*_-u*g)+y*(l*m-u*h),r[1]=-(n*(h*_-m*g)-p*(i*_-o*g)+y*(i*m-o*h)),r[2]=n*(l*_-u*g)-s*(i*_-o*g)+y*(i*u-o*l),r[3]=-(n*(l*m-u*h)-s*(i*m-o*h)+p*(i*u-o*l)),r[4]=-(a*(h*_-m*g)-c*(l*_-u*g)+f*(l*m-u*h)),r[5]=t*(h*_-m*g)-c*(i*_-o*g)+f*(i*m-o*h),r[6]=-(t*(l*_-u*g)-a*(i*_-o*g)+f*(i*u-o*l)),r[7]=t*(l*m-u*h)-a*(i*m-o*h)+c*(i*u-o*l),r[8]=a*(p*_-m*y)-c*(s*_-u*y)+f*(s*m-u*p),r[9]=-(t*(p*_-m*y)-c*(n*_-o*y)+f*(n*m-o*p)),r[10]=t*(s*_-u*y)-a*(n*_-o*y)+f*(n*u-o*s),r[11]=-(t*(s*m-u*p)-a*(n*m-o*p)+c*(n*u-o*s)),r[12]=-(a*(p*g-h*y)-c*(s*g-l*y)+f*(s*h-l*p)),r[13]=t*(p*g-h*y)-c*(n*g-i*y)+f*(n*h-i*p),r[14]=-(t*(s*g-l*y)-a*(n*g-i*y)+f*(n*l-i*s)),r[15]=t*(s*h-l*p)-a*(n*h-i*p)+c*(n*l-i*s),r}function UP(r){var e=r[0],t=r[1],n=r[2],i=r[3],o=r[4],a=r[5],s=r[6],l=r[7],u=r[8],c=r[9],p=r[10],h=r[11],m=r[12],f=r[13],y=r[14],g=r[15],_=e*a-t*o,x=e*s-n*o,b=e*l-i*o,v=t*s-n*a,P=t*l-i*a,S=n*l-i*s,T=u*f-c*m,C=u*y-p*m,A=u*g-h*m,E=c*y-p*f,k=c*g-h*f,R=p*g-h*y;return _*R-x*k+b*E+v*A-P*C+S*T}function Id(r,e,t){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],h=e[9],m=e[10],f=e[11],y=e[12],g=e[13],_=e[14],x=e[15],b=t[0],v=t[1],P=t[2],S=t[3];return r[0]=b*n+v*s+P*p+S*y,r[1]=b*i+v*l+P*h+S*g,r[2]=b*o+v*u+P*m+S*_,r[3]=b*a+v*c+P*f+S*x,b=t[4],v=t[5],P=t[6],S=t[7],r[4]=b*n+v*s+P*p+S*y,r[5]=b*i+v*l+P*h+S*g,r[6]=b*o+v*u+P*m+S*_,r[7]=b*a+v*c+P*f+S*x,b=t[8],v=t[9],P=t[10],S=t[11],r[8]=b*n+v*s+P*p+S*y,r[9]=b*i+v*l+P*h+S*g,r[10]=b*o+v*u+P*m+S*_,r[11]=b*a+v*c+P*f+S*x,b=t[12],v=t[13],P=t[14],S=t[15],r[12]=b*n+v*s+P*p+S*y,r[13]=b*i+v*l+P*h+S*g,r[14]=b*o+v*u+P*m+S*_,r[15]=b*a+v*c+P*f+S*x,r}function jP(r,e,t){var n=t[0],i=t[1],o=t[2],a,s,l,u,c,p,h,m,f,y,g,_;return e===r?(r[12]=e[0]*n+e[4]*i+e[8]*o+e[12],r[13]=e[1]*n+e[5]*i+e[9]*o+e[13],r[14]=e[2]*n+e[6]*i+e[10]*o+e[14],r[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],h=e[6],m=e[7],f=e[8],y=e[9],g=e[10],_=e[11],r[0]=a,r[1]=s,r[2]=l,r[3]=u,r[4]=c,r[5]=p,r[6]=h,r[7]=m,r[8]=f,r[9]=y,r[10]=g,r[11]=_,r[12]=a*n+c*i+f*o+e[12],r[13]=s*n+p*i+y*o+e[13],r[14]=l*n+h*i+g*o+e[14],r[15]=u*n+m*i+_*o+e[15]),r}function NP(r,e,t){var n=t[0],i=t[1],o=t[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*i,r[5]=e[5]*i,r[6]=e[6]*i,r[7]=e[7]*i,r[8]=e[8]*o,r[9]=e[9]*o,r[10]=e[10]*o,r[11]=e[11]*o,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function GP(r,e,t,n){var i=n[0],o=n[1],a=n[2],s=Math.hypot(i,o,a),l,u,c,p,h,m,f,y,g,_,x,b,v,P,S,T,C,A,E,k,R,V,M,L;return s<oe?null:(s=1/s,i*=s,o*=s,a*=s,l=Math.sin(t),u=Math.cos(t),c=1-u,p=e[0],h=e[1],m=e[2],f=e[3],y=e[4],g=e[5],_=e[6],x=e[7],b=e[8],v=e[9],P=e[10],S=e[11],T=i*i*c+u,C=o*i*c+a*l,A=a*i*c-o*l,E=i*o*c-a*l,k=o*o*c+u,R=a*o*c+i*l,V=i*a*c+o*l,M=o*a*c-i*l,L=a*a*c+u,r[0]=p*T+y*C+b*A,r[1]=h*T+g*C+v*A,r[2]=m*T+_*C+P*A,r[3]=f*T+x*C+S*A,r[4]=p*E+y*k+b*R,r[5]=h*E+g*k+v*R,r[6]=m*E+_*k+P*R,r[7]=f*E+x*k+S*R,r[8]=p*V+y*M+b*L,r[9]=h*V+g*M+v*L,r[10]=m*V+_*M+P*L,r[11]=f*V+x*M+S*L,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function ZP(r,e,t){var n=Math.sin(t),i=Math.cos(t),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],h=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=o*i+u*n,r[5]=a*i+c*n,r[6]=s*i+p*n,r[7]=l*i+h*n,r[8]=u*i-o*n,r[9]=c*i-a*n,r[10]=p*i-s*n,r[11]=h*i-l*n,r}function $P(r,e,t){var n=Math.sin(t),i=Math.cos(t),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],p=e[10],h=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=o*i-u*n,r[1]=a*i-c*n,r[2]=s*i-p*n,r[3]=l*i-h*n,r[8]=o*n+u*i,r[9]=a*n+c*i,r[10]=s*n+p*i,r[11]=l*n+h*i,r}function HP(r,e,t){var n=Math.sin(t),i=Math.cos(t),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],p=e[6],h=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=o*i+u*n,r[1]=a*i+c*n,r[2]=s*i+p*n,r[3]=l*i+h*n,r[4]=u*i-o*n,r[5]=c*i-a*n,r[6]=p*i-s*n,r[7]=h*i-l*n,r}function qP(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function WP(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function XP(r,e,t){var n=t[0],i=t[1],o=t[2],a=Math.hypot(n,i,o),s,l,u;return a<oe?null:(a=1/a,n*=a,i*=a,o*=a,s=Math.sin(e),l=Math.cos(e),u=1-l,r[0]=n*n*u+l,r[1]=i*n*u+o*s,r[2]=o*n*u-i*s,r[3]=0,r[4]=n*i*u-o*s,r[5]=i*i*u+l,r[6]=o*i*u+n*s,r[7]=0,r[8]=n*o*u+i*s,r[9]=i*o*u-n*s,r[10]=o*o*u+l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function YP(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=n,r[6]=t,r[7]=0,r[8]=0,r[9]=-t,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function KP(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=0,r[2]=-t,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=t,r[9]=0,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function JP(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=0,r[4]=-t,r[5]=n,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Ed(r,e,t){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,h=n*u,m=i*l,f=i*u,y=o*u,g=a*s,_=a*l,x=a*u;return r[0]=1-(m+y),r[1]=p+x,r[2]=h-_,r[3]=0,r[4]=p-x,r[5]=1-(c+y),r[6]=f+g,r[7]=0,r[8]=h+_,r[9]=f-g,r[10]=1-(c+m),r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function QP(r,e){var t=new Pe(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?(t[0]=(s*a+c*n+l*o-u*i)*2/p,t[1]=(l*a+c*i+u*n-s*o)*2/p,t[2]=(u*a+c*o+s*i-l*n)*2/p):(t[0]=(s*a+c*n+l*o-u*i)*2,t[1]=(l*a+c*i+u*n-s*o)*2,t[2]=(u*a+c*o+s*i-l*n)*2),Ed(r,e,t),r}function eS(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}function Ld(r,e){var t=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 r[0]=Math.hypot(t,n,i),r[1]=Math.hypot(o,a,s),r[2]=Math.hypot(l,u,c),r}function tS(r,e){var t=new Pe(3);Ld(t,e);var n=1/t[0],i=1/t[1],o=1/t[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,h=e[8]*n,m=e[9]*i,f=e[10]*o,y=a+c+f,g=0;return y>0?(g=Math.sqrt(y+1)*2,r[3]=.25*g,r[0]=(p-m)/g,r[1]=(h-l)/g,r[2]=(s-u)/g):a>c&&a>f?(g=Math.sqrt(1+a-c-f)*2,r[3]=(p-m)/g,r[0]=.25*g,r[1]=(s+u)/g,r[2]=(h+l)/g):c>f?(g=Math.sqrt(1+c-a-f)*2,r[3]=(h-l)/g,r[0]=(s+u)/g,r[1]=.25*g,r[2]=(p+m)/g):(g=Math.sqrt(1+f-a-c)*2,r[3]=(s-u)/g,r[0]=(h+l)/g,r[1]=(p+m)/g,r[2]=.25*g),r}function rS(r,e,t,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,h=i*u,m=i*c,f=o*u,y=o*c,g=a*c,_=s*l,x=s*u,b=s*c,v=n[0],P=n[1],S=n[2];return r[0]=(1-(f+g))*v,r[1]=(h+b)*v,r[2]=(m-x)*v,r[3]=0,r[4]=(h-b)*P,r[5]=(1-(p+g))*P,r[6]=(y+_)*P,r[7]=0,r[8]=(m+x)*S,r[9]=(y-_)*S,r[10]=(1-(p+f))*S,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function nS(r,e,t,n,i){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,p=s+s,h=o*u,m=o*c,f=o*p,y=a*c,g=a*p,_=s*p,x=l*u,b=l*c,v=l*p,P=n[0],S=n[1],T=n[2],C=i[0],A=i[1],E=i[2],k=(1-(y+_))*P,R=(m+v)*P,V=(f-b)*P,M=(m-v)*S,L=(1-(h+_))*S,$=(g+x)*S,q=(f+b)*T,Y=(g-x)*T,he=(1-(h+y))*T;return r[0]=k,r[1]=R,r[2]=V,r[3]=0,r[4]=M,r[5]=L,r[6]=$,r[7]=0,r[8]=q,r[9]=Y,r[10]=he,r[11]=0,r[12]=t[0]+C-(k*C+M*A+q*E),r[13]=t[1]+A-(R*C+L*A+Y*E),r[14]=t[2]+E-(V*C+$*A+he*E),r[15]=1,r}function iS(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=t+t,s=n+n,l=i+i,u=t*a,c=n*a,p=n*s,h=i*a,m=i*s,f=i*l,y=o*a,g=o*s,_=o*l;return r[0]=1-p-f,r[1]=c+_,r[2]=h-g,r[3]=0,r[4]=c-_,r[5]=1-u-f,r[6]=m+y,r[7]=0,r[8]=h+g,r[9]=m-y,r[10]=1-u-p,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function oS(r,e,t,n,i,o,a){var s=1/(t-e),l=1/(i-n),u=1/(o-a);return r[0]=o*2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o*2*l,r[6]=0,r[7]=0,r[8]=(t+e)*s,r[9]=(i+n)*l,r[10]=(a+o)*u,r[11]=-1,r[12]=0,r[13]=0,r[14]=a*o*2*u,r[15]=0,r}function Dd(r,e,t,n,i){var o=1/Math.tan(e/2),a;return r[0]=o/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(a=1/(n-i),r[10]=(i+n)*a,r[14]=2*i*n*a):(r[10]=-1,r[14]=-2*n),r}var aS=Dd;function sS(r,e,t,n,i){var o=1/Math.tan(e/2),a;return r[0]=o/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(a=1/(n-i),r[10]=i*a,r[14]=i*n*a):(r[10]=-1,r[14]=-n),r}function lS(r,e,t,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 r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=-((a-s)*l*.5),r[9]=(i-o)*u*.5,r[10]=n/(t-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*t/(t-n),r[15]=0,r}function kd(r,e,t,n,i,o,a){var s=1/(e-t),l=1/(n-i),u=1/(o-a);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*u,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*l,r[14]=(a+o)*u,r[15]=1,r}var uS=kd;function cS(r,e,t,n,i,o,a){var s=1/(e-t),l=1/(n-i),u=1/(o-a);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=u,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*l,r[14]=o*u,r[15]=1,r}function pS(r,e,t,n){var i,o,a,s,l,u,c,p,h,m,f=e[0],y=e[1],g=e[2],_=n[0],x=n[1],b=n[2],v=t[0],P=t[1],S=t[2];return Math.abs(f-v)<oe&&Math.abs(y-P)<oe&&Math.abs(g-S)<oe?Ad(r):(c=f-v,p=y-P,h=g-S,m=1/Math.hypot(c,p,h),c*=m,p*=m,h*=m,i=x*h-b*p,o=b*c-_*h,a=_*p-x*c,m=Math.hypot(i,o,a),m?(m=1/m,i*=m,o*=m,a*=m):(i=0,o=0,a=0),s=p*a-h*o,l=h*i-c*a,u=c*o-p*i,m=Math.hypot(s,l,u),m?(m=1/m,s*=m,l*=m,u*=m):(s=0,l=0,u=0),r[0]=i,r[1]=s,r[2]=c,r[3]=0,r[4]=o,r[5]=l,r[6]=p,r[7]=0,r[8]=a,r[9]=u,r[10]=h,r[11]=0,r[12]=-(i*f+o*y+a*g),r[13]=-(s*f+l*y+u*g),r[14]=-(c*f+p*y+h*g),r[15]=1,r)}function hS(r,e,t,n){var i=e[0],o=e[1],a=e[2],s=n[0],l=n[1],u=n[2],c=i-t[0],p=o-t[1],h=a-t[2],m=c*c+p*p+h*h;m>0&&(m=1/Math.sqrt(m),c*=m,p*=m,h*=m);var f=l*h-u*p,y=u*c-s*h,g=s*p-l*c;return m=f*f+y*y+g*g,m>0&&(m=1/Math.sqrt(m),f*=m,y*=m,g*=m),r[0]=f,r[1]=y,r[2]=g,r[3]=0,r[4]=p*g-h*y,r[5]=h*f-c*g,r[6]=c*y-p*f,r[7]=0,r[8]=c,r[9]=p,r[10]=h,r[11]=0,r[12]=i,r[13]=o,r[14]=a,r[15]=1,r}function mS(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}function fS(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}function dS(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r}function Rd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r}function yS(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r}function gS(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r[9]=e[9]+t[9]*n,r[10]=e[10]+t[10]*n,r[11]=e[11]+t[11]*n,r[12]=e[12]+t[12]*n,r[13]=e[13]+t[13]*n,r[14]=e[14]+t[14]*n,r[15]=e[15]+t[15]*n,r}function _S(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]}function xS(r,e){var t=r[0],n=r[1],i=r[2],o=r[3],a=r[4],s=r[5],l=r[6],u=r[7],c=r[8],p=r[9],h=r[10],m=r[11],f=r[12],y=r[13],g=r[14],_=r[15],x=e[0],b=e[1],v=e[2],P=e[3],S=e[4],T=e[5],C=e[6],A=e[7],E=e[8],k=e[9],R=e[10],V=e[11],M=e[12],L=e[13],$=e[14],q=e[15];return Math.abs(t-x)<=oe*Math.max(1,Math.abs(t),Math.abs(x))&&Math.abs(n-b)<=oe*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-v)<=oe*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(o-P)<=oe*Math.max(1,Math.abs(o),Math.abs(P))&&Math.abs(a-S)<=oe*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(s-T)<=oe*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-C)<=oe*Math.max(1,Math.abs(l),Math.abs(C))&&Math.abs(u-A)<=oe*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(c-E)<=oe*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(p-k)<=oe*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(h-R)<=oe*Math.max(1,Math.abs(h),Math.abs(R))&&Math.abs(m-V)<=oe*Math.max(1,Math.abs(m),Math.abs(V))&&Math.abs(f-M)<=oe*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(y-L)<=oe*Math.max(1,Math.abs(y),Math.abs(L))&&Math.abs(g-$)<=oe*Math.max(1,Math.abs(g),Math.abs($))&&Math.abs(_-q)<=oe*Math.max(1,Math.abs(_),Math.abs(q))}var bS=Id,vS=Rd;var en={};Bn(en,{add:()=>NT,calculateW:()=>LT,clone:()=>OT,conjugate:()=>FT,copy:()=>UT,create:()=>Lh,dot:()=>ey,equals:()=>WT,exactEquals:()=>qT,exp:()=>Yd,fromEuler:()=>zT,fromMat3:()=>Jd,fromValues:()=>VT,getAngle:()=>CT,getAxisAngle:()=>MT,identity:()=>TT,invert:()=>RT,len:()=>$T,length:()=>ty,lerp:()=>ZT,ln:()=>Kd,mul:()=>GT,multiply:()=>Xd,normalize:()=>Dh,pow:()=>DT,random:()=>kT,rotateX:()=>AT,rotateY:()=>IT,rotateZ:()=>ET,rotationTo:()=>XT,scale:()=>Qd,set:()=>jT,setAxes:()=>KT,setAxisAngle:()=>Wd,slerp:()=>ul,sqlerp:()=>YT,sqrLen:()=>HT,squaredLength:()=>ry,str:()=>BT});d();var O={};Bn(O,{add:()=>TS,angle:()=>$S,bezier:()=>BS,ceil:()=>MS,clone:()=>wS,copy:()=>PS,create:()=>il,cross:()=>To,dist:()=>QS,distance:()=>Vd,div:()=>JS,divide:()=>Od,dot:()=>al,equals:()=>XS,exactEquals:()=>WS,floor:()=>CS,forEach:()=>rT,fromValues:()=>ol,hermite:()=>zS,inverse:()=>RS,len:()=>xh,length:()=>Fd,lerp:()=>FS,max:()=>IS,min:()=>AS,mul:()=>KS,multiply:()=>Bd,negate:()=>kS,normalize:()=>_h,random:()=>OS,rotateX:()=>NS,rotateY:()=>GS,rotateZ:()=>ZS,round:()=>ES,scale:()=>LS,scaleAndAdd:()=>DS,set:()=>SS,sqrDist:()=>eT,sqrLen:()=>tT,squaredDistance:()=>Ud,squaredLength:()=>jd,str:()=>qS,sub:()=>YS,subtract:()=>zd,transformMat3:()=>US,transformMat4:()=>VS,transformQuat:()=>jS,zero:()=>HS});d();function il(){var r=new Pe(3);return Pe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function wS(r){var e=new Pe(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Fd(r){var e=r[0],t=r[1],n=r[2];return Math.hypot(e,t,n)}function ol(r,e,t){var n=new Pe(3);return n[0]=r,n[1]=e,n[2]=t,n}function PS(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function SS(r,e,t,n){return r[0]=e,r[1]=t,r[2]=n,r}function TS(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function zd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function Bd(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function Od(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function MS(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function CS(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function AS(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function IS(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function ES(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r}function LS(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function DS(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r}function Vd(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return Math.hypot(t,n,i)}function Ud(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return t*t+n*n+i*i}function jd(r){var e=r[0],t=r[1],n=r[2];return e*e+t*t+n*n}function kS(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function RS(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function _h(r,e){var t=e[0],n=e[1],i=e[2],o=t*t+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r}function al(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function To(r,e,t){var n=e[0],i=e[1],o=e[2],a=t[0],s=t[1],l=t[2];return r[0]=i*l-o*s,r[1]=o*a-n*l,r[2]=n*s-i*a,r}function FS(r,e,t,n){var i=e[0],o=e[1],a=e[2];return r[0]=i+n*(t[0]-i),r[1]=o+n*(t[1]-o),r[2]=a+n*(t[2]-a),r}function zS(r,e,t,n,i,o){var a=o*o,s=a*(2*o-3)+1,l=a*(o-2)+o,u=a*(o-1),c=a*(3-2*o);return r[0]=e[0]*s+t[0]*l+n[0]*u+i[0]*c,r[1]=e[1]*s+t[1]*l+n[1]*u+i[1]*c,r[2]=e[2]*s+t[2]*l+n[2]*u+i[2]*c,r}function BS(r,e,t,n,i,o){var a=1-o,s=a*a,l=o*o,u=s*a,c=3*o*s,p=3*l*a,h=l*o;return r[0]=e[0]*u+t[0]*c+n[0]*p+i[0]*h,r[1]=e[1]*u+t[1]*c+n[1]*p+i[1]*h,r[2]=e[2]*u+t[2]*c+n[2]*p+i[2]*h,r}function OS(r,e){e=e||1;var t=St()*2*Math.PI,n=St()*2-1,i=Math.sqrt(1-n*n)*e;return r[0]=Math.cos(t)*i,r[1]=Math.sin(t)*i,r[2]=n*e,r}function VS(r,e,t){var n=e[0],i=e[1],o=e[2],a=t[3]*n+t[7]*i+t[11]*o+t[15];return a=a||1,r[0]=(t[0]*n+t[4]*i+t[8]*o+t[12])/a,r[1]=(t[1]*n+t[5]*i+t[9]*o+t[13])/a,r[2]=(t[2]*n+t[6]*i+t[10]*o+t[14])/a,r}function US(r,e,t){var n=e[0],i=e[1],o=e[2];return r[0]=n*t[0]+i*t[3]+o*t[6],r[1]=n*t[1]+i*t[4]+o*t[7],r[2]=n*t[2]+i*t[5]+o*t[8],r}function jS(r,e,t){var n=t[0],i=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=i*u-o*l,p=o*s-n*u,h=n*l-i*s,m=i*h-o*p,f=o*c-n*h,y=n*p-i*c,g=a*2;return c*=g,p*=g,h*=g,m*=2,f*=2,y*=2,r[0]=s+c+m,r[1]=l+p+f,r[2]=u+h+y,r}function NS(r,e,t,n){var i=[],o=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function GS(r,e,t,n){var i=[],o=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function ZS(r,e,t,n){var i=[],o=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function $S(r,e){var t=r[0],n=r[1],i=r[2],o=e[0],a=e[1],s=e[2],l=Math.sqrt(t*t+n*n+i*i),u=Math.sqrt(o*o+a*a+s*s),c=l*u,p=c&&al(r,e)/c;return Math.acos(Math.min(Math.max(p,-1),1))}function HS(r){return r[0]=0,r[1]=0,r[2]=0,r}function qS(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function WS(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function XS(r,e){var t=r[0],n=r[1],i=r[2],o=e[0],a=e[1],s=e[2];return Math.abs(t-o)<=oe*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(n-a)<=oe*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-s)<=oe*Math.max(1,Math.abs(i),Math.abs(s))}var YS=zd,KS=Bd,JS=Od,QS=Vd,eT=Ud,xh=Fd,tT=jd,rT=function(){var r=il();return function(e,t,n,i,o,a){var s,l;for(t||(t=3),n||(n=0),i?l=Math.min(i*t+n,e.length):l=e.length,s=n;s<l;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],o(r,r,a),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2];return e}}();var De={};Bn(De,{add:()=>Sh,ceil:()=>nT,clone:()=>bh,copy:()=>wh,create:()=>Nd,cross:()=>pT,dist:()=>bT,distance:()=>Hd,div:()=>xT,divide:()=>$d,dot:()=>Ch,equals:()=>Eh,exactEquals:()=>Ih,floor:()=>iT,forEach:()=>ST,fromValues:()=>vh,inverse:()=>cT,len:()=>wT,length:()=>sl,lerp:()=>Ah,max:()=>aT,min:()=>oT,mul:()=>_T,multiply:()=>Zd,negate:()=>uT,normalize:()=>Mh,random:()=>hT,round:()=>sT,scale:()=>Th,scaleAndAdd:()=>lT,set:()=>Ph,sqrDist:()=>vT,sqrLen:()=>PT,squaredDistance:()=>qd,squaredLength:()=>ll,str:()=>yT,sub:()=>gT,subtract:()=>Gd,transformMat4:()=>mT,transformQuat:()=>fT,zero:()=>dT});d();function Nd(){var r=new Pe(4);return Pe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function bh(r){var e=new Pe(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function vh(r,e,t,n){var i=new Pe(4);return i[0]=r,i[1]=e,i[2]=t,i[3]=n,i}function wh(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function Ph(r,e,t,n,i){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r}function Sh(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function Gd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}function Zd(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3],r}function $d(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r[3]=e[3]/t[3],r}function nT(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r[3]=Math.ceil(e[3]),r}function iT(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r[3]=Math.floor(e[3]),r}function oT(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r[3]=Math.min(e[3],t[3]),r}function aT(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r[3]=Math.max(e[3],t[3]),r}function sT(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r[3]=Math.round(e[3]),r}function Th(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function lT(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r}function Hd(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2],o=e[3]-r[3];return Math.hypot(t,n,i,o)}function qd(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2],o=e[3]-r[3];return t*t+n*n+i*i+o*o}function sl(r){var e=r[0],t=r[1],n=r[2],i=r[3];return Math.hypot(e,t,n,i)}function ll(r){var e=r[0],t=r[1],n=r[2],i=r[3];return e*e+t*t+n*n+i*i}function uT(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r}function cT(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r[3]=1/e[3],r}function Mh(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=t*t+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),r[0]=t*a,r[1]=n*a,r[2]=i*a,r[3]=o*a,r}function Ch(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function pT(r,e,t,n){var i=t[0]*n[1]-t[1]*n[0],o=t[0]*n[2]-t[2]*n[0],a=t[0]*n[3]-t[3]*n[0],s=t[1]*n[2]-t[2]*n[1],l=t[1]*n[3]-t[3]*n[1],u=t[2]*n[3]-t[3]*n[2],c=e[0],p=e[1],h=e[2],m=e[3];return r[0]=p*u-h*l+m*s,r[1]=-(c*u)+h*a-m*o,r[2]=c*l-p*a+m*i,r[3]=-(c*s)+p*o-h*i,r}function Ah(r,e,t,n){var i=e[0],o=e[1],a=e[2],s=e[3];return r[0]=i+n*(t[0]-i),r[1]=o+n*(t[1]-o),r[2]=a+n*(t[2]-a),r[3]=s+n*(t[3]-s),r}function hT(r,e){e=e||1;var t,n,i,o,a,s;do t=St()*2-1,n=St()*2-1,a=t*t+n*n;while(a>=1);do i=St()*2-1,o=St()*2-1,s=i*i+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return r[0]=e*t,r[1]=e*n,r[2]=e*i*l,r[3]=e*o*l,r}function mT(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3];return r[0]=t[0]*n+t[4]*i+t[8]*o+t[12]*a,r[1]=t[1]*n+t[5]*i+t[9]*o+t[13]*a,r[2]=t[2]*n+t[6]*i+t[10]*o+t[14]*a,r[3]=t[3]*n+t[7]*i+t[11]*o+t[15]*a,r}function fT(r,e,t){var n=e[0],i=e[1],o=e[2],a=t[0],s=t[1],l=t[2],u=t[3],c=u*n+s*o-l*i,p=u*i+l*n-a*o,h=u*o+a*i-s*n,m=-a*n-s*i-l*o;return r[0]=c*u+m*-a+p*-l-h*-s,r[1]=p*u+m*-s+h*-a-c*-l,r[2]=h*u+m*-l+c*-s-p*-a,r[3]=e[3],r}function dT(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function yT(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function Ih(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function Eh(r,e){var t=r[0],n=r[1],i=r[2],o=r[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(t-a)<=oe*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(n-s)<=oe*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=oe*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=oe*Math.max(1,Math.abs(o),Math.abs(u))}var gT=Gd,_T=Zd,xT=$d,bT=Hd,vT=qd,wT=sl,PT=ll,ST=function(){var r=Nd();return function(e,t,n,i,o,a){var s,l;for(t||(t=4),n||(n=0),i?l=Math.min(i*t+n,e.length):l=e.length,s=n;s<l;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],r[3]=e[s+3],o(r,r,a),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2],e[s+3]=r[3];return e}}();function Lh(){var r=new Pe(4);return Pe!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function TT(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function Wd(r,e,t){t=t*.5;var n=Math.sin(t);return r[0]=n*e[0],r[1]=n*e[1],r[2]=n*e[2],r[3]=Math.cos(t),r}function MT(r,e){var t=Math.acos(e[3])*2,n=Math.sin(t/2);return n>oe?(r[0]=e[0]/n,r[1]=e[1]/n,r[2]=e[2]/n):(r[0]=1,r[1]=0,r[2]=0),t}function CT(r,e){var t=ey(r,e);return Math.acos(2*t*t-1)}function Xd(r,e,t){var n=e[0],i=e[1],o=e[2],a=e[3],s=t[0],l=t[1],u=t[2],c=t[3];return r[0]=n*c+a*s+i*u-o*l,r[1]=i*c+a*l+o*s-n*u,r[2]=o*c+a*u+n*l-i*s,r[3]=a*c-n*s-i*l-o*u,r}function AT(r,e,t){t*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(t),l=Math.cos(t);return r[0]=n*l+a*s,r[1]=i*l+o*s,r[2]=o*l-i*s,r[3]=a*l-n*s,r}function IT(r,e,t){t*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(t),l=Math.cos(t);return r[0]=n*l-o*s,r[1]=i*l+a*s,r[2]=o*l+n*s,r[3]=a*l-i*s,r}function ET(r,e,t){t*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(t),l=Math.cos(t);return r[0]=n*l+i*s,r[1]=i*l-n*s,r[2]=o*l+a*s,r[3]=a*l-o*s,r}function LT(r,e){var t=e[0],n=e[1],i=e[2];return r[0]=t,r[1]=n,r[2]=i,r[3]=Math.sqrt(Math.abs(1-t*t-n*n-i*i)),r}function Yd(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=Math.sqrt(t*t+n*n+i*i),s=Math.exp(o),l=a>0?s*Math.sin(a)/a:0;return r[0]=t*l,r[1]=n*l,r[2]=i*l,r[3]=s*Math.cos(a),r}function Kd(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=Math.sqrt(t*t+n*n+i*i),s=a>0?Math.atan2(a,o)/a:0;return r[0]=t*s,r[1]=n*s,r[2]=i*s,r[3]=.5*Math.log(t*t+n*n+i*i+o*o),r}function DT(r,e,t){return Kd(r,e),Qd(r,r,t),Yd(r,r),r}function ul(r,e,t,n){var i=e[0],o=e[1],a=e[2],s=e[3],l=t[0],u=t[1],c=t[2],p=t[3],h,m,f,y,g;return m=i*l+o*u+a*c+s*p,m<0&&(m=-m,l=-l,u=-u,c=-c,p=-p),1-m>oe?(h=Math.acos(m),f=Math.sin(h),y=Math.sin((1-n)*h)/f,g=Math.sin(n*h)/f):(y=1-n,g=n),r[0]=y*i+g*l,r[1]=y*o+g*u,r[2]=y*a+g*c,r[3]=y*s+g*p,r}function kT(r){var e=St(),t=St(),n=St(),i=Math.sqrt(1-e),o=Math.sqrt(e);return r[0]=i*Math.sin(2*Math.PI*t),r[1]=i*Math.cos(2*Math.PI*t),r[2]=o*Math.sin(2*Math.PI*n),r[3]=o*Math.cos(2*Math.PI*n),r}function RT(r,e){var t=e[0],n=e[1],i=e[2],o=e[3],a=t*t+n*n+i*i+o*o,s=a?1/a:0;return r[0]=-t*s,r[1]=-n*s,r[2]=-i*s,r[3]=o*s,r}function FT(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r}function Jd(r,e){var t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),r[3]=.5*n,n=.5/n,r[0]=(e[5]-e[7])*n,r[1]=(e[6]-e[2])*n,r[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[o*3+o]-e[a*3+a]+1),r[i]=.5*n,n=.5/n,r[3]=(e[o*3+a]-e[a*3+o])*n,r[o]=(e[o*3+i]+e[i*3+o])*n,r[a]=(e[a*3+i]+e[i*3+a])*n}return r}function zT(r,e,t,n){var i=.5*Math.PI/180;e*=i,t*=i,n*=i;var o=Math.sin(e),a=Math.cos(e),s=Math.sin(t),l=Math.cos(t),u=Math.sin(n),c=Math.cos(n);return r[0]=o*l*c-a*s*u,r[1]=a*s*c+o*l*u,r[2]=a*l*u-o*s*c,r[3]=a*l*c+o*s*u,r}function BT(r){return"quat("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}var OT=bh,VT=vh,UT=wh,jT=Ph,NT=Sh,GT=Xd,Qd=Th,ey=Ch,ZT=Ah,ty=sl,$T=ty,ry=ll,HT=ry,Dh=Mh,qT=Ih,WT=Eh,XT=function(){var r=il(),e=ol(1,0,0),t=ol(0,1,0);return function(n,i,o){var a=al(i,o);return a<-.999999?(To(r,e,i),xh(r)<1e-6&&To(r,t,i),_h(r,r),Wd(n,r,Math.PI),n):a>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(To(r,i,o),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+a,Dh(n,n))}}(),YT=function(){var r=Lh(),e=Lh();return function(t,n,i,o,a,s){return ul(r,n,a,s),ul(e,i,o,s),ul(t,r,e,2*s*(1-s)),t}}(),KT=function(){var r=gh();return function(e,t,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-t[0],r[5]=-t[1],r[8]=-t[2],Dh(e,Jd(e,r))}}();var it={};Bn(it,{add:()=>r2,angle:()=>w2,ceil:()=>n2,clone:()=>JT,copy:()=>e2,create:()=>ny,cross:()=>f2,dist:()=>L2,distance:()=>sy,div:()=>E2,divide:()=>ay,dot:()=>m2,equals:()=>M2,exactEquals:()=>T2,floor:()=>i2,forEach:()=>R2,fromValues:()=>QT,inverse:()=>p2,len:()=>C2,length:()=>uy,lerp:()=>d2,max:()=>a2,min:()=>o2,mul:()=>I2,multiply:()=>oy,negate:()=>c2,normalize:()=>h2,random:()=>y2,rotate:()=>v2,round:()=>s2,scale:()=>l2,scaleAndAdd:()=>u2,set:()=>t2,sqrDist:()=>D2,sqrLen:()=>k2,squaredDistance:()=>ly,squaredLength:()=>cy,str:()=>S2,sub:()=>A2,subtract:()=>iy,transformMat2:()=>g2,transformMat2d:()=>_2,transformMat3:()=>x2,transformMat4:()=>b2,zero:()=>P2});d();function ny(){var r=new Pe(2);return Pe!=Float32Array&&(r[0]=0,r[1]=0),r}function JT(r){var e=new Pe(2);return e[0]=r[0],e[1]=r[1],e}function QT(r,e){var t=new Pe(2);return t[0]=r,t[1]=e,t}function e2(r,e){return r[0]=e[0],r[1]=e[1],r}function t2(r,e,t){return r[0]=e,r[1]=t,r}function r2(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function iy(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function oy(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r}function ay(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r}function n2(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r}function i2(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r}function o2(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function a2(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}function s2(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r}function l2(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function u2(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r}function sy(r,e){var t=e[0]-r[0],n=e[1]-r[1];return Math.hypot(t,n)}function ly(r,e){var t=e[0]-r[0],n=e[1]-r[1];return t*t+n*n}function uy(r){var e=r[0],t=r[1];return Math.hypot(e,t)}function cy(r){var e=r[0],t=r[1];return e*e+t*t}function c2(r,e){return r[0]=-e[0],r[1]=-e[1],r}function p2(r,e){return r[0]=1/e[0],r[1]=1/e[1],r}function h2(r,e){var t=e[0],n=e[1],i=t*t+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r}function m2(r,e){return r[0]*e[0]+r[1]*e[1]}function f2(r,e,t){var n=e[0]*t[1]-e[1]*t[0];return r[0]=r[1]=0,r[2]=n,r}function d2(r,e,t,n){var i=e[0],o=e[1];return r[0]=i+n*(t[0]-i),r[1]=o+n*(t[1]-o),r}function y2(r,e){e=e||1;var t=St()*2*Math.PI;return r[0]=Math.cos(t)*e,r[1]=Math.sin(t)*e,r}function g2(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i,r[1]=t[1]*n+t[3]*i,r}function _2(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i+t[4],r[1]=t[1]*n+t[3]*i+t[5],r}function x2(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[3]*i+t[6],r[1]=t[1]*n+t[4]*i+t[7],r}function b2(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[4]*i+t[12],r[1]=t[1]*n+t[5]*i+t[13],r}function v2(r,e,t,n){var i=e[0]-t[0],o=e[1]-t[1],a=Math.sin(n),s=Math.cos(n);return r[0]=i*s-o*a+t[0],r[1]=i*a+o*s+t[1],r}function w2(r,e){var t=r[0],n=r[1],i=e[0],o=e[1],a=Math.sqrt(t*t+n*n)*Math.sqrt(i*i+o*o),s=a&&(t*i+n*o)/a;return Math.acos(Math.min(Math.max(s,-1),1))}function P2(r){return r[0]=0,r[1]=0,r}function S2(r){return"vec2("+r[0]+", "+r[1]+")"}function T2(r,e){return r[0]===e[0]&&r[1]===e[1]}function M2(r,e){var t=r[0],n=r[1],i=e[0],o=e[1];return Math.abs(t-i)<=oe*Math.max(1,Math.abs(t),Math.abs(i))&&Math.abs(n-o)<=oe*Math.max(1,Math.abs(n),Math.abs(o))}var C2=uy,A2=iy,I2=oy,E2=ay,L2=sy,D2=ly,k2=cy,R2=function(){var r=ny();return function(e,t,n,i,o,a){var s,l;for(t||(t=2),n||(n=0),i?l=Math.min(i*t+n,e.length):l=e.length,s=n;s<l;s+=t)r[0]=e[s],r[1]=e[s+1],o(r,r,a),e[s]=r[0],e[s+1]=r[1];return e}}();d();d();function et(r,e,t){return e*(8192/(r.tileSize*Math.pow(2,t-r.tileID.overscaledZ)))}function Si(){return new Float64Array(4)}function Ne(){return new Float64Array(3)}function ar(){return new Float64Array(16)}function tn(){let r=new Float64Array(16);return F.identity(r),r}function cl(){let r=new Float32Array(16);return F.identity(r),r}function Tt(r,e,t,n,i=!1){if(!t[0]&&!t[1])return[0,0];let o=i?n==="map"?-r.bearingInRadians:0:n==="viewport"?r.bearingInRadians:0;if(o){let a=Math.sin(o),s=Math.cos(o);t=[t[0]*s-t[1]*a,t[0]*a+t[1]*s]}return[i?t[0]:et(e,t[0],r.zoom),i?t[1]:et(e,t[1],r.zoom)]}function Mo(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]}function Bt(r,e,t){let n=Rr.determinant([r[0],r[1],r[2],e[0],e[1],e[2],t[0],t[1],t[2]]);if(n===0)return null;let i=O.cross([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),o=O.cross([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),a=O.cross([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),s=O.scale([],i,-r[3]);return O.add(s,s,O.scale([],o,-e[3])),O.add(s,s,O.scale([],a,-t[3])),O.scale(s,s,1/n),s}function dy(r,e,t){let n=r[0]*t[0]+r[1]*t[1]+r[2]*t[2],i=e[0]*t[0]+e[1]*t[1]+e[2]*t[2];return i===0?null:(-n-t[3])/i}function Co(r,e,t,n){let i=Math.sqrt(r*r+e*e),o=Math.sqrt(t*t+n*n);r/=i,e/=i,t/=o,n/=o;let a=r*t+e*n,s=Math.acos(a);return-e*t+r*n>0?s:-s}function bt(r,e){let t=Un(r,360),n=Un(e,360),i=n-t,o=n>t?i-360:i+360;return Math.abs(i)<Math.abs(o)?i:o}function Ao(r,e){let t=Un(r,Math.PI*2),n=Un(e,Math.PI*2);return Math.min(Math.abs(t-n),Math.abs(t-n+Math.PI*2),Math.abs(t-n-Math.PI*2))}function Un(r,e){return(r%e+e)%e}function Ti(r,e,t,n,i){let o=ae((r-e)/(t-e),0,1);return Fr(n,i,o)}function Fr(r,e,t){return r*(1-t)+e*t}function yy(r){let e=1/0,t=1/0,n=-1/0,i=-1/0;for(let o of r)e=Math.min(e,o.x),t=Math.min(t,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y);return[e,t,n,i]}function pl(r){if(r<=0)return 0;if(r>=1)return 1;let e=r*r,t=e*r;return 4*(r<.5?t:3*(r-e)+t-.75)}function Io(r,e,t,n){let i=new fy.default(r,e,t,n);return o=>i.solve(o)}var Eo=Io(.25,.1,.25,1);function ae(r,e,t){return Math.min(t,Math.max(e,r))}function Yt(r,e,t){let n=t-e,i=((r-e)%n+n)%n+e;return i===e?t:i}function gy(r,e){let t=[];for(let n in r)n in e||t.push(n);return t}function N(r,...e){for(let t of e)for(let n in t)r[n]=t[n];return r}function xr(r,e){let t={};for(let n=0;n<e.length;n++){let i=e[n];i in r&&(t[i]=r[i])}return t}var F2=1;function hl(){return F2++}function _y(r){return Math.log(r)/Math.LN2%1===0}function xy(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function We(r){return Math.pow(2,r)}function Ge(r){return Math.log(r)/Math.LN2}function Lo(r,e,t){let n={};for(let i in r)n[i]=e.call(t||this,r[i],i,r);return n}function ml(r,e,t){let n={};for(let i in r)e.call(t||this,r[i],i,r)&&(n[i]=r[i]);return n}function Xt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Xt(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let n in r)if(!Xt(r[n],e[n]))return!1;return!0}return r===e}function dt(r){return Array.isArray(r)?r.map(dt):typeof r=="object"&&r?Lo(r,dt):r}var py={};function ue(r){py[r]||(typeof console<"u"&&console.warn(r),py[r]=!0)}function zr(r,e,t){return(t.y-r.y)*(e.x-r.x)>(e.y-r.y)*(t.x-r.x)}function by(r,e,t,n){let i=e.y-r.y,o=e.x-r.x,a=n.y-t.y,s=n.x-t.x,l=a*o-s*i;if(l===0)return null;let u=r.y-t.y,c=r.x-t.x,p=(s*u-a*c)/l;return new my.default(r.x+p*o,r.y+p*i)}function vy([r,e,t]){return e+=90,e*=Math.PI/180,t*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(t),y:r*Math.sin(e)*Math.sin(t),z:r*Math.cos(t)}}function Br(r){return typeof WorkerGlobalScope<"u"&&typeof r<"u"&&r instanceof WorkerGlobalScope}function wy(r){let e=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,t={};if(r.replace(e,(n,i,o,a)=>{let s=o||a;return t[i]=s?s.toLowerCase():!0,""}),t["max-age"]){let n=parseInt(t["max-age"],10);isNaN(n)?delete t["max-age"]:t["max-age"]=n}return t}var kh=null;function Py(r){if(kh==null){let e=r.navigator?r.navigator.userAgent:null;kh=!!r.safari||!!(e&&(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return kh}function Mt(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}var Sy=async r=>{if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));let e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},hy="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",Ty=r=>new Promise((e,t)=>{let n=new Image;n.onload=()=>{e(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=hy})},n.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(r)],{type:"image/png"});n.src=r.byteLength?URL.createObjectURL(i):hy});function z2(r,e,t,n,i){let o=Math.max(-e,0)*4,l=(Math.max(0,t)-t)*n*4+o,u=n*4,c=Math.max(0,e),p=Math.max(0,t),h=Math.min(r.width,e+n),m=Math.min(r.height,t+i);return{rect:{x:c,y:p,width:h-c,height:m-p},layout:[{offset:l,stride:u}]}}async function My(r,e,t,n,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(r,{timestamp:0});try{let a=o?.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error(`Unrecognized format ${a}`);let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,z2(r,e,t,n,i)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}function Do(r,e,t,n){return r.addEventListener(e,t,n),{unsubscribe:()=>{r.removeEventListener(e,t,n)}}}function Ee(r){return r*Math.PI/180}function Vn(r){return r/Math.PI*180}function fl(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing}function Cy(r){let e=new Float64Array(9);Rr.fromQuat(e,r);let t=Vn(-Math.asin(ae(e[2],-1,1))),n,i;return Math.hypot(e[5],e[8])<.001?(n=0,i=-Vn(Math.atan2(e[3],e[4]))):(n=Vn(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),i=Vn(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:n,pitch:t+90,bearing:i}}function dl(r,e,t){let n=it.fromValues(e.x-t.x,e.y-t.y),i=it.fromValues(r.x-t.x,r.y-t.y),o=n[0]*i[1]-n[1]*i[0],a=Math.atan2(o,it.dot(n,i));return Vn(a)}function Rh(r,e,t){let n=new Float64Array(4);return en.fromEuler(n,r,e-90,t),n}var jn=25,ko=0,vt=85.051129,Ay={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Iy={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function Ey(r,e){return Ay[e]&&"touches"in r}function Ly(r,e){return Iy[e]&&(r instanceof MouseEvent||r instanceof WheelEvent)}function Dy(r){return Ay[r]||Iy[r]}d();d();var ky="AbortError";function Ry(r){return r.message===ky}function Nn(){return new Error(ky)}var B2=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),yl,Fh,re={now:B2,frame(r,e,t){let n=requestAnimationFrame(o=>{i(),e(o)}),{unsubscribe:i}=Do(r.signal,"abort",()=>{i(),cancelAnimationFrame(n),t(Nn())},!1)},frameAsync(r){return new Promise((e,t)=>{this.frame(r,e,t)})},getImageData(r,e=0){return this.getImageCanvasContext(r).getImageData(-e,-e,r.width+2*e,r.height+2*e)},getImageCanvasContext(r){let e=window.document.createElement("canvas"),t=e.getContext("2d",{willReadFrequently:!0});if(!t)throw new Error("failed to create canvas 2d context");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0,r.width,r.height),t},resolveURL(r){return yl||(yl=document.createElement("a")),yl.href=r,yl.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Fh==null&&(Fh=matchMedia("(prefers-reduced-motion: reduce)")),Fh.matches):!1}};d();var Fy=ie(le(),1),Ae=class Ae{static testProp(e){if(!Ae.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in Ae.docStyle)return e[t];return e[0]}static create(e,t,n){let i=window.document.createElement(e);return t!==void 0&&(i.className=t),n&&n.appendChild(i),i}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){Ae.docStyle&&Ae.selectProp&&(Ae.userSelect=Ae.docStyle[Ae.selectProp],Ae.docStyle[Ae.selectProp]="none")}static enableDrag(){Ae.docStyle&&Ae.selectProp&&(Ae.docStyle[Ae.selectProp]=Ae.userSelect)}static setTransform(e,t){e.style[Ae.transformProp]=t}static addEventListener(e,t,n,i={}){"passive"in i?e.addEventListener(t,n,i):e.addEventListener(t,n,i.capture)}static removeEventListener(e,t,n,i={}){"passive"in i?e.removeEventListener(t,n,i):e.removeEventListener(t,n,i.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",Ae.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Ae.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Ae.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,t,n){let i=t.boundingClientRect;return new Fy.default((n.clientX-i.left)/t.x-e.clientLeft,(n.clientY-i.top)/t.y-e.clientTop)}static mousePos(e,t){let n=Ae.getScale(e);return Ae.getPoint(e,n,t)}static touchPos(e,t){let n=[],i=Ae.getScale(e);for(let o=0;o<t.length;o++)n.push(Ae.getPoint(e,i,t[o]));return n}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){let i=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),o=i.querySelectorAll("script");for(let a of o)a.remove();return Ae.clean(i),i.innerHTML}static isPossiblyDangerous(e,t){let n=t.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(e)&&(n.includes("javascript:")||n.includes("data:"))||e.startsWith("on"))return!0}static clean(e){let t=e.children;for(let n of t)Ae.removeAttributes(n),Ae.clean(n)}static removeAttributes(e){for(let{name:t,value:n}of e.attributes)Ae.isPossiblyDangerous(t,n)&&e.removeAttribute(t)}};Ae.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Ae.selectProp=Ae.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Ae.transformProp=Ae.testProp(["transform","WebkitTransform"]);var B=Ae;d();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:""};function gl(r){return ot.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}function O2(r,e){ot.REGISTERED_PROTOCOLS[r]=e}function V2(r){delete ot.REGISTERED_PROTOCOLS[r]}d();var _l="global-dispatcher",rn=class extends Error{constructor(e,t,n,i){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=i}},xl=()=>Br(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,U2=r=>/^file:/.test(r)||/^file:/.test(xl())&&!/^\w+:/.test(r);async function j2(r,e){let t=new Request(r.url,{method:r.method||"GET",body:r.body,credentials:r.credentials,headers:r.headers,cache:r.cache,referrer:xl(),signal:e.signal});r.type==="json"&&!t.headers.has("Accept")&&t.headers.set("Accept","application/json");let n;try{n=await fetch(t)}catch(a){throw new rn(0,a.message,r.url,new Blob)}if(!n.ok){let a=await n.blob();throw new rn(n.status,n.statusText,r.url,a)}let i;r.type==="arrayBuffer"||r.type==="image"?i=n.arrayBuffer():r.type==="json"?i=n.json():i=n.text();let o=await i;if(e.signal.aborted)throw Nn();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function N2(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open(r.method||"GET",r.url,!0),(r.type==="arrayBuffer"||r.type==="image")&&(i.responseType="arraybuffer");for(let o in r.headers)i.setRequestHeader(o,r.headers[o]);r.type==="json"&&(i.responseType="text",r.headers?.Accept||i.setRequestHeader("Accept","application/json")),i.withCredentials=r.credentials==="include",i.onerror=()=>{n(new Error(i.statusText))},i.onload=()=>{if(!e.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let o=i.response;if(r.type==="json")try{o=JSON.parse(i.response)}catch(a){n(a);return}t({data:o,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let o=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new rn(i.status,i.statusText,r.url,o))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Nn())}),i.send(r.body)})}var Mi=function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){let t=gl(r.url);if(t)return t(r,e);if(Br(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:_l},e)}if(!U2(r.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return j2(r,e);if(Br(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:_l},e)}return N2(r,e)},nn=(r,e)=>Mi(N(r,{type:"json"}),e),zy=(r,e)=>Mi(N(r,{type:"arrayBuffer"}),e);function zh(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;let e=new URL(r),t=window.location;return e.protocol===t.protocol&&e.host===t.host}var By=r=>{let e=window.document.createElement("video");return e.muted=!0,new Promise(t=>{e.onloadstart=()=>{t(e)};for(let n of r){let i=window.document.createElement("source");zh(n)||(e.crossOrigin="Anonymous"),i.src=n,e.appendChild(i)}})};d();d();var Fo={supported:!1,testSupport:G2},Ro,Bh=!1,Ci,Oy=!1;typeof document<"u"&&(Ci=document.createElement("img"),Ci.onload=()=>{Ro&&Vy(Ro),Ro=null,Oy=!0},Ci.onerror=()=>{Bh=!0,Ro=null},Ci.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function G2(r){Bh||!Ci||(Oy?Vy(r):Ro=r)}function Vy(r){let e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,Ci),r.isContextLost())return;Fo.supported=!0}catch{}r.deleteTexture(e),Bh=!0}var wt;(m=>{let r,e,t,n;m.resetRequestQueue=()=>{r=[],e=0,t=0,n={}},m.addThrottleControl=f=>{let y=t++;return n[y]=f,y},m.removeThrottleControl=f=>{delete n[f],p()};let s=()=>{for(let f of Object.keys(n))if(n[f]())return!0;return!1};m.getImage=(f,y,g=!0)=>new Promise((_,x)=>{Fo.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),N(f,{type:"image"});let b={abortController:y,requestParameters:f,supportImageRefresh:g,state:"queued",onError:v=>{x(v)},onSuccess:v=>{_(v)}};r.push(b),p()});let u=f=>typeof createImageBitmap=="function"?Sy(f):Ty(f),c=async f=>{f.state="running";let{requestParameters:y,supportImageRefresh:g,onError:_,onSuccess:x,abortController:b}=f,v=g===!1&&!Br(self)&&!gl(y.url)&&(!y.headers||Object.keys(y.headers).reduce((S,T)=>S&&T==="accept",!0));e++;let P=v?h(y,b):Mi(y,b);try{let S=await P;if(delete f.abortController,f.state="completed",S.data instanceof HTMLImageElement||Mt(S.data))x(S);else if(S.data){let T=await u(S.data);x({data:T,cacheControl:S.cacheControl,expires:S.expires})}}catch(S){delete f.abortController,_(S)}finally{e--,p()}},p=()=>{let f=s()?ot.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:ot.MAX_PARALLEL_IMAGE_REQUESTS;for(let y=e;y<f&&r.length>0;y++){let g=r.shift();if(g.abortController.signal.aborted){y--;continue}c(g)}},h=(f,y)=>new Promise((g,_)=>{let x=new Image,b=f.url,v=f.credentials;v&&v==="include"?x.crossOrigin="use-credentials":(v&&v==="same-origin"||!zh(b))&&(x.crossOrigin="anonymous"),y.signal.addEventListener("abort",()=>{x.src="",_(Nn())}),x.fetchPriority="high",x.onload=()=>{x.onerror=x.onload=null,g({data:x})},x.onerror=()=>{x.onerror=x.onload=null,!y.signal.aborted&&_(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."))},x.src=b})})(wt||(wt={}));wt.resetRequestQueue();d();var bl=class{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn?this._transformRequestFn(e,t)||{url:e}:{url:e}}setTransformRequest(e){this._transformRequestFn=e}};d();d();function Uy(r,e,t){t[r]&&t[r].indexOf(e)!==-1||(t[r]=t[r]||[],t[r].push(e))}function Oh(r,e,t){if(t&&t[r]){let n=t[r].indexOf(e);n!==-1&&t[r].splice(n,1)}}var z=class{constructor(e,t={}){N(this,t),this.type=e}},K=class extends z{constructor(e,t={}){super("error",N({error:e},t))}},xe=class{on(e,t){return this._listeners=this._listeners||{},Uy(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return Oh(e,t,this._listeners),Oh(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Uy(e,t,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,t){typeof e=="string"&&(e=new z(e,t||{}));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)Oh(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(N(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof K&&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}};d();d();d();d();var Z2=8,$2={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},H2={"*":{type:"source"}},q2=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],W2={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:"*"}},X2={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:"*"}},Y2={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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},K2={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"}},J2={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"}}},Q2={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"}}},eM={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},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"}},tM=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],rM={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},nM={"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"}},iM={"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"}},oM={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},aM={"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"}},sM={"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"}},lM={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},uM={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},cM={type:"array",value:"*"},pM={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},hM={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},mM={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},fM={type:"array",value:"*",minimum:1},dM={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}},yM={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},gM={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},_M={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},xM=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],bM={"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"}},vM={"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"}},wM={"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"}},PM={"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"}},SM={"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"}},TM={"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"}},MM={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},CM={"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"}},AM={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},IM={"*":{type:"string"}},I={$version:Z2,$root:$2,sources:H2,source:q2,source_vector:W2,source_raster:X2,source_raster_dem:Y2,source_geojson:K2,source_video:J2,source_image:Q2,layer:eM,layout:tM,layout_background:rM,layout_fill:nM,layout_circle:iM,layout_heatmap:oM,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:aM,layout_symbol:sM,layout_raster:lM,layout_hillshade:uM,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:cM,filter_operator:pM,geometry_type:hM,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:mM,expression:fM,light:dM,sky:yM,terrain:gM,projection:_M,paint:xM,paint_fill:bM,"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:vM,paint_circle:wM,paint_heatmap:PM,paint_symbol:SM,paint_raster:TM,paint_hillshade:MM,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:CM,transition:AM,"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:IM},EM=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function LM(r,e){let t={};for(let n in r)n!=="ref"&&(t[n]=r[n]);return EM.forEach(n=>{n in e&&(t[n]=e[n])}),t}function pm(r){r=r.slice();let e=Object.create(null);for(let t=0;t<r.length;t++)e[r[t].id]=r[t];for(let t=0;t<r.length;t++)"ref"in r[t]&&(r[t]=LM(r[t],e[r[t].ref]));return r}function ke(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!ke(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let n in r)if(!ke(r[n],e[n]))return!1;return!0}return r===e}function Kt(r,e){r.push(e)}function ug(r,e,t){Kt(t,{command:"addSource",args:[r,e[r]]})}function cg(r,e,t){Kt(e,{command:"removeSource",args:[r]}),t[r]=!0}function DM(r,e,t,n){cg(r,t,n),ug(r,e,t)}function kM(r,e,t){let n;for(n in r[t])if(Object.prototype.hasOwnProperty.call(r[t],n)&&n!=="data"&&!ke(r[t][n],e[t][n]))return!1;for(n in e[t])if(Object.prototype.hasOwnProperty.call(e[t],n)&&n!=="data"&&!ke(r[t][n],e[t][n]))return!1;return!0}function RM(r,e,t,n){r=r||{},e=e||{};let i;for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(Object.prototype.hasOwnProperty.call(e,i)||cg(i,t,n));for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(r,i)?ke(r[i],e[i])||(r[i].type==="geojson"&&e[i].type==="geojson"&&kM(r,e,i)?Kt(t,{command:"setGeoJSONSourceData",args:[i,e[i].data]}):DM(i,e,t,n)):ug(i,e,t))}function vl(r,e,t,n,i,o){r=r||{},e=e||{};for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&(ke(r[a],e[a])||t.push({command:o,args:[n,a,e[a],i]}));for(let a in e)!Object.prototype.hasOwnProperty.call(e,a)||Object.prototype.hasOwnProperty.call(r,a)||ke(r[a],e[a])||t.push({command:o,args:[n,a,e[a],i]})}function jy(r){return r.id}function Ny(r,e){return r[e.id]=e,r}function FM(r,e,t){r=r||[],e=e||[];let n=r.map(jy),i=e.map(jy),o=r.reduce(Ny,{}),a=e.reduce(Ny,{}),s=n.slice(),l=Object.create(null),u,c,p,h,m;for(let f=0,y=0;f<n.length;f++)u=n[f],Object.prototype.hasOwnProperty.call(a,u)?y++:(Kt(t,{command:"removeLayer",args:[u]}),s.splice(s.indexOf(u,y),1));for(let f=0,y=0;f<i.length;f++)u=i[i.length-1-f],s[s.length-1-f]!==u&&(Object.prototype.hasOwnProperty.call(o,u)?(Kt(t,{command:"removeLayer",args:[u]}),s.splice(s.lastIndexOf(u,s.length-y),1)):y++,h=s[s.length-f],Kt(t,{command:"addLayer",args:[a[u],h]}),s.splice(s.length-f,0,u),l[u]=!0);for(let f=0;f<i.length;f++)if(u=i[f],c=o[u],p=a[u],!(l[u]||ke(c,p))){if(!ke(c.source,p.source)||!ke(c["source-layer"],p["source-layer"])||!ke(c.type,p.type)){Kt(t,{command:"removeLayer",args:[u]}),h=s[s.lastIndexOf(u)+1],Kt(t,{command:"addLayer",args:[p,h]});continue}vl(c.layout,p.layout,t,u,null,"setLayoutProperty"),vl(c.paint,p.paint,t,u,null,"setPaintProperty"),ke(c.filter,p.filter)||Kt(t,{command:"setFilter",args:[u,p.filter]}),(!ke(c.minzoom,p.minzoom)||!ke(c.maxzoom,p.maxzoom))&&Kt(t,{command:"setLayerZoomRange",args:[u,p.minzoom,p.maxzoom]});for(m in c)Object.prototype.hasOwnProperty.call(c,m)&&(m==="layout"||m==="paint"||m==="filter"||m==="metadata"||m==="minzoom"||m==="maxzoom"||(m.indexOf("paint.")===0?vl(c[m],p[m],t,u,m.slice(6),"setPaintProperty"):ke(c[m],p[m])||Kt(t,{command:"setLayerProperty",args:[u,m,p[m]]})));for(m in p)!Object.prototype.hasOwnProperty.call(p,m)||Object.prototype.hasOwnProperty.call(c,m)||m==="layout"||m==="paint"||m==="filter"||m==="metadata"||m==="minzoom"||m==="maxzoom"||(m.indexOf("paint.")===0?vl(c[m],p[m],t,u,m.slice(6),"setPaintProperty"):ke(c[m],p[m])||Kt(t,{command:"setLayerProperty",args:[u,m,p[m]]}))}}function pg(r,e){if(!r)return[{command:"setStyle",args:[e]}];let t=[];try{if(!ke(r.version,e.version))return[{command:"setStyle",args:[e]}];ke(r.center,e.center)||t.push({command:"setCenter",args:[e.center]}),ke(r.state,e.state)||t.push({command:"setGlobalState",args:[e.state]}),ke(r.centerAltitude,e.centerAltitude)||t.push({command:"setCenterAltitude",args:[e.centerAltitude]}),ke(r.zoom,e.zoom)||t.push({command:"setZoom",args:[e.zoom]}),ke(r.bearing,e.bearing)||t.push({command:"setBearing",args:[e.bearing]}),ke(r.pitch,e.pitch)||t.push({command:"setPitch",args:[e.pitch]}),ke(r.roll,e.roll)||t.push({command:"setRoll",args:[e.roll]}),ke(r.sprite,e.sprite)||t.push({command:"setSprite",args:[e.sprite]}),ke(r.glyphs,e.glyphs)||t.push({command:"setGlyphs",args:[e.glyphs]}),ke(r.transition,e.transition)||t.push({command:"setTransition",args:[e.transition]}),ke(r.light,e.light)||t.push({command:"setLight",args:[e.light]}),ke(r.terrain,e.terrain)||t.push({command:"setTerrain",args:[e.terrain]}),ke(r.sky,e.sky)||t.push({command:"setSky",args:[e.sky]}),ke(r.projection,e.projection)||t.push({command:"setProjection",args:[e.projection]});let n={},i=[];RM(r.sources,e.sources,i,n);let o=[];r.layers&&r.layers.forEach(a=>{"source"in a&&n[a.source]?t.push({command:"removeLayer",args:[a.id]}):o.push(a)}),t=t.concat(i),FM(o,e.layers,t)}catch(n){console.warn("Unable to compute style diff:",n),t=[{command:"setStyle",args:[e]}]}return t}var j=class{constructor(e,t,n,i){this.message=(e?`${e}: `:"")+n,i&&(this.identifier=i),t!=null&&t.__line__&&(this.line=t.__line__)}};function Li(r,...e){for(let t of e)for(let n in t)r[n]=t[n];return r}var Jt=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},Wh=class r{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[n,i]of t)this.bindings[n]=i}concat(e){return new r(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}},Fi={kind:"null"},H={kind:"number"},ye={kind:"string"},me={kind:"boolean"},er={kind:"color"},Ul={kind:"projectionDefinition"},Hn={kind:"object"},ce={kind:"value"},zM={kind:"error"},jl={kind:"collator"},zi={kind:"formatted"},Nl={kind:"padding"},Vo={kind:"colorArray"},Gl={kind:"numberArray"},Qo={kind:"resolvedImage"},Zl={kind:"variableAnchorOffsetCollection"};function Ot(r,e){return{kind:"array",itemType:r,N:e}}function Ze(r){if(r.kind==="array"){let e=Ze(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}else return r.kind}var BM=[Fi,H,ye,me,er,Ul,zi,Hn,Ot(ce),Nl,Gl,Vo,Qo,Zl];function Uo(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Uo(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(let t of BM)if(!Uo(t,e))return null}}return`Expected ${Ze(r)} but found ${Ze(e)} instead.`}function hm(r,e){return e.some(t=>t.kind===r.kind)}function qn(r,e){return e.some(t=>t==="null"?r===null:t==="array"?Array.isArray(r):t==="object"?r&&!Array.isArray(r)&&typeof r=="object":t===typeof r)}function on(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}var hg=.96422,mg=1,fg=.82521,dg=4/29,Ei=6/29,yg=3*Ei*Ei,OM=Ei*Ei*Ei,VM=Math.PI/180,UM=180/Math.PI;function gg(r){return r=r%360,r<0&&(r+=360),r}function _g([r,e,t,n]){r=Vh(r),e=Vh(e),t=Vh(t);let i,o,a=Uh((.2225045*r+.7168786*e+.0606169*t)/mg);r===e&&e===t?i=o=a:(i=Uh((.4360747*r+.3850649*e+.1430804*t)/hg),o=Uh((.0139322*r+.0971045*e+.7141733*t)/fg));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function Vh(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Uh(r){return r>OM?Math.pow(r,1/3):r/yg+dg}function xg([r,e,t,n]){let i=(r+16)/116,o=isNaN(e)?i:i+e/500,a=isNaN(t)?i:i-t/200;return i=mg*Nh(i),o=hg*Nh(o),a=fg*Nh(a),[jh(3.1338561*o-1.6168667*i-.4906146*a),jh(-.9787684*o+1.9161415*i+.033454*a),jh(.0719453*o-.2289914*i+1.4052427*a),n]}function jh(r){return r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055,r<0?0:r>1?1:r}function Nh(r){return r>Ei?r*r*r:yg*(r-dg)}function jM(r){let[e,t,n,i]=_g(r),o=Math.sqrt(t*t+n*n);return[Math.round(o*1e4)?gg(Math.atan2(n,t)*UM):NaN,o,e,i]}function NM([r,e,t,n]){return r=isNaN(r)?0:r*VM,xg([t,Math.cos(r)*e,Math.sin(r)*e,n])}function GM([r,e,t,n]){r=gg(r),e/=100,t/=100;function i(o){let a=(o+r/30)%12,s=e*Math.min(t,1-t);return t-s*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4),n]}var ZM=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Bo(r,e){return ZM(r,e)?r[e]:void 0}function $M(r){if(r=r.toLowerCase().trim(),r==="transparent")return[0,0,0,0];let e=Bo(HM,r);if(e){let[i,o,a]=e;return[i/255,o/255,a/255,1]}if(r.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(r)){let o=r.length<6?1:2,a=1;return[wl(r.slice(a,a+=o)),wl(r.slice(a,a+=o)),wl(r.slice(a,a+=o)),wl(r.slice(a,a+o)||"ff")]}if(r.startsWith("rgb")){let i=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=r.match(i);if(o){let[a,s,l,u,c,p,h,m,f,y,g,_]=o,x=[u||" ",h||" ",y].join("");if(x===" "||x===" /"||x===",,"||x===",,,"){let b=[l,p,f].join(""),v=b==="%%%"?100:b===""?255:0;if(v){let P=[Ai(+s/v,0,1),Ai(+c/v,0,1),Ai(+m/v,0,1),g?Gy(+g,_):1];if(Zy(P))return P}}return}}let t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,n=r.match(t);if(n){let[i,o,a,s,l,u,c,p,h]=n,m=[a||" ",l||" ",c].join("");if(m===" "||m===" /"||m===",,"||m===",,,"){let f=[+o,Ai(+s,0,100),Ai(+u,0,100),p?Gy(+p,h):1];if(Zy(f))return GM(f)}}}function wl(r){return parseInt(r.padEnd(2,r),16)/255}function Gy(r,e){return Ai(e?r/100:r,0,1)}function Ai(r,e,t){return Math.min(Math.max(e,r),t)}function Zy(r){return!r.some(Number.isNaN)}var HM={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]};function sn(r,e,t){return r+t*(e-r)}function Di(r,e,t){return r.map((n,i)=>sn(n,e[i],t))}function qM(r){return r==="rgb"||r==="hcl"||r==="lab"}var X=class r{constructor(e,t,n,i=1,o=!0){this.r=e,this.g=t,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,t,n,i]))}static parse(e){if(e instanceof r)return e;if(typeof e!="string")return;let t=$M(e);if(t)return new r(...t,!1)}get rgb(){let{r:e,g:t,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[e/o,t/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",jM(this.rgb))}get lab(){return this.overwriteGetter("lab",_g(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,n,i]=this.rgb;return`rgba(${[e,t,n].map(o=>Math.round(o*255)).join(",")},${i})`}static interpolate(e,t,n,i="rgb"){switch(i){case"rgb":{let[o,a,s,l]=Di(e.rgb,t.rgb,n);return new r(o,a,s,l,!1)}case"hcl":{let[o,a,s,l]=e.hcl,[u,c,p,h]=t.hcl,m,f;if(!isNaN(o)&&!isNaN(u)){let b=u-o;u>o&&b>180?b-=360:u<o&&o-u>180&&(b+=360),m=o+n*b}else isNaN(o)?isNaN(u)?m=NaN:(m=u,(s===1||s===0)&&(f=c)):(m=o,(p===1||p===0)&&(f=a));let[y,g,_,x]=NM([m,f??sn(a,c,n),sn(s,p,n),sn(l,h,n)]);return new r(y,g,_,x,!1)}case"lab":{let[o,a,s,l]=xg(Di(e.lab,t.lab,n));return new r(o,a,s,l,!1)}}}};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 jo=class{constructor(e,t,n){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=n,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}},WM=["bottom","center","top"],No=class{constructor(e,t,n,i,o,a){this.text=e,this.image=t,this.scale=n,this.fontStack=i,this.textColor=o,this.verticalAlign=a}},Vt=class r{constructor(e){this.sections=e}static fromString(e){return new r([new No(e,null,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 r?e:r.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},tr=class r{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof r)return e;if(typeof e=="number")return new r([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if(typeof t!="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 r(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new r(Di(e.values,t.values,n))}},rr=class r{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof r)return e;if(typeof e=="number")return new r([e]);if(Array.isArray(e)){for(let t of e)if(typeof t!="number")return;return new r(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new r(Di(e.values,t.values,n))}},Ct=class r{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof r)return e;if(typeof e=="string"){let n=X.parse(e);return n?new r([n]):void 0}if(!Array.isArray(e))return;let t=[];for(let n of e){if(typeof n!="string")return;let i=X.parse(n);if(!i)return;t.push(i)}return new r(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,i="rgb"){let o=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)o.push(X.interpolate(e.values[a],t.values[a],n,i));return new r(o)}},Ve=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},XM=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),vr=class r{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof r)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){let n=e[t],i=e[t+1];if(typeof n!="string"||!XM.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new r(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){let i=e.values,o=t.values;if(i.length!==o.length)throw new Ve(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);let a=[];for(let s=0;s<i.length;s+=2){if(i[s]!==o[s])throw new Ve(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${i[s]}, to[${s}]: ${o[s]}`);a.push(i[s]);let[l,u]=i[s+1],[c,p]=o[s+1];a.push([sn(l,c,n),sn(u,p,n)])}return new r(a)}},At=class r{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new r({name:e,available:!1}):null}},wr=class r{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new r(e,t,n)}static parse(e){if(e instanceof r)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new r(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new r(e.from,e.to,e.transition);if(typeof e=="string")return new r(e,e,1)}};function bg(r,e,t,n){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[r,e,t,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[r,e,t,n]:[r,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Go(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof wr||r instanceof X||r instanceof jo||r instanceof Vt||r instanceof tr||r instanceof rr||r instanceof Ct||r instanceof vr||r instanceof At)return!0;if(Array.isArray(r)){for(let e of r)if(!Go(e))return!1;return!0}else if(typeof r=="object"){for(let e in r)if(!Go(r[e]))return!1;return!0}else return!1}function Ye(r){if(r===null)return Fi;if(typeof r=="string")return ye;if(typeof r=="boolean")return me;if(typeof r=="number")return H;if(r instanceof X)return er;if(r instanceof wr)return Ul;if(r instanceof jo)return jl;if(r instanceof Vt)return zi;if(r instanceof tr)return Nl;if(r instanceof rr)return Gl;if(r instanceof Ct)return Vo;if(r instanceof vr)return Zl;if(r instanceof At)return Qo;if(Array.isArray(r)){let e=r.length,t;for(let n of r){let i=Ye(n);if(!t)t=i;else{if(t===i)continue;t=ce;break}}return Ot(t||ce,e)}else return Hn}function Oo(r){let e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof X||r instanceof wr||r instanceof Vt||r instanceof tr||r instanceof rr||r instanceof Ct||r instanceof vr||r instanceof At?r.toString():JSON.stringify(r)}var ln=class r{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Go(e[1]))return t.error("invalid value");let n=e[1],i=Ye(n),o=t.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new r(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Pl={string:ye,number:H,boolean:me,object:Hn},sr=class r{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 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 Pl)||u==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);s=Pl[u],n++}else s=ce;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],n++}i=Ot(s,l)}else{if(!Pl[o])throw new Error(`Types doesn't contain name = ${o}`);i=Pl[o]}let a=[];for(;n<e.length;n++){let s=t.parse(e[n],n,ce);if(!s)return null;a.push(s)}return new r(i,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let n=this.args[t].evaluate(e);if(Uo(this.type,Ye(n))){if(t===this.args.length-1)throw new Ve(`Expected value to be of type ${Ze(this.type)}, but found ${Ze(Ye(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},$y={"to-boolean":me,"to-color":er,"to-number":H,"to-string":ye},an=class r{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 n=e[0];if(!$y[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 t.error("Expected one argument.");let i=$y[n],o=[];for(let a=1;a<e.length;a++){let s=t.parse(e[a],a,ce);if(!s)return null;o.push(s)}return new r(i,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,n;for(let i of this.args){if(t=i.evaluate(e),n=null,t instanceof X)return t;if(typeof t=="string"){let o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?n=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:n=bg(t[0],t[1],t[2],t[3]),!n))return new X(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Ve(n||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(let n of this.args){t=n.evaluate(e);let i=tr.parse(t);if(i)return i}throw new Ve(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(let n of this.args){t=n.evaluate(e);let i=rr.parse(t);if(i)return i}throw new Ve(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(let n of this.args){t=n.evaluate(e);let i=Ct.parse(t);if(i)return i}throw new Ve(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(let n of this.args){t=n.evaluate(e);let i=vr.parse(t);if(i)return i}throw new Ve(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(let n of this.args){if(t=n.evaluate(e),t===null)return 0;let i=Number(t);if(!isNaN(i))return i}throw new Ve(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Vt.fromString(Oo(this.args[0].evaluate(e)));case"resolvedImage":return At.fromString(Oo(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Oo(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},YM=["Unknown","Point","LineString","Polygon"],Cl=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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"?YM[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.get(e);return t||(t=X.parse(e),this._parseColorCache.set(e,t)),t}},Al=class r{constructor(e,t,n=[],i,o=new Wh,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=t}parse(e,t,n,i,o={}){return t?this.concat(t,n,i)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,o,a){return a==="assert"?new sr(o,[i]):a==="coerce"?new an(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,t.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))a=n(a,s,t.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof ln)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new Cl;try{a=new ln(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>"u"?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,t,n){let i=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new r(this.registry,this._isConstant,i,t||null,o,this.errors)}error(e,...t){let n=`${this.key}${t.map(i=>`[${i}]`).join("")}`;this.errors.push(new Jt(n,e))}checkSubtype(e,t){let n=Uo(e,t);return n&&this.error(n),n}},Il=class r{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 n=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return t.error(`Expected string, but found ${typeof a} instead.`,o);if(/[^a-zA-Z0-9_]/.test(a))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);let s=t.parse(e[o+1],o+1);if(!s)return null;n.push([a,s])}let i=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return i?new r(n,i):null}outputDefined(){return this.result.outputDefined()}},El=class r{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");let n=e[1];return t.scope.has(n)?new r(n,t.scope.get(n)):t.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}},Xh=class r{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,H),i=t.parse(e[2],2,Ot(t.expectedType||ce));if(!n||!i)return null;let o=i.type;return new r(o.itemType,n,i)}evaluate(e){let t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Ve(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new Ve(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new Ve(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Yh=class r{constructor(e,t){this.type=me,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,ce),i=t.parse(e[2],2,ce);return!n||!i?null:hm(n.type,[me,ye,H,Fi,ce])?new r(n,i):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ze(n.type)} instead`)}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!qn(t,["boolean","string","number","null"]))throw new Ve(`Expected first argument to be of type boolean, string, number or null, but found ${Ze(Ye(t))} instead.`);if(!qn(n,["string","array"]))throw new Ve(`Expected second argument to be of type array or string, but found ${Ze(Ye(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Kh=class r{constructor(e,t,n){this.type=H,this.needle=e,this.haystack=t,this.fromIndex=n}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 n=t.parse(e[1],1,ce),i=t.parse(e[2],2,ce);if(!n||!i)return null;if(!hm(n.type,[me,ye,H,Fi,ce]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ze(n.type)} instead`);if(e.length===4){let o=t.parse(e[3],3,H);return o?new r(n,i,o):null}else return new r(n,i)}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!qn(t,["boolean","string","number","null"]))throw new Ve(`Expected first argument to be of type boolean, string, number or null, but found ${Ze(Ye(t))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),qn(n,["string"])){let o=n.indexOf(t,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(qn(n,["array"]))return n.indexOf(t,i);throw new Ve(`Expected second argument to be of type array or string, but found ${Ze(Ye(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Jh=class r{constructor(e,t,n,i,o,a){this.inputType=e,this.type=t,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}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 n,i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.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 h=t.concat(u);if(c.length===0)return h.error("Expected at least one branch label.");for(let f of c){if(typeof f!="number"&&typeof f!="string")return h.error("Branch labels must be numbers or strings.");if(typeof f=="number"&&Math.abs(f)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof f=="number"&&Math.floor(f)!==f)return h.error("Numeric branch labels must be integer values.");if(!n)n=Ye(f);else if(h.checkSubtype(n,Ye(f)))return null;if(typeof o[String(f)]<"u")return h.error("Branch labels must be unique.");o[String(f)]=a.length}let m=t.parse(p,u,i);if(!m)return null;i=i||m.type,a.push(m)}let s=t.parse(e[1],1,ce);if(!s)return null;let l=t.parse(e[e.length-1],e.length-1,i);return!l||s.type.kind!=="value"&&t.concat(1).checkSubtype(n,s.type)?null:new r(n,i,s,o,a,l)}evaluate(e){let t=this.input.evaluate(e);return(Ye(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()}},Qh=class r{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}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 n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let s=t.parse(e[a],a,me);if(!s)return null;let l=t.parse(e[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=t.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 r(n,i,o)}evaluate(e){for(let[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},em=class r{constructor(e,t,n,i){this.type=e,this.input=t,this.beginIndex=n,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 n=t.parse(e[1],1,ce),i=t.parse(e[2],2,H);if(!n||!i)return null;if(!hm(n.type,[Ot(ce),ye,ce]))return t.error(`Expected first argument to be of type array or string, but found ${Ze(n.type)} instead`);if(e.length===4){let o=t.parse(e[3],3,H);return o?new r(n.type,n,i,o):null}else return new r(n.type,n,i)}evaluate(e){let t=this.input.evaluate(e),n=this.beginIndex.evaluate(e),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),qn(t,["string"]))return[...t].slice(n,i).join("");if(qn(t,["array"]))return t.slice(n,i);throw new Ve(`Expected first argument to be of type array or string, but found ${Ze(Ye(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function $l(r,e){let t=r.length-1,n=0,i=t,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=r[o],s=r[o+1],a<=e){if(o===t||e<s)return o;n=o+1}else if(a>e)i=o-1;else throw new Ve("Input is not a number.");return 0}var ki=class r{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}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 n=t.parse(e[1],1,H);if(!n)return null;let i=[],o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.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 t.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 t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let p=t.parse(l,c,o);if(!p)return null;o=o||p.type,i.push([s,p])}return new r(o,n,i)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=t[0])return n[0].evaluate(e);let o=t.length;if(i>=t[o-1])return n[o-1].evaluate(e);let a=$l(t,i);return n[a].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function KM(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Gh,Hy;function JM(){if(Hy)return Gh;Hy=1,Gh=r;function r(e,t,n,i){this.cx=3*e,this.bx=3*(n-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=n,this.p2y=i}return 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(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n=n-o/a}var s=0,l=1;for(n=e,i=0;i<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<t));i++)e>o?s=n:l=n,n=(l-s)*.5+s;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Gh}var QM=JM(),eC=KM(QM),Pt=class r{constructor(e,t,n,i,o){this.type=e,this.operator=t,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,t,n,i){let o=0;if(e.name==="exponential")o=Zh(t,e.base,n,i);else if(e.name==="linear")o=Zh(t,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new eC(a[0],a[1],a[2],a[3]).solve(Zh(t,1,n,i))}return o}static parse(e,t){let[n,i,o,...a]=e;if(!Array.isArray(i)||i.length===0)return t.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 t.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 t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return t.error(`Unknown interpolation type ${String(i[0])}`,1,0);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(o=t.parse(o,2,H),!o)return null;let s=[],l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&t.expectedType!=Vo?l=er:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],h=u+3,m=u+4;if(typeof c!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',h);if(s.length&&s[s.length-1][0]>=c)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',h);let f=t.parse(p,m,l);if(!f)return null;l=l||f.type,s.push([c,f])}return!on(l,H)&&!on(l,Ul)&&!on(l,er)&&!on(l,Nl)&&!on(l,Gl)&&!on(l,Vo)&&!on(l,Zl)&&!on(l,Ot(H))?t.error(`Type ${Ze(l)} is not interpolatable.`):new r(l,n,i,o,s)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=t[0])return n[0].evaluate(e);let o=t.length;if(i>=t[o-1])return n[o-1].evaluate(e);let a=$l(t,i),s=t[a],l=t[a+1],u=r.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(e),p=n[a+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return sn(c,p,u);case"color":return X.interpolate(c,p,u);case"padding":return tr.interpolate(c,p,u);case"colorArray":return Ct.interpolate(c,p,u);case"numberArray":return rr.interpolate(c,p,u);case"variableAnchorOffsetCollection":return vr.interpolate(c,p,u);case"array":return Di(c,p,u);case"projectionDefinition":return wr.interpolate(c,p,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return X.interpolate(c,p,u,"hcl");case"colorArray":return Ct.interpolate(c,p,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return X.interpolate(c,p,u,"lab");case"colorArray":return Ct.interpolate(c,p,u,"lab")}}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Zh(r,e,t,n){let i=n-t,o=r-t;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var Me={color:X.interpolate,number:sn,padding:tr.interpolate,numberArray:rr.interpolate,colorArray:Ct.interpolate,variableAnchorOffsetCollection:vr.interpolate,array:Di},Ll=class r{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 n=null,i=t.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of e.slice(1)){let l=t.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=>Uo(i,s.type))?new r(ce,o):new r(n,o)}evaluate(e){let t=null,n=0,i;for(let o of this.args)if(n++,t=o.evaluate(e),t&&t instanceof At&&!t.available&&(i||(i=t.name),t=null,n===this.args.length&&(t=i)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function qy(r,e){return r==="=="||r==="!="?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 tC(r,e,t){return e===t}function rC(r,e,t){return e!==t}function nC(r,e,t){return e<t}function iC(r,e,t){return e>t}function oC(r,e,t){return e<=t}function aC(r,e,t){return e>=t}function vg(r,e,t,n){return n.compare(e,t)===0}function sC(r,e,t,n){return!vg(r,e,t,n)}function lC(r,e,t,n){return n.compare(e,t)<0}function uC(r,e,t,n){return n.compare(e,t)>0}function cC(r,e,t,n){return n.compare(e,t)<=0}function pC(r,e,t,n){return n.compare(e,t)>=0}function Bi(r,e,t){let n=r!=="=="&&r!=="!=";return class wg{constructor(o,a,s){this.type=me,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,ce);if(!l)return null;if(!qy(s,l.type))return a.concat(1).error(`"${s}" comparisons are not supported for type '${Ze(l.type)}'.`);let u=a.parse(o[2],2,ce);if(!u)return null;if(!qy(s,u.type))return a.concat(2).error(`"${s}" comparisons are not supported for type '${Ze(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error(`Cannot compare types '${Ze(l.type)}' and '${Ze(u.type)}'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new sr(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new sr(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,jl),!c)return null}return new wg(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=Ye(a),u=Ye(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new Ve(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let l=Ye(a),u=Ye(s);if(l.kind!=="string"||u.kind!=="string")return e(o,a,s)}return this.collator?t(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 hC=Bi("==",tC,vg),mC=Bi("!=",rC,sC),fC=Bi("<",nC,lC),dC=Bi(">",iC,uC),yC=Bi("<=",oC,cC),gC=Bi(">=",aC,pC),Dl=class r{constructor(e,t,n){this.type=jl,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object.");let i=t.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,me);if(!i)return null;let o=t.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,me);if(!o)return null;let a=null;return n.locale&&(a=t.parse(n.locale,1,ye),!a)?null:new r(i,o,a)}evaluate(e){return new jo(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}},tm=class r{constructor(e,t,n,i,o){this.type=ye,this.number=e,this.locale=t,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");let n=t.parse(e[1],1,H);if(!n)return null;let i=e[2];if(typeof i!="object"||Array.isArray(i))return t.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=t.parse(i.locale,1,ye),!o))return null;let a=null;if(i.currency&&(a=t.parse(i.currency,1,ye),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=t.parse(i["min-fraction-digits"],1,H),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=t.parse(i["max-fraction-digits"],1,H),!l)?null:new r(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}},Zo=class r{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 n=e[1];if(!Array.isArray(n)&&typeof n=="object")return t.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=t.parse(s["font-scale"],1,H),!l))return null;let u=null;if(s["text-font"]&&(u=t.parse(s["text-font"],1,Ot(ye)),!u))return null;let c=null;if(s["text-color"]&&(c=t.parse(s["text-color"],1,er),!c))return null;let p=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!WM.includes(s["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(p=t.parse(s["vertical-align"],1,ye),!p)return null}let h=i[i.length-1];h.scale=l,h.font=u,h.textColor=c,h.verticalAlign=p}else{let l=t.parse(e[a],1,ce);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,i.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new r(i)}evaluate(e){let t=n=>{let i=n.content.evaluate(e);return Ye(i)===Qo?new No("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new No(Oo(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new Vt(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),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}},rm=class r{constructor(e){this.type=Qo,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");let n=t.parse(e[1],1,ye);return n?new r(n):t.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),n=At.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},nm=class r{constructor(e){this.type=H,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${Ze(n.type)} instead.`):new r(n):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new Ve(`Expected value to be of type string or array, but found ${Ze(Ye(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},br=8192;function _C(r,e){let t=xC(r[0]),n=vC(r[1]),i=Math.pow(2,e.z);return[Math.round(t*i*br),Math.round(n*i*br)]}function mm(r,e){let t=Math.pow(2,e.z),n=(r[0]/br+e.x)/t,i=(r[1]/br+e.y)/t;return[bC(n),wC(i)]}function xC(r){return(180+r)/360}function bC(r){return r*360-180}function vC(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function wC(r){return 360/Math.PI*Math.atan(Math.exp((180-r*360)*Math.PI/180))-90}function ea(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function $o(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function PC(r,e,t){return e[1]>r[1]!=t[1]>r[1]&&r[0]<(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1])+e[0]}function SC(r,e,t){let n=r[0]-e[0],i=r[1]-e[1],o=r[0]-t[0],a=r[1]-t[1];return n*a-o*i===0&&n*o<=0&&i*a<=0}function Hl(r,e,t,n){let i=[e[0]-r[0],e[1]-r[1]],o=[n[0]-t[0],n[1]-t[1]];return AC(o,i)===0?!1:!!(Wy(r,e,t,n)&&Wy(t,n,r,e))}function TC(r,e,t){for(let n of t)for(let i=0;i<n.length-1;++i)if(Hl(r,e,n[i],n[i+1]))return!0;return!1}function Oi(r,e,t=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(SC(r,i[o],i[o+1]))return t;PC(r,i[o],i[o+1])&&(n=!n)}return n}function MC(r,e){for(let t of e)if(Oi(r,t))return!0;return!1}function Pg(r,e){for(let t of r)if(!Oi(t,e))return!1;for(let t=0;t<r.length-1;++t)if(TC(r[t],r[t+1],e))return!1;return!0}function CC(r,e){for(let t of e)if(Pg(r,t))return!0;return!1}function AC(r,e){return r[0]*e[1]-r[1]*e[0]}function Wy(r,e,t,n){let i=r[0]-t[0],o=r[1]-t[1],a=e[0]-t[0],s=e[1]-t[1],l=n[0]-t[0],u=n[1]-t[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function fm(r,e,t){let n=[];for(let i=0;i<r.length;i++){let o=[];for(let a=0;a<r[i].length;a++){let s=_C(r[i][a],t);ea(e,s),o.push(s)}n.push(o)}return n}function Sg(r,e,t){let n=[];for(let i=0;i<r.length;i++){let o=fm(r[i],e,t);n.push(o)}return n}function Tg(r,e,t,n){if(r[0]<t[0]||r[0]>t[2]){let i=n*.5,o=r[0]-t[0]>i?-n:t[0]-r[0]>i?n:0;o===0&&(o=r[0]-t[2]>i?-n:t[2]-r[0]>i?n:0),r[0]+=o}ea(e,r)}function IC(r){r[0]=r[1]=1/0,r[2]=r[3]=-1/0}function Xy(r,e,t,n){let i=Math.pow(2,n.z)*br,o=[n.x*br,n.y*br],a=[];for(let s of r)for(let l of s){let u=[l.x+o[0],l.y+o[1]];Tg(u,e,t,i),a.push(u)}return a}function Yy(r,e,t,n){let i=Math.pow(2,n.z)*br,o=[n.x*br,n.y*br],a=[];for(let s of r){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];ea(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){IC(e);for(let s of a)for(let l of s)Tg(l,e,t,i)}return a}function EC(r,e){let t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=r.canonicalID();if(e.type==="Polygon"){let o=fm(e.coordinates,n,i),a=Xy(r.geometry(),t,n,i);if(!$o(t,n))return!1;for(let s of a)if(!Oi(s,o))return!1}if(e.type==="MultiPolygon"){let o=Sg(e.coordinates,n,i),a=Xy(r.geometry(),t,n,i);if(!$o(t,n))return!1;for(let s of a)if(!MC(s,o))return!1}return!0}function LC(r,e){let t=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=r.canonicalID();if(e.type==="Polygon"){let o=fm(e.coordinates,n,i),a=Yy(r.geometry(),t,n,i);if(!$o(t,n))return!1;for(let s of a)if(!Pg(s,o))return!1}if(e.type==="MultiPolygon"){let o=Sg(e.coordinates,n,i),a=Yy(r.geometry(),t,n,i);if(!$o(t,n))return!1;for(let s of a)if(!CC(s,o))return!1}return!0}var Ho=class r{constructor(e,t){this.type=me,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Go(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let o of n.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&i.push(s),a==="MultiPolygon"&&i.push(...s)}if(i.length){let o={type:"MultiPolygon",coordinates:i};return new r(n,o)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new r(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new r(n,n)}return t.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 EC(e,this.geometries);if(e.geometryType()==="LineString")return LC(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},kl=class{constructor(e=[],t=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,i=t[e];for(;e>0;){let o=e-1>>1,a=t[o];if(n(i,a)>=0)break;t[e]=a,e=o}t[e]=i}_down(e){let{data:t,compare:n}=this,i=this.length>>1,o=t[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(t[s],t[a])<0&&(a=s),n(t[a],o)>=0)break;t[e]=t[a],e=a}t[e]=o}};function Mg(r,e,t=0,n=r.length-1,i=DC){for(;n>t;){if(n-t>600){let l=n-t+1,u=e-t+1,c=Math.log(l),p=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*p*(l-p)/l)*(u-l/2<0?-1:1),m=Math.max(t,Math.floor(e-u*p/l+h)),f=Math.min(n,Math.floor(e+(l-u)*p/l+h));Mg(r,e,m,f,i)}let o=r[e],a=t,s=n;for(zo(r,t,e),i(r[n],o)>0&&zo(r,t,n);a<s;){for(zo(r,a,s),a++,s--;i(r[a],o)<0;)a++;for(;i(r[s],o)>0;)s--}i(r[t],o)===0?zo(r,t,s):(s++,zo(r,s,n)),s<=e&&(t=s+1),e<=s&&(n=s-1)}}function zo(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}function DC(r,e){return r<e?-1:r>e?1:0}function ta(r,e){if(r.length<=1)return[r];let n=[],i,o;for(let a of r){let s=RC(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[a]):i.push(a))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(Mg(n[a],e,1,n[a].length-1,kC),n[a]=n[a].slice(0,e));return n}function kC(r,e){return e.area-r.area}function RC(r){let e=0;for(let t=0,n=r.length,i=n-1,o,a;t<n;i=t++)o=r[t],a=r[i],e+=(a.x-o.x)*(o.y+a.y);return e}var FC=6378.137,Ky=1/298.257223563,Jy=Ky*(2-Ky),Qy=Math.PI/180,qo=class{constructor(e){let t=Qy*FC*1e3,n=Math.cos(e*Qy),i=1/(1-Jy*(1-n*n)),o=Math.sqrt(i);this.kx=t*o*n,this.ky=t*o*i*(1-Jy)}distance(e,t){let n=this.wrap(e[0]-t[0])*this.kx,i=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,t){let n=1/0,i,o,a,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,h=(e[l+1][1]-c)*this.ky,m=0;(p!==0||h!==0)&&(m=(this.wrap(t[0]-u)*this.kx*p+(t[1]-c)*this.ky*h)/(p*p+h*h),m>1?(u=e[l+1][0],c=e[l+1][1]):m>0&&(u+=p/this.kx*m,c+=h/this.ky*m)),p=this.wrap(t[0]-u)*this.kx,h=(t[1]-c)*this.ky;let f=p*p+h*h;f<n&&(n=f,i=u,o=c,a=l,s=m)}return{point:[i,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},im=100,om=50;function Cg(r,e){return e[0]-r[0]}function Rl(r){return r[1]-r[0]+1}function Or(r,e){return r[1]>=r[0]&&r[1]<e}function am(r,e){if(r[0]>r[1])return[null,null];let t=Rl(r);if(e){if(t===2)return[r,null];let i=Math.floor(t/2);return[[r[0],r[0]+i],[r[0]+i,r[1]]]}if(t===1)return[r,null];let n=Math.floor(t/2)-1;return[[r[0],r[0]+n],[r[0]+n+1,r[1]]]}function sm(r,e){if(!Or(e,r.length))return[1/0,1/0,-1/0,-1/0];let t=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)ea(t,r[n]);return t}function lm(r){let e=[1/0,1/0,-1/0,-1/0];for(let t of r)for(let n of t)ea(e,n);return e}function eg(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function dm(r,e,t){if(!eg(r)||!eg(e))return NaN;let n=0,i=0;return r[2]<e[0]&&(n=e[0]-r[2]),r[0]>e[2]&&(n=r[0]-e[2]),r[1]>e[3]&&(i=r[1]-e[3]),r[3]<e[1]&&(i=e[1]-r[3]),t.distance([0,0],[n,i])}function $n(r,e,t){let n=t.pointOnLine(e,r);return t.distance(r,n.point)}function ym(r,e,t,n,i){let o=Math.min($n(r,[t,n],i),$n(e,[t,n],i)),a=Math.min($n(t,[r,e],i),$n(n,[r,e],i));return Math.min(o,a)}function zC(r,e,t,n,i){if(!(Or(e,r.length)&&Or(n,t.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let l=r[s],u=r[s+1];for(let c=n[0];c<n[1];++c){let p=t[c],h=t[c+1];if(Hl(l,u,p,h))return 0;a=Math.min(a,ym(l,u,p,h,i))}}return a}function BC(r,e,t,n,i){if(!(Or(e,r.length)&&Or(n,t.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let l=n[0];l<=n[1];++l)if(a=Math.min(a,i.distance(r[s],t[l])),a===0)return a;return a}function OC(r,e,t){if(Oi(r,e,!0))return 0;let n=1/0;for(let i of e){let o=i[0],a=i[i.length-1];if(o!==a&&(n=Math.min(n,$n(r,[a,o],t)),n===0))return n;let s=t.pointOnLine(i,r);if(n=Math.min(n,t.distance(r,s.point)),n===0)return n}return n}function VC(r,e,t,n){if(!Or(e,r.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Oi(r[o],t,!0))return 0;let i=1/0;for(let o=e[0];o<e[1];++o){let a=r[o],s=r[o+1];for(let l of t)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let h=l[p],m=l[u];if(Hl(a,s,h,m))return 0;i=Math.min(i,ym(a,s,h,m,n))}}return i}function tg(r,e){for(let t of r)for(let n of t)if(Oi(n,e,!0))return!0;return!1}function UC(r,e,t,n=1/0){let i=lm(r),o=lm(e);if(n!==1/0&&dm(i,o,t)>=n)return n;if($o(i,o)){if(tg(r,e))return 0}else if(tg(e,r))return 0;let a=1/0;for(let s of r)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],h=s[l];for(let m of e)for(let f=0,y=m.length,g=y-1;f<y;g=f++){let _=m[g],x=m[f];if(Hl(p,h,_,x))return 0;a=Math.min(a,ym(p,h,_,x,t))}}return a}function rg(r,e,t,n,i,o){if(!o)return;let a=dm(sm(n,o),i,t);a<e&&r.push([a,o,[0,0]])}function Sl(r,e,t,n,i,o,a){if(!o||!a)return;let s=dm(sm(n,o),sm(i,a),t);s<e&&r.push([s,o,a])}function Fl(r,e,t,n,i=1/0){let o=Math.min(n.distance(r[0],t[0][0]),i);if(o===0)return o;let a=new kl([[0,[0,r.length-1],[0,0]]],Cg),s=lm(t);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?om:im;if(Rl(u)<=c){if(!Or(u,r.length))return NaN;if(e){let p=VC(r,u,t,n);if(isNaN(p)||p===0)return p;o=Math.min(o,p)}else for(let p=u[0];p<=u[1];++p){let h=OC(r[p],t,n);if(o=Math.min(o,h),o===0)return 0}}else{let p=am(u,e);rg(a,o,n,r,s,p[0]),rg(a,o,n,r,s,p[1])}}return o}function zl(r,e,t,n,i,o=1/0){let a=Math.min(o,i.distance(r[0],t[0]));if(a===0)return a;let s=new kl([[0,[0,r.length-1],[0,t.length-1]]],Cg);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?om:im,h=n?om:im;if(Rl(u)<=p&&Rl(c)<=h){if(!Or(u,r.length)&&Or(c,t.length))return NaN;let m;if(e&&n)m=zC(r,u,t,c,i),a=Math.min(a,m);else if(e&&!n){let f=r.slice(u[0],u[1]+1);for(let y=c[0];y<=c[1];++y)if(m=$n(t[y],f,i),a=Math.min(a,m),a===0)return a}else if(!e&&n){let f=t.slice(c[0],c[1]+1);for(let y=u[0];y<=u[1];++y)if(m=$n(r[y],f,i),a=Math.min(a,m),a===0)return a}else m=BC(r,u,t,c,i),a=Math.min(a,m)}else{let m=am(u,e),f=am(c,n);Sl(s,a,i,r,t,m[0],f[0]),Sl(s,a,i,r,t,m[0],f[1]),Sl(s,a,i,r,t,m[1],f[0]),Sl(s,a,i,r,t,m[1],f[1])}}return a}function jC(r,e){let t=r.geometry(),n=t.flat().map(a=>mm([a.x,a.y],r.canonical));if(t.length===0)return NaN;let i=new qo(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,zl(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,zl(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,Fl(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function NC(r,e){let t=r.geometry(),n=t.flat().map(a=>mm([a.x,a.y],r.canonical));if(t.length===0)return NaN;let i=new qo(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,zl(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,zl(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,Fl(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function GC(r,e){let t=r.geometry();if(t.length===0||t[0].length===0)return NaN;let n=ta(t,0).map(a=>a.map(s=>s.map(l=>mm([l.x,l.y],r.canonical)))),i=new qo(n[0][0][0][1]),o=1/0;for(let a of e)for(let s of n){switch(a.type){case"Point":o=Math.min(o,Fl([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,Fl(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,UC(s,a.coordinates,i,o));break}if(o===0)return o}return o}function $h(r){return r.type==="MultiPolygon"?r.coordinates.map(e=>({type:"Polygon",coordinates:e})):r.type==="MultiLineString"?r.coordinates.map(e=>({type:"LineString",coordinates:e})):r.type==="MultiPoint"?r.coordinates.map(e=>({type:"Point",coordinates:e})):[r]}var Wo=class r{constructor(e,t){this.type=H,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Go(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new r(n,n.features.map(i=>$h(i.geometry)).flat());if(n.type==="Feature")return new r(n,$h(n.geometry));if("type"in n&&"coordinates"in n)return new r(n,$h(n))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return jC(e,this.geometries);if(e.geometryType()==="LineString")return NC(e,this.geometries);if(e.geometryType()==="Polygon")return GC(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Xo=class r{constructor(e){this.type=ce,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=e[1];return n==null?t.error("Global state property must be defined."):typeof n!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new r(n)}evaluate(e){var t;let n=(t=e.globals)===null||t===void 0?void 0:t.globalState;return!n||Object.keys(n).length===0?null:Bo(n,this.key)}eachChild(){}outputDefined(){return!1}},Kn={"==":hC,"!=":mC,">":dC,"<":fC,">=":gC,"<=":yC,array:sr,at:Xh,boolean:sr,case:Qh,coalesce:Ll,collator:Dl,format:Zo,image:rm,in:Yh,"index-of":Kh,interpolate:Pt,"interpolate-hcl":Pt,"interpolate-lab":Pt,length:nm,let:Il,literal:ln,match:Jh,number:sr,"number-format":tm,object:sr,slice:em,step:ki,string:sr,"to-boolean":an,"to-color":an,"to-number":an,"to-string":an,var:El,within:Ho,distance:Wo,"global-state":Xo},Pr=class r{constructor(e,t,n,i){this.name=e,this.type=t,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,t){let n=e[0],i=r.definitions[n];if(!i)return t.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 Al(t.registry,Bl,t.path,null,t.scope);let p=[],h=!1;for(let m=1;m<e.length;m++){let f=e[m],y=Array.isArray(u)?u[m-1]:u.type,g=l.parse(f,1+p.length,y);if(!g){h=!0;break}p.push(g)}if(!h){if(Array.isArray(u)&&u.length!==p.length){l.error(`Expected ${u.length} arguments, but found ${p.length} instead.`);continue}for(let m=0;m<p.length;m++){let f=Array.isArray(u)?u[m]:u.type,y=p[m];l.concat(m+1).checkSubtype(f,y.type)}if(l.errors.length===0)return new r(n,o,c,p)}}if(s.length===1)t.errors.push(...l.errors);else{let c=(s.length?s:a).map(([h])=>$C(h)).join(" | "),p=[];for(let h=1;h<e.length;h++){let m=t.parse(e[h],1+p.length);if(!m)return null;p.push(Ze(m.type))}t.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,t){r.definitions=t;for(let n in t)e[n]=r}};function ng(r,[e,t,n,i]){e=e.evaluate(r),t=t.evaluate(r),n=n.evaluate(r);let o=i?i.evaluate(r):1,a=bg(e,t,n,o);if(a)throw new Ve(a);return new X(e/255,t/255,n/255,o,!1)}function ig(r,e){return r in e}function Hh(r,e){let t=e[r];return typeof t>"u"?null:t}function ZC(r,e,t,n){for(;t<=n;){let i=t+n>>1;if(e[i]===r)return!0;e[i]>r?n=i-1:t=i+1}return!1}function Zn(r){return{type:r}}Pr.register(Kn,{error:[zM,[ye],(r,[e])=>{throw new Ve(e.evaluate(r))}],typeof:[ye,[ce],(r,[e])=>Ze(Ye(e.evaluate(r)))],"to-rgba":[Ot(H,4),[er],(r,[e])=>{let[t,n,i,o]=e.evaluate(r).rgb;return[t*255,n*255,i*255,o]}],rgb:[er,[H,H,H],ng],rgba:[er,[H,H,H,H],ng],has:{type:me,overloads:[[[ye],(r,[e])=>ig(e.evaluate(r),r.properties())],[[ye,Hn],(r,[e,t])=>ig(e.evaluate(r),t.evaluate(r))]]},get:{type:ce,overloads:[[[ye],(r,[e])=>Hh(e.evaluate(r),r.properties())],[[ye,Hn],(r,[e,t])=>Hh(e.evaluate(r),t.evaluate(r))]]},"feature-state":[ce,[ye],(r,[e])=>Hh(e.evaluate(r),r.featureState||{})],properties:[Hn,[],r=>r.properties()],"geometry-type":[ye,[],r=>r.geometryType()],id:[ce,[],r=>r.id()],zoom:[H,[],r=>r.globals.zoom],"heatmap-density":[H,[],r=>r.globals.heatmapDensity||0],elevation:[H,[],r=>r.globals.elevation||0],"line-progress":[H,[],r=>r.globals.lineProgress||0],accumulated:[ce,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[H,Zn(H),(r,e)=>{let t=0;for(let n of e)t+=n.evaluate(r);return t}],"*":[H,Zn(H),(r,e)=>{let t=1;for(let n of e)t*=n.evaluate(r);return t}],"-":{type:H,overloads:[[[H,H],(r,[e,t])=>e.evaluate(r)-t.evaluate(r)],[[H],(r,[e])=>-e.evaluate(r)]]},"/":[H,[H,H],(r,[e,t])=>e.evaluate(r)/t.evaluate(r)],"%":[H,[H,H],(r,[e,t])=>e.evaluate(r)%t.evaluate(r)],ln2:[H,[],()=>Math.LN2],pi:[H,[],()=>Math.PI],e:[H,[],()=>Math.E],"^":[H,[H,H],(r,[e,t])=>Math.pow(e.evaluate(r),t.evaluate(r))],sqrt:[H,[H],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[H,[H],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[H,[H],(r,[e])=>Math.log(e.evaluate(r))],log2:[H,[H],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[H,[H],(r,[e])=>Math.sin(e.evaluate(r))],cos:[H,[H],(r,[e])=>Math.cos(e.evaluate(r))],tan:[H,[H],(r,[e])=>Math.tan(e.evaluate(r))],asin:[H,[H],(r,[e])=>Math.asin(e.evaluate(r))],acos:[H,[H],(r,[e])=>Math.acos(e.evaluate(r))],atan:[H,[H],(r,[e])=>Math.atan(e.evaluate(r))],min:[H,Zn(H),(r,e)=>Math.min(...e.map(t=>t.evaluate(r)))],max:[H,Zn(H),(r,e)=>Math.max(...e.map(t=>t.evaluate(r)))],abs:[H,[H],(r,[e])=>Math.abs(e.evaluate(r))],round:[H,[H],(r,[e])=>{let t=e.evaluate(r);return t<0?-Math.round(-t):Math.round(t)}],floor:[H,[H],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[H,[H],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[me,[ye,ce],(r,[e,t])=>r.properties()[e.value]===t.value],"filter-id-==":[me,[ce],(r,[e])=>r.id()===e.value],"filter-type-==":[me,[ye],(r,[e])=>r.geometryType()===e.value],"filter-<":[me,[ye,ce],(r,[e,t])=>{let n=r.properties()[e.value],i=t.value;return typeof n==typeof i&&n<i}],"filter-id-<":[me,[ce],(r,[e])=>{let t=r.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[me,[ye,ce],(r,[e,t])=>{let n=r.properties()[e.value],i=t.value;return typeof n==typeof i&&n>i}],"filter-id->":[me,[ce],(r,[e])=>{let t=r.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[me,[ye,ce],(r,[e,t])=>{let n=r.properties()[e.value],i=t.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[me,[ce],(r,[e])=>{let t=r.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[me,[ye,ce],(r,[e,t])=>{let n=r.properties()[e.value],i=t.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[me,[ce],(r,[e])=>{let t=r.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[me,[ce],(r,[e])=>e.value in r.properties()],"filter-has-id":[me,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[me,[Ot(ye)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[me,[Ot(ce)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[me,[ye,Ot(ce)],(r,[e,t])=>t.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[me,[ye,Ot(ce)],(r,[e,t])=>ZC(r.properties()[e.value],t.value,0,t.value.length-1)],all:{type:me,overloads:[[[me,me],(r,[e,t])=>e.evaluate(r)&&t.evaluate(r)],[Zn(me),(r,e)=>{for(let t of e)if(!t.evaluate(r))return!1;return!0}]]},any:{type:me,overloads:[[[me,me],(r,[e,t])=>e.evaluate(r)||t.evaluate(r)],[Zn(me),(r,e)=>{for(let t of e)if(t.evaluate(r))return!0;return!1}]]},"!":[me,[me],(r,[e])=>!e.evaluate(r)],"is-supported-script":[me,[ye],(r,[e])=>{let t=r.globals&&r.globals.isSupportedScript;return t?t(e.evaluate(r)):!0}],upcase:[ye,[ye],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[ye,[ye],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[ye,Zn(ce),(r,e)=>e.map(t=>Oo(t.evaluate(r))).join("")],"resolved-locale":[ye,[jl],(r,[e])=>e.evaluate(r).resolvedLocale()]});function $C(r){return Array.isArray(r)?`(${r.map(Ze).join(", ")})`:`(${Ze(r.type)}...)`}function Bl(r){if(r instanceof El)return Bl(r.boundExpression);if(r instanceof Pr&&r.name==="error")return!1;if(r instanceof Dl)return!1;if(r instanceof Ho)return!1;if(r instanceof Wo)return!1;if(r instanceof Xo)return!1;let e=r instanceof an||r instanceof sr,t=!0;return r.eachChild(n=>{e?t=t&&Bl(n):t=t&&n instanceof ln}),t?ql(r)&&Wl(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function ql(r){if(r instanceof Pr){if(r.name==="get"&&r.args.length===1)return!1;if(r.name==="feature-state")return!1;if(r.name==="has"&&r.args.length===1)return!1;if(r.name==="properties"||r.name==="geometry-type"||r.name==="id")return!1;if(/^filter-/.test(r.name))return!1}if(r instanceof Ho||r instanceof Wo)return!1;let e=!0;return r.eachChild(t=>{e&&!ql(t)&&(e=!1)}),e}function Yo(r){if(r instanceof Pr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(t=>{e&&!Yo(t)&&(e=!1)}),e}function Wl(r,e){if(r instanceof Pr&&e.indexOf(r.name)>=0)return!1;let t=!0;return r.eachChild(n=>{t&&!Wl(n,e)&&(t=!1)}),t}function um(r){return{result:"success",value:r}}function Ii(r){return{result:"error",value:r}}function un(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Ag(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function gm(r){return!!r.expression&&r.expression.interpolated}function ge(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function Xl(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Ye(r)===Hn}function HC(r){return r}function qC(r){switch(r.type){case"color":return X.parse;case"padding":return tr.parse;case"numberArray":return rr.parse;case"colorArray":return Ct.parse;default:return null}}function WC(r){switch(r){case"exponential":return Eg;case"interval":return YC;case"categorical":return XC;case"identity":return KC;default:throw new Error(`Unknown function type "${r}"`)}}function Ig(r,e){let t=r.stops&&typeof r.stops[0][0]=="object",n=t||r.property!==void 0,i=t||!n,o=r.type||(gm(e)?"exponential":"interval"),a=qC(e);if(a&&(r=Li({},r),r.stops&&(r.stops=r.stops.map(c=>[c[0],a(c[1])])),r.default?r.default=a(r.default):r.default=a(e.default)),r.colorSpace&&!qM(r.colorSpace))throw new Error(`Unknown color space: "${r.colorSpace}"`);let s=WC(o),l,u;if(o==="categorical"){l=Object.create(null);for(let c of r.stops)l[c[0]]=c[1];u=typeof r.stops[0][0]}if(t){let c={},p=[];for(let f=0;f<r.stops.length;f++){let y=r.stops[f],g=y[0].zoom;c[g]===void 0&&(c[g]={zoom:g,type:r.type,property:r.property,default:r.default,stops:[]},p.push(g)),c[g].stops.push([y[0].value,y[1]])}let h=[];for(let f of p)h.push([c[f].zoom,Ig(c[f],e)]);let m={name:"linear"};return{kind:"composite",interpolationType:m,interpolationFactor:Pt.interpolationFactor.bind(void 0,m),zoomStops:h.map(f=>f[0]),evaluate({zoom:f},y){return Eg({stops:h,base:r.base},e,f).evaluate(f,y)}}}else if(i){let c=o==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:Pt.interpolationFactor.bind(void 0,c),zoomStops:r.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(r,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let h=p&&p.properties?p.properties[r.property]:void 0;return h===void 0?ra(r.default,e.default):s(r,e,h,l,u)}}}function ra(r,e,t){if(r!==void 0)return r;if(e!==void 0)return e;if(t!==void 0)return t}function XC(r,e,t,n,i){let o=typeof t===i?n[t]:void 0;return ra(o,r.default,e.default)}function YC(r,e,t){if(ge(t)!=="number")return ra(r.default,e.default);let n=r.stops.length;if(n===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[n-1][0])return r.stops[n-1][1];let i=$l(r.stops.map(o=>o[0]),t);return r.stops[i][1]}function Eg(r,e,t){let n=r.base!==void 0?r.base:1;if(ge(t)!=="number")return ra(r.default,e.default);let i=r.stops.length;if(i===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[i-1][0])return r.stops[i-1][1];let o=$l(r.stops.map(c=>c[0]),t),a=JC(t,n,r.stops[o][0],r.stops[o+1][0]),s=r.stops[o][1],l=r.stops[o+1][1],u=Me[e.type]||HC;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),h=l.evaluate.apply(void 0,c);if(!(p===void 0||h===void 0))return u(p,h,a,r.colorSpace)}}:u(s,l,a,r.colorSpace)}function KC(r,e,t){switch(e.type){case"color":t=X.parse(t);break;case"formatted":t=Vt.fromString(t.toString());break;case"resolvedImage":t=At.fromString(t.toString());break;case"padding":t=tr.parse(t);break;case"colorArray":t=Ct.parse(t);break;case"numberArray":t=rr.parse(t);break;default:ge(t)!==e.type&&(e.type!=="enum"||!e.values[t])&&(t=void 0)}return ra(t,r.default,e.default)}function JC(r,e,t,n){let i=n-t,o=r-t;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var Wn=class{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Cl,this._defaultValue=t?eA(t):null,this._enumValues=t&&t.type==="enum"?t.values:null}evaluateWithoutErrorHandling(e,t,n,i,o,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,i,o,a){this._evaluator.globals=e,this._evaluator.feature=t||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 Ve(`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<"u"&&console.warn(s.message)),this._defaultValue}}};function na(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Kn}function _m(r,e){let t=new Al(Kn,Bl,[],e?QC(e):void 0),n=t.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?um(new Wn(n,e)):Ii(t.errors)}var Sr=class{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Yo(t.expression),this.globalStateRefs=Yl(t.expression)}evaluateWithoutErrorHandling(e,t,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,i,o,a)}evaluate(e,t,n,i,o,a){return this._styleExpression.evaluate(e,t,n,i,o,a)}},cn=class{constructor(e,t,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Yo(t.expression),this.globalStateRefs=Yl(t.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,t,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,i,o,a)}evaluate(e,t,n,i,o,a){return this._styleExpression.evaluate(e,t,n,i,o,a)}interpolationFactor(e,t,n){return this.interpolationType?Pt.interpolationFactor(this.interpolationType,e,t,n):0}};function Lg(r){return r._styleExpression!==void 0}function Dg(r,e){let t=_m(r,e);if(t.result==="error")return t;let n=t.value.expression,i=ql(n);if(!i&&!un(e))return Ii([new Jt("","data expressions not supported")]);let o=Wl(n,["zoom"]);if(!o&&!Ag(e))return Ii([new Jt("","zoom expressions not supported")]);let a=Ml(n);if(!a&&!o)return Ii([new Jt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof Jt)return Ii([a]);if(a instanceof Pt&&!gm(e))return Ii([new Jt("",'"interpolate" expressions cannot be used with this property')]);if(!a)return um(i?new Sr("constant",t.value):new Sr("source",t.value));let s=a instanceof Pt?a.interpolation:void 0;return um(i?new cn("camera",t.value,a.labels,s):new cn("composite",t.value,a.labels,s))}var Ko=class r{constructor(e,t){this._parameters=e,this._specification=t,Li(this,Ig(this._parameters,this._specification))}static deserialize(e){return new r(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function kg(r,e){if(Xl(r))return new Ko(r,e);if(na(r)){let t=Dg(r,e);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return t.value}else{let t=r;return e.type==="color"&&typeof r=="string"?t=X.parse(r):e.type==="padding"&&(typeof r=="number"||Array.isArray(r))?t=tr.parse(r):e.type==="numberArray"&&(typeof r=="number"||Array.isArray(r))?t=rr.parse(r):e.type==="colorArray"&&(typeof r=="string"||Array.isArray(r))?t=Ct.parse(r):e.type==="variableAnchorOffsetCollection"&&Array.isArray(r)?t=vr.parse(r):e.type==="projectionDefinition"&&typeof r=="string"&&(t=wr.parse(r)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>t}}}function Ml(r){let e=null;if(r instanceof Il)e=Ml(r.result);else if(r instanceof Ll){for(let t of r.args)if(e=Ml(t),e)break}else(r instanceof ki||r instanceof Pt)&&r.input instanceof Pr&&r.input.name==="zoom"&&(e=r);return e instanceof Jt||r.eachChild(t=>{let n=Ml(t);n instanceof Jt?e=n:!e&&n?e=new Jt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new Jt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Yl(r,e=new Set){return r instanceof Xo&&e.add(r.key),r.eachChild(t=>{Yl(t,e)}),e}function QC(r){let e={color:er,string:ye,number:H,enum:ye,boolean:me,formatted:zi,padding:Nl,numberArray:Gl,colorArray:Vo,projectionDefinition:Ul,resolvedImage:Qo,variableAnchorOffsetCollection:Zl};return r.type==="array"?Ot(e[r.value]||ce,r.length):e[r.type]}function eA(r){if(r.type==="color"&&Xl(r.default))return new X(0,0,0,0);switch(r.type){case"color":return X.parse(r.default)||null;case"padding":return tr.parse(r.default)||null;case"numberArray":return rr.parse(r.default)||null;case"colorArray":return Ct.parse(r.default)||null;case"variableAnchorOffsetCollection":return vr.parse(r.default)||null;case"projectionDefinition":return wr.parse(r.default)||null;default:return r.default===void 0?null:r.default}}function xm(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(let e of r.slice(1))if(!xm(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var tA={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function pn(r){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};xm(r)||(r=Ol(r));let e=_m(r,tA);if(e.result==="error")throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));{let t=Rg(r);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:t,getGlobalStateRefs:()=>Yl(e.value.expression)}}}function rA(r,e){return r<e?-1:r>e?1:0}function Rg(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(Rg(r[e]))return!0;return!1}function Ol(r){if(!r)return!0;let e=r[0];return r.length<=1?e!=="any":e==="=="?qh(r[1],r[2],"=="):e==="!="?Tl(qh(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?qh(r[1],r[2],e):e==="any"?nA(r.slice(1)):e==="all"?["all"].concat(r.slice(1).map(Ol)):e==="none"?["all"].concat(r.slice(1).map(Ol).map(Tl)):e==="in"?og(r[1],r.slice(2)):e==="!in"?Tl(og(r[1],r.slice(2))):e==="has"?ag(r[1]):e==="!has"?Tl(ag(r[1])):!0}function qh(r,e,t){switch(r){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,r,e]}}function nA(r){return["any"].concat(r.map(Ol))}function og(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",r,["literal",e.sort(rA)]]:["filter-in-small",r,["literal",e]]}}function ag(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Tl(r){return["!",r]}function Fg(){let r={},e=I.$version;for(let t in I.$root){let n=I.$root[t];if(n.required){let i=null;t==="version"?i=e:n.type==="array"?i=[]:i={},i!=null&&(r[t]=i)}}return r}function zg(r){let e=r.key,t=r.value;return t?[new j(e,t,"constants have been deprecated as of v8")]:[]}function Xe(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Xn(r){if(Array.isArray(r))return r.map(Xn);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){let e={};for(let t in r)e[t]=Xn(r[t]);return e}return Xe(r)}function Qt(r){let e=r.key,t=r.value,n=r.valueSpec||{},i=r.objectElementValidators||{},o=r.style,a=r.styleSpec,s=r.validateSpec,l=[],u=ge(t);if(u!=="object")return[new j(e,t,`object expected, ${u} found`)];for(let c in t){let p=c.split(".")[0],h=Bo(n,p)||n["*"],m;if(Bo(i,p))m=i[p];else if(Bo(n,p))m=s;else if(i["*"])m=i["*"];else if(n["*"])m=s;else{l.push(new j(e,t[c],`unknown property "${c}"`));continue}l=l.concat(m({key:(e&&`${e}.`)+c,value:t[c],valueSpec:h,style:o,styleSpec:a,object:t,objectKey:c,validateSpec:s},t))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&t[c]===void 0&&l.push(new j(e,t,`missing required property "${c}"`));return l}function bm(r){let e=r.value,t=r.valueSpec,n=r.validateSpec,i=r.style,o=r.styleSpec,a=r.key,s=r.arrayElementValidator||n;if(ge(e)!=="array")return[new j(a,e,`array expected, ${ge(e)} found`)];if(t.length&&e.length!==t.length)return[new j(a,e,`array length ${t.length} expected, length ${e.length} found`)];if(t["min-length"]&&e.length<t["min-length"])return[new j(a,e,`array length at least ${t["min-length"]} expected, length ${e.length} found`)];let l={type:t.value,values:t.values};o.$version<7&&(l.function=t.function),ge(t.value)==="object"&&(l=t.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:r.validateSpec,style:i,styleSpec:o,key:`${a}[${c}]`}));return u}function Kl(r){let e=r.key,t=r.value,n=r.valueSpec,i=ge(t);return i==="number"&&t!==t&&(i="NaN"),i!=="number"?[new j(e,t,`number expected, ${i} found`)]:"minimum"in n&&t<n.minimum?[new j(e,t,`${t} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&t>n.maximum?[new j(e,t,`${t} is greater than the maximum value ${n.maximum}`)]:[]}function Bg(r){let e=r.valueSpec,t=Xe(r.value.type),n,i={},o,a,s=t!=="categorical"&&r.value.property===void 0,l=!s,u=ge(r.value.stops)==="array"&&ge(r.value.stops[0])==="array"&&ge(r.value.stops[0][0])==="object",c=Qt({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:p,default:f}});return t==="identity"&&s&&c.push(new j(r.key,r.value,'missing required property "property"')),t!=="identity"&&!r.value.stops&&c.push(new j(r.key,r.value,'missing required property "stops"')),t==="exponential"&&r.valueSpec.expression&&!gm(r.valueSpec)&&c.push(new j(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(l&&!un(r.valueSpec)?c.push(new j(r.key,r.value,"property functions not supported")):s&&!Ag(r.valueSpec)&&c.push(new j(r.key,r.value,"zoom functions not supported"))),(t==="categorical"||u)&&r.value.property===void 0&&c.push(new j(r.key,r.value,'"property" property is required')),c;function p(y){if(t==="identity")return[new j(y.key,y.value,'identity function may not have a "stops" property')];let g=[],_=y.value;return g=g.concat(bm({key:y.key,value:_,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:h})),ge(_)==="array"&&_.length===0&&g.push(new j(y.key,_,"array must have at least one stop")),g}function h(y){let g=[],_=y.value,x=y.key;if(ge(_)!=="array")return[new j(x,_,`array expected, ${ge(_)} found`)];if(_.length!==2)return[new j(x,_,`array length 2 expected, length ${_.length} found`)];if(u){if(ge(_[0])!=="object")return[new j(x,_,`object expected, ${ge(_[0])} found`)];if(_[0].zoom===void 0)return[new j(x,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new j(x,_,"object stop key must have value")];if(a&&a>Xe(_[0].zoom))return[new j(x,_[0].zoom,"stop zoom values must appear in ascending order")];Xe(_[0].zoom)!==a&&(a=Xe(_[0].zoom),o=void 0,i={}),g=g.concat(Qt({key:`${x}[0]`,value:_[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Kl,value:m}}))}else g=g.concat(m({key:`${x}[0]`,value:_[0],validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},_));return na(Xn(_[1]))?g.concat([new j(`${x}[1]`,_[1],"expressions are not allowed in function stops.")]):g.concat(y.validateSpec({key:`${x}[1]`,value:_[1],valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function m(y,g){let _=ge(y.value),x=Xe(y.value),b=y.value!==null?y.value:g;if(!n)n=_;else if(_!==n)return[new j(y.key,b,`${_} stop domain type must match previous stop domain type ${n}`)];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new j(y.key,b,"stop domain value must be a number, string, or boolean")];if(_!=="number"&&t!=="categorical"){let v=`number expected, ${_} found`;return un(e)&&t===void 0&&(v+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new j(y.key,b,v)]}return t==="categorical"&&_==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new j(y.key,b,`integer expected, found ${x}`)]:t!=="categorical"&&_==="number"&&o!==void 0&&x<o?[new j(y.key,b,"stop domain values must appear in ascending order")]:(o=x,t==="categorical"&&x in i?[new j(y.key,b,"stop domain values must be unique")]:(i[x]=!0,[]))}function f(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function Ri(r){let e=(r.expressionContext==="property"?Dg:_m)(Xn(r.value),r.valueSpec);if(e.result==="error")return e.value.map(n=>new j(`${r.key}${n.key}`,r.value,n.message));let t=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!t.outputDefined())return[new j(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Yo(t))return[new j(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Yo(t))return[new j(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Wl(t,["zoom","feature-state"]))return[new j(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!ql(t))return[new j(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function iA(r){let e=r.value,t=r.key,n=ge(e);return n!=="boolean"?[new j(t,e,`boolean expected, ${n} found`)]:[]}function cm(r){let e=r.key,t=r.value,n=ge(t);return n!=="string"?[new j(e,t,`color expected, ${n} found`)]:X.parse(String(t))?[]:[new j(e,t,`color expected, "${t}" found`)]}function Jo(r){let e=r.key,t=r.value,n=r.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(Xe(t))===-1&&i.push(new j(e,t,`expected one of [${n.values.join(", ")}], ${JSON.stringify(t)} found`)):Object.keys(n.values).indexOf(Xe(t))===-1&&i.push(new j(e,t,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(t)} found`)),i}function vm(r){return xm(Xn(r.value))?Ri(Li({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Og(r)}function Og(r){let e=r.value,t=r.key;if(ge(e)!=="array")return[new j(t,e,`array expected, ${ge(e)} found`)];let n=r.styleSpec,i,o=[];if(e.length<1)return[new j(t,e,"filter array must have at least 1 element")];switch(o=o.concat(Jo({key:`${t}[0]`,value:e[0],valueSpec:n.filter_operator,style:r.style,styleSpec:r.styleSpec})),Xe(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Xe(e[1])==="$type"&&o.push(new j(t,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new j(t,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=ge(e[1]),i!=="string"&&o.push(new j(`${t}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=ge(e[a]),Xe(e[1])==="$type"?o=o.concat(Jo({key:`${t}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:r.style,styleSpec:r.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new j(`${t}[${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(Og({key:`${t}[${a}]`,value:e[a],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":i=ge(e[1]),e.length!==2?o.push(new j(t,e,`filter array for "${e[0]}" operator must have 2 elements`)):i!=="string"&&o.push(new j(`${t}[1]`,e[1],`string expected, ${i} found`));break}return o}function Vg(r,e){let t=r.key,n=r.validateSpec,i=r.style,o=r.styleSpec,a=r.value,s=r.objectKey,l=o[`${e}_${r.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:t,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=r.valueSpec||l[s];if(!c)return[new j(t,a,`unknown property "${s}"`)];let p;if(ge(a)==="string"&&un(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new j(t,a,`"${s}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(p[1])} }\`.`)];let h=[];return r.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&h.push(new j(t,a,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&Xl(Xn(a))&&Xe(a.type)==="identity"&&h.push(new j(t,a,'"text-font" does not support identity functions'))),h.concat(n({key:r.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function Ug(r){return Vg(r,"paint")}function jg(r){return Vg(r,"layout")}function Ng(r){let e=[],t=r.value,n=r.key,i=r.style,o=r.styleSpec;if(ge(t)!=="object")return[new j(n,t,`object expected, ${ge(t)} found`)];!t.type&&!t.ref&&e.push(new j(n,t,'either "type" or "ref" is required'));let a=Xe(t.type),s=Xe(t.ref);if(t.id){let l=Xe(t.id);for(let u=0;u<r.arrayIndex;u++){let c=i.layers[u];Xe(c.id)===l&&e.push(new j(n,t.id,`duplicate layer id "${t.id}", previously used at line ${c.id.__line__}`))}}if("ref"in t){["type","source","source-layer","filter","layout"].forEach(u=>{u in t&&e.push(new j(n,t[u],`"${u}" is prohibited for ref layers`))});let l;i.layers.forEach(u=>{Xe(u.id)===s&&(l=u)}),l?l.ref?e.push(new j(n,t.ref,"ref cannot reference another ref layer")):a=Xe(l.type):e.push(new j(n,t.ref,`ref layer "${s}" not found`))}else if(a!=="background")if(!t.source)e.push(new j(n,t,'missing required property "source"'));else{let l=i.sources&&i.sources[t.source],u=l&&Xe(l.type);l?u==="vector"&&a==="raster"?e.push(new j(n,t.source,`layer "${t.id}" requires a raster source`)):u!=="raster-dem"&&a==="hillshade"?e.push(new j(n,t.source,`layer "${t.id}" requires a raster-dem source`)):u!=="raster-dem"&&a==="color-relief"?e.push(new j(n,t.source,`layer "${t.id}" requires a raster-dem source`)):u==="raster"&&a!=="raster"?e.push(new j(n,t.source,`layer "${t.id}" requires a vector source`)):u==="vector"&&!t["source-layer"]?e.push(new j(n,t,`layer "${t.id}" must specify a "source-layer"`)):u==="raster-dem"&&a!=="hillshade"&&a!=="color-relief"?e.push(new j(n,t.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):a==="line"&&t.paint&&t.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new j(n,t,`layer "${t.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new j(n,t.source,`source "${t.source}" not found`))}return e=e.concat(Qt({key:n,value:t,valueSpec:o.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*"(){return[]},type(){return r.validateSpec({key:`${n}.type`,value:t.type,valueSpec:o.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:t,objectKey:"type"})},filter:vm,layout(l){return Qt({layer:t,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return jg(Li({layerType:a},u))}}})},paint(l){return Qt({layer:t,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Ug(Li({layerType:a},u))}}})}}})),e}function Yn(r){let e=r.value,t=r.key,n=ge(e);return n!=="string"?[new j(t,e,`string expected, ${n} found`)]:[]}function oA(r){var e;let t=(e=r.sourceName)!==null&&e!==void 0?e:"",n=r.value,i=r.styleSpec,o=i.source_raster_dem,a=r.style,s=[],l=ge(n);if(n===void 0)return s;if(l!=="object")return s.push(new j("source_raster_dem",n,`object expected, ${l} found`)),s;let c=Xe(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],h=r.value.encoding?`"${r.value.encoding}"`:"Default";for(let m in n)!c&&p.includes(m)?s.push(new j(m,n[m],`In "${t}": "${m}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[m]?s=s.concat(r.validateSpec({key:m,value:n[m],valueSpec:o[m],validateSpec:r.validateSpec,style:a,styleSpec:i})):s.push(new j(m,n[m],`unknown property "${m}"`));return s}var sg={promoteId:aA};function Gg(r){let e=r.value,t=r.key,n=r.styleSpec,i=r.style,o=r.validateSpec;if(!e.type)return[new j(t,e,'"type" is required')];let a=Xe(e.type),s;switch(a){case"vector":case"raster":return s=Qt({key:t,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:r.style,styleSpec:n,objectElementValidators:sg,validateSpec:o}),s;case"raster-dem":return s=oA({sourceName:t,value:e,style:r.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=Qt({key:t,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:sg}),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(...Ri({key:`${t}.${l}.map`,value:c,expressionContext:"cluster-map"})),s.push(...Ri({key:`${t}.${l}.reduce`,value:p,expressionContext:"cluster-reduce"}))}return s;case"video":return Qt({key:t,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Qt({key:t,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new j(t,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Jo({key:`${t}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function aA({key:r,value:e}){if(ge(e)==="string")return Yn({key:r,value:e});{let t=[];for(let n in e)t.push(...Yn({key:`${r}.${n}`,value:e[n]}));return t}}function Zg(r){let e=r.value,t=r.styleSpec,n=t.light,i=r.style,o=[],a=ge(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new j("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(r.validateSpec({key:s,value:e[s],valueSpec:t.transition,validateSpec:r.validateSpec,style:i,styleSpec:t})):n[s]?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:r.validateSpec,style:i,styleSpec:t})):o=o.concat([new j(s,e[s],`unknown property "${s}"`)])}return o}function $g(r){let e=r.value,t=r.styleSpec,n=t.sky,i=r.style,o=ge(e);if(e===void 0)return[];if(o!=="object")return[new j("sky",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(r.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:t})):a=a.concat([new j(s,e[s],`unknown property "${s}"`)]);return a}function Hg(r){let e=r.value,t=r.styleSpec,n=t.terrain,i=r.style,o=[],a=ge(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new j("terrain",e,`object expected, ${a} found`)]),o;for(let s in e)n[s]?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:r.validateSpec,style:i,styleSpec:t})):o=o.concat([new j(s,e[s],`unknown property "${s}"`)]);return o}function sA(r){return Yn(r).length===0?[]:Ri(r)}function lA(r){return Yn(r).length===0?[]:Ri(r)}function uA(r){let e=r.key,t=r.value;if(ge(t)==="array"){if(t.length<1||t.length>4)return[new j(e,t,`padding requires 1 to 4 values; ${t.length} values found`)];let i={type:"number"},o=[];for(let a=0;a<t.length;a++)o=o.concat(r.validateSpec({key:`${e}[${a}]`,value:t[a],validateSpec:r.validateSpec,valueSpec:i}));return o}else return Kl({key:e,value:t,valueSpec:{}})}function cA(r){let e=r.key,t=r.value;if(ge(t)==="array"){let i={type:"number"};if(t.length<1)return[new j(e,t,"array length at least 1 expected, length 0 found")];let o=[];for(let a=0;a<t.length;a++)o=o.concat(r.validateSpec({key:`${e}[${a}]`,value:t[a],validateSpec:r.validateSpec,valueSpec:i}));return o}else return Kl({key:e,value:t,valueSpec:{}})}function pA(r){let e=r.key,t=r.value;if(ge(t)==="array"){if(t.length<1)return[new j(e,t,"array length at least 1 expected, length 0 found")];let i=[];for(let o=0;o<t.length;o++)i=i.concat(cm({key:`${e}[${o}]`,value:t[o]}));return i}else return cm({key:e,value:t})}function hA(r){let e=r.key,t=r.value,n=ge(t),i=r.styleSpec;if(n!=="array"||t.length<1||t.length%2!==0)return[new j(e,t,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<t.length;a+=2)o=o.concat(Jo({key:`${e}[${a}]`,value:t[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(bm({key:`${e}[${a+1}]`,value:t[a+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:i}));return o}function qg(r){let e=[],t=r.value,n=r.key;if(Array.isArray(t)){let i=[],o=[];for(let a in t){t[a].id&&i.includes(t[a].id)&&e.push(new j(n,t,`all the sprites' ids must be unique, but ${t[a].id} is duplicated`)),i.push(t[a].id),t[a].url&&o.includes(t[a].url)&&e.push(new j(n,t,`all the sprites' URLs must be unique, but ${t[a].url} is duplicated`)),o.push(t[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Qt({key:`${n}[${a}]`,value:t[a],valueSpec:s,validateSpec:r.validateSpec}))}return e}else return Yn({key:n,value:t})}function mA(r){let e=r.value,t=r.styleSpec,n=t.projection,i=r.style,o=ge(e);if(e===void 0)return[];if(o!=="object")return[new j("projection",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(r.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:t})):a=a.concat([new j(s,e[s],`unknown property "${s}"`)]);return a}function fA(r){let e=r.key,t=r.value;t=t instanceof String?t.valueOf():t;let n=ge(t);return n==="array"&&!yA(t)&&!dA(t)?[new j(e,t,`projection expected, invalid array ${JSON.stringify(t)} found`)]:["array","string"].includes(n)?[]:[new j(e,t,`projection expected, invalid type "${n}" found`)]}function dA(r){return!!["interpolate","step","literal"].includes(r[0])}function yA(r){return Array.isArray(r)&&r.length===3&&typeof r[0]=="string"&&typeof r[1]=="string"&&typeof r[2]=="number"}function gA(r){return!!r&&r.constructor===Object}function Wg(r){return gA(r.value)?[]:[new j(r.key,r.value,`object expected, ${ge(r.value)} found`)]}var lg={"*"(){return[]},array:bm,boolean:iA,number:Kl,color:cm,constants:zg,enum:Jo,filter:vm,function:Bg,layer:Ng,object:Qt,source:Gg,light:Zg,sky:$g,terrain:Hg,projection:mA,projectionDefinition:fA,string:Yn,formatted:sA,resolvedImage:lA,padding:uA,numberArray:cA,colorArray:pA,variableAnchorOffsetCollection:hA,sprite:qg,state:Wg};function Vl(r){let e=r.value,t=r.valueSpec,n=r.styleSpec;return r.validateSpec=Vl,t.expression&&Xl(Xe(e))?Bg(r):t.expression&&na(Xn(e))?Ri(r):t.type&&lg[t.type]?lg[t.type](r):Qt(Li({},r,{valueSpec:t.type?n[t.type]:t}))}function Xg(r){let e=r.value,t=r.key,n=Yn(r);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new j(t,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&n.push(new j(t,e,'"glyphs" url must include a "{range}" token'))),n}function Ut(r,e=I){let t=[];return t=t.concat(Vl({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:Vl,objectElementValidators:{glyphs:Xg,"*"(){return[]}}})),r.constants&&(t=t.concat(zg({key:"constants",value:r.constants}))),Yg(t)}Ut.source=ur(lr(Gg));Ut.sprite=ur(lr(qg));Ut.glyphs=ur(lr(Xg));Ut.light=ur(lr(Zg));Ut.sky=ur(lr($g));Ut.terrain=ur(lr(Hg));Ut.state=ur(lr(Wg));Ut.layer=ur(lr(Ng));Ut.filter=ur(lr(vm));Ut.paintProperty=ur(lr(Ug));Ut.layoutProperty=ur(lr(jg));function lr(r){return function(e){return r({...e,validateSpec:Vl})}}function Yg(r){return[].concat(r).sort((e,t)=>e.line-t.line)}function ur(r){return function(...e){return Yg(r.apply(this,e))}}d();var Ue=Ut,Hk=Ue.source,Kg=Ue.light,Jg=Ue.sky,qk=Ue.terrain,Wk=Ue.filter,Qg=Ue.paintProperty,e_=Ue.layoutProperty;function hn(r,e){let t=!1;if(e&&e.length)for(let n of e)r.fire(new K(new Error(n.message))),t=!0;return t}d();d();d();var Jn=class r{constructor(e,t,n){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],t=a[1],n=a[2],this.d=t+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;let o=n/t*e;this.min=-o,this.max=e+o}insert(e,t,n,i,o){this._forEachCell(t,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),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,t,n,i,o,a){this.cells[o].push(a)}query(e,t,n,i,o){let a=this.min,s=this.max;if(e<=a&&t<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(e,t,n,i,this._queryCell,l,u,o),l}}_queryCell(e,t,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let h=0;h<u.length;h++){let m=u[h];if(s[m]===void 0){let f=m*4;(l?l(p[f+0],p[f+1],p[f+2],p[f+3]):e<=p[f+2]&&t<=p[f+3]&&n>=p[f+0]&&i>=p[f+1])?(s[m]=!0,a.push(c[m])):s[m]=!1}}}}_forEachCell(e,t,n,i,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(t),p=this._convertToCellCoord(n),h=this._convertToCellCoord(i);for(let m=u;m<=p;m++)for(let f=c;f<=h;f++){let y=this.d*f+m;if(!(l&&!l(this._convertFromCellCoord(m),this._convertFromCellCoord(f),this._convertFromCellCoord(m+1),this._convertFromCellCoord(f+1)))&&o.call(this,e,t,n,i,y,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,t=3+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(t+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=t;for(let a=0;a<e.length;a++){let s=e[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+e.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+e.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(e,t){let n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new r(e.buffer)}};var Vr={};function G(r,e,t={}){if(Vr[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),Vr[r]={klass:e,omit:t.omit||[],shallow:t.shallow||[]}}G("Object",Object);G("Set",Set);G("TransferableGridIndex",Jn);G("Color",X);G("Error",Error);G("AJAXError",rn);G("ResolvedImage",At);G("StylePropertyFunction",Ko);G("StyleExpression",Wn,{omit:["_evaluator"]});G("ZoomDependentExpression",cn);G("ZoomConstantExpression",Sr);G("CompoundExpression",Pr,{omit:["_evaluate"]});for(let r in Kn)Kn[r]._classRegistryKey||G(`Expression_${r}`,Kn[r]);function t_(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function wm(r){let e=r.constructor;return r.$name||e._classRegistryKey}function _A(r){if(r===null||typeof r!="object")return!1;let e=wm(r);return!!(e&&e!=="Object")}function r_(r){return!_A(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||t_(r)||Mt(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Vi(r,e){if(r_(r)){if((t_(r)||Mt(r))&&e&&e.push(r),ArrayBuffer.isView(r)){let o=r;e&&e.push(o.buffer)}return r instanceof ImageData&&e&&e.push(r.data.buffer),r}if(Array.isArray(r)){let o=[];for(let a of r)o.push(Vi(a,e));return o}if(typeof r!="object")throw new Error(`can't serialize object of type ${typeof r}`);let t=wm(r);if(!t)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!Vr[t])throw new Error(`${t} is not registered.`);let{klass:n}=Vr[t],i=n.serialize?n.serialize(r,e):{};if(n.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 r){if(!r.hasOwnProperty(o)||Vr[t].omit.indexOf(o)>=0)continue;let a=r[o];i[o]=Vr[t].shallow.indexOf(o)>=0?a:Vi(a,e)}r instanceof Error&&(i.message=r.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return t!=="Object"&&(i.$name=t),i}function Ui(r){if(r_(r))return r;if(Array.isArray(r))return r.map(Ui);if(typeof r!="object")throw new Error(`can't deserialize object of type ${typeof r}`);let e=wm(r)||"Object";if(!Vr[e])throw new Error(`can't deserialize unregistered class ${e}`);let{klass:t}=Vr[e];if(!t)throw new Error(`can't deserialize unregistered class ${e}`);if(t.deserialize)return t.deserialize(r);let n=Object.create(t.prototype);for(let i of Object.keys(r)){if(i==="$name")continue;let o=r[i];n[i]=Vr[e].shallow.indexOf(i)>=0?o:Ui(o)}return n}d();d();var Qn=class{constructor(){this.first=!0}update(e,t){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=t):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=t),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=n,!0):!1)}};d();d();var Je={"Latin-1 Supplement":r=>r>=128&&r<=255,"Hangul Jamo":r=>r>=4352&&r<=4607,Khmer:r=>r>=6016&&r<=6143,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Kanbun:r=>r>=12688&&r<=12703,"CJK Strokes":r=>r>=12736&&r<=12783,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Hangul Syllables":r=>r>=44032&&r<=55215,"Private Use Area":r=>r>=57344&&r<=63743,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function Pm(r){for(let e of r)if(n_(e.charCodeAt(0)))return!0;return!1}function Sm(r){let e=r.map(t=>{try{return new RegExp(`\\p{sc=${t}}`,"u").source}catch{return null}}).filter(t=>t);return new RegExp(e.join("|"),"u")}var xA=["Arab","Dupl","Mong","Ougr","Syrc"],cR=Sm(xA);var bA=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],vA=Sm(bA);function n_(r){return r===746||r===747?!0:r<4352?!1:!!(Je["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||Je["CJK Compatibility"](r)||Je["CJK Strokes"](r)||Je["CJK Symbols and Punctuation"](r)&&!(r>=12296&&r<=12305)&&!(r>=12308&&r<=12319)&&r!==12336||Je["Enclosed CJK Letters and Months"](r)||Je["Ideographic Description Characters"](r)||Je.Kanbun(r)||Je.Katakana(r)&&r!==12540||Je["Halfwidth and Fullwidth Forms"](r)&&r!==65288&&r!==65289&&r!==65293&&!(r>=65306&&r<=65310)&&r!==65339&&r!==65341&&r!==65343&&!(r>=65371&&r<=65503)&&r!==65507&&!(r>=65512&&r<=65519)||Je["Small Form Variants"](r)&&!(r>=65112&&r<=65118)&&!(r>=65123&&r<=65126)||Je["Vertical Forms"](r)||Je["Yijing Hexagram Symbols"](r)||/\p{sc=Cans}/u.test(String.fromCodePoint(r))||/\p{sc=Hang}/u.test(String.fromCodePoint(r))||vA.test(String.fromCodePoint(r)))}var wA=["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"],PA=Sm(wA);function i_(r){return PA.test(String.fromCodePoint(r))}function SA(r,e){return!(!e&&i_(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||Je.Khmer(r))}function o_(r){for(let e of r)if(i_(e.charCodeAt(0)))return!0;return!1}function a_(r,e){for(let t of r)if(!SA(t.charCodeAt(0),e))return!1;return!0}d();var Tm=class{constructor(){this.TIMEOUT=5e3;this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null;this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Tr.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let n=e.pluginURL,i=new Promise(s=>{this.loadScriptResolve=s});t(n);let o=new Promise(s=>setTimeout(()=>s(),this.TIMEOUT));if(await Promise.race([i,o]),this.isParsed()){let s={pluginStatus:"loaded",pluginURL:n};return this.setState(s),s}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)}},Tr=new Tm;var be=class{constructor(e,t){this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new Qn,this.transition=t.transition||{},this.globalState=t.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Qn,this.transition={},this.globalState={})}isSupportedScript(e){return a_(e,Tr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*t}}};var ji=class{constructor(e,t){this.property=e,this.value=t,this.expression=kg(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}},ia=class{constructor(e){this.property=e,this.value=new ji(e,void 0)}transitioned(e,t){return new Jl(this.property,this.value,t,N({},e.transition,this.transition),e.now)}untransitioned(){return new Jl(this.property,this.value,null,{},0)}},Mr=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return dt(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new ia(this._values[e].property)),this._values[e].value=new ji(this._values[e].property,t===null?void 0:dt(t))}getTransition(e){return dt(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new ia(this._values[e].property)),this._values[e].transition=dt(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n);let i=this.getTransition(t);i!==void 0&&(e[`${t}-transition`]=i)}return e}transitioned(e,t){let n=new Ql(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(e,t._values[i]);return n}untransitioned(){let e=new Ql(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},Jl=class{constructor(e,t,n,i,o){this.property=e,this.value=t,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,t,n){let i=e.now||0,o=this.value.possiblyEvaluate(e,t,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,t,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,n),o,pl(s))}}else return o}},Ql=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){let i=new mn(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,t,n);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},eu=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return dt(this._values[e].value)}setValue(e,t){this._values[e]=new ji(this._values[e].property,t===null?void 0:dt(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n)}return e}possiblyEvaluate(e,t,n){let i=new mn(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,t,n);return i}},yt=class{constructor(e,t,n){this.property=e,this.value=t,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,t,n,i){return this.property.evaluate(this.value,this.parameters,e,t,n,i)}},mn=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,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,n){let i=this.specification.type,o=Me[i];return o?o(e,t,n):e}},Q=class{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,i){return e.expression.kind==="constant"||e.expression.kind==="camera"?new yt(this,{kind:"constant",value:e.expression.evaluate(t,null,{},n,i)},t):new yt(this,e.expression,t)}interpolate(e,t,n){if(e.value.kind!=="constant"||t.value.kind!=="constant")return e;if(e.value.value===void 0||t.value.value===void 0)return new yt(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=Me[i];if(o){let a=o(e.value.value,t.value.value,n);return new yt(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,t,n,i,o,a){return e.kind==="constant"?e.value:e.evaluate(t,n,i,o,a)}},Ur=class extends Q{possiblyEvaluate(e,t,n,i){if(e.value===void 0)return new yt(this,{kind:"constant",value:void 0},t);if(e.expression.kind==="constant"){let o=e.expression.evaluate(t,null,{},n,i),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,t);return new yt(this,{kind:"constant",value:l},t)}else if(e.expression.kind==="camera"){let o=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 yt(this,{kind:"constant",value:o},t)}else return new yt(this,e.expression,t)}evaluate(e,t,n,i,o,a){if(e.kind==="source"){let s=e.evaluate(t,n,i,o,a);return this._calculate(s,s,s,t)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,i),e.evaluate({zoom:Math.floor(t.zoom)},n,i),e.evaluate({zoom:Math.floor(t.zoom)+1},n,i),t):e.value}_calculate(e,t,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}},ei=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,i){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(t,null,{},n,i);return this._calculate(o,o,o,t)}else return this._calculate(e.expression.evaluate(new be(Math.floor(t.zoom-1),t)),e.expression.evaluate(new be(Math.floor(t.zoom),t)),e.expression.evaluate(new be(Math.floor(t.zoom+1),t)),t)}_calculate(e,t,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}},jr=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,i){return!!e.expression.evaluate(t,null,{},n,i)}interpolate(){return!1}},Le=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let n=e[t];n.specification.overridable&&this.overridableProperties.push(t);let i=this.defaultPropertyValues[t]=new ji(n,void 0),o=this.defaultTransitionablePropertyValues[t]=new ia(n);this.defaultTransitioningPropertyValues[t]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=i.possiblyEvaluate({})}}};G("DataDrivenProperty",Q);G("DataConstantProperty",Z);G("CrossFadedDataDrivenProperty",Ur);G("CrossFadedProperty",ei);G("ColorRampProperty",jr);var tu="-transition",$e=class extends xe{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},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,this._featureFilter=pn(e.filter)),t.layout&&(this._unevaluatedLayout=new eu(t.layout)),t.paint)){this._transitionablePaint=new Mr(t.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 mn(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=pn(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let n=this._unevaluatedLayout._values[t];for(let i of n.getGlobalStateRefs())e.add(i)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}setLayoutProperty(e,t,n={}){if(t!=null){let i=`layers.${this.id}.layout.${e}`;if(this._validate(e_,i,e,t,n))return}if(e==="visibility"){this.visibility=t;return}this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(tu)?this._transitionablePaint.getTransition(e.slice(0,-tu.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(t!=null){let i=`layers.${this.id}.paint.${e}`;if(this._validate(Qg,i,e,t,n))return!1}if(e.endsWith(tu))return this._transitionablePaint.setTransition(e.slice(0,-tu.length),t||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,t),this._handleSpecialPaintPropertyUpdate(e);let l=this._transitionablePaint._values[e].value;return l.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,l)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,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,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),ml(e,(t,n)=>t!==void 0&&!(n==="layout"&&!Object.keys(t).length)&&!(n==="paint"&&!Object.keys(t).length))}_validate(e,t,n,i,o={}){return o&&o.validate===!1?!1:hn(this,e.call(Ue,{key:t,layerType:this.type,objectKey:n,value:i,styleSpec:I,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 yt)||!un(t.property.specification))&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}};d();d();d();var TA={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},fn=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}},MA=128,CA=5,ze=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*CA),MA),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 Ie(r,e=1){let t=0,n=0,i=r.map(a=>{let s=AA(a.type),l=t=s_(t,Math.max(e,s)),u=a.components||1;return n=Math.max(n,s),t+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=s_(t,Math.max(n,e));return{members:i,size:o,alignment:e}}function AA(r){return TA[r].BYTES_PER_ELEMENT}function s_(r,e){return Math.ceil(r/e)*e}var l_=ie(le(),1),ti=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let i=e*2;return this.int16[i+0]=t,this.int16[i+1]=n,e}};ti.prototype.bytesPerElement=4;G("StructArrayLayout2i4",ti);var Ni=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n)}emplace(e,t,n,i){let o=e*3;return this.int16[o+0]=t,this.int16[o+1]=n,this.int16[o+2]=i,e}};Ni.prototype.bytesPerElement=6;G("StructArrayLayout3i6",Ni);var oa=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,i)}emplace(e,t,n,i,o){let a=e*4;return this.int16[a+0]=t,this.int16[a+1]=n,this.int16[a+2]=i,this.int16[a+3]=o,e}};oa.prototype.bytesPerElement=8;G("StructArrayLayout4i8",oa);var aa=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,n,i,o,a)}emplace(e,t,n,i,o,a,s){let l=e*6;return this.int16[l+0]=t,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}};aa.prototype.bytesPerElement=12;G("StructArrayLayout2i4i12",aa);var sa=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,n,i,o,a)}emplace(e,t,n,i,o,a,s){let l=e*4,u=e*8;return this.int16[l+0]=t,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}};sa.prototype.bytesPerElement=8;G("StructArrayLayout2i4ub8",sa);var dn=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let i=e*2;return this.float32[i+0]=t,this.float32[i+1]=n,e}};dn.prototype.bytesPerElement=8;G("StructArrayLayout2f8",dn);var la=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,i,o,a,s,l,u,c)}emplace(e,t,n,i,o,a,s,l,u,c,p){let h=e*10;return this.uint16[h+0]=t,this.uint16[h+1]=n,this.uint16[h+2]=i,this.uint16[h+3]=o,this.uint16[h+4]=a,this.uint16[h+5]=s,this.uint16[h+6]=l,this.uint16[h+7]=u,this.uint16[h+8]=c,this.uint16[h+9]=p,e}};la.prototype.bytesPerElement=20;G("StructArrayLayout10ui20",la);var ua=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a,s,l,u,c,p,h){let m=this.length;return this.resize(m+1),this.emplace(m,e,t,n,i,o,a,s,l,u,c,p,h)}emplace(e,t,n,i,o,a,s,l,u,c,p,h,m){let f=e*12;return this.int16[f+0]=t,this.int16[f+1]=n,this.int16[f+2]=i,this.int16[f+3]=o,this.uint16[f+4]=a,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=u,this.int16[f+8]=c,this.int16[f+9]=p,this.int16[f+10]=h,this.int16[f+11]=m,e}};ua.prototype.bytesPerElement=24;G("StructArrayLayout4i4ui4i24",ua);var ca=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n)}emplace(e,t,n,i){let o=e*3;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=i,e}};ca.prototype.bytesPerElement=12;G("StructArrayLayout3f12",ca);var pa=class extends ze{_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 n=e*1;return this.uint32[n+0]=t,e}};pa.prototype.bytesPerElement=4;G("StructArrayLayout1ul4",pa);var ha=class extends ze{_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,n,i,o,a,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,i,o,a,s,l,u)}emplace(e,t,n,i,o,a,s,l,u,c){let p=e*10,h=e*5;return this.int16[p+0]=t,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[h+3]=l,this.uint16[p+8]=u,this.uint16[p+9]=c,e}};ha.prototype.bytesPerElement=20;G("StructArrayLayout6i1ul2ui20",ha);var ma=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,n,i,o,a)}emplace(e,t,n,i,o,a,s){let l=e*6;return this.int16[l+0]=t,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}};ma.prototype.bytesPerElement=12;G("StructArrayLayout2i2i2i12",ma);var fa=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,i,o)}emplace(e,t,n,i,o,a){let s=e*4,l=e*8;return this.float32[s+0]=t,this.float32[s+1]=n,this.float32[s+2]=i,this.int16[l+6]=o,this.int16[l+7]=a,e}};fa.prototype.bytesPerElement=16;G("StructArrayLayout2f1f2i16",fa);var da=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,n,i,o,a)}emplace(e,t,n,i,o,a,s){let l=e*16,u=e*4,c=e*8;return this.uint8[l+0]=t,this.uint8[l+1]=n,this.float32[u+1]=i,this.float32[u+2]=o,this.int16[c+6]=a,this.int16[c+7]=s,e}};da.prototype.bytesPerElement=16;G("StructArrayLayout2ub2f2i16",da);var Gi=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n)}emplace(e,t,n,i){let o=e*3;return this.uint16[o+0]=t,this.uint16[o+1]=n,this.uint16[o+2]=i,e}};Gi.prototype.bytesPerElement=6;G("StructArrayLayout3ui6",Gi);var ya=class extends ze{_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,n,i,o,a,s,l,u,c,p,h,m,f,y,g,_){let x=this.length;return this.resize(x+1),this.emplace(x,e,t,n,i,o,a,s,l,u,c,p,h,m,f,y,g,_)}emplace(e,t,n,i,o,a,s,l,u,c,p,h,m,f,y,g,_,x){let b=e*24,v=e*12,P=e*48;return this.int16[b+0]=t,this.int16[b+1]=n,this.uint16[b+2]=i,this.uint16[b+3]=o,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+12]=p,this.float32[v+7]=h,this.float32[v+8]=m,this.uint8[P+36]=f,this.uint8[P+37]=y,this.uint8[P+38]=g,this.uint32[v+10]=_,this.int16[b+22]=x,e}};ya.prototype.bytesPerElement=48;G("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ya);var ga=class extends ze{_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,n,i,o,a,s,l,u,c,p,h,m,f,y,g,_,x,b,v,P,S,T,C,A,E,k,R){let V=this.length;return this.resize(V+1),this.emplace(V,e,t,n,i,o,a,s,l,u,c,p,h,m,f,y,g,_,x,b,v,P,S,T,C,A,E,k,R)}emplace(e,t,n,i,o,a,s,l,u,c,p,h,m,f,y,g,_,x,b,v,P,S,T,C,A,E,k,R,V){let M=e*32,L=e*16;return this.int16[M+0]=t,this.int16[M+1]=n,this.int16[M+2]=i,this.int16[M+3]=o,this.int16[M+4]=a,this.int16[M+5]=s,this.int16[M+6]=l,this.int16[M+7]=u,this.uint16[M+8]=c,this.uint16[M+9]=p,this.uint16[M+10]=h,this.uint16[M+11]=m,this.uint16[M+12]=f,this.uint16[M+13]=y,this.uint16[M+14]=g,this.uint16[M+15]=_,this.uint16[M+16]=x,this.uint16[M+17]=b,this.uint16[M+18]=v,this.uint16[M+19]=P,this.uint16[M+20]=S,this.uint16[M+21]=T,this.uint16[M+22]=C,this.uint32[L+12]=A,this.float32[L+13]=E,this.float32[L+14]=k,this.uint16[M+30]=R,this.uint16[M+31]=V,e}};ga.prototype.bytesPerElement=64;G("StructArrayLayout8i15ui1ul2f2ui64",ga);var ri=class extends ze{_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 n=e*1;return this.float32[n+0]=t,e}};ri.prototype.bytesPerElement=4;G("StructArrayLayout1f4",ri);var _a=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n)}emplace(e,t,n,i){let o=e*6,a=e*3;return this.uint16[o+0]=t,this.float32[a+1]=n,this.float32[a+2]=i,e}};_a.prototype.bytesPerElement=12;G("StructArrayLayout1ui2f12",_a);var xa=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n)}emplace(e,t,n,i){let o=e*2,a=e*4;return this.uint32[o+0]=t,this.uint16[a+2]=n,this.uint16[a+3]=i,e}};xa.prototype.bytesPerElement=8;G("StructArrayLayout1ul2ui8",xa);var ba=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let i=e*2;return this.uint16[i+0]=t,this.uint16[i+1]=n,e}};ba.prototype.bytesPerElement=4;G("StructArrayLayout2ui4",ba);var va=class extends ze{_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 n=e*1;return this.uint16[n+0]=t,e}};va.prototype.bytesPerElement=2;G("StructArrayLayout1ui2",va);var Zi=class extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,i)}emplace(e,t,n,i,o){let a=e*4;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=i,this.float32[a+3]=o,e}};Zi.prototype.bytesPerElement=16;G("StructArrayLayout4f16",Zi);var ru=class extends fn{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 l_.default(this.anchorPointX,this.anchorPointY)}};ru.prototype.size=20;var wa=class extends ha{get(e){return new ru(this,e)}};G("CollisionBoxArray",wa);var nu=class extends fn{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]}};nu.prototype.size=48;var Pa=class extends ya{get(e){return new nu(this,e)}};G("PlacedSymbolArray",Pa);var iu=class extends fn{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 collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};iu.prototype.size=64;var Sa=class extends ga{get(e){return new iu(this,e)}};G("SymbolInstanceArray",Sa);var Ta=class extends ri{getoffsetX(e){return this.float32[e*1+0]}};G("GlyphOffsetArray",Ta);var Ma=class extends Ni{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};G("SymbolLineVertexArray",Ma);var ou=class extends fn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};ou.prototype.size=12;var Ca=class extends _a{get(e){return new ou(this,e)}};G("TextAnchorOffsetArray",Ca);var au=class extends fn{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]}};au.prototype.size=8;var Aa=class extends xa{get(e){return new au(this,e)}};G("FeatureIndexArray",Aa);var pt=class extends ti{},su=class extends Ni{},lu=class extends oa{},uu=class extends ti{},cu=class extends ti{},pu=class extends aa{};var hu=class extends sa{},mu=class extends dn{},Nr=class extends la{},fu=class extends ua{},du=class extends ca{},yu=class extends pa{},Ia=class extends ma{},gu=class extends fa{},_u=class extends da{},xu=class extends Gi{},je=class extends Gi{},yn=class extends ba{},Ea=class extends va{};d();var IA=Ie([{name:"a_pos",components:2,type:"Int16"}],4);var{members:u_,size:UR,alignment:jR}=IA;d();var pe=class r{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1;this.segments=e}prepareSegment(e,t,n,i){let o=this.segments[this.segments.length-1];return e>r.MAX_VERTEX_ARRAY_LENGTH&&ue(`Max vertices per segment is ${r.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${r.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!o||o.vertexLength+e>r.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i?this.createNewSegment(t,n,i):o}createNewSegment(e,t,n){let i={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return n!==void 0&&(i.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(e,t,n){return this.prepareSegment(0,e,t,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}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,n,i){return new r([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};pe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;G("SegmentVector",pe);d();d();function Mm(r,e){return r=ae(Math.floor(r),0,255),e=ae(Math.floor(e),0,255),256*r+e}d();var La=Ie([{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 f_=ie(Im(),1);var Da=class r{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,i){this.ids.push(m_(e)),this.positions.push(t,n,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let t=m_(e),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=t?i=a:n=a+1}let o=[];for(;this.ids[n]===t;){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,t){let n=new Float64Array(e.ids),i=new Uint32Array(e.positions);return Em(n,i,0,n.length-1),t&&t.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(e){let t=new r;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}};function m_(r){let e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,f_.default)(String(r))}function Em(r,e,t,n){for(;t<n;){let i=r[t+n>>1],o=t-1,a=n+1;for(;;){do o++;while(r[o]<i);do a--;while(r[a]>i);if(o>=a)break;vu(r,o,a),vu(e,3*o,3*a),vu(e,3*o+1,3*a+1),vu(e,3*o+2,3*a+2)}a-t<n-a?(Em(r,e,t,a),t=a+1):(Em(r,e,a+1,n),n=a)}}function vu(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}G("FeaturePositionMap",Da);d();var cr=class{constructor(e,t){this.gl=e.gl,this.location=t}},ee=class extends cr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},U=class extends cr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},J=class extends cr{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]))}},tt=class extends cr{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]))}},gt=class extends cr{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]))}},_t=class extends cr{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))}},ka=class extends cr{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e.length*4);for(let n=0;n<e.length;n++)t[4*n]=e[n].r,t[4*n+1]=e[n].g,t[4*n+2]=e[n].b,t[4*n+3]=e[n].a;this.gl.uniform4fv(this.location,t)}}},Ra=class extends cr{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},kA=new Float32Array(16),Qe=class extends cr{constructor(e,t){super(e,t),this.current=kA}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);return}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 Lm(r){return[Mm(255*r.r,255*r.g),Mm(255*r.b,255*r.a)]}var ni=class{constructor(e,t,n){this.value=e,this.uniformNames=t.map(i=>`u_${i}`),this.type=n}setUniform(e,t,n){e.set(n.constantOr(this.value))}getBinding(e,t,n){return this.type==="color"?new _t(e,t):new U(e,t)}},gn=class{constructor(e,t){this.uniformNames=t.map(n=>`u_${n}`),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,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,t,n){return n.substr(0,9)==="u_pattern"?new gt(e,t):new U(e,t)}},pr=class{constructor(e,t,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map(o=>({name:`a_${o}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,t,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new be(0),t,{},i,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,t,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(e,t,o)}_setPaintValue(e,t,n){if(this.type==="color"){let i=Lm(n);for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=e;i<t;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()}},jt=class{constructor(e,t,n,i,o,a){this.expression=e,this.uniformNames=t.map(s=>`u_${s}_t`),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=t.map(s=>({name:`a_${s}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,n,i,o){let a=this.expression.evaluate(new be(this.zoom),t,{},i,[],o),s=this.expression.evaluate(new be(this.zoom+1),t,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,t,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,t,o,a)}_setPaintValue(e,t,n,i){if(this.type==="color"){let o=Lm(n),a=Lm(i);for(let s=e;s<t;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<t;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,t){let n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,i=ae(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,t,n){return new U(e,t)}},Cr=class{constructor(e,t,n,i,o,a){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,t,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,t.patterns&&t.patterns[this.layerId],n)}updatePaintArray(e,t,n,i,o){this._setPaintValues(e,t,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(e,t,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<t;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,La.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,La.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},wu=class{constructor(e,t,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 yt)||!un(a.property.specification))continue;let s=RA(o,e.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],h=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=h?new gn(l.value,s):new ni(l.value,s,u),i.push(`/u_${o}`);else if(l.kind==="source"||h){let m=d_(o,u,"source");this.binders[o]=h?new Cr(l,u,c,t,m,e.id):new pr(l,s,u,m),i.push(`/a_${o}`)}else{let m=d_(o,u,"composite");this.binders[o]=new jt(l,s,u,c,t,m),i.push(`/z_${o}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof pr||t instanceof jt?t.maxValue:0}populatePaintArrays(e,t,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof pr||s instanceof jt||s instanceof Cr)&&s.populatePaintArray(e,t,n,i,o)}}setConstantPatternPositions(e,t){for(let n in this.binders){let i=this.binders[n];i instanceof gn&&i.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,n,i,o){let a=!1;for(let s in e){let l=t.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let h=this.binders[p];if((h instanceof pr||h instanceof jt||h instanceof Cr)&&h.expression.isStateDependent===!0){let m=i.paint.get(p);h.expression=m.value,h.updatePaintArray(u.start,u.end,c,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let t in this.binders){let n=this.binders[t];(n instanceof ni||n instanceof gn)&&e.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof pr||n instanceof jt)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof Cr)for(let i=0;i<La.members.length;i++)e.push(La.members[i].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof ni||n instanceof gn||n instanceof jt)for(let i of n.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof ni||o instanceof gn||o instanceof jt){for(let a of o.uniformNames)if(t[a]){let s=o.getBinding(e,t[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(e,t,n,i){for(let{name:o,property:a,binding:s}of t)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let n=this.binders[t];if(e&&n instanceof Cr){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof pr||n instanceof jt)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let t in this.binders){let n=this.binders[t];(n instanceof pr||n instanceof jt||n instanceof Cr)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof pr||t instanceof jt||t instanceof Cr)&&t.destroy()}}},It=class{constructor(e,t,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new wu(i,t,n);this.needsUpload=!1,this._featureMap=new Da,this._bufferOffset=0}populatePaintArrays(e,t,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,t,i,o,a);t.id!==void 0&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,t,o,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 RA(r,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"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function FA(r){return{"line-pattern":{source:Nr,composite:Nr},"fill-pattern":{source:Nr,composite:Nr},"fill-extrusion-pattern":{source:Nr,composite:Nr}}[r]}function d_(r,e,t){let n={color:{source:dn,composite:Zi},number:{source:ri,composite:dn}},i=FA(r);return i&&i[t]||n[e][t]}G("ConstantBinder",ni);G("CrossFadedConstantBinder",gn);G("SourceExpressionBinder",pr);G("CrossFadedCompositeBinder",Cr);G("CompositeExpressionBinder",jt);G("ProgramConfiguration",wu,{omit:["_buffers"]});G("ProgramConfigurationSet",It);d();d();var zA=15,Dm=Math.pow(2,zA-1)-1,y_=-Dm-1;function Et(r){let e=8192/r.extent,t=r.loadGeometry();for(let n=0;n<t.length;n++){let i=t[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=ae(s,y_,Dm),a.y=ae(l,y_,Dm),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ue("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return t}d();function Lt(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?Et(r):[]}}var g_=-32768;function BA(r,e,t,n,i){r.emplaceBack(g_+e*8+n,g_+t*8+i)}var ii=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new uu,this.indexArray=new je,this.segments=new pe,this.programConfigurations=new It(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,n){let i=this.layers[0],o=[],a=null,s=!1,l=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),l=l||c.paint.get("circle-pitch-alignment")==="map"}let u=l?t.subdivisionGranularity.circle:1;for(let{feature:c,id:p,index:h,sourceLayerIndex:m}of e){let f=this.layers[0]._featureFilter.needGeometry,y=Lt(c,f);if(!this.layers[0]._featureFilter.filter(new be(this.zoom,{globalState:this.globalState}),y,n))continue;let g=s?a.evaluate(y,{},n):void 0,_={id:p,properties:c.properties,type:c.type,sourceLayerIndex:m,index:h,geometry:f?y.geometry:Et(c),patterns:{},sortKey:g};o.push(_)}s&&o.sort((c,p)=>c.sortKey-p.sortKey);for(let c of o){let{geometry:p,index:h,sourceLayerIndex:m}=c,f=e[h].feature;this.addFeature(c,p,h,n,u),t.featureIndex.insert(f,p,h,m,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,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,u_),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,n,i,o=1){let a;switch(o){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${o}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let l of t)for(let u of l){let c=u.x,p=u.y;if(c<0||c>=8192||p<0||p>=8192)continue;let h=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),m=h.vertexLength;for(let f=0;f<s;f++)for(let y=0;y<s;y++)BA(this.layoutVertexArray,c,p,a[y],a[f]);for(let f=0;f<s-1;f++)for(let y=0;y<s-1;y++){let g=m+f*s+y,_=m+(f+1)*s+y;this.indexArray.emplaceBack(g,_+1,g+1),this.indexArray.emplaceBack(g,_,_+1)}h.vertexLength+=s*s,h.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};G("CircleBucket",ii,{omit:["layers"]});d();var Fa=ie(le(),1);function Pu(r,e){for(let t=0;t<r.length;t++)if($i(e,r[t]))return!0;for(let t=0;t<e.length;t++)if($i(r,e[t]))return!0;return!!Rm(r,e)}function x_(r,e,t){return!!($i(r,e)||km(e,r,t))}function Su(r,e){if(r.length===1)return __(e,r[0]);for(let t=0;t<e.length;t++){let n=e[t];for(let i=0;i<n.length;i++)if($i(r,n[i]))return!0}for(let t=0;t<r.length;t++)if(__(e,r[t]))return!0;for(let t=0;t<e.length;t++)if(Rm(r,e[t]))return!0;return!1}function b_(r,e,t){for(let n=0;n<e.length;n++){let i=e[n];if(r.length>=3){for(let o=0;o<i.length;o++)if($i(r,i[o]))return!0}if(OA(r,i,t))return!0}return!1}function OA(r,e,t){if(r.length>1){if(Rm(r,e))return!0;for(let n=0;n<e.length;n++)if(km(e[n],r,t))return!0}for(let n=0;n<r.length;n++)if(km(r[n],e,t))return!0;return!1}function Rm(r,e){if(r.length===0||e.length===0)return!1;for(let t=0;t<r.length-1;t++){let n=r[t],i=r[t+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(VA(n,i,a,s))return!0}}return!1}function VA(r,e,t,n){return zr(r,t,n)!==zr(e,t,n)&&zr(r,e,t)!==zr(r,e,n)}function km(r,e,t){let n=t*t;if(e.length===1)return r.distSqr(e[0])<n;for(let i=1;i<e.length;i++){let o=e[i-1],a=e[i];if(v_(r,o,a)<n)return!0}return!1}function v_(r,e,t){let n=e.distSqr(t);if(n===0)return r.distSqr(e);let i=((r.x-e.x)*(t.x-e.x)+(r.y-e.y)*(t.y-e.y))/n;return i<0?r.distSqr(e):i>1?r.distSqr(t):r.distSqr(t.sub(e)._mult(i)._add(e))}function __(r,e){let t=!1,n,i,o;for(let a=0;a<r.length;a++){n=r[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&&(t=!t)}return t}function $i(r,e){let t=!1;for(let n=0,i=r.length-1;n<r.length;i=n++){let o=r[n],a=r[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&&(t=!t)}return t}function w_(r,e,t,n,i){for(let a of r)if(e<=a.x&&t<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new Fa.default(e,t),new Fa.default(e,i),new Fa.default(n,i),new Fa.default(n,t)];if(r.length>2){for(let a of o)if($i(r,a))return!0}for(let a=0;a<r.length-1;a++){let s=r[a],l=r[a+1];if(UA(s,l,o))return!0}return!1}function UA(r,e,t){let n=t[0],i=t[2];if(r.x<n.x&&e.x<n.x||r.x>i.x&&e.x>i.x||r.y<n.y&&e.y<n.y||r.y>i.y&&e.y>i.y)return!1;let o=zr(r,e,t[0]);return o!==zr(r,e,t[1])||o!==zr(r,e,t[2])||o!==zr(r,e,t[3])}d();var Tu=ie(le(),1);function oi(r,e,t){let n=e.paint.get(r).value;return n.kind==="constant"?n.value:t.programConfigurations.get(e.id).getMaxValue(r)}function _n(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function xn(r,e,t,n,i){if(!e[0]&&!e[1])return r;let o=Tu.default.convert(e)._mult(i);t==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<r.length;s++){let l=r[s];a.push(l.sub(o))}return a}function P_(r,e){let t=[];for(let n=0;n<r.length;n++){let i=r[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 Tu.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new Tu.default(0,0):u.sub(l)._unit()._perp(),h=c._add(p)._unit(),m=h.x*p.x+h.y*p.y;m!==0&&h._mult(1/m),o.push(h._mult(e)._add(l))}t.push(o)}return t}d();var S_,NA=()=>S_=S_||new Le({"circle-sort-key":new Q(I.layout_circle["circle-sort-key"])}),T_,GA=()=>T_=T_||new Le({"circle-radius":new Q(I.paint_circle["circle-radius"]),"circle-color":new Q(I.paint_circle["circle-color"]),"circle-blur":new Q(I.paint_circle["circle-blur"]),"circle-opacity":new Q(I.paint_circle["circle-opacity"]),"circle-translate":new Z(I.paint_circle["circle-translate"]),"circle-translate-anchor":new Z(I.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Z(I.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Z(I.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Q(I.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Q(I.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Q(I.paint_circle["circle-stroke-opacity"])}),M_={get paint(){return GA()},get layout(){return NA()}};var C_=ie(le(),1),A_=r=>r.type==="circle",Mu=class extends $e{constructor(e){super(e,M_)}createBucket(e){return new ii(e)}queryRadius(e){let t=e;return oi("circle-radius",this,t)+oi("circle-stroke-width",this,t)+_n(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:l}){let u=xn(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-o.bearingInRadians,a),c=this.paint.get("circle-radius").evaluate(t,n),p=this.paint.get("circle-stroke-width").evaluate(t,n),h=c+p,m=this.paint.get("circle-pitch-alignment")==="map",f=m?u:ZA(u,o,s,l),y=m?h*a:h;for(let g of i)for(let _ of g){let x=m?_:I_(_,o,s,l),b=y,v=o.projectTileCoordinates(_.x,_.y,s,l).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=v/o.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=o.cameraToCenterDistance/v),x_(f,x,b))return!0}return!1}};function I_(r,e,t,n){let i=e.projectTileCoordinates(r.x,r.y,t,n).point;return new C_.default((i.x*.5+.5)*e.width,(-i.y*.5+.5)*e.height)}function ZA(r,e,t,n){return r.map(i=>I_(i,e,t,n))}d();d();var za=class extends ii{};G("HeatmapBucket",za,{omit:["layers"]});d();var E_,$A=()=>E_=E_||new Le({"heatmap-radius":new Q(I.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Q(I.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Z(I.paint_heatmap["heatmap-intensity"]),"heatmap-color":new jr(I.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Z(I.paint_heatmap["heatmap-opacity"])}),L_={get paint(){return $A()}};d();d();function Fm(r,{width:e,height:t},n,i){if(!i)i=new Uint8Array(e*t*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*t*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*t*n}`);return r.width=e,r.height=t,r.data=i,r}function D_(r,{width:e,height:t},n){if(e===r.width&&t===r.height)return;let i=Fm({},{width:e,height:t},n);zm(r,i,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,t)},n),r.width=e,r.height=t,r.data=i.data}function zm(r,e,t,n,i,o){if(i.width===0||i.height===0)return e;if(i.width>r.width||i.height>r.height||t.x>r.width-i.width||t.y>r.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=r.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=((t.y+l)*r.width+t.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 ai=class r{constructor(e,t){Fm(this,e,1,t)}resize(e){D_(this,e,1)}clone(){return new r({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,i,o){zm(e,t,n,i,o,1)}},Se=class r{constructor(e,t){Fm(this,e,4,t)}resize(e){D_(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 r({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,i,o){zm(e,t,n,i,o,4)}setPixel(e,t,n){let i=(e*this.width+t)*4;this.data[i+0]=Math.round(n.r*255/n.a),this.data[i+1]=Math.round(n.g*255/n.a),this.data[i+2]=Math.round(n.b*255/n.a),this.data[i+3]=Math.round(n.a*255)}};G("AlphaImage",ai);G("RGBAImage",Se);function Cu(r){let e={},t=r.resolution||256,n=r.clips?r.clips.length:1,i=r.image||new Se({width:t,height:n});if(!_y(t))throw new Error(`width is not a power of 2 - ${t}`);let o=(a,s,l)=>{e[r.evaluationKey]=l;let u=r.expression.evaluate(e);i.setPixel(a/4/t,s/4,u)};if(r.clips)for(let a=0,s=0;a<n;++a,s+=t*4)for(let l=0,u=0;l<t;l++,u+=4){let c=l/(t-1),{start:p,end:h}=r.clips[a],m=p*(1-c)+h*c;o(s,u,m)}else for(let a=0,s=0;a<t;a++,s+=4){let l=a/(t-1);o(0,s,l)}return i}var Hi="big-fb",k_=r=>r.type==="heatmap",Au=class extends $e{createBucket(e){return new za(e)}constructor(e){super(e,L_),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Cu({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Hi)&&this.heatmapFbos.delete(Hi)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};d();d();var R_,HA=()=>R_=R_||new Le({"hillshade-illumination-direction":new Z(I.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Z(I.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Z(I.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Z(I.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Z(I.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Z(I.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Z(I.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Z(I.paint_hillshade["hillshade-method"])}),F_={get paint(){return HA()}};var z_=r=>r.type==="hillshade",Iu=class extends $e{constructor(e){super(e,F_),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,n=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,o=Math.max(e.length,t.length,n.length,i.length);e=e.concat(Array(o-e.length).fill(e.at(-1))),t=t.concat(Array(o-t.length).fill(t.at(-1))),n=n.concat(Array(o-n.length).fill(n.at(-1))),i=i.concat(Array(o-i.length).fill(i.at(-1)));let a=t.map(Ee);return{directionRadians:e.map(Ee),altitudeRadians:a,shadowColor:i,highlightColor:n}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};d();d();var B_,qA=()=>B_=B_||new Le({"color-relief-opacity":new Z(I["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new jr(I["paint_color-relief"]["color-relief-color"])}),O_={get paint(){return qA()}};d();var ve=class{constructor(e,t,n,i){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(t,i)}update(e,t,n){let{width:i,height:o}=e,a=(!this.size||this.size[0]!==i||this.size[1]!==o)&&!n,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(t&&t.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!t||t.premultiply!==!1)),a)this.size=[i,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Mt(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,i,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{let{x:u,y:c}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Mt(e)?l.texSubImage2D(l.TEXTURE_2D,0,u,c,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,u,c,i,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,n){let{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_2D,this.texture),n===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(n=o.LINEAR),e!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,t),o.texParameteri(o.TEXTURE_2D,o.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}};d();var Bm=class{constructor(e,t,n,i=1,o=1,a=1,s=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n)){ue(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=t.height;let l=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(e,t){let n=new Uint8Array(this.data.buffer),i=this._idx(e,t)*4;return this.unpack(n[i],n[i+1],n[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_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)}unpack(e,t,n){return e*this.redFactor+t*this.greenFactor+n*this.blueFactor-this.baseShift}pack(e){return Om(e,this.getUnpackVector())}getPixels(){return new Se({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=t*this.dim,o=t*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(t){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=-t*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)]}};function Om(r,e){let t=e[0],n=e[1],i=e[2],o=e[3],a=Math.min(t,n,i),s=Math.round((r+o)/a);return{r:Math.floor(s*a/t)%256,g:Math.floor(s*a/n)%256,b:Math.floor(s*a/i)%256}}G("DEMData",Bm);var V_=r=>r.type==="color-relief",Eu=class extends $e{constructor(e){super(e,O_)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values["color-relief-color"].value.expression;if(n instanceof Sr&&n._styleExpression.expression instanceof Pt){this.colorRampExpression=n;let a=n._styleExpression.expression;t.elevationStops=a.labels,t.colorStops=[];for(let s of t.elevationStops)t.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[X.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let i={elevationStops:[],colorStops:[]},o=(t.elevationStops.length-1)/(e-1);for(let a=0;a<t.elevationStops.length-.5;a+=o)i.elevationStops.push(t.elevationStops[Math.round(a)]),i.colorStops.push(t.colorStops[Math.round(a)]);return ue(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(t),o=new Se({width:i.colorStops.length,height:1}),a=new Se({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let l=Om(i.elevationStops[s],n);a.setPixel(0,s,new X(l.r/255,l.g/255,l.b/255,1)),o.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new ve(e,a,e.gl.RGBA),colorTexture:new ve(e,o,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}};d();d();d();var WA=Ie([{name:"a_pos",components:2,type:"Int16"}],4);var{members:U_,size:TB,alignment:MB}=WA;d();function qi(r,e,t){let n=t.patternDependencies,i=!1;for(let o of e){let a=o.paint.get(`${r}-pattern`);a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Wi(r,e,t,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get(`${r}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},t,{},i.availableImages),c=l.evaluate({zoom:n},t,{},i.availableImages),p=l.evaluate({zoom:n+1},t,{},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,t.patterns[a.id]={min:u,mid:c,max:p}}}return t}d();var ja=ie(le(),1);d();function jm(r,e,t=2){let n=e&&e.length,i=n?e[0]*t:r.length,o=N_(r,0,i,t,!0),a=[];if(!o||o.next===o.prev)return a;let s,l,u;if(n&&(o=QA(r,e,o,t)),r.length>80*t){s=1/0,l=1/0;let c=-1/0,p=-1/0;for(let h=t;h<i;h+=t){let m=r[h],f=r[h+1];m<s&&(s=m),f<l&&(l=f),m>c&&(c=m),f>p&&(p=f)}u=Math.max(c-s,p-l),u=u!==0?32767/u:0}return Oa(o,a,t,s,l,u,0),a}function N_(r,e,t,n,i){let o;if(i===cI(r,e,t,n)>0)for(let a=e;a<t;a+=n)o=j_(a/n|0,r[a],r[a+1],o);else for(let a=t-n;a>=e;a-=n)o=j_(a/n|0,r[a],r[a+1],o);return o&&Xi(o,o.next)&&(Ua(o),o=o.next),o}function si(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Xi(t,t.next)||qe(t.prev,t,t.next)===0)){if(Ua(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Oa(r,e,t,n,i,o,a){if(!r)return;!a&&o&&iI(r,n,i,o);let s=r;for(;r.prev!==r.next;){let l=r.prev,u=r.next;if(o?YA(r,n,i,o):XA(r)){e.push(l.i,r.i,u.i),Ua(r),r=u.next,s=u.next;continue}if(r=u,r===s){a?a===1?(r=KA(si(r),e),Oa(r,e,t,n,i,o,2)):a===2&&JA(r,e,t,n,i,o):Oa(si(r),e,t,n,i,o,1);break}}}function XA(r){let e=r.prev,t=r,n=r.next;if(qe(e,t,n)>=0)return!1;let i=e.x,o=t.x,a=n.x,s=e.y,l=t.y,u=n.y,c=Math.min(i,o,a),p=Math.min(s,l,u),h=Math.max(i,o,a),m=Math.max(s,l,u),f=n.next;for(;f!==e;){if(f.x>=c&&f.x<=h&&f.y>=p&&f.y<=m&&Ba(i,s,o,l,a,u,f.x,f.y)&&qe(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function YA(r,e,t,n){let i=r.prev,o=r,a=r.next;if(qe(i,o,a)>=0)return!1;let s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,h=a.y,m=Math.min(s,l,u),f=Math.min(c,p,h),y=Math.max(s,l,u),g=Math.max(c,p,h),_=Vm(m,f,e,t,n),x=Vm(y,g,e,t,n),b=r.prevZ,v=r.nextZ;for(;b&&b.z>=_&&v&&v.z<=x;){if(b.x>=m&&b.x<=y&&b.y>=f&&b.y<=g&&b!==i&&b!==a&&Ba(s,c,l,p,u,h,b.x,b.y)&&qe(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=m&&v.x<=y&&v.y>=f&&v.y<=g&&v!==i&&v!==a&&Ba(s,c,l,p,u,h,v.x,v.y)&&qe(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=_;){if(b.x>=m&&b.x<=y&&b.y>=f&&b.y<=g&&b!==i&&b!==a&&Ba(s,c,l,p,u,h,b.x,b.y)&&qe(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=m&&v.x<=y&&v.y>=f&&v.y<=g&&v!==i&&v!==a&&Ba(s,c,l,p,u,h,v.x,v.y)&&qe(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function KA(r,e){let t=r;do{let n=t.prev,i=t.next.next;!Xi(n,i)&&Z_(n,t,t.next,i)&&Va(n,i)&&Va(i,n)&&(e.push(n.i,t.i,i.i),Ua(t),Ua(t.next),t=r=i),t=t.next}while(t!==r);return si(t)}function JA(r,e,t,n,i,o){let a=r;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&sI(a,s)){let l=$_(a,s);a=si(a,a.next),l=si(l,l.next),Oa(a,e,t,n,i,o,0),Oa(l,e,t,n,i,o,0);return}s=s.next}a=a.next}while(a!==r)}function QA(r,e,t,n){let i=[];for(let o=0,a=e.length;o<a;o++){let s=e[o]*n,l=o<a-1?e[o+1]*n:r.length,u=N_(r,s,l,n,!1);u===u.next&&(u.steiner=!0),i.push(aI(u))}i.sort(eI);for(let o=0;o<i.length;o++)t=tI(i[o],t);return t}function eI(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){let n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function tI(r,e){let t=rI(r,e);if(!t)return e;let n=$_(t,r);return si(n,n.next),si(t,t.next)}function rI(r,e){let t=e,n=r.x,i=r.y,o=-1/0,a;if(Xi(r,t))return t;do{if(Xi(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){let p=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=n&&p>o&&(o=p,a=t.x<t.next.x?t:t.next,p===n))return a}t=t.next}while(t!==e);if(!a)return null;let s=a,l=a.x,u=a.y,c=1/0;t=a;do{if(n>=t.x&&t.x>=l&&n!==t.x&&G_(i<u?n:o,i,l,u,i<u?o:n,i,t.x,t.y)){let p=Math.abs(i-t.y)/(n-t.x);Va(t,r)&&(p<c||p===c&&(t.x>a.x||t.x===a.x&&nI(a,t)))&&(a=t,c=p)}t=t.next}while(t!==s);return a}function nI(r,e){return qe(r.prev,r,e.prev)<0&&qe(e.next,r,r.next)<0}function iI(r,e,t,n){let i=r;do i.z===0&&(i.z=Vm(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,oI(i)}function oI(r){let e,t=1;do{let n=r,i;r=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let u=0;u<t&&(s++,a=a.nextZ,!!a);u++);let l=t;for(;s>0||l>0&&a;)s!==0&&(l===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,l--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;n=a}o.nextZ=null,t*=2}while(e>1);return r}function Vm(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function aI(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function G_(r,e,t,n,i,o,a,s){return(i-a)*(e-s)>=(r-a)*(o-s)&&(r-a)*(n-s)>=(t-a)*(e-s)&&(t-a)*(o-s)>=(i-a)*(n-s)}function Ba(r,e,t,n,i,o,a,s){return!(r===a&&e===s)&&G_(r,e,t,n,i,o,a,s)}function sI(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!lI(r,e)&&(Va(r,e)&&Va(e,r)&&uI(r,e)&&(qe(r.prev,r,e.prev)||qe(r,e.prev,e))||Xi(r,e)&&qe(r.prev,r,r.next)>0&&qe(e.prev,e,e.next)>0)}function qe(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Xi(r,e){return r.x===e.x&&r.y===e.y}function Z_(r,e,t,n){let i=Du(qe(r,e,t)),o=Du(qe(r,e,n)),a=Du(qe(t,n,r)),s=Du(qe(t,n,e));return!!(i!==o&&a!==s||i===0&&Lu(r,t,e)||o===0&&Lu(r,n,e)||a===0&&Lu(t,r,n)||s===0&&Lu(t,e,n))}function Lu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Du(r){return r>0?1:r<0?-1:0}function lI(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Z_(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Va(r,e){return qe(r.prev,r,r.next)<0?qe(r,e,r.next)>=0&&qe(r,r.prev,e)>=0:qe(r,e,r.prev)<0||qe(r,r.next,e)<0}function uI(r,e){let t=r,n=!1,i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function $_(r,e){let t=Um(r.i,r.x,r.y),n=Um(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function j_(r,e,t,n){let i=Um(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ua(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Um(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function cI(r,e,t,n){let i=0;for(let o=e,a=t-n;o<t;o+=n)i+=(r[a]-r[o])*(r[o+1]+r[a+1]),a=o;return i}d();var Nt=class{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){let t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}},ku=class ku{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};ku.noSubdivision=new ku({fill:new Nt(0,0),line:new Nt(0,0),tile:new Nt(0,0),stencil:new Nt(0,0),circle:1});var bn=ku;G("SubdivisionGranularityExpression",Nt);G("SubdivisionGranularitySetting",bn);var Ar=-32768,Gr=32767,Nm=class{constructor(e,t){this._vertexBuffer=[];this._vertexDictionary=new Map;this._used=!1;this._granularity=e,this._granularityCellSize=8192/e,this._canonical=t}_getKey(e,t){return e=e+32768,t=t+32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let n=Math.round(e)|0,i=Math.round(t)|0,o=this._getKey(n,i);if(this._vertexDictionary.has(o))return this._vertexDictionary.get(o);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(o,a),this._vertexBuffer.push(n,i),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return hI(this._vertexBuffer,e);let t=[],n=e.length;for(let i=0;i<n;i+=3){let o=[e[i+0],e[i+1],e[i+2]],a=[this._vertexBuffer[e[i+0]*2+0],this._vertexBuffer[e[i+0]*2+1],this._vertexBuffer[e[i+1]*2+0],this._vertexBuffer[e[i+1]*2+1],this._vertexBuffer[e[i+2]*2+0],this._vertexBuffer[e[i+2]*2+1]],s=1/0,l=1/0,u=-1/0,c=-1/0;for(let y=0;y<3;y++){let g=a[y*2],_=a[y*2+1];s=Math.min(s,g),u=Math.max(u,g),l=Math.min(l,_),c=Math.max(c,_)}if(s===u||l===c)continue;let p=Math.floor(s/this._granularityCellSize),h=Math.ceil(u/this._granularityCellSize),m=Math.floor(l/this._granularityCellSize),f=Math.ceil(c/this._granularityCellSize);if(p===h&&m===f){t.push(...o);continue}for(let y=m;y<f;y++){let g=this._scanlineGenerateVertexRingForCellRow(y,a,o);mI(this._vertexBuffer,g,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,n){let i=e*this._granularityCellSize,o=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let l=t[s*2],u=t[s*2+1],c=t[(s+1)*2%6],p=t[((s+1)*2+1)%6],h=t[(s+2)*2%6],m=t[((s+2)*2+1)%6],f=c-l,y=p-u,g=f===0,_=y===0,x=(i-u)/y,b=(o-u)/y,v=Math.min(x,b),P=Math.max(x,b);if(!_&&(v>=1||P<=0)||_&&(u<i||u>o)){p>=i&&p<=o&&a.push(n[(s+1)%3]);continue}if(!_&&v>0){let C=l+f*v,A=u+y*v;a.push(this._vertexToIndex(C,A))}let S=l+f*Math.max(v,0),T=l+f*Math.min(P,1);if(g||this._generateIntraEdgeVertices(a,l,u,c,p,S,T),!_&&P<1){let C=l+f*P,A=u+y*P;a.push(this._vertexToIndex(C,A))}(_||p>=i&&p<=o)&&a.push(n[(s+1)%3]),!_&&(p<=i||p>=o)&&this._generateInterEdgeVertices(a,l,u,c,p,h,m,T,i,o)}return a}_generateIntraEdgeVertices(e,t,n,i,o,a,s){let l=i-t,u=o-n,c=u===0,p=c?Math.min(t,i):Math.min(a,s),h=c?Math.max(t,i):Math.max(a,s),m=Math.floor(p/this._granularityCellSize)+1,f=Math.ceil(h/this._granularityCellSize)-1;if(c?t<i:a<s)for(let g=m;g<=f;g++){let _=g*this._granularityCellSize,x=n+u*(_-t)/l;e.push(this._vertexToIndex(_,x))}else for(let g=f;g>=m;g--){let _=g*this._granularityCellSize,x=n+u*(_-t)/l;e.push(this._vertexToIndex(_,x))}}_generateInterEdgeVertices(e,t,n,i,o,a,s,l,u,c){let p=o-n,h=a-i,m=s-o,f=(u-o)/m,y=(c-o)/m,g=Math.min(f,y),_=Math.max(f,y),x=i+h*g,b=Math.floor(Math.min(x,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(x,l)/this._granularityCellSize)-1,P=l<x,S=m===0;if(S&&(s===u||s===c))return;if(S||g>=1||_<=0){let C=t-a,A=n-s,E=(u-s)/A,k=(c-s)/A,R=Math.min(E,k),V=a+C*R;b=Math.floor(Math.min(V,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(V,l)/this._granularityCellSize)-1,P=l<V}let T=p>0?c:u;if(P)for(let C=b;C<=v;C++){let A=C*this._granularityCellSize;e.push(this._vertexToIndex(A,T))}else for(let C=v;C>=b;C--){let A=C*this._granularityCellSize;e.push(this._vertexToIndex(A,T))}}_generateOutline(e){let t=[];for(let n of e){let i=Yi(n,this._granularity,!0),o=this._pointArrayToIndices(i),a=[];for(let s=1;s<o.length;s++)a.push(o[s-1]),a.push(o[s]);t.push(a)}return t}_handlePoles(e){let t=!1,n=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(t||n)&&this._fillPoles(e,t,n)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let n=e[t+1];n===Ar&&(e[t+1]=Ar+1),n===Gr&&(e[t+1]=Gr-1)}}_generatePoleQuad(e,t,n,i,o,a){i>o!=(a===Ar)?(e.push(t),e.push(n),e.push(this._vertexToIndex(i,a)),e.push(n),e.push(this._vertexToIndex(o,a)),e.push(this._vertexToIndex(i,a))):(e.push(n),e.push(t),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(o,a)),e.push(n),e.push(this._vertexToIndex(i,a)))}_fillPoles(e,t,n){let i=this._vertexBuffer,o=0,a=8192,s=e.length;for(let l=2;l<s;l+=3){let u=e[l-2],c=e[l-1],p=e[l],h=i[u*2],m=i[u*2+1],f=i[c*2],y=i[c*2+1],g=i[p*2],_=i[p*2+1];t&&(m===o&&y===o&&this._generatePoleQuad(e,u,c,h,f,Ar),y===o&&_===o&&this._generatePoleQuad(e,c,p,f,g,Ar),_===o&&m===o&&this._generatePoleQuad(e,p,u,g,h,Ar)),n&&(m===a&&y===a&&this._generatePoleQuad(e,u,c,h,f,Gr),y===a&&_===a&&this._generatePoleQuad(e,c,p,f,g,Gr),_===a&&m===a&&this._generatePoleQuad(e,p,u,g,h,Gr))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:n,holeIndices:i}=pI(e);this._initializeVertices(n);let o;try{let s=jm(n,i),l=this._convertIndices(n,s);o=this._subdivideTrianglesScanline(l)}catch(s){console.error(s)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(o),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:a}}_convertIndices(e,t){let n=[];for(let i=0;i<t.length;i++){let o=e[t[i]*2],a=e[t[i]*2+1];n.push(this._vertexToIndex(o,a))}return n}_pointArrayToIndices(e){let t=[];for(let n=0;n<e.length;n++){let i=e[n];t.push(this._vertexToIndex(i.x,i.y))}return t}};function Ru(r,e,t,n=!0){return new Nm(t,e).subdividePolygonInternal(r,n)}function Yi(r,e,t=!1){if(!r||r.length<1)return[];if(r.length<2)return[];let n=r[0],i=r[r.length-1],o=t&&(n.x!==i.x||n.y!==i.y);if(e<2)return o?[...r,r[0]]:[...r];let a=Math.floor(8192/e),s=[];s.push(new ja.default(r[0].x,r[0].y));let l=r.length,u=o?l:l-1;for(let c=0;c<u;c++){let p=r[c],h=c<l-1?r[c+1]:r[0],m=p.x,f=p.y,y=h.x,g=h.y,_=m!==y,x=f!==g;if(!_&&!x)continue;let b=y-m,v=g-f,P=Math.abs(b),S=Math.abs(v),T=m,C=f;for(;;){let E=b>0?(Math.floor(T/a)+1)*a:(Math.ceil(T/a)-1)*a,k=v>0?(Math.floor(C/a)+1)*a:(Math.ceil(C/a)-1)*a,R=Math.abs(T-E),V=Math.abs(C-k),M=Math.abs(T-y),L=Math.abs(C-g),$=_?R/P:Number.POSITIVE_INFINITY,q=x?V/S:Number.POSITIVE_INFINITY;if((M<=R||!_)&&(L<=V||!x))break;if($<q&&_||!x){T=E,C=C+v*$;let Y=new ja.default(T,Math.round(C));(s[s.length-1].x!==Y.x||s[s.length-1].y!==Y.y)&&s.push(Y)}else{T=T+b*q,C=k;let Y=new ja.default(Math.round(T),C);(s[s.length-1].x!==Y.x||s[s.length-1].y!==Y.y)&&s.push(Y)}}let A=new ja.default(y,g);(s[s.length-1].x!==A.x||s[s.length-1].y!==A.y)&&s.push(A)}return s}function pI(r){let e=[],t=[];for(let n of r)if(n.length!==0){n!==r[0]&&e.push(t.length/2);for(let i=0;i<n.length;i++)t.push(n[i].x),t.push(n[i].y)}return{flattened:t,holeIndices:e}}function hI(r,e){let t=[];for(let n=0;n<e.length;n+=3){let i=e[n],o=e[n+1],a=e[n+2],s=r[i*2],l=r[i*2+1],u=r[o*2],c=r[o*2+1],p=r[a*2],h=r[a*2+1],m=u-s,f=c-l,y=p-s,g=h-l;m*g-f*y>0?(t.push(i),t.push(a),t.push(o)):(t.push(i),t.push(o),t.push(a))}return t}function mI(r,e,t){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let n=0,i=r[e[0]*2];for(let l=1;l<e.length;l++){let u=r[e[l]*2];u<i&&(i=u,n=l)}let o=e.length,a=n,s=(a+1)%o;for(;;){let l=a-1>=0?a-1:o-1,u=(s+1)%o,c=r[e[l]*2],p=r[e[l]*2+1],h=r[e[u]*2],m=r[e[u]*2+1],f=r[e[a]*2],y=r[e[a]*2+1],g=r[e[s]*2],_=r[e[s]*2+1],x=!1;if(c<h)x=!0;else if(c>h)x=!1;else{let b=g-f,P=_-y,S=-b,T=y<_?1:-1,C=((c-f)*P+(p-y)*S)*T,A=((h-f)*P+(m-y)*S)*T;C>A&&(x=!0)}if(x){let b=e[l],v=e[a],P=e[s];b!==v&&b!==P&&v!==P&&t.push(P,v,b),a--,a<0&&(a=o-1)}else{let b=e[u],v=e[a],P=e[s];b!==v&&b!==P&&v!==P&&t.push(P,v,b),s++,s>=o&&(s=0)}if(l===u)break}}d();function Fu(r,e,t,n,i,o,a,s,l){let u=i.length/2,c=a&&s&&l;if(u<pe.MAX_VERTEX_ARRAY_LENGTH){let p=e.prepareSegment(u,t,n),h=p.vertexLength;for(let y=0;y<o.length;y+=3)n.emplaceBack(h+o[y],h+o[y+1],h+o[y+2]);p.vertexLength+=u,p.primitiveLength+=o.length/3;let m,f;c&&(f=a.prepareSegment(u,t,s),m=f.vertexLength,f.vertexLength+=u);for(let y=0;y<i.length;y+=2)r(i[y],i[y+1]);if(c)for(let y=0;y<l.length;y++){let g=l[y];for(let _=1;_<g.length;_+=2)s.emplaceBack(m+g[_-1],m+g[_]);f.primitiveLength+=g.length/2}}else fI(e,t,n,i,o,r),c&&dI(a,t,s,i,l,r),e.forceNewSegmentOnNextPrepare(),a?.forceNewSegmentOnNextPrepare()}function Na(r,e,t,n,i,o,a){if(o){let s=n.count;return t(e[i*2],e[i*2+1]),r[i]=n.count,n.count++,a.vertexLength++,s}else return r[i]}function fI(r,e,t,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=r.getOrCreateLatestSegment(e,t),c=u.vertexLength;for(let p=2;p<i.length;p+=3){let h=i[p-2],m=i[p-1],f=i[p],y=a[h]<l,g=a[m]<l,_=a[f]<l,x=(y?1:0)+(g?1:0)+(_?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=r.createNewSegment(e,t),l=s.count,y=!0,g=!0,_=!0,c=0);let b=Na(a,n,o,s,h,y,u),v=Na(a,n,o,s,m,g,u),P=Na(a,n,o,s,f,_,u);t.emplaceBack(c+b-l,c+v-l,c+P-l),u.primitiveLength++}}function dI(r,e,t,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=r.getOrCreateLatestSegment(e,t),c=u.vertexLength;for(let p=0;p<i.length;p++){let h=i[p];for(let m=1;m<i[p].length;m+=2){let f=h[m-1],y=h[m],g=a[f]<l,_=a[y]<l,x=(g?1:0)+(_?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=r.createNewSegment(e,t),l=s.count,g=!0,_=!0,c=0);let b=Na(a,n,o,s,f,g,u),v=Na(a,n,o,s,y,_,u);t.emplaceBack(c+b-l,c+v-l),u.primitiveLength++}}}var yI=500,Ga=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new cu,this.indexArray=new je,this.indexArray2=new yn,this.programConfigurations=new It(e.layers,e.zoom),this.segments=new pe,this.segments2=new pe,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,n){this.hasPattern=qi("fill",this.layers,t);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,h=Lt(s,p);if(!this.layers[0]._featureFilter.filter(new be(this.zoom,{globalState:this.globalState}),h,n))continue;let m=o?i.evaluate(h,{},n,t.availableImages):void 0,f={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?h.geometry:Et(s),patterns:{},sortKey:m};a.push(f)}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 h=Wi("fill",this.layers,s,this.zoom,t);this.patternFeatures.push(h)}else this.addFeature(s,l,u,n,{},t.subdivisionGranularity);let p=e[u].feature;t.featureIndex.insert(p,l,u,c,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,U_),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,n,i,o,a){for(let s of ta(t,yI)){let l=Ru(s,i,a.fill.getGranularityForZoomLevel(i.z)),u=this.layoutVertexArray;Fu((c,p)=>{u.emplaceBack(c,p)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles,this.segments2,this.indexArray2,l.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};G("FillBucket",Ga,{omit:["layers","patternFeatures"]});d();var H_,gI=()=>H_=H_||new Le({"fill-sort-key":new Q(I.layout_fill["fill-sort-key"])}),q_,_I=()=>q_=q_||new Le({"fill-antialias":new Z(I.paint_fill["fill-antialias"]),"fill-opacity":new Q(I.paint_fill["fill-opacity"]),"fill-color":new Q(I.paint_fill["fill-color"]),"fill-outline-color":new Q(I.paint_fill["fill-outline-color"]),"fill-translate":new Z(I.paint_fill["fill-translate"]),"fill-translate-anchor":new Z(I.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ur(I.paint_fill["fill-pattern"])}),W_={get paint(){return _I()},get layout(){return gI()}};var X_=r=>r.type==="fill",zu=class extends $e{constructor(e){super(e,W_)}recalculate(e,t){super.recalculate(e,t);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 Ga(e)}queryRadius(){return _n(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:n,pixelsToTileUnits:i}){let o=xn(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-n.bearingInRadians,i);return Su(o,t)}isTileClipped(){return!0}};d();d();d();var xI=Ie([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Y_=Ie([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:K_,size:v3,alignment:w3}=xI;var ix=ie(Za(),1);var LI=ix.default.VectorTileFeature.types,DI=500,$m=Math.pow(2,13);function $a(r,e,t,n,i,o,a,s){r.emplaceBack(e,t,Math.floor(n*$m)*2+a,i*$m*2,o*$m*2,Math.round(s))}var Ha=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new pu,this.centroidVertexArray=new pt,this.indexArray=new je,this.programConfigurations=new It(e.layers,e.zoom),this.segments=new pe,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,n){this.features=[],this.hasPattern=qi("fill-extrusion",this.layers,t);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of e){let l=this.layers[0]._featureFilter.needGeometry,u=Lt(i,l);if(!this.layers[0]._featureFilter.filter(new be(this.zoom,{globalState:this.globalState}),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:Et(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Wi("fill-extrusion",this.layers,c,this.zoom,t)):this.addFeature(c,c.geometry,a,n,{},t.subdivisionGranularity),t.featureIndex.insert(i,c.geometry,a,s,this.index,!0)}}addFeatures(e,t,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,t,n,e.subdivisionGranularity)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,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,K_),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Y_.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,n,i,o,a){for(let s of ta(t,DI)){let l={x:0,y:0,sampleCount:0},u=this.layoutVertexArray.length;this.processPolygon(l,i,e,s,a);let c=this.layoutVertexArray.length-u,p=Math.floor(l.x/l.sampleCount),h=Math.floor(l.y/l.sampleCount);for(let m=0;m<c;m++)this.centroidVertexArray.emplaceBack(p,h)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}processPolygon(e,t,n,i,o){if(i.length<1||nx(i[0]))return;for(let p of i)p.length!==0&&kI(e,p);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=o.fill.getGranularityForZoomLevel(t.z),l=LI[n.type]==="Polygon";for(let p of i){if(p.length===0||nx(p))continue;let h=Yi(p,s,l);this._generateSideFaces(h,a)}if(!l)return;let u=Ru(i,t,s,!1),c=this.layoutVertexArray;Fu((p,h)=>{$a(c,p,h,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,u.verticesFlattened,u.indicesTriangles)}_generateSideFaces(e,t){let n=0;for(let i=1;i<e.length;i++){let o=e[i],a=e[i-1];if(RI(o,a))continue;t.segment.vertexLength+4>pe.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=o.sub(a)._perp()._unit(),l=a.dist(o);n+l>32768&&(n=0),$a(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,n),$a(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,n),n+=l,$a(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,n),$a(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,n);let u=t.segment.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}};function kI(r,e){for(let t=0;t<e.length;t++){let n=e[t];t===e.length-1&&e[0].x===n.x&&e[0].y===n.y||(r.x+=n.x,r.y+=n.y,r.sampleCount++)}}G("FillExtrusionBucket",Ha,{omit:["layers","features"]});function RI(r,e){return r.x===e.x&&(r.x<0||r.x>8192)||r.y===e.y&&(r.y<0||r.y>8192)}function nx(r){return r.every(e=>e.x<0)||r.every(e=>e.x>8192)||r.every(e=>e.y<0)||r.every(e=>e.y>8192)}d();var ox,FI=()=>ox=ox||new Le({"fill-extrusion-opacity":new Z(I["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Q(I["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Z(I["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Z(I["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ur(I["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Q(I["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Q(I["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Z(I["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),ax={get paint(){return FI()}};var Ou=ie(le(),1);var lx=r=>r.type==="fill-extrusion",Vu=class extends $e{constructor(e){super(e,ax)}createBucket(e){return new Ha(e)}queryRadius(){return _n(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){let l=xn(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),u=this.paint.get("fill-extrusion-height").evaluate(t,n),c=this.paint.get("fill-extrusion-base").evaluate(t,n),p=OI(l,s,0),h=BI(i,c,u,s),m=h[0],f=h[1];return zI(m,f,p)}};function qa(r,e){return r.x*e.x+r.y*e.y}function sx(r,e){if(r.length===1){let t=0,n=e[t++],i;for(;!i||n.equals(i);)if(i=e[t++],!i)return 1/0;for(;t<e.length;t++){let o=e[t],a=r[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=qa(s,s),p=qa(s,l),h=qa(l,l),m=qa(u,s),f=qa(u,l),y=c*h-p*p,g=(h*m-p*f)/y,_=(c*f-p*m)/y,x=1-g-_,b=n.z*x+i.z*g+o.z*_;if(isFinite(b))return b}return 1/0}else{let t=1/0;for(let n of e)t=Math.min(t,n.z);return t}}function zI(r,e,t){let n=1/0;Su(t,e)&&(n=sx(t,e[0]));for(let i=0;i<e.length;i++){let o=e[i],a=r[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],h=[l,u,p,c,l];Pu(t,h)&&(n=Math.min(n,sx(t,h)))}}return n===1/0?!1:n}function BI(r,e,t,n){let i=[],o=[],a=n[8]*e,s=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*t,p=n[9]*t,h=n[10]*t,m=n[11]*t;for(let f of r){let y=[],g=[];for(let _ of f){let x=_.x,b=_.y,v=n[0]*x+n[4]*b+n[12],P=n[1]*x+n[5]*b+n[13],S=n[2]*x+n[6]*b+n[14],T=n[3]*x+n[7]*b+n[15],C=v+a,A=P+s,E=S+l,k=T+u,R=v+c,V=P+p,M=S+h,L=T+m,$=new Ou.default(C/k,A/k);$.z=E/k,y.push($);let q=new Ou.default(R/L,V/L);q.z=M/L,g.push(q)}i.push(y),o.push(g)}return[i,o]}function OI(r,e,t){let n=[];for(let i of r){let o=[i.x,i.y,t,1];De.transformMat4(o,o,e),n.push(new Ou.default(o[0]/o[3],o[1]/o[3]))}return n}d();d();d();var VI=Ie([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ux,size:hO,alignment:mO}=VI;d();var UI=Ie([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:cx,size:gO,alignment:_O}=UI;var mx=ie(Za(),1);var jI=mx.default.VectorTileFeature.types,px=63,NI=Math.cos(75/2*(Math.PI/180)),GI=15,ZI=20,$I=15,fx=1/2,hx=Math.pow(2,$I-1)/fx,Wa=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new hu,this.layoutVertexArray2=new mu,this.indexArray=new je,this.programConfigurations=new It(e.layers,e.zoom),this.segments=new pe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,n){this.hasPattern=qi("line",this.layers,t);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,h=Lt(s,p);if(!this.layers[0]._featureFilter.filter(new be(this.zoom,{globalState:this.globalState}),h,n))continue;let m=o?i.evaluate(h,{},n):void 0,f={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?h.geometry:Et(s),patterns:{},sortKey:m};a.push(f)}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 h=Wi("line",this.layers,s,this.zoom,t);this.patternFeatures.push(h)}else this.addFeature(s,l,u,n,{},t.subdivisionGranularity);let p=e[u].feature;t.featureIndex.insert(p,l,u,c,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,n)}addFeatures(e,t,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,n,e.subdivisionGranularity)}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,cx)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ux),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 t=+e.properties.mapbox_clip_start,n=+e.properties.mapbox_clip_end;return{start:t,end:n}}}addFeature(e,t,n,i,o,a){let s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),u=s.get("line-cap"),c=s.get("line-miter-limit"),p=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let h of t)this.addLine(h,e,l,u,c,p,i,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,t,n,i,o,a,s,l){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let u=s?l.line.getGranularityForZoomLevel(s.z):1;if(e=Yi(e,u),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<e.length-1;v++)this.totalDistance+=e[v].dist(e[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=jI[t.type]==="Polygon",p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let h=0;for(;h<p-1&&e[h].equals(e[h+1]);)h++;if(p<(c?3:2))return;n==="bevel"&&(o=1.05);let m=this.overscaling<=16?GI*8192/(512*this.overscaling):0,f=this.segments.prepareSegment(p*10,this.layoutVertexArray,this.indexArray),y,g,_,x,b;this.e1=this.e2=-1,c&&(y=e[p-2],b=e[h].sub(y)._unit()._perp());for(let v=h;v<p;v++){if(_=v===p-1?c?e[h+1]:void 0:e[v+1],_&&e[v].equals(_))continue;b&&(x=b),y&&(g=y),y=e[v],b=_?_.sub(y)._unit()._perp():x,x=x||b;let P=x.add(b);(P.x!==0||P.y!==0)&&P._unit();let S=x.x*b.x+x.y*b.y,T=P.x*b.x+P.y*b.y,C=T!==0?1/T:1/0,A=2*Math.sqrt(2-2*T),E=T<NI&&g&&_,k=x.x*b.y-x.y*b.x>0;if(E&&v>h){let M=y.dist(g);if(M>2*m){let L=y.sub(y.sub(g)._mult(m/M)._round());this.updateDistance(g,L),this.addCurrentVertex(L,x,0,0,f),g=L}}let R=g&&_,V=R?n:c?"butt":i;if(R&&V==="round"&&(C<a?V="miter":C<=2&&(V="fakeround")),V==="miter"&&C>o&&(V="bevel"),V==="bevel"&&(C>2&&(V="flipbevel"),C<o&&(V="miter")),g&&this.updateDistance(g,y),V==="miter")P._mult(C),this.addCurrentVertex(y,P,0,0,f);else if(V==="flipbevel"){if(C>100)P=b.mult(-1);else{let M=C*x.add(b).mag()/x.sub(b).mag();P._perp()._mult(M*(k?-1:1))}this.addCurrentVertex(y,P,0,0,f),this.addCurrentVertex(y,P.mult(-1),0,0,f)}else if(V==="bevel"||V==="fakeround"){let M=-Math.sqrt(C*C-1),L=k?M:0,$=k?0:M;if(g&&this.addCurrentVertex(y,x,L,$,f),V==="fakeround"){let q=Math.round(A*180/Math.PI/ZI);for(let Y=1;Y<q;Y++){let he=Y/q;if(he!==.5){let _e=he-.5,de=1.0904+S*(-3.2452+S*(3.55645-S*1.43519)),He=.848013+S*(-1.06021+S*.215638);he=he+he*_e*(he-1)*(de*_e*_e+He)}let Oe=b.sub(x)._mult(he)._add(x)._unit()._mult(k?-1:1);this.addHalfVertex(y,Oe.x,Oe.y,!1,k,0,f)}}_&&this.addCurrentVertex(y,b,-L,-$,f)}else if(V==="butt")this.addCurrentVertex(y,P,0,0,f);else if(V==="square"){let M=g?1:-1;this.addCurrentVertex(y,P,M,M,f)}else V==="round"&&(g&&(this.addCurrentVertex(y,x,0,0,f),this.addCurrentVertex(y,x,1,1,f,!0)),_&&(this.addCurrentVertex(y,b,-1,-1,f,!0),this.addCurrentVertex(y,b,0,0,f)));if(E&&v<p-1){let M=y.dist(_);if(M>2*m){let L=y.add(_.sub(y)._mult(m/M)._round());this.updateDistance(y,L),this.addCurrentVertex(L,b,0,0,f),y=L}}}}addCurrentVertex(e,t,n,i,o,a=!1){let s=t.x+t.y*n,l=t.y-t.x*n,u=-t.x+t.y*i,c=-t.y-t.x*i;this.addHalfVertex(e,s,l,a,!1,n,o),this.addHalfVertex(e,u,c,a,!0,-i,o),this.distance>hx/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,n,i,o,a))}addHalfVertex({x:e,y:t},n,i,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(hx-1):this.scaledDistance)*fx;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(t<<1)+(a?1:0),Math.round(px*n)+128,Math.round(px*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let h=this.scaledDistance-this.lineClips.start,m=this.lineClips.end-this.lineClips.start,f=h/m;this.layoutVertexArray2.emplaceBack(f,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,p,this.e2),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,t){this.distance+=e.dist(t),this.updateScaledDistance()}};G("LineBucket",Wa,{omit:["layers","patternFeatures"]});d();var dx,HI=()=>dx=dx||new Le({"line-cap":new Z(I.layout_line["line-cap"]),"line-join":new Q(I.layout_line["line-join"]),"line-miter-limit":new Z(I.layout_line["line-miter-limit"]),"line-round-limit":new Z(I.layout_line["line-round-limit"]),"line-sort-key":new Q(I.layout_line["line-sort-key"])}),yx,qI=()=>yx=yx||new Le({"line-opacity":new Q(I.paint_line["line-opacity"]),"line-color":new Q(I.paint_line["line-color"]),"line-translate":new Z(I.paint_line["line-translate"]),"line-translate-anchor":new Z(I.paint_line["line-translate-anchor"]),"line-width":new Q(I.paint_line["line-width"]),"line-gap-width":new Q(I.paint_line["line-gap-width"]),"line-offset":new Q(I.paint_line["line-offset"]),"line-blur":new Q(I.paint_line["line-blur"]),"line-dasharray":new ei(I.paint_line["line-dasharray"]),"line-pattern":new Ur(I.paint_line["line-pattern"]),"line-gradient":new jr(I.paint_line["line-gradient"])}),Hm={get paint(){return qI()},get layout(){return HI()}};var qm=class extends Q{possiblyEvaluate(e,t){return t=new be(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,i){return t=N({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,i)}},Uu,_x=r=>r.type==="line",ju=class extends $e{constructor(e){super(e,Hm),this.gradientVersion=0,Uu||(Uu=new qm(Hm.paint.properties["line-width"].specification),Uu.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();Lg(t)?this.stepInterpolant=t._styleExpression.expression instanceof ki:this.stepInterpolant=!1,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"]=Uu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Wa(e)}queryRadius(e){let t=e,n=gx(oi("line-width",this,t),oi("line-gap-width",this,t)),i=oi("line-offset",this,t);return n/2+Math.abs(i)+_n(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a}){let s=xn(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*gx(this.paint.get("line-width").evaluate(t,n),this.paint.get("line-gap-width").evaluate(t,n)),u=this.paint.get("line-offset").evaluate(t,n);return u&&(i=P_(i,u*a)),b_(s,i,l)}isTileClipped(){return!0}};function gx(r,e){return e>0?e+2*r:r}d();d();d();var xx=Ie([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),bx=Ie([{name:"a_projected_pos",components:3,type:"Float32"}],4),eV=Ie([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),vx=Ie([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),tV=Ie([{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"}]),Wm=Ie([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),wx=Ie([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),rV=Ie([{name:"triangle",components:3,type:"Uint16"}]),nV=Ie([{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"}]),iV=Ie([{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",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),oV=Ie([{type:"Float32",name:"offsetX"}]),aV=Ie([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),sV=Ie([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Ka=ie(le(),1);d();function WI(r,e,t){let n=e.layout.get("text-transform").evaluate(t,{});return n==="uppercase"?r=r.toLocaleUpperCase():n==="lowercase"&&(r=r.toLocaleLowerCase()),Tr.applyArabicShaping&&(r=Tr.applyArabicShaping(r)),r}function Px(r,e,t){return r.sections.forEach(n=>{n.text=WI(n.text,e,t)}),r}d();function Sx(r){let e={},t={},n=[],i=0;function o(u){n.push(r[u]),i++}function a(u,c,p){let h=t[u];return delete t[u],t[c]=h,n[h].geometry[0].pop(),n[h].geometry[0]=n[h].geometry[0].concat(p[0]),h}function s(u,c,p){let h=e[c];return delete e[c],e[u]=h,n[h].geometry[0].shift(),n[h].geometry[0]=p[0].concat(n[h].geometry[0]),h}function l(u,c,p){let h=p?c[0][c[0].length-1]:c[0][0];return`${u}:${h.x}:${h.y}`}for(let u=0;u<r.length;u++){let c=r[u],p=c.geometry,h=c.text?c.text.toString():null;if(!h){o(u);continue}let m=l(h,p),f=l(h,p,!0);if(m in t&&f in e&&t[m]!==e[f]){let y=s(m,f,p),g=a(m,f,n[y].geometry);delete e[m],delete t[f],t[l(h,n[g].geometry,!0)]=g,n[y].geometry=null}else m in t?a(m,f,p):f in e?s(m,f,p):(o(u),e[m]=i-1,t[f]=i-1)}return n.filter(u=>u.geometry)}d();d();var Tx={"!":"\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"};d();var vn=24;d();var kx=ie(Km(),1),Dx=3;function hE(r,e,t){r===1&&t.readMessage(mE,e)}function mE(r,e,t){if(r===3){let{id:n,bitmap:i,width:o,height:a,left:s,top:l,advance:u}=t.readMessage(fE,{});e.push({id:n,bitmap:new ai({width:o+2*Dx,height:a+2*Dx},i),metrics:{width:o,height:a,left:s,top:l,advance:u}})}}function fE(r,e,t){r===1?e.id=t.readVarint():r===2?e.bitmap=t.readBytes():r===3?e.width=t.readVarint():r===4?e.height=t.readVarint():r===5?e.left=t.readSVarint():r===6?e.top=t.readSVarint():r===7&&(e.advance=t.readVarint())}function Rx(r){return new kx.default(r).readFields(hE,[])}d();function Fx(r){let{userImage:e}=r;return e&&e.render&&e.render()?(r.data.replace(new Uint8Array(e.data.buffer)),!0):!1}d();d();function Xa(r){let e=0,t=0;for(let s of r)e+=s.w*s.h,t=Math.max(t,s.w);r.sort((s,l)=>l.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),t),h:1/0}],o=0,a=0;for(let s of r)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 Dt=1;var eo=class{constructor(e,{pixelRatio:t,version:n,stretchX:i,stretchY:o,content:a,textFitWidth:s,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n,this.textFitWidth=s,this.textFitHeight=l}get tl(){return[this.paddedRect.x+Dt,this.paddedRect.y+Dt]}get br(){return[this.paddedRect.x+this.paddedRect.w-Dt,this.paddedRect.y+this.paddedRect.h-Dt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-Dt*2)/this.pixelRatio,(this.paddedRect.h-Dt*2)/this.pixelRatio]}},Jm=class{constructor(e,t){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,n,o),this.addImages(t,i,o);let{w:a,h:s}=Xa(o),l=new Se({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;Se.copy(c.data,l,{x:0,y:0},{x:p.x+Dt,y:p.y+Dt},c.data)}for(let u in t){let c=t[u],p=i[u].paddedRect,h=p.x+Dt,m=p.y+Dt,f=c.data.width,y=c.data.height;Se.copy(c.data,l,{x:0,y:0},{x:h,y:m},c.data),Se.copy(c.data,l,{x:0,y:y-1},{x:h,y:m-1},{width:f,height:1}),Se.copy(c.data,l,{x:0,y:0},{x:h,y:m+y},{width:f,height:1}),Se.copy(c.data,l,{x:f-1,y:0},{x:h-1,y:m},{width:1,height:y}),Se.copy(c.data,l,{x:0,y:0},{x:h+f,y:m},{width:1,height:y})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(e,t,n){for(let i in e){let o=e[i],a={x:0,y:0,w:o.data.width+2*Dt,h:o.data.height+2*Dt};n.push(a),t[i]=new eo(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t||e.version===t.version)return;e.version=t.version;let[i,o]=e.tl;n.update(t.data,void 0,{x:i,y:o})}};G("ImagePosition",eo);G("ImageAtlas",Jm);var li=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(li||{});function Zu(r){let e=.5,t=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0;break}switch(r){case"bottom":case"bottom-right":case"bottom-left":t=1;break;case"top":case"top-right":case"top-left":t=0;break}return{horizontalAlign:e,verticalAlign:t}}var Ox=ie(Za(),1);d();var zx=255,Ya=128,$u=zx*Ya;function Qm(r,e){let{expression:t}=e;if(t.kind==="constant")return{kind:"constant",layoutSize:t.evaluate(new be(r+1))};if(t.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=t,o=0;for(;o<n.length&&n[o]<=r;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<r+1;)a++;a=Math.min(n.length-1,a);let s=n[o],l=n[a];if(t.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let u=t.evaluate(new be(s)),c=t.evaluate(new be(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function to(r,{uSize:e,uSizeT:t},{lowerSize:n,upperSize:i}){return r.kind==="source"?n/Ya:r.kind==="composite"?Me.number(n/Ya,i/Ya,t):e}function ui(r,e){let t=0,n=0;if(r.kind==="constant")n=r.layoutSize;else if(r.kind!=="source"){let{interpolationType:i,minZoom:o,maxZoom:a}=r,s=i?ae(Pt.interpolationFactor(i,e,o,a),0,1):0;r.kind==="camera"?n=Me.number(r.minSize,r.maxSize,s):t=s}return{uSizeT:t,uSize:n}}d();function ro(r,e,t){let n="never",i=r.get(e);return i?n=i:r.get(t)&&(n="always"),n}var yE=Ox.default.VectorTileFeature.types,gE=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Hu(r,e,t,n,i,o,a,s,l,u,c,p,h){let m=s?Math.min($u,Math.round(s[0])):0,f=s?Math.min($u,Math.round(s[1])):0;r.emplaceBack(e,t,Math.round(n*32),Math.round(i*32),o,a,(m<<1)+(l?1:0),f,u*16,c*16,p*256,h*256)}function ci(r,e,t){r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t)}function _E(r){for(let e of r.sections)if(o_(e.text))return!0;return!1}var Ja=class{constructor(e){this.layoutVertexArray=new fu,this.indexArray=new je,this.programConfigurations=e,this.segments=new pe,this.dynamicLayoutVertexArray=new du,this.opacityVertexArray=new yu,this.hasVisibleVertices=!1,this.placedSymbolArray=new Pa}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,xx.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,bx.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,gE,!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())}};G("SymbolBuffers",Ja);var Qa=class{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new pe,this.collisionVertexArray=new _u}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,vx.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};G("CollisionBuffers",Qa);var hr=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,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=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Qm(this.zoom,n["text-size"]),this.iconSizeData=Qm(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=ro(i,"text-overlap","text-allow-overlap")!=="never"||ro(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=>li[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Ja(new It(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Ja(new It(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ta,this.lineVertexArray=new Ma,this.symbolInstances=new Sa,this.textAnchorOffsets=new Ca}calculateGlyphDependencies(e,t,n,i,o){for(let a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,(n||i)&&o){let s=Tx[e.charAt(a)];s&&(t[s.charCodeAt(0)]=!0)}}populate(e,t,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 Vt&&!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 h=t.iconDependencies,m=t.glyphDependencies,f=t.availableImages,y=new be(this.zoom,{globalState:this.globalState});for(let{feature:g,id:_,index:x,sourceLayerIndex:b}of e){let v=i._featureFilter.needGeometry,P=Lt(g,v);if(!i._featureFilter.filter(y,P,n))continue;v||(P.geometry=Et(g));let S;if(u){let E=i.getValueAndResolveTokens("text-field",P,n,f),k=Vt.factory(E),R=this.hasRTLText=this.hasRTLText||_E(k);(!R||Tr.getRTLTextPluginStatus()==="unavailable"||R&&Tr.isParsed())&&(S=Px(k,i,P))}let T;if(c){let E=i.getValueAndResolveTokens("icon-image",P,n,f);E instanceof At?T=E:T=At.fromString(E)}if(!S&&!T)continue;let C=this.sortFeaturesByKey?p.evaluate(P,{},n):void 0,A={id:_,text:S,icon:T,index:x,sourceLayerIndex:b,geometry:P.geometry,properties:g.properties,type:yE[g.type],sortKey:C};if(this.features.push(A),T&&(h[T.name]=!0),S){let E=a.evaluate(P,{},n).join(","),k=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let R of S.sections)if(R.image)h[R.image.name]=!0;else{let V=Pm(S.toString()),M=R.fontStack||E,L=m[M]=m[M]||{};this.calculateGlyphDependencies(R.text,L,k,this.allowVerticalPlacement,V)}}}o.get("symbol-placement")==="line"&&(this.features=Sx(this.features)),this.sortFeaturesByKey&&this.features.sort((g,_)=>g.sortKey-_.sortKey)}update(e,t,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,t,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,t){let n=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(t[e.segment+1]),o=e.dist(t[e.segment]),a={};for(let s=e.segment+1;s<t.length;s++)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:i},s<t.length-1&&(i+=t[s+1].dist(t[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=t[s-1].dist(t[s]));for(let s=0;s<t.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,t,n,i,o,a,s,l,u,c,p,h){let m=e.indexArray,f=e.layoutVertexArray,y=e.segments.prepareSegment(4*t.length,f,m,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,_=y.vertexLength,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<t.length;v++){let{tl:P,tr:S,bl:T,br:C,tex:A,pixelOffsetTL:E,pixelOffsetBR:k,minFontScaleX:R,minFontScaleY:V,glyphOffset:M,isSDF:L,sectionIndex:$}=t[v],q=y.vertexLength,Y=M[1];Hu(f,l.x,l.y,P.x,Y+P.y,A.x,A.y,n,L,E.x,E.y,R,V),Hu(f,l.x,l.y,S.x,Y+S.y,A.x+A.w,A.y,n,L,k.x,E.y,R,V),Hu(f,l.x,l.y,T.x,Y+T.y,A.x,A.y+A.h,n,L,E.x,k.y,R,V),Hu(f,l.x,l.y,C.x,Y+C.y,A.x+A.w,A.y+A.h,n,L,k.x,k.y,R,V),ci(e.dynamicLayoutVertexArray,l,x),m.emplaceBack(q,q+2,q+1),m.emplaceBack(q+1,q+2,q+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(M[0]),(v===t.length-1||$!==t[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(f.length,a,a.index,{},h,b&&b[$])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,p)}_addCollisionDebugVertex(e,t,n,i,o,a){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,n,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,h=s.anchorX,m=s.anchorY;this._addCollisionDebugVertex(c,p,a,h,m,new Ka.default(e,t)),this._addCollisionDebugVertex(c,p,a,h,m,new Ka.default(n,t)),this._addCollisionDebugVertex(c,p,a,h,m,new Ka.default(n,i)),this._addCollisionDebugVertex(c,p,a,h,m,new Ka.default(e,i)),l.vertexLength+=4;let f=o.indexArray;f.emplaceBack(u,u+1),f.emplaceBack(u+1,u+2),f.emplaceBack(u+2,u+3),f.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(e,t,n,i){for(let o=e;o<t;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 Qa(Ia,Wm.members,yn),this.iconCollisionBox=new Qa(Ia,Wm.members,yn);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,n,i,o,a,s,l,u){let c={};for(let p=t;p<n;p++){let h=e.get(p);c.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.textFeatureIndex=h.featureIndex;break}for(let p=i;p<o;p++){let h=e.get(p);c.verticalTextBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.verticalTextFeatureIndex=h.featureIndex;break}for(let p=a;p<s;p++){let h=e.get(p);c.iconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.iconFeatureIndex=h.featureIndex;break}for(let p=l;p<u;p++){let h=e.get(p);c.verticalIconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.verticalIconFeatureIndex=h.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let n=this.symbolInstances.get(t);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,t){let n=e.placedSymbolArray.get(t),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)e.indexArray.emplaceBack(o,o+2,o+1),e.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=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(t*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,t){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===t?n.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 t of this.symbolInstanceIndexes){let n=this.symbolInstances.get(t);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)}}};G("SymbolBucket",hr,{omit:["layers","collisionBoxArray","features","compareText"]});hr.MAX_GLYPHS=65535;hr.addDynamicAttributes=ci;d();function Vx(r,e){return e.replace(/{([^{}]+)}/g,(t,n)=>r&&n in r?String(r[n]):"")}d();var Ux,xE=()=>Ux=Ux||new Le({"symbol-placement":new Z(I.layout_symbol["symbol-placement"]),"symbol-spacing":new Z(I.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Z(I.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Q(I.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Z(I.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Z(I.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Z(I.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Z(I.layout_symbol["icon-ignore-placement"]),"icon-optional":new Z(I.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Z(I.layout_symbol["icon-rotation-alignment"]),"icon-size":new Q(I.layout_symbol["icon-size"]),"icon-text-fit":new Z(I.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Z(I.layout_symbol["icon-text-fit-padding"]),"icon-image":new Q(I.layout_symbol["icon-image"]),"icon-rotate":new Q(I.layout_symbol["icon-rotate"]),"icon-padding":new Q(I.layout_symbol["icon-padding"]),"icon-keep-upright":new Z(I.layout_symbol["icon-keep-upright"]),"icon-offset":new Q(I.layout_symbol["icon-offset"]),"icon-anchor":new Q(I.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Z(I.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Z(I.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Z(I.layout_symbol["text-rotation-alignment"]),"text-field":new Q(I.layout_symbol["text-field"]),"text-font":new Q(I.layout_symbol["text-font"]),"text-size":new Q(I.layout_symbol["text-size"]),"text-max-width":new Q(I.layout_symbol["text-max-width"]),"text-line-height":new Z(I.layout_symbol["text-line-height"]),"text-letter-spacing":new Q(I.layout_symbol["text-letter-spacing"]),"text-justify":new Q(I.layout_symbol["text-justify"]),"text-radial-offset":new Q(I.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Z(I.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Q(I.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Q(I.layout_symbol["text-anchor"]),"text-max-angle":new Z(I.layout_symbol["text-max-angle"]),"text-writing-mode":new Z(I.layout_symbol["text-writing-mode"]),"text-rotate":new Q(I.layout_symbol["text-rotate"]),"text-padding":new Z(I.layout_symbol["text-padding"]),"text-keep-upright":new Z(I.layout_symbol["text-keep-upright"]),"text-transform":new Q(I.layout_symbol["text-transform"]),"text-offset":new Q(I.layout_symbol["text-offset"]),"text-allow-overlap":new Z(I.layout_symbol["text-allow-overlap"]),"text-overlap":new Z(I.layout_symbol["text-overlap"]),"text-ignore-placement":new Z(I.layout_symbol["text-ignore-placement"]),"text-optional":new Z(I.layout_symbol["text-optional"])}),jx,bE=()=>jx=jx||new Le({"icon-opacity":new Q(I.paint_symbol["icon-opacity"]),"icon-color":new Q(I.paint_symbol["icon-color"]),"icon-halo-color":new Q(I.paint_symbol["icon-halo-color"]),"icon-halo-width":new Q(I.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Q(I.paint_symbol["icon-halo-blur"]),"icon-translate":new Z(I.paint_symbol["icon-translate"]),"icon-translate-anchor":new Z(I.paint_symbol["icon-translate-anchor"]),"text-opacity":new Q(I.paint_symbol["text-opacity"]),"text-color":new Q(I.paint_symbol["text-color"],{runtimeType:er,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Q(I.paint_symbol["text-halo-color"]),"text-halo-width":new Q(I.paint_symbol["text-halo-width"]),"text-halo-blur":new Q(I.paint_symbol["text-halo-blur"]),"text-translate":new Z(I.paint_symbol["text-translate"]),"text-translate-anchor":new Z(I.paint_symbol["text-translate-anchor"])}),qu={get paint(){return bE()},get layout(){return xE()}};d();var es=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:Fi,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()){let t=this.defaultValue.value;e(t._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};G("FormatSectionOverride",es,{omit:["defaultValue"]});var Nx=r=>r.type==="symbol",Wu=class r extends $e{constructor(e){super(e,qu)}recalculate(e,t){if(super.recalculate(e,t),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,t,n,i){let o=this.layout.get(e).evaluate(t,{},n,i),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!na(a.value)&&o?Vx(t.properties,o):o}createBucket(e){return new hr(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of qu.paint.overridableProperties){if(!r.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),n=new es(t),i=new Wn(n,t.property.specification),o=null;t.value.kind==="constant"||t.value.kind==="source"?o=new Sr("source",i):o=new cn("composite",i,t.value.zoomStops),this.paint._values[e]=new yt(t.property,o,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!this.layout||t.isDataDriven()||n.isDataDriven()?!1:r.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let n=e.get("text-field"),i=qu.paint.properties[t],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 Vt)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof ln&&Ye(u.value)===zi){let c=u.value;a(c.sections)}else u instanceof Zo?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};d();d();var Gx,vE=()=>Gx=Gx||new Le({"background-color":new Z(I.paint_background["background-color"]),"background-pattern":new ei(I.paint_background["background-pattern"]),"background-opacity":new Z(I.paint_background["background-opacity"])}),Zx={get paint(){return vE()}};var $x=r=>r.type==="background",Xu=class extends $e{constructor(e){super(e,Zx)}};d();d();var Hx,wE=()=>Hx=Hx||new Le({"raster-opacity":new Z(I.paint_raster["raster-opacity"]),"raster-hue-rotate":new Z(I.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Z(I.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Z(I.paint_raster["raster-brightness-max"]),"raster-saturation":new Z(I.paint_raster["raster-saturation"]),"raster-contrast":new Z(I.paint_raster["raster-contrast"]),"raster-resampling":new Z(I.paint_raster["raster-resampling"]),"raster-fade-duration":new Z(I.paint_raster["raster-fade-duration"])}),qx={get paint(){return wE()}};var Wx=r=>r.type==="raster",Yu=class extends $e{constructor(e){super(e,qx)}};d();function Xx(r){let e=[],t=r.id;return t===void 0&&e.push({message:`layers.${t}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${t}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${t}: property "renderingMode" must be either "2d" or "3d"`}),e}var Yx=r=>r.type==="custom",Ku=class extends $e{constructor(t){super(t,{});this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)};this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)};this.implementation=t}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 Ju(r){if(r.type==="custom")return new Ku(r);switch(r.type){case"background":return new Xu(r);case"circle":return new Mu(r);case"color-relief":return new Eu(r);case"fill":return new zu(r);case"fill-extrusion":return new Vu(r);case"heatmap":return new Au(r);case"hillshade":return new Iu(r);case"line":return new ju(r);case"raster":return new Yu(r);case"symbol":return new Wu(r)}}d();d();function no(r){let e=[];if(typeof r=="string")e.push({id:"default",url:r});else if(r&&r.length>0){let t=[];for(let{id:n,url:i}of r){let o=`${n}${i}`;t.indexOf(o)===-1&&(t.push(o),e.push({id:n,url:i}))}}return e}function Kx(r,e,t){try{let n=new URL(r);return n.pathname+=`${e}${t}`,n.toString()}catch{throw new Error(`Invalid sprite URL "${r}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function Jx(r,e,t,n){let i=no(r),o=t>1?"@2x":"",a={},s={};for(let{id:l,url:u}of i){let c=e.transformRequest(Kx(u,o,".json"),"SpriteJSON");a[l]=nn(c,n);let p=e.transformRequest(Kx(u,o,".png"),"SpriteImage");s[l]=wt.getImage(p,n)}return await Promise.all([...Object.values(a),...Object.values(s)]),PE(a,s)}async function PE(r,e){let t={};for(let n in r){t[n]={};let i=re.getImageCanvasContext((await e[n]).data),o=(await r[n]).data;for(let a in o){let{width:s,height:l,x:u,y:c,sdf:p,pixelRatio:h,stretchX:m,stretchY:f,content:y,textFitWidth:g,textFitHeight:_}=o[a],x={width:s,height:l,x:u,y:c,context:i};t[n][a]={data:null,pixelRatio:h,sdf:p,stretchX:m,stretchY:f,content:y,textFitWidth:g,textFitHeight:_,spriteData:x}}}return t}d();var Qu=1,ec=class extends xe{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:t,promiseResolve:n}of this.requestors)n(this._getImagesForIds(t));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let n=t.spriteData;t.data=new Se({width:n.width,height:n.height},n.context.getImageData(n.x,n.y,n.width,n.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 n=!0,i=t.data||t.spriteData;return this._validateStretch(t.stretchX,i&&i.width)||(this.fire(new K(new Error(`Image "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(t.stretchY,i&&i.height)||(this.fire(new K(new Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(t.content,t)||(this.fire(new K(new Error(`Image "${e}" has invalid "content" value`))),n=!1),n}_validateStretch(e,t){if(!e)return!0;let n=0;for(let i of e){if(i[0]<n||i[1]<i[0]||t<i[1])return!1;n=i[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let n=t.spriteData,i=n&&n.width||t.data.width,o=n&&n.height||t.data.height;return!(e[0]<0||i<e[0]||e[1]<0||o<e[1]||e[2]<0||i<e[2]||e[3]<0||o<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,n=!0){let i=this.getImage(e);if(n&&(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){return new Promise((t,n)=>{let i=!0;if(!this.isLoaded())for(let o of e)this.images[o]||(i=!1);this.isLoaded()||i?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){let t={};for(let n of e){let i=this.getImage(n);i||(this.fire(new z("styleimagemissing",{id:n})),i=this.getImage(n)),i?t[n]={data:i.data.clone(),pixelRatio:i.pixelRatio,sdf:i.sdf,version:i.version,stretchX:i.stretchX,stretchY:i.stretchY,content:i.content,textFitWidth:i.textFitWidth,textFitHeight:i.textFitHeight,hasRenderCallback:!!(i.userImage&&i.userImage.render)}:ue(`Image "${n}" 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.`)}return t}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let t=this.patterns[e],n=this.getImage(e);if(!n)return null;if(t&&t.position.version===n.version)return t.position;if(t)t.position.version=n.version;else{let i=n.data.width+Qu*2,o=n.data.height+Qu*2,a={w:i,h:o,x:0,y:0},s=new eo(a,n);this.patterns[e]={bin:a,position:s}}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 ve(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let o in this.patterns)e.push(this.patterns[o].bin);let{w:t,h:n}=Xa(e),i=this.atlasImage;i.resize({width:t||1,height:n||1});for(let o in this.patterns){let{bin:a}=this.patterns[o],s=a.x+Qu,l=a.y+Qu,u=this.getImage(o).data,c=u.width,p=u.height;Se.copy(u,i,{x:0,y:0},{x:s,y:l},{width:c,height:p}),Se.copy(u,i,{x:0,y:p-1},{x:s,y:l-1},{width:c,height:1}),Se.copy(u,i,{x:0,y:0},{x:s,y:l+p},{width:c,height:1}),Se.copy(u,i,{x:c-1,y:0},{x:s-1,y:l},{width:1,height:p}),Se.copy(u,i,{x:0,y:0},{x:s+c,y:l},{width:1,height:p})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this.callbackDispatchedThisFrame[t])continue;this.callbackDispatchedThisFrame[t]=!0;let n=this.getImage(t);n||ue(`Image with ID: "${t}" was not found`),Fx(n)&&this.updateImage(t,n)}}};d();d();async function Qx(r,e,t,n){let i=e*256,o=i+255,a=n.transformRequest(t.replace("{fontstack}",r).replace("{range}",`${i}-${o}`),"Glyphs"),s=await zy(a,new AbortController);if(!s||!s.data)throw new Error(`Could not load glyph range. range: ${e}, ${i}-${o}`);let l={};for(let u of Rx(s.data))l[u.id]=u;return l}d();var ts=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:i=.25,fontFamily:o="sans-serif",fontWeight:a="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=i,this.radius=n;let l=this.size=e+t*4,u=this._createCanvas(l),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${a} ${e}px ${o}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:i,actualBoundingBoxLeft:o,actualBoundingBoxRight:a}=this.ctx.measureText(e),s=Math.ceil(n),l=0,u=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-o))),c=Math.min(this.size-this.buffer,s+Math.ceil(i)),p=u+2*this.buffer,h=c+2*this.buffer,m=Math.max(p*h,0),f=new Uint8ClampedArray(m),y={data:f,width:p,height:h,glyphWidth:u,glyphHeight:c,glyphTop:s,glyphLeft:l,glyphAdvance:t};if(u===0||c===0)return y;let{ctx:g,buffer:_,gridInner:x,gridOuter:b}=this;g.clearRect(_,_,u,c),g.fillText(e,_,_+s);let v=g.getImageData(_,_,u,c);b.fill(1e20,0,m),x.fill(0,0,m);for(let P=0;P<c;P++)for(let S=0;S<u;S++){let T=v.data[4*(P*u+S)+3]/255;if(T===0)continue;let C=(P+_)*p+S+_;if(T===1)b[C]=0,x[C]=1e20;else{let A=.5-T;b[C]=A>0?A*A:0,x[C]=A<0?A*A:0}}eb(b,0,0,p,h,p,this.f,this.v,this.z),eb(x,_,_,u,c,p,this.f,this.v,this.z);for(let P=0;P<m;P++){let S=Math.sqrt(b[P])-Math.sqrt(x[P]);f[P]=Math.round(255-255*(S/this.radius+this.cutoff))}return y}};function eb(r,e,t,n,i,o,a,s,l){for(let u=e;u<e+n;u++)tb(r,t*o+u,o,i,a,s,l);for(let u=t;u<t+i;u++)tb(r,u*o+e,1,n,a,s,l)}function tb(r,e,t,n,i,o,a){o[0]=0,a[0]=-1e20,a[1]=1e20,i[0]=r[e];for(let s=1,l=0,u=0;s<n;s++){i[s]=r[e+s*t];let c=s*s;do{let p=o[l];u=(i[s]-i[p]+c-p*p)/(s-p)/2}while(u<=a[l]&&--l>-1);l++,o[l]=s,a[l]=u,a[l+1]=1e20}for(let s=0,l=0;s<n;s++){for(;a[l+1]<s;)l++;let u=o[l],c=s-u;r[e+s*t]=i[u]+c*c}}var io=class io{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}async getGlyphs(e){let t=[];for(let o in e)for(let a of e[o])t.push(this._getAndCacheGlyphsPromise(o,a));let n=await Promise.all(t),i={};for(let{stack:o,id:a,glyph:s}of n)i[o]||(i[o]={}),i[o][a]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return i}async _getAndCacheGlyphsPromise(e,t){let n=this.entries[e];n||(n=this.entries[e]={glyphs:{},requests:{},ranges:{}});let i=n.glyphs[t];if(i!==void 0)return{stack:e,id:t,glyph:i};if(i=this._tinySDF(n,e,t),i)return n.glyphs[t]=i,{stack:e,id:t,glyph:i};let o=Math.floor(t/256);if(o*256>65535)throw new Error("glyphs > 65535 not supported");if(n.ranges[o])return{stack:e,id:t,glyph:i};if(!this.url)throw new Error("glyphsUrl is not set");if(!n.requests[o]){let s=io.loadGlyphRange(e,o,this.url,this.requestManager);n.requests[o]=s}let a=await n.requests[o];for(let s in a)this._doesCharSupportLocalGlyph(+s)||(n.glyphs[+s]=a[+s]);return n.ranges[o]=!0,{stack:e,id:t,glyph:a[t]||null}}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))||Je["CJK Unified Ideographs"](e)||Je["Hangul Syllables"](e)||Je.Hiragana(e)||Je.Katakana(e)||Je["CJK Symbols and Punctuation"](e)||Je["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,t,n){let i=this.localIdeographFontFamily;if(!i||!this._doesCharSupportLocalGlyph(n))return;let o=2,a=e.tinySDF;if(!a){let c="400";/bold/i.test(t)?c="900":/medium/i.test(t)?c="500":/light/i.test(t)&&(c="200"),a=e.tinySDF=new io.TinySDF({fontSize:24*o,buffer:3*o,radius:8*o,cutoff:.25,fontFamily:i,fontWeight:c})}let s=a.draw(String.fromCharCode(n));return{id:n,bitmap:new ai({width:s.width||30*o,height:s.height||30*o},s.data),metrics:{width:s.glyphWidth/o||24,height:s.glyphHeight/o||24,left:s.glyphLeft/o+.5||0,top:s.glyphTop/o-27.5||-8,advance:s.glyphAdvance/o||24,isDoubleResolution:!0}}}};io.loadGlyphRange=Qx,io.TinySDF=ts;var tc=io;d();var tf=class{constructor(){this.specification=I.light.position}possiblyEvaluate(e,t){return vy(e.expression.evaluate(t))}interpolate(e,t,n){return{x:Me.number(e.x,t.x,n),y:Me.number(e.y,t.y,n),z:Me.number(e.z,t.z,n)}}},rb="-transition",ef,rc=class extends xe{constructor(e){super(),ef=ef||new Le({anchor:new Z(I.light.anchor),position:new tf,color:new Z(I.light.color),intensity:new Z(I.light.intensity)}),this._transitionable=new Mr(ef),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(Kg,e,t))for(let n in e){let i=e[n];n.endsWith(rb)?this._transitionable.setTransition(n.slice(0,-rb.length),i):this._transitionable.setValue(n,i)}}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,n){return n&&n.validate===!1?!1:hn(this,e.call(Ue,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:I}))}};d();var SE=new Le({"sky-color":new Z(I.sky["sky-color"]),"horizon-color":new Z(I.sky["horizon-color"]),"fog-color":new Z(I.sky["fog-color"]),"fog-ground-blend":new Z(I.sky["fog-ground-blend"]),"horizon-fog-blend":new Z(I.sky["horizon-fog-blend"]),"sky-horizon-blend":new Z(I.sky["sky-horizon-blend"]),"atmosphere-blend":new Z(I.sky["atmosphere-blend"])}),nb="-transition",nc=class extends xe{constructor(e){super(),this._transitionable=new Mr(SE),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new be(0))}setSky(e,t={}){if(!this._validate(Jg,e,t)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let n in e){let i=e[n];n.endsWith(nb)?this._transitionable.setTransition(n.slice(0,-nb.length),i):this._transitionable.setValue(n,i)}}}getSky(){return this._transitionable.serialize()}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,n={}){return n?.validate===!1?!1:hn(this,e.call(Ue,N({value:t,style:{glyphs:!0,sprite:!0},styleSpec:I})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}};d();var ic=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 n=e.join(",")+String(t);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(e,t)),this.dashEntry[n]}getDashRanges(e,t,n){let i=e.length%2===1,o=[],a=i?-e[e.length-1]*n:0,s=e[0]*n,l=!0;o.push({left:a,right:s,isDash:l,zeroLength:e[0]===0});let u=e[0];for(let c=1;c<e.length;c++){l=!l;let p=e[c];a=u*n,u+=p,s=u*n,o.push({left:a,right:s,isDash:l,zeroLength:p===0})}return o}addRoundDash(e,t,n){let i=t/2;for(let o=-n;o<=n;o++){let a=this.nextRow+n+o,s=this.width*a,l=0,u=e[l];for(let c=0;c<this.width;c++){c/u.right>1&&(u=e[++l]);let p=Math.abs(c-u.left),h=Math.abs(c-u.right),m=Math.min(p,h),f,y=o/n*(i+1);if(u.isDash){let g=i-Math.abs(y);f=Math.sqrt(m*m+g*g)}else f=i-Math.sqrt(m*m+y*y);this.data[s+c]=Math.max(0,Math.min(255,f+128))}}}addRegularDash(e){for(let s=e.length-1;s>=0;--s){let l=e[s],u=e[s+1];l.zeroLength?e.splice(s,1):u&&u.isDash===l.isDash&&(u.left=l.left,e.splice(s,1))}let t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);let i=this.width*this.nextRow,o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++o]);let l=Math.abs(s-a.left),u=Math.abs(s-a.right),c=Math.min(l,u),p=a.isDash?c:-c;this.data[i+s]=Math.max(0,Math.min(255,p+128))}}addDash(e,t){let n=t?7:0,i=2*n+1;if(this.nextRow+i>this.height)return ue("LineAtlas out of space"),null;let o=0;for(let s=0;s<e.length;s++)o+=e[s];if(o!==0){let s=this.width/o,l=this.getDashRanges(e,this.width,s);t?this.addRoundDash(l,s,n):this.addRegularDash(l)}let a={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:o};return this.nextRow+=i,this.dirty=!0,a}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))}};d();d();d();var oc=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var TE={once:!0},ac=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new oc(()=>this.process()),this.subscription=Do(this.target,"message",n=>this.receive(n),!1),this.globalScope=Br(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise((n,i)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=t?Do(t.signal,"abort",()=>{a?.unsubscribe(),delete this.resolveRejects[o];let u={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(u)},TE):null;this.resolveRejects[o]={resolve:u=>{a?.unsubscribe(),n(u)},reject:u=>{a?.unsubscribe(),i(u)}};let s=[],l={...e,id:o,sourceMapId:this.mapId,origin:location.origin,data:Vi(e.data,s)};this.target.postMessage(l,{transfer:s})})}receive(e){let t=e.data,n=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[n];let i=this.abortControllers[n];delete this.abortControllers[n],i&&i.abort();return}if(Br(self)||t.mustQueue){this.tasks[n]=t,this.taskQueue.push(n),this.invoker.trigger();return}this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if(t.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;t.error?o.reject(Ui(t.error)):o.resolve(Ui(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));return}let n=Ui(t.data),i=new AbortController;this.abortControllers[e]=i;try{let o=await this.messageHandlers[t.type](t.sourceMapId,n,i);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,t,n){let i=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Vi(t):null,data:Vi(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};d();d();d();d();var ib='(()=>{var Uy=Object.create;var ss=Object.defineProperty;var $y=Object.getOwnPropertyDescriptor;var jy=Object.getOwnPropertyNames;var qy=Object.getPrototypeOf,Wy=Object.prototype.hasOwnProperty;var ve=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xy=(t,e)=>{for(var r in e)ss(t,r,{get:e[r],enumerable:!0})},Hy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jy(e))!Wy.call(t,i)&&i!==r&&ss(t,i,{get:()=>e[i],enumerable:!(n=$y(e,i))||n.enumerable});return t};var Y=(t,e,r)=>(r=t!=null?Uy(qy(t)):{},Hy(e||!t||!t.__esModule?ss(r,"default",{value:t,enumerable:!0}):r,t));var ye=ve((p0,au)=>{"use strict";au.exports=hr;function hr(t,e){this.x=t,this.y=e}hr.prototype={clone:function(){return new hr(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}};hr.convert=function(t){return t instanceof hr?t:Array.isArray(t)?new hr(t[0],t[1]):t}});var uu=ve((f0,lu)=>{"use strict";lu.exports=su;function su(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}su.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 op=ve((Ov,el)=>{function Sg(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 el<"u"&&(el.exports=Sg)});var ap=ve((Gv,tl)=>{function wg(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 tl!==void 0&&(tl.exports=wg)});var rl=ve((Nv,ta)=>{var sp=op(),Ag=ap();ta.exports=sp;ta.exports.murmur3=sp;ta.exports.murmur2=Ag});var dl=ve((MS,jp)=>{"use strict";var cb=ye();jp.exports=Rr;function Rr(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(pb,this,e)}function pb(t,e,r){t==1?e.id=r.readVarint():t==2?fb(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function fb(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}}Rr.types=["Unknown","Point","LineString","Polygon"];Rr.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 cb(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};Rr.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]};Rr.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=Rr.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],g=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(g*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=yb(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 yb(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=mb(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 mb(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 gl=ve((LS,Wp)=>{"use strict";var hb=dl();Wp.exports=qp;function qp(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(db,this,e),this.length=this._features.length}function db(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(gb(r))}function gb(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}qp.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 hb(this._pbf,e,this.extent,this._keys,this._values)}});var Hp=ve((DS,Xp)=>{"use strict";var bb=gl();Xp.exports=xb;function xb(t,e){this.layers=t.readFields(vb,{},e)}function vb(t,e,r){if(t===3){var n=new bb(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var Rt=ve((BS,xa)=>{xa.exports.VectorTile=Hp();xa.exports.VectorTileFeature=dl();xa.exports.VectorTileLayer=gl()});var df=ve(Sl=>{Sl.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)};Sl.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,h=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]|=h*128}});var mi=ve((fA,Pf)=>{"use strict";Pf.exports=J;var Aa=df();function J(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var wl=65536*65536,gf=1/wl,Ob=12,vf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");J.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=_a(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xf(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_a(this.buf,this.pos)+_a(this.buf,this.pos+4)*wl;return this.pos+=8,t},readSFixed64:function(){var t=_a(this.buf,this.pos)+xf(this.buf,this.pos+4)*wl;return this.pos+=8,t},readFloat:function(){var t=Aa.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Aa.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,Gb(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!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Ob&&vf?ex(this.buf,e,t):Qb(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!==J.Bytes)return t.push(this.readVarint(e));var r=mt(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==J.Bytes)return t.push(this.readSVarint());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==J.Bytes)return t.push(this.readBoolean());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==J.Bytes)return t.push(this.readFloat());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==J.Bytes)return t.push(this.readDouble());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed32());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed32());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed64());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed64());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===J.Varint)for(;this.buf[this.pos++]>127;);else if(e===J.Bytes)this.pos=this.readVarint()+this.pos;else if(e===J.Fixed32)this.pos+=4;else if(e===J.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),Gr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Gr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Gr(this.buf,t&-1,this.pos),Gr(this.buf,Math.floor(t*gf),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Gr(this.buf,t&-1,this.pos),Gr(this.buf,Math.floor(t*gf),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Nb(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(!!t)},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=tx(this.buf,t,this.pos);var r=this.pos-e;r>=128&&bf(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Aa.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Aa.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&&bf(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,J.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,jb,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,qb,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Hb,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Wb,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Xb,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Zb,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Jb,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Yb,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Kb,e)},writeBytesField:function(t,e){this.writeTag(t,J.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,J.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,J.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,J.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};function Gb(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 Or(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function mt(t){return t.type===J.Bytes?t.readVarint()+t.pos:t.pos+1}function Or(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Nb(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),Ub(r,n,e),$b(n,e)}function Ub(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 $b(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 bf(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 jb(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function qb(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Wb(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Xb(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Hb(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Zb(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function Jb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Yb(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Kb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function _a(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Gr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function xf(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Qb(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 ex(t,e,r){return vf.decode(t.subarray(e,r))}function tx(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 gy=ve((iT,dy)=>{dy.exports=Ha;function Ha(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)Ha(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)Ha(t.geometries[n],e);else if(r==="Feature")Ha(t.geometry,e);else if(r==="Polygon")my(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)my(t.coordinates[n],e);return t}function my(t,e){if(t.length!==0){hy(t[0],e);for(var r=1;r<t.length;r++)hy(t[r],!e)}}function hy(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 Py=ve((sT,vy)=>{"use strict";var Ux=ye(),$x=Rt().VectorTileFeature;vy.exports=xy;function xy(t,e){this.options=e||{},this.features=t,this.length=t.length}xy.prototype.feature=function(t){return new Ja(this.features[t],this.options.extent)};function Ja(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}Ja.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 Ux(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};Ja.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]};Ja.prototype.toGeoJSON=$x.prototype.toGeoJSON});var Ay=ve((lT,Li)=>{var jx=mi(),wy=Py();Li.exports=Ul;Li.exports.fromVectorTileJs=Ul;Li.exports.fromGeojsonVt=qx;Li.exports.GeoJSONWrapper=wy;function Ul(t){var e=new jx;return Wx(t,e),e.finish()}function qx(t,e){e=e||{};var r={};for(var n in t)r[n]=new wy(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Ul({layers:r})}function Wx(t,e){for(var r in t.layers)e.writeMessage(3,Xx,t.layers[r])}function Xx(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,Hx,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,Yx,o[r])}function Hx(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Zx,t),e.writeVarintField(3,r.type),e.writeMessage(4,Jx,r)}function Zx(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>"u"&&(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>"u"&&(i.push(l),f=i.length-1,a[p]=f),e.writeVarint(f)}}}function Nl(t,e){return(e<<3)+(t&7)}function Sy(t){return t<<1^t>>31}function Jx(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(Nl(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint(Nl(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(Sy(f)),e.writeVarint(Sy(y)),i+=f,o+=y}n===3&&e.writeVarint(Nl(7,1))}}function Yx(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 km=Y(ye(),1),Pu=Y(uu(),1);var ls;function cu(){return ls==null&&(ls=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ls}var qi;function pu(){if(qi==null&&(qi=!1,cu())){let r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let i=0;i<5*5;i++){let o=i*4;r.fillStyle=`rgb(${o},${o+1},${o+2})`,r.fillRect(i%5,Math.floor(i/5),1,1)}let n=r.getImageData(0,0,5,5).data;for(let i=0;i<5*5*4;i++)if(i%4!==3&&n[i]!==i){qi=!0;break}}}return qi||!1}var Jr=1e-6,Yr=typeof Float32Array<"u"?Float32Array:Array,Kr=Math.random;var d0=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 Wi={};Xy(Wi,{add:()=>em,ceil:()=>tm,clone:()=>Jy,copy:()=>Ky,create:()=>fu,cross:()=>fm,dist:()=>Am,distance:()=>du,div:()=>wm,divide:()=>hu,dot:()=>pm,equals:()=>vm,exactEquals:()=>xm,floor:()=>rm,forEach:()=>Cm,fromValues:()=>Yy,inverse:()=>um,len:()=>Im,length:()=>bu,lerp:()=>ym,max:()=>im,min:()=>nm,mul:()=>Sm,multiply:()=>mu,negate:()=>lm,normalize:()=>cm,random:()=>mm,round:()=>om,scale:()=>am,scaleAndAdd:()=>sm,set:()=>Qy,sqrDist:()=>_m,sqrLen:()=>Tm,squaredDistance:()=>gu,squaredLength:()=>xu,str:()=>bm,sub:()=>Pm,subtract:()=>yu,transformMat4:()=>hm,transformQuat:()=>dm,zero:()=>gm});function fu(){var t=new Yr(4);return Yr!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Jy(t){var e=new Yr(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Yy(t,e,r,n){var i=new Yr(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function Ky(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Qy(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function em(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 yu(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 mu(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 hu(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 tm(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 rm(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 nm(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 im(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 om(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 am(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 sm(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 du(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 gu(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 bu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function xu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function lm(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function um(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 cm(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 pm(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function fm(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 ym(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 mm(t,e){e=e||1;var r,n,i,o,a,s;do r=Kr()*2-1,n=Kr()*2-1,a=r*r+n*n;while(a>=1);do i=Kr()*2-1,o=Kr()*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 hm(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 dm(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 gm(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function bm(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function xm(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function vm(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)<=Jr*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=Jr*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=Jr*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=Jr*Math.max(1,Math.abs(o),Math.abs(u))}var Pm=yu,Sm=mu,wm=hu,Am=du,_m=gu,Im=bu,Tm=xu,Cm=function(){var t=fu();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}}();function Su(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 Fm(t,e,r,n){let i=new Pu.default(t,e,r,n);return o=>i.solve(o)}var A0=Fm(.25,.1,.25,1);function it(t,e,r){return Math.min(r,Math.max(e,t))}function wu(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function de(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function Au(t){return Math.log(t)/Math.LN2%1===0}function tn(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function _u(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 nt(t){return Array.isArray(t)?t.map(nt):typeof t=="object"&&t?tn(t,nt):t}var vu={};function ce(t){vu[t]||(typeof console<"u"&&console.warn(t),vu[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 at(t){return typeof WorkerGlobalScope<"u"&&typeof t<"u"&&t instanceof WorkerGlobalScope}function vt(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function Em(t,e,r,n,i){let o=Math.max(-e,0)*4,l=(Math.max(0,r)-r)*n*4+o,u=n*4,c=Math.max(0,e),p=Math.max(0,r),f=Math.min(t.width,e+n),y=Math.min(t.height,r+i);return{rect:{x:c,y:p,width:f-c,height:y-p},layout:[{offset:l,stride:u}]}}async function Mm(t,e,r,n,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(t,{timestamp:0});try{let a=o?.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error(`Unrecognized format ${a}`);let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,Em(t,e,r,n,i)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}var Qr,en;function Lm(t,e,r,n,i){let o=t.width,a=t.height;(!Qr||!en)&&(Qr=new OffscreenCanvas(o,a),en=Qr.getContext("2d",{willReadFrequently:!0})),Qr.width=o,Qr.height=a,en.drawImage(t,0,0,o,a);let s=en.getImageData(e,r,n,i);return en.clearRect(0,0,o,a),s.data}async function Iu(t,e,r,n,i){if(pu())try{return await Mm(t,e,r,n,i)}catch{}return Lm(t,e,r,n,i)}function us(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}function cs(t){return t*Math.PI/180}var Xi=25,Hi=0;var $t=class t{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[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+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 h=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,h,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=3+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[3+a]=o,i.set(s,o),o+=s.length}return i[3+e.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+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 t(e.buffer)}};var Dm=8,Bm={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Vm={"*":{type:"source"}},Rm=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],zm={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:"*"}},Om={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:"*"}},Gm={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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Nm={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"}},Um={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"}}},$m={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"}}},jm={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},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"}},qm=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],Wm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Xm={"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"}},Hm={"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"}},Zm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Jm={"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"}},Ym={"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"}},Km={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},eh={type:"array",value:"*"},th={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},rh={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},nh={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},ih={type:"array",value:"*",minimum:1},oh={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}},ah={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sh={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},lh={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},uh=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],ch={"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"}},ph={"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"}},fh={"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"}},yh={"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"}},mh={"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"}},hh={"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"}},dh={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},gh={"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"}},bh={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},xh={"*":{type:"string"}},P={$version:Dm,$root:Bm,sources:Vm,source:Rm,source_vector:zm,source_raster:Om,source_raster_dem:Gm,source_geojson:Nm,source_video:Um,source_image:$m,layer:jm,layout:qm,layout_background:Wm,layout_fill:Xm,layout_circle:Hm,layout_heatmap:Zm,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Jm,layout_symbol:Ym,layout_raster:Km,layout_hillshade:Qm,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:eh,filter_operator:th,geometry_type:rh,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:nh,expression:ih,light:oh,sky:ah,terrain:sh,projection:lh,paint:uh,paint_fill:ch,"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:ph,paint_circle:fh,paint_heatmap:yh,paint_symbol:mh,paint_raster:hh,paint_hillshade:dh,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:gh,transition:bh,"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:xh},vh=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var C=class{constructor(e,r,n,i){this.message=(e?`${e}: `:"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function xr(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var Ve=class extends Error{constructor(e,r){super(r),this.message=r,this.key=e}},vs=class t{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new t(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}},wr={kind:"null"},k={kind:"number"},$={kind:"string"},U={kind:"boolean"},ze={kind:"color"},yo={kind:"projectionDefinition"},Wt={kind:"object"},N={kind:"value"},Ph={kind:"error"},mo={kind:"collator"},Ar={kind:"formatted"},ho={kind:"padding"},an={kind:"colorArray"},go={kind:"numberArray"},vn={kind:"resolvedImage"},bo={kind:"variableAnchorOffsetCollection"};function Ce(t,e){return{kind:"array",itemType:t,N:e}}function ie(t){if(t.kind==="array"){let e=ie(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var Sh=[wr,k,$,U,ze,yo,Ar,Wt,Ce(N),ho,go,an,vn,bo];function sn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!sn(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 Sh)if(!sn(r,e))return null}}return`Expected ${ie(t)} but found ${ie(e)} instead.`}function zs(t,e){return e.some(r=>r.kind===t.kind)}function Xt(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 Pt(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var Xu=.96422,Hu=1,Zu=.82521,Ju=4/29,br=6/29,Yu=3*br*br,wh=br*br*br,Ah=Math.PI/180,_h=180/Math.PI;function Ku(t){return t=t%360,t<0&&(t+=360),t}function Qu([t,e,r,n]){t=ps(t),e=ps(e),r=ps(r);let i,o,a=fs((.2225045*t+.7168786*e+.0606169*r)/Hu);t===e&&e===r?i=o=a:(i=fs((.4360747*t+.3850649*e+.1430804*r)/Xu),o=fs((.0139322*t+.0971045*e+.7141733*r)/Zu));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function ps(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fs(t){return t>wh?Math.pow(t,1/3):t/Yu+Ju}function ec([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=Hu*ms(i),o=Xu*ms(o),a=Zu*ms(a),[ys(3.1338561*o-1.6168667*i-.4906146*a),ys(-.9787684*o+1.9161415*i+.033454*a),ys(.0719453*o-.2289914*i+1.4052427*a),n]}function ys(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 ms(t){return t>br?t*t*t:Yu*(t-Ju)}function Ih(t){let[e,r,n,i]=Qu(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Ku(Math.atan2(n,r)*_h):NaN,o,e,i]}function Th([t,e,r,n]){return t=isNaN(t)?0:t*Ah,ec([r,Math.cos(t)*e,Math.sin(t)*e,n])}function Ch([t,e,r,n]){t=Ku(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]}var kh=Object.hasOwn||function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function nn(t,e){return kh(t,e)?t[e]:void 0}function Fh(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=nn(Eh,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[Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+=o)),Zi(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,h,g,d]=o,x=[u||" ",f||" ",h].join("");if(x===" "||x===" /"||x===",,"||x===",,,"){let b=[l,p,m].join(""),v=b==="%%%"?100:b===""?255:0;if(v){let S=[dr(+s/v,0,1),dr(+c/v,0,1),dr(+y/v,0,1),g?Tu(+g,d):1];if(Cu(S))return S}}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,dr(+s,0,100),dr(+u,0,100),p?Tu(+p,f):1];if(Cu(m))return Ch(m)}}}function Zi(t){return parseInt(t.padEnd(2,t),16)/255}function Tu(t,e){return dr(e?t/100:t,0,1)}function dr(t,e,r){return Math.min(Math.max(e,t),r)}function Cu(t){return!t.some(Number.isNaN)}var Eh={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]};function wt(t,e,r){return t+r*(e-t)}function vr(t,e,r){return t.map((n,i)=>wt(n,e[i],r))}function Mh(t){return t==="rgb"||t==="hcl"||t==="lab"}var H=class t{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 t)return e;if(typeof e!="string")return;let r=Fh(e);if(r)return new t(...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",Ih(this.rgb))}get lab(){return this.overwriteGetter("lab",Qu(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})`}static interpolate(e,r,n,i="rgb"){switch(i){case"rgb":{let[o,a,s,l]=vr(e.rgb,r.rgb,n);return new t(o,a,s,l,!1)}case"hcl":{let[o,a,s,l]=e.hcl,[u,c,p,f]=r.hcl,y,m;if(!isNaN(o)&&!isNaN(u)){let b=u-o;u>o&&b>180?b-=360:u<o&&o-u>180&&(b+=360),y=o+n*b}else isNaN(o)?isNaN(u)?y=NaN:(y=u,(s===1||s===0)&&(m=c)):(y=o,(p===1||p===0)&&(m=a));let[h,g,d,x]=Th([y,m??wt(a,c,n),wt(s,p,n),wt(l,f,n)]);return new t(h,g,d,x,!1)}case"lab":{let[o,a,s,l]=ec(vr(e.lab,r.lab,n));return new t(o,a,s,l,!1)}}}};H.black=new H(0,0,0,1);H.white=new H(1,1,1,1);H.transparent=new H(0,0,0,0);H.red=new H(1,0,0,1);var ln=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}},Lh=["bottom","center","top"],un=class{constructor(e,r,n,i,o,a){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o,this.verticalAlign=a}},Fe=class t{constructor(e){this.sections=e}static fromString(e){return new t([new un(e,null,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 t?e:t.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Oe=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([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 t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(vr(e.values,r.values,n))}},Ge=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(vr(e.values,r.values,n))}},Pe=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="string"){let n=H.parse(e);return n?new t([n]):void 0}if(!Array.isArray(e))return;let r=[];for(let n of e){if(typeof n!="string")return;let i=H.parse(n);if(!i)return;r.push(i)}return new t(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n,i="rgb"){let o=[];if(e.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)o.push(H.interpolate(e.values[a],r.values[a],n,i));return new t(o)}},ne=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},Dh=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Ee=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)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"||!Dh.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){let i=e.values,o=r.values;if(i.length!==o.length)throw new ne(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`);let a=[];for(let s=0;s<i.length;s+=2){if(i[s]!==o[s])throw new ne(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${i[s]}, to[${s}]: ${o[s]}`);a.push(i[s]);let[l,u]=i[s+1],[c,p]=o[s+1];a.push([wt(l,c,n),wt(u,p,n)])}return new t(a)}},Se=class t{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}},At=class t{constructor(e,r,n){this.from=e,this.to=r,this.transition=n}static interpolate(e,r,n){return new t(e,r,n)}static parse(e){if(e instanceof t)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new t(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new t(e.from,e.to,e.transition);if(typeof e=="string")return new t(e,e,1)}};function tc(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>"u"||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 cn(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof At||t instanceof H||t instanceof ln||t instanceof Fe||t instanceof Oe||t instanceof Ge||t instanceof Pe||t instanceof Ee||t instanceof Se)return!0;if(Array.isArray(t)){for(let e of t)if(!cn(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!cn(t[e]))return!1;return!0}else return!1}function ue(t){if(t===null)return wr;if(typeof t=="string")return $;if(typeof t=="boolean")return U;if(typeof t=="number")return k;if(t instanceof H)return ze;if(t instanceof At)return yo;if(t instanceof ln)return mo;if(t instanceof Fe)return Ar;if(t instanceof Oe)return ho;if(t instanceof Ge)return go;if(t instanceof Pe)return an;if(t instanceof Ee)return bo;if(t instanceof Se)return vn;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=ue(n);if(!r)r=i;else{if(r===i)continue;r=N;break}}return Ce(r||N,e)}else return Wt}function on(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof H||t instanceof At||t instanceof Fe||t instanceof Oe||t instanceof Ge||t instanceof Pe||t instanceof Ee||t instanceof Se?t.toString():JSON.stringify(t)}var _t=class t{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(!cn(e[1]))return r.error("invalid value");let n=e[1],i=ue(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 t(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Ji={string:$,number:k,boolean:U,object:Wt},$e=class t{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 Ji)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=Ji[u],n++}else s=N;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=Ce(s,l)}else{if(!Ji[o])throw new Error(`Types doesn\'t contain name = ${o}`);i=Ji[o]}let a=[];for(;n<e.length;n++){let s=r.parse(e[n],n,N);if(!s)return null;a.push(s)}return new t(i,a)}evaluate(e){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(e);if(sn(this.type,ue(n))){if(r===this.args.length-1)throw new ne(`Expected value to be of type ${ie(this.type)}, but found ${ie(ue(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},ku={"to-boolean":U,"to-color":ze,"to-number":k,"to-string":$},St=class t{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(!ku[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=ku[n],o=[];for(let a=1;a<e.length;a++){let s=r.parse(e[a],a,N);if(!s)return null;o.push(s)}return new t(i,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!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 H)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 rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:n=tc(r[0],r[1],r[2],r[3]),!n))return new H(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ne(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=Oe.parse(r);if(i)return i}throw new ne(`Could not parse padding from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"numberArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ge.parse(r);if(i)return i}throw new ne(`Could not parse numberArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"colorArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Pe.parse(r);if(i)return i}throw new ne(`Could not parse colorArray 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=Ee.parse(r);if(i)return i}throw new ne(`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 ne(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Fe.fromString(on(this.args[0].evaluate(e)));case"resolvedImage":return Se.fromString(on(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return on(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Bh=["Unknown","Point","LineString","Polygon"],eo=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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"?Bh[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.get(e);return r||(r=H.parse(e),this._parseColorCache.set(e,r)),r}},to=class t{constructor(e,r,n=[],i,o=new vs,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 $e(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==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof _t)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new eo;try{a=new _t(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>"u"?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 t(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 Ve(n,e))}checkSubtype(e,r){let n=sn(e,r);return n&&this.error(n),n}},ro=class t{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 t(n,i):null}outputDefined(){return this.result.outputDefined()}},no=class t{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 t(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}},Ps=class t{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,k),i=r.parse(e[2],2,Ce(r.expectedType||N));if(!n||!i)return null;let o=i.type;return new t(o.itemType,n,i)}evaluate(e){let r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new ne(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new ne(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new ne(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Ss=class t{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,N),i=r.parse(e[2],2,N);return!n||!i?null:zs(n.type,[U,$,k,wr,N])?new t(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(n.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!Xt(r,["boolean","string","number","null"]))throw new ne(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ue(r))} instead.`);if(!Xt(n,["string","array"]))throw new ne(`Expected second argument to be of type array or string, but found ${ie(ue(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},ws=class t{constructor(e,r,n){this.type=k,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,N),i=r.parse(e[2],2,N);if(!n||!i)return null;if(!zs(n.type,[U,$,k,wr,N]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(n.type)} instead`);if(e.length===4){let o=r.parse(e[3],3,k);return o?new t(n,i,o):null}else return new t(n,i)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!Xt(r,["boolean","string","number","null"]))throw new ne(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ue(r))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),Xt(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(Xt(n,["array"]))return n.indexOf(r,i);throw new ne(`Expected second argument to be of type array or string, but found ${ie(ue(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},As=class t{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=ue(m);else if(f.checkSubtype(n,ue(m)))return null;if(typeof o[String(m)]<"u")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,N);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 t(n,i,s,o,a,l)}evaluate(e){let r=this.input.evaluate(e);return(ue(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()}},_s=class t{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 t(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()}},Is=class t{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,N),i=r.parse(e[2],2,k);if(!n||!i)return null;if(!zs(n.type,[Ce(N),$,N]))return r.error(`Expected first argument to be of type array or string, but found ${ie(n.type)} instead`);if(e.length===4){let o=r.parse(e[3],3,k);return o?new t(n.type,n,i,o):null}else return new t(n.type,n,i)}evaluate(e){let r=this.input.evaluate(e),n=this.beginIndex.evaluate(e),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),Xt(r,["string"]))return[...r].slice(n,i).join("");if(Xt(r,["array"]))return r.slice(n,i);throw new ne(`Expected first argument to be of type array or string, but found ${ie(ue(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function xo(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 ne("Input is not a number.");return 0}var Pr=class t{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,k);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 t(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=xo(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 Vh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hs,Fu;function Rh(){if(Fu)return hs;Fu=1,hs=t;function t(e,r,n,i){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(i-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=n,this.p2y=i}return t.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,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<r)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n=n-o/a}var s=0,l=1;for(n=e,i=0;i<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<r));i++)e>o?s=n:l=n,n=(l-s)*.5+s;return n},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},hs}var zh=Rh(),Oh=Vh(zh),ke=class t{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=ds(r,e.base,n,i);else if(e.name==="linear")o=ds(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Oh(a[0],a[1],a[2],a[3]).solve(ds(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,k),!o)return null;let s=[],l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&r.expectedType!=an?l=ze: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!Pt(l,k)&&!Pt(l,yo)&&!Pt(l,ze)&&!Pt(l,ho)&&!Pt(l,go)&&!Pt(l,an)&&!Pt(l,bo)&&!Pt(l,Ce(k))?r.error(`Type ${ie(l)} is not interpolatable.`):new t(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=xo(r,i),s=r[a],l=r[a+1],u=t.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(e),p=n[a+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return wt(c,p,u);case"color":return H.interpolate(c,p,u);case"padding":return Oe.interpolate(c,p,u);case"colorArray":return Pe.interpolate(c,p,u);case"numberArray":return Ge.interpolate(c,p,u);case"variableAnchorOffsetCollection":return Ee.interpolate(c,p,u);case"array":return vr(c,p,u);case"projectionDefinition":return At.interpolate(c,p,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return H.interpolate(c,p,u,"hcl");case"colorArray":return Pe.interpolate(c,p,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return H.interpolate(c,p,u,"lab");case"colorArray":return Pe.interpolate(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 ds(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 lt={color:H.interpolate,number:wt,padding:Oe.interpolate,numberArray:Ge.interpolate,colorArray:Pe.interpolate,variableAnchorOffsetCollection:Ee.interpolate,array:vr},io=class t{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=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=>sn(i,s.type))?new t(N,o):new t(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 Se&&!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())}};function Eu(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 Gh(t,e,r){return e===r}function Nh(t,e,r){return e!==r}function Uh(t,e,r){return e<r}function $h(t,e,r){return e>r}function jh(t,e,r){return e<=r}function qh(t,e,r){return e>=r}function rc(t,e,r,n){return n.compare(e,r)===0}function Wh(t,e,r,n){return!rc(t,e,r,n)}function Xh(t,e,r,n){return n.compare(e,r)<0}function Hh(t,e,r,n){return n.compare(e,r)>0}function Zh(t,e,r,n){return n.compare(e,r)<=0}function Jh(t,e,r,n){return n.compare(e,r)>=0}function _r(t,e,r){let n=t!=="=="&&t!=="!=";return class nc{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,N);if(!l)return null;if(!Eu(s,l.type))return a.concat(1).error(`"${s}" comparisons are not supported for type \'${ie(l.type)}\'.`);let u=a.parse(o[2],2,N);if(!u)return null;if(!Eu(s,u.type))return a.concat(2).error(`"${s}" comparisons are not supported for type \'${ie(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error(`Cannot compare types \'${ie(l.type)}\' and \'${ie(u.type)}\'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new $e(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new $e(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,mo),!c)return null}return new nc(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new ne(`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=ue(a),u=ue(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 Yh=_r("==",Gh,rc),Kh=_r("!=",Nh,Wh),Qh=_r("<",Uh,Xh),ed=_r(">",$h,Hh),td=_r("<=",jh,Zh),rd=_r(">=",qh,Jh),oo=class t{constructor(e,r,n){this.type=mo,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,$),!a)?null:new t(i,o,a)}evaluate(e){return new ln(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}},Ts=class t{constructor(e,r,n,i,o){this.type=$,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,k);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,$),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,$),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,k),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,k),!l)?null:new t(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}},pn=class t{constructor(e){this.type=Ar,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,k),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Ce($)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,ze),!c))return null;let p=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!Lh.includes(s["vertical-align"]))return r.error(`\'vertical-align\' must be one of: \'bottom\', \'center\', \'top\' but found \'${s["vertical-align"]}\' instead.`);if(p=r.parse(s["vertical-align"],1,$),!p)return null}let f=i[i.length-1];f.scale=l,f.font=u,f.textColor=c,f.verticalAlign=p}else{let l=r.parse(e[a],1,N);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,verticalAlign:null})}}return new t(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return ue(i)===vn?new un("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new un(on(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new Fe(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),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}},Cs=class t{constructor(e){this.type=vn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,$);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Se.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},ks=class t{constructor(e){this.type=k,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 ${ie(n.type)} instead.`):new t(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 ne(`Expected value to be of type string or array, but found ${ie(ue(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},He=8192;function nd(t,e){let r=id(t[0]),n=ad(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*He),Math.round(n*i*He)]}function Os(t,e){let r=Math.pow(2,e.z),n=(t[0]/He+e.x)/r,i=(t[1]/He+e.y)/r;return[od(n),sd(i)]}function id(t){return(180+t)/360}function od(t){return t*360-180}function ad(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function sd(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function Pn(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 fn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ld(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 ud(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 vo(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return yd(o,i)===0?!1:!!(Mu(t,e,r,n)&&Mu(r,n,t,e))}function cd(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(vo(t,e,n[i],n[i+1]))return!0;return!1}function Ir(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(ud(t,i[o],i[o+1]))return r;ld(t,i[o],i[o+1])&&(n=!n)}return n}function pd(t,e){for(let r of e)if(Ir(t,r))return!0;return!1}function ic(t,e){for(let r of t)if(!Ir(r,e))return!1;for(let r=0;r<t.length-1;++r)if(cd(t[r],t[r+1],e))return!1;return!0}function fd(t,e){for(let r of e)if(ic(t,r))return!0;return!1}function yd(t,e){return t[0]*e[1]-t[1]*e[0]}function Mu(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 Gs(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=nd(t[i][a],r);Pn(e,s),o.push(s)}n.push(o)}return n}function oc(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=Gs(t[i],e,r);n.push(o)}return n}function ac(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}Pn(e,t)}function md(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function Lu(t,e,r,n){let i=Math.pow(2,n.z)*He,o=[n.x*He,n.y*He],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];ac(u,e,r,i),a.push(u)}return a}function Du(t,e,r,n){let i=Math.pow(2,n.z)*He,o=[n.x*He,n.y*He],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Pn(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){md(e);for(let s of a)for(let l of s)ac(l,e,r,i)}return a}function hd(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=Gs(e.coordinates,n,i),a=Lu(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!Ir(s,o))return!1}if(e.type==="MultiPolygon"){let o=oc(e.coordinates,n,i),a=Lu(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!pd(s,o))return!1}return!0}function dd(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=Gs(e.coordinates,n,i),a=Du(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!ic(s,o))return!1}if(e.type==="MultiPolygon"){let o=oc(e.coordinates,n,i),a=Du(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!fd(s,o))return!1}return!0}var yn=class t{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(cn(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let o of n.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&i.push(s),a==="MultiPolygon"&&i.push(...s)}if(i.length){let o={type:"MultiPolygon",coordinates:i};return new t(n,o)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new t(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new t(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 hd(e,this.geometries);if(e.geometryType()==="LineString")return dd(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},ao=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){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._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--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=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};function sc(t,e,r=0,n=t.length-1,i=gd){for(;n>r;){if(n-r>600){let l=n-r+1,u=e-r+1,c=Math.log(l),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(l-p)/l)*(u-l/2<0?-1:1),y=Math.max(r,Math.floor(e-u*p/l+f)),m=Math.min(n,Math.floor(e+(l-u)*p/l+f));sc(t,e,y,m,i)}let o=t[e],a=r,s=n;for(rn(t,r,e),i(t[n],o)>0&&rn(t,r,n);a<s;){for(rn(t,a,s),a++,s--;i(t[a],o)<0;)a++;for(;i(t[s],o)>0;)s--}i(t[r],o)===0?rn(t,r,s):(s++,rn(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}}function rn(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function gd(t,e){return t<e?-1:t>e?1:0}function Yt(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=xd(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[a]):i.push(a))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(sc(n[a],e,1,n[a].length-1,bd),n[a]=n[a].slice(0,e));return n}function bd(t,e){return e.area-t.area}function xd(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}var vd=6378.137,Bu=1/298.257223563,Vu=Bu*(2-Bu),Ru=Math.PI/180,mn=class{constructor(e){let r=Ru*vd*1e3,n=Math.cos(e*Ru),i=1/(1-Vu*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-Vu)}distance(e,r){let n=this.wrap(e[0]-r[0])*this.kx,i=(e[1]-r[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,r){let n=1/0,i,o,a,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,f=(e[l+1][1]-c)*this.ky,y=0;(p!==0||f!==0)&&(y=(this.wrap(r[0]-u)*this.kx*p+(r[1]-c)*this.ky*f)/(p*p+f*f),y>1?(u=e[l+1][0],c=e[l+1][1]):y>0&&(u+=p/this.kx*y,c+=f/this.ky*y)),p=this.wrap(r[0]-u)*this.kx,f=(r[1]-c)*this.ky;let m=p*p+f*f;m<n&&(n=m,i=u,o=c,a=l,s=y)}return{point:[i,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},Fs=100,Es=50;function lc(t,e){return e[0]-t[0]}function so(t){return t[1]-t[0]+1}function st(t,e){return t[1]>=t[0]&&t[1]<e}function Ms(t,e){if(t[0]>t[1])return[null,null];let r=so(t);if(e){if(r===2)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(r===1)return[t,null];let n=Math.floor(r/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function Ls(t,e){if(!st(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Pn(r,t[n]);return r}function Ds(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)Pn(e,n);return e}function zu(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Ns(t,e,r){if(!zu(t)||!zu(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function qt(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function Us(t,e,r,n,i){let o=Math.min(qt(t,[r,n],i),qt(e,[r,n],i)),a=Math.min(qt(r,[t,e],i),qt(n,[t,e],i));return Math.min(o,a)}function Pd(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let l=t[s],u=t[s+1];for(let c=n[0];c<n[1];++c){let p=r[c],f=r[c+1];if(vo(l,u,p,f))return 0;a=Math.min(a,Us(l,u,p,f,i))}}return a}function Sd(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let l=n[0];l<=n[1];++l)if(a=Math.min(a,i.distance(t[s],r[l])),a===0)return a;return a}function wd(t,e,r){if(Ir(t,e,!0))return 0;let n=1/0;for(let i of e){let o=i[0],a=i[i.length-1];if(o!==a&&(n=Math.min(n,qt(t,[a,o],r)),n===0))return n;let s=r.pointOnLine(i,t);if(n=Math.min(n,r.distance(t,s.point)),n===0)return n}return n}function Ad(t,e,r,n){if(!st(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Ir(t[o],r,!0))return 0;let i=1/0;for(let o=e[0];o<e[1];++o){let a=t[o],s=t[o+1];for(let l of r)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let f=l[p],y=l[u];if(vo(a,s,f,y))return 0;i=Math.min(i,Us(a,s,f,y,n))}}return i}function Ou(t,e){for(let r of t)for(let n of r)if(Ir(n,e,!0))return!0;return!1}function _d(t,e,r,n=1/0){let i=Ds(t),o=Ds(e);if(n!==1/0&&Ns(i,o,r)>=n)return n;if(fn(i,o)){if(Ou(t,e))return 0}else if(Ou(e,t))return 0;let a=1/0;for(let s of t)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],f=s[l];for(let y of e)for(let m=0,h=y.length,g=h-1;m<h;g=m++){let d=y[g],x=y[m];if(vo(p,f,d,x))return 0;a=Math.min(a,Us(p,f,d,x,r))}}return a}function Gu(t,e,r,n,i,o){if(!o)return;let a=Ns(Ls(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function Yi(t,e,r,n,i,o,a){if(!o||!a)return;let s=Ns(Ls(n,o),Ls(i,a),r);s<e&&t.push([s,o,a])}function lo(t,e,r,n,i=1/0){let o=Math.min(n.distance(t[0],r[0][0]),i);if(o===0)return o;let a=new ao([[0,[0,t.length-1],[0,0]]],lc),s=Ds(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?Es:Fs;if(so(u)<=c){if(!st(u,t.length))return NaN;if(e){let p=Ad(t,u,r,n);if(isNaN(p)||p===0)return p;o=Math.min(o,p)}else for(let p=u[0];p<=u[1];++p){let f=wd(t[p],r,n);if(o=Math.min(o,f),o===0)return 0}}else{let p=Ms(u,e);Gu(a,o,n,t,s,p[0]),Gu(a,o,n,t,s,p[1])}}return o}function uo(t,e,r,n,i,o=1/0){let a=Math.min(o,i.distance(t[0],r[0]));if(a===0)return a;let s=new ao([[0,[0,t.length-1],[0,r.length-1]]],lc);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?Es:Fs,f=n?Es:Fs;if(so(u)<=p&&so(c)<=f){if(!st(u,t.length)&&st(c,r.length))return NaN;let y;if(e&&n)y=Pd(t,u,r,c,i),a=Math.min(a,y);else if(e&&!n){let m=t.slice(u[0],u[1]+1);for(let h=c[0];h<=c[1];++h)if(y=qt(r[h],m,i),a=Math.min(a,y),a===0)return a}else if(!e&&n){let m=r.slice(c[0],c[1]+1);for(let h=u[0];h<=u[1];++h)if(y=qt(t[h],m,i),a=Math.min(a,y),a===0)return a}else y=Sd(t,u,r,c,i),a=Math.min(a,y)}else{let y=Ms(u,e),m=Ms(c,n);Yi(s,a,i,t,r,y[0],m[0]),Yi(s,a,i,t,r,y[0],m[1]),Yi(s,a,i,t,r,y[1],m[0]),Yi(s,a,i,t,r,y[1],m[1])}}return a}function Id(t,e){let r=t.geometry(),n=r.flat().map(a=>Os([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new mn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,uo(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,uo(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,lo(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function Td(t,e){let r=t.geometry(),n=r.flat().map(a=>Os([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new mn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,uo(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,uo(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,lo(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function Cd(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=Yt(r,0).map(a=>a.map(s=>s.map(l=>Os([l.x,l.y],t.canonical)))),i=new mn(n[0][0][0][1]),o=1/0;for(let a of e)for(let s of n){switch(a.type){case"Point":o=Math.min(o,lo([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,lo(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,_d(s,a.coordinates,i,o));break}if(o===0)return o}return o}function gs(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var hn=class t{constructor(e,r){this.type=k,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'distance\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(cn(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>gs(i.geometry)).flat());if(n.type==="Feature")return new t(n,gs(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,gs(n))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Id(e,this.geometries);if(e.geometryType()==="LineString")return Td(e,this.geometries);if(e.geometryType()==="Polygon")return Cd(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},dn=class t{constructor(e){this.type=N,this.key=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=e[1];return n==null?r.error("Global state property must be defined."):typeof n!="string"?r.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new t(n)}evaluate(e){var r;let n=(r=e.globals)===null||r===void 0?void 0:r.globalState;return!n||Object.keys(n).length===0?null:nn(n,this.key)}eachChild(){}outputDefined(){return!1}},Kt={"==":Yh,"!=":Kh,">":ed,"<":Qh,">=":rd,"<=":td,array:$e,at:Ps,boolean:$e,case:_s,coalesce:io,collator:oo,format:pn,image:Cs,in:Ss,"index-of":ws,interpolate:ke,"interpolate-hcl":ke,"interpolate-lab":ke,length:ks,let:ro,literal:_t,match:As,number:$e,"number-format":Ts,object:$e,slice:Is,step:Pr,string:$e,"to-boolean":St,"to-color":St,"to-number":St,"to-string":St,var:no,within:yn,distance:hn,"global-state":dn},Ze=class t{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=t.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 to(r.registry,co,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<e.length;y++){let m=e[y],h=Array.isArray(u)?u[y-1]:u.type,g=l.parse(m,1+p.length,h);if(!g){f=!0;break}p.push(g)}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,h=p[y];l.concat(y+1).checkSubtype(m,h.type)}if(l.errors.length===0)return new t(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>Fd(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(ie(y.type))}r.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function Nu(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=tc(e,r,n,o);if(a)throw new ne(a);return new H(e/255,r/255,n/255,o,!1)}function Uu(t,e){return t in e}function bs(t,e){let r=e[t];return typeof r>"u"?null:r}function kd(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 jt(t){return{type:t}}Ze.register(Kt,{error:[Ph,[$],(t,[e])=>{throw new ne(e.evaluate(t))}],typeof:[$,[N],(t,[e])=>ie(ue(e.evaluate(t)))],"to-rgba":[Ce(k,4),[ze],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[ze,[k,k,k],Nu],rgba:[ze,[k,k,k,k],Nu],has:{type:U,overloads:[[[$],(t,[e])=>Uu(e.evaluate(t),t.properties())],[[$,Wt],(t,[e,r])=>Uu(e.evaluate(t),r.evaluate(t))]]},get:{type:N,overloads:[[[$],(t,[e])=>bs(e.evaluate(t),t.properties())],[[$,Wt],(t,[e,r])=>bs(e.evaluate(t),r.evaluate(t))]]},"feature-state":[N,[$],(t,[e])=>bs(e.evaluate(t),t.featureState||{})],properties:[Wt,[],t=>t.properties()],"geometry-type":[$,[],t=>t.geometryType()],id:[N,[],t=>t.id()],zoom:[k,[],t=>t.globals.zoom],"heatmap-density":[k,[],t=>t.globals.heatmapDensity||0],elevation:[k,[],t=>t.globals.elevation||0],"line-progress":[k,[],t=>t.globals.lineProgress||0],accumulated:[N,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[k,jt(k),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[k,jt(k),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:k,overloads:[[[k,k],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[k],(t,[e])=>-e.evaluate(t)]]},"/":[k,[k,k],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[k,[k,k],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[k,[],()=>Math.LN2],pi:[k,[],()=>Math.PI],e:[k,[],()=>Math.E],"^":[k,[k,k],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[k,[k],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[k,[k],(t,[e])=>Math.log(e.evaluate(t))],log2:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[k,[k],(t,[e])=>Math.sin(e.evaluate(t))],cos:[k,[k],(t,[e])=>Math.cos(e.evaluate(t))],tan:[k,[k],(t,[e])=>Math.tan(e.evaluate(t))],asin:[k,[k],(t,[e])=>Math.asin(e.evaluate(t))],acos:[k,[k],(t,[e])=>Math.acos(e.evaluate(t))],atan:[k,[k],(t,[e])=>Math.atan(e.evaluate(t))],min:[k,jt(k),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[k,jt(k),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[k,[k],(t,[e])=>Math.abs(e.evaluate(t))],round:[k,[k],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[k,[k],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[k,[k],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[$,N],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[N],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[$],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[N],(t,[e])=>e.value in t.properties()],"filter-has-id":[U,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[U,[Ce($)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Ce(N)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[$,Ce(N)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[$,Ce(N)],(t,[e,r])=>kd(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)],[jt(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)],[jt(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,[$],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[$,[$],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[$,[$],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[$,jt(N),(t,e)=>e.map(r=>on(r.evaluate(t))).join("")],"resolved-locale":[$,[mo],(t,[e])=>e.evaluate(t).resolvedLocale()]});function Fd(t){return Array.isArray(t)?`(${t.map(ie).join(", ")})`:`(${ie(t.type)}...)`}function co(t){if(t instanceof no)return co(t.boundExpression);if(t instanceof Ze&&t.name==="error")return!1;if(t instanceof oo)return!1;if(t instanceof yn)return!1;if(t instanceof hn)return!1;if(t instanceof dn)return!1;let e=t instanceof St||t instanceof $e,r=!0;return t.eachChild(n=>{e?r=r&&co(n):r=r&&n instanceof _t}),r?Po(t)&&So(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Po(t){if(t instanceof Ze){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 yn||t instanceof hn)return!1;let e=!0;return t.eachChild(r=>{e&&!Po(r)&&(e=!1)}),e}function gn(t){if(t instanceof Ze&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!gn(r)&&(e=!1)}),e}function So(t,e){if(t instanceof Ze&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!So(n,e)&&(r=!1)}),r}function Bs(t){return{result:"success",value:t}}function gr(t){return{result:"error",value:t}}function It(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function uc(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function $s(t){return!!t.expression&&t.expression.interpolated}function j(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function wo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&ue(t)===Wt}function Ed(t){return t}function Md(t){switch(t.type){case"color":return H.parse;case"padding":return Oe.parse;case"numberArray":return Ge.parse;case"colorArray":return Pe.parse;default:return null}}function Ld(t){switch(t){case"exponential":return pc;case"interval":return Bd;case"categorical":return Dd;case"identity":return Vd;default:throw new Error(`Unknown function type "${t}"`)}}function cc(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",n=r||t.property!==void 0,i=r||!n,o=t.type||($s(e)?"exponential":"interval"),a=Md(e);if(a&&(t=xr({},t),t.stops&&(t.stops=t.stops.map(c=>[c[0],a(c[1])])),t.default?t.default=a(t.default):t.default=a(e.default)),t.colorSpace&&!Mh(t.colorSpace))throw new Error(`Unknown color space: "${t.colorSpace}"`);let s=Ld(o),l,u;if(o==="categorical"){l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}if(r){let c={},p=[];for(let m=0;m<t.stops.length;m++){let h=t.stops[m],g=h[0].zoom;c[g]===void 0&&(c[g]={zoom:g,type:t.type,property:t.property,default:t.default,stops:[]},p.push(g)),c[g].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,cc(c[m],e)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:ke.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return pc({stops:f,base:t.base},e,m).evaluate(m,h)}}}else if(i){let c=o==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:ke.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?Sn(t.default,e.default):s(t,e,f,l,u)}}}function Sn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Dd(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return Sn(o,t.default,e.default)}function Bd(t,e,r){if(j(r)!=="number")return Sn(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=xo(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function pc(t,e,r){let n=t.base!==void 0?t.base:1;if(j(r)!=="number")return Sn(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=xo(t.stops.map(c=>c[0]),r),a=Rd(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=lt[e.type]||Ed;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 Vd(t,e,r){switch(e.type){case"color":r=H.parse(r);break;case"formatted":r=Fe.fromString(r.toString());break;case"resolvedImage":r=Se.fromString(r.toString());break;case"padding":r=Oe.parse(r);break;case"colorArray":r=Pe.parse(r);break;case"numberArray":r=Ge.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return Sn(r,t.default,e.default)}function Rd(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 Ht=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new eo,this._defaultValue=r?Od(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 ne(`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<"u"&&console.warn(s.message)),this._defaultValue}}};function wn(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Kt}function Qt(t,e){let r=new to(Kt,co,[],e?zd(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Bs(new Ht(n,e)):gr(r.errors)}var Je=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!gn(r.expression),this.globalStateRefs=Ao(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)}},Tt=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!gn(r.expression),this.globalStateRefs=Ao(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?ke.interpolationFactor(this.interpolationType,e,r,n):0}};function fc(t){return t._styleExpression!==void 0}function yc(t,e){let r=Qt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Po(n);if(!i&&!It(e))return gr([new Ve("","data expressions not supported")]);let o=So(n,["zoom"]);if(!o&&!uc(e))return gr([new Ve("","zoom expressions not supported")]);let a=Qi(n);if(!a&&!o)return gr([new Ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Ve)return gr([a]);if(a instanceof ke&&!$s(e))return gr([new Ve("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return Bs(i?new Je("constant",r.value):new Je("source",r.value));let s=a instanceof ke?a.interpolation:void 0;return Bs(i?new Tt("camera",r.value,a.labels,s):new Tt("composite",r.value,a.labels,s))}var bn=class t{constructor(e,r){this._parameters=e,this._specification=r,xr(this,cc(this._parameters,this._specification))}static deserialize(e){return new t(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function mc(t,e){if(wo(t))return new bn(t,e);if(wn(t)){let r=yc(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=H.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=Oe.parse(t):e.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?r=Ge.parse(t):e.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?r=Pe.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?r=Ee.parse(t):e.type==="projectionDefinition"&&typeof t=="string"&&(r=At.parse(t)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function Qi(t){let e=null;if(t instanceof ro)e=Qi(t.result);else if(t instanceof io){for(let r of t.args)if(e=Qi(r),e)break}else(t instanceof Pr||t instanceof ke)&&t.input instanceof Ze&&t.input.name==="zoom"&&(e=t);return e instanceof Ve||t.eachChild(r=>{let n=Qi(r);n instanceof Ve?e=n:!e&&n?e=new Ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&n&&e!==n&&(e=new Ve("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function Ao(t,e=new Set){return t instanceof dn&&e.add(t.key),t.eachChild(r=>{Ao(r,e)}),e}function zd(t){let e={color:ze,string:$,number:k,enum:$,boolean:U,formatted:Ar,padding:ho,numberArray:go,colorArray:an,projectionDefinition:yo,resolvedImage:vn,variableAnchorOffsetCollection:bo};return t.type==="array"?Ce(e[t.value]||N,t.length):e[t.type]}function Od(t){if(t.type==="color"&&wo(t.default))return new H(0,0,0,0);switch(t.type){case"color":return H.parse(t.default)||null;case"padding":return Oe.parse(t.default)||null;case"numberArray":return Ge.parse(t.default)||null;case"colorArray":return Pe.parse(t.default)||null;case"variableAnchorOffsetCollection":return Ee.parse(t.default)||null;case"projectionDefinition":return At.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function js(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(!js(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var Gd={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ct(t){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};js(t)||(t=po(t));let e=Qt(t,Gd);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=hc(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r,getGlobalStateRefs:()=>Ao(e.value.expression)}}}function Nd(t,e){return t<e?-1:t>e?1:0}function hc(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(hc(t[e]))return!0;return!1}function po(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?xs(t[1],t[2],"=="):e==="!="?Ki(xs(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?xs(t[1],t[2],e):e==="any"?Ud(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(po)):e==="none"?["all"].concat(t.slice(1).map(po).map(Ki)):e==="in"?$u(t[1],t.slice(2)):e==="!in"?Ki($u(t[1],t.slice(2))):e==="has"?ju(t[1]):e==="!has"?Ki(ju(t[1])):!0}function xs(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 Ud(t){return["any"].concat(t.map(po))}function $u(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(Nd)]]:["filter-in-small",t,["literal",e]]}}function ju(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ki(t){return["!",t]}function Vs(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+=`${Vs(o)},`;return`${i}]`}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+=`${JSON.stringify(r[i])}:${Vs(t[r[i]])},`;return`${n}}`}function $d(t){let e="";for(let r of vh)e+=`/${Vs(t[r])}`;return e}function dc(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||$d(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 gc(t){let e=t.key,r=t.value;return r?[new C(e,r,"constants have been deprecated as of v8")]:[]}function le(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Zt(t){if(Array.isArray(t))return t.map(Zt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Zt(t[r]);return e}return le(t)}function Re(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=j(r);if(u!=="object")return[new C(e,r,`object expected, ${u} found`)];for(let c in r){let p=c.split(".")[0],f=nn(n,p)||n["*"],y;if(nn(i,p))y=i[p];else if(nn(n,p))y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new C(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 C(e,r,`missing required property "${c}"`));return l}function qs(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(j(e)!=="array")return[new C(a,e,`array expected, ${j(e)} found`)];if(r.length&&e.length!==r.length)return[new C(a,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new C(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),j(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 _o(t){let e=t.key,r=t.value,n=t.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new C(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new C(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new C(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function bc(t){let e=t.valueSpec,r=le(t.value.type),n,i={},o,a,s=r!=="categorical"&&t.value.property===void 0,l=!s,u=j(t.value.stops)==="array"&&j(t.value.stops[0])==="array"&&j(t.value.stops[0][0])==="object",c=Re({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 C(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&c.push(new C(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!$s(t.valueSpec)&&c.push(new C(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!It(t.valueSpec)?c.push(new C(t.key,t.value,"property functions not supported")):s&&!uc(t.valueSpec)&&c.push(new C(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new C(t.key,t.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new C(h.key,h.value,\'identity function may not have a "stops" property\')];let g=[],d=h.value;return g=g.concat(qs({key:h.key,value:d,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(d)==="array"&&d.length===0&&g.push(new C(h.key,d,"array must have at least one stop")),g}function f(h){let g=[],d=h.value,x=h.key;if(j(d)!=="array")return[new C(x,d,`array expected, ${j(d)} found`)];if(d.length!==2)return[new C(x,d,`array length 2 expected, length ${d.length} found`)];if(u){if(j(d[0])!=="object")return[new C(x,d,`object expected, ${j(d[0])} found`)];if(d[0].zoom===void 0)return[new C(x,d,"object stop key must have zoom")];if(d[0].value===void 0)return[new C(x,d,"object stop key must have value")];if(a&&a>le(d[0].zoom))return[new C(x,d[0].zoom,"stop zoom values must appear in ascending order")];le(d[0].zoom)!==a&&(a=le(d[0].zoom),o=void 0,i={}),g=g.concat(Re({key:`${x}[0]`,value:d[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:_o,value:y}}))}else g=g.concat(y({key:`${x}[0]`,value:d[0],validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},d));return wn(Zt(d[1]))?g.concat([new C(`${x}[1]`,d[1],"expressions are not allowed in function stops.")]):g.concat(h.validateSpec({key:`${x}[1]`,value:d[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,g){let d=j(h.value),x=le(h.value),b=h.value!==null?h.value:g;if(!n)n=d;else if(d!==n)return[new C(h.key,b,`${d} stop domain type must match previous stop domain type ${n}`)];if(d!=="number"&&d!=="string"&&d!=="boolean")return[new C(h.key,b,"stop domain value must be a number, string, or boolean")];if(d!=="number"&&r!=="categorical"){let v=`number expected, ${d} found`;return It(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new C(h.key,b,v)]}return r==="categorical"&&d==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new C(h.key,b,`integer expected, found ${x}`)]:r!=="categorical"&&d==="number"&&o!==void 0&&x<o?[new C(h.key,b,"stop domain values must appear in ascending order")]:(o=x,r==="categorical"&&x in i?[new C(h.key,b,"stop domain values must be unique")]:(i[x]=!0,[]))}function m(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function Sr(t){let e=(t.expressionContext==="property"?yc:Qt)(Zt(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new C(`${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 C(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"&&!gn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!gn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!So(r,["zoom","feature-state"]))return[new C(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Po(r))return[new C(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function jd(t){let e=t.value,r=t.key,n=j(e);return n!=="boolean"?[new C(r,e,`boolean expected, ${n} found`)]:[]}function Rs(t){let e=t.key,r=t.value,n=j(r);return n!=="string"?[new C(e,r,`color expected, ${n} found`)]:H.parse(String(r))?[]:[new C(e,r,`color expected, "${r}" found`)]}function xn(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(le(r))===-1&&i.push(new C(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(le(r))===-1&&i.push(new C(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Ws(t){return js(Zt(t.value))?Sr(xr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xc(t)}function xc(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new C(r,e,`array expected, ${j(e)} found`)];let n=t.styleSpec,i,o=[];if(e.length<1)return[new C(r,e,"filter array must have at least 1 element")];switch(o=o.concat(xn({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),le(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&le(e[1])==="$type"&&o.push(new C(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new C(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=j(e[1]),i!=="string"&&o.push(new C(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=j(e[a]),le(e[1])==="$type"?o=o.concat(xn({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 C(`${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(xc({key:`${r}[${a}]`,value:e[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=j(e[1]),e.length!==2?o.push(new C(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):i!=="string"&&o.push(new C(`${r}[1]`,e[1],`string expected, ${i} found`));break}return o}function vc(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 C(r,a,`unknown property "${s}"`)];let p;if(j(a)==="string"&&It(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new C(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 C(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&wo(Zt(a))&&le(a.type)==="identity"&&f.push(new C(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 Pc(t){return vc(t,"paint")}function Sc(t){return vc(t,"layout")}function wc(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;if(j(r)!=="object")return[new C(n,r,`object expected, ${j(r)} found`)];!r.type&&!r.ref&&e.push(new C(n,r,\'either "type" or "ref" is required\'));let a=le(r.type),s=le(r.ref);if(r.id){let l=le(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];le(c.id)===l&&e.push(new C(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 C(n,r[u],`"${u}" is prohibited for ref layers`))});let l;i.layers.forEach(u=>{le(u.id)===s&&(l=u)}),l?l.ref?e.push(new C(n,r.ref,"ref cannot reference another ref layer")):a=le(l.type):e.push(new C(n,r.ref,`ref layer "${s}" not found`))}else if(a!=="background")if(!r.source)e.push(new C(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&le(l.type);l?u==="vector"&&a==="raster"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&a==="hillshade"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u!=="raster-dem"&&a==="color-relief"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&a!=="raster"?e.push(new C(n,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new C(n,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&a!=="hillshade"&&a!=="color-relief"?e.push(new C(n,r.source,"raster-dem source can only be used with layer type \'hillshade\' or \'color-relief\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new C(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new C(n,r.source,`source "${r.source}" not found`))}return e=e.concat(Re({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:Ws,layout(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Sc(xr({layerType:a},u))}}})},paint(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Pc(xr({layerType:a},u))}}})}}})),e}function Jt(t){let e=t.value,r=t.key,n=j(e);return n!=="string"?[new C(r,e,`string expected, ${n} found`)]:[]}function qd(t){var e;let r=(e=t.sourceName)!==null&&e!==void 0?e:"",n=t.value,i=t.styleSpec,o=i.source_raster_dem,a=t.style,s=[],l=j(n);if(n===void 0)return s;if(l!=="object")return s.push(new C("source_raster_dem",n,`object expected, ${l} found`)),s;let c=le(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],f=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let y in n)!c&&p.includes(y)?s.push(new C(y,n[y],`In "${r}": "${y}" is only valid when "encoding" is set to "custom". ${f} encoding found`)):o[y]?s=s.concat(t.validateSpec({key:y,value:n[y],valueSpec:o[y],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new C(y,n[y],`unknown property "${y}"`));return s}var qu={promoteId:Wd};function Ac(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new C(r,e,\'"type" is required\')];let a=le(e.type),s;switch(a){case"vector":case"raster":return s=Re({key:r,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:qu,validateSpec:o}),s;case"raster-dem":return s=qd({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=Re({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:qu}),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(...Sr({key:`${r}.${l}.map`,value:c,expressionContext:"cluster-map"})),s.push(...Sr({key:`${r}.${l}.reduce`,value:p,expressionContext:"cluster-reduce"}))}return s;case"video":return Re({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Re({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new C(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return xn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Wd({key:t,value:e}){if(j(e)==="string")return Jt({key:t,value:e});{let r=[];for(let n in e)r.push(...Jt({key:`${t}.${n}`,value:e[n]}));return r}}function _c(t){let e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new C("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 C(s,e[s],`unknown property "${s}"`)])}return o}function Ic(t){let e=t.value,r=t.styleSpec,n=r.sky,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new C("sky",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new C(s,e[s],`unknown property "${s}"`)]);return a}function Tc(t){let e=t.value,r=t.styleSpec,n=r.terrain,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new C("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 C(s,e[s],`unknown property "${s}"`)]);return o}function Xd(t){return Jt(t).length===0?[]:Sr(t)}function Hd(t){return Jt(t).length===0?[]:Sr(t)}function Zd(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new C(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 _o({key:e,value:r,valueSpec:{}})}function Jd(t){let e=t.key,r=t.value;if(j(r)==="array"){let i={type:"number"};if(r.length<1)return[new C(e,r,"array length at least 1 expected, length 0 found")];let 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 _o({key:e,value:r,valueSpec:{}})}function Yd(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1)return[new C(e,r,"array length at least 1 expected, length 0 found")];let i=[];for(let o=0;o<r.length;o++)i=i.concat(Rs({key:`${e}[${o}]`,value:r[o]}));return i}else return Rs({key:e,value:r})}function Kd(t){let e=t.key,r=t.value,n=j(r),i=t.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new C(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(xn({key:`${e}[${a}]`,value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(qs({key:`${e}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function Cc(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 C(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 C(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(Re({key:`${n}[${a}]`,value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Jt({key:n,value:r})}function Qd(t){let e=t.value,r=t.styleSpec,n=r.projection,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new C("projection",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new C(s,e[s],`unknown property "${s}"`)]);return a}function eg(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let n=j(r);return n==="array"&&!rg(r)&&!tg(r)?[new C(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(n)?[]:[new C(e,r,`projection expected, invalid type "${n}" found`)]}function tg(t){return!!["interpolate","step","literal"].includes(t[0])}function rg(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function ng(t){return!!t&&t.constructor===Object}function kc(t){return ng(t.value)?[]:[new C(t.key,t.value,`object expected, ${j(t.value)} found`)]}var Wu={"*"(){return[]},array:qs,boolean:jd,number:_o,color:Rs,constants:gc,enum:xn,filter:Ws,function:bc,layer:wc,object:Re,source:Ac,light:_c,sky:Ic,terrain:Tc,projection:Qd,projectionDefinition:eg,string:Jt,formatted:Xd,resolvedImage:Hd,padding:Zd,numberArray:Jd,colorArray:Yd,variableAnchorOffsetCollection:Kd,sprite:Cc,state:kc};function fo(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=fo,r.expression&&wo(le(e))?bc(t):r.expression&&wn(Zt(e))?Sr(t):r.type&&Wu[r.type]?Wu[r.type](t):Re(xr({},t,{valueSpec:r.type?n[r.type]:r}))}function Fc(t){let e=t.value,r=t.key,n=Jt(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new C(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&n.push(new C(r,e,\'"glyphs" url must include a "{range}" token\'))),n}function Me(t,e=P){let r=[];return r=r.concat(fo({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:fo,objectElementValidators:{glyphs:Fc,"*"(){return[]}}})),t.constants&&(r=r.concat(gc({key:"constants",value:t.constants}))),Ec(r)}Me.source=qe(je(Ac));Me.sprite=qe(je(Cc));Me.glyphs=qe(je(Fc));Me.light=qe(je(_c));Me.sky=qe(je(Ic));Me.terrain=qe(je(Tc));Me.state=qe(je(kc));Me.layer=qe(je(wc));Me.filter=qe(je(Ws));Me.paintProperty=qe(je(Pc));Me.layoutProperty=qe(je(Sc));function je(t){return function(e){return t({...e,validateSpec:fo})}}function Ec(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function qe(t){return function(...e){return Ec(t.apply(this,e))}}var Mc="AbortError";function Lc(t){return t.message===Mc}function Xs(){return new Error(Mc)}var Io={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Dc(t){return Io.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function Bc(t,e){Io.REGISTERED_PROTOCOLS[t]=e}function Vc(t){delete Io.REGISTERED_PROTOCOLS[t]}var Rc="global-dispatcher",er=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}},Oc=()=>at(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ig=t=>/^file:/.test(t)||/^file:/.test(Oc())&&!/^\\w+:/.test(t);async function og(t,e){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:Oc(),signal:e.signal});t.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let n;try{n=await fetch(r)}catch(a){throw new er(0,a.message,t.url,new Blob)}if(!n.ok){let a=await n.blob();throw new er(n.status,n.statusText,t.url,a)}let i;t.type==="arrayBuffer"||t.type==="image"?i=n.arrayBuffer():t.type==="json"?i=n.json():i=n.text();let o=await i;if(e.signal.aborted)throw Xs();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function ag(t,e){return new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(i.responseType="arraybuffer");for(let o in t.headers)i.setRequestHeader(o,t.headers[o]);t.type==="json"&&(i.responseType="text",t.headers?.Accept||i.setRequestHeader("Accept","application/json")),i.withCredentials=t.credentials==="include",i.onerror=()=>{n(new Error(i.statusText))},i.onload=()=>{if(!e.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let o=i.response;if(t.type==="json")try{o=JSON.parse(i.response)}catch(a){n(a);return}r({data:o,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let o=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new er(i.status,i.statusText,t.url,o))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Xs())}),i.send(t.body)})}var Gc=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=Dc(t.url);if(r)return r(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:Rc},e)}if(!ig(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return og(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:Rc},e)}return ag(t,e)},Nc=(t,e)=>Gc(de(t,{type:"json"}),e),Uc=(t,e)=>Gc(de(t,{type:"arrayBuffer"}),e);var ut={};function I(t,e,r={}){if(ut[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ut[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}I("Object",Object);I("Set",Set);I("TransferableGridIndex",$t);I("Color",H);I("Error",Error);I("AJAXError",er);I("ResolvedImage",Se);I("StylePropertyFunction",bn);I("StyleExpression",Ht,{omit:["_evaluator"]});I("ZoomDependentExpression",Tt);I("ZoomConstantExpression",Je);I("CompoundExpression",Ze,{omit:["_evaluate"]});for(let t in Kt)Kt[t]._classRegistryKey||I(`Expression_${t}`,Kt[t]);function $c(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function Hs(t){let e=t.constructor;return t.$name||e._classRegistryKey}function sg(t){if(t===null||typeof t!="object")return!1;let e=Hs(t);return!!(e&&e!=="Object")}function jc(t){return!sg(t)&&(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||t instanceof Error||$c(t)||vt(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Tr(t,e){if(jc(t)){if(($c(t)||vt(t))&&e&&e.push(t),ArrayBuffer.isView(t)){let o=t;e&&e.push(o.buffer)}return t instanceof ImageData&&e&&e.push(t.data.buffer),t}if(Array.isArray(t)){let o=[];for(let a of t)o.push(Tr(a,e));return o}if(typeof t!="object")throw new Error(`can\'t serialize object of type ${typeof t}`);let r=Hs(t);if(!r)throw new Error(`can\'t serialize object of unregistered class ${t.constructor.name}`);if(!ut[r])throw new Error(`${r} is not registered.`);let{klass:n}=ut[r],i=n.serialize?n.serialize(t,e):{};if(n.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)||ut[r].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=ut[r].shallow.indexOf(o)>=0?a:Tr(a,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(i.$name=r),i}function Cr(t){if(jc(t))return t;if(Array.isArray(t))return t.map(Cr);if(typeof t!="object")throw new Error(`can\'t deserialize object of type ${typeof t}`);let e=Hs(t)||"Object";if(!ut[e])throw new Error(`can\'t deserialize unregistered class ${e}`);let{klass:r}=ut[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]=ut[e].shallow.indexOf(i)>=0?o:Cr(o)}return n}var To=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var lg={once:!0},Co=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new To(()=>this.process()),this.subscription=us(this.target,"message",n=>this.receive(n),!1),this.globalScope=at(self)?e:window}registerMessageHandler(e,r){this.messageHandlers[e]=r}sendAsync(e,r){return new Promise((n,i)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=r?us(r.signal,"abort",()=>{a?.unsubscribe(),delete this.resolveRejects[o];let u={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(u)},lg):null;this.resolveRejects[o]={resolve:u=>{a?.unsubscribe(),n(u)},reject:u=>{a?.unsubscribe(),i(u)}};let s=[],l={...e,id:o,sourceMapId:this.mapId,origin:location.origin,data:Tr(e.data,s)};this.target.postMessage(l,{transfer:s})})}receive(e){let r=e.data,n=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&r.origin!=="resource://android"&&location.origin!=="resource://android"&&r.origin!==location.origin)&&!(r.targetMapId&&this.mapId!==r.targetMapId)){if(r.type==="<cancel>"){delete this.tasks[n];let i=this.abortControllers[n];delete this.abortControllers[n],i&&i.abort();return}if(at(self)||r.mustQueue){this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger();return}this.processTask(n,r)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),r=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(e,r)}async processTask(e,r){if(r.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;r.error?o.reject(Cr(r.error)):o.resolve(Cr(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(e,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));return}let n=Cr(r.data),i=new AbortController;this.abortControllers[e]=i;try{let o=await this.messageHandlers[r.type](r.sourceMapId,n,i);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,r,n){let i=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:r?Tr(r):null,data:Tr(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function qc(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function Zs(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var ko=class{constructor(e,r={}){de(this,r),this.type=e}},An=class extends ko{constructor(e,r={}){super("error",de({error:e},r))}},Fo=class{on(e,r){return this._listeners=this._listeners||{},qc(e,r,this._listeners),{unsubscribe:()=>{this.off(e,r)}}}off(e,r){return Zs(e,r,this._listeners),Zs(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},qc(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new ko(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)Zs(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(de(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof An&&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 ct=Me,K0=ct.source,Q0=ct.light,ev=ct.sky,tv=ct.terrain,rv=ct.filter,Wc=ct.paintProperty,Xc=ct.layoutProperty;function Hc(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new An(new Error(n.message))),r=!0;return r}var _n=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 q={"Latin-1 Supplement":t=>t>=128&&t<=255,"Hangul Jamo":t=>t>=4352&&t<=4607,Khmer:t=>t>=6016&&t<=6143,"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,"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,Kanbun:t=>t>=12688&&t<=12703,"CJK Strokes":t=>t>=12736&&t<=12783,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Hangul Syllables":t=>t>=44032&&t<=55215,"Private Use Area":t=>t>=57344&&t<=63743,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function In(t){for(let e of t)if(Eo(e.charCodeAt(0)))return!0;return!1}function Zc(t){for(let e of t)if(!pg(e.charCodeAt(0)))return!1;return!0}function Js(t){let e=t.map(r=>{try{return new RegExp(`\\\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(e.join("|"),"u")}var ug=["Arab","Dupl","Mong","Ougr","Syrc"],cg=Js(ug);function pg(t){return!cg.test(String.fromCodePoint(t))}var fg=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],Jc=Js(fg);function Yc(t){return t<11904?!1:q["CJK Compatibility Forms"](t)||q["CJK Compatibility"](t)||q["CJK Strokes"](t)||q["CJK Symbols and Punctuation"](t)||q["Enclosed CJK Letters and Months"](t)||q["Halfwidth and Fullwidth Forms"](t)||q["Ideographic Description Characters"](t)||q["Vertical Forms"](t)?!0:Jc.test(String.fromCodePoint(t))}function Eo(t){return t===746||t===747?!0:t<4352?!1:!!(q["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||q["CJK Compatibility"](t)||q["CJK Strokes"](t)||q["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||q["Enclosed CJK Letters and Months"](t)||q["Ideographic Description Characters"](t)||q.Kanbun(t)||q.Katakana(t)&&t!==12540||q["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)||q["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||q["Vertical Forms"](t)||q["Yijing Hexagram Symbols"](t)||/\\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\\p{sc=Hang}/u.test(String.fromCodePoint(t))||Jc.test(String.fromCodePoint(t)))}function yg(t){return!!(q["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||q["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)||q["Letterlike Symbols"](t)||q["Number Forms"](t)||q["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)||q["Control Pictures"](t)&&t!==9251||q["Optical Character Recognition"](t)||q["Enclosed Alphanumerics"](t)||q["Geometric Shapes"](t)||q["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||q["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||q["CJK Symbols and Punctuation"](t)||q.Katakana(t)||q["Private Use Area"](t)||q["CJK Compatibility Forms"](t)||q["Small Form Variants"](t)||q["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}function Ys(t){return!(Eo(t)||yg(t))}function Kc(t){return/\\p{sc=Arab}/u.test(String.fromCodePoint(t))}var mg=["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"],hg=Js(mg);function Qc(t){return hg.test(String.fromCodePoint(t))}function dg(t,e){return!(!e&&Qc(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||q.Khmer(t))}function ep(t){for(let e of t)if(Qc(e.charCodeAt(0)))return!0;return!1}function tp(t,e){for(let r of t)if(!dg(r.charCodeAt(0),e))return!1;return!0}var Ks=class{constructor(){this.TIMEOUT=5e3;this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null;this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(we.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,r){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let n=e.pluginURL,i=new Promise(s=>{this.loadScriptResolve=s});r(n);let o=new Promise(s=>setTimeout(()=>s(),this.TIMEOUT));if(await Promise.race([i,o]),this.isParsed()){let s={pluginStatus:"loaded",pluginURL:n};return this.setState(s),s}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)}},we=new Ks;var W=class{constructor(e,r){this.zoom=e,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new _n,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new _n,this.transition={},this.globalState={})}isSupportedScript(e){return tp(e,we.getRTLTextPluginStatus()==="loaded")}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 kr=class{constructor(e,r){this.property=e,this.value=r,this.expression=mc(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}},Tn=class{constructor(e){this.property=e,this.value=new kr(e,void 0)}transitioned(e,r){return new Lo(this.property,this.value,r,de({},e.transition,this.transition),e.now)}untransitioned(){return new Lo(this.property,this.value,null,{},0)}},Mo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return nt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Tn(this._values[e].property)),this._values[e].value=new kr(this._values[e].property,r===null?void 0:nt(r))}getTransition(e){return nt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Tn(this._values[e].property)),this._values[e].transition=nt(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 Do(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 Do(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},Lo=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,Su(s))}}else return o}},Do=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new kt(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}},Bo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return nt(this._values[e].value)}setValue(e,r){this._values[e]=new kr(this._values[e].property,r===null?void 0:nt(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 kt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},ge=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)}},kt=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},F=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=lt[i];return o?o(e,r,n):e}},L=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 ge(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new ge(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 ge(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=lt[i];if(o){let a=o(e.value.value,r.value.value,n);return new ge(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)}},pt=class extends L{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new ge(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 ge(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 ge(this,{kind:"constant",value:o},r)}else return new ge(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}},tr=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 W(Math.floor(r.zoom-1),r)),e.expression.evaluate(new W(Math.floor(r.zoom),r)),e.expression.evaluate(new W(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}},ft=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},ee=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 kr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Tn(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};I("DataDrivenProperty",L);I("DataConstantProperty",F);I("CrossFadedDataDrivenProperty",pt);I("CrossFadedProperty",tr);I("ColorRampProperty",ft);var Vo="-transition",oe=class extends Fo{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},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,this._featureFilter=Ct(e.filter)),r.layout&&(this._unevaluatedLayout=new Bo(r.layout)),r.paint)){this._transitionablePaint=new Mo(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 kt(r.paint)}}setFilter(e){this.filter=e,this._featureFilter=Ct(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let r in this._unevaluatedLayout._values){let n=this._unevaluatedLayout._values[r];for(let i of n.getGlobalStateRefs())e.add(i)}for(let r of this._featureFilter.getGlobalStateRefs())e.add(r);return e}setLayoutProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.layout.${e}`;if(this._validate(Xc,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(Vo)?this._transitionablePaint.getTransition(e.slice(0,-Vo.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.paint.${e}`;if(this._validate(Wc,i,e,r,n))return!1}if(e.endsWith(Vo))return this._transitionablePaint.setTransition(e.slice(0,-Vo.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),_u(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:Hc(this,e.call(ct,{key:r,layerType:this.type,objectKey:n,value:i,styleSpec:P,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 ge)||!It(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};var gg={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Ft=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}},bg=128,xg=5,te=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*xg),bg),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 Q(t,e=1){let r=0,n=0,i=t.map(a=>{let s=vg(a.type),l=r=rp(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=rp(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function vg(t){return gg[t].BYTES_PER_ELEMENT}function rp(t,e){return Math.ceil(t/e)*e}var np=Y(ye(),1),rr=class extends te{_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}};rr.prototype.bytesPerElement=4;I("StructArrayLayout2i4",rr);var Cn=class extends te{_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}};Cn.prototype.bytesPerElement=6;I("StructArrayLayout3i6",Cn);var Ro=class extends te{_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}};Ro.prototype.bytesPerElement=8;I("StructArrayLayout4i8",Ro);var kn=class extends te{_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}};kn.prototype.bytesPerElement=12;I("StructArrayLayout2i4i12",kn);var Fn=class extends te{_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}};Fn.prototype.bytesPerElement=8;I("StructArrayLayout2i4ub8",Fn);var Et=class extends te{_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}};Et.prototype.bytesPerElement=8;I("StructArrayLayout2f8",Et);var En=class extends te{_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}};En.prototype.bytesPerElement=20;I("StructArrayLayout10ui20",En);var Mn=class extends te{_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}};Mn.prototype.bytesPerElement=24;I("StructArrayLayout4i4ui4i24",Mn);var Ln=class extends te{_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}};Ln.prototype.bytesPerElement=12;I("StructArrayLayout3f12",Ln);var Dn=class extends te{_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}};Dn.prototype.bytesPerElement=4;I("StructArrayLayout1ul4",Dn);var Bn=class extends te{_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}};Bn.prototype.bytesPerElement=20;I("StructArrayLayout6i1ul2ui20",Bn);var Vn=class extends te{_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}};Vn.prototype.bytesPerElement=12;I("StructArrayLayout2i2i2i12",Vn);var zo=class extends te{_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}};zo.prototype.bytesPerElement=16;I("StructArrayLayout2f1f2i16",zo);var Rn=class extends te{_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,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*16,u=e*4,c=e*8;return this.uint8[l+0]=r,this.uint8[l+1]=n,this.float32[u+1]=i,this.float32[u+2]=o,this.int16[c+6]=a,this.int16[c+7]=s,e}};Rn.prototype.bytesPerElement=16;I("StructArrayLayout2ub2f2i16",Rn);var zn=class extends te{_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}};zn.prototype.bytesPerElement=6;I("StructArrayLayout3ui6",zn);var On=class extends te{_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,h,g,d){let x=this.length;return this.resize(x+1),this.emplace(x,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x){let b=e*24,v=e*12,S=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[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+12]=p,this.float32[v+7]=f,this.float32[v+8]=y,this.uint8[S+36]=m,this.uint8[S+37]=h,this.uint8[S+38]=g,this.uint32[v+10]=d,this.int16[b+22]=x,e}};On.prototype.bytesPerElement=48;I("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",On);var Gn=class extends te{_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,h,g,d,x,b,v,S,A,w,T,E,D,B,z){let M=this.length;return this.resize(M+1),this.emplace(M,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,E,D,B,z)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,E,D,B,z,M){let _=e*32,V=e*16;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=i,this.int16[_+3]=o,this.int16[_+4]=a,this.int16[_+5]=s,this.int16[_+6]=l,this.int16[_+7]=u,this.uint16[_+8]=c,this.uint16[_+9]=p,this.uint16[_+10]=f,this.uint16[_+11]=y,this.uint16[_+12]=m,this.uint16[_+13]=h,this.uint16[_+14]=g,this.uint16[_+15]=d,this.uint16[_+16]=x,this.uint16[_+17]=b,this.uint16[_+18]=v,this.uint16[_+19]=S,this.uint16[_+20]=A,this.uint16[_+21]=w,this.uint16[_+22]=T,this.uint32[V+12]=E,this.float32[V+13]=D,this.float32[V+14]=B,this.uint16[_+30]=z,this.uint16[_+31]=M,e}};Gn.prototype.bytesPerElement=64;I("StructArrayLayout8i15ui1ul2f2ui64",Gn);var nr=class extends te{_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}};nr.prototype.bytesPerElement=4;I("StructArrayLayout1f4",nr);var Nn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(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*6,a=e*3;return this.uint16[o+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,e}};Nn.prototype.bytesPerElement=12;I("StructArrayLayout1ui2f12",Nn);var Un=class extends te{_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}};Un.prototype.bytesPerElement=8;I("StructArrayLayout1ul2ui8",Un);var $n=class extends te{_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}};$n.prototype.bytesPerElement=4;I("StructArrayLayout2ui4",$n);var Oo=class extends te{_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}};Oo.prototype.bytesPerElement=2;I("StructArrayLayout1ui2",Oo);var Fr=class extends te{_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}};Fr.prototype.bytesPerElement=16;I("StructArrayLayout4f16",Fr);var Go=class extends Ft{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 np.default(this.anchorPointX,this.anchorPointY)}};Go.prototype.size=20;var jn=class extends Bn{get(e){return new Go(this,e)}};I("CollisionBoxArray",jn);var No=class extends Ft{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]}};No.prototype.size=48;var qn=class extends On{get(e){return new No(this,e)}};I("PlacedSymbolArray",qn);var Uo=class extends Ft{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 collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};Uo.prototype.size=64;var Wn=class extends Gn{get(e){return new Uo(this,e)}};I("SymbolInstanceArray",Wn);var Xn=class extends nr{getoffsetX(e){return this.float32[e*1+0]}};I("GlyphOffsetArray",Xn);var Hn=class extends Cn{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};I("SymbolLineVertexArray",Hn);var $o=class extends Ft{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};$o.prototype.size=12;var Zn=class extends Nn{get(e){return new $o(this,e)}};I("TextAnchorOffsetArray",Zn);var jo=class extends Ft{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]}};jo.prototype.size=8;var Jn=class extends Un{get(e){return new jo(this,e)}};I("FeatureIndexArray",Jn);var qo=class extends rr{};var Wo=class extends rr{},Xo=class extends rr{},Ho=class extends kn{};var Zo=class extends Fn{},Jo=class extends Et{},yt=class extends En{},Yo=class extends Mn{},Ko=class extends Ln{},Qo=class extends Dn{},Yn=class extends Vn{};var ea=class extends Rn{};var Le=class extends zn{},Mt=class extends $n{};var Pg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:ip,size:kv,alignment:Fv}=Pg;var pe=class t{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1;this.segments=e}prepareSegment(e,r,n,i){let o=this.segments[this.segments.length-1];return e>t.MAX_VERTEX_ARRAY_LENGTH&&ce(`Max vertices per segment is ${t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${t.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!o||o.vertexLength+e>t.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i?this.createNewSegment(r,n,i):o}createNewSegment(e,r,n){let i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return n!==void 0&&(i.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(e,r,n){return this.prepareSegment(0,e,r,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}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 t([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};pe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;I("SegmentVector",pe);function Qs(t,e){return t=it(Math.floor(t),0,255),e=it(Math.floor(e),0,255),256*t+e}var Kn=Q([{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 up=Y(rl(),1);var Qn=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(lp(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=lp(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 nl(n,i,0,n.length-1),r&&r.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(e){let r=new t;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function lp(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,up.default)(String(t))}function nl(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;ra(t,o,a),ra(e,3*o,3*a),ra(e,3*o+1,3*a+1),ra(e,3*o+2,3*a+2)}a-r<n-a?(nl(t,e,r,a),r=a+1):(nl(t,e,a+1,n),n=a)}}function ra(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}I("FeaturePositionMap",Qn);var ei=class{constructor(e,r){this.gl=e.gl,this.location=r}};var Er=class extends ei{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var na=class extends ei{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]))}},ia=class extends ei{constructor(e,r){super(e,r),this.current=H.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))}};var qv=new Float32Array(16);function il(t){return[Qs(255*t.r,255*t.g),Qs(255*t.b,255*t.a)]}var ir=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 ia(e,r):new Er(e,r)}},Lt=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 na(e,r):new Er(e,r)}},We=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 W(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=il(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()}},De=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 W(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new W(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=il(n),a=il(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=it(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,r,n){return new Er(e,r)}},Ye=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,Kn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Kn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},oa=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 ge)||!It(a.property.specification))continue;let s=_g(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 Lt(l.value,s):new ir(l.value,s,u),i.push(`/u_${o}`);else if(l.kind==="source"||f){let y=cp(o,u,"source");this.binders[o]=f?new Ye(l,u,c,r,y,e.id):new We(l,s,u,y),i.push(`/a_${o}`)}else{let y=cp(o,u,"composite");this.binders[o]=new De(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 We||r instanceof De?r.maxValue:0}populatePaintArrays(e,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof We||s instanceof De||s instanceof Ye)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof Lt&&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 We||f instanceof De||f instanceof Ye)&&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 ir||n instanceof Lt)&&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 We||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof Ye)for(let i=0;i<Kn.members.length;i++)e.push(Kn.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof ir||n instanceof Lt||n instanceof De)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 ir||o instanceof Lt||o instanceof De){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 Ye){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof We||n instanceof De)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let r in this.binders){let n=this.binders[r];(n instanceof We||n instanceof De||n instanceof Ye)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof We||r instanceof De||r instanceof Ye)&&r.destroy()}}},Ae=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new oa(i,r,n);this.needsUpload=!1,this._featureMap=new Qn,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 _g(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 Ig(t){return{"line-pattern":{source:yt,composite:yt},"fill-pattern":{source:yt,composite:yt},"fill-extrusion-pattern":{source:yt,composite:yt}}[t]}function cp(t,e,r){let n={color:{source:Et,composite:Fr},number:{source:nr,composite:Et}},i=Ig(t);return i&&i[r]||n[e][r]}I("ConstantBinder",ir);I("CrossFadedConstantBinder",Lt);I("SourceExpressionBinder",We);I("CrossFadedCompositeBinder",Ye);I("CompositeExpressionBinder",De);I("ProgramConfiguration",oa,{omit:["_buffers"]});I("ProgramConfigurationSet",Ae);var Tg=15,ol=Math.pow(2,Tg-1)-1,pp=-ol-1;function _e(t){let e=8192/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=it(s,pp,ol),a.y=it(l,pp,ol),(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 Ne(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?_e(t):[]}}var fp=-32768;function Cg(t,e,r,n,i){t.emplaceBack(fp+e*8+n,fp+r*8+i)}var or=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,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 Wo,this.indexArray=new Le,this.segments=new pe,this.programConfigurations=new Ae(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,l=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),l=l||c.paint.get("circle-pitch-alignment")==="map"}let u=l?r.subdivisionGranularity.circle:1;for(let{feature:c,id:p,index:f,sourceLayerIndex:y}of e){let m=this.layers[0]._featureFilter.needGeometry,h=Ne(c,m);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),h,n))continue;let g=s?a.evaluate(h,{},n):void 0,d={id:p,properties:c.properties,type:c.type,sourceLayerIndex:y,index:f,geometry:m?h.geometry:_e(c),patterns:{},sortKey:g};o.push(d)}s&&o.sort((c,p)=>c.sortKey-p.sortKey);for(let c of o){let{geometry:p,index:f,sourceLayerIndex:y}=c,m=e[f].feature;this.addFeature(c,p,f,n,u),r.featureIndex.insert(m,p,f,y,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,ip),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,o=1){let a;switch(o){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${o}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let l of r)for(let u of l){let c=u.x,p=u.y;if(c<0||c>=8192||p<0||p>=8192)continue;let f=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),y=f.vertexLength;for(let m=0;m<s;m++)for(let h=0;h<s;h++)Cg(this.layoutVertexArray,c,p,a[h],a[m]);for(let m=0;m<s-1;m++)for(let h=0;h<s-1;h++){let g=y+m*s+h,d=y+(m+1)*s+h;this.indexArray.emplaceBack(g,d+1,g+1),this.indexArray.emplaceBack(g,d,d+1)}f.vertexLength+=s*s,f.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};I("CircleBucket",or,{omit:["layers"]});var ti=Y(ye(),1);function mp(t,e){for(let r=0;r<t.length;r++)if(Mr(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Mr(t,e[r]))return!0;return!!sl(t,e)}function hp(t,e,r){return!!(Mr(t,e)||al(e,t,r))}function aa(t,e){if(t.length===1)return yp(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(Mr(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(yp(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(sl(t,e[r]))return!0;return!1}function dp(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(Mr(t,i[o]))return!0}if(kg(t,i,r))return!0}return!1}function kg(t,e,r){if(t.length>1){if(sl(t,e))return!0;for(let n=0;n<e.length;n++)if(al(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(al(t[n],e,r))return!0;return!1}function sl(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(Fg(n,i,a,s))return!0}}return!1}function Fg(t,e,r,n){return ot(t,r,n)!==ot(e,r,n)&&ot(t,e,r)!==ot(t,e,n)}function al(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(ll(t,o,a)<n)return!0}return!1}function ll(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 yp(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 Mr(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 gp(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 ti.default(e,r),new ti.default(e,i),new ti.default(n,i),new ti.default(n,r)];if(t.length>2){for(let a of o)if(Mr(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(Eg(s,l,o))return!0}return!1}function Eg(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 sa=Y(ye(),1);function ar(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Dt(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Bt(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=sa.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 bp(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 sa.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new sa.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 xp,Mg=()=>xp=xp||new ee({"circle-sort-key":new L(P.layout_circle["circle-sort-key"])}),vp,Lg=()=>vp=vp||new ee({"circle-radius":new L(P.paint_circle["circle-radius"]),"circle-color":new L(P.paint_circle["circle-color"]),"circle-blur":new L(P.paint_circle["circle-blur"]),"circle-opacity":new L(P.paint_circle["circle-opacity"]),"circle-translate":new F(P.paint_circle["circle-translate"]),"circle-translate-anchor":new F(P.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new F(P.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new F(P.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new L(P.paint_circle["circle-stroke-width"]),"circle-stroke-color":new L(P.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new L(P.paint_circle["circle-stroke-opacity"])}),Pp={get paint(){return Lg()},get layout(){return Mg()}};var Sp=Y(ye(),1);var la=class extends oe{constructor(e){super(e,Pp)}createBucket(e){return new or(e)}queryRadius(e){let r=e;return ar("circle-radius",this,r)+ar("circle-stroke-width",this,r)+Dt(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:l}){let u=Bt(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-o.bearingInRadians,a),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:Dg(u,o,s,l),h=y?f*a:f;for(let g of i)for(let d of g){let x=y?d:wp(d,o,s,l),b=h,v=o.projectTileCoordinates(d.x,d.y,s,l).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=v/o.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=o.cameraToCenterDistance/v),hp(m,x,b))return!0}return!1}};function wp(t,e,r,n){let i=e.projectTileCoordinates(t.x,t.y,r,n).point;return new Sp.default((i.x*.5+.5)*e.width,(-i.y*.5+.5)*e.height)}function Dg(t,e,r,n){return t.map(i=>wp(i,e,r,n))}var ri=class extends or{};I("HeatmapBucket",ri,{omit:["layers"]});var Ap,Bg=()=>Ap=Ap||new ee({"heatmap-radius":new L(P.paint_heatmap["heatmap-radius"]),"heatmap-weight":new L(P.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new F(P.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ft(P.paint_heatmap["heatmap-color"]),"heatmap-opacity":new F(P.paint_heatmap["heatmap-opacity"])}),_p={get paint(){return Bg()}};function ul(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 Ip(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=ul({},{width:e,height:r},n);cl(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 cl(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 sr=class t{constructor(e,r){ul(this,e,1,r)}resize(e){Ip(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){cl(e,r,n,i,o,1)}},fe=class t{constructor(e,r){ul(this,e,4,r)}resize(e){Ip(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 t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){cl(e,r,n,i,o,4)}setPixel(e,r,n){let i=(e*this.width+r)*4;this.data[i+0]=Math.round(n.r*255/n.a),this.data[i+1]=Math.round(n.g*255/n.a),this.data[i+2]=Math.round(n.b*255/n.a),this.data[i+3]=Math.round(n.a*255)}};I("AlphaImage",sr);I("RGBAImage",fe);function Tp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new fe({width:r,height:n});if(!Au(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.setPixel(a/4/r,s/4,u)};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 Cp="big-fb";var ua=class extends oe{createBucket(e){return new ri(e)}constructor(e){super(e,_p),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Tp({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Cp)&&this.heatmapFbos.delete(Cp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var kp,Vg=()=>kp=kp||new ee({"hillshade-illumination-direction":new F(P.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new F(P.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new F(P.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new F(P.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new F(P.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new F(P.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new F(P.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new F(P.paint_hillshade["hillshade-method"])}),Fp={get paint(){return Vg()}};var ca=class extends oe{constructor(e){super(e,Fp),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,n=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,o=Math.max(e.length,r.length,n.length,i.length);e=e.concat(Array(o-e.length).fill(e.at(-1))),r=r.concat(Array(o-r.length).fill(r.at(-1))),n=n.concat(Array(o-n.length).fill(n.at(-1))),i=i.concat(Array(o-i.length).fill(i.at(-1)));let a=r.map(cs);return{directionRadians:e.map(cs),altitudeRadians:a,shadowColor:i,highlightColor:n}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Ep,Rg=()=>Ep=Ep||new ee({"color-relief-opacity":new F(P["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new ft(P["paint_color-relief"]["color-relief-color"])}),Mp={get paint(){return Rg()}};var ni=class{constructor(e,r,n,i){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(r,i)}update(e,r,n){let{width:i,height:o}=e,a=(!this.size||this.size[0]!==i||this.size[1]!==o)&&!n,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(r&&r.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!r||r.premultiply!==!1)),a)this.size=[i,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||vt(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,i,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{let{x:u,y:c}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||vt(e)?l.texSubImage2D(l.TEXTURE_2D,0,u,c,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,u,c,i,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,r,n){let{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_2D,this.texture),n===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(n=o.LINEAR),e!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,n||e),this.filter=e),r!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrap=r)}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}};var ii=class{constructor(e,r,n,i=1,o=1,a=1,s=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n)){ce(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(e,r){let n=new Uint8Array(this.data.buffer),i=this._idx(e,r)*4;return this.unpack(n[i],n[i+1],n[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_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)}unpack(e,r,n){return e*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}pack(e){return pl(e,this.getUnpackVector())}getPixels(){return new fe({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)]}};function pl(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],a=Math.min(r,n,i),s=Math.round((t+o)/a);return{r:Math.floor(s*a/r)%256,g:Math.floor(s*a/n)%256,b:Math.floor(s*a/i)%256}}I("DEMData",ii);var pa=class extends oe{constructor(e){super(e,Mp)}_createColorRamp(e){let r={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values["color-relief-color"].value.expression;if(n instanceof Je&&n._styleExpression.expression instanceof ke){this.colorRampExpression=n;let a=n._styleExpression.expression;r.elevationStops=a.labels,r.colorStops=[];for(let s of r.elevationStops)r.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[H.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=e)return r;let i={elevationStops:[],colorStops:[]},o=(r.elevationStops.length-1)/(e-1);for(let a=0;a<r.elevationStops.length-.5;a+=o)i.elevationStops.push(r.elevationStops[Math.round(a)]),i.colorStops.push(r.colorStops[Math.round(a)]);return ce(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,r,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(r),o=new fe({width:i.colorStops.length,height:1}),a=new fe({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let l=pl(i.elevationStops[s],n);a.setPixel(0,s,new H(l.r/255,l.g/255,l.b/255,1)),o.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new ni(e,a,e.gl.RGBA),colorTexture:new ni(e,o,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}};var zg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Lp,size:U1,alignment:$1}=zg;function Lr(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 Dr(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 ci=Y(ye(),1);function ml(t,e,r=2){let n=e&&e.length,i=n?e[0]*r:t.length,o=Bp(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;let s,l,u;if(n&&(o=$g(t,e,o,r)),t.length>80*r){s=1/0,l=1/0;let c=-1/0,p=-1/0;for(let f=r;f<i;f+=r){let y=t[f],m=t[f+1];y<s&&(s=y),m<l&&(l=m),y>c&&(c=y),m>p&&(p=m)}u=Math.max(c-s,p-l),u=u!==0?32767/u:0}return ai(o,a,r,s,l,u,0),a}function Bp(t,e,r,n,i){let o;if(i===eb(t,e,r,n)>0)for(let a=e;a<r;a+=n)o=Dp(a/n|0,t[a],t[a+1],o);else for(let a=r-n;a>=e;a-=n)o=Dp(a/n|0,t[a],t[a+1],o);return o&&Br(o,o.next)&&(li(o),o=o.next),o}function lr(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(Br(r,r.next)||se(r.prev,r,r.next)===0)){if(li(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function ai(t,e,r,n,i,o,a){if(!t)return;!a&&o&&Hg(t,n,i,o);let s=t;for(;t.prev!==t.next;){let l=t.prev,u=t.next;if(o?Gg(t,n,i,o):Og(t)){e.push(l.i,t.i,u.i),li(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=Ng(lr(t),e),ai(t,e,r,n,i,o,2)):a===2&&Ug(t,e,r,n,i,o):ai(lr(t),e,r,n,i,o,1);break}}}function Og(t){let e=t.prev,r=t,n=t.next;if(se(e,r,n)>=0)return!1;let i=e.x,o=r.x,a=n.x,s=e.y,l=r.y,u=n.y,c=Math.min(i,o,a),p=Math.min(s,l,u),f=Math.max(i,o,a),y=Math.max(s,l,u),m=n.next;for(;m!==e;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&oi(i,s,o,l,a,u,m.x,m.y)&&se(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Gg(t,e,r,n){let i=t.prev,o=t,a=t.next;if(se(i,o,a)>=0)return!1;let s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=Math.min(s,l,u),m=Math.min(c,p,f),h=Math.max(s,l,u),g=Math.max(c,p,f),d=fl(y,m,e,r,n),x=fl(h,g,e,r,n),b=t.prevZ,v=t.nextZ;for(;b&&b.z>=d&&v&&v.z<=x;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==a&&oi(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&oi(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=d;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==a&&oi(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&oi(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ng(t,e){let r=t;do{let n=r.prev,i=r.next.next;!Br(n,i)&&Rp(n,r,r.next,i)&&si(n,i)&&si(i,n)&&(e.push(n.i,r.i,i.i),li(r),li(r.next),r=t=i),r=r.next}while(r!==t);return lr(r)}function Ug(t,e,r,n,i,o){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&Yg(a,s)){let l=zp(a,s);a=lr(a,a.next),l=lr(l,l.next),ai(a,e,r,n,i,o,0),ai(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function $g(t,e,r,n){let i=[];for(let o=0,a=e.length;o<a;o++){let s=e[o]*n,l=o<a-1?e[o+1]*n:t.length,u=Bp(t,s,l,n,!1);u===u.next&&(u.steiner=!0),i.push(Jg(u))}i.sort(jg);for(let o=0;o<i.length;o++)r=qg(i[o],r);return r}function jg(t,e){let r=t.x-e.x;if(r===0&&(r=t.y-e.y,r===0)){let n=(t.next.y-t.y)/(t.next.x-t.x),i=(e.next.y-e.y)/(e.next.x-e.x);r=n-i}return r}function qg(t,e){let r=Wg(t,e);if(!r)return e;let n=zp(r,t);return lr(n,n.next),lr(r,r.next)}function Wg(t,e){let r=e,n=t.x,i=t.y,o=-1/0,a;if(Br(t,r))return r;do{if(Br(t,r.next))return r.next;if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){let p=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(p<=n&&p>o&&(o=p,a=r.x<r.next.x?r:r.next,p===n))return a}r=r.next}while(r!==e);if(!a)return null;let s=a,l=a.x,u=a.y,c=1/0;r=a;do{if(n>=r.x&&r.x>=l&&n!==r.x&&Vp(i<u?n:o,i,l,u,i<u?o:n,i,r.x,r.y)){let p=Math.abs(i-r.y)/(n-r.x);si(r,t)&&(p<c||p===c&&(r.x>a.x||r.x===a.x&&Xg(a,r)))&&(a=r,c=p)}r=r.next}while(r!==s);return a}function Xg(t,e){return se(t.prev,t,e.prev)<0&&se(e.next,t,t.next)<0}function Hg(t,e,r,n){let i=t;do i.z===0&&(i.z=fl(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,Zg(i)}function Zg(t){let e,r=1;do{let n=t,i;t=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let u=0;u<r&&(s++,a=a.nextZ,!!a);u++);let l=r;for(;s>0||l>0&&a;)s!==0&&(l===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=a}o.nextZ=null,r*=2}while(e>1);return t}function fl(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 Jg(t){let 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 Vp(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 oi(t,e,r,n,i,o,a,s){return!(t===a&&e===s)&&Vp(t,e,r,n,i,o,a,s)}function Yg(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Kg(t,e)&&(si(t,e)&&si(e,t)&&Qg(t,e)&&(se(t.prev,t,e.prev)||se(t,e.prev,e))||Br(t,e)&&se(t.prev,t,t.next)>0&&se(e.prev,e,e.next)>0)}function se(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Br(t,e){return t.x===e.x&&t.y===e.y}function Rp(t,e,r,n){let i=ya(se(t,e,r)),o=ya(se(t,e,n)),a=ya(se(r,n,t)),s=ya(se(r,n,e));return!!(i!==o&&a!==s||i===0&&fa(t,r,e)||o===0&&fa(t,n,e)||a===0&&fa(r,t,n)||s===0&&fa(r,e,n))}function fa(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 ya(t){return t>0?1:t<0?-1:0}function Kg(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Rp(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function si(t,e){return se(t.prev,t,t.next)<0?se(t,e,t.next)>=0&&se(t,t.prev,e)>=0:se(t,e,t.prev)<0||se(t,t.next,e)<0}function Qg(t,e){let 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 zp(t,e){let r=yl(t.i,t.x,t.y),n=yl(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 Dp(t,e,r,n){let i=yl(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 li(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 yl(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function eb(t,e,r,n){let i=0;for(let o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}var Vt=class{constructor(e,r){if(r>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=r}getGranularityForZoomLevel(e){let r=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/r),this._minGranularity,1)}},ha=class ha{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};ha.noSubdivision=new ha({fill:new Vt(0,0),line:new Vt(0,0),tile:new Vt(0,0),stencil:new Vt(0,0),circle:1});var ma=ha;I("SubdivisionGranularityExpression",Vt);I("SubdivisionGranularitySetting",ma);var Vr=-32768,ui=32767,hl=class{constructor(e,r){this._vertexBuffer=[];this._vertexDictionary=new Map;this._used=!1;this._granularity=e,this._granularityCellSize=8192/e,this._canonical=r}_getKey(e,r){return e=e+32768,r=r+32768,e<<16|r<<0}_vertexToIndex(e,r){if(e<-32768||r<-32768||e>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let n=Math.round(e)|0,i=Math.round(r)|0,o=this._getKey(n,i);if(this._vertexDictionary.has(o))return this._vertexDictionary.get(o);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(o,a),this._vertexBuffer.push(n,i),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return rb(this._vertexBuffer,e);let r=[],n=e.length;for(let i=0;i<n;i+=3){let o=[e[i+0],e[i+1],e[i+2]],a=[this._vertexBuffer[e[i+0]*2+0],this._vertexBuffer[e[i+0]*2+1],this._vertexBuffer[e[i+1]*2+0],this._vertexBuffer[e[i+1]*2+1],this._vertexBuffer[e[i+2]*2+0],this._vertexBuffer[e[i+2]*2+1]],s=1/0,l=1/0,u=-1/0,c=-1/0;for(let h=0;h<3;h++){let g=a[h*2],d=a[h*2+1];s=Math.min(s,g),u=Math.max(u,g),l=Math.min(l,d),c=Math.max(c,d)}if(s===u||l===c)continue;let p=Math.floor(s/this._granularityCellSize),f=Math.ceil(u/this._granularityCellSize),y=Math.floor(l/this._granularityCellSize),m=Math.ceil(c/this._granularityCellSize);if(p===f&&y===m){r.push(...o);continue}for(let h=y;h<m;h++){let g=this._scanlineGenerateVertexRingForCellRow(h,a,o);nb(this._vertexBuffer,g,r)}}return r}_scanlineGenerateVertexRingForCellRow(e,r,n){let i=e*this._granularityCellSize,o=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let l=r[s*2],u=r[s*2+1],c=r[(s+1)*2%6],p=r[((s+1)*2+1)%6],f=r[(s+2)*2%6],y=r[((s+2)*2+1)%6],m=c-l,h=p-u,g=m===0,d=h===0,x=(i-u)/h,b=(o-u)/h,v=Math.min(x,b),S=Math.max(x,b);if(!d&&(v>=1||S<=0)||d&&(u<i||u>o)){p>=i&&p<=o&&a.push(n[(s+1)%3]);continue}if(!d&&v>0){let T=l+m*v,E=u+h*v;a.push(this._vertexToIndex(T,E))}let A=l+m*Math.max(v,0),w=l+m*Math.min(S,1);if(g||this._generateIntraEdgeVertices(a,l,u,c,p,A,w),!d&&S<1){let T=l+m*S,E=u+h*S;a.push(this._vertexToIndex(T,E))}(d||p>=i&&p<=o)&&a.push(n[(s+1)%3]),!d&&(p<=i||p>=o)&&this._generateInterEdgeVertices(a,l,u,c,p,f,y,w,i,o)}return a}_generateIntraEdgeVertices(e,r,n,i,o,a,s){let l=i-r,u=o-n,c=u===0,p=c?Math.min(r,i):Math.min(a,s),f=c?Math.max(r,i):Math.max(a,s),y=Math.floor(p/this._granularityCellSize)+1,m=Math.ceil(f/this._granularityCellSize)-1;if(c?r<i:a<s)for(let g=y;g<=m;g++){let d=g*this._granularityCellSize,x=n+u*(d-r)/l;e.push(this._vertexToIndex(d,x))}else for(let g=m;g>=y;g--){let d=g*this._granularityCellSize,x=n+u*(d-r)/l;e.push(this._vertexToIndex(d,x))}}_generateInterEdgeVertices(e,r,n,i,o,a,s,l,u,c){let p=o-n,f=a-i,y=s-o,m=(u-o)/y,h=(c-o)/y,g=Math.min(m,h),d=Math.max(m,h),x=i+f*g,b=Math.floor(Math.min(x,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(x,l)/this._granularityCellSize)-1,S=l<x,A=y===0;if(A&&(s===u||s===c))return;if(A||g>=1||d<=0){let T=r-a,E=n-s,D=(u-s)/E,B=(c-s)/E,z=Math.min(D,B),M=a+T*z;b=Math.floor(Math.min(M,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(M,l)/this._granularityCellSize)-1,S=l<M}let w=p>0?c:u;if(S)for(let T=b;T<=v;T++){let E=T*this._granularityCellSize;e.push(this._vertexToIndex(E,w))}else for(let T=v;T>=b;T--){let E=T*this._granularityCellSize;e.push(this._vertexToIndex(E,w))}}_generateOutline(e){let r=[];for(let n of e){let i=Ke(n,this._granularity,!0),o=this._pointArrayToIndices(i),a=[];for(let s=1;s<o.length;s++)a.push(o[s-1]),a.push(o[s]);r.push(a)}return r}_handlePoles(e){let r=!1,n=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(r||n)&&this._fillPoles(e,r,n)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let r=0;r<e.length;r+=2){let n=e[r+1];n===Vr&&(e[r+1]=Vr+1),n===ui&&(e[r+1]=ui-1)}}_generatePoleQuad(e,r,n,i,o,a){i>o!=(a===Vr)?(e.push(r),e.push(n),e.push(this._vertexToIndex(i,a)),e.push(n),e.push(this._vertexToIndex(o,a)),e.push(this._vertexToIndex(i,a))):(e.push(n),e.push(r),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(o,a)),e.push(n),e.push(this._vertexToIndex(i,a)))}_fillPoles(e,r,n){let i=this._vertexBuffer,o=0,a=8192,s=e.length;for(let l=2;l<s;l+=3){let u=e[l-2],c=e[l-1],p=e[l],f=i[u*2],y=i[u*2+1],m=i[c*2],h=i[c*2+1],g=i[p*2],d=i[p*2+1];r&&(y===o&&h===o&&this._generatePoleQuad(e,u,c,f,m,Vr),h===o&&d===o&&this._generatePoleQuad(e,c,p,m,g,Vr),d===o&&y===o&&this._generatePoleQuad(e,p,u,g,f,Vr)),n&&(y===a&&h===a&&this._generatePoleQuad(e,u,c,f,m,ui),h===a&&d===a&&this._generatePoleQuad(e,c,p,m,g,ui),d===a&&y===a&&this._generatePoleQuad(e,p,u,g,f,ui))}}_initializeVertices(e){for(let r=0;r<e.length;r+=2)this._vertexToIndex(e[r],e[r+1])}subdividePolygonInternal(e,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:n,holeIndices:i}=tb(e);this._initializeVertices(n);let o;try{let s=ml(n,i),l=this._convertIndices(n,s);o=this._subdivideTrianglesScanline(l)}catch(s){console.error(s)}let a=[];return r&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(o),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:a}}_convertIndices(e,r){let n=[];for(let i=0;i<r.length;i++){let o=e[r[i]*2],a=e[r[i]*2+1];n.push(this._vertexToIndex(o,a))}return n}_pointArrayToIndices(e){let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(this._vertexToIndex(i.x,i.y))}return r}};function da(t,e,r,n=!0){return new hl(r,e).subdividePolygonInternal(t,n)}function Ke(t,e,r=!1){if(!t||t.length<1)return[];if(t.length<2)return[];let n=t[0],i=t[t.length-1],o=r&&(n.x!==i.x||n.y!==i.y);if(e<2)return o?[...t,t[0]]:[...t];let a=Math.floor(8192/e),s=[];s.push(new ci.default(t[0].x,t[0].y));let l=t.length,u=o?l:l-1;for(let c=0;c<u;c++){let p=t[c],f=c<l-1?t[c+1]:t[0],y=p.x,m=p.y,h=f.x,g=f.y,d=y!==h,x=m!==g;if(!d&&!x)continue;let b=h-y,v=g-m,S=Math.abs(b),A=Math.abs(v),w=y,T=m;for(;;){let D=b>0?(Math.floor(w/a)+1)*a:(Math.ceil(w/a)-1)*a,B=v>0?(Math.floor(T/a)+1)*a:(Math.ceil(T/a)-1)*a,z=Math.abs(w-D),M=Math.abs(T-B),_=Math.abs(w-h),V=Math.abs(T-g),G=d?z/S:Number.POSITIVE_INFINITY,O=x?M/A:Number.POSITIVE_INFINITY;if((_<=z||!d)&&(V<=M||!x))break;if(G<O&&d||!x){w=D,T=T+v*G;let R=new ci.default(w,Math.round(T));(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}else{w=w+b*O,T=B;let R=new ci.default(Math.round(w),T);(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}}let E=new ci.default(h,g);(s[s.length-1].x!==E.x||s[s.length-1].y!==E.y)&&s.push(E)}return s}function tb(t){let e=[],r=[];for(let n of t)if(n.length!==0){n!==t[0]&&e.push(r.length/2);for(let i=0;i<n.length;i++)r.push(n[i].x),r.push(n[i].y)}return{flattened:r,holeIndices:e}}function rb(t,e){let r=[];for(let n=0;n<e.length;n+=3){let i=e[n],o=e[n+1],a=e[n+2],s=t[i*2],l=t[i*2+1],u=t[o*2],c=t[o*2+1],p=t[a*2],f=t[a*2+1],y=u-s,m=c-l,h=p-s,g=f-l;y*g-m*h>0?(r.push(i),r.push(a),r.push(o)):(r.push(i),r.push(o),r.push(a))}return r}function nb(t,e,r){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let n=0,i=t[e[0]*2];for(let l=1;l<e.length;l++){let u=t[e[l]*2];u<i&&(i=u,n=l)}let o=e.length,a=n,s=(a+1)%o;for(;;){let l=a-1>=0?a-1:o-1,u=(s+1)%o,c=t[e[l]*2],p=t[e[l]*2+1],f=t[e[u]*2],y=t[e[u]*2+1],m=t[e[a]*2],h=t[e[a]*2+1],g=t[e[s]*2],d=t[e[s]*2+1],x=!1;if(c<f)x=!0;else if(c>f)x=!1;else{let b=g-m,S=d-h,A=-b,w=h<d?1:-1,T=((c-m)*S+(p-h)*A)*w,E=((f-m)*S+(y-h)*A)*w;T>E&&(x=!0)}if(x){let b=e[l],v=e[a],S=e[s];b!==v&&b!==S&&v!==S&&r.push(S,v,b),a--,a<0&&(a=o-1)}else{let b=e[u],v=e[a],S=e[s];b!==v&&b!==S&&v!==S&&r.push(S,v,b),s++,s>=o&&(s=0)}if(l===u)break}}function ga(t,e,r,n,i,o,a,s,l){let u=i.length/2,c=a&&s&&l;if(u<pe.MAX_VERTEX_ARRAY_LENGTH){let p=e.prepareSegment(u,r,n),f=p.vertexLength;for(let h=0;h<o.length;h+=3)n.emplaceBack(f+o[h],f+o[h+1],f+o[h+2]);p.vertexLength+=u,p.primitiveLength+=o.length/3;let y,m;c&&(m=a.prepareSegment(u,r,s),y=m.vertexLength,m.vertexLength+=u);for(let h=0;h<i.length;h+=2)t(i[h],i[h+1]);if(c)for(let h=0;h<l.length;h++){let g=l[h];for(let d=1;d<g.length;d+=2)s.emplaceBack(y+g[d-1],y+g[d]);m.primitiveLength+=g.length/2}}else ib(e,r,n,i,o,t),c&&ob(a,r,s,i,l,t),e.forceNewSegmentOnNextPrepare(),a?.forceNewSegmentOnNextPrepare()}function pi(t,e,r,n,i,o,a){if(o){let s=n.count;return r(e[i*2],e[i*2+1]),t[i]=n.count,n.count++,a.vertexLength++,s}else return t[i]}function ib(t,e,r,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let p=2;p<i.length;p+=3){let f=i[p-2],y=i[p-1],m=i[p],h=a[f]<l,g=a[y]<l,d=a[m]<l,x=(h?1:0)+(g?1:0)+(d?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,h=!0,g=!0,d=!0,c=0);let b=pi(a,n,o,s,f,h,u),v=pi(a,n,o,s,y,g,u),S=pi(a,n,o,s,m,d,u);r.emplaceBack(c+b-l,c+v-l,c+S-l),u.primitiveLength++}}function ob(t,e,r,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let p=0;p<i.length;p++){let f=i[p];for(let y=1;y<i[p].length;y+=2){let m=f[y-1],h=f[y],g=a[m]<l,d=a[h]<l,x=(g?1:0)+(d?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,g=!0,d=!0,c=0);let b=pi(a,n,o,s,m,g,u),v=pi(a,n,o,s,h,d,u);r.emplaceBack(c+b-l,c+v-l),u.primitiveLength++}}}var ab=500,ur=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,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 Xo,this.indexArray=new Le,this.indexArray2=new Mt,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.segments2=new pe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Lr("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=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),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:_e(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=Dr("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{},r.subdivisionGranularity);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,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Lp),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,a){for(let s of Yt(r,ab)){let l=da(s,i,a.fill.getGranularityForZoomLevel(i.z)),u=this.layoutVertexArray;ga((c,p)=>{u.emplaceBack(c,p)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles,this.segments2,this.indexArray2,l.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};I("FillBucket",ur,{omit:["layers","patternFeatures"]});var Op,sb=()=>Op=Op||new ee({"fill-sort-key":new L(P.layout_fill["fill-sort-key"])}),Gp,lb=()=>Gp=Gp||new ee({"fill-antialias":new F(P.paint_fill["fill-antialias"]),"fill-opacity":new L(P.paint_fill["fill-opacity"]),"fill-color":new L(P.paint_fill["fill-color"]),"fill-outline-color":new L(P.paint_fill["fill-outline-color"]),"fill-translate":new F(P.paint_fill["fill-translate"]),"fill-translate-anchor":new F(P.paint_fill["fill-translate-anchor"]),"fill-pattern":new pt(P.paint_fill["fill-pattern"])}),Np={get paint(){return lb()},get layout(){return sb()}};var ba=class extends oe{constructor(e){super(e,Np)}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 ur(e)}queryRadius(){return Dt(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:r,transform:n,pixelsToTileUnits:i}){let o=Bt(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-n.bearingInRadians,i);return aa(o,r)}isTileClipped(){return!0}};var ub=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Up=Q([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:$p,size:kS,alignment:FS}=ub;var Jp=Y(Rt(),1);var Pb=Jp.default.VectorTileFeature.types,Sb=500,bl=Math.pow(2,13);function fi(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*bl)*2+a,i*bl*2,o*bl*2,Math.round(s))}var cr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,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 Ho,this.centroidVertexArray=new qo,this.indexArray=new Le,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=Lr("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=Ne(i,l);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:_e(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Dr("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{},r.subdivisionGranularity),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,e.subdivisionGranularity)}}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,$p),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Up.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,a){for(let s of Yt(r,Sb)){let l={x:0,y:0,sampleCount:0},u=this.layoutVertexArray.length;this.processPolygon(l,i,e,s,a);let c=this.layoutVertexArray.length-u,p=Math.floor(l.x/l.sampleCount),f=Math.floor(l.y/l.sampleCount);for(let y=0;y<c;y++)this.centroidVertexArray.emplaceBack(p,f)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}processPolygon(e,r,n,i,o){if(i.length<1||Zp(i[0]))return;for(let p of i)p.length!==0&&wb(e,p);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=o.fill.getGranularityForZoomLevel(r.z),l=Pb[n.type]==="Polygon";for(let p of i){if(p.length===0||Zp(p))continue;let f=Ke(p,s,l);this._generateSideFaces(f,a)}if(!l)return;let u=da(i,r,s,!1),c=this.layoutVertexArray;ga((p,f)=>{fi(c,p,f,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,u.verticesFlattened,u.indicesTriangles)}_generateSideFaces(e,r){let n=0;for(let i=1;i<e.length;i++){let o=e[i],a=e[i-1];if(Ab(o,a))continue;r.segment.vertexLength+4>pe.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=o.sub(a)._perp()._unit(),l=a.dist(o);n+l>32768&&(n=0),fi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,n),fi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,n),n+=l,fi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,n),fi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,n);let u=r.segment.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}};function wb(t,e){for(let r=0;r<e.length;r++){let n=e[r];r===e.length-1&&e[0].x===n.x&&e[0].y===n.y||(t.x+=n.x,t.y+=n.y,t.sampleCount++)}}I("FillExtrusionBucket",cr,{omit:["layers","features"]});function Ab(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Zp(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var Yp,_b=()=>Yp=Yp||new ee({"fill-extrusion-opacity":new F(P["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new L(P["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new F(P["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new F(P["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new pt(P["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new L(P["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new L(P["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new F(P["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),Kp={get paint(){return _b()}};var va=Y(ye(),1);var Pa=class extends oe{constructor(e){super(e,Kp)}createBucket(e){return new cr(e)}queryRadius(){return Dt(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){let l=Bt(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),u=this.paint.get("fill-extrusion-height").evaluate(r,n),c=this.paint.get("fill-extrusion-base").evaluate(r,n),p=Cb(l,s,0),f=Tb(i,c,u,s),y=f[0],m=f[1];return Ib(y,m,p)}};function yi(t,e){return t.x*e.x+t.y*e.y}function Qp(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=yi(s,s),p=yi(s,l),f=yi(l,l),y=yi(u,s),m=yi(u,l),h=c*f-p*p,g=(f*y-p*m)/h,d=(c*m-p*y)/h,x=1-g-d,b=n.z*x+i.z*g+o.z*d;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 Ib(t,e,r){let n=1/0;aa(r,e)&&(n=Qp(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];mp(r,f)&&(n=Math.min(n,Qp(r,f)))}}return n===1/0?!1:n}function Tb(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 h=[],g=[];for(let d of m){let x=d.x,b=d.y,v=n[0]*x+n[4]*b+n[12],S=n[1]*x+n[5]*b+n[13],A=n[2]*x+n[6]*b+n[14],w=n[3]*x+n[7]*b+n[15],T=v+a,E=S+s,D=A+l,B=w+u,z=v+c,M=S+p,_=A+f,V=w+y,G=new va.default(T/B,E/B);G.z=D/B,h.push(G);let O=new va.default(z/V,M/V);O.z=_/V,g.push(O)}i.push(h),o.push(g)}return[i,o]}function Cb(t,e,r){let n=[];for(let i of t){let o=[i.x,i.y,r,1];Wi.transformMat4(o,o,e),n.push(new va.default(o[0]/o[3],o[1]/o[3]))}return n}var kb=Q([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ef,size:fw,alignment:yw}=kb;var Fb=Q([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:tf,size:dw,alignment:gw}=Fb;var of=Y(Rt(),1);var Eb=of.default.VectorTileFeature.types,rf=63,Mb=Math.cos(75/2*(Math.PI/180)),Lb=15,Db=20,Bb=15,af=1/2,nf=Math.pow(2,Bb-1)/af,pr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,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 Zo,this.layoutVertexArray2=new Jo,this.indexArray=new Le,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Lr("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=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),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:_e(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=Dr("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{},r.subdivisionGranularity);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,e.subdivisionGranularity)}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,tf)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ef),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,a){let s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),u=s.get("line-cap"),c=s.get("line-miter-limit"),p=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let f of r)this.addLine(f,e,l,u,c,p,i,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,r,n,i,o,a,s,l){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let u=s?l.line.getGranularityForZoomLevel(s.z):1;if(e=Ke(e,u),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<e.length-1;v++)this.totalDistance+=e[v].dist(e[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=Eb[r.type]==="Polygon",p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let f=0;for(;f<p-1&&e[f].equals(e[f+1]);)f++;if(p<(c?3:2))return;n==="bevel"&&(o=1.05);let y=this.overscaling<=16?Lb*8192/(512*this.overscaling):0,m=this.segments.prepareSegment(p*10,this.layoutVertexArray,this.indexArray),h,g,d,x,b;this.e1=this.e2=-1,c&&(h=e[p-2],b=e[f].sub(h)._unit()._perp());for(let v=f;v<p;v++){if(d=v===p-1?c?e[f+1]:void 0:e[v+1],d&&e[v].equals(d))continue;b&&(x=b),h&&(g=h),h=e[v],b=d?d.sub(h)._unit()._perp():x,x=x||b;let S=x.add(b);(S.x!==0||S.y!==0)&&S._unit();let A=x.x*b.x+x.y*b.y,w=S.x*b.x+S.y*b.y,T=w!==0?1/w:1/0,E=2*Math.sqrt(2-2*w),D=w<Mb&&g&&d,B=x.x*b.y-x.y*b.x>0;if(D&&v>f){let _=h.dist(g);if(_>2*y){let V=h.sub(h.sub(g)._mult(y/_)._round());this.updateDistance(g,V),this.addCurrentVertex(V,x,0,0,m),g=V}}let z=g&&d,M=z?n:c?"butt":i;if(z&&M==="round"&&(T<a?M="miter":T<=2&&(M="fakeround")),M==="miter"&&T>o&&(M="bevel"),M==="bevel"&&(T>2&&(M="flipbevel"),T<o&&(M="miter")),g&&this.updateDistance(g,h),M==="miter")S._mult(T),this.addCurrentVertex(h,S,0,0,m);else if(M==="flipbevel"){if(T>100)S=b.mult(-1);else{let _=T*x.add(b).mag()/x.sub(b).mag();S._perp()._mult(_*(B?-1:1))}this.addCurrentVertex(h,S,0,0,m),this.addCurrentVertex(h,S.mult(-1),0,0,m)}else if(M==="bevel"||M==="fakeround"){let _=-Math.sqrt(T*T-1),V=B?_:0,G=B?0:_;if(g&&this.addCurrentVertex(h,x,V,G,m),M==="fakeround"){let O=Math.round(E*180/Math.PI/Db);for(let R=1;R<O;R++){let K=R/O;if(K!==.5){let re=K-.5,me=1.0904+A*(-3.2452+A*(3.55645-A*1.43519)),Ut=.848013+A*(-1.06021+A*.215638);K=K+K*re*(K-1)*(me*re*re+Ut)}let X=b.sub(x)._mult(K)._add(x)._unit()._mult(B?-1:1);this.addHalfVertex(h,X.x,X.y,!1,B,0,m)}}d&&this.addCurrentVertex(h,b,-V,-G,m)}else if(M==="butt")this.addCurrentVertex(h,S,0,0,m);else if(M==="square"){let _=g?1:-1;this.addCurrentVertex(h,S,_,_,m)}else M==="round"&&(g&&(this.addCurrentVertex(h,x,0,0,m),this.addCurrentVertex(h,x,1,1,m,!0)),d&&(this.addCurrentVertex(h,b,-1,-1,m,!0),this.addCurrentVertex(h,b,0,0,m)));if(D&&v<p-1){let _=h.dist(d);if(_>2*y){let V=h.add(d.sub(h)._mult(y/_)._round());this.updateDistance(h,V),this.addCurrentVertex(V,b,0,0,m),h=V}}}}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>nf/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*(nf-1):this.scaledDistance)*af;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(rf*n)+128,Math.round(rf*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,p,this.e2),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()}};I("LineBucket",pr,{omit:["layers","patternFeatures"]});var sf,Vb=()=>sf=sf||new ee({"line-cap":new F(P.layout_line["line-cap"]),"line-join":new L(P.layout_line["line-join"]),"line-miter-limit":new F(P.layout_line["line-miter-limit"]),"line-round-limit":new F(P.layout_line["line-round-limit"]),"line-sort-key":new L(P.layout_line["line-sort-key"])}),lf,Rb=()=>lf=lf||new ee({"line-opacity":new L(P.paint_line["line-opacity"]),"line-color":new L(P.paint_line["line-color"]),"line-translate":new F(P.paint_line["line-translate"]),"line-translate-anchor":new F(P.paint_line["line-translate-anchor"]),"line-width":new L(P.paint_line["line-width"]),"line-gap-width":new L(P.paint_line["line-gap-width"]),"line-offset":new L(P.paint_line["line-offset"]),"line-blur":new L(P.paint_line["line-blur"]),"line-dasharray":new tr(P.paint_line["line-dasharray"]),"line-pattern":new pt(P.paint_line["line-pattern"]),"line-gradient":new ft(P.paint_line["line-gradient"])}),xl={get paint(){return Rb()},get layout(){return Vb()}};var vl=class extends L{possiblyEvaluate(e,r){return r=new W(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=de({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},Sa;var wa=class extends oe{constructor(e){super(e,xl),this.gradientVersion=0,Sa||(Sa=new vl(xl.paint.properties["line-width"].specification),Sa.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();fc(r)?this.stepInterpolant=r._styleExpression.expression instanceof Pr:this.stepInterpolant=!1,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"]=Sa.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new pr(e)}queryRadius(e){let r=e,n=uf(ar("line-width",this,r),ar("line-gap-width",this,r)),i=ar("line-offset",this,r);return n/2+Math.abs(i)+Dt(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a}){let s=Bt(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*uf(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),u=this.paint.get("line-offset").evaluate(r,n);return u&&(i=bp(i,u*a)),dp(s,i,l)}isTileClipped(){return!0}};function uf(t,e){return e>0?e+2*t:t}var cf=Q([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pf=Q([{name:"a_projected_pos",components:3,type:"Float32"}],4),Zw=Q([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),ff=Q([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),Jw=Q([{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"}]),Pl=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Yw=Q([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Kw=Q([{name:"triangle",components:3,type:"Uint16"}]),Qw=Q([{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"}]),eA=Q([{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",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),tA=Q([{type:"Float32",name:"offsetX"}]),rA=Q([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),nA=Q([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var vi=Y(ye(),1);function zb(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),we.applyArabicShaping&&(t=we.applyArabicShaping(t)),t}function yf(t,e,r){return t.sections.forEach(n=>{n.text=zb(n.text,e,r)}),t}function mf(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 h=s(y,m,p),g=a(y,m,n[h].geometry);delete e[y],delete r[m],r[l(f,n[g].geometry,!0)]=g,n[h].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 zr={"!":"\\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 hf(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||!Ys(n)||zr[t[r+1]])&&(!i||!Ys(i)||zr[t[r-1]])&&zr[t[r]]?e+=zr[t[r]]:e+=t[r]}return e}var ae=24;var rx=Y(mi(),1),nx=3;var Ia=nx;function hi(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 i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),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 he=1;var Ta=class{constructor(e,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a,textFitWidth:s,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n,this.textFitWidth=s,this.textFitHeight=l}get tl(){return[this.paddedRect.x+he,this.paddedRect.y+he]}get br(){return[this.paddedRect.x+this.paddedRect.w-he,this.paddedRect.y+this.paddedRect.h-he]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-he*2)/this.pixelRatio,(this.paddedRect.h-he*2)/this.pixelRatio]}},di=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}=hi(o),l=new fe({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;fe.copy(c.data,l,{x:0,y:0},{x:p.x+he,y:p.y+he},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+he,y=p.y+he,m=c.data.width,h=c.data.height;fe.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),fe.copy(c.data,l,{x:0,y:h-1},{x:f,y:y-1},{width:m,height:1}),fe.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),fe.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),fe.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:h})}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*he,h:o.data.height+2*he};n.push(a),r[i]=new Ta(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})}};I("ImagePosition",Ta);I("ImageAtlas",di);var Fa=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(Fa||{}),bi=-17;function ix(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var Sf=57344,wf=63743,Ca=class t{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(e,r,n){let i=new t;return i.scale=e||1,i.fontStack=r,i.verticalAlign=n||"bottom",i}static forImage(e,r){let n=new t;return n.imageName=e,n.verticalAlign=r||"bottom",n}},gi=class t{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){let n=new t;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=hf(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&ka[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&ka[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 t;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)}getMaxImageSize(e){let r=0,n=0;for(let i=0;i<this.length();i++){let o=this.getSection(i);if(o.imageName){let a=e[o.imageName];if(!a)continue;let s=a.displaySize;r=Math.max(r,s[0]),n=Math.max(n,s[1])}}return{maxImageWidth:r,maxImageHeight:n}}addTextSection(e,r){this.text+=e.text,this.sections.push(Ca.forText(e.scale,e.fontStack||r,e.verticalAlign));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 ${wf-Sf+2}`);return}this.text+=String.fromCharCode(n),this.sections.push(Ca.forImage(r,e.verticalAlign)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=wf?null:++this.imageSectionID:(this.imageSectionID=Sf,this.imageSectionID)}};function ox(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 xi(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=gi.fromFeature(t,i);p===2&&h.verticalizePunctuation();let g,{processBidirectionalText:d,processStyledBidirectionalText:x}=we;if(d&&h.sections.length===1){g=[];let S=d(h.toString(),Al(h,u,o,e,n,y));for(let A of S){let w=new gi;w.text=A,w.sections=h.sections;for(let T=0;T<A.length;T++)w.sectionIndex.push(0);g.push(w)}}else if(x){g=[];let S=x(h.text,h.sectionIndex,Al(h,u,o,e,n,y));for(let A of S){let w=new gi;w.text=A[0],w.sectionIndex=A[1],w.sections=h.sections,g.push(w)}}else g=ox(h,Al(h,u,o,e,n,y));let b=[],v={positionedLines:b,text:h.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return yx(v,e,r,n,g,a,s,l,p,u,f,m),ix(b)?!1:v}var ka={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ax={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},sx={40:!0};function If(t,e,r,n,i,o){if(e.imageName){let a=n[e.imageName];return a?a.displaySize[0]*e.scale*ae/o+i:0}else{let a=r[e.fontStack],s=a&&a[t];return s?s.metrics.advance*e.scale+i:0}}function lx(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=If(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function Af(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 ux(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 _f(t,e,r,n,i,o){let a=null,s=Af(e,r,i,o);for(let l of n){let u=e-l.x,c=Af(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function Tf(t){return t?Tf(t.priorBreak).concat(t.index):[]}function Al(t,e,r,n,i,o){if(!t)return[];let a=[],s=lx(t,e,r,n,i,o),l=t.text.indexOf("\\u200B")>=0,u=0;for(let c=0;c<t.length();c++){let p=t.getSection(c),f=t.getCharCode(c);if(ka[f]||(u+=If(f,p,n,i,e,o)),c<t.length()-1){let y=Yc(f);(ax[f]||y||p.imageName||c!==t.length()-2&&sx[t.getCharCode(c+1)])&&a.push(_f(c+1,u,s,a,ux(f,t.getCharCode(c+1),y&&l),!1))}}return Tf(_f(t.length(),u,s,a,0,!0))}function Cf(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 cx(t,e,r){let n=e.getMaxScale()*ae,{maxImageWidth:i,maxImageHeight:o}=e.getMaxImageSize(t),a=Math.max(n,o*r);return{verticalLineContentWidth:Math.max(n,i*r),horizontalLineContentHeight:a}}function kf(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function px(t,e,r,n){if(t&&t.rect)return t;let i=e[r.fontStack],o=i&&i[n];return o?{rect:null,metrics:o.metrics}:null}function fx(t,e,r){return!(t===1||!e&&!Eo(r)||e&&(ka[r]||Kc(r)))}function yx(t,e,r,n,i,o,a,s,l,u,c,p){let f=0,y=0,m=0,h=0,g=s==="right"?1:s==="left"?0:.5,d=ae/p,x=0;for(let S of i){S.trim();let A=S.getMaxScale(),w={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=w;let T=w.positionedGlyphs,E=0;if(!S.length()){y+=o,++x;continue}let D=cx(n,S,d);for(let M=0;M<S.length();M++){let _=S.getSection(M),V=S.getSectionIndex(M),G=S.getCharCode(M),O=fx(l,c,G),R;if(_.imageName){if(t.iconsInText=!0,_.scale=_.scale*d,R=hx(_,O,A,D,n),!R)continue;E=Math.max(E,R.imageOffset)}else if(R=mx(_,G,O,D,e,r),!R)continue;let{rect:K,metrics:X,baselineOffset:re}=R;if(T.push({glyph:G,imageName:_.imageName,x:f,y:y+re+bi,vertical:O,scale:_.scale,fontStack:_.fontStack,sectionIndex:V,metrics:X,rect:K}),!O)f+=X.advance*_.scale+u;else{t.verticalizable=!0;let me=_.imageName?X.advance:ae;f+=me*_.scale+u}}if(T.length!==0){let M=f-u;m=Math.max(M,m),dx(T,0,T.length-1,g)}f=0;let B=(A-1)*ae;w.lineOffset=Math.max(E,B);let z=o*A+E;y+=z,h=Math.max(z,h),++x}let{horizontalAlign:b,verticalAlign:v}=Cf(a);gx(t.positionedLines,g,b,v,m,h,o,y,i.length),t.top+=-v*y,t.bottom=t.top+y,t.left+=-b*m,t.right=t.left+m}function mx(t,e,r,n,i,o){let a=o[t.fontStack],s=a&&a[e],l=px(s,i,t,e);if(l===null)return null;let u;if(r)u=n.verticalLineContentWidth-t.scale*ae;else{let c=kf(t.verticalAlign);u=(n.horizontalLineContentHeight-t.scale*ae)*c}return{rect:l.rect,metrics:l.metrics,baselineOffset:u}}function hx(t,e,r,n,i){let o=i[t.imageName];if(!o)return null;let a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:he,top:-Ia,advance:e?s[1]:s[0]},u;if(e)u=n.verticalLineContentWidth-s[1]*t.scale;else{let p=kf(t.verticalAlign);u=(n.horizontalLineContentHeight-s[1]*t.scale)*p}let c=(e?s[0]:s[1])*t.scale-ae*r;return{rect:a,metrics:l,baselineOffset:u,imageOffset:c}}function dx(t,e,r,n){if(n===0)return;let i=t[r],o=i.metrics.advance*i.scale,a=(t[r].x+o)*n;for(let s=e;s<=r;s++)t[s].x-=a}function gx(t,e,r,n,i,o,a,s,l){let u=(e-r)*i,c=0;o!==a?c=-s*n-bi:c=-n*l*a+.5*a;for(let p of t)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function Ff(t,e,r){let{horizontalAlign:n,verticalAlign:i}=Cf(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 Ea(t){let e=t.left,r=t.top,n=t.right-e,i=t.bottom-r,o=t.image.content[2]-t.image.content[0],a=t.image.content[3]-t.image.content[1],s=t.image.textFitWidth??"stretchOrShrink",l=t.image.textFitHeight??"stretchOrShrink",u=o/a;if(l==="proportional"){if(s==="stretchOnly"&&n/i<u||s==="proportional"){let c=Math.ceil(i*u);e*=c/n,n=c}}else if(s==="proportional"&&l==="stretchOnly"&&u!==0&&n/i>u){let c=Math.ceil(n/u);r*=c/i,i=c}return{x1:e,y1:r,x2:e+n,y2:r+i}}function _l(t,e,r,n,i,o){let a=t.image,s;if(a.content){let g=a.content,d=a.pixelRatio||1;s=[g[0]/d,g[1]/d,a.displaySize[0]-g[2]/d,a.displaySize[1]-g[3]/d]}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,h=e.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+h+n[2]):(c=i[1]+(m+h-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var Ef=Y(Rt(),1);var Nr=255,zt=128,Qe=Nr*zt;function Il(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new W(t+1))};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 W(s)),c=r.evaluate(new W(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function Tl(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var bx=Ef.default.VectorTileFeature.types,xx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ma(t,e,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(Qe,Math.round(s[0])):0,m=s?Math.min(Qe,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 Mf(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 vx(t){for(let e of t.sections)if(ep(e.text))return!0;return!1}var Pi=class{constructor(e){this.layoutVertexArray=new Yo,this.indexArray=new Le,this.programConfigurations=e,this.segments=new pe,this.dynamicLayoutVertexArray=new Ko,this.opacityVertexArray=new Qo,this.hasVisibleVertices=!1,this.placedSymbolArray=new qn}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,cf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,pf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,xx,!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())}};I("SymbolBuffers",Pi);var Si=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new pe,this.collisionVertexArray=new ea}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,ff.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};I("CollisionBuffers",Si);var Xe=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,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=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Il(this.zoom,n["text-size"]),this.iconSizeData=Il(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=Tl(i,"text-overlap","text-allow-overlap")!=="never"||Tl(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=>Fa[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Pi(new Ae(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Pi(new Ae(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Xn,this.lineVertexArray=new Hn,this.symbolInstances=new Wn,this.textAnchorOffsets=new Zn}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=zr[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 Fe&&!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,h=new W(this.zoom,{globalState:this.globalState});for(let{feature:g,id:d,index:x,sourceLayerIndex:b}of e){let v=i._featureFilter.needGeometry,S=Ne(g,v);if(!i._featureFilter.filter(h,S,n))continue;v||(S.geometry=_e(g));let A;if(u){let D=i.getValueAndResolveTokens("text-field",S,n,m),B=Fe.factory(D),z=this.hasRTLText=this.hasRTLText||vx(B);(!z||we.getRTLTextPluginStatus()==="unavailable"||z&&we.isParsed())&&(A=yf(B,i,S))}let w;if(c){let D=i.getValueAndResolveTokens("icon-image",S,n,m);D instanceof Se?w=D:w=Se.fromString(D)}if(!A&&!w)continue;let T=this.sortFeaturesByKey?p.evaluate(S,{},n):void 0,E={id:d,text:A,icon:w,index:x,sourceLayerIndex:b,geometry:S.geometry,properties:g.properties,type:bx[g.type],sortKey:T};if(this.features.push(E),w&&(f[w.name]=!0),A){let D=a.evaluate(S,{},n).join(","),B=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let z of A.sections)if(z.image)f[z.image.name]=!0;else{let M=In(A.toString()),_=z.fontStack||D,V=y[_]=y[_]||{};this.calculateGlyphDependencies(z.text,V,B,this.allowVerticalPlacement,M)}}}o.get("symbol-placement")==="line"&&(this.features=mf(this.features)),this.sortFeaturesByKey&&this.features.sort((g,d)=>g.sortKey-d.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,h=e.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,d=h.vertexLength,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<r.length;v++){let{tl:S,tr:A,bl:w,br:T,tex:E,pixelOffsetTL:D,pixelOffsetBR:B,minFontScaleX:z,minFontScaleY:M,glyphOffset:_,isSDF:V,sectionIndex:G}=r[v],O=h.vertexLength,R=_[1];Ma(m,l.x,l.y,S.x,R+S.y,E.x,E.y,n,V,D.x,D.y,z,M),Ma(m,l.x,l.y,A.x,R+A.y,E.x+E.w,E.y,n,V,B.x,D.y,z,M),Ma(m,l.x,l.y,w.x,R+w.y,E.x,E.y+E.h,n,V,D.x,B.y,z,M),Ma(m,l.x,l.y,T.x,R+T.y,E.x+E.w,E.y+E.h,n,V,B.x,B.y,z,M),Mf(e.dynamicLayoutVertexArray,l,x),y.emplaceBack(O,O+2,O+1),y.emplaceBack(O+1,O+2,O+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(_[0]),(v===r.length-1||G!==r[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,b&&b[G])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,d,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 vi.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.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 Si(Yn,Pl.members,Mt),this.iconCollisionBox=new Si(Yn,Pl.members,Mt);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+2,o+1),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)}}};I("SymbolBucket",Xe,{omit:["layers","collisionBoxArray","features","compareText"]});Xe.MAX_GLYPHS=65535;Xe.addDynamicAttributes=Mf;function Lf(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}var Df,Px=()=>Df=Df||new ee({"symbol-placement":new F(P.layout_symbol["symbol-placement"]),"symbol-spacing":new F(P.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new F(P.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new L(P.layout_symbol["symbol-sort-key"]),"symbol-z-order":new F(P.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new F(P.layout_symbol["icon-allow-overlap"]),"icon-overlap":new F(P.layout_symbol["icon-overlap"]),"icon-ignore-placement":new F(P.layout_symbol["icon-ignore-placement"]),"icon-optional":new F(P.layout_symbol["icon-optional"]),"icon-rotation-alignment":new F(P.layout_symbol["icon-rotation-alignment"]),"icon-size":new L(P.layout_symbol["icon-size"]),"icon-text-fit":new F(P.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new F(P.layout_symbol["icon-text-fit-padding"]),"icon-image":new L(P.layout_symbol["icon-image"]),"icon-rotate":new L(P.layout_symbol["icon-rotate"]),"icon-padding":new L(P.layout_symbol["icon-padding"]),"icon-keep-upright":new F(P.layout_symbol["icon-keep-upright"]),"icon-offset":new L(P.layout_symbol["icon-offset"]),"icon-anchor":new L(P.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new F(P.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new F(P.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new F(P.layout_symbol["text-rotation-alignment"]),"text-field":new L(P.layout_symbol["text-field"]),"text-font":new L(P.layout_symbol["text-font"]),"text-size":new L(P.layout_symbol["text-size"]),"text-max-width":new L(P.layout_symbol["text-max-width"]),"text-line-height":new F(P.layout_symbol["text-line-height"]),"text-letter-spacing":new L(P.layout_symbol["text-letter-spacing"]),"text-justify":new L(P.layout_symbol["text-justify"]),"text-radial-offset":new L(P.layout_symbol["text-radial-offset"]),"text-variable-anchor":new F(P.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new L(P.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new L(P.layout_symbol["text-anchor"]),"text-max-angle":new F(P.layout_symbol["text-max-angle"]),"text-writing-mode":new F(P.layout_symbol["text-writing-mode"]),"text-rotate":new L(P.layout_symbol["text-rotate"]),"text-padding":new F(P.layout_symbol["text-padding"]),"text-keep-upright":new F(P.layout_symbol["text-keep-upright"]),"text-transform":new L(P.layout_symbol["text-transform"]),"text-offset":new L(P.layout_symbol["text-offset"]),"text-allow-overlap":new F(P.layout_symbol["text-allow-overlap"]),"text-overlap":new F(P.layout_symbol["text-overlap"]),"text-ignore-placement":new F(P.layout_symbol["text-ignore-placement"]),"text-optional":new F(P.layout_symbol["text-optional"])}),Bf,Sx=()=>Bf=Bf||new ee({"icon-opacity":new L(P.paint_symbol["icon-opacity"]),"icon-color":new L(P.paint_symbol["icon-color"]),"icon-halo-color":new L(P.paint_symbol["icon-halo-color"]),"icon-halo-width":new L(P.paint_symbol["icon-halo-width"]),"icon-halo-blur":new L(P.paint_symbol["icon-halo-blur"]),"icon-translate":new F(P.paint_symbol["icon-translate"]),"icon-translate-anchor":new F(P.paint_symbol["icon-translate-anchor"]),"text-opacity":new L(P.paint_symbol["text-opacity"]),"text-color":new L(P.paint_symbol["text-color"],{runtimeType:ze,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new L(P.paint_symbol["text-halo-color"]),"text-halo-width":new L(P.paint_symbol["text-halo-width"]),"text-halo-blur":new L(P.paint_symbol["text-halo-blur"]),"text-translate":new F(P.paint_symbol["text-translate"]),"text-translate-anchor":new F(P.paint_symbol["text-translate-anchor"])}),La={get paint(){return Sx()},get layout(){return Px()}};var wi=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:wr,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}};I("FormatSectionOverride",wi,{omit:["defaultValue"]});var Da=class t extends oe{constructor(e){super(e,La)}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()&&!wn(a.value)&&o?Lf(r.properties,o):o}createBucket(e){return new Xe(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of La.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new wi(r),i=new Ht(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new Je("source",i):o=new Tt("composite",i,r.value.zoomStops),this.paint._values[e]=new ge(r.property,o,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!this.layout||r.isDataDriven()||n.isDataDriven()?!1:t.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let n=e.get("text-field"),i=La.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 Fe)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof _t&&ue(u.value)===Ar){let c=u.value;a(c.sections)}else u instanceof pn?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};function Vf(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 Rf,wx=()=>Rf=Rf||new ee({"background-color":new F(P.paint_background["background-color"]),"background-pattern":new tr(P.paint_background["background-pattern"]),"background-opacity":new F(P.paint_background["background-opacity"])}),zf={get paint(){return wx()}};var Ba=class extends oe{constructor(e){super(e,zf)}};var Of,Ax=()=>Of=Of||new ee({"raster-opacity":new F(P.paint_raster["raster-opacity"]),"raster-hue-rotate":new F(P.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new F(P.paint_raster["raster-brightness-min"]),"raster-brightness-max":new F(P.paint_raster["raster-brightness-max"]),"raster-saturation":new F(P.paint_raster["raster-saturation"]),"raster-contrast":new F(P.paint_raster["raster-contrast"]),"raster-resampling":new F(P.paint_raster["raster-resampling"]),"raster-fade-duration":new F(P.paint_raster["raster-fade-duration"])}),Gf={get paint(){return Ax()}};var Va=class extends oe{constructor(e){super(e,Gf)}};var Ra=class extends oe{constructor(r){super(r,{});this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)};this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)};this.implementation=r}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 Nf(t){if(t.type==="custom")return new Ra(t);switch(t.type){case"background":return new Ba(t);case"circle":return new la(t);case"color-relief":return new pa(t);case"fill":return new ba(t);case"fill-extrusion":return new Pa(t);case"heatmap":return new ua(t);case"hillshade":return new ca(t);case"line":return new wa(t);case"raster":return new Va(t);case"symbol":return new Da(t)}}var za=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]=Nf(i);o._featureFilter=Ct(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=dc(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 fy=Y(Rt(),1),yy=Y(mi(),1);var Ur=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 $f=Y(Rt(),1),jf=Y(mi(),1);var Oa=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 Ai=Y(ye(),1),fr=class t{constructor(){this.minX=1/0;this.maxX=-1/0;this.minY=1/0;this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new t;return r.extend(e(new Ai.default(this.minX,this.minY))),r.extend(e(new Ai.default(this.maxX,this.minY))),r.extend(e(new Ai.default(this.minX,this.maxY))),r.extend(e(new Ai.default(this.maxX,this.maxY))),r}static fromPoints(e){let r=new t;for(let n of e)r.extend(n);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}};var _i=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 $t(8192,16,0),this.grid3D=new $t(8192,16,0),this.featureIndexArray=new Jn,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]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new $f.default.VectorTile(new jf.default(this.rawTileData)).layers,this.sourceLayerCoder=new Ur(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,n,i){this.loadVTLayers();let o=e.params,a=8192/e.tileSize/e.scale,s=Ct(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=fr.fromPoints(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=fr.fromPoints(e.cameraQueryGeometry).expandBy(u),y=this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,(g,d,x,b)=>gp(e.cameraQueryGeometry,g-u,d-u,x+u,b+u));for(let g of y)p.push(g);p.sort(_x);let m={},h;for(let g=0;g<p.length;g++){let d=p[g];if(d===h)continue;h=d;let x=this.featureIndexArray.get(d),b=null;this.loadMatchingFeature(m,x.bucketIndex,x.sourceLayerIndex,x.featureIndex,s,o.layers,o.availableImages,r,n,i,(v,S,A)=>(b||(b=_e(v)),S.queryIntersectsFeature({queryGeometry:l,feature:v,featureState:A,geometry:b,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return m}loadMatchingFeature(e,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!f.some(d=>a.has(d)))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let d=Ne(h,!0);if(!o.filter(new W(this.tileID.overscaledZ),d,this.tileID.canonical))return}else if(!o.filter(new W(this.tileID.overscaledZ),h))return;let g=this.getId(h,y);for(let d=0;d<f.length;d++){let x=f[d];if(a&&!a.has(x))continue;let b=l[x];if(!b)continue;let v={};g&&c&&(v=c.getState(b.sourceLayer||"_geojsonTileLayer",g));let S=de({},u[x]);S.paint=Uf(S.paint,b.paint,h,v,s),S.layout=Uf(S.layout,b.layout,h,v,s);let A=!p||p(h,b,v);if(!A)continue;let w=new Oa(h,this.z,this.x,this.y,g);w.layer=S;let T=e[x];T===void 0&&(T=e[x]=[]),T.push({featureIndex:i,feature:w,intersectionZ:A})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=Ct(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)),n===void 0&&e.properties?.cluster&&this.promoteId&&(n=Number(e.properties.cluster_id))}return n}};I("FeatureIndex",_i,{omit:["rawTileData","sourceLayerCoder"]});function Uf(t,e,r,n,i){return tn(t,(o,a)=>{let s=e instanceof kt?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function _x(t,e){return e-t}var qf=Y(ye(),1);var et=class t extends qf.default{constructor(e,r,n,i){super(e,r),this.angle=n,i!==void 0&&(this.segment=i)}clone(){return new t(this.x,this.y,this.angle,this.segment)}};I("Anchor",et);function Cl(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 Wf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Xf(t,e,r){return t?3/5*e*r:0}function Hf(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Zf(t,e,r,n,i,o){let a=Xf(r,i,o),s=Hf(r,n)*o,l=0,u=Wf(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,h=lt.number(p.x,f.x,m),g=lt.number(p.y,f.y,m),d=new et(h,g,f.angleTo(p),c);return d._round(),!a||Cl(t,d,s,a,e)?d:void 0}l+=y}}function Jf(t,e,r,n,i,o,a,s,l){let u=Xf(n,o,a),c=Hf(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 Yf(t,m,e,u,r,p,f,!1,l)}function Yf(t,e,r,n,i,o,a,s,l){let u=o/2,c=Wf(t),p=0,f=e-r,y=[];for(let m=0;m<t.length-1;m++){let h=t[m],g=t[m+1],d=h.dist(g),x=g.angleTo(h);for(;f+r<p+d;){f+=r;let b=(f-p)/d,v=lt.number(h.x,g.x,b),S=lt.number(h.y,g.y,b);if(v>=0&&v<l&&S>=0&&S<l&&f-u>=0&&f+u<=c){let A=new et(v,S,x,m);A._round(),(!n||Cl(t,A,o,n,i))&&y.push(A)}}p+=d}return!s&&!y.length&&!a&&(y=Yf(t,p/2,r,n,i,o,a,!0,l)),y}var ht=Y(ye(),1);function Kf(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 ht.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new ht.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 ht.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new ht.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 ht.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new ht.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 ht.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new ht.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 be=Y(ye(),1);var $r=he;function kl(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*$r,l=o.paddedRect.h-2*$r,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},c=o.stretchX||[[0,s]],p=o.stretchY||[[0,l]],f=(_,V)=>_+V[1]-V[0],y=c.reduce(f,0),m=p.reduce(f,0),h=s-y,g=l-m,d=0,x=y,b=0,v=m,S=0,A=h,w=0,T=g;if(o.content&&n){let _=o.content,V=_[2]-_[0],G=_[3]-_[1];(o.textFitWidth||o.textFitHeight)&&(u=Ea(t)),d=Ga(c,0,_[0]),b=Ga(p,0,_[1]),x=Ga(c,_[0],_[2]),v=Ga(p,_[1],_[3]),S=_[0]-d,w=_[1]-b,A=V-x,T=G-v}let E=u.x1,D=u.y1,B=u.x2-E,z=u.y2-D,M=(_,V,G,O)=>{let R=Na(_.stretch-d,x,B,E),K=Ua(_.fixed-S,A,_.stretch,y),X=Na(V.stretch-b,v,z,D),re=Ua(V.fixed-w,T,V.stretch,m),me=Na(G.stretch-d,x,B,E),Ut=Ua(G.fixed-S,A,G.stretch,y),tt=Na(O.stretch-b,v,z,D),gt=Ua(O.fixed-w,T,O.stretch,m),Gi=new be.default(R,X),Ni=new be.default(me,X),Ui=new be.default(me,tt),$i=new be.default(R,tt),is=new be.default(K/a,re/a),Ie=new be.default(Ut/a,gt/a),bt=e*Math.PI/180;if(bt){let xt=Math.sin(bt),Zr=Math.cos(bt),Be=[Zr,-xt,xt,Zr];Gi._matMult(Be),Ni._matMult(Be),$i._matMult(Be),Ui._matMult(Be)}let Hr=_.stretch+_.fixed,os=G.stretch+G.fixed,ji=V.stretch+V.fixed,as=O.stretch+O.fixed,Te={x:o.paddedRect.x+$r+Hr,y:o.paddedRect.y+$r+ji,w:os-Hr,h:as-ji},xe=A/a/B,rt=T/a/z;return{tl:Gi,tr:Ni,bl:$i,br:Ui,tex:Te,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:is,pixelOffsetBR:Ie,minFontScaleX:xe,minFontScaleY:rt,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let _=Qf(c,h,y),V=Qf(p,g,m);for(let G=0;G<_.length-1;G++){let O=_[G],R=_[G+1];for(let K=0;K<V.length-1;K++){let X=V[K],re=V[K+1];i.push(M(O,X,R,re))}}}return i}function Ga(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 Qf(t,e,r){let n=[{fixed:-$r,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+$r,stretch:r}),n}function Na(t,e,r,n){return t/e*r+n}function Ua(t,e,r,n){return t-e*r/n}function ey(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=Ia+1,h=!0,g=1,d=0,x=(i||s)&&p.vertical,b=p.metrics.advance*p.scale/2;if(s&&e.verticalizable){let X=(p.scale-1)*ae,re=(ae-p.metrics.width*p.scale)/2;d=c.lineOffset/2-(p.imageName?-re:X)}if(p.imageName){let X=a[p.imageName];h=X.sdf,g=X.pixelRatio,m=he/g}let v=i?[p.x+b,p.y]:[0,0],S=i?[0,0]:[p.x+b+r[0],p.y+r[1]-d],A=[0,0];x&&(A=S,S=[0,0]);let w=p.metrics.isDoubleResolution?2:1,T=(p.metrics.left-m)*p.scale-b+S[0],E=(-p.metrics.top-m)*p.scale+S[1],D=T+f.w/w*p.scale/g,B=E+f.h/w*p.scale/g,z=new be.default(T,E),M=new be.default(D,E),_=new be.default(T,B),V=new be.default(D,B);if(x){let X=new be.default(-b,b-bi),re=-Math.PI/2,me=ae/2-b,Ut=p.imageName?me:0,tt=new be.default(5-bi-me,-Ut),gt=new be.default(...A);z._rotateAround(re,X)._add(tt)._add(gt),M._rotateAround(re,X)._add(tt)._add(gt),_._rotateAround(re,X)._add(tt)._add(gt),V._rotateAround(re,X)._add(tt)._add(gt)}if(l){let X=Math.sin(l),re=Math.cos(l),me=[re,-X,X,re];z._matMult(me),M._matMult(me),_._matMult(me),V._matMult(me)}let G=new be.default(0,0),O=new be.default(0,0);u.push({tl:z,tr:M,bl:_,br:V,tex:f,writingMode:e.writingMode,glyphOffset:v,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:G,pixelOffsetBR:O,minFontScaleX:0,minFontScaleY:0})}return u}var Ii=Y(ye(),1);var yr=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.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?Ea(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};p.y1=p.y1*s-l[0],p.y2=p.y2*s+l[2],p.x1=p.x1*s-l[3],p.x2=p.x2*s+l[1];let f=a.collisionPadding;if(f&&(p.x1-=f[0]*s,p.y1-=f[1]*s,p.x2+=f[2]*s,p.y2+=f[3]*s),c){let y=new Ii.default(p.x1,p.y1),m=new Ii.default(p.x2,p.y1),h=new Ii.default(p.x1,p.y2),g=new Ii.default(p.x2,p.y2),d=c*Math.PI/180;y._rotate(d),m._rotate(d),h._rotate(d),g._rotate(d),p.x1=Math.min(y.x,m.x,h.x,g.x),p.x2=Math.max(y.x,m.x,h.x,g.x),p.y1=Math.min(y.y,m.y,h.y,g.y),p.y2=Math.max(y.y,m.y,h.y,g.y)}e.emplaceBack(r.x,r.y,p.x1,p.y1,p.x2,p.y2,n,i,o)}this.boxEndIndex=e.length}};var Ti=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){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._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--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=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};var Fl=Y(ye(),1);function ty(t,e=1,r=!1){let n=fr.fromPoints(t[0]),i=Math.min(n.width(),n.height()),o=i/2,a=new Ti([],Ix),{minX:s,minY:l,maxX:u,maxY:c}=n;if(i===0)return new Fl.default(s,l);for(let y=s;y<u;y+=i)for(let m=l;m<c;m+=i)a.push(new jr(y+o,m+o,o,t));let p=Cx(t),f=a.length;for(;a.length;){let y=a.pop();(y.d>p.d||!p.d)&&(p=y,r&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,f)),!(y.max-p.d<=e)&&(o=y.h/2,a.push(new jr(y.p.x-o,y.p.y-o,o,t)),a.push(new jr(y.p.x+o,y.p.y-o,o,t)),a.push(new jr(y.p.x-o,y.p.y+o,o,t)),a.push(new jr(y.p.x+o,y.p.y+o,o,t)),f+=4)}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Ix(t,e){return e.max-t.max}function jr(t,e,r,n){this.p=new Fl.default(t,e),this.h=r,this.d=Tx(this.p,n),this.max=this.d+this.h*Math.SQRT2}function Tx(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,ll(t,u,c))}}return(r?1:-1)*Math.sqrt(n)}function Cx(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 jr(r/e,n/e,0,t)}var Dl=Y(rl(),1);var El=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(El||{}),Ot=7,$a=Number.POSITIVE_INFINITY;function Ml(t,e){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.SQRT2;switch(i){case"top-right":case"top-left":s=l-Ot;break;case"bottom-right":case"bottom-left":s=-l+Ot;break;case"bottom":s=-o+Ot;break;case"top":s=o-Ot;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-Ot;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+Ot;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]!==$a?n(t,e[0],e[1]):r(t,e[0])}function Ll(t,e,r){let n=t.layout,i=n.get("text-variable-anchor-offset")?.evaluate(e,{},r);if(i){let a=i.values,s=[];for(let l=0;l<a.length;l+=2){let u=s[l]=a[l],c=a[l+1].map(p=>p*ae);u.startsWith("top")?c[1]-=Ot:u.startsWith("bottom")&&(c[1]+=Ot),s[l+1]=c}return new Ee(s)}let o=n.get("text-variable-anchor");if(o){let a;t._unevaluatedLayout.getValue("text-radial-offset")!==void 0?a=[n.get("text-radial-offset").evaluate(e,{},r)*ae,$a]:a=n.get("text-offset").evaluate(e,{},r).map(u=>u*ae);let l=[];for(let u of o)l.push(u,Ml(u,a));return new Ee(l)}return null}function iy(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=8192/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],n=r.layout,i=r._unevaluatedLayout._values,o={layoutIconSize:i["icon-size"].possiblyEvaluate(new W(t.bucket.zoom+1),t.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new W(t.bucket.zoom+1),t.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new W(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.textSizeData;o.compositeTextSizes=[i["text-size"].possiblyEvaluate(new W(c),t.canonical),i["text-size"].possiblyEvaluate(new W(p),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.iconSizeData;o.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new W(c),t.canonical),i["icon-size"].possiblyEvaluate(new W(p),t.canonical)]}let a=n.get("text-line-height")*ae,s=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",l=n.get("text-keep-upright"),u=n.get("text-size");for(let c of t.bucket.features){let p=n.get("text-font").evaluate(c,{},t.canonical).join(","),f=u.evaluate(c,{},t.canonical),y=o.layoutTextSize.evaluate(c,{},t.canonical),m=o.layoutIconSize.evaluate(c,{},t.canonical),h={horizontal:{},vertical:void 0},g=c.text,d=[0,0];if(g){let S=g.toString(),A=n.get("text-letter-spacing").evaluate(c,{},t.canonical)*ae,w=Zc(S)?A:0,T=n.get("text-anchor").evaluate(c,{},t.canonical),E=Ll(r,c,t.canonical);if(!E){let _=n.get("text-radial-offset").evaluate(c,{},t.canonical);_?d=Ml(T,[_*ae,$a]):d=n.get("text-offset").evaluate(c,{},t.canonical).map(V=>V*ae)}let D=s?"center":n.get("text-justify").evaluate(c,{},t.canonical),z=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(c,{},t.canonical)*ae:1/0,M=()=>{t.bucket.allowVerticalPlacement&&In(S)&&(h.vertical=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,"left",w,d,2,!0,y,f))};if(!s&&E){let _=new Set;if(D==="auto")for(let G=0;G<E.values.length;G+=2)_.add(ry(E.values[G]));else _.add(D);let V=!1;for(let G of _)if(!h.horizontal[G])if(V)h.horizontal[G]=h.horizontal[0];else{let O=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,"center",G,w,d,1,!1,y,f);O&&(h.horizontal[G]=O,V=O.positionedLines.length===1)}M()}else{D==="auto"&&(D=ry(T));let _=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,1,!1,y,f);_&&(h.horizontal[D]=_),M(),In(S)&&s&&l&&(h.vertical=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,2,!1,y,f))}}let x,b=!1;if(c.icon&&c.icon.name){let S=t.imageMap[c.icon.name];S&&(x=Ff(t.imagePositions[c.icon.name],n.get("icon-offset").evaluate(c,{},t.canonical),n.get("icon-anchor").evaluate(c,{},t.canonical)),b=!!S.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&&ce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(S.pixelRatio!==t.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let v=oy(h.horizontal)||h.vertical;t.bucket.iconsInText=v?v.iconsInText:!1,(v||x)&&kx(t.bucket,c,h,x,t.imageMap,o,y,m,d,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function ry(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 kx(t,e,r,n,i,o,a,s,l,u,c,p){let f=o.textMaxSize.evaluate(e,{});f===void 0&&(f=a);let y=t.layers[0].layout,m=y.get("icon-offset").evaluate(e,{},c),h=oy(r.horizontal),g=24,d=a/g,x=t.tilePixelRatio*d,b=t.tilePixelRatio*f/g,v=t.tilePixelRatio*s,S=t.tilePixelRatio*y.get("symbol-spacing"),A=y.get("text-padding")*t.tilePixelRatio,w=Vf(y,e,c,t.tilePixelRatio),T=y.get("text-max-angle")/180*Math.PI,E=y.get("text-rotation-alignment")!=="viewport"&&y.get("symbol-placement")!=="point",D=y.get("icon-rotation-alignment")==="map"&&y.get("symbol-placement")!=="point",B=y.get("symbol-placement"),z=S/2,M=y.get("icon-text-fit"),_;n&&M!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(_=_l(n,r.vertical,M,y.get("icon-text-fit-padding"),m,d)),h&&(n=_l(n,h,M,y.get("icon-text-fit-padding"),m,d)));let V=c?p.line.getGranularityForZoomLevel(c.z):1,G=(O,R)=>{R.x<0||R.x>=8192||R.y<0||R.y>=8192||Ex(t,R,O,r,n,i,_,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,x,[A,A,A,A],E,l,v,w,D,m,e,o,u,c,a)};if(B==="line")for(let O of Kf(e.geometry,0,0,8192,8192)){let R=Ke(O,V),K=Jf(R,S,T,r.vertical||h,n,g,b,t.overscaling,8192);for(let X of K){let re=h;(!re||!Mx(t,re.text,z,X))&&G(R,X)}}else if(B==="line-center"){for(let O of e.geometry)if(O.length>1){let R=Ke(O,V),K=Zf(R,T,r.vertical||h,n,g,b);K&&G(R,K)}}else if(e.type==="Polygon")for(let O of Yt(e.geometry,0)){let R=ty(O,16),K=Ke(O[0],V,!0);G(K,new et(R.x,R.y,0))}else if(e.type==="LineString")for(let O of e.geometry){let R=Ke(O,V);G(R,new et(R[0].x,R[0].y,0))}else if(e.type==="Point")for(let O of e.geometry)for(let R of O)G([R],new et(R.x,R.y,0))}function Fx(t,e){let r=t.length,n=e?.values;if(n?.length>0)for(let i=0;i<n.length;i+=2){let o=El[n[i]],a=n[i+1];t.emplaceBack(o,a[0],a[1])}return[r,t.length]}function ny(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=ey(e,r,s,i,o,a,n,t.allowVerticalPlacement),g=t.textSizeData,d=null;g.kind==="source"?(d=[zt*i.layout.get("text-size").evaluate(a,{})],d[0]>Qe&&ce(`${t.layerIds[0]}: Value for "text-size" is >= ${Nr}. Reduce your "text-size".`)):g.kind==="composite"&&(d=[zt*y.compositeTextSizes[0].evaluate(a,{},m),zt*y.compositeTextSizes[1].evaluate(a,{},m)],(d[0]>Qe||d[1]>Qe)&&ce(`${t.layerIds[0]}: Value for "text-size" is >= ${Nr}. Reduce your "text-size".`)),t.addSymbols(t.text,h,d,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let x of c)p[x]=t.text.placedSymbolArray.length-1;return h.length*4}function oy(t){for(let e in t)return t[e];return null}function Ex(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T){let E=t.addToLineVertexArray(e,r),D,B,z,M,_=0,V=0,G=0,O=0,R=-1,K=-1,X={},re=(0,Dl.default)("");if(t.allowVerticalPlacement&&n.vertical){let xe=s.layout.get("text-rotate").evaluate(v,{},w)+90,rt=n.vertical;z=new yr(l,e,u,c,p,rt,f,y,m,xe),a&&(M=new yr(l,e,u,c,p,a,g,d,m,xe))}if(i){let Te=s.layout.get("icon-rotate").evaluate(v,{}),xe=s.layout.get("icon-text-fit")!=="none",rt=kl(i,Te,A,xe),xt=a?kl(a,Te,A,xe):void 0;B=new yr(l,e,u,c,p,i,g,d,!1,Te),_=rt.length*4;let Zr=t.iconSizeData,Be=null;Zr.kind==="source"?(Be=[zt*s.layout.get("icon-size").evaluate(v,{})],Be[0]>Qe&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Nr}. Reduce your "icon-size".`)):Zr.kind==="composite"&&(Be=[zt*S.compositeIconSizes[0].evaluate(v,{},w),zt*S.compositeIconSizes[1].evaluate(v,{},w)],(Be[0]>Qe||Be[1]>Qe)&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Nr}. Reduce your "icon-size".`)),t.addSymbols(t.icon,rt,Be,b,x,v,0,e,E.lineStartIndex,E.lineLength,-1,w),R=t.icon.placedSymbolArray.length-1,xt&&(V=xt.length*4,t.addSymbols(t.icon,xt,Be,b,x,v,2,e,E.lineStartIndex,E.lineLength,-1,w),K=t.icon.placedSymbolArray.length-1)}let me=Object.keys(n.horizontal);for(let Te of me){let xe=n.horizontal[Te];if(!D){re=(0,Dl.default)(xe.text);let xt=s.layout.get("text-rotate").evaluate(v,{},w);D=new yr(l,e,u,c,p,xe,f,y,m,xt)}let rt=xe.positionedLines.length===1;if(G+=ny(t,e,xe,o,s,m,v,h,E,n.vertical?1:3,rt?me:[Te],X,R,S,w),rt)break}n.vertical&&(O+=ny(t,e,n.vertical,o,s,m,v,h,E,2,["vertical"],X,K,S,w));let Ut=D?D.boxStartIndex:t.collisionBoxArray.length,tt=D?D.boxEndIndex:t.collisionBoxArray.length,gt=z?z.boxStartIndex:t.collisionBoxArray.length,Gi=z?z.boxEndIndex:t.collisionBoxArray.length,Ni=B?B.boxStartIndex:t.collisionBoxArray.length,Ui=B?B.boxEndIndex:t.collisionBoxArray.length,$i=M?M.boxStartIndex:t.collisionBoxArray.length,is=M?M.boxEndIndex:t.collisionBoxArray.length,Ie=-1,bt=(Te,xe)=>Te&&Te.circleDiameter?Math.max(Te.circleDiameter,xe):xe;Ie=bt(D,Ie),Ie=bt(z,Ie),Ie=bt(B,Ie),Ie=bt(M,Ie);let Hr=Ie>-1?1:0;Hr&&(Ie*=T/ae),t.glyphOffsetArray.length>=Xe.MAX_GLYPHS&&ce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let os=Ll(s,v,w),[ji,as]=Fx(t.textAnchorOffsets,os);t.symbolInstances.emplaceBack(e.x,e.y,X.right>=0?X.right:-1,X.center>=0?X.center:-1,X.left>=0?X.left:-1,X.vertical||-1,R,K,re,Ut,tt,gt,Gi,Ni,Ui,$i,is,u,G,O,_,V,Hr,0,f,Ie,ji,as)}function Mx(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 ja=1,Ci=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*ja,h:p.bitmap.height+2*ja};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=hi(n),a=new sr({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;sr.copy(c.bitmap,a,{x:0,y:0},{x:p.x+ja,y:p.y+ja},c.bitmap)}}this.image=a,this.positions=r}};I("GlyphAtlas",Ci);function sy(t,e,r){e=Math.pow(2,r)-e-1;var n=ay(t*256,e*256,r),i=ay((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function ay(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 py=Y(ye(),1);var Bl=63710088e-1,ki=class t{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 t(wu(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 Bl*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof t)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new t(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new t(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 ly=2*Math.PI*Bl;function uy(t){return ly*Math.cos(t*Math.PI/180)}function Lx(t){return(180+t)/360}function Dx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Bx(t,e){return t/uy(e)}function Vx(t){return t*360-180}function Vl(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Rx(t,e){return t*uy(Vl(e))}function zx(t){return 1/Math.cos(t*Math.PI/180)}var Fi=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=ki.convert(e);return new t(Lx(n.lng),Dx(n.lat),Bx(r,n.lat))}toLngLat(){return new ki(Vx(this.x),Vl(this.y))}toAltitude(){return Rx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ly*zx(Vl(this.y))}};function cy(t,e,r){return!(t<Hi||t>Xi||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}var qa=class{constructor(e,r,n){if(!cy(e,r,n))throw new Error(`x=${r}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} ${Hi}<=z<=${Xi} `);this.z=e,this.x=r,this.y=n,this.key=Ei(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=sy(this.x,this.y,this.z),o=Ox(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 py.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},Rl=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Ei(e,r.z,r.z,r.x,r.y)}},Mi=class t{constructor(e,r,n,i,o){this.terrainRttPosMatrix32f=null;if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new qa(n,+i,+o),this.key=Ei(r,e,n,i,o)}clone(){return new t(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 t(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new t(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?Ei(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Ei(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 t(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 t(r,this.wrap,r,n,i),new t(r,this.wrap,r,n+1,i),new t(r,this.wrap,r,n,i+1),new t(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 t(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new t(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 Rl(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Fi(e.x-this.wrap,e.y))}};function Ei(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 Ox(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}I("CanonicalTileID",qa);I("OverscaledTileID",Mi,{omit:["terrainRttPosMatrix32f"]});var Wa=class{constructor(e){this.tileID=new Mi(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.globalState=e.globalState}async parse(e,r,n,i,o){this.status="parsing",this.data=e,this.collisionBoxArray=new jn;let a=new Ur(Object.keys(e.layers).sort()),s=new _i(this.tileID,this.promoteId);s.bucketLayerIDs=[];let l={},u={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n,subdivisionGranularity:o},c=r.familiesBySource[this.source];for(let A in c){let w=e.layers[A];if(!w)continue;w.version===1&&ce(`Vector tile source "${this.source}" layer "${A}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let T=a.encode(A),E=[];for(let D=0;D<w.length;D++){let B=w.feature(D),z=s.getId(B,A);E.push({feature:B,id:z,index:D,sourceLayerIndex:T})}for(let D of c[A]){let B=D[0];if(B.source!==this.source&&ce(`layer.source = ${B.source} does not equal this.source = ${this.source}`),B.minzoom&&this.zoom<Math.floor(B.minzoom)||B.maxzoom&&this.zoom>=B.maxzoom||B.visibility==="none")continue;zl(D,this.zoom,n),(l[B.id]=B.createBucket({index:s.bucketLayerIDs.length,layers:D,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:T,sourceID:this.source,globalState:this.globalState})).populate(E,u,this.tileID.canonical),s.bucketLayerIDs.push(D.map(M=>M.id))}}let p=tn(u.glyphDependencies,A=>Object.keys(A).map(Number));this.inFlightDependencies.forEach(A=>A?.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){let A=new AbortController;this.inFlightDependencies.push(A),f=i.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},A)}let y=Object.keys(u.iconDependencies),m=Promise.resolve({});if(y.length){let A=new AbortController;this.inFlightDependencies.push(A),m=i.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"icons"}},A)}let h=Object.keys(u.patternDependencies),g=Promise.resolve({});if(h.length){let A=new AbortController;this.inFlightDependencies.push(A),g=i.sendAsync({type:"GI",data:{icons:h,source:this.source,tileID:this.tileID,type:"patterns"}},A)}let[d,x,b]=await Promise.all([f,m,g]),v=new Ci(d),S=new di(x,b);for(let A in l){let w=l[A];w instanceof Xe?(zl(w.layers,this.zoom,n),iy({bucket:w,glyphMap:d,glyphPositions:v.positions,imageMap:x,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:u.subdivisionGranularity})):w.hasPattern&&(w instanceof pr||w instanceof ur||w instanceof cr)&&(zl(w.layers,this.zoom,n),w.addFeatures(u,this.tileID.canonical,S.patternPositions))}return this.status="done",{buckets:Object.values(l).filter(A=>!A.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:v.image,imageAtlas:S,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?x:null,glyphPositions:this.returnDependencies?v.positions:null}}};function zl(t,e,r){let n=new W(e);for(let i of t)i.recalculate(n,r)}var Gx=60,XI=1e3/Gx;var qr=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}};var Wr=class{constructor(e,r,n){this.actor=e,this.layerIndex=r,this.availableImages=n,this.fetching={},this.loading={},this.loaded={}}async loadVectorTile(e,r){let n=await Uc(e.request,r);try{return{vectorTile:new fy.default.VectorTile(new yy.default(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires}}catch(i){let o=new Uint8Array(n.data),a=o[0]===31&&o[1]===139,s=`Unable to parse the tile at ${e.request.url}, `;throw a?s+="please make sure the data is not gzipped and that you have configured the relevant header in the server":s+=`got error: ${i.message}`,new Error(s)}}async loadTile(e){let r=e.uid,n=e&&e.request&&e.request.collectResourceTiming?new qr(e.request):!1,i=new Wa(e);this.loading[r]=i;let o=new AbortController;i.abort=o;try{let a=await this.loadVectorTile(e,o);if(delete this.loading[r],!a)return null;let s=a.rawData,l={};a.expires&&(l.expires=a.expires),a.cacheControl&&(l.cacheControl=a.cacheControl);let u={};if(n){let p=n.finish();p&&(u.resourceTiming=JSON.parse(JSON.stringify(p)))}i.vectorTile=a.vectorTile;let c=i.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);this.loaded[r]=i,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:u};try{let p=await c;return de({rawTileData:s.slice(0)},p,l,u)}finally{delete this.fetching[r]}}catch(a){throw delete this.loading[r],i.status="done",this.loaded[r]=i,a}}async reloadTile(e){let r=e.uid;if(!this.loaded||!this.loaded[r])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let n=this.loaded[r];if(n.showCollisionBoxes=e.showCollisionBoxes,n.globalState=e.globalState,n.status==="parsing"){let i=await n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity),o;if(this.fetching[r]){let{rawTileData:a,cacheControl:s,resourceTiming:l}=this.fetching[r];delete this.fetching[r],o=de({rawTileData:a.slice(0)},i,s,l)}else o=i;return o}if(n.status==="done"&&n.vectorTile)return n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity)}async abortTile(e){let r=this.loading,n=e.uid;r&&r[n]&&r[n].abort&&(r[n].abort.abort(),delete r[n])}async removeTile(e){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}};var Xa=class{constructor(){this.loaded={}}async loadTile(e){let{uid:r,encoding:n,rawImageData:i,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,u=i.width+2,c=i.height+2,p=vt(i)?new fe({width:u,height:c},await Iu(i,-1,-1,u,c)):i,f=new ii(r,p,n,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=f,f}removeTile(e){let r=this.loaded,n=e.uid;r&&r[n]&&delete r[n]}};var Gy=Y(gy(),1);var Ol=Y(ye(),1),by=Y(Rt(),1);var Nx=by.default.VectorTileFeature.prototype.toGeoJSON,Gl=class{constructor(e){this._feature=e,this.extent=8192,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 Ol.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 Ol.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return Nx.call(this,e,r,n)}},Za=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=e.length,this._features=e}feature(e){return new Gl(this._features[e])}};var Ny=Y(Ay(),1);var _y=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$l=1,Di=8,Vi=class t{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!==$l)throw new Error(`Got v${i} data when expected v${$l}.`);let o=_y[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 t(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=_y.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,Di,e),this.coords=new this.ArrayType(this.data,Di+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(Di+a+s+l),this.ids=new this.IndexArrayType(this.data,Di,e),this.coords=new this.ArrayType(this.data,Di+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,($l<<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 ql(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 g=f;g<=p;g++){let d=a[2*g],x=a[2*g+1];d>=e&&d<=n&&x>=r&&x<=i&&u.push(o[g])}continue}let y=f+p>>1,m=a[2*y],h=a[2*y+1];m>=e&&m<=n&&h>=r&&h<=i&&u.push(o[y]),(c===0?e<=m:r<=h)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=h)&&(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 g=f;g<=p;g++)Iy(o[2*g],o[2*g+1],e,r)<=u&&l.push(i[g]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];Iy(m,h,e,r)<=u&&l.push(i[y]),(c===0?e-n<=m:r-n<=h)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?e+n>=m:r+n>=h)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function ql(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;Ty(t,e,a,n,i,o),ql(t,e,r,n,a-1,1-o),ql(t,e,r,a+1,i,1-o)}function Ty(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)),h=Math.min(i,Math.floor(r+(u-c)*f/u+y));Ty(t,e,r,m,h,o)}let a=e[2*r+o],s=n,l=i;for(Bi(t,e,n,r),e[2*i+o]>a&&Bi(t,e,n,i);s<l;){for(Bi(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?Bi(t,e,n,l):(l++,Bi(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Bi(t,e,r,n){jl(t,r,n),jl(e,2*r,2*n),jl(e,2*r+1,2*n+1)}function jl(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function Iy(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var Kx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Cy=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),mr=2,Nt=3,Wl=4,Gt=5,Fy=6,Ri=class{constructor(e){this.options=Object.assign(Object.create(Kx),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=Cy(Ya(c)),y=Cy(Ka(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(Ya(n),Ka(a),Ya(o),Ka(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+Gt]>1?ky(u,f,this.clusterProps):this.points[u[f+Nt]])}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+Wl]===e&&p.push(a[y+Gt]>1?ky(a,y,this.clusterProps):this.points[a[y+Nt]])}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 Vi(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+Gt]>1,c,p,f;if(u)c=Ey(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let h=this.points[r[l+Nt]];c=h.properties;let[g,d]=h.geometry.coordinates;p=Ya(g),f=Ka(d)}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+Nt]:m=this.points[r[l+Nt]].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+mr]<=r)continue;l[p+mr]=r;let f=l[p],y=l[p+1],m=e.within(l[p],l[p+1],s),h=l[p+Gt],g=h;for(let d of m){let x=d*c;l[x+mr]>r&&(g+=l[x+Gt])}if(g>h&&g>=a){let d=f*h,x=y*h,b,v=-1,S=((p/c|0)<<5)+(r+1)+this.points.length;for(let A of m){let w=A*c;if(l[w+mr]<=r)continue;l[w+mr]=r;let T=l[w+Gt];d+=l[w]*T,x+=l[w+1]*T,l[w+Wl]=S,o&&(b||(b=this._map(l,p,!0),v=this.clusterProps.length,this.clusterProps.push(b)),o(b,this._map(l,w)))}l[p+Wl]=S,u.push(d/g,x/g,1/0,S,-1,g),o&&u.push(v)}else{for(let d=0;d<c;d++)u.push(l[p+d]);if(g>1)for(let d of m){let x=d*c;if(!(l[x+mr]<=r)){l[x+mr]=r;for(let b=0;b<c;b++)u.push(l[x+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+Gt]>1){let a=this.clusterProps[e[r+Fy]];return n?Object.assign({},a):a}let i=this.points[e[r+Nt]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function ky(t,e,r){return{type:"Feature",id:t[e+Nt],properties:Ey(t,e,r),geometry:{type:"Point",coordinates:[Qx(t[e]),e0(t[e+1])]}}}function Ey(t,e,r){let n=t[e+Gt],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,o=t[e+Fy],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Nt],point_count:n,point_count_abbreviated:i})}function Ya(t){return t/360+.5}function Ka(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 Qx(t){return(t-.5)*360}function e0(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function zi(t,e,r,n){let i=n,o=e+(r-e>>1),a=r-e,s,l=t[e],u=t[e+1],c=t[r],p=t[r+1];for(let f=e+3;f<r;f+=3){let y=t0(t[f],t[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){let m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-e>3&&zi(t,e,s,n),t[s+2]=i,r-s>3&&zi(t,s,r,n))}function t0(t,e,r,n,i,o){let a=i-r,s=o-n;if(a!==0||s!==0){let 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 dt(t,e,r,n){let i={id:t??null,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")Qa(i,r);else if(e==="Polygon")Qa(i,r[0]);else if(e==="MultiLineString")for(let o of r)Qa(i,o);else if(e==="MultiPolygon")for(let o of r)Qa(i,o[0]);return i}function Qa(t,e){for(let 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 Zl(t,e){let r=[];if(t.type==="FeatureCollection")for(let n=0;n<t.features.length;n++)es(r,t.features[n],e,n);else t.type==="Feature"?es(r,t,e):es(r,{geometry:t},e);return r}function es(t,e,r,n){if(!e.geometry)return;let i=e.geometry.coordinates;if(i&&i.length===0)return;let 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")My(i,s);else if(o==="MultiPoint")for(let u of i)My(u,s);else if(o==="LineString")Hl(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(let u of i)s=[],Hl(u,s,a,!1),t.push(dt(l,"LineString",s,e.properties));return}else Xl(i,s,a,!1);else if(o==="Polygon")Xl(i,s,a,!0);else if(o==="MultiPolygon")for(let u of i){let c=[];Xl(u,c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(let u of e.geometry.geometries)es(t,{id:l,geometry:u,properties:e.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");t.push(dt(l,o,s,e.properties))}function My(t,e){e.push(Ly(t[0]),Dy(t[1]),0)}function Hl(t,e,r,n){let i,o,a=0;for(let l=0;l<t.length;l++){let u=Ly(t[l][0]),c=Dy(t[l][1]);e.push(u,c,0),l>0&&(n?a+=(i*c-u*o)/2:a+=Math.sqrt(Math.pow(u-i,2)+Math.pow(c-o,2))),i=u,o=c}let s=e.length-3;e[2]=1,zi(e,0,s,r),e[s+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Xl(t,e,r,n){for(let i=0;i<t.length;i++){let o=[];Hl(t[i],o,r,n),e.push(o)}}function Ly(t){return t/360+.5}function Dy(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 Ue(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;let l=[];for(let u of t){let c=u.geometry,p=u.type,f=i===0?u.minX:u.minY,y=i===0?u.maxX:u.maxY;if(f>=r&&y<n){l.push(u);continue}else if(y<r||f>=n)continue;let m=[];if(p==="Point"||p==="MultiPoint")r0(c,m,r,n,i);else if(p==="LineString")Vy(c,m,r,n,i,!1,s.lineMetrics);else if(p==="MultiLineString")Jl(c,m,r,n,i,!1);else if(p==="Polygon")Jl(c,m,r,n,i,!0);else if(p==="MultiPolygon")for(let h of c){let g=[];Jl(h,g,r,n,i,!0),g.length&&m.push(g)}if(m.length){if(s.lineMetrics&&p==="LineString"){for(let h of m)l.push(dt(u.id,p,h,u.tags));continue}(p==="LineString"||p==="MultiLineString")&&(m.length===1?(p="LineString",m=m[0]):p="MultiLineString"),(p==="Point"||p==="MultiPoint")&&(p=m.length===3?"Point":"MultiPoint"),l.push(dt(u.id,p,m,u.tags))}}return l.length?l:null}function r0(t,e,r,n,i){for(let o=0;o<t.length;o+=3){let a=t[o+i];a>=r&&a<=n&&Xr(e,t[o],t[o+1],t[o+2])}}function Vy(t,e,r,n,i,o,a){let s=By(t),l=i===0?n0:i0,u=t.start,c,p;for(let d=0;d<t.length-3;d+=3){let x=t[d],b=t[d+1],v=t[d+2],S=t[d+3],A=t[d+4],w=i===0?x:b,T=i===0?S:A,E=!1;a&&(c=Math.sqrt(Math.pow(x-S,2)+Math.pow(b-A,2))),w<r?T>r&&(p=l(s,x,b,S,A,r),a&&(s.start=u+c*p)):w>n?T<n&&(p=l(s,x,b,S,A,n),a&&(s.start=u+c*p)):Xr(s,x,b,v),T<r&&w>=r&&(p=l(s,x,b,S,A,r),E=!0),T>n&&w<=n&&(p=l(s,x,b,S,A,n),E=!0),!o&&E&&(a&&(s.end=u+c*p),e.push(s),s=By(t)),a&&(u+=c)}let f=t.length-3,y=t[f],m=t[f+1],h=t[f+2],g=i===0?y:m;g>=r&&g<=n&&Xr(s,y,m,h),f=s.length-3,o&&f>=3&&(s[f]!==s[0]||s[f+1]!==s[1])&&Xr(s,s[0],s[1],s[2]),s.length&&e.push(s)}function By(t){let e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Jl(t,e,r,n,i,o){for(let a of t)Vy(a,e,r,n,i,o,!1)}function Xr(t,e,r,n){t.push(e,r,n)}function n0(t,e,r,n,i,o){let a=(o-e)/(n-e);return Xr(t,o,r+(i-r)*a,1),a}function i0(t,e,r,n,i,o){let a=(o-r)/(i-r);return Xr(t,e+(n-e)*a,o,1),a}function Kl(t,e){let r=e.buffer/e.extent,n=t,i=Ue(t,1,-1-r,r,0,-1,2,e),o=Ue(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=Ue(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=Ry(i,1).concat(n)),o&&(n=n.concat(Ry(o,-1)))),n}function Ry(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Yl(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(let s of i.geometry)a.push(Yl(s,e))}else if(o==="MultiPolygon"){a=[];for(let s of i.geometry){let l=[];for(let u of s)l.push(Yl(u,e));a.push(l)}}r.push(dt(i.id,o,a,i.tags))}return r}function Yl(t,e){let r=[];r.size=t.size,t.start!==void 0&&(r.start=t.start,r.end=t.end);for(let n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function ts(t,e){if(t.transformed)return t;let r=1<<t.z,n=t.x,i=t.y;for(let o of t.features){let a=o.geometry,s=o.type;if(o.geometry=[],s===1)for(let l=0;l<a.length;l+=2)o.geometry.push(zy(a[l],a[l+1],e,r,n,i));else for(let l=0;l<a.length;l++){let u=[];for(let c=0;c<a[l].length;c+=2)u.push(zy(a[l][c],a[l][c+1],e,r,n,i));o.geometry.push(u)}}return t.transformed=!0,t}function zy(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function eu(t,e,r,n,i){let o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let s of t)o0(a,s,o,i);return a}function o0(t,e,r,n){let i=e.geometry,o=e.type,a=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),o==="Point"||o==="MultiPoint")for(let s=0;s<i.length;s+=3)a.push(i[s],i[s+1]),t.numPoints++,t.numSimplified++;else if(o==="LineString")Ql(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(let s=0;s<i.length;s++)Ql(a,i[s],t,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(let s=0;s<i.length;s++){let l=i[s];for(let u=0;u<l.length;u++)Ql(a,l[u],t,r,!0,u===0)}if(a.length){let s=e.tags||null;if(o==="LineString"&&n.lineMetrics){s={};for(let u in e.tags)s[u]=e.tags[u];s.mapbox_clip_start=i.start/i.size,s.mapbox_clip_end=i.end/i.size}let l={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:s};e.id!==null&&(l.id=e.id),t.features.push(l)}}function Ql(t,e,r,n,i,o){let a=n*n;if(n>0&&e.size<(i?a:n)){r.numPoints+=e.length/3;return}let s=[];for(let l=0;l<e.length;l+=3)(n===0||e[l+2]>a)&&(r.numSimplified++,s.push(e[l],e[l+1])),r.numPoints++;i&&a0(s,o),t.push(s)}function a0(t,e){let r=0;for(let 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(let n=0,i=t.length;n<i/2;n+=2){let o=t[n],a=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=o,t[i-1-n]=a}}var s0={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ru=class{constructor(e,r){r=this.options=l0(Object.create(s0),r);let n=r.debug;if(n&&console.time("preprocess data"),r.maxZoom<0||r.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=Zl(e,r);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",r.indexMaxZoom,r.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=Kl(i,r),i.length&&this.splitTile(i,0,0,0),n&&(i.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)))}splitTile(e,r,n,i,o,a,s){let l=[e,r,n,i],u=this.options,c=u.debug;for(;l.length;){i=l.pop(),n=l.pop(),r=l.pop(),e=l.pop();let p=1<<r,f=tu(r,n,i),y=this.tiles[f];if(!y&&(c>1&&console.time("creation"),y=this.tiles[f]=eu(e,r,n,i,u),this.tileCoords.push({z:r,x:n,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,i,y.numFeatures,y.numPoints,y.numSimplified),console.timeEnd("creation"));let T=`z${r}`;this.stats[T]=(this.stats[T]||0)+1,this.total++}if(y.source=e,o==null){if(r===u.indexMaxZoom||y.numPoints<=u.indexMaxPoints)continue}else{if(r===u.maxZoom||r===o)continue;if(o!=null){let T=o-r;if(n!==a>>T||i!==s>>T)continue}}if(y.source=null,e.length===0)continue;c>1&&console.time("clipping");let m=.5*u.buffer/u.extent,h=.5-m,g=.5+m,d=1+m,x=null,b=null,v=null,S=null,A=Ue(e,p,n-m,n+g,0,y.minX,y.maxX,u),w=Ue(e,p,n+h,n+d,0,y.minX,y.maxX,u);e=null,A&&(x=Ue(A,p,i-m,i+g,1,y.minY,y.maxY,u),b=Ue(A,p,i+h,i+d,1,y.minY,y.maxY,u),A=null),w&&(v=Ue(w,p,i-m,i+g,1,y.minY,y.maxY,u),S=Ue(w,p,i+h,i+d,1,y.minY,y.maxY,u),w=null),c>1&&console.timeEnd("clipping"),l.push(x||[],r+1,n*2,i*2),l.push(b||[],r+1,n*2,i*2+1),l.push(v||[],r+1,n*2+1,i*2),l.push(S||[],r+1,n*2+1,i*2+1)}}getTile(e,r,n){e=+e,r=+r,n=+n;let i=this.options,{extent:o,debug:a}=i;if(e<0||e>24)return null;let s=1<<e;r=r+s&s-1;let l=tu(e,r,n);if(this.tiles[l])return ts(this.tiles[l],o);a>1&&console.log("drilling down to z%d-%d-%d",e,r,n);let u=e,c=r,p=n,f;for(;!f&&u>0;)u--,c=c>>1,p=p>>1,f=this.tiles[tu(u,c,p)];return!f||!f.source?null:(a>1&&(console.log("found parent tile z%d-%d-%d",u,c,p),console.time("drilling down")),this.splitTile(f.source,u,c,p,e,r,n),a>1&&console.timeEnd("drilling down"),this.tiles[l]?ts(this.tiles[l],o):null)}};function tu(t,e,r){return((1<<t)*r+e)*32+t}function l0(t,e){for(let r in e)t[r]=e[r];return t}function nu(t,e){return new ru(t,e)}function Oi(t,e){return e?t.properties[e]:t.id}function iu(t,e){if(t==null)return!0;if(t.type==="Feature")return Oi(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=Oi(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function ou(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(Oi(t,e),t);else for(let n of t.features)r.set(Oi(n,e),n);return r}function Oy(t,e,r){if(e.removeAll&&t.clear(),e.remove)for(let n of e.remove)t.delete(n);if(e.add)for(let n of e.add){let i=Oi(n,r);i!=null&&t.set(i,n)}if(e.update)for(let n of e.update){let i=t.get(n.id);if(i==null)continue;let o=n.newGeometry||n.removeAllProperties,a=!n.removeAllProperties&&(n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0);if((o||a)&&(i={...i},t.set(n.id,i),a&&(i.properties={...i.properties})),n.newGeometry&&(i.geometry=n.newGeometry),n.removeAllProperties)i.properties={};else if(n.removeProperties?.length>0)for(let s of n.removeProperties)Object.prototype.hasOwnProperty.call(i.properties,s)&&delete i.properties[s];if(n.addOrUpdateProperties?.length>0)for(let{key:s,value:l}of n.addOrUpdateProperties)i.properties[s]=l}}var rs=class extends Wr{constructor(){super(...arguments);this._dataUpdateable=new Map}async loadVectorTile(r,n){let i=r.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let o=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!o)return null;let a=new Za(o.features),s=(0,Ny.default)(a);return(s.byteOffset!==0||s.byteLength!==s.buffer.byteLength)&&(s=new Uint8Array(s)),{vectorTile:a,rawData:s.buffer}}async loadData(r){this._pendingRequest?.abort();let n=r&&r.request&&r.request.collectResourceTiming?new qr(r.request):!1;this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(r,this._pendingRequest),this._geoJSONIndex=r.cluster?new Ri(u0(r)).load((await this._pendingData).features):nu(await this._pendingData,r.geojsonVtOptions),this.loaded={};let i={};if(n){let o=n.finish();o&&(i.resourceTiming={},i.resourceTiming[r.source]=JSON.parse(JSON.stringify(o)))}return i}catch(i){if(delete this._pendingRequest,Lc(i))return{abandoned:!0};throw i}}async getData(){return this._pendingData}reloadTile(r){let n=this.loaded,i=r.uid;return n&&n[i]?super.reloadTile(r):this.loadTile(r)}async loadAndProcessGeoJSON(r,n){let i=await this.loadGeoJSON(r,n);if(delete this._pendingRequest,typeof i!="object")throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if((0,Gy.default)(i,!0),r.filter){let o=Qt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(o.result==="error")throw new Error(o.value.map(s=>`${s.key}: ${s.message}`).join(", "));i={type:"FeatureCollection",features:i.features.filter(s=>o.value.evaluate({zoom:0},s))}}return i}async loadGeoJSON(r,n){let{promoteId:i}=r;if(r.request){let o=await Nc(r.request,n);return this._dataUpdateable=iu(o.data,i)?ou(o.data,i):void 0,o.data}if(typeof r.data=="string")try{let o=JSON.parse(r.data);return this._dataUpdateable=iu(o,i)?ou(o,i):void 0,o}catch{throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`)}if(!r.dataDiff)throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${r.source}`);return Oy(this._dataUpdateable,r.dataDiff,i),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}async removeSource(r){this._pendingRequest&&this._pendingRequest.abort()}getClusterExpansionZoom(r){return this._geoJSONIndex.getClusterExpansionZoom(r.clusterId)}getClusterChildren(r){return this._geoJSONIndex.getChildren(r.clusterId)}getClusterLeaves(r){return this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset)}};function u0({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=Qt(u),p=Qt(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 ns=class{constructor(e){this.self=e,this.actor=new Co(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(r,n)=>{if(this.externalWorkerSourceTypes[r])throw new Error(`Worker source with name "${r}" already registered.`);this.externalWorkerSourceTypes[r]=n},this.self.addProtocol=Bc,this.self.removeProtocol=Vc,this.self.registerRTLTextPlugin=r=>{we.setMethods(r)},this.actor.registerMessageHandler("LDT",(r,n)=>this._getDEMWorkerSource(r,n.source).loadTile(n)),this.actor.registerMessageHandler("RDT",async(r,n)=>{this._getDEMWorkerSource(r,n.source).removeTile(n)}),this.actor.registerMessageHandler("GCEZ",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterExpansionZoom(n)),this.actor.registerMessageHandler("GCC",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterChildren(n)),this.actor.registerMessageHandler("GCL",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterLeaves(n)),this.actor.registerMessageHandler("LD",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadData(n)),this.actor.registerMessageHandler("GD",(r,n)=>this._getWorkerSource(r,n.type,n.source).getData()),this.actor.registerMessageHandler("LT",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadTile(n)),this.actor.registerMessageHandler("RT",(r,n)=>this._getWorkerSource(r,n.type,n.source).reloadTile(n)),this.actor.registerMessageHandler("AT",(r,n)=>this._getWorkerSource(r,n.type,n.source).abortTile(n)),this.actor.registerMessageHandler("RMT",(r,n)=>this._getWorkerSource(r,n.type,n.source).removeTile(n)),this.actor.registerMessageHandler("RS",async(r,n)=>{if(!this.workerSources[r]||!this.workerSources[r][n.type]||!this.workerSources[r][n.type][n.source])return;let i=this.workerSources[r][n.type][n.source];delete this.workerSources[r][n.type][n.source],i.removeSource!==void 0&&i.removeSource(n)}),this.actor.registerMessageHandler("RM",async r=>{delete this.layerIndexes[r],delete this.availableImages[r],delete this.workerSources[r],delete this.demWorkerSources[r]}),this.actor.registerMessageHandler("SR",async(r,n)=>{this.referrer=n}),this.actor.registerMessageHandler("SRPS",(r,n)=>this._syncRTLPluginState(r,n)),this.actor.registerMessageHandler("IS",async(r,n)=>{this.self.importScripts(n)}),this.actor.registerMessageHandler("SI",(r,n)=>this._setImages(r,n)),this.actor.registerMessageHandler("UL",async(r,n)=>{this._getLayerIndex(r).update(n.layers,n.removedIds)}),this.actor.registerMessageHandler("SL",async(r,n)=>{this._getLayerIndex(r).replace(n)})}async _setImages(e,r){this.availableImages[e]=r;for(let n in this.workerSources[e]){let i=this.workerSources[e][n];for(let o in i)i[o].availableImages=r}}async _syncRTLPluginState(e,r){return await we.syncState(r,this.self.importScripts)}_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 za),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={sendAsync:(o,a)=>(o.targetMapId=e,this.actor.sendAsync(o,a))};switch(r){case"vector":this.workerSources[e][r][n]=new Wr(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][r][n]=new rs(i,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][r][n]=new this.externalWorkerSourceTypes[r](i,this._getLayerIndex(e),this._getAvailableImages(e));break}}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 Xa),this.demWorkerSources[e][r]}};at(self)&&(self.worker=new ns(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n';var ME=()=>ot.WORKER_URL?ot.WORKER_URL:URL.createObjectURL(new Blob([ib],{type:"text/javascript"}));function ob(){return new Worker(ME())}var sc="maplibre_preloaded_worker_pool",wn=class r{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<r.workerCount;)this.workers.push(ob());return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[sc]}numActive(){return Object.keys(this.active).length}},CE=Math.floor(re.hardwareConcurrency/2);wn.workerCount=Py(globalThis)?Math.max(Math.min(CE,3),1):1;var rs;function ns(){return rs||(rs=new wn),rs}function AE(){ns().acquire(sc)}function IE(){let r=rs;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(sc),rs=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()"))}var is=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t;let n=this.workerPool.acquire(t);for(let i=0;i<n.length;i++){let o=n[i],a=new ac(o,t);a.name=`Worker ${i}`,this.actors.push(a)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){let n=[];for(let i of this.actors)n.push(i.sendAsync({type:e,data:t}));return Promise.all(n)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(t=>{t.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let n of this.actors)n.registerMessageHandler(e,t)}},lc;function uc(){return lc||(lc=new is(ns(),_l),lc.registerMessageHandler("GR",(r,e,t)=>Mi(e,t))),lc}d();function EE(r,e){let t=F.create();return F.translate(t,t,[1,1,0]),F.scale(t,t,[r.width*.5,r.height*.5,1]),r.calculatePosMatrix?F.multiply(t,t,r.calculatePosMatrix(e.toUnwrapped())):t}function LE(r,e,t){if(r)for(let n of r){let i=e[n];if(i&&i.source===t&&i.type==="fill-extrusion")return!0}else for(let n in e){let i=e[n];if(i.source===t&&i.type==="fill-extrusion")return!0}return!1}function ab(r,e,t,n,i,o,a){let s=LE(i?.layers??null,e,r.id),l=o.maxPitchScaleFactor(),u=r.tilesIn(n,l,s);u.sort(ub);let c=[];for(let h of u)c.push({wrappedTileID:h.tileID.wrapped().key,queryResults:h.tile.queryRenderedFeatures(e,t,r._state,h.queryGeometry,h.cameraQueryGeometry,h.scale,i,o,l,EE(r.transform,h.tileID),a?(m,f)=>a(h.tileID,m,f):void 0)});let p=DE(c);return kE(p,r)}function sb(r,e,t,n,i,o,a){let s={},l=o.queryRenderedSymbols(n),u=[];for(let c of Object.keys(l).map(Number))u.push(a[c]);u.sort(ub);for(let c of u){let p=c.featureIndex.lookupSymbolFeatures(l[c.bucketInstanceId],e,c.bucketIndex,c.sourceLayerIndex,i.filter,i.layers,i.availableImages,r);for(let h in p){let m=s[h]=s[h]||[],f=p[h];f.sort((y,g)=>{let _=c.featureSortOrder;if(_){let x=_.indexOf(y.featureIndex);return _.indexOf(g.featureIndex)-x}else return g.featureIndex-y.featureIndex});for(let y of f)m.push(y)}}return RE(s,r,t)}function lb(r,e){let t=r.getRenderableIds().map(o=>r.getTileByID(o)),n=[],i={};for(let o=0;o<t.length;o++){let a=t[o],s=a.tileID.canonical.key;i[s]||(i[s]=!0,a.querySourceFeatures(n,e))}return n}function ub(r,e){let t=r.tileID,n=e.tileID;return t.overscaledZ-n.overscaledZ||t.canonical.y-n.canonical.y||t.wrap-n.wrap||t.canonical.x-n.canonical.x}function DE(r){let e={},t={};for(let n of r){let i=n.queryResults,o=n.wrappedTileID,a=t[o]=t[o]||{};for(let s in i){let l=i[s],u=a[s]=a[s]||{},c=e[s]=e[s]||[];for(let p of l)u[p.featureIndex]||(u[p.featureIndex]=!0,c.push(p))}}return e}function kE(r,e){for(let t in r)for(let n of r[t])cb(n,e);return r}function RE(r,e,t){for(let n in r)for(let i of r[n]){let o=e[n],a=t[o.source];cb(i,a)}return r}function cb(r,e){let t=r.feature,n=e.getFeatureState(t.layer["source-layer"],t.id);t.source=t.layer.source,t.layer["source-layer"]&&(t.sourceLayer=t.layer["source-layer"]),t.state=n}d();d();d();d();async function cc(r,e,t){let n=r;if(r.url?n=(await nn(e.transformRequest(r.url,"Source"),t)).data:await re.frameAsync(t),!n)return null;let i=xr(N(n,r),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(i.vectorLayerIds=n.vector_layers.map(o=>o.id)),i}d();d();d();var kt=63710088e-1,W=class r{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 r(Yt(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,n=this.lat*t,i=e.lat*t,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-this.lng)*t);return kt*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof r)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new r(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new r(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 rt=class r{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?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 W?new W(e.lng,e.lat):W.convert(e),this}setSouthWest(e){return this._sw=e instanceof W?new W(e.lng,e.lat):W.convert(e),this}extend(e){let t=this._sw,n=this._ne,i,o;if(e instanceof W)i=e,o=e;else if(e instanceof r){if(i=e._sw,o=e._ne,!i||!o)return this}else{if(Array.isArray(e))if(e.length===4||e.every(Array.isArray)){let a=e;return this.extend(r.convert(a))}else{let a=e;return this.extend(W.convert(a))}else if(e&&("lng"in e||"lon"in e)&&"lat"in e)return this.extend(W.convert(e));return this}return!t&&!n?(this._sw=new W(i.lng,i.lat),this._ne=new W(o.lng,o.lat)):(t.lng=Math.min(i.lng,t.lng),t.lat=Math.min(i.lat,t.lat),n.lng=Math.max(o.lng,n.lng),n.lat=Math.max(o.lat,n.lat)),this}getCenter(){return new W((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 W(this.getWest(),this.getNorth())}getSouthEast(){return new W(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:n}=W.convert(e),i=this._sw.lat<=n&&n<=this._ne.lat,o=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=t&&t>=this._ne.lng),i&&o}static convert(e){return e instanceof r||!e?e:new r(e)}static fromLngLat(e,t=0){let i=360*t/40075017,o=i/Math.cos(Math.PI/180*e.lat);return new r(new W(e.lng-o,e.lat-i),new W(e.lng+o,e.lat+i))}adjustAntiMeridian(){let e=new W(this._sw.lng,this._sw.lat),t=new W(this._ne.lng,this._ne.lat);return e.lng>t.lng?new r(e,new W(t.lng+360,t.lat)):new r(e,t)}};d();var pb=2*Math.PI*kt;function hb(r){return pb*Math.cos(r*Math.PI/180)}function $r(r){return(180+r)/360}function mr(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Er(r,e){return r/hb(e)}function FE(r){return r*360-180}function rf(r){let e=180-r*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function pc(r,e){return r*hb(rf(e))}function zE(r){return 1/Math.cos(r*Math.PI/180)}var fe=class r{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){let n=W.convert(e);return new r($r(n.lng),mr(n.lat),Er(t,n.lat))}toLngLat(){return new W(FE(this.x),rf(this.y))}toAltitude(){return pc(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/pb*zE(rf(this.y))}};var oo=class{constructor(e,t,n){this.bounds=rt.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=Math.pow(2,e.z),n={minX:Math.floor($r(this.bounds.getWest())*t),minY:Math.floor(mr(this.bounds.getNorth())*t),maxX:Math.ceil($r(this.bounds.getEast())*t),maxY:Math.ceil(mr(this.bounds.getSouth())*t)};return e.x>=n.minX&&e.x<n.maxX&&e.y>=n.minY&&e.y<n.maxY}};var os=class extends xe{constructor(e,t,n,i){if(super(),this.id=e,this.dispatcher=n,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,N(this,xr(t,["url","scheme","tileSize","promoteId"])),this._options=N({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(i)}async load(){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await cc(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(N(this,e),e.bounds&&(this.tileBounds=new oo(e.bounds,this.minzoom,this.maxzoom)),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new K(e))}}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.abort(),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.abort(),this._tileJSONRequest=null)}serialize(){return N({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:this.map._requestManager.transformRequest(t,"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,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};n.request.collectResourceTiming=this._collectResourceTiming;let i="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getActor(),i="LT";else if(e.state==="loading")return new Promise((o,a)=>{e.reloadPromise={resolve:o,reject:a}});e.abortController=new AbortController;try{let o=await e.actor.sendAsync({type:i,data:n},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,o)}catch(o){if(delete e.abortController,e.aborted)return;if(o&&o.status!==404)throw o;this._afterTileLoadWorkerResponse(e,null)}}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){let n=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(n.resolve).catch(n.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}};d();var pi=class extends xe{constructor(e,t,n,i){super(),this.id=e,this.dispatcher=n,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=N({type:"raster"},t),N(this,xr(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let t=await cc(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(N(this,t),t.bounds&&(this.tileBounds=new oo(t.bounds,this.minzoom,this.maxzoom)),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new z("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this.fire(new K(t))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return N({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let n=await wt.getImage(this.map._requestManager.transformRequest(t,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(n&&n.data){this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let i=this.map.painter.context,o=i.gl,a=n.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new ve(i,a,o.RGBA,{useMipmap:!0}),e.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(n){if(delete e.abortController,e.aborted)e.state="unloaded";else if(n)throw e.state="errored",n}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}};d();d();d();function fb(r,e,t){e=Math.pow(2,t)-e-1;var n=mb(r*256,e*256,t),i=mb((r+1)*256,(e+1)*256,t);return n[0]+","+n[1]+","+i[0]+","+i[1]}function mb(r,e,t){var n=2*Math.PI*6378137/256/Math.pow(2,t),i=r*n-2*Math.PI*6378137/2,o=e*n-2*Math.PI*6378137/2;return[i,o]}var gb=ie(le(),1);d();function db(r,e,t){return!(r<ko||r>jn||t<0||t>=Math.pow(2,r)||e<0||e>=Math.pow(2,r))}function yb(r,e){let{x:t,y:n}=fe.fromLngLat(e);return!(r<ko||r>jn||n<0||n>=1||t<0||t>=1)}var Pn=class{constructor(e,t,n){if(!db(e,t,n))throw new Error(`x=${t}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} ${ko}<=z<=${jn} `);this.z=e,this.x=t,this.y=n,this.key=hi(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,n){let i=fb(this.x,this.y,this.z),o=BE(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,t>1?"@2x":"").replace(/{quadkey}/g,o).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 gb.default((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},Sn=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=hi(e,t.z,t.z,t.x,t.y)}},Be=class r{constructor(e,t,n,i,o){this.terrainRttPosMatrix32f=null;if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Pn(n,+i,+o),this.key=hi(t,e,n,i,o)}clone(){return new r(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 r(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new r(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 n=this.canonical.z-e;return e>this.canonical.z?hi(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):hi(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return e.overscaledZ===0||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 r(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new r(t,this.wrap,t,n,i),new r(t,this.wrap,t,n+1,i),new r(t,this.wrap,t,n,i+1),new r(t,this.wrap,t,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 r(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new r(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 Sn(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new fe(e.x-this.wrap,e.y))}};function hi(r,e,t,n,i){r*=2,r<0&&(r=r*-1-1);let o=1<<t;return(o*o*r+o*i+n).toString(36)+t.toString(36)+e.toString(36)}function BE(r,e,t){let n="",i;for(let o=r;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(t&i?2:0);return n}G("CanonicalTileID",Pn);G("OverscaledTileID",Be,{omit:["terrainRttPosMatrix32f"]});var as=class extends pi{constructor(e,t,n,i){super(e,t,n,i),this.type="raster-dem",this.maxzoom=22,this._options=N({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n=this.map._requestManager.transformRequest(t,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let i=await wt.getImage(n,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i&&i.data){let o=i.data;this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let s=Mt(o)&&rl()?o:await this.readImageNow(o),l={type:this.type,uid:e.uid,source:this.id,rawImageData:s,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let u=await e.actor.sendAsync({type:"LDT",data:l});e.dem=u,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async readImageNow(e){if(typeof VideoFrame<"u"&&yh()){let t=e.width+2,n=e.height+2;try{return new Se({width:t,height:n},await My(e,-1,-1,t,n))}catch{}}return re.getImageData(e,1)}_getNeighboringTiles(e){let t=e.canonical,n=Math.pow(2,t.z),i=(t.x-1+n)%n,o=t.x===0?e.wrap-1:e.wrap,a=(t.x+1+n)%n,s=t.x+1===n?e.wrap+1:e.wrap,l={};return l[new Be(e.overscaledZ,o,t.z,i,t.y).key]={backfilled:!1},l[new Be(e.overscaledZ,s,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(l[new Be(e.overscaledZ,o,t.z,i,t.y-1).key]={backfilled:!1},l[new Be(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},l[new Be(e.overscaledZ,s,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<n&&(l[new Be(e.overscaledZ,o,t.z,i,t.y+1).key]={backfilled:!1},l[new Be(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},l[new Be(e.overscaledZ,s,t.z,a,t.y+1).key]={backfilled:!1}),l}async 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&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}};d();var ss=class extends xe{constructor(e,t,n,i){super(),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=n.getActor(),this.setEventedParent(i),this._data=t.data,this._options=N({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,t.clusterMaxZoom!==void 0&&this.maxzoom<=t.clusterMaxZoom&&ue(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t.clusterMaxZoom}".`),this.workerOptions=N({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t.buffer!==void 0?t.buffer:128),tolerance:this._pixelsToTileUnits(t.tolerance!==void 0?t.tolerance:.375),extent:8192,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:8192,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(8192/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||ue(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${t}"`),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}async getData(){let e=N({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(t=>t.coordinates).flat(1/0):e.coordinates.flat(1/0)}async getBounds(){let e=new rt,t=await this.getData(),n;switch(t.type){case"FeatureCollection":n=t.features.map(i=>this.getCoordinatesFromGeometry(i.geometry)).flat(1/0);break;case"Feature":n=this.getCoordinatesFromGeometry(t.geometry);break;default:n=this.getCoordinatesFromGeometry(t);break}if(n.length==0)return e;for(let i=0;i<n.length-1;i+=2)e.extend([n[i],n[i+1]]);return e}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom))),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,n){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:n}})}async _updateWorkerData(e){let t=N({type:this.type},this.workerOptions);e?t.dataDiff=e:typeof this._data=="string"?(t.request=this.map._requestManager.transformRequest(re.resolveURL(this._data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new z("dataloading",{dataType:"source"}));try{let n=await this.actor.sendAsync({type:"LD",data:t});if(this._pendingLoads--,this._removed||n.abandoned){this.fire(new z("dataabort",{dataType:"source"}));return}let i=null;n.resourceTiming&&n.resourceTiming[this.id]&&(i=n.resourceTiming[this.id].slice(0));let o={dataType:"source"};this._collectResourceTiming&&i&&i.length>0&&N(o,{resourceTiming:i}),this.fire(new z("data",{...o,sourceDataType:"metadata"})),this.fire(new z("data",{...o,sourceDataType:"content"}))}catch(n){if(this._pendingLoads--,this._removed){this.fire(new z("dataabort",{dataType:"source"}));return}this.fire(new K(n))}}loaded(){return this._pendingLoads===0}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=this.actor;let n={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,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};e.abortController=new AbortController;let i=await this.actor.sendAsync({type:t,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(i,this.map.painter,t==="RT")}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return N({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}};d();d();d();var ls=ie(le(),1),at=class r{constructor(){this.minX=1/0;this.maxX=-1/0;this.minY=1/0;this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let t=new r;return t.extend(e(new ls.default(this.minX,this.minY))),t.extend(e(new ls.default(this.maxX,this.minY))),t.extend(e(new ls.default(this.minX,this.maxY))),t.extend(e(new ls.default(this.maxX,this.maxY))),t}static fromPoints(e){let t=new r;for(let n of e)t.extend(n);return t}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}};var Gt=class extends xe{constructor(t,n,i,o){super();this.flippedWindingOrder=!1;this.id=t,this.dispatcher=i,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=n}async load(t){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let n=await wt.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new K(n))}}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;let n=t.map(fe.fromLngLat);return this.tileID=OE(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map(i=>this.tileID.getTilePoint(i)._round()),this.flippedWindingOrder=VE(this.tileCoords),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let t=this.map.painter.context,n=t.gl;this.texture||(this.texture=new ve(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let i=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}async loadTile(t){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:n,minY:i,maxX:o,maxY:a}=at.fromPoints(t),s={};for(let l=0;l<=jn;l++){let u=Math.pow(2,l),c=Math.floor(n*u),p=Math.floor(i*u),h=Math.floor(o*u),m=Math.floor(a*u);s[l]={minTileX:c,minTileY:p,maxTileX:h,maxTileY:m}}return s}};function OE(r){let e=at.fromPoints(r),t=e.width(),n=e.height(),i=Math.max(t,n),o=Math.max(0,Math.floor(-Math.log(i)/Math.LN2)),a=Math.pow(2,o);return new Pn(o,Math.floor((e.minX+e.maxX)/2*a),Math.floor((e.minY+e.maxY)/2*a))}function VE(r){let e=r[1].x-r[0].x,t=r[1].y-r[0].y,n=r[2].x-r[0].x,i=r[2].y-r[0].y;return e*i-t*n<0}var us=class extends Gt{constructor(e,t,n,i){super(e,t,n,i),this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{let t=await By(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new K(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 K(new j(`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)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;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 ve(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let n=!1;for(let i in this.tiles){let o=this.tiles[i];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,n=!0)}n&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}};d();var cs=class extends Gt{constructor(e,t,n,i){super(e,t,n,i),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(o=>!Array.isArray(o)||o.length!==2||o.some(a=>typeof a!="number")))&&this.fire(new K(new j(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new K(new j(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new K(new j(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new K(new j(`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 K(new j(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate!==void 0?t.animate:!0}async load(){if(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 K(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){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()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,n=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new ve(t,this.canvas,n.RGBA,{premultiply:!0});let i=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};var _b={},xb=(r,e,t,n)=>{let i=bb(e.type),o=new i(r,e,t,n);if(o.id!==r)throw new Error(`Expected Source id to be ${r} instead of ${o.id}`);return o},bb=r=>{switch(r){case"geojson":return ss;case"image":return Gt;case"raster":return pi;case"raster-dem":return as;case"vector":return os;case"video":return us;case"canvas":return cs}return _b[r]},UE=(r,e)=>{_b[r]=e},jE=async(r,e)=>{if(bb(r))throw new Error(`A source type called "${r}" already exists.`);UE(r,e)};d();d();function vb(r,e){let t={};if(!e)return t;for(let n of r){let i=n.layerIds.map(o=>e.getLayer(o)).filter(Boolean);if(i.length!==0){n.layers=i,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(o=>i.filter(a=>a.id===o)[0]));for(let o of i)t[o.id]=n}}return t}d();d();var hc=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=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 Pb=ie(Za(),1),Sb=ie(Km(),1);d();var ao=class{constructor(e,t,n,i,o){this.type="Feature",this._vectorTileFeature=e,e._z=t,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 t in this)t==="_geometry"||t==="_vectorTileFeature"||(e[t]=this[t]);return e}};var nf=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 Jn(8192,16,0),this.grid3D=new Jn(8192,16,0),this.featureIndexArray=new Aa,this.promoteId=t}insert(e,t,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<t.length;u++){let c=t[u],p=[1/0,1/0,-1/0,-1/0];for(let h=0;h<c.length;h++){let m=c[h];p[0]=Math.min(p[0],m.x),p[1]=Math.min(p[1],m.y),p[2]=Math.max(p[2],m.x),p[3]=Math.max(p[3],m.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Pb.default.VectorTile(new Sb.default(this.rawTileData)).layers,this.sourceLayerCoder=new hc(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,n,i){this.loadVTLayers();let o=e.params,a=8192/e.tileSize/e.scale,s=pn(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=at.fromPoints(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),h=at.fromPoints(e.cameraQueryGeometry).expandBy(u),m=this.grid3D.query(h.minX,h.minY,h.maxX,h.maxY,(g,_,x,b)=>w_(e.cameraQueryGeometry,g-u,_-u,x+u,b+u));for(let g of m)p.push(g);p.sort(NE);let f={},y;for(let g=0;g<p.length;g++){let _=p[g];if(_===y)continue;y=_;let x=this.featureIndexArray.get(_),b=null;this.loadMatchingFeature(f,x.bucketIndex,x.sourceLayerIndex,x.featureIndex,s,o.layers,o.availableImages,t,n,i,(v,P,S)=>(b||(b=Et(v)),P.queryIntersectsFeature({queryGeometry:l,feature:v,featureState:S,geometry:b,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return f}loadMatchingFeature(e,t,n,i,o,a,s,l,u,c,p){let h=this.bucketLayerIDs[t];if(a&&!h.some(_=>a.has(_)))return;let m=this.sourceLayerCoder.decode(n),y=this.vtLayers[m].feature(i);if(o.needGeometry){let _=Lt(y,!0);if(!o.filter(new be(this.tileID.overscaledZ),_,this.tileID.canonical))return}else if(!o.filter(new be(this.tileID.overscaledZ),y))return;let g=this.getId(y,m);for(let _=0;_<h.length;_++){let x=h[_];if(a&&!a.has(x))continue;let b=l[x];if(!b)continue;let v={};g&&c&&(v=c.getState(b.sourceLayer||"_geojsonTileLayer",g));let P=N({},u[x]);P.paint=wb(P.paint,b.paint,y,v,s),P.layout=wb(P.layout,b.layout,y,v,s);let S=!p||p(y,b,v);if(!S)continue;let T=new ao(y,this.z,this.x,this.y,g);T.layer=P;let C=e[x];C===void 0&&(C=e[x]=[]),C.push({featureIndex:i,feature:T,intersectionZ:S})}}lookupSymbolFeatures(e,t,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=pn(o);for(let p of e)this.loadMatchingFeature(u,n,i,p,c,a,s,l,t);return u}hasLayer(e){for(let t of this.bucketLayerIDs)for(let n of t)if(e===n)return!0;return!1}getId(e,t){let n=e.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];n=e.properties[i],typeof n=="boolean"&&(n=Number(n)),n===void 0&&e.properties?.cluster&&this.promoteId&&(n=Number(e.properties.cluster_id))}return n}};G("FeatureIndex",nf,{omit:["rawTileData","sourceLayerCoder"]});function wb(r,e,t,n,i){return Lo(r,(o,a)=>{let s=e instanceof mn?e.get(a):null;return s&&s.evaluate?s.evaluate(t,n,i):s})}function NE(r,e){return e-r}d();d();var ps="RTLPluginLoaded";var af=class extends xe{constructor(){super(...arguments);this.status="unavailable";this.url=null;this.dispatcher=uc()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(t,n=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=re.resolveURL(t),!this.url)throw new Error(`requested url ${t} is invalid`);if(this.status==="unavailable")if(n)this.status="deferred",this._syncState(this.status);else return this._requestImport();else if(this.status==="requested")return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new z(ps))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}},of=null;function Tn(){return of||(of=new af),of}var GE=3e4,so=class{constructor(e,t){this.timeAdded=0;this.fadeEndTime=0;this.tileID=e,this.uid=hl(),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 this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,t,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new wa;return}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=vb(e.buckets,t?.style),this.hasSymbolBuckets=!1;for(let i in this.buckets){let o=this.buckets[i];if(o instanceof hr)if(this.hasSymbolBuckets=!0,n)o.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let o=this.buckets[i];if(o instanceof hr&&o.hasRTLText){this.hasRTLText=!0,Tn().lazyLoad();break}}this.queryPadding=0;for(let i in this.buckets){let o=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(i).queryRadius(o))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}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 n in this.buckets){let i=this.buckets[n];i.uploadPending()&&i.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new ve(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new ve(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,i,o,a,s,l,u,c,p){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:o,scale:a,tileSize:this.tileSize,pixelPosMatrix:c,transform:l,params:s,queryPadding:this.queryPadding*u,getElevation:p},e,t,n)}querySourceFeatures(e,t){let n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;let i=n.loadVTLayers(),o=t&&t.sourceLayer?t.sourceLayer:"",a=i._geojsonTileLayer||i[o];if(!a)return;let s=pn(t&&t.filter),{z:l,x:u,y:c}=this.tileID.canonical,p={z:l,x:u,y:c};for(let h=0;h<a.length;h++){let m=a.feature(h);if(s.needGeometry){let g=Lt(m,!0);if(!s.filter(new be(this.tileID.overscaledZ),g,this.tileID.canonical))continue}else if(!s.filter(new be(this.tileID.overscaledZ),m))continue;let f=n.getId(m,o),y=new ao(m,l,u,c,f);y.tile=p,e.push(y)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let n=wy(e.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+n["max-age"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let n=Date.now(),i=!1;if(this.expirationTime>n)i=!1;else if(!t)i=!0;else if(this.expirationTime<t)i=!0;else{let o=this.expirationTime-t;o?this.expirationTime=n+Math.max(o,GE):i=!0}i?(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||Object.keys(e).length===0)return;let n=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!t.style.hasLayer(i))continue;let o=this.buckets[i],a=o.layers[0].sourceLayer||"_geojsonTileLayer",s=n[a],l=e[a];if(!s||!l||Object.keys(l).length===0)continue;o.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let u=t&&t.style&&t.style.getLayer(i);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(o)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<re.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=re.now()+e}setDependencies(e,t){let n={};for(let i of t)n[i]=!0;this.dependencies[e]=n}hasDependency(e,t){for(let n of e){let i=this.dependencies[n];if(i){for(let o of t)if(i[o])return!0}}return!1}};d();var mc=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,n){let i=e.wrapped().key;this.data[i]===void 0&&(this.data[i]=[]);let o={value:t,timeout:void 0};if(n!==void 0&&(o.timeout=setTimeout(()=>{this.remove(e,o)},n)),this.data[i].push(o),this.order.push(i),this.order.length>this.max){let a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}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),this.data[e].length===0&&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 n=e.wrapped().key,i=t===void 0?0:this.data[n].indexOf(t),o=this.data[n][i];return this.data[n].splice(i,1),o.timeout&&clearTimeout(o.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(o.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(e){let t=[];for(let n in this.data)for(let i of this.data[n])e(i.value)||t.push(i);for(let n of t)this.remove(n.value.tileID,n)}};var lf=ie(le(),1);d();var fc=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,n){let i=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][i]=this.stateChanges[e][i]||{},N(this.stateChanges[e][i],n),this.deletedStates[e]===null){this.deletedStates[e]={};for(let o in this.state[e])o!==i&&(this.deletedStates[e][o]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][i]===null){this.deletedStates[e][i]={};for(let a in this.state[e][i])n[a]||(this.deletedStates[e][i][a]=null)}else for(let a in n)this.deletedStates[e]&&this.deletedStates[e][i]&&this.deletedStates[e][i][a]===null&&delete this.deletedStates[e][i][a]}removeFeatureState(e,t,n){if(this.deletedStates[e]===null)return;let o=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&t!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][n]=null);else if(t!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o]){this.deletedStates[e][o]={};for(n in this.stateChanges[e][o])this.deletedStates[e][o][n]=null}else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,t){let n=String(t),i=this.state[e]||{},o=this.stateChanges[e]||{},a=N({},i[n],o[n]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let s=this.deletedStates[e][t];if(s===null)return{};for(let l in s)delete a[l]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){let n={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let o={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),N(this.state[i][a],this.stateChanges[i][a]),o[a]=this.state[i][a];n[i]=o}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let o={};if(this.deletedStates[i]===null)for(let a in this.state[i])o[a]={},this.state[i][a]={};else for(let a in this.deletedStates[i]){if(this.deletedStates[i][a]===null)this.state[i][a]={};else for(let l of Object.keys(this.deletedStates[i][a]))delete this.state[i][a][l];o[a]=this.state[i][a]}n[i]=n[i]||{},N(n[i],o)}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length!==0)for(let i in e)e[i].setFeatureState(n,t)}};d();d();var Tb=ie(le(),1),Mn=89.25;function Mb(r,e,t){let n=1/(1<<t.z);return new fe(r/8192*n+t.x*n,e/8192*n+t.y*n)}function Zt(r,e){let t=ae(e.lat,-vt,vt);return new Tb.default($r(e.lng)*r,mr(t)*r)}function Cn(r,e){return new fe(e.x/r,e.y/r).toLngLat()}function lo(r){return r.cameraToCenterDistance*Math.min(Math.tan(Ee(90-r.pitch))*.85,Math.tan(Ee(Mn-r.pitch)))}function dc(r,e){let t=r.canonical,n=e/We(t.z),i=t.x+Math.pow(2,t.z)*r.wrap,o=F.identity(new Float64Array(16));return F.translate(o,o,[i*n,t.y*n,0]),F.scale(o,o,[n/8192,n/8192,1]),o}function hs(r,e,t,n,i){let o=fe.fromLngLat(r,e),a=Er(1,r.lat),s=i*a,l=s*Math.cos(Ee(t)),u=Math.sqrt(s*s-l*l),c=u*Math.sin(Ee(-n)),p=u*Math.cos(Ee(-n));return new fe(o.x+c,o.y+p,o.z+l)}d();function ZE(r,e,t){let n=e.intersectsFrustum(r);if(!t||n===0)return n;let i=e.intersectsPlane(t);return i===0?0:n===2&&i===2?2:1}function Cb(r,e,t){let i=0,o=(t-e)/10;for(let a=0;a<10;a++){let s=e+(a+.5)/10*(t-e);i+=o*Math.pow(Math.cos(s),r)}return i}function yc(r,e){return function(t,n,i,o,a){let s=2*((r-1)/Ge(Math.cos(Ee(Mn-a))/Math.cos(Ee(Mn)))-1),l=Math.acos(i/o),u=2*Cb(s-1,0,Ee(a/2)),c=Math.min(Ee(Mn),l+Ee(a/2)),p=Math.min(c,l-Ee(a/2)),h=Cb(s-1,p,c),m=Math.atan(n/i),f=Math.hypot(n,i),y=t;return y=y+Ge(o/f/Math.max(.5,Math.cos(Ee(a/2)))),y+=s*Ge(Math.cos(m))/2,y-=Ge(Math.max(1,h/u/e))/2,y}}var $E=9.314,HE=3,qE=yc($E,HE);function mi(r,e){let t=(e.roundZoom?Math.round:Math.floor)(r.zoom+Ge(r.tileSize/e.tileSize));return Math.max(0,t)}function An(r,e){let t=r.getCameraFrustum(),n=r.getClippingPlane(),i=r.screenPointToMercatorCoordinate(r.getCameraPoint()),o=fe.fromLngLat(r.center,r.elevation);i.z=o.z+Math.cos(r.pitchInRadians)*r.cameraToCenterDistance/r.worldSize;let a=r.getCoveringTilesDetailsProvider(),s=a.allowVariableZoom(r,e),l=mi(r,e),u=e.minzoom||0,c=e.maxzoom!==void 0?e.maxzoom:r.maxZoom,p=Math.min(Math.max(0,l),c),h=Math.pow(2,p),m=[h*i.x,h*i.y,0],f=[h*o.x,h*o.y,0],y=Math.hypot(o.x-i.x,o.y-i.y),g=Math.abs(o.z-i.z),_=Math.hypot(y,g),x=P=>({zoom:0,x:0,y:0,wrap:P,fullyVisible:!1}),b=[],v=[];if(r.renderWorldCopies&&a.allowWorldCopies())for(let P=1;P<=3;P++)b.push(x(-P)),b.push(x(P));for(b.push(x(0));b.length>0;){let P=b.pop(),S=P.x,T=P.y,C=P.fullyVisible,A={x:S,y:T,z:P.zoom},E=a.getTileBoundingVolume(A,P.wrap,r.elevation,e);if(!C){let M=ZE(t,E,n);if(M===0)continue;C=M===2}let k=a.distanceToTile2d(i.x,i.y,A,E),R=l;s&&(R=(e.calculateTileZoom||qE)(r.zoom+Ge(r.tileSize/e.tileSize),k,g,_,r.fov)),R=(e.roundZoom?Math.round:Math.floor)(R),R=Math.max(0,R);let V=Math.min(R,c);if(P.wrap=a.getWrap(o,A,P.wrap),P.zoom>=V){if(P.zoom<u)continue;let M=p-P.zoom,L=m[0]-.5-(S<<M),$=m[1]-.5-(T<<M),q=e.reparseOverscaled?Math.max(P.zoom,R):P.zoom;v.push({tileID:new Be(P.zoom===c?q:P.zoom,P.wrap,P.zoom,S,T),distanceSq:it.sqrLen([f[0]-.5-S,f[1]-.5-T]),tileDistanceToCamera:Math.sqrt(L*L+$*$)});continue}for(let M=0;M<4;M++){let L=(S<<1)+M%2,$=(T<<1)+(M>>1),q=P.zoom+1;b.push({zoom:q,x:L,y:$,wrap:P.wrap,fullyVisible:C})}}return v.sort((P,S)=>P.distanceSq-S.distanceSq).map(P=>P.tileID)}d();var sf=ie(le(),1);var Ib=at.fromPoints([new sf.default(0,0),new sf.default(8192,8192)]);var Hr=class r extends xe{constructor(e,t,n){super(),this.id=e,this.dispatcher=n,this.on("data",i=>this._dataHandler(i)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=xb(e,t,n,this),this._tiles={},this._cache=new mc(0,i=>this._unloadTile(i)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new fc,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((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let e in this._tiles){let t=this._tiles[e];if(t.state!=="loaded"&&t.state!=="errored")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)}async _loadTile(e,t,n){try{await this._source.loadTile(e),this._tileLoaded(e,t,n)}catch(i){e.state="errored",i.status!==404?this._source.fire(new K(i,{tile:e})):this.update(this.transform,this.terrain)}}_unloadTile(e){this._source.unloadTile&&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 n=this._tiles[t];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(Eb).map(e=>e.key)}getRenderableIds(e){let t=[];for(let n in this._tiles)this._isIdRenderable(n,e)&&t.push(this._tiles[n]);return e?t.sort((n,i)=>{let o=n.tileID,a=i.tileID,s=new lf.default(o.canonical.x,o.canonical.y)._rotate(-this.transform.bearingInRadians),l=new lf.default(a.canonical.x,a.canonical.y)._rotate(-this.transform.bearingInRadians);return o.overscaledZ-a.overscaledZ||l.y-s.y||l.x-s.x}).map(n=>n.tileID.key):t.map(n=>n.tileID).sort(Eb).map(n=>n.key)}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return t?this._isIdRenderable(t.tileID.key):!1}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(e){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let t in this._tiles)e?this._reloadTile(t,"expired"):this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}async _reloadTile(e,t){let n=this._tiles[e];n&&(n.state!=="loading"&&(n.state=t),await this._loadTile(n,e,t))}_tileLoaded(e,t,n){e.timeAdded=re.now(),n==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),this.getSource().type==="raster-dem"&&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 o=t[i];if(e.neighboringTiles&&e.neighboringTiles[o]){let a=this.getTileByID(o);n(e,a),n(a,e)}}function n(i,o){i.needsHillshadePrepare=!0,i.needsTerrainPrepare=!0;let a=o.tileID.canonical.x-i.tileID.canonical.x,s=o.tileID.canonical.y-i.tileID.canonical.y,l=Math.pow(2,i.tileID.canonical.z),u=o.tileID.key;a===0&&s===0||Math.abs(s)>1||(Math.abs(a)>1&&(Math.abs(a+l)===1?a+=l:Math.abs(a-l)===1&&(a-=l)),!(!o.dem||!i.dem)&&(i.dem.backfillBorder(o.dem,a,s),i.neighboringTiles&&i.neighboringTiles[u]&&(i.neighboringTiles[u].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,n,i){for(let o in this._tiles){let a=this._tiles[o];if(i[o]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>n)continue;let s=a.tileID;for(;a&&a.tileID.overscaledZ>t+1;){let u=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[u.key],a&&a.hasData()&&(s=u)}let l=s;for(;l.overscaledZ>t;)if(l=l.scaledTo(l.overscaledZ-1),e[l.key]||e[l.canonical.key]){i[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=t?n:null}for(let n=e.overscaledZ-1;n>=t;n--){let i=e.scaledTo(n),o=this._getLoadedTile(i);if(o)return o}}findLoadedSibling(e){return this._getLoadedTile(e)}_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,n=Math.ceil(e.height/this._source.tileSize)+1,i=t*n,o=this._maxTileCacheZoomLevels===null?ot.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,a=Math.floor(i*o),s=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(s)}handleWrapJump(e){let t=this._prevLng===void 0?e:this._prevLng,i=(e-t)/360,o=Math.round(i);if(this._prevLng=e,o){let a={};for(let s in this._tiles){let l=this._tiles[s];l.tileID=l.tileID.unwrapTo(l.tileID.wrap+o),a[l.tileID.key]=l}this._tiles=a;for(let s in this._timers)clearTimeout(this._timers[s]),delete this._timers[s];for(let s in this._tiles){let l=this._tiles[s];this._setTileReloadTimer(s,l)}}}_updateCoveredAndRetainedTiles(e,t,n,i,o,a){let s={},l={},u=Object.keys(e),c=re.now();for(let p of u){let h=e[p],m=this._tiles[p];if(!m||m.fadeEndTime!==0&&m.fadeEndTime<=c)continue;let f=this.findLoadedParent(h,t),y=this.findLoadedSibling(h),g=f||y||null;g&&(this._addTile(g.tileID),s[g.tileID.key]=g.tileID),l[p]=h}this._retainLoadedChildren(l,i,n,e);for(let p in s)e[p]||(this._coveredTiles[p]=!0,e[p]=s[p]);if(a){let p={},h={};for(let m of o)this._tiles[m.key].hasData()?p[m.key]=m:h[m.key]=m;for(let m in h){let f=h[m].children(this._source.maxzoom);this._tiles[f[0].key]&&this._tiles[f[1].key]&&this._tiles[f[2].key]&&this._tiles[f[3].key]&&(p[f[0].key]=e[f[0].key]=f[0],p[f[1].key]=e[f[1].key]=f[1],p[f[2].key]=e[f[2].key]=f[2],p[f[3].key]=e[f[3].key]=f[3],delete h[m])}for(let m in h){let f=h[m],y=this.findLoadedParent(f,this._source.minzoom),g=this.findLoadedSibling(f),_=y||g||null;if(_){p[_.tileID.key]=e[_.tileID.key]=_.tileID;for(let x in p)p[x].isChildOf(_.tileID)&&delete p[x]}}for(let m in this._tiles)p[m]||(this._coveredTiles[m]=!0)}}update(e,t){if(!this._sourceLoaded||this._paused)return;this.transform=e,this.terrain=t,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let n;!this.used&&!this.usedForTerrain?n=[]:this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(c=>new Be(c.canonical.z,c.wrap,c.canonical.z,c.canonical.x,c.canonical.y)):(n=An(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this.usedForTerrain?!1:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:t,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(n=n.filter(c=>this._source.hasTile(c))));let i=mi(e,this._source),o=Math.max(i-r.maxOverzooming,this._source.minzoom),a=Math.max(i+r.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let c={};for(let p of n)if(p.canonical.z>this._source.minzoom){let h=p.scaledTo(p.canonical.z-1);c[h.key]=h;let m=p.scaledTo(Math.max(this._source.minzoom,Math.min(p.canonical.z,5)));c[m.key]=m}n=n.concat(Object.values(c))}let s=n.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new z("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let l=this._updateRetainedTiles(n,i);Lb(this._source.type)&&this._updateCoveredAndRetainedTiles(l,o,a,i,n,t);for(let c in l)this._tiles[c].clearFadeHold();let u=gy(this._tiles,l);for(let c of u){let p=this._tiles[c];p.hasSymbolBuckets&&!p.holdingForFade()?p.setHoldDuration(this.map._fadeDuration):(!p.hasSymbolBuckets||p.symbolFadeFinished())&&this._removeTile(c)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let n={},i={},o=Math.max(t-r.maxOverzooming,this._source.minzoom),a=Math.max(t+r.maxUnderzooming,this._source.minzoom),s={};for(let l of e){let u=this._addTile(l);n[l.key]=l,!u.hasData()&&t<this._source.maxzoom&&(s[l.key]=l)}this._retainLoadedChildren(s,t,a,n);for(let l of e){let u=this._tiles[l.key];if(u.hasData())continue;if(t+1>this._source.maxzoom){let p=l.children(this._source.maxzoom)[0],h=this.getTile(p);if(h&&h.hasData()){n[p.key]=p;continue}}else{let p=l.children(this._source.maxzoom);if(n[p[0].key]&&n[p[1].key]&&n[p[2].key]&&n[p[3].key])continue}let c=u.wasRequested();for(let p=l.overscaledZ-1;p>=o;--p){let h=l.scaledTo(p);if(i[h.key])break;if(i[h.key]=!0,u=this.getTile(h),!u&&c&&(u=this._addTile(h)),u){let m=u.hasData();if((m||!this.map?.cancelPendingTileRequestsWhileZooming||c)&&(n[h.key]=h),c=u.wasRequested(),m)break}}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let t=[],n,i=this._tiles[e].tileID;for(;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){n=this._loadedParentTiles[i.key];break}t.push(i.key);let o=i.scaledTo(i.overscaledZ-1);if(n=this._getLoadedTile(o),n)break;i=o}for(let o of t)this._loadedParentTiles[o]=n}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let t=this._tiles[e].tileID,n=this._getLoadedTile(t);this._loadedSiblingTiles[t.key]=n}}_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 n=t;return t||(t=new so(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,e.key,t.state)),t.uses++,this._tiles[e.key]=t,n||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 n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},n))}refreshTiles(e){for(let t in this._tiles)!this._isIdRenderable(t)&&this._tiles[t].state!="errored"||e.some(n=>n.equals(this._tiles[t].tileID.canonical))&&this._reloadTile(t,"expired")}_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()&&t.state!=="reloading"?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){let t=e.sourceDataType;e.dataType==="source"&&t==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&t==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,t,n){let i=[],o=this.transform;if(!o)return i;let a=o.getCoveringTilesDetailsProvider().allowWorldCopies(),s=n?o.getCameraQueryGeometry(e):e,l=m=>o.screenPointToMercatorCoordinate(m,this.terrain),u=this.transformBbox(e,l,!a),c=this.transformBbox(s,l,!a),p=this.getIds(),h=at.fromPoints(c);for(let m=0;m<p.length;m++){let f=this._tiles[p[m]];if(f.holdingForFade())continue;let y=a?[f.tileID]:[f.tileID.unwrapTo(-1),f.tileID.unwrapTo(0)],g=Math.pow(2,o.zoom-f.tileID.overscaledZ),_=t*f.queryPadding*8192/f.tileSize/g;for(let x of y){let b=h.map(v=>x.getTilePoint(new fe(v.x,v.y)));if(b.expandBy(_),b.intersects(Ib)){let v=u.map(S=>x.getTilePoint(S)),P=c.map(S=>x.getTilePoint(S));i.push({tile:f,tileID:a?x:x.unwrapTo(0),queryGeometry:v,cameraQueryGeometry:P,scale:g})}}}return i}transformBbox(e,t,n){let i=e.map(t);if(n){let o=at.fromPoints(e);o.shrinkBy(Math.min(o.width(),o.height())*.001);let a=o.map(t);at.fromPoints(i).covers(a)||(i=i.map(l=>l.x>.5?new fe(l.x-1,l.y,l.z):l))}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(n=>this._tiles[n].tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){if(this._source.hasTransition())return!0;if(Lb(this._source.type)){let e=re.now();for(let t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,n){e=e||"_geojsonTileLayer",this._state.updateState(e,t,n)}removeFeatureState(e,t,n){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,t,n)}getFeatureState(e,t){return e=e||"_geojsonTileLayer",this._state.getState(e,t)}setDependencies(e,t,n){let i=this._tiles[e];i&&i.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(let n in this._tiles)this._tiles[n].hasDependency(e,t)&&this._reloadTile(n,"reloading");this._cache.filter(n=>!n.hasDependency(e,t))}};Hr.maxOverzooming=10;Hr.maxUnderzooming=3;function Eb(r,e){let t=Math.abs(r.wrap*2)-+(r.wrap<0),n=Math.abs(e.wrap*2)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||n-t||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x}function Lb(r){return r==="raster"||r==="image"||r==="video"}d();d();d();var fr=ie(le(),1);d();var qr=ie(le(),1);function uf(r,e,t,n,i){let o=[];for(let a=0;a<r.length;a++){let s=r[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 qr.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new qr.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round()),!(c.y<t&&p.y<t)&&(c.y<t?c=new qr.default(c.x+(p.x-c.x)*((t-c.y)/(p.y-c.y)),t)._round():p.y<t&&(p=new qr.default(c.x+(p.x-c.x)*((t-c.y)/(p.y-c.y)),t)._round()),!(c.x>=n&&p.x>=n)&&(c.x>=n?c=new qr.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new qr.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 qr.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new qr.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}d();var gc=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let n=1;n<this.points.length;n++)this._distances[n]=this._distances[n-1]+this.points[n].dist(this.points[n-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=ae(e,0,1);let t=1,n=this._distances[t],i=e*this.paddedLength+this.padding;for(;n<i&&t<this._distances.length;)n=this._distances[++t];let o=t-1,a=this._distances[o],s=n-a,l=s>0?(i-a)/s:0;return this.points[o].mult(1-l).add(this.points[t].mult(l))}};d();function _c(r,e){let t=!0;return r==="always"||(r==="never"||e==="never")&&(t=!1),t}var ms=class{constructor(e,t,n){let i=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let a=0;a<this.xCellCount*this.yCellCount;a++)i.push([]),o.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,n,i,o){this._forEachCell(t,n,i,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}insertCircle(e,t,n,i){this._forEachCell(t-i,n-i,t+i,n+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(i)}_insertBoxCell(e,t,n,i,o,a){this.boxCells[o].push(a)}_insertCircleCell(e,t,n,i,o,a){this.circleCells[o].push(a)}_query(e,t,n,i,o,a,s){if(n<0||e>this.width||i<0||t>this.height)return[];let l=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=i){if(o)return[{key:null,x1:e,y1:t,x2:n,y2:i}];for(let u=0;u<this.boxKeys.length;u++)l.push({key:this.boxKeys[u],x1:this.bboxes[u*4],y1:this.bboxes[u*4+1],x2:this.bboxes[u*4+2],y2:this.bboxes[u*4+3]});for(let u=0;u<this.circleKeys.length;u++){let c=this.circles[u*3],p=this.circles[u*3+1],h=this.circles[u*3+2];l.push({key:this.circleKeys[u],x1:c-h,y1:p-h,x2:c+h,y2:p+h})}}else{let u={hitTest:o,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,n,i,this._queryCell,l,u,s)}return l}query(e,t,n,i){return this._query(e,t,n,i,!1,null)}hitTest(e,t,n,i,o,a){return this._query(e,t,n,i,!0,o,a).length>0}hitTestCircle(e,t,n,i,o){let a=e-n,s=e+n,l=t-n,u=t+n;if(s<0||a>this.width||u<0||l>this.height)return!1;let c=[],p={hitTest:!0,overlapMode:i,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}};return this._forEachCell(a,l,s,u,this._queryCellCircle,c,p,o),c.length>0}_queryCell(e,t,n,i,o,a,s,l){let{seenUids:u,hitTest:c,overlapMode:p}=s,h=this.boxCells[o];if(h!==null){let f=this.bboxes;for(let y of h)if(!u.box[y]){u.box[y]=!0;let g=y*4,_=this.boxKeys[y];if(e<=f[g+2]&&t<=f[g+3]&&n>=f[g+0]&&i>=f[g+1]&&(!l||l(_))&&(!c||!_c(p,_.overlapMode))&&(a.push({key:_,x1:f[g],y1:f[g+1],x2:f[g+2],y2:f[g+3]}),c))return!0}}let m=this.circleCells[o];if(m!==null){let f=this.circles;for(let y of m)if(!u.circle[y]){u.circle[y]=!0;let g=y*3,_=this.circleKeys[y];if(this._circleAndRectCollide(f[g],f[g+1],f[g+2],e,t,n,i)&&(!l||l(_))&&(!c||!_c(p,_.overlapMode))){let x=f[g],b=f[g+1],v=f[g+2];if(a.push({key:_,x1:x-v,y1:b-v,x2:x+v,y2:b+v}),c)return!0}}}return!1}_queryCellCircle(e,t,n,i,o,a,s,l){let{circle:u,seenUids:c,overlapMode:p}=s,h=this.boxCells[o];if(h!==null){let f=this.bboxes;for(let y of h)if(!c.box[y]){c.box[y]=!0;let g=y*4,_=this.boxKeys[y];if(this._circleAndRectCollide(u.x,u.y,u.radius,f[g+0],f[g+1],f[g+2],f[g+3])&&(!l||l(_))&&!_c(p,_.overlapMode))return a.push(!0),!0}}let m=this.circleCells[o];if(m!==null){let f=this.circles;for(let y of m)if(!c.circle[y]){c.circle[y]=!0;let g=y*3,_=this.circleKeys[y];if(this._circlesCollide(f[g],f[g+1],f[g+2],u.x,u.y,u.radius)&&(!l||l(_))&&!_c(p,_.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,n,i,o,a,s,l){let u=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),p=this._convertToXCellCoord(n),h=this._convertToYCellCoord(i);for(let m=u;m<=p;m++)for(let f=c;f<=h;f++){let y=this.xCellCount*f+m;if(o.call(this,e,t,n,i,y,a,s,l))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,n,i,o,a){let s=i-e,l=o-t,u=n+a;return u*u>s*s+l*l}_circleAndRectCollide(e,t,n,i,o,a,s){let l=(a-i)/2,u=Math.abs(e-(i+l));if(u>l+n)return!1;let c=(s-o)/2,p=Math.abs(t-(o+c));if(p>c+n)return!1;if(u<=l||p<=c)return!0;let h=u-l,m=p-c;return h*h+m*m<=n*n}};d();var uo=ie(le(),1);function fs(r,e,t){let n=F.create();if(!r){let{vecSouth:i,vecEast:o}=vc(e),a=Qr.create();a[0]=o[0],a[1]=o[1],a[2]=i[0],a[3]=i[1],Qr.invert(a,a),n[0]=a[0],n[1]=a[1],n[4]=a[2],n[5]=a[3]}return F.scale(n,n,[1/t,1/t,1]),n}function Rb(r,e,t,n){if(r){let i=F.create();if(!e){let{vecSouth:o,vecEast:a}=vc(t);i[0]=a[0],i[1]=a[1],i[4]=o[0],i[5]=o[1]}return F.scale(i,i,[n,n,1]),i}else return t.pixelsToClipSpaceMatrix}function vc(r){let e=Math.cos(r.rollInRadians),t=Math.sin(r.rollInRadians),n=Math.cos(r.pitchInRadians),i=Math.cos(r.bearingInRadians),o=Math.sin(r.bearingInRadians),a=it.create();a[0]=-i*n*t-o*e,a[1]=-o*n*t+i*e;let s=it.length(a);s<1e-9?it.zero(a):it.scale(a,a,1/s);let l=it.create();l[0]=i*n*e-o*t,l[1]=o*n*e+i*t;let u=it.length(l);return u<1e-9?it.zero(l):it.scale(l,l,1/u),{vecEast:l,vecSouth:a}}function wc(r,e,t,n){let i;n?(i=[r,e,n(r,e),1],De.transformMat4(i,i,t)):(i=[r,e,0,1],ds(i,i,t));let o=i[3];return{point:new uo.default(i[0]/o,i[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function hf(r,e){return .5+.5*(r/e)}function WE(r,e){return r.x>=-e[0]&&r.x<=e[0]&&r.y>=-e[1]&&r.y<=e[1]}function Fb(r,e,t,n,i,o,a,s,l,u,c,p,h){let m=t?r.textSizeData:r.iconSizeData,f=ui(m,e.transform.zoom),y=[256/e.width*2+1,256/e.height*2+1],g=t?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;g.clear();let _=r.lineVertexArray,x=t?r.text.placedSymbolArray:r.icon.placedSymbolArray,b=e.transform.width/e.transform.height,v=!1;for(let P=0;P<x.length;P++){let S=x.get(P);if(S.hidden||S.writingMode===2&&!v){fi(S.numGlyphs,g);continue}v=!1;let T=new uo.default(S.anchorX,S.anchorY),A={getElevation:h,pitchedLabelPlaneMatrix:n,lineVertexArray:_,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:T,unwrappedTileID:l,width:u,height:c,translation:p},E=ff(S.anchorX,S.anchorY,A);if(!WE(E.point,y)){fi(S.numGlyphs,g);continue}let k=E.signedDistanceFromCamera,R=hf(e.transform.cameraToCenterDistance,k),V=to(m,f,S),M=o?V*e.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,l)/R:V*R,L=kb({projectionContext:A,pitchedLabelPlaneMatrixInverse:i,symbol:S,fontSize:M,flip:!1,keepUpright:a,glyphOffsetArray:r.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:b,rotateToLine:s});v=L.useVertical,(L.notEnoughRoom||v||L.needsFlipping&&kb({projectionContext:A,pitchedLabelPlaneMatrixInverse:i,symbol:S,fontSize:M,flip:!0,keepUpright:a,glyphOffsetArray:r.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:b,rotateToLine:s}).notEnoughRoom)&&fi(S.numGlyphs,g)}t?r.text.dynamicLayoutVertexBuffer.updateData(g):r.icon.dynamicLayoutVertexBuffer.updateData(g)}function mf(r,e,t,n,i,o,a,s){let l=o.glyphStartIndex+o.numGlyphs,u=o.lineStartIndex,c=o.lineStartIndex+o.lineLength,p=e.getoffsetX(o.glyphStartIndex),h=e.getoffsetX(l-1),m=bc(r*p,t,n,i,o.segment,u,c,s,a);if(!m)return null;let f=bc(r*h,t,n,i,o.segment,u,c,s,a);return!f||s.projectionCache.anyProjectionOccluded?null:{first:m,last:f}}function Db(r,e,t,n){if(r===1){let i=Math.abs(t.y-e.y),o=Math.abs(t.x-e.x)*n;if(i>o)return{useVertical:!0}}return(r===2?e.y<t.y:e.x>t.x)?{needsFlipping:!0}:null}function kb(r){let{projectionContext:e,pitchedLabelPlaneMatrixInverse:t,symbol:n,fontSize:i,flip:o,keepUpright:a,glyphOffsetArray:s,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:c}=r,p=i/24,h=n.lineOffsetX*p,m=n.lineOffsetY*p,f;if(n.numGlyphs>1){let y=n.glyphStartIndex+n.numGlyphs,g=n.lineStartIndex,_=n.lineStartIndex+n.lineLength,x=mf(p,s,h,m,o,n,c,e);if(!x)return{notEnoughRoom:!0};let b=xc(x.first.point.x,x.first.point.y,e,t),v=xc(x.last.point.x,x.last.point.y,e,t);if(a&&!o){let P=Db(n.writingMode,b,v,u);if(P)return P}f=[x.first];for(let P=n.glyphStartIndex+1;P<y-1;P++){let S=bc(p*s.getoffsetX(P),h,m,o,n.segment,g,_,e,c);if(!S)return{notEnoughRoom:!0};f.push(S)}f.push(x.last)}else{if(a&&!o){let g=In(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,_=n.lineStartIndex+n.segment+1,x=new uo.default(e.lineVertexArray.getx(_),e.lineVertexArray.gety(_)),b=In(x.x,x.y,e),v=b.signedDistanceFromCamera>0?b.point:zb(e.tileAnchorPoint,x,g,1,e),P=xc(g.x,g.y,e,t),S=xc(v.x,v.y,e,t),T=Db(n.writingMode,P,S,u);if(T)return T}let y=bc(p*s.getoffsetX(n.glyphStartIndex),h,m,o,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,e,c);if(!y||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[y]}for(let y of f)ci(l,y.point,y.angle);return{}}function zb(r,e,t,n,i){let o=r.add(r.sub(e)._unit()),a=In(o.x,o.y,i).point,s=t.sub(a);return t.add(s._mult(n/s.mag()))}function cf(r,e,t){let n=e.projectionCache;if(n.projections[r])return n.projections[r];let i=new uo.default(e.lineVertexArray.getx(r),e.lineVertexArray.gety(r)),o=In(i.x,i.y,e);if(o.signedDistanceFromCamera>0)return n.projections[r]=o.point,n.anyProjectionOccluded=n.anyProjectionOccluded||o.isOccluded,o.point;let a=r-t.direction,s=t.distanceFromAnchor===0?e.tileAnchorPoint:new uo.default(e.lineVertexArray.getx(a),e.lineVertexArray.gety(a)),l=t.absOffsetX-t.distanceFromAnchor+1;return zb(s,i,t.previousVertex,l,e)}function In(r,e,t){let n=r+t.translation[0],i=e+t.translation[1],o;return t.pitchWithMap?(o=wc(n,i,t.pitchedLabelPlaneMatrix,t.getElevation),o.isOccluded=!1):(o=t.transform.projectTileCoordinates(n,i,t.unwrappedTileID,t.getElevation),o.point.x=(o.point.x*.5+.5)*t.width,o.point.y=(-o.point.y*.5+.5)*t.height),o}function xc(r,e,t,n){if(t.pitchWithMap){let i=[r,e,0,1];return De.transformMat4(i,i,n),t.transform.projectTileCoordinates(i[0]/i[3],i[1]/i[3],t.unwrappedTileID,t.getElevation).point}else return{x:r/t.width*2-1,y:e/t.height*2-1}}function ff(r,e,t){return t.transform.projectTileCoordinates(r,e,t.unwrappedTileID,t.getElevation)}function pf(r,e,t){return r._unit()._perp()._mult(e*t)}function XE(r,e,t,n,i,o,a,s,l){if(s.projectionCache.offsets[r])return s.projectionCache.offsets[r];let u=t.add(e);if(r+l.direction<n||r+l.direction>=i)return s.projectionCache.offsets[r]=u,u;let c=cf(r+l.direction,s,l),p=pf(c.sub(t),a,l.direction),h=t.add(p),m=c.add(p);return s.projectionCache.offsets[r]=by(o,u,h,m)||u,s.projectionCache.offsets[r]}function bc(r,e,t,n,i,o,a,s,l){let u=n?r-e:r+e,c=u>0?1:-1,p=0;n&&(c*=-1,p=Math.PI),c<0&&(p+=Math.PI);let h=c>0?o+i:o+i+1,m;s.projectionCache.cachedAnchorPoint?m=s.projectionCache.cachedAnchorPoint:(m=In(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=m);let f=m,y=m,g,_,x=0,b=0,v=Math.abs(u),P=[],S;for(;x+b<=v;){if(h+=c,h<o||h>=a)return null;x+=b,y=f,_=g;let E={absOffsetX:v,direction:c,distanceFromAnchor:x,previousVertex:y};if(f=cf(h,s,E),t===0)P.push(y),S=f.sub(y);else{let k,R=f.sub(y);if(R.mag()===0){let V=cf(h+c,s,E);k=pf(V.sub(f),t,c)}else k=pf(R,t,c);_||(_=y.add(k)),g=XE(h,k,f,o,a,_,t,s,E),P.push(_),S=g.sub(_)}b=S.mag()}let T=(v-x)/b,C=S._mult(T)._add(_||y),A=p+Math.atan2(f.y-y.y,f.x-y.x);return P.push(C),{point:C,angle:l?A:0,path:P}}var YE=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function fi(r,e){for(let t=0;t<r;t++){let n=e.length;e.resize(n+4),e.float32.set(YE,n*3)}}function ds(r,e,t){let n=e[0],i=e[1];return r[0]=t[0]*n+t[4]*i+t[12],r[1]=t[1]*n+t[5]*i+t[13],r[3]=t[3]*n+t[7]*i+t[15],r}function Bb(r,e){let t=F.create();return F.invert(t,e.pitchedLabelPlaneMatrix),r.map(n=>{let i=wc(n.x,n.y,t,e.getElevation),o=e.transform.projectTileCoordinates(i.point.x,i.point.y,e.unwrappedTileID,e.getElevation);return o.point.x=(o.point.x*.5+.5)*e.width,o.point.y=(-o.point.y*.5+.5)*e.height,o})}function Ob(r){let e=0,t=0,n=0,i=0;for(let o=0;o<r.length;o++)r[o].isOccluded?(n=o+1,i=0):(i++,i>t&&(t=i,e=n));return r.slice(e,e+t)}var Fe=100,Pc=class{constructor(e,t=new ms(e.width+2*Fe,e.height+2*Fe,25),n=new ms(e.width+2*Fe,e.height+2*Fe,25)){this.transform=e,this.grid=t,this.ignoredGrid=n,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Fe,this.screenBottomBoundary=e.height+Fe,this.gridRightBoundary=e.width+2*Fe,this.gridBottomBoundary=e.height+2*Fe,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,i,o,a,s,l,u,c,p,h){let m=e.anchorPointX+l[0],f=e.anchorPointY+l[1],y=this.projectAndGetPerspectiveRatio(m,f,o,c,h),g=n*y.perspectiveRatio,_;if(!a&&!s){let C=y.x+(p?p.x*g:0),A=y.y+(p?p.y*g:0);_={allPointsOccluded:!1,box:[C+e.x1*g,A+e.y1*g,C+e.x2*g,A+e.y2*g]}}else _=this._projectCollisionBox(e,g,i,o,a,s,l,y,c,p,h);let[x,b,v,P]=_.box,S=a?_.allPointsOccluded:y.isOccluded,T=S;return T||(T=y.perspectiveRatio<this.perspectiveRatioCutoff),T||(T=!this.isInsideGrid(x,b,v,P)),T||t!=="always"&&this.grid.hitTest(x,b,v,P,t,u)?{box:[x,b,v,P],placeable:!1,offscreen:!1,occluded:S}:{box:[x,b,v,P],placeable:!0,offscreen:this.isOffscreen(x,b,v,P),occluded:S}}placeCollisionCircles(e,t,n,i,o,a,s,l,u,c,p,h,m,f){let y=[],g=new fr.default(t.anchorX,t.anchorY),_=this.getPerspectiveRatio(g.x,g.y,a,f),b=(u?o*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,a)/_:o*_)/vn,v={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},P=t.lineOffsetX*b,S=t.lineOffsetY*b,T={getElevation:f,pitchedLabelPlaneMatrix:s,lineVertexArray:n,pitchWithMap:u,projectionCache:v,transform:this.transform,tileAnchorPoint:g,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:m},C=mf(b,i,P,S,!1,t,!1,T),A=!1,E=!1,k=!0;if(C){let R=p*.5*_+h,V=new fr.default(-Fe,-Fe),M=new fr.default(this.screenRightBoundary,this.screenBottomBoundary),L=new gc,$=C.first,q=C.last,Y=[];for(let _e=$.path.length-1;_e>=1;_e--)Y.push($.path[_e]);for(let _e=1;_e<q.path.length;_e++)Y.push(q.path[_e]);let he=R*2.5;if(u){let _e=this.projectPathToScreenSpace(Y,T);_e.some(de=>de.signedDistanceFromCamera<=0)?Y=[]:Y=_e.map(de=>de.point)}let Oe=[];if(Y.length>0){let _e=Y[0].clone(),de=Y[0].clone();for(let He=1;He<Y.length;He++)_e.x=Math.min(_e.x,Y[He].x),_e.y=Math.min(_e.y,Y[He].y),de.x=Math.max(de.x,Y[He].x),de.y=Math.max(de.y,Y[He].y);_e.x>=V.x&&de.x<=M.x&&_e.y>=V.y&&de.y<=M.y?Oe=[Y]:de.x<V.x||_e.x>M.x||de.y<V.y||_e.y>M.y?Oe=[]:Oe=uf([Y],V.x,V.y,M.x,M.y)}for(let _e of Oe){L.reset(_e,R*.25);let de=0;L.length<=.5*R?de=1:de=Math.ceil(L.paddedLength/he)+1;for(let He=0;He<de;He++){let st=He/Math.max(de-1,1),xt=L.lerp(st),ut=xt.x+Fe,qt=xt.y+Fe;y.push(ut,qt,R,0);let yr=ut-R,Jr=qt-R,ir=ut+R,gr=qt+R;if(k=k&&this.isOffscreen(yr,Jr,ir,gr),E=E||this.isInsideGrid(yr,Jr,ir,gr),e!=="always"&&this.grid.hitTestCircle(ut,qt,R,e,c)&&(A=!0,!l))return{circles:[],offscreen:!1,collisionDetected:A}}}}return{circles:!l&&A||!E||_<this.perspectiveRatioCutoff?[]:y,offscreen:k,collisionDetected:A}}projectPathToScreenSpace(e,t){let n=Bb(e,t);return Ob(n)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],n=new at;for(let p of e){let h=new fr.default(p.x+Fe,p.y+Fe);n.extend(h),t.push(h)}let{minX:i,minY:o,maxX:a,maxY:s}=n,l=this.grid.query(i,o,a,s).concat(this.ignoredGrid.query(i,o,a,s)),u={},c={};for(let p of l){let h=p.key;if(u[h.bucketInstanceId]===void 0&&(u[h.bucketInstanceId]={}),u[h.bucketInstanceId][h.featureIndex])continue;let m=[new fr.default(p.x1,p.y1),new fr.default(p.x2,p.y1),new fr.default(p.x2,p.y2),new fr.default(p.x1,p.y2)];Pu(t,m)&&(u[h.bucketInstanceId][h.featureIndex]=!0,c[h.bucketInstanceId]===void 0&&(c[h.bucketInstanceId]=[]),c[h.bucketInstanceId].push(h.featureIndex))}return c}insertCollisionBox(e,t,n,i,o,a){let s=n?this.ignoredGrid:this.grid,l={bucketInstanceId:i,featureIndex:o,collisionGroupID:a,overlapMode:t};s.insert(l,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,i,o,a){let s=n?this.ignoredGrid:this.grid,l={bucketInstanceId:i,featureIndex:o,collisionGroupID:a,overlapMode:t};for(let u=0;u<e.length;u+=4)s.insertCircle(l,e[u],e[u+1],e[u+2])}projectAndGetPerspectiveRatio(e,t,n,i,o){if(o){let a;i?(a=[e,t,i(e,t),1],De.transformMat4(a,a,o)):(a=[e,t,0,1],ds(a,a,o));let s=a[3];return{x:(a[0]/s+1)/2*this.transform.width+Fe,y:(-a[1]/s+1)/2*this.transform.height+Fe,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/s),isOccluded:!1,signedDistanceFromCamera:s}}else{let a=this.transform.projectTileCoordinates(e,t,n,i);return{x:(a.point.x+1)/2*this.transform.width+Fe,y:(-a.point.y+1)/2*this.transform.height+Fe,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera),isOccluded:a.isOccluded,signedDistanceFromCamera:a.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,n,i){let o=this.transform.projectTileCoordinates(e,t,n,i);return .5+.5*(this.transform.cameraToCenterDistance/o.signedDistanceFromCamera)}isOffscreen(e,t,n,i){return n<Fe||e>=this.screenRightBoundary||i<Fe||t>this.screenBottomBoundary}isInsideGrid(e,t,n,i){return n>=0&&e<this.gridRightBoundary&&i>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=F.identity([]);return F.translate(e,e,[-Fe,-Fe,0]),e}_projectCollisionBox(e,t,n,i,o,a,s,l,u,c,p){let h=1,m=0,f=0,y=1,g=e.anchorPointX+s[0],_=e.anchorPointY+s[1];if(a&&!o){let M=this.projectAndGetPerspectiveRatio(g+1,_,i,u,p),L=M.x-l.x,$=M.y-l.y,q=Math.atan($/L)+(L<0?Math.PI:0),Y=Math.sin(q),he=Math.cos(q);h=he,m=Y,f=-Y,y=he}else if(!a&&o){let M=vc(this.transform);h=M.vecEast[0],m=M.vecEast[1],f=M.vecSouth[0],y=M.vecSouth[1]}let x=l.x,b=l.y,v=t;if(o){x=g,b=_;let M=this.transform.zoom-n.overscaledZ;if(v=Math.pow(2,-M),v*=this.transform.getPitchedTextCorrection(g,_,i),!c){let L=l.signedDistanceFromCamera/this.transform.cameraToCenterDistance,$=ae(.5+.5*L,0,4);v*=$}}c&&(x+=h*c.x*v+f*c.y*v,b+=m*c.x*v+y*c.y*v);let P=e.x1*v,S=e.x2*v,T=(P+S)/2,C=e.y1*v,A=e.y2*v,E=(C+A)/2,k=[{offsetX:P,offsetY:C},{offsetX:T,offsetY:C},{offsetX:S,offsetY:C},{offsetX:S,offsetY:E},{offsetX:S,offsetY:A},{offsetX:T,offsetY:A},{offsetX:P,offsetY:A},{offsetX:P,offsetY:E}],R=[];for(let{offsetX:M,offsetY:L}of k)R.push(new fr.default(x+h*M+f*L,b+m*M+y*L));let V=!1;if(o){let M=R.map(L=>this.projectAndGetPerspectiveRatio(L.x,L.y,i,u,p));V=M.some(L=>!L.isOccluded),R=M.map(L=>new fr.default(L.x,L.y))}else V=!0;return{box:yy(R),allPointsOccluded:!V}}};d();d();var Vb=ie(le(),1);var ys=class r extends Vb.default{constructor(e,t,n,i){super(e,t),this.angle=n,i!==void 0&&(this.segment=i)}clone(){return new r(this.x,this.y,this.angle,this.segment)}};G("Anchor",ys);d();d();d();var QE=ie(le(),1);d();var eL=ie(le(),1);d();d();var tL=ie(le(),1);var nL=ie(Im(),1);d();var gs=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(gs||{});var rL=Number.POSITIVE_INFINITY;function Ub(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}var gf=ie(le(),1);var Sc=class{constructor(e,t,n,i){e?this.opacity=Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):this.opacity=i&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}},di=class{constructor(e,t,n,i,o){this.text=new Sc(e?e.text:null,t,n,o),this.icon=new Sc(e?e.icon:null,t,i,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},Tc=class{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}},df=class{constructor(e,t,n,i,o){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=i,this.tileID=o}},yf=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:n=>n.collisionGroupID===t}}return this.collisionGroups[e]}};function jb(r,e,t,n,i){let{horizontalAlign:o,verticalAlign:a}=Zu(r),s=-(o-.5)*e,l=-(a-.5)*t;return new gf.default(s+n[0]*i,l+n[1]*i)}var Mc=class{constructor(e,t,n,i,o){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new Pc(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new yf(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(n,i)=>t.getElevation(e,n,i):null}getBucketParts(e,t,n,i){let o=n.getBucket(t),a=n.latestFeatureIndex;if(!o||!a||t.id!==o.layerIds[0])return;let s=n.collisionBoxArray,l=o.layers[0].layout,u=o.layers[0].paint,c=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),p=n.tileSize/8192,h=n.tileID.toUnwrapped(),m=l.get("text-rotation-alignment")==="map",f=et(n,1,this.transform.zoom),y=Tt(this.collisionIndex.transform,n,u.get("text-translate"),u.get("text-translate-anchor")),g=Tt(this.collisionIndex.transform,n,u.get("icon-translate"),u.get("icon-translate-anchor")),_=fs(m,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new df(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID);let x={bucket:o,layout:l,translationText:y,translationIcon:g,unwrappedTileID:h,pitchedLabelPlaneMatrix:_,scale:c,textPixelRatio:p,holdingForFade:n.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:ui(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(i)for(let b of o.sortKeyRanges){let{sortKey:v,symbolInstanceStart:P,symbolInstanceEnd:S}=b;e.push({sortKey:v,symbolInstanceStart:P,symbolInstanceEnd:S,parameters:x})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:x})}attemptAnchorPlacement(e,t,n,i,o,a,s,l,u,c,p,h,m,f,y,g,_,x,b,v){let P=gs[e.textAnchor],S=[e.textOffset0,e.textOffset1],T=jb(P,n,i,S,o),C=this.collisionIndex.placeCollisionBox(t,h,l,u,c,s,a,g,p.predicate,b,T,v);if(!(x&&!this.collisionIndex.placeCollisionBox(x,h,l,u,c,s,a,_,p.predicate,b,T,v).placeable)&&C.placeable){let A;if(this.prevPlacement&&this.prevPlacement.variableOffsets[m.crossTileID]&&this.prevPlacement.placements[m.crossTileID]&&this.prevPlacement.placements[m.crossTileID].text&&(A=this.prevPlacement.variableOffsets[m.crossTileID].anchor),m.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[m.crossTileID]={textOffset:S,width:n,height:i,anchor:P,textBoxScale:o,prevAnchor:A},this.markUsedJustification(f,P,m,y),f.allowVerticalPlacement&&(this.markUsedOrientation(f,y,m),this.placedOrientations[m.crossTileID]=y),{shift:T,placedGlyphBoxes:C}}}placeLayerBucketPart(e,t,n){let{bucket:i,layout:o,translationText:a,translationIcon:s,unwrappedTileID:l,pitchedLabelPlaneMatrix:u,textPixelRatio:c,holdingForFade:p,collisionBoxArray:h,partiallyEvaluatedTextSize:m,collisionGroup:f}=e.parameters,y=o.get("text-optional"),g=o.get("icon-optional"),_=ro(o,"text-overlap","text-allow-overlap"),x=_==="always",b=ro(o,"icon-overlap","icon-allow-overlap"),v=b==="always",P=o.get("text-rotation-alignment")==="map",S=o.get("text-pitch-alignment")==="map",T=o.get("icon-text-fit")!=="none",C=o.get("symbol-z-order")==="viewport-y",A=x&&(v||!i.hasIconData()||g),E=v&&(x||!i.hasTextData()||y);!i.collisionArrays&&h&&i.deserializeCollisionBoxes(h);let k=this.retainedQueryData[i.bucketInstanceId].tileID,R=this._getTerrainElevationFunc(k),V=this.transform.getFastPathSimpleProjectionMatrix(k),M=(L,$,q)=>{if(t[L.crossTileID])return;if(p){this.placements[L.crossTileID]=new Tc(!1,!1,!1);return}let Y=!1,he=!1,Oe=!0,_e=null,de={box:null,placeable:!1,offscreen:null,occluded:!1},He={box:null,placeable:!1,offscreen:null},st=null,xt=null,ut=null,qt=0,yr=0,Jr=0;$.textFeatureIndex?qt=$.textFeatureIndex:L.useRuntimeCollisionCircles&&(qt=L.featureIndex),$.verticalTextFeatureIndex&&(yr=$.verticalTextFeatureIndex);let ir=$.textBox;if(ir){let Dr=mt=>{let ct=1;if(i.allowVerticalPlacement&&!mt&&this.prevPlacement){let Wt=this.prevPlacement.placedOrientations[L.crossTileID];Wt&&(this.placedOrientations[L.crossTileID]=Wt,ct=Wt,this.markUsedOrientation(i,ct,L))}return ct},_r=(mt,ct)=>{if(i.allowVerticalPlacement&&L.numVerticalGlyphVertices>0&&$.verticalTextBox){for(let Wt of i.writingModes)if(Wt===2?(de=ct(),He=de):de=mt(),de&&de.placeable)break}else de=mt()},vi=L.textAnchorOffsetStartIndex,kr=L.textAnchorOffsetEndIndex;if(kr===vi){let mt=(Fn,wi)=>{let ft=this.collisionIndex.placeCollisionBox(Fn,_,c,k,l,S,P,a,f.predicate,R,void 0,V);return ft&&ft.placeable&&(this.markUsedOrientation(i,wi,L),this.placedOrientations[L.crossTileID]=wi),ft};_r(()=>mt(ir,1),()=>{let Fn=$.verticalTextBox;return i.allowVerticalPlacement&&L.numVerticalGlyphVertices>0&&Fn?mt(Fn,2):{box:null,offscreen:null}}),Dr(de&&de.placeable)}else{let mt=gs[this.prevPlacement?.variableOffsets[L.crossTileID]?.anchor],ct=(ft,ph,Cw)=>{let Aw=ft.x2-ft.x1,Iw=ft.y2-ft.y1,Ew=L.textBoxScale,Lw=T&&b==="never"?ph:null,zn=null,gd=_==="never"?1:2,_d="never";mt&&gd++;for(let hh=0;hh<gd;hh++){for(let mh=vi;mh<kr;mh++){let xd=i.textAnchorOffsets.get(mh);if(mt&&xd.textAnchor!==mt)continue;let fh=this.attemptAnchorPlacement(xd,ft,Aw,Iw,Ew,P,S,c,k,l,f,_d,L,i,Cw,a,s,Lw,R);if(fh&&(zn=fh.placedGlyphBoxes,zn&&zn.placeable))return Y=!0,_e=fh.shift,zn}mt?mt=null:_d=_}return n&&!zn&&(zn={box:this.collisionIndex.placeCollisionBox(ir,"always",c,k,l,S,P,a,f.predicate,R,void 0,V).box,offscreen:!1,placeable:!1,occluded:!1}),zn};_r(()=>ct(ir,$.iconBox,1),()=>{let ft=$.verticalTextBox,ph=de&&de.placeable;return i.allowVerticalPlacement&&!ph&&L.numVerticalGlyphVertices>0&&ft?ct(ft,$.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),de&&(Y=de.placeable,Oe=de.offscreen);let wi=Dr(de&&de.placeable);if(!Y&&this.prevPlacement){let ft=this.prevPlacement.variableOffsets[L.crossTileID];ft&&(this.variableOffsets[L.crossTileID]=ft,this.markUsedJustification(i,ft.anchor,L,wi))}}}if(st=de,Y=st&&st.placeable,Oe=st&&st.offscreen,L.useRuntimeCollisionCircles){let Dr=i.text.placedSymbolArray.get(L.centerJustifiedTextSymbolIndex),_r=to(i.textSizeData,m,Dr),vi=o.get("text-padding"),kr=L.collisionCircleDiameter;xt=this.collisionIndex.placeCollisionCircles(_,Dr,i.lineVertexArray,i.glyphOffsetArray,_r,l,u,n,S,f.predicate,kr,vi,a,R),xt.circles.length&&xt.collisionDetected&&!n&&ue("Collisions detected, but collision boxes are not shown"),Y=x||xt.circles.length>0&&!xt.collisionDetected,Oe=Oe&&xt.offscreen}if($.iconFeatureIndex&&(Jr=$.iconFeatureIndex),$.iconBox){let Dr=_r=>this.collisionIndex.placeCollisionBox(_r,b,c,k,l,S,P,s,f.predicate,R,T&&_e?_e:void 0,V);He&&He.placeable&&$.verticalIconBox?(ut=Dr($.verticalIconBox),he=ut.placeable):(ut=Dr($.iconBox),he=ut.placeable),Oe=Oe&&ut.offscreen}let gr=y||L.numHorizontalGlyphVertices===0&&L.numVerticalGlyphVertices===0,el=g||L.numIconVertices===0;!gr&&!el?he=Y=he&&Y:el?gr||(he=he&&Y):Y=he&&Y;let lh=Y&&st.placeable,uh=he&&ut.placeable;if(lh&&(He&&He.placeable&&yr?this.collisionIndex.insertCollisionBox(st.box,_,o.get("text-ignore-placement"),i.bucketInstanceId,yr,f.ID):this.collisionIndex.insertCollisionBox(st.box,_,o.get("text-ignore-placement"),i.bucketInstanceId,qt,f.ID)),uh&&this.collisionIndex.insertCollisionBox(ut.box,b,o.get("icon-ignore-placement"),i.bucketInstanceId,Jr,f.ID),xt&&Y&&this.collisionIndex.insertCollisionCircles(xt.circles,_,o.get("text-ignore-placement"),i.bucketInstanceId,qt,f.ID),n&&this.storeCollisionData(i.bucketInstanceId,q,$,st,ut,xt),L.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(i.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");let bi=(Y||A)&&!st?.occluded,ch=(he||E)&&!ut?.occluded;this.placements[L.crossTileID]=new Tc(bi,ch,Oe||i.justReloaded),t[L.crossTileID]=!0};if(C){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let L=i.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let $=L.length-1;$>=0;--$){let q=L[$];M(i.symbolInstances.get(q),i.collisionArrays[q],q)}}else for(let L=e.symbolInstanceStart;L<e.symbolInstanceEnd;L++)M(i.symbolInstances.get(L),i.collisionArrays[L],L);i.justReloaded=!1}storeCollisionData(e,t,n,i,o,a){if(n.textBox||n.iconBox){let s;this.collisionBoxArrays.has(e)?s=this.collisionBoxArrays.get(e):(s=new Map,this.collisionBoxArrays.set(e,s));let l;s.has(t)?l=s.get(t):(l={text:null,icon:null},s.set(t,l)),n.textBox&&(l.text=i.box),n.iconBox&&(l.icon=o.box)}if(a){let s=this.collisionCircleArrays[e];s===void 0&&(s=this.collisionCircleArrays[e]=[]);for(let l=0;l<a.circles.length;l+=4)s.push(a.circles[l+0]-Fe),s.push(a.circles[l+1]-Fe),s.push(a.circles[l+2]),s.push(a.collisionDetected?1:0)}}markUsedJustification(e,t,n,i){let o={left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex},a;i===2?a=n.verticalPlacedTextSymbolIndex:a=o[Ub(t)];let s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(let l of s)l>=0&&(a>=0&&l!==a?e.text.placedSymbolArray.get(l).crossTileID=0:e.text.placedSymbolArray.get(l).crossTileID=n.crossTileID)}markUsedOrientation(e,t,n){let i=t===1||t===3?t:0,o=t===2?t:0,a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(let s of a)e.text.placedSymbolArray.get(s).placedOrientation=i;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let i=t?t.symbolFadeChange(e):1,o=t?t.opacities:{},a=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let l in this.placements){let u=this.placements[l],c=o[l];c?(this.opacities[l]=new di(c,i,u.text,u.icon),n=n||u.text!==c.text.placed||u.icon!==c.icon.placed):(this.opacities[l]=new di(null,i,u.text,u.icon,u.skipFade),n=n||u.text||u.icon)}for(let l in o){let u=o[l];if(!this.opacities[l]){let c=new di(u,i,!1,!1);c.isHidden()||(this.opacities[l]=c,n=n||u.text.placed||u.icon.placed)}}for(let l in a)!this.variableOffsets[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.variableOffsets[l]=a[l]);for(let l in s)!this.placedOrientations[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.placedOrientations[l]=s[l]);if(t&&t.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let n={};for(let i of t){let o=i.getBucket(e);o&&i.latestFeatureIndex&&e.id===o.layerIds[0]&&this.updateBucketOpacities(o,i.tileID,n,i.collisionBoxArray)}}updateBucketOpacities(e,t,n,i){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 o=e.layers[0],a=o.layout,s=new di(null,0,!1,!1,!0),l=a.get("text-allow-overlap"),u=a.get("icon-allow-overlap"),c=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),p=a.get("text-rotation-alignment")==="map",h=a.get("text-pitch-alignment")==="map",m=a.get("icon-text-fit")!=="none",f=new di(null,0,l&&(u||!e.hasIconData()||a.get("icon-optional")),u&&(l||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let y=(_,x,b)=>{for(let v=0;v<x/4;v++)_.opacityVertexArray.emplaceBack(b);_.hasVisibleVertices=_.hasVisibleVertices||b!==_s},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let _=0;_<e.symbolInstances.length;_++){let x=e.symbolInstances.get(_),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:v,crossTileID:P}=x,S=n[P],T=this.opacities[P];S?T=s:T||(T=f,this.opacities[P]=T),n[P]=!0;let C=b>0||v>0,A=x.numIconVertices>0,E=this.placedOrientations[x.crossTileID],k=E===2,R=E===1||E===3;if(C){let M=Gb(T.text),L=k?_s:M;y(e.text,b,L);let $=R?_s:M;y(e.text,v,$);let q=T.text.isHidden();[x.rightJustifiedTextSymbolIndex,x.centerJustifiedTextSymbolIndex,x.leftJustifiedTextSymbolIndex].forEach(Oe=>{Oe>=0&&(e.text.placedSymbolArray.get(Oe).hidden=q||k?1:0)}),x.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(x.verticalPlacedTextSymbolIndex).hidden=q||R?1:0);let Y=this.variableOffsets[x.crossTileID];Y&&this.markUsedJustification(e,Y.anchor,x,E);let he=this.placedOrientations[x.crossTileID];he&&(this.markUsedJustification(e,"left",x,he),this.markUsedOrientation(e,he,x))}if(A){let M=Gb(T.icon),L=!(m&&x.verticalPlacedIconSymbolIndex&&k);if(x.placedIconSymbolIndex>=0){let $=L?M:_s;y(e.icon,x.numIconVertices,$),e.icon.placedSymbolArray.get(x.placedIconSymbolIndex).hidden=T.icon.isHidden()}if(x.verticalPlacedIconSymbolIndex>=0){let $=L?_s:M;y(e.icon,x.numVerticalIconVertices,$),e.icon.placedSymbolArray.get(x.verticalPlacedIconSymbolIndex).hidden=T.icon.isHidden()}}let V=g&&g.has(_)?g.get(_):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let M=e.collisionArrays[_];if(M){let L=new gf.default(0,0);if(M.textBox||M.verticalTextBox){let $=!0;if(c){let q=this.variableOffsets[P];q?(L=jb(q.anchor,q.width,q.height,q.textOffset,q.textBoxScale),p&&L._rotate(h?-this.transform.bearingInRadians:this.transform.bearingInRadians)):$=!1}if(M.textBox||M.verticalTextBox){let q;M.textBox&&(q=k),M.verticalTextBox&&(q=R),Nb(e.textCollisionBox.collisionVertexArray,T.text.placed,!$||q,V.text,L.x,L.y)}}if(M.iconBox||M.verticalIconBox){let $=!!(!R&&M.verticalIconBox),q;M.iconBox&&(q=$),M.verticalIconBox&&(q=!$),Nb(e.iconCollisionBox.collisionVertexArray,T.icon.placed,q,V.icon,m?L.x:0,m?L.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),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`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?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 n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}};function Nb(r,e,t,n,i,o){(!n||n.length===0)&&(n=[0,0,0,0]);let a=n[0]-Fe,s=n[1]-Fe,l=n[2]-Fe,u=n[3]-Fe;r.emplaceBack(e?1:0,t?1:0,i||0,o||0,a,s),r.emplaceBack(e?1:0,t?1:0,i||0,o||0,l,s),r.emplaceBack(e?1:0,t?1:0,i||0,o||0,l,u),r.emplaceBack(e?1:0,t?1:0,i||0,o||0,a,u)}var iL=Math.pow(2,25),oL=Math.pow(2,24),aL=Math.pow(2,17),sL=Math.pow(2,16),lL=Math.pow(2,9),uL=Math.pow(2,8),cL=Math.pow(2,1);function Gb(r){if(r.opacity===0&&!r.placed)return 0;if(r.opacity===1&&r.placed)return 4294967295;let e=r.placed?1:0,t=Math.floor(r.opacity*127);return t*iL+e*oL+t*aL+e*sL+t*lL+e*uL+t*cL+e}var _s=0;var _f=class{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,i,o){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let s=e[this._currentTileIndex];if(t.getBucketParts(a,i,s,this._sortAcrossTiles),this._currentTileIndex++,o())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((s,l)=>s.sortKey-l.sortKey));this._currentPartIndex<a.length;){let s=a[this._currentPartIndex];if(t.placeLayerBucketPart(s,this._seenCrossTileIDs,n),this._currentPartIndex++,o())return!0}return!1}},Cc=class{constructor(e,t,n,i,o,a,s,l){this.placement=new Mc(e,t,a,s,l),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(e,t,n){let i=re.now(),o=()=>this._forceFullPlacement?!1:re.now()-i>2;for(;this._currentPlacementIndex>=0;){let a=e[this._currentPlacementIndex],s=t[a],l=this.placement.collisionIndex.transform.zoom;if(s.type==="symbol"&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new _f(s)),this._inProgressLayer.continuePlacement(n[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};d();d();var Zb=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],xf=1,xs=8,vs=class r{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[t,n]=new Uint8Array(e,0,2);if(t!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==xf)throw new Error(`Got v${i} data when expected v${xf}.`);let o=Zb[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 r(s,a,o,e)}constructor(e,t=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(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=Zb.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,xs,e),this.coords=new this.ArrayType(this.data,xs+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(xs+a+s+l),this.ids=new this.IndexArrayType(this.data,xs,e),this.coords=new this.ArrayType(this.data,xs+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(xf<<4)+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return vf(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,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,h=l.pop()||0;if(p-h<=s){for(let g=h;g<=p;g++){let _=a[2*g],x=a[2*g+1];_>=e&&_<=n&&x>=t&&x<=i&&u.push(o[g])}continue}let m=h+p>>1,f=a[2*m],y=a[2*m+1];f>=e&&f<=n&&y>=t&&y<=i&&u.push(o[m]),(c===0?e<=f:t<=y)&&(l.push(h),l.push(m-1),l.push(1-c)),(c===0?n>=f:i>=y)&&(l.push(m+1),l.push(p),l.push(1-c))}return u}within(e,t,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,h=s.pop()||0;if(p-h<=a){for(let g=h;g<=p;g++)$b(o[2*g],o[2*g+1],e,t)<=u&&l.push(i[g]);continue}let m=h+p>>1,f=o[2*m],y=o[2*m+1];$b(f,y,e,t)<=u&&l.push(i[m]),(c===0?e-n<=f:t-n<=y)&&(s.push(h),s.push(m-1),s.push(1-c)),(c===0?e+n>=f:t+n>=y)&&(s.push(m+1),s.push(p),s.push(1-c))}return l}};function vf(r,e,t,n,i,o){if(i-n<=t)return;let a=n+i>>1;Hb(r,e,a,n,i,o),vf(r,e,t,n,a-1,1-o),vf(r,e,t,a+1,i,1-o)}function Hb(r,e,t,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=t-n+1,p=Math.log(u),h=.5*Math.exp(2*p/3),m=.5*Math.sqrt(p*h*(u-h)/u)*(c-u/2<0?-1:1),f=Math.max(n,Math.floor(t-c*h/u+m)),y=Math.min(i,Math.floor(t+(u-c)*h/u+m));Hb(r,e,t,f,y,o)}let a=e[2*t+o],s=n,l=i;for(bs(r,e,n,t),e[2*i+o]>a&&bs(r,e,n,i);s<l;){for(bs(r,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?bs(r,e,n,l):(l++,bs(r,e,l,i)),l<=t&&(n=l+1),t<=l&&(i=l-1)}}function bs(r,e,t,n){bf(r,t,n),bf(e,2*t,2*n),bf(e,2*t+1,2*n+1)}function bf(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}function $b(r,e,t,n){let i=r-t,o=e-n;return i*i+o*o}var ws=512/8192/2,pL=128,wf=class{constructor(e,t,n){this.tileID=e;this.bucketInstanceId=n;this._symbolsByKey={};let i=new Map;for(let o=0;o<t.length;o++){let a=t.get(o),s=a.key,l=i.get(s);l?l.push(a):i.set(s,[a])}for(let[o,a]of i){let s=a.map(c=>({x:Math.floor(c.anchorX*ws),y:Math.floor(c.anchorY*ws)})),l=a.map(c=>c.crossTileID),u={positions:s,crossTileIDs:l};if(u.positions.length>pL){let c=new vs(u.positions.length,16,Uint16Array);for(let{x:p,y:h}of u.positions)c.add(p,h);c.finish(),delete u.positions,u.index=c}this._symbolsByKey[o]=u}}getScaledCoordinates(e,t){let{x:n,y:i,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=t.canonical,u=l-o,c=ws/Math.pow(2,u),p=(a*8192+e.anchorX)*c,h=(s*8192+e.anchorY)*c,m=n*8192*ws,f=i*8192*ws;return{x:Math.floor(p-m),y:Math.floor(h-f)}}findMatches(e,t,n){let i=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let o=0;o<e.length;o++){let a=e.get(o);if(a.crossTileID)continue;let s=this._symbolsByKey[a.key];if(!s)continue;let l=this.getScaledCoordinates(a,t);if(s.index){let u=s.index.range(l.x-i,l.y-i,l.x+i,l.y+i).sort();for(let c of u){let p=s.crossTileIDs[c];if(!n[p]){n[p]=!0,a.crossTileID=p;break}}}else if(s.positions)for(let u=0;u<s.positions.length;u++){let c=s.positions[u],p=s.crossTileIDs[u];if(Math.abs(c.x-l.x)<=i&&Math.abs(c.y-l.y)<=i&&!n[p]){n[p]=!0,a.crossTileID=p;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},Pf=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},Sf=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let n in this.indexes){let i=this.indexes[n],o={};for(let a in i){let s=i[a];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+t),o[s.tileID.key]=s}this.indexes[n]=o}this.lng=e}addBucket(e,t,n){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 o=0;o<t.symbolInstances.length;o++){let a=t.symbolInstances.get(o);a.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let i=this.usedCrossTileIDs[e.overscaledZ];for(let o in this.indexes){let a=this.indexes[o];if(Number(o)>e.overscaledZ)for(let s in a){let l=a[s];l.tileID.isChildOf(e)&&l.findMatches(t.symbolInstances,e,i)}else{let s=e.scaledTo(Number(o)),l=a[s.key];l&&l.findMatches(t.symbolInstances,e,i)}}for(let o=0;o<t.symbolInstances.length;o++){let a=t.symbolInstances.get(o);a.crossTileID||(a.crossTileID=n.generate(),i[a.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new wf(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let n of t.getCrossTileIDsLists())for(let i of n)delete this.usedCrossTileIDs[e][i]}removeStaleBuckets(e){let t=!1;for(let n in this.indexes){let i=this.indexes[n];for(let o in i)e[i[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,i[o]),delete i[o],t=!0)}return t}},co=class{constructor(){this.layerIndexes={},this.crossTileIDs=new Pf,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let i=this.layerIndexes[e.id];i===void 0&&(i=this.layerIndexes[e.id]=new Sf);let o=!1,a={};i.handleWrapJump(n);for(let s of t){let l=s.getBucket(e);!l||e.id!==l.layerIds[0]||(l.bucketInstanceId||(l.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(s.tileID,l,this.crossTileIDs)&&(o=!0),a[l.bucketInstanceId]=!0)}return i.removeStaleBuckets(a)&&(o=!0),o}pruneUnusedLayers(e){let t={};e.forEach(n=>{t[n]=!0});for(let n in this.layerIndexes)t[n]||delete this.layerIndexes[n]}};d();d();d();d();var qb=`#ifdef GL_ES
3
+ precision mediump float;
4
+ #else
5
+ #if !defined(lowp)
6
+ #define lowp
7
+ #endif
8
+ #if !defined(mediump)
9
+ #define mediump
10
+ #endif
11
+ #if !defined(highp)
12
+ #define highp
13
+ #endif
14
+ #endif
15
+ out highp vec4 fragColor;`;d();var Wb=`#ifdef GL_ES
16
+ precision highp float;
17
+ #else
18
+ #if !defined(lowp)
19
+ #define lowp
20
+ #endif
21
+ #if !defined(mediump)
22
+ #define mediump
23
+ #endif
24
+ #if !defined(highp)
25
+ #define highp
26
+ #endif
27
+ #endif
28
+ vec2 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
29
+ );}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;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
30
+ );}
31
+ #ifdef TERRAIN3D
32
+ uniform 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;
33
+ #endif
34
+ const 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) {
35
+ #ifdef TERRAIN3D
36
+ highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
37
+ #else
38
+ return 1.0;
39
+ #endif
40
+ }float calculate_visibility(vec4 pos) {
41
+ #ifdef TERRAIN3D
42
+ vec3 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;
43
+ #else
44
+ return 1.0;
45
+ #endif
46
+ }float ele(vec2 pos) {
47
+ #ifdef TERRAIN3D
48
+ vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
49
+ #else
50
+ return 0.0;
51
+ #endif
52
+ }float get_elevation(vec2 pos) {
53
+ #ifdef TERRAIN3D
54
+ #ifdef GLOBE
55
+ if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
56
+ #endif
57
+ vec2 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;
58
+ #else
59
+ return 0.0;
60
+ #endif
61
+ }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`;d();var Xb=`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
62
+ #ifdef OVERDRAW_INSPECTOR
63
+ fragColor=vec4(1.0);
64
+ #endif
65
+ }`;d();var Yb="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}";d();var Kb=`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;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
66
+ #ifdef OVERDRAW_INSPECTOR
67
+ fragColor=vec4(1.0);
68
+ #endif
69
+ }`;d();var Jb="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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);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 Qb=`in vec3 v_data;in float v_visibility;
70
+ #pragma mapbox: define highp vec4 color
71
+ #pragma mapbox: define mediump float radius
72
+ #pragma mapbox: define lowp float blur
73
+ #pragma mapbox: define lowp float opacity
74
+ #pragma mapbox: define highp vec4 stroke_color
75
+ #pragma mapbox: define mediump float stroke_width
76
+ #pragma mapbox: define lowp float stroke_opacity
77
+ void main() {
78
+ #pragma mapbox: initialize highp vec4 color
79
+ #pragma mapbox: initialize mediump float radius
80
+ #pragma mapbox: initialize lowp float blur
81
+ #pragma mapbox: initialize lowp float opacity
82
+ #pragma mapbox: initialize highp vec4 stroke_color
83
+ #pragma mapbox: initialize mediump float stroke_width
84
+ #pragma mapbox: initialize lowp float stroke_opacity
85
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;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));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
86
+ #ifdef OVERDRAW_INSPECTOR
87
+ fragColor=vec4(1.0);
88
+ #endif
89
+ }`;d();var ev=`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
90
+ #pragma mapbox: define highp vec4 color
91
+ #pragma mapbox: define mediump float radius
92
+ #pragma mapbox: define lowp float blur
93
+ #pragma mapbox: define lowp float opacity
94
+ #pragma mapbox: define highp vec4 stroke_color
95
+ #pragma mapbox: define mediump float stroke_width
96
+ #pragma mapbox: define lowp float stroke_opacity
97
+ void main(void) {
98
+ #pragma mapbox: initialize highp vec4 color
99
+ #pragma mapbox: initialize mediump float radius
100
+ #pragma mapbox: initialize lowp float blur
101
+ #pragma mapbox: initialize lowp float opacity
102
+ #pragma mapbox: initialize highp vec4 stroke_color
103
+ #pragma mapbox: initialize mediump float stroke_width
104
+ #pragma mapbox: initialize lowp float stroke_opacity
105
+ vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
106
+ #ifdef GLOBE
107
+ vec3 center_vector=projectToSphere(circle_center);
108
+ #endif
109
+ float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
110
+ #ifdef GLOBE
111
+ vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
112
+ #else
113
+ vec4 projected_center=projectTileWithElevation(circle_center,ele);
114
+ #endif
115
+ corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
116
+ #ifdef GLOBE
117
+ vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
118
+ #else
119
+ gl_Position=projectTileWithElevation(corner_position,ele);
120
+ #endif
121
+ } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`;d();var Tf="void main() {fragColor=vec4(1.0);}";d();var tv="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}";d();var rv=`uniform highp float u_intensity;in vec2 v_extrude;
122
+ #pragma mapbox: define highp float weight
123
+ #define GAUSS_COEF 0.3989422804014327
124
+ void main() {
125
+ #pragma mapbox: initialize highp float weight
126
+ float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
127
+ #ifdef OVERDRAW_INSPECTOR
128
+ fragColor=vec4(1.0);
129
+ #endif
130
+ }`;d();var nv=`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
131
+ #pragma mapbox: define highp float weight
132
+ #pragma mapbox: define mediump float radius
133
+ const highp float ZERO=1.0/255.0/16.0;
134
+ #define GAUSS_COEF 0.3989422804014327
135
+ void main(void) {
136
+ #pragma mapbox: initialize highp float weight
137
+ #pragma mapbox: initialize mediump float radius
138
+ vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.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;vec2 circle_center=floor(pos_raw/8.0);
139
+ #ifdef GLOBE
140
+ vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
141
+ #else
142
+ gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
143
+ #endif
144
+ }`;d();var iv=`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
145
+ #ifdef OVERDRAW_INSPECTOR
146
+ fragColor=vec4(0.0);
147
+ #endif
148
+ }`;d();var ov="uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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 av="in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}";d();var sv="in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}";d();var lv="in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}";d();var uv="in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}";d();var cv=`#ifdef GL_ES
149
+ precision highp float;
150
+ #endif
151
+ uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(textureSize(u_elevation_stops,0)[0]);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int num_elevation_stops=textureSize(u_elevation_stops,0)[0];int r=(num_elevation_stops-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
152
+ {l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(textureSize(u_color_stops,0)[0]);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
153
+ #ifdef OVERDRAW_INSPECTOR
154
+ fragColor=vec4(1.0);
155
+ #endif
156
+ }`;d();var pv="uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}";d();var hv="uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}";d();var mv="in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}";d();var fv=`in vec2 a_pos;void main() {
157
+ #ifdef GLOBE
158
+ gl_Position=projectTileFor3D(a_pos,0.0);
159
+ #else
160
+ gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
161
+ #endif
162
+ }`;d();var dv=`#pragma mapbox: define highp vec4 color
163
+ #pragma mapbox: define lowp float opacity
164
+ void main() {
165
+ #pragma mapbox: initialize highp vec4 color
166
+ #pragma mapbox: initialize lowp float opacity
167
+ fragColor=color*opacity;
168
+ #ifdef OVERDRAW_INSPECTOR
169
+ fragColor=vec4(1.0);
170
+ #endif
171
+ }`;d();var yv=`uniform vec2 u_fill_translate;in vec2 a_pos;
172
+ #pragma mapbox: define highp vec4 color
173
+ #pragma mapbox: define lowp float opacity
174
+ void main() {
175
+ #pragma mapbox: initialize highp vec4 color
176
+ #pragma mapbox: initialize lowp float opacity
177
+ gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`;d();var gv=`in vec2 v_pos;
178
+ #ifdef GLOBE
179
+ in float v_depth;
180
+ #endif
181
+ #pragma mapbox: define highp vec4 outline_color
182
+ #pragma mapbox: define lowp float opacity
183
+ void main() {
184
+ #pragma mapbox: initialize highp vec4 outline_color
185
+ #pragma mapbox: initialize lowp float opacity
186
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
187
+ #ifdef GLOBE
188
+ if (v_depth > 1.0) {discard;}
189
+ #endif
190
+ #ifdef OVERDRAW_INSPECTOR
191
+ fragColor=vec4(1.0);
192
+ #endif
193
+ }`;d();var _v=`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
194
+ #ifdef GLOBE
195
+ out float v_depth;
196
+ #endif
197
+ #pragma mapbox: define highp vec4 outline_color
198
+ #pragma mapbox: define lowp float opacity
199
+ void main() {
200
+ #pragma mapbox: initialize highp vec4 outline_color
201
+ #pragma mapbox: initialize lowp float opacity
202
+ gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
203
+ #ifdef GLOBE
204
+ v_depth=gl_Position.z/gl_Position.w;
205
+ #endif
206
+ }`;d();var xv=`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
207
+ #ifdef GLOBE
208
+ in float v_depth;
209
+ #endif
210
+ #pragma mapbox: define lowp float opacity
211
+ #pragma mapbox: define lowp vec4 pattern_from
212
+ #pragma mapbox: define lowp vec4 pattern_to
213
+ void main() {
214
+ #pragma mapbox: initialize lowp float opacity
215
+ #pragma mapbox: initialize mediump vec4 pattern_from
216
+ #pragma mapbox: initialize mediump vec4 pattern_to
217
+ vec2 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=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
218
+ #ifdef GLOBE
219
+ if (v_depth > 1.0) {discard;}
220
+ #endif
221
+ #ifdef OVERDRAW_INSPECTOR
222
+ fragColor=vec4(1.0);
223
+ #endif
224
+ }`;d();var bv=`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
225
+ #ifdef GLOBE
226
+ out float v_depth;
227
+ #endif
228
+ #pragma mapbox: define lowp float opacity
229
+ #pragma mapbox: define lowp vec4 pattern_from
230
+ #pragma mapbox: define lowp vec4 pattern_to
231
+ #pragma mapbox: define lowp float pixel_ratio_from
232
+ #pragma mapbox: define lowp float pixel_ratio_to
233
+ void main() {
234
+ #pragma mapbox: initialize lowp float opacity
235
+ #pragma mapbox: initialize mediump vec4 pattern_from
236
+ #pragma mapbox: initialize mediump vec4 pattern_to
237
+ #pragma mapbox: initialize lowp float pixel_ratio_from
238
+ #pragma mapbox: initialize lowp float pixel_ratio_to
239
+ vec2 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=projectTile(a_pos+u_fill_translate,a_pos);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;
240
+ #ifdef GLOBE
241
+ v_depth=gl_Position.z/gl_Position.w;
242
+ #endif
243
+ }`;d();var vv=`#ifdef GL_ES
244
+ precision highp float;
245
+ #endif
246
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
247
+ #pragma mapbox: define lowp float opacity
248
+ #pragma mapbox: define lowp vec4 pattern_from
249
+ #pragma mapbox: define lowp vec4 pattern_to
250
+ void main() {
251
+ #pragma mapbox: initialize lowp float opacity
252
+ #pragma mapbox: initialize mediump vec4 pattern_from
253
+ #pragma mapbox: initialize mediump vec4 pattern_to
254
+ vec2 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
255
+ #ifdef OVERDRAW_INSPECTOR
256
+ fragColor=vec4(1.0);
257
+ #endif
258
+ }`;d();var wv=`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
259
+ #pragma mapbox: define lowp float opacity
260
+ #pragma mapbox: define lowp vec4 pattern_from
261
+ #pragma mapbox: define lowp vec4 pattern_to
262
+ #pragma mapbox: define lowp float pixel_ratio_from
263
+ #pragma mapbox: define lowp float pixel_ratio_to
264
+ void main() {
265
+ #pragma mapbox: initialize lowp float opacity
266
+ #pragma mapbox: initialize mediump vec4 pattern_from
267
+ #pragma mapbox: initialize mediump vec4 pattern_to
268
+ #pragma mapbox: initialize lowp float pixel_ratio_from
269
+ #pragma mapbox: initialize lowp float pixel_ratio_to
270
+ vec2 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=projectTile(a_pos+u_fill_translate,a_pos);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 Pv=`in vec4 v_color;void main() {fragColor=v_color;
271
+ #ifdef OVERDRAW_INSPECTOR
272
+ fragColor=vec4(1.0);
273
+ #endif
274
+ }`;d();var Sv=`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
275
+ #ifdef TERRAIN3D
276
+ in vec2 a_centroid;
277
+ #endif
278
+ out vec4 v_color;
279
+ #pragma mapbox: define highp float base
280
+ #pragma mapbox: define highp float height
281
+ #pragma mapbox: define highp vec4 color
282
+ void main() {
283
+ #pragma mapbox: initialize highp float base
284
+ #pragma mapbox: initialize highp float height
285
+ #pragma mapbox: initialize highp vec4 color
286
+ vec3 normal=a_normal_ed.xyz;
287
+ #ifdef TERRAIN3D
288
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
289
+ #else
290
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
291
+ #endif
292
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
293
+ #ifdef GLOBE
294
+ vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
295
+ #else
296
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
297
+ #endif
298
+ 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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
299
+ #ifdef GLOBE
300
+ mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
301
+ #endif
302
+ 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 Tv=`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
303
+ #pragma mapbox: define lowp float base
304
+ #pragma mapbox: define lowp float height
305
+ #pragma mapbox: define lowp vec4 pattern_from
306
+ #pragma mapbox: define lowp vec4 pattern_to
307
+ #pragma mapbox: define lowp float pixel_ratio_from
308
+ #pragma mapbox: define lowp float pixel_ratio_to
309
+ void main() {
310
+ #pragma mapbox: initialize lowp float base
311
+ #pragma mapbox: initialize lowp float height
312
+ #pragma mapbox: initialize mediump vec4 pattern_from
313
+ #pragma mapbox: initialize mediump vec4 pattern_to
314
+ #pragma mapbox: initialize lowp float pixel_ratio_from
315
+ #pragma mapbox: initialize lowp float pixel_ratio_to
316
+ vec2 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=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
317
+ #ifdef OVERDRAW_INSPECTOR
318
+ fragColor=vec4(1.0);
319
+ #endif
320
+ }`;d();var Mv=`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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
321
+ #ifdef TERRAIN3D
322
+ in vec2 a_centroid;
323
+ #endif
324
+ #ifdef GLOBE
325
+ out vec3 v_sphere_pos;
326
+ #endif
327
+ out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
328
+ #pragma mapbox: define lowp float base
329
+ #pragma mapbox: define lowp float height
330
+ #pragma mapbox: define lowp vec4 pattern_from
331
+ #pragma mapbox: define lowp vec4 pattern_to
332
+ #pragma mapbox: define lowp float pixel_ratio_from
333
+ #pragma mapbox: define lowp float pixel_ratio_to
334
+ void main() {
335
+ #pragma mapbox: initialize lowp float base
336
+ #pragma mapbox: initialize lowp float height
337
+ #pragma mapbox: initialize mediump vec4 pattern_from
338
+ #pragma mapbox: initialize mediump vec4 pattern_to
339
+ #pragma mapbox: initialize lowp float pixel_ratio_from
340
+ #pragma mapbox: initialize lowp float pixel_ratio_to
341
+ vec2 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;
342
+ #ifdef TERRAIN3D
343
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
344
+ #else
345
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
346
+ #endif
347
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
348
+ #ifdef GLOBE
349
+ vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
350
+ #else
351
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
352
+ #endif
353
+ vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
354
+ ? a_pos
355
+ : vec2(edgedistance,elevation*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 Cv=`#ifdef GL_ES
356
+ precision highp float;
357
+ #endif
358
+ uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;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))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
359
+ #ifdef OVERDRAW_INSPECTOR
360
+ fragColor=vec4(1.0);
361
+ #endif
362
+ }`;d();var Av="uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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 Iv=`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
363
+ #define PI 3.141592653589793
364
+ #define STANDARD 0
365
+ #define COMBINED 1
366
+ #define IGOR 2
367
+ #define MULTIDIRECTIONAL 3
368
+ #define BASIC 4
369
+ float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;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_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
370
+ {fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
371
+ {fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;switch(u_method){case BASIC:
372
+ basic_hillshade(deriv);break;case COMBINED:
373
+ combined_hillshade(deriv);break;case IGOR:
374
+ igor_hillshade(deriv);break;case MULTIDIRECTIONAL:
375
+ multidirectional_hillshade(deriv);break;case STANDARD:
376
+ default:
377
+ standard_hillshade(deriv);break;}
378
+ #ifdef OVERDRAW_INSPECTOR
379
+ fragColor=vec4(1.0);
380
+ #endif
381
+ }`;d();var Ev="uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}";d();var Lv=`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
382
+ #ifdef GLOBE
383
+ in float v_depth;
384
+ #endif
385
+ #pragma mapbox: define highp vec4 color
386
+ #pragma mapbox: define lowp float blur
387
+ #pragma mapbox: define lowp float opacity
388
+ void main() {
389
+ #pragma mapbox: initialize highp vec4 color
390
+ #pragma mapbox: initialize lowp float blur
391
+ #pragma mapbox: initialize lowp float opacity
392
+ 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);fragColor=color*(alpha*opacity);
393
+ #ifdef GLOBE
394
+ if (v_depth > 1.0) {discard;}
395
+ #endif
396
+ #ifdef OVERDRAW_INSPECTOR
397
+ fragColor=vec4(1.0);
398
+ #endif
399
+ }`;d();var Dv=`
400
+ #define scale 0.015873016
401
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
402
+ #ifdef GLOBE
403
+ out float v_depth;
404
+ #endif
405
+ #pragma mapbox: define highp vec4 color
406
+ #pragma mapbox: define lowp float blur
407
+ #pragma mapbox: define lowp float opacity
408
+ #pragma mapbox: define mediump float gapwidth
409
+ #pragma mapbox: define lowp float offset
410
+ #pragma mapbox: define mediump float width
411
+ void main() {
412
+ #pragma mapbox: initialize highp vec4 color
413
+ #pragma mapbox: initialize lowp float blur
414
+ #pragma mapbox: initialize lowp float opacity
415
+ #pragma mapbox: initialize mediump float gapwidth
416
+ #pragma mapbox: initialize lowp float offset
417
+ #pragma mapbox: initialize mediump float width
418
+ float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
419
+ #ifdef GLOBE
420
+ v_depth=gl_Position.z/gl_Position.w;
421
+ #endif
422
+ #ifdef TERRAIN3D
423
+ v_gamma_scale=1.0;
424
+ #else
425
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
426
+ #endif
427
+ v_width2=vec2(outset,inset);}`;d();var kv=`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
428
+ #ifdef GLOBE
429
+ in float v_depth;
430
+ #endif
431
+ #pragma mapbox: define lowp float blur
432
+ #pragma mapbox: define lowp float opacity
433
+ void main() {
434
+ #pragma mapbox: initialize lowp float blur
435
+ #pragma mapbox: initialize lowp float opacity
436
+ 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);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
437
+ #ifdef GLOBE
438
+ if (v_depth > 1.0) {discard;}
439
+ #endif
440
+ #ifdef OVERDRAW_INSPECTOR
441
+ fragColor=vec4(1.0);
442
+ #endif
443
+ }`;d();var Rv=`
444
+ #define scale 0.015873016
445
+ in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
446
+ #ifdef GLOBE
447
+ out float v_depth;
448
+ #endif
449
+ #pragma mapbox: define lowp float blur
450
+ #pragma mapbox: define lowp float opacity
451
+ #pragma mapbox: define mediump float gapwidth
452
+ #pragma mapbox: define lowp float offset
453
+ #pragma mapbox: define mediump float width
454
+ void main() {
455
+ #pragma mapbox: initialize lowp float blur
456
+ #pragma mapbox: initialize lowp float opacity
457
+ #pragma mapbox: initialize mediump float gapwidth
458
+ #pragma mapbox: initialize lowp float offset
459
+ #pragma mapbox: initialize mediump float width
460
+ float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
461
+ #ifdef GLOBE
462
+ v_depth=gl_Position.z/gl_Position.w;
463
+ #endif
464
+ #ifdef TERRAIN3D
465
+ v_gamma_scale=1.0;
466
+ #else
467
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
468
+ #endif
469
+ v_width2=vec2(outset,inset);}`;d();var Fv=`#ifdef GL_ES
470
+ precision highp float;
471
+ #endif
472
+ uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
473
+ #ifdef GLOBE
474
+ in float v_depth;
475
+ #endif
476
+ #pragma mapbox: define lowp vec4 pattern_from
477
+ #pragma mapbox: define lowp vec4 pattern_to
478
+ #pragma mapbox: define lowp float pixel_ratio_from
479
+ #pragma mapbox: define lowp float pixel_ratio_to
480
+ #pragma mapbox: define lowp float blur
481
+ #pragma mapbox: define lowp float opacity
482
+ void main() {
483
+ #pragma mapbox: initialize mediump vec4 pattern_from
484
+ #pragma mapbox: initialize mediump vec4 pattern_to
485
+ #pragma mapbox: initialize lowp float pixel_ratio_from
486
+ #pragma mapbox: initialize lowp float pixel_ratio_to
487
+ #pragma mapbox: initialize lowp float blur
488
+ #pragma mapbox: initialize lowp float opacity
489
+ vec2 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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
490
+ #ifdef GLOBE
491
+ if (v_depth > 1.0) {discard;}
492
+ #endif
493
+ #ifdef OVERDRAW_INSPECTOR
494
+ fragColor=vec4(1.0);
495
+ #endif
496
+ }`;d();var zv=`
497
+ #define scale 0.015873016
498
+ #define LINE_DISTANCE_SCALE 2.0
499
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
500
+ #ifdef GLOBE
501
+ out float v_depth;
502
+ #endif
503
+ #pragma mapbox: define lowp float blur
504
+ #pragma mapbox: define lowp float opacity
505
+ #pragma mapbox: define lowp float offset
506
+ #pragma mapbox: define mediump float gapwidth
507
+ #pragma mapbox: define mediump float width
508
+ #pragma mapbox: define lowp float floorwidth
509
+ #pragma mapbox: define lowp vec4 pattern_from
510
+ #pragma mapbox: define lowp vec4 pattern_to
511
+ #pragma mapbox: define lowp float pixel_ratio_from
512
+ #pragma mapbox: define lowp float pixel_ratio_to
513
+ void main() {
514
+ #pragma mapbox: initialize lowp float blur
515
+ #pragma mapbox: initialize lowp float opacity
516
+ #pragma mapbox: initialize lowp float offset
517
+ #pragma mapbox: initialize mediump float gapwidth
518
+ #pragma mapbox: initialize mediump float width
519
+ #pragma mapbox: initialize lowp float floorwidth
520
+ #pragma mapbox: initialize mediump vec4 pattern_from
521
+ #pragma mapbox: initialize mediump vec4 pattern_to
522
+ #pragma mapbox: initialize lowp float pixel_ratio_from
523
+ #pragma mapbox: initialize lowp float pixel_ratio_to
524
+ float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
525
+ #ifdef GLOBE
526
+ v_depth=gl_Position.z/gl_Position.w;
527
+ #endif
528
+ #ifdef TERRAIN3D
529
+ v_gamma_scale=1.0;
530
+ #else
531
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
532
+ #endif
533
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`;d();var Bv=`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
534
+ #ifdef GLOBE
535
+ in float v_depth;
536
+ #endif
537
+ #pragma mapbox: define highp vec4 color
538
+ #pragma mapbox: define lowp float blur
539
+ #pragma mapbox: define lowp float opacity
540
+ #pragma mapbox: define mediump float width
541
+ #pragma mapbox: define lowp float floorwidth
542
+ void main() {
543
+ #pragma mapbox: initialize highp vec4 color
544
+ #pragma mapbox: initialize lowp float blur
545
+ #pragma mapbox: initialize lowp float opacity
546
+ #pragma mapbox: initialize mediump float width
547
+ #pragma mapbox: initialize lowp float floorwidth
548
+ 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 sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(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);fragColor=color*(alpha*opacity);
549
+ #ifdef GLOBE
550
+ if (v_depth > 1.0) {discard;}
551
+ #endif
552
+ #ifdef OVERDRAW_INSPECTOR
553
+ fragColor=vec4(1.0);
554
+ #endif
555
+ }`;d();var Ov=`
556
+ #define scale 0.015873016
557
+ #define LINE_DISTANCE_SCALE 2.0
558
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;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;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
559
+ #ifdef GLOBE
560
+ out float v_depth;
561
+ #endif
562
+ #pragma mapbox: define highp vec4 color
563
+ #pragma mapbox: define lowp float blur
564
+ #pragma mapbox: define lowp float opacity
565
+ #pragma mapbox: define mediump float gapwidth
566
+ #pragma mapbox: define lowp float offset
567
+ #pragma mapbox: define mediump float width
568
+ #pragma mapbox: define lowp float floorwidth
569
+ void main() {
570
+ #pragma mapbox: initialize highp vec4 color
571
+ #pragma mapbox: initialize lowp float blur
572
+ #pragma mapbox: initialize lowp float opacity
573
+ #pragma mapbox: initialize mediump float gapwidth
574
+ #pragma mapbox: initialize lowp float offset
575
+ #pragma mapbox: initialize mediump float width
576
+ #pragma mapbox: initialize lowp float floorwidth
577
+ float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
578
+ #ifdef GLOBE
579
+ v_depth=gl_Position.z/gl_Position.w;
580
+ #endif
581
+ #ifdef TERRAIN3D
582
+ v_gamma_scale=1.0;
583
+ #else
584
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
585
+ #endif
586
+ v_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 Vv=`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
587
+ #ifdef OVERDRAW_INSPECTOR
588
+ fragColor=vec4(1.0);
589
+ #endif
590
+ }`;d();var Uv=`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
591
+ #ifdef GLOBE
592
+ if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
593
+ #endif
594
+ v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`;d();var jv=`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
595
+ #pragma mapbox: define lowp float opacity
596
+ void main() {
597
+ #pragma mapbox: initialize lowp float opacity
598
+ lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
599
+ #ifdef OVERDRAW_INSPECTOR
600
+ fragColor=vec4(1.0);
601
+ #endif
602
+ }`;d();var Nv=`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;
603
+ #pragma mapbox: define lowp float opacity
604
+ void main() {
605
+ #pragma mapbox: initialize lowp float opacity
606
+ vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
607
+ camera_to_anchor_distance/u_camera_to_center_distance :
608
+ u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
609
+ #ifdef GLOBE
610
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
611
+ #endif
612
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;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 Gv=`#define SDF_PX 8.0
613
+ uniform 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;in vec2 v_data0;in vec3 v_data1;
614
+ #pragma mapbox: define highp vec4 fill_color
615
+ #pragma mapbox: define highp vec4 halo_color
616
+ #pragma mapbox: define lowp float opacity
617
+ #pragma mapbox: define lowp float halo_width
618
+ #pragma mapbox: define lowp float halo_blur
619
+ void main() {
620
+ #pragma mapbox: initialize highp vec4 fill_color
621
+ #pragma mapbox: initialize highp vec4 halo_color
622
+ #pragma mapbox: initialize lowp float opacity
623
+ #pragma mapbox: initialize lowp float halo_width
624
+ #pragma mapbox: initialize lowp float halo_blur
625
+ float 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 inner_edge=(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);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);
626
+ #ifdef OVERDRAW_INSPECTOR
627
+ fragColor=vec4(1.0);
628
+ #endif
629
+ }`;d();var Zv=`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;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_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
630
+ #pragma mapbox: define highp vec4 fill_color
631
+ #pragma mapbox: define highp vec4 halo_color
632
+ #pragma mapbox: define lowp float opacity
633
+ #pragma mapbox: define lowp float halo_width
634
+ #pragma mapbox: define lowp float halo_blur
635
+ void main() {
636
+ #pragma mapbox: initialize highp vec4 fill_color
637
+ #pragma mapbox: initialize highp vec4 halo_color
638
+ #pragma mapbox: initialize lowp float opacity
639
+ #pragma mapbox: initialize lowp float halo_width
640
+ #pragma mapbox: initialize lowp float halo_blur
641
+ vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
642
+ camera_to_anchor_distance/u_camera_to_center_distance :
643
+ u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
644
+ #ifdef GLOBE
645
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
646
+ #endif
647
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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 $v=`#define SDF_PX 8.0
648
+ #define SDF 1.0
649
+ #define ICON 0.0
650
+ uniform 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;in vec4 v_data0;in vec4 v_data1;
651
+ #pragma mapbox: define highp vec4 fill_color
652
+ #pragma mapbox: define highp vec4 halo_color
653
+ #pragma mapbox: define lowp float opacity
654
+ #pragma mapbox: define lowp float halo_width
655
+ #pragma mapbox: define lowp float halo_blur
656
+ void main() {
657
+ #pragma mapbox: initialize highp vec4 fill_color
658
+ #pragma mapbox: initialize highp vec4 halo_color
659
+ #pragma mapbox: initialize lowp float opacity
660
+ #pragma mapbox: initialize lowp float halo_width
661
+ #pragma mapbox: initialize lowp float halo_blur
662
+ float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;
663
+ #ifdef OVERDRAW_INSPECTOR
664
+ fragColor=vec4(1.0);
665
+ #endif
666
+ return;}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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);
667
+ #ifdef OVERDRAW_INSPECTOR
668
+ fragColor=vec4(1.0);
669
+ #endif
670
+ }`;d();var Hv=`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in 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_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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
671
+ #pragma mapbox: define highp vec4 fill_color
672
+ #pragma mapbox: define highp vec4 halo_color
673
+ #pragma mapbox: define lowp float opacity
674
+ #pragma mapbox: define lowp float halo_width
675
+ #pragma mapbox: define lowp float halo_blur
676
+ void main() {
677
+ #pragma mapbox: initialize highp vec4 fill_color
678
+ #pragma mapbox: initialize highp vec4 halo_color
679
+ #pragma mapbox: initialize lowp float opacity
680
+ #pragma mapbox: initialize lowp float halo_width
681
+ #pragma mapbox: initialize lowp float halo_blur
682
+ vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
683
+ camera_to_anchor_distance/u_camera_to_center_distance :
684
+ u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
685
+ #ifdef GLOBE
686
+ if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
687
+ #endif
688
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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 qv="in 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() {fragColor=pack(v_depth);}";d();var Wv="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}";d();var Xv="uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}";d();var Yv="in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}";d();var Kv="in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}";d();var Jv="in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}";d();var Qv="in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}";d();var e0="in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}";d();var t0="float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}";d();var r0=`#define GLOBE_RADIUS 6371008.8
689
+ uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
690
+ );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
691
+ if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
692
+ );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`;d();var n0=`in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
693
+ );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`;d();var i0="in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}";d();var o0="uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}";d();var a0="in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}";var Rt={prelude:we(qb,Wb),projectionMercator:we("",t0),projectionGlobe:we("",r0),background:we(Xb,Yb),backgroundPattern:we(Kb,Jb),circle:we(Qb,ev),clippingMask:we(Tf,tv),heatmap:we(rv,nv),heatmapTexture:we(iv,ov),collisionBox:we(av,sv),collisionCircle:we(lv,uv),colorRelief:we(cv,pv),debug:we(hv,mv),depth:we(Tf,fv),fill:we(dv,yv),fillOutline:we(gv,_v),fillOutlinePattern:we(xv,bv),fillPattern:we(vv,wv),fillExtrusion:we(Pv,Sv),fillExtrusionPattern:we(Tv,Mv),hillshadePrepare:we(Cv,Av),hillshade:we(Iv,Ev),line:we(Lv,Dv),lineGradient:we(kv,Rv),linePattern:we(Fv,zv),lineSDF:we(Bv,Ov),raster:we(Vv,Uv),symbolIcon:we(jv,Nv),symbolSDF:we(Gv,Zv),symbolTextAndIcon:we($v,Hv),terrain:we(Xv,Yv),terrainDepth:we(qv,Kv),terrainCoords:we(Wv,Jv),projectionErrorMeasurement:we(e0,Qv),atmosphere:we(n0,i0),sky:we(o0,a0)};function we(r,e){let t=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/in ([\w]+) ([\w]+)/g),i=r.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(i):i,s={};return r=r.replace(t,(l,u,c,p,h)=>(s[h]=!0,u==="define"?`
694
+ #ifndef HAS_UNIFORM_u_${h}
695
+ in ${c} ${p} ${h};
696
+ #else
697
+ uniform ${c} ${p} u_${h};
698
+ #endif
699
+ `:`
700
+ #ifdef HAS_UNIFORM_u_${h}
701
+ ${c} ${p} ${h} = u_${h};
702
+ #endif
703
+ `)),e=e.replace(t,(l,u,c,p,h)=>{let m=p==="float"?"vec2":"vec4",f=h.match(/color/)?"color":m;return s[h]?u==="define"?`
704
+ #ifndef HAS_UNIFORM_u_${h}
705
+ uniform lowp float u_${h}_t;
706
+ in ${c} ${m} a_${h};
707
+ out ${c} ${p} ${h};
708
+ #else
709
+ uniform ${c} ${p} u_${h};
710
+ #endif
711
+ `:f==="vec4"?`
712
+ #ifndef HAS_UNIFORM_u_${h}
713
+ ${h} = a_${h};
714
+ #else
715
+ ${c} ${p} ${h} = u_${h};
716
+ #endif
717
+ `:`
718
+ #ifndef HAS_UNIFORM_u_${h}
719
+ ${h} = unpack_mix_${f}(a_${h}, u_${h}_t);
720
+ #else
721
+ ${c} ${p} ${h} = u_${h};
722
+ #endif
723
+ `:u==="define"?`
724
+ #ifndef HAS_UNIFORM_u_${h}
725
+ uniform lowp float u_${h}_t;
726
+ in ${c} ${m} a_${h};
727
+ #else
728
+ uniform ${c} ${p} u_${h};
729
+ #endif
730
+ `:f==="vec4"?`
731
+ #ifndef HAS_UNIFORM_u_${h}
732
+ ${c} ${p} ${h} = a_${h};
733
+ #else
734
+ ${c} ${p} ${h} = u_${h};
735
+ #endif
736
+ `:`
737
+ #ifndef HAS_UNIFORM_u_${h}
738
+ ${c} ${p} ${h} = unpack_mix_${f}(a_${h}, u_${h}_t);
739
+ #else
740
+ ${c} ${p} ${h} = u_${h};
741
+ #endif
742
+ `}),{fragmentSource:r,vertexSource:e,staticAttributes:n,staticUniforms:a}}function s0(r){return r.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}function l0(r){return r.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}d();var Ft=class{constructor(e,t,n){this.vertexBuffer=e,this.indexBuffer=t,this.segments=n}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};d();var $t=Ie([{name:"a_pos",type:"Int16",components:2}]);var Mf="#define PROJECTION_MERCATOR",Cf="mercator",yi=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Cf}get shaderDefine(){return Mf}get shaderPreludeCode(){return Rt.projectionMercator}get vertexShaderPreludeCode(){return Rt.projectionMercator.vertexSource}get subdivisionGranularity(){return bn.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,t,n,i,o){if(this._cachedMesh)return this._cachedMesh;let a=new pt;a.emplaceBack(0,0),a.emplaceBack(8192,0),a.emplaceBack(0,8192),a.emplaceBack(8192,8192);let s=e.createVertexBuffer(a,$t.members),l=pe.simpleSegment(0,0,4,2),u=new je;u.emplaceBack(1,0,2),u.emplaceBack(1,2,3);let c=e.createIndexBuffer(u);return this._cachedMesh=new Ft(s,c,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}};d();var zt=ie(le(),1);d();var En=ie(le(),1);d();var u0=ie(le(),1);var po=class r{constructor(e=0,t=0,n=0,i=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<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=n,this.right=i}interpolate(e,t,n){return t.top!=null&&e.top!=null&&(this.top=Me.number(e.top,t.top,n)),t.bottom!=null&&e.bottom!=null&&(this.bottom=Me.number(e.bottom,t.bottom,n)),t.left!=null&&e.left!=null&&(this.left=Me.number(e.left,t.left,n)),t.right!=null&&e.right!=null&&(this.right=Me.number(e.right,t.right,n)),this}getCenter(e,t){let n=ae((this.left+e-this.right)/2,0,e),i=ae((this.top+t-this.bottom)/2,0,t);return new u0.default(n,i)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new r(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function ho(r,e){if(!r.renderWorldCopies||r.lngRange)return;let t=e.lng-r.center.lng;e.lng+=t>180?-360:t<-180?360:0}function c0(r){return Math.max(0,Math.floor(r))}var Ln=class{constructor(e,t,n,i,o,a){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=a===void 0?!0:!!a,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=i??0,this._maxPitch=o??60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=c0(this._zoom),this._scale=We(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new po,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,n){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=c0(this._zoom),this._scale=We(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new po(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!n&&e.autoCalculateNearFarZ,t&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(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 En.default(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=Yt(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=Qr.create(),Qr.rotate(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=ae(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Vn(this._fovInRadians)}setFov(e){e=ae(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Ee(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.getConstrained(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=We(t),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(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}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(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)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,n){this._unmodified=!1,this._edgeInsets.interpolate(e,t,n),this._constrain(),this._calcMatrices()}resize(e,t,n=!0){this._width=e,this._height=t,n&&this._constrain(),this._calcMatrices()}getMaxBounds(){return!this._latRange||this._latRange.length!==2||!this._lngRange||this._lngRange.length!==2?null:new rt([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-vt,vt])}getConstrained(e,t){return this._callbacks.getConstrained(e,t)}getCameraQueryGeometry(e,t){if(t.length===1)return[t[0],e];{let{minX:n,minY:i,maxX:o,maxY:a}=at.fromPoints(t).extend(e);return[new En.default(n,i),new En.default(o,i),new En.default(o,a),new En.default(n,a),new En.default(n,i)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:n}=this.getConstrained(this.center,this.zoom);this.setCenter(t),this.setZoom(n),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=F.identity(new Float64Array(16));F.scale(e,e,[this._width/2,-this._height/2,1]),F.translate(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=F.identity(new Float64Array(16)),F.scale(e,e,[1,-1,1]),F.translate(e,e,[-1,-1,0]),F.scale(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,n,i){let o=n!==void 0?n:this.bearing,a=i=i!==void 0?i:this.pitch,s=fe.fromLngLat(e,t),l=-Math.cos(Ee(a)),u=Math.sin(Ee(a)),c=u*Math.sin(Ee(o)),p=-u*Math.cos(Ee(o)),h=this.elevation,m=t-h,f;l*m>=0||Math.abs(l)<.1?(f=1e4,h=t+f*l):f=-m/l;let y=pc(1,s.y),g,_,x=0,b=10;do{if(x+=1,x>b)break;_=f/y;let S=c*_,T=p*_;g=new fe(s.x+S,s.y+T),y=1/g.meterInMercatorCoordinateUnits()}while(Math.abs(f-_*y)>1e-12);let v=g.toLngLat(),P=Ge(this.height/2/Math.tan(this.fovInRadians/2)/_/this.tileSize);return{center:v,elevation:h,zoom:P}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=Er(1,this.center.lat)*this.worldSize,n=this.cameraToCenterDistance/t,i=fe.fromLngLat(this.center,this.elevation),o=hs(this.center,this.elevation,this.pitch,this.bearing,n);this._elevation=e;let a=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),pc(o.z,i.y),this.bearing,this.pitch);this._elevation=a.elevation,this._center=a.center,this.setZoom(a.zoom)}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new En.default(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let e=Er(1,this.center.lat)*this.worldSize,t=this.cameraToCenterDistance/e;return hs(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/t,e.canonical.y/t,1/t/8192,1/t/8192]}};d();d();var mo=class r{constructor(e,t){this.min=e,this.max=t,this.center=O.scale([],O.add([],this.min,this.max),.5)}quadrant(e){let t=[e%2===0,e<2],n=O.clone(this.min),i=O.clone(this.max);for(let o=0;o<t.length;o++)n[o]=t[o]?this.min[o]:this.center[o],i[o]=t[o]?this.center[o]:this.max[o];return i[2]=this.max[2],new r(n,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]}intersectsFrustum(e){let t=!0;for(let n=0;n<e.planes.length;n++){let i=this.intersectsPlane(e.planes[n]);if(i===0)return 0;i===1&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],n=e[3];for(let i=0;i<3;i++)e[i]>0?(t+=e[i]*this.min[i],n+=e[i]*this.max[i]):(n+=e[i]*this.min[i],t+=e[i]*this.max[i]);return t>=0?2:n<0?0:1}};var Ac=class{distanceToTile2d(e,t,n,i){let o=i.distanceX([e,t]),a=i.distanceY([e,t]);return Math.hypot(o,a)}getWrap(e,t,n){return n}getTileBoundingVolume(e,t,n,i){let o=0,a=0;if(i?.terrain){let l=new Be(e.z,t,e.z,e.x,e.y),u=i.terrain.getMinMaxElevation(l);o=u.minElevation??Math.min(0,n),a=u.maxElevation??Math.max(0,n)}let s=1<<e.z;return new mo([t+e.x/s,e.y/s,o],[t+(e.x+1)/s,(e.y+1)/s,a])}allowVariableZoom(e,t){let n=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,i=ae(78.5-n/2,0,60);return!!t.terrain||e.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}};d();var fo=class r{constructor(e,t,n){this.points=e;this.planes=t;this.aabb=n}static fromInvProjectionMatrix(e,t=1,n=0,i,o){let 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]],s=o?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=Math.pow(2,n),u=a.map(m=>hL(m,e,t,l));i&&mL(u,s[0],i,o);let c=s.map(m=>{let f=O.sub([],u[m[0]],u[m[1]]),y=O.sub([],u[m[2]],u[m[1]]),g=O.normalize([],O.cross([],f,y)),_=-O.dot(g,u[m[1]]);return g.concat(_)}),p=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],h=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let m of u)for(let f=0;f<3;f++)p[f]=Math.min(p[f],m[f]),h[f]=Math.max(h[f],m[f]);return new r(u,c,new mo(p,h))}};function hL(r,e,t,n){let i=De.transformMat4([],r,e),o=1/i[3]/t*n;return De.mul(i,i,[o,o,1/i[3],o])}function mL(r,e,t,n){let i=n?4:0,o=n?0:4,a=0,s=[],l=[];for(let p=0;p<4;p++){let h=O.sub([],r[p+o],r[p+i]),m=O.length(h);O.scale(h,h,1/m),s.push(m),l.push(h)}for(let p=0;p<4;p++){let h=dy(r[p+i],l[p],t);h!==null&&h>=0?a=Math.max(a,h):a=Math.max(a,s[p])}let u=fL(r,e),c=dL(t,u);if(c!==null){let p=c/O.dot(l[0],u);a=Math.min(a,p)}for(let p=0;p<4;p++){let h=Math.min(a,s[p]),m=[r[p+i][0]+l[p][0]*h,r[p+i][1]+l[p][1]*h,r[p+i][2]+l[p][2]*h,1];r[p+o]=m}}function fL(r,e){let t=O.sub([],r[e[0]],r[e[1]]),n=O.sub([],r[e[2]],r[e[1]]),i=[0,0,0,0];return O.normalize(i,O.cross([],t,n)),i[3]=-O.dot(i,r[e[0]]),i}function dL(r,e){let t=O.len(r),n=De.scale([],r,1/t),i=O.sub([],e,O.scale([],n,O.dot(e,n))),o=O.len(i);if(o>0){let a=Math.sqrt(1-n[3]*n[3]),s=O.scale([],n,-n[3]),l=O.add([],s,O.scale([],i,a/o));return Mo(e,l)}else return null}var Wr=class r{constructor(e,t,n,i,o){this._posMatrixCache=new Map;this._alignedPosMatrixCache=new Map;this._fogMatrixCacheF32=new Map;this._helper=new Ln({calcMatrices:()=>{this._calcMatrices()},getConstrained:(a,s)=>this.getConstrained(a,s)},e,t,n,i,o),this._coveringTilesDetailsProvider=new Ac}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){return this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,n=!0){this._helper.resize(e,t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}clone(){let e=new r;return e.apply(this),e}apply(e,t,n){this._helper.apply(e,t,n)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){let t=[new Sn(0,e)];if(this._helper._renderWorldCopies){let n=this.screenPointToMercatorCoordinate(new zt.default(0,0)),i=this.screenPointToMercatorCoordinate(new zt.default(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new zt.default(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new zt.default(0,this._helper._height)),s=Math.floor(Math.min(n.x,i.x,o.x,a.x)),l=Math.floor(Math.max(n.x,i.x,o.x,a.x)),u=1;for(let c=s-u;c<=l+u;c++)c!==0&&t.push(new Sn(c,e))}return t}getCameraFrustum(){return fo.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){let t=this.screenPointToLocation(this.centerPoint,e),n=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(n)}setLocationAtPoint(e,t){let n=Er(this.elevation,this.center.lat),i=this.screenPointToMercatorCoordinateAtZ(t,n),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,n),a=fe.fromLngLat(e),s=new fe(a.x-(i.x-o.x),a.y-(i.y-o.y));this.setCenter(s?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,t){return t?this.coordinatePoint(fe.fromLngLat(e),t.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(fe.fromLngLat(e))}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){let n=t.pointCoordinate(e);if(n!=null)return n}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,t){let n=t||0,i=[e.x,e.y,0,1],o=[e.x,e.y,1,1];De.transformMat4(i,i,this._pixelMatrixInverse),De.transformMat4(o,o,this._pixelMatrixInverse);let a=i[3],s=o[3],l=i[0]/a,u=o[0]/s,c=i[1]/a,p=o[1]/s,h=i[2]/a,m=o[2]/s,f=h===m?0:(n-h)/(m-h);return new fe(Me.number(l,u,f)/this.worldSize,Me.number(c,p,f)/this.worldSize,n)}coordinatePoint(e,t=0,n=this._pixelMatrix){let i=[e.x*this.worldSize,e.y*this.worldSize,t,1];return De.transformMat4(i,i,n),new zt.default(i[0]/i[3],i[1]/i[3])}getBounds(){let e=Math.max(0,this._helper._height/2-lo(this));return new rt().extend(this.screenPointToLocation(new zt.default(0,e))).extend(this.screenPointToLocation(new zt.default(this._helper._width,e))).extend(this.screenPointToLocation(new zt.default(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new zt.default(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?t.pointCoordinate(e)!=null:e.y>this.height/2-lo(this)}calculatePosMatrix(e,t=!1,n){let i=e.key??hi(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),o=t?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(i)){let l=o.get(i);return n?l.f32:l.f64}let a=dc(e,this.worldSize);F.multiply(a,t?this._alignedProjMatrix:this._viewProjMatrix,a);let s={f64:a,f32:new Float32Array(a)};return o.set(i,s),n?s.f32:s.f64}calculateFogMatrix(e){let t=e.key,n=this._fogMatrixCacheF32;if(n.has(t))return n.get(t);let i=dc(e,this.worldSize);return F.multiply(i,this._fogMatrix,i),n.set(t,new Float32Array(i)),n.get(t)}getConstrained(e,t){t=ae(+t,this.minZoom,this.maxZoom);let n={center:new W(e.lng,e.lat),zoom:t},i=this._helper._lngRange;if(!this._helper._renderWorldCopies&&i===null){let b=179.9999999999;i=[-b,b]}let o=this.tileSize*We(n.zoom),a=0,s=o,l=0,u=o,c=0,p=0,{x:h,y:m}=this.size;if(this._helper._latRange){let b=this._helper._latRange;a=mr(b[1])*o,s=mr(b[0])*o,s-a<m&&(c=m/(s-a))}i&&(l=Yt($r(i[0])*o,0,o),u=Yt($r(i[1])*o,0,o),u<l&&(u+=o),u-l<h&&(p=h/(u-l)));let{x:f,y}=Zt(o,e),g,_,x=Math.max(p||0,c||0);if(x){let b=new zt.default(p?(u+l)/2:f,c?(s+a)/2:y);return n.center=Cn(o,b).wrap(),n.zoom+=Ge(x),n}if(this._helper._latRange){let b=m/2;y-b<a&&(_=a+b),y+b>s&&(_=s-b)}if(i){let b=(l+u)/2,v=f;this._helper._renderWorldCopies&&(v=Yt(f,b-o/2,b+o/2));let P=h/2;v-P<l&&(g=l+P),v+P>u&&(g=u-P)}if(g!==void 0||_!==void 0){let b=new zt.default(g??f,_??y);n.center=Cn(o,b).wrap()}return n}calculateCenterFromCameraLngLatAlt(e,t,n,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,i)}_calculateNearFarZIfNeeded(e,t,n){if(!this._helper.autoCalculateNearFarZ)return;let o=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=e-o*this._helper._pixelPerMeter/Math.cos(t),s=o<0?a:e,l=Math.PI/2+this.pitchInRadians,c=Ee(this.fov)*(Math.abs(Math.cos(Ee(this.roll)))*this.height+Math.abs(Math.sin(Ee(this.roll)))*this.width)/this.height*(.5+n.y/this.height),p=Math.sin(c)*s/Math.sin(ae(Math.PI-l-c,.01,Math.PI-.01)),h=lo(this),m=Math.atan(h/this._helper.cameraToCenterDistance),f=Ee(90-Mn),y=m>f?2*m*(.5+n.y/(h*2)):f,g=Math.sin(y)*s/Math.sin(ae(Math.PI-l-y,.01,Math.PI-.01)),_=Math.min(p,g);this._helper._farZ=(Math.cos(Math.PI/2-t)*_+s)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let e=this.centerOffset,t=Zt(this.worldSize,this.center),n=t.x,i=t.y;this._helper._pixelPerMeter=Er(1,this.center.lat)*this.worldSize;let o=Ee(Math.min(this.pitch,Mn)),a=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));this._calculateNearFarZIfNeeded(a,o,e);let s;s=new Float64Array(16),F.perspective(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),F.invert(this._invProjMatrix,s),s[8]=-e.x*2/this._helper._width,s[9]=e.y*2/this._helper._height,this._projectionMatrix=F.clone(s),F.scale(s,s,[1,-1,1]),F.translate(s,s,[0,0,-this._helper.cameraToCenterDistance]),F.rotateZ(s,s,-this.rollInRadians),F.rotateX(s,s,this.pitchInRadians),F.rotateZ(s,s,-this.bearingInRadians),F.translate(s,s,[-n,-i,0]),this._mercatorMatrix=F.scale([],s,[this.worldSize,this.worldSize,this.worldSize]),F.scale(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=F.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),F.translate(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=F.invert([],s);let l=[0,0,-1,1];De.transformMat4(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),F.perspective(this._fogMatrix,this.fovInRadians,this.width/this.height,a,this._helper._farZ),this._fogMatrix[8]=-e.x*2/this.width,this._fogMatrix[9]=e.y*2/this.height,F.scale(this._fogMatrix,this._fogMatrix,[1,-1,1]),F.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),F.rotateZ(this._fogMatrix,this._fogMatrix,-this.rollInRadians),F.rotateX(this._fogMatrix,this._fogMatrix,this.pitchInRadians),F.rotateZ(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),F.translate(this._fogMatrix,this._fogMatrix,[-n,-i,0]),F.scale(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),F.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=F.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);let u=this._helper._width%2/2,c=this._helper._height%2/2,p=Math.cos(this.bearingInRadians),h=Math.sin(-this.bearingInRadians),m=n-Math.round(n)+p*u+h*c,f=i-Math.round(i)+p*c+h*u,y=new Float64Array(s);if(F.translate(y,y,[m>.5?m-1:m,f>.5?f-1:f,0]),this._alignedProjMatrix=y,s=F.invert(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let e=this.screenPointToMercatorCoordinate(new zt.default(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return De.transformMat4(t,t,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let e=Er(1,this.center.lat)*this.worldSize,t=this._helper.cameraToCenterDistance/e;return hs(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}lngLatToCameraDepth(e,t){let n=fe.fromLngLat(e),i=[n.x*this.worldSize,n.y*this.worldSize,t,1];return De.transformMat4(i,i,this._viewProjMatrix),i[2]/i[3]}getProjectionData(e){let{overscaledTileID:t,aligned:n,applyTerrainMatrix:i}=e,o=this._helper.getMercatorTileCoordinates(t),a=t?this.calculatePosMatrix(t,n,!0):null,s;return t&&t.terrainRttPosMatrix32f&&i?s=t.terrainRttPosMatrix32f:a?s=a:s=cl(),{mainMatrix:s,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,n){return 1}transformLightDirection(e){return O.clone(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,t,n,i){let o=this.calculatePosMatrix(n),a;i?(a=[e,t,i(e,t),1],De.transformMat4(a,a,o)):(a=[e,t,0,1],ds(a,a,o));let s=a[3];return{point:new zt.default(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(e){for(let t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,t){let n=fe.fromLngLat(e,t),i=n.meterInMercatorCoordinateUnits(),o=tn();return F.translate(o,o,[n.x,n.y,n.z]),F.rotateZ(o,o,Math.PI),F.rotateX(o,o,Math.PI/2),F.scale(o,o,[-i,i,i]),o}getProjectionDataForCustomLayer(e=!0){let t=new Be(0,0,0,0,0),n=this.getProjectionData({overscaledTileID:t,applyGlobeMatrix:e}),i=dc(t,this.worldSize);F.multiply(i,this._viewProjMatrix,i),n.tileMercatorCoords=[0,0,1,1];let o=[8192,8192,this.worldSize/this._helper.pixelsPerMeter],a=ar();return F.scale(a,i,o),n.fallbackMatrix=a,n.mainMatrix=a,n}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}};d();d();var Ps=ie(le(),1);function Af(){ue("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Ic(r){if(r.useSlerp)if(r.k<1){let e=Rh(r.startEulerAngles.roll,r.startEulerAngles.pitch,r.startEulerAngles.bearing),t=Rh(r.endEulerAngles.roll,r.endEulerAngles.pitch,r.endEulerAngles.bearing),n=new Float64Array(4);en.slerp(n,e,t,r.k);let i=Cy(n);r.tr.setRoll(i.roll),r.tr.setPitch(i.pitch),r.tr.setBearing(i.bearing)}else r.tr.setRoll(r.endEulerAngles.roll),r.tr.setPitch(r.endEulerAngles.pitch),r.tr.setBearing(r.endEulerAngles.bearing);else r.tr.setRoll(Me.number(r.startEulerAngles.roll,r.endEulerAngles.roll,r.k)),r.tr.setPitch(Me.number(r.startEulerAngles.pitch,r.endEulerAngles.pitch,r.k)),r.tr.setBearing(Me.number(r.startEulerAngles.bearing,r.endEulerAngles.bearing,r.k))}function Ec(r,e,t,n,i){let o=i.padding,a=Zt(i.worldSize,t.getNorthWest()),s=Zt(i.worldSize,t.getNorthEast()),l=Zt(i.worldSize,t.getSouthEast()),u=Zt(i.worldSize,t.getSouthWest()),c=Ee(-n),p=a.rotate(c),h=s.rotate(c),m=l.rotate(c),f=u.rotate(c),y=new Ps.default(Math.max(p.x,h.x,f.x,m.x),Math.max(p.y,h.y,f.y,m.y)),g=new Ps.default(Math.min(p.x,h.x,f.x,m.x),Math.min(p.y,h.y,f.y,m.y)),_=y.sub(g),x=i.width-(o.left+o.right+e.left+e.right),b=i.height-(o.top+o.bottom+e.top+e.bottom),v=x/_.x,P=b/_.y;if(P<0||v<0){Af();return}let S=Math.min(Ge(i.scale*Math.min(v,P)),r.maxZoom),T=Ps.default.convert(r.offset),C=(e.left-e.right)/2,A=(e.top-e.bottom)/2,k=new Ps.default(C,A).rotate(Ee(n)),V=T.add(k).mult(i.scale/We(S));return{center:Cn(i.worldSize,a.add(l).div(2).sub(V)),zoom:S,bearing:n}}var Xr=class{get useGlobeControls(){return!1}handlePanInertia(e,t){return{easingOffset:e,easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,n){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(n,e.around)}cameraForBoxAndBearing(e,t,n,i,o){return Ec(e,t,n,i,o)}handleJumpToCenterZoom(e,t){let i=typeof t.zoom<"u"?+t.zoom:e.zoom;e.zoom!==i&&e.setZoom(+t.zoom),t.center!==void 0&&e.setCenter(W.convert(t.center))}handleEaseTo(e,t){let n=e.zoom,i=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a=t.roll===void 0?e.roll:t.roll,s=t.pitch===void 0?e.pitch:t.pitch,l=t.bearing===void 0?e.bearing:t.bearing,u={roll:a,pitch:s,bearing:l},c=typeof t.zoom<"u",p=!e.isPaddingEqual(t.padding),h=!1,m=c?+t.zoom:e.zoom,f=e.centerPoint.add(t.offsetAsPoint),y=e.screenPointToLocation(f),{center:g,zoom:_}=e.getConstrained(W.convert(t.center||y),m??n);ho(e,g);let x=Zt(e.worldSize,y),b=Zt(e.worldSize,g).sub(x),v=We(_-n);return h=_!==n,{easeFunc:S=>{if(h&&e.setZoom(Me.number(n,_,S)),fl(o,u)||Ic({startEulerAngles:o,endEulerAngles:u,tr:e,k:S,useSlerp:o.roll!=u.roll}),p&&(e.interpolatePadding(i,t.padding,S),f=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let T=We(e.zoom-n),C=_>n?Math.min(2,v):Math.max(.5,v),A=Math.pow(C,1-S),E=Cn(e.worldSize,x.add(b.mult(S*A)).mult(T));e.setLocationAtPoint(e.renderWorldCopies?E.wrap():E,f)}},isZooming:h,elevationCenter:g}}handleFlyTo(e,t){let n=typeof t.zoom<"u",i=e.zoom,o=e.getConstrained(W.convert(t.center||t.locationAtOffset),n?+t.zoom:i),a=o.center,s=o.zoom;ho(e,a);let l=Zt(e.worldSize,t.locationAtOffset),u=Zt(e.worldSize,a).sub(l),c=u.mag(),p=We(s-i),h=typeof t.minZoom<"u",m;if(h){let y=Math.min(+t.minZoom,i,s),g=e.getConstrained(a,y).zoom;m=We(g-i)}return{easeFunc:(y,g,_,x)=>{e.setZoom(y===1?s:i+Ge(g));let b=y===1?a:Cn(e.worldSize,l.add(u.mult(_)).mult(g));e.setLocationAtPoint(e.renderWorldCopies?b.wrap():b,x)},scaleOfZoom:p,targetCenter:a,scaleOfMinZoom:m,pixelPathLength:c}}};d();d();d();d();var yL=0,p0=1,gL=771,Te=class{constructor(e,t,n){this.blendFunction=e,this.blendColor=t,this.mask=n}};Te.Replace=[p0,yL];Te.disabled=new Te(Te.Replace,X.transparent,[!1,!1,!1,!1]);Te.unblended=new Te(Te.Replace,X.transparent,[!0,!0,!0,!0]);Te.alphaBlended=new Te([p0,gL],X.transparent,[!0,!0,!0,!0]);d();var ne=class{constructor(e,t,n){this.enable=e,this.mode=t,this.frontFace=n}};ne.disabled=new ne(!1,1029,2305);ne.backCCW=new ne(!0,1029,2305);ne.frontCCW=new ne(!0,1028,2305);d();var te=class{constructor(e,t,n){this.func=e,this.mask=t,this.range=n}};te.ReadOnly=!1;te.ReadWrite=!0;te.disabled=new te(519,te.ReadOnly,[0,1]);d();var se=class{constructor(e,t,n,i,o,a){this.test=e,this.ref=t,this.mask=n,this.fail=i,this.depthFail=o,this.pass=a}};se.disabled=new se({func:519,mask:0},0,0,7680,7680,7680);d();var h0=(r,e)=>({u_input:new U(r,e.u_input),u_output_expected:new U(r,e.u_output_expected)}),m0=(r,e)=>({u_input:r,u_output_expected:e});d();var If=new WeakMap;function Ht(r){if(If.has(r))return If.get(r);{let e=r.getParameter(r.VERSION)?.startsWith("WebGL 2.0");return If.set(r,e),e}}var Lc=class r{constructor(e){this._readbackWaitFrames=4;this._measureWaitFrames=6;this._texWidth=1;this._texHeight=1;this._measuredError=0;this._updateCount=0;this._lastReadbackFrame=-1e3;this._readbackQueue=null;this._cachedRenderContext=e;let t=e.context,n=t.gl;this._texFormat=n.RGBA,this._texType=n.UNSIGNED_BYTE;let i=new pt;i.emplaceBack(-1,-1),i.emplaceBack(2,-1),i.emplaceBack(-1,2);let o=new je;o.emplaceBack(0,1,2),this._fullscreenTriangle=new Ft(t.createVertexBuffer(i,$t.members),t.createIndexBuffer(o),pe.simpleSegment(0,0,i.length,o.length)),this._resultBuffer=new Uint8Array(4),t.activeTexture.set(n.TEXTURE1);let a=n.createTexture();n.bindTexture(n.TEXTURE_2D,a),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST),n.texImage2D(n.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=t.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(a),Ht(n)&&(this._pbo=n.createBuffer(),n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.bufferData(n.PIXEL_PACK_BUFFER,4,n.STREAM_READ),n.bindBuffer(n.PIXEL_PACK_BUFFER,null))}get awaitingQuery(){return!!this._readbackQueue}destroy(){let e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,t){let n=this._updateCount;return this._readbackQueue?n>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():n>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){let e=this._cachedRenderContext.context,t=e.gl;e.activeTexture.set(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,t){let n=this._cachedRenderContext.context,i=n.gl;if(this._bindFramebuffer(),n.viewport.set([0,0,this._texWidth,this._texHeight]),n.clear({color:X.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(n,i.TRIANGLES,te.disabled,se.disabled,Te.unblended,ne.disabled,m0(e,t),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Ht(i)){i.bindBuffer(i.PIXEL_PACK_BUFFER,this._pbo),i.readBuffer(i.COLOR_ATTACHMENT0),i.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),i.bindBuffer(i.PIXEL_PACK_BUFFER,null);let a=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);i.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:a}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Ht(e)){let t=e.clientWaitSync(this._readbackQueue.sync,0,0);if(t===e.WAIT_FAILED){ue("WebGL2 clientWaitSync failed."),this._readbackQueue=null,this._lastReadbackFrame=this._updateCount;return}if(t===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=r._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let t=0;return t+=e[0]/256,t+=e[1]/65536,t+=e[2]/16777216,e[3]<127&&(t=-t),t/128}};d();var Dc=8192/128;function f0(r,e){let t=d0(e,"16bit"),n=pt.deserialize({arrayBuffer:t.vertices,length:t.vertices.byteLength/2/2}),i=je.deserialize({arrayBuffer:t.indices,length:t.indices.byteLength/2/3});return new Ft(r.createVertexBuffer(n,$t.members),r.createIndexBuffer(i),pe.simpleSegment(0,0,n.length,i.length))}function d0(r,e){let t=r.granularity!==void 0?Math.max(r.granularity,1):1,n=t+(r.generateBorders?2:0),i=t+(r.extendToNorthPole||r.generateBorders?1:0)+(r.extendToSouthPole||r.generateBorders?1:0),o=n+1,a=i+1,s=r.generateBorders?-1:0,l=r.generateBorders||r.extendToNorthPole?-1:0,u=t+(r.generateBorders?1:0),c=t+(r.generateBorders||r.extendToSouthPole?1:0),p=o*a,h=n*i*6,m=o*a>65536;if(m&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let f=m||e==="32bit",y=new Int16Array(p*2),g=0;for(let b=l;b<=c;b++)for(let v=s;v<=u;v++){let P=v/t*8192;v===-1&&(P=-Dc),v===t+1&&(P=8192+Dc);let S=b/t*8192;b===-1&&(S=r.extendToNorthPole?Ar:-Dc),b===t+1&&(S=r.extendToSouthPole?Gr:8192+Dc),y[g++]=P,y[g++]=S}let _=f?new Uint32Array(h):new Uint16Array(h),x=0;for(let b=0;b<i;b++)for(let v=0;v<n;v++){let P=v+b*o,S=v+1+b*o,T=v+(b+1)*o,C=v+1+(b+1)*o;_[x++]=P,_[x++]=T,_[x++]=S,_[x++]=S,_[x++]=T,_[x++]=C}return{vertices:y.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:f}}var _L="#define GLOBE",xL="globe",y0={errorTransitionTimeSeconds:.5},Ef=new bn({fill:new Nt(128,2),line:new Nt(512,0),tile:new Nt(128,32),stencil:new Nt(128,1),circle:3}),yo=class{constructor(){this._tileMeshCache={};this._errorCorrectionUsable=0;this._errorMeasurementLastValue=0;this._errorCorrectionPreviousValue=0;this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return xL}get shaderDefine(){return _L}get shaderPreludeCode(){return Rt.projectionGlobe}get vertexShaderPreludeCode(){return Rt.projectionMercator.vertexSource}get subdivisionGranularity(){return Ef}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new Lc(e));let t=mr(this._errorQueryLatitudeDegrees),n=2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5,i=this._errorMeasurement.updateErrorLoop(t,n),o=re.now();i!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=i,this._errorMeasurementLastChangeTime=o);let a=(o-this._errorMeasurementLastChangeTime)/1e3,s=Math.min(Math.max(a/y0.errorTransitionTimeSeconds,0),1),l=-this._errorMeasurementLastValue;this._errorCorrectionUsable=Fr(this._errorCorrectionPreviousValue,l,pl(s))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,n,i,o){let s=(o==="stencil"?Ef.stencil:Ef.tile).getGranularityForZoomLevel(t.z),l=t.y===0&&i,u=t.y===(1<<t.z)-1&&i;return this._getMesh(e,{granularity:s,generateBorders:n,extendToNorthPole:l,extendToSouthPole:u})}_getMesh(e,t){let n=this._getMeshKey(t);if(n in this._tileMeshCache)return this._tileMeshCache[n];let i=f0(e,t);return this._tileMeshCache[n]=i,i}recalculate(e){}hasTransition(){let e=re.now(),t=!1;return t=t||(e-this._errorMeasurementLastChangeTime)/1e3<y0.errorTransitionTimeSeconds+.2,t=t||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,t}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}};var bL=new Le({type:new Z(I.projection.type)}),Ss=class extends xe{constructor(e){super(),this._transitionable=new Mr(bL),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new be(0)),this._mercatorProjection=new yi,this._verticalPerspectiveProjection=new yo}get transitionState(){let e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof wr){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,n,i,o){return this.currentProjection.getMeshFromTileID(e,t,n,i,o)}setProjection(e){this._transitionable.setValue("type",e?.type||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}};d();d();var dr=ie(le(),1);d();function g0(r){let e=gi(r.worldSize,r.center.lat);return 2*Math.PI*e}function _0(r,e,t){let n=lt(e),i=lt(t),o=O.dot(n,i),a=Math.acos(o),s=g0(r);return a/(2*Math.PI)*s}function x0(r,e){let t=Un(r*Math.PI*2+Math.PI,Math.PI*2),n=2*Math.atan(Math.exp(Math.PI-e*Math.PI*2))-Math.PI*.5;return[t,n]}function vL(r,e){let t=Math.cos(e),n=new Float64Array(3);return n[0]=Math.sin(r)*t,n[1]=Math.sin(e),n[2]=Math.cos(r)*t,n}function Lr(r,e,t,n,i){let o=1/(1<<i),a=r/8192*o+t*o,s=e/8192*o+n*o,l=Un(a*Math.PI*2+Math.PI,Math.PI*2),u=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-Math.PI*.5,c=Math.cos(u),p=new Float64Array(3);return p[0]=Math.sin(l)*c,p[1]=Math.sin(u),p[2]=Math.cos(l)*c,p}function lt(r){return vL(r.lng*Math.PI/180,r.lat*Math.PI/180)}function gi(r,e){return r/(2*Math.PI)/Math.cos(e*Math.PI/180)}function Df(r){let t=Math.asin(r[1])/Math.PI*180,n=Math.sqrt(r[0]*r[0]+r[2]*r[2]);if(n>1e-6){let i=r[0]/n,o=r[2]/n,a=Math.acos(o),l=(i>0?a:-a)/Math.PI*180;return new W(Yt(l,-180,180),t)}else return new W(0,t)}function b0(r){let e=Ne();e[0]=r[0]*-r[3],e[1]=r[1]*-r[3],e[2]=r[2]*-r[3];let t=Math.sqrt(1-r[3]*r[3]);return{center:e,radius:t}}function v0(r,e,t){let n=Ne();O.sub(n,t,r);let i=Ne();return O.scaleAndAdd(i,r,n,e/O.len(n)),i}function kc(r){return Math.cos(r*Math.PI/180)}function nt(r,e){let t=kc(r),n=kc(e);return Ge(n/t)}function wL(r,e){return 360/g0({worldSize:r,center:{lat:e}})}function kf(r,e){let t=r.rotate(e.bearingInRadians),n=e.zoom+nt(e.center.lat,0),i=Fr(1/kc(e.center.lat),1/kc(Math.min(Math.abs(e.center.lat),60)),Ti(n,7,3,0,1)),o=wL(e.worldSize,e.center.lat);return new W(e.center.lng-t.x*o*i,ae(e.center.lat+t.y*o,-vt,vt))}function Lf(r){let e=.5*r,t=Math.sin(e),n=Math.cos(e);return Math.log(t+n)-Math.log(n-t)}function Rf(r,e,t,n){let i=r.lat+t*n;if(Math.abs(t)>1){let o=r.lat+t,s=(Math.sign(o)!==Math.sign(r.lat)?-Math.abs(r.lat):Math.abs(r.lat))*Math.PI/180,l=Math.abs(r.lat+t)*Math.PI/180,u=Lf(s+n*(l-s)),c=Lf(s),p=Lf(l),h=(u-c)/(p-c),m=r.lng+e*h;return new W(m,i)}else{let o=r.lng+e*n;return new W(o,i)}}d();d();var Rc=class{constructor(e){this._cachePrevious=new Map;this._cache=new Map;this._hadAnyChanges=!1;this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,n,i){let o=`${e.z}_${e.x}_${e.y}_${i?.terrain?"t":""}`,a=this._cache.get(o);if(a)return a;let s=this._cachePrevious.get(o);if(s)return this._cache.set(o,s),s;let l=this._boundingVolumeFactory(e,t,n,i);return this._cache.set(o,l),this._hadAnyChanges=!0,l}};d();var go=class r{constructor(e,t,n,i){this.min=n,this.max=i,this.points=e,this.planes=t}static fromAabb(e,t){let n=[];for(let i=0;i<8;i++)n.push([(i>>0&1)===1?t[0]:e[0],(i>>1&1)===1?t[1]:e[1],(i>>2&1)===1?t[2]:e[2]]);return new r(n,[[-1,0,0,t[0]],[1,0,0,-e[0]],[0,-1,0,t[1]],[0,1,0,-e[1]],[0,0,-1,t[2]],[0,0,1,-e[2]]],e,t)}static fromCenterSizeAngles(e,t,n){let i=en.fromEuler([],n[0],n[1],n[2]),o=O.transformQuat([],[t[0],0,0],i),a=O.transformQuat([],[0,t[1],0],i),s=O.transformQuat([],[0,0,t[2]],i),l=[...e],u=[...e];for(let p=0;p<8;p++)for(let h=0;h<3;h++){let m=e[h]+o[h]*((p>>0&1)===1?1:-1)+a[h]*((p>>1&1)===1?1:-1)+s[h]*((p>>2&1)===1?1:-1);l[h]=Math.min(l[h],m),u[h]=Math.max(u[h],m)}let c=[];for(let p=0;p<8;p++){let h=[...e];O.add(h,h,O.scale([],o,(p>>0&1)===1?1:-1)),O.add(h,h,O.scale([],a,(p>>1&1)===1?1:-1)),O.add(h,h,O.scale([],s,(p>>2&1)===1?1:-1)),c.push(h)}return new r(c,[[...o,-O.dot(o,c[0])],[...a,-O.dot(a,c[0])],[...s,-O.dot(s,c[0])],[-o[0],-o[1],-o[2],-O.dot(o,c[7])],[-a[0],-a[1],-a[2],-O.dot(a,c[7])],[-s[0],-s[1],-s[2],-O.dot(s,c[7])]],l,u)}intersectsFrustum(e){let t=!0,n=this.points.length,i=this.planes.length,o=e.planes.length,a=e.points.length;for(let s=0;s<o;s++){let l=e.planes[s],u=0;for(let c=0;c<n;c++){let p=this.points[c];l[0]*p[0]+l[1]*p[1]+l[2]*p[2]+l[3]>=0&&u++}if(u===0)return 0;u<n&&(t=!1)}if(t)return 2;for(let s=0;s<i;s++){let l=this.planes[s],u=0;for(let c=0;c<a;c++){let p=e.points[c];l[0]*p[0]+l[1]*p[1]+l[2]*p[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(e){let t=this.points.length,n=0;for(let i=0;i<t;i++){let o=this.points[i];e[0]*o[0]+e[1]*o[1]+e[2]*o[2]+e[3]>=0&&n++}return n===t?2:n===0?0:1}};function Fc(r,e,t){let n=r-e;return n<0?-n:Math.max(0,n-t)}function Ff(r,e,t,n,i){let o=r-t,a;return o<0?a=Math.min(-o,1+o-i):o>1?a=Math.min(Math.max(o-i,0),1-o):a=0,Math.max(a,Fc(e,n,i))}var zc=class{constructor(){this._boundingVolumeCache=new Rc(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,n,i){let o=1<<n.z,a=1/o,s=n.x/o,l=n.y/o,u=1,c=.5*u,p=2*u;return p=Math.min(p,Ff(e,t,s,l,a)),p=Math.min(p,Ff(e,t,s+c,-l-a,a)),p=Math.min(p,Ff(e,t,s+c,u+u-l-a,a)),p}getWrap(e,t,n){let i=1<<t.z,o=1/i,a=t.x/i,s=Fc(e.x,a,o),l=Fc(e.x,a-1,o),u=Fc(e.x,a+1,o),c=Math.min(s,l,u);return c===u?1:c===l?-1:0}allowVariableZoom(e,t){return mi(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,n,i){return this._boundingVolumeCache.getTileBoundingVolume(e,t,n,i)}_computeTileBoundingVolume(e,t,n,i){let o=0,a=0;if(i?.terrain){let s=new Be(e.z,t,e.z,e.x,e.y),l=i.terrain.getMinMaxElevation(s);o=l.minElevation??Math.min(0,n),a=l.maxElevation??Math.max(0,n)}if(o/=kt,a/=kt,o+=1,a+=1,e.z<=0)return go.fromAabb([-a,-a,-a],[a,a,a]);if(e.z===1)return go.fromAabb([e.x===0?-a:0,e.y===0?0:-a,-a],[e.x===0?0:a,e.y===0?a:0,a]);{let s=[Lr(0,0,e.x,e.y,e.z),Lr(8192,0,e.x,e.y,e.z),Lr(8192,8192,e.x,e.y,e.z),Lr(0,8192,e.x,e.y,e.z)],l=[];for(let A of s)l.push(O.scale([],A,a));if(a!==o)for(let A of s)l.push(O.scale([],A,o));e.y===0&&l.push([0,1,0]),e.y===(1<<e.z)-1&&l.push([0,-1,0]);let u=[1,1,1],c=[-1,-1,-1];for(let A of l)for(let E=0;E<3;E++)u[E]=Math.min(u[E],A[E]),c[E]=Math.max(c[E],A[E]);let p=Lr(8192/2,8192/2,e.x,e.y,e.z),h=O.cross([],[0,1,0],p);O.normalize(h,h);let m=O.cross([],p,h);O.normalize(m,m);let f=O.cross([],s[2],s[1]);O.normalize(f,f);let y=O.cross([],s[0],s[3]);O.normalize(y,y),l.push(O.scale([],p,a)),e.y>=(1<<e.z)/2&&l.push(O.scale([],Lr(8192/2,0,e.x,e.y,e.z),a)),e.y<(1<<e.z)/2&&l.push(O.scale([],Lr(8192/2,8192,e.x,e.y,e.z),a));let g=w0(p,l),_=w0(m,l),x=[-p[0],-p[1],-p[2],g.max],b=[p[0],p[1],p[2],-g.min],v=[-m[0],-m[1],-m[2],_.max],P=[m[0],m[1],m[2],-_.min],S=[...f,0],T=[...y,0],C=[];return e.y===0?C.push(Bt(T,S,x),Bt(T,S,b)):C.push(Bt(v,S,x),Bt(v,S,b),Bt(v,T,x),Bt(v,T,b)),e.y===(1<<e.z)-1?C.push(Bt(T,S,x),Bt(T,S,b)):C.push(Bt(P,S,x),Bt(P,S,b),Bt(P,T,x),Bt(P,T,b)),new go(C,[x,b,v,P,S,T],u,c)}}};function w0(r,e){let t=1/0,n=-1/0;for(let i of e){let o=O.dot(r,i);t=Math.min(t,o),n=Math.max(n,o)}return{min:t,max:n}}var _o=class r{constructor(){this._cachedClippingPlane=Si();this._projectionMatrix=tn();this._globeViewProjMatrix32f=cl();this._globeViewProjMatrixNoCorrection=tn();this._globeViewProjMatrixNoCorrectionInverted=tn();this._globeProjMatrixInverted=tn();this._cameraPosition=Ne();this._globeLatitudeErrorCorrectionRadians=0;this._helper=new Ln({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)}),this._coveringTilesDetailsProvider=new zc}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){return this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}clone(){let e=new r;return e.apply(this),e}apply(e,t){this._globeLatitudeErrorCorrectionRadians=t||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=Ne();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){let{overscaledTileID:t,applyGlobeMatrix:n}=e,i=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:i,clippingPlane:this._cachedClippingPlane,projectionTransition:n?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){let t=this.pitchInRadians,n=this.cameraToCenterDistance/e,i=1,o=Math.sin(t)*n,a=Math.cos(t)*n+i,s=Math.sqrt(o*o+a*a),u=i/s*i,c=-o,p=a,h=Math.sqrt(c*c+p*p);c/=h,p/=h;let m=[0,c,p];O.rotateZ(m,m,[0,0,0],-this.bearingInRadians),O.rotateX(m,m,[0,0,0],-1*this.center.lat*Math.PI/180),O.rotateY(m,m,[0,0,0],this.center.lng*Math.PI/180);let f=1/O.length(m);return O.scale(m,m,f),[...m,-u*f]}isLocationOccluded(e){return!this.isSurfacePointVisible(lt(e))}transformLightDirection(e){let t=this._helper._center.lng*Math.PI/180,n=this._helper._center.lat*Math.PI/180,i=Math.cos(n),o=[Math.sin(t)*i,Math.sin(n),Math.cos(t)*i],a=[o[2],0,-o[0]],s=[0,0,0];O.cross(s,a,o),O.normalize(a,a),O.normalize(s,s);let l=[a[0]*e[0]+s[0]*e[1]+o[0]*e[2],a[1]*e[0]+s[1]*e[1]+o[1]*e[2],a[2]*e[0]+s[2]*e[1]+o[2]*e[2]],u=[0,0,0];return O.normalize(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,t,n){let i=Mb(e,t,n.canonical),o=x0(i.x,i.y);return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(e,t,n,i){let o=n.canonical,a=Lr(e,t,o.x,o.y,o.z),l=1+(i?i(e,t):0)/kt,u=[a[0]*l,a[1]*l,a[2]*l,1];De.transformMat4(u,u,this._globeViewProjMatrixNoCorrection);let c=this._cachedClippingPlane,h=c[0]*a[0]+c[1]*a[1]+c[2]*a[2]+c[3]<0;return{point:new dr.default(u[0]/u[3],u[1]/u[3]),signedDistanceFromCamera:u[3],isOccluded:h}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let e=gi(this.worldSize,this.center.lat),t=ar(),n=ar();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+e*2),F.perspective(t,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let i=this.centerOffset;t[8]=-i.x*2/this._helper._width,t[9]=i.y*2/this._helper._height,this._projectionMatrix=F.clone(t),this._globeProjMatrixInverted=ar(),F.invert(this._globeProjMatrixInverted,t),F.translate(t,t,[0,0,-this.cameraToCenterDistance]),F.rotateZ(t,t,this.rollInRadians),F.rotateX(t,t,-this.pitchInRadians),F.rotateZ(t,t,this.bearingInRadians),F.translate(t,t,[0,0,-e]);let o=Ne();o[0]=e,o[1]=e,o[2]=e,F.rotateX(n,t,this.center.lat*Math.PI/180),F.rotateY(n,n,-this.center.lng*Math.PI/180),F.scale(n,n,o),this._globeViewProjMatrixNoCorrection=n,F.rotateX(t,t,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),F.rotateY(t,t,-this.center.lng*Math.PI/180),F.scale(t,t,o),this._globeViewProjMatrix32f=new Float32Array(t),this._globeViewProjMatrixNoCorrectionInverted=ar(),F.invert(this._globeViewProjMatrixNoCorrectionInverted,n);let a=Ne();this._cameraPosition=Ne(),this._cameraPosition[2]=this.cameraToCenterDistance/e,O.rotateZ(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),O.rotateX(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),O.rotateZ(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),O.add(this._cameraPosition,this._cameraPosition,[0,0,1]),O.rotateX(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),O.rotateY(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let s=F.clone(this._globeViewProjMatrixNoCorrectionInverted);F.scale(s,s,[1,1,-1]),this._cachedFrustum=fo.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){ue("calculateFogMatrix is not supported on globe projection.");let t=ar();return F.identity(t),t}getVisibleUnwrappedCoordinates(e){return[new Sn(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&ue("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){if(!this._globeViewProjMatrixNoCorrection)return 1;let n=lt(e);O.scale(n,n,1+t/kt);let i=Si();return De.transformMat4(i,[n[0],n[1],n[2],1],this._globeViewProjMatrixNoCorrection),i[2]/i[3]}populateCache(e){}getBounds(){let e=this.width*.5,t=this.height*.5,n=[new dr.default(0,0),new dr.default(e,0),new dr.default(this.width,0),new dr.default(this.width,t),new dr.default(this.width,this.height),new dr.default(e,this.height),new dr.default(0,this.height),new dr.default(0,t)],i=[];for(let p of n)i.push(this.unprojectScreenPoint(p));let o=0,a=0,s=0,l=0,u=this.center;for(let p of i){let h=bt(u.lng,p.lng),m=bt(u.lat,p.lat);h<a&&(a=h),h>o&&(o=h),m<l&&(l=m),m>s&&(s=m)}let c=[u.lng+a,u.lat+l,u.lng+o,u.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new rt(c)}getConstrained(e,t){let n=ae(e.lat,-vt,vt),i=ae(+t,this.minZoom+nt(0,n),this.maxZoom);return{center:new W(e.lng,n),zoom:i}}calculateCenterFromCameraLngLatAlt(e,t,n,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,i)}setLocationAtPoint(e,t){let n=this.unprojectScreenPoint(t),i=lt(n),o=lt(e),a=Ne();O.zero(a);let s=Ne();O.rotateY(s,i,a,-this.center.lng*Math.PI/180),O.rotateX(s,s,a,this.center.lat*Math.PI/180);let l=o[0]*o[0]+o[2]*o[2],u=s[0]*s[0];if(l<u)return;let c=Math.sqrt(l-u),p=-c,h=Co(o[0],o[2],s[0],c),m=Co(o[0],o[2],s[0],p),f=Ne();O.rotateY(f,o,a,-h);let y=Co(f[1],f[2],s[1],s[2]),g=Ne();O.rotateY(g,o,a,-m);let _=Co(g[1],g[2],s[1],s[2]),x=Math.PI*.5,b=y>=-x&&y<=x,v=_>=-x&&_<=x,P,S;if(b&&v){let E=this.center.lng*Math.PI/180,k=this.center.lat*Math.PI/180,R=Ao(h,E),V=Ao(y,k),M=Ao(m,E),L=Ao(_,k);R+V<M+L?(P=h,S=y):(P=m,S=_)}else if(b)P=h,S=y;else if(v)P=m,S=_;else return;let T=P/Math.PI*180,C=S/Math.PI*180,A=this.center.lat;this.setCenter(new W(T,ae(C,-90,90))),this.setZoom(this.zoom+nt(A,this.center.lat))}locationToScreenPoint(e,t){let n=lt(e);if(t){let i=t.getElevationForLngLatZoom(e,this._helper._tileZoom);O.scale(n,n,1+i/kt)}return this._projectSurfacePointToScreen(n)}_projectSurfacePointToScreen(e){let t=Si();return De.transformMat4(t,[...e,1],this._globeViewProjMatrixNoCorrection),t[0]/=t[3],t[1]/=t[3],new dr.default((t[0]*.5+.5)*this.width,(-t[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(e,t){if(t){let n=t.pointCoordinate(e);if(n)return n}return fe.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}isPointOnMapSurface(e,t){let n=this._cameraPosition,i=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(n,i)}getRayDirectionFromPixel(e){let t=Si();t[0]=e.x/this.width*2-1,t[1]=(e.y/this.height*2-1)*-1,t[2]=1,t[3]=1,De.transformMat4(t,t,this._globeViewProjMatrixNoCorrectionInverted),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3];let n=Ne();n[0]=t[0]-this._cameraPosition[0],n[1]=t[1]-this._cameraPosition[1],n[2]=t[2]-this._cameraPosition[2];let i=Ne();return O.normalize(i,n),i}isSurfacePointVisible(e){let t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;let t=Si();return De.transformMat4(t,[...e,1],this._globeViewProjMatrixNoCorrection),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3],t[0]>-1&&t[0]<1&&t[1]>-1&&t[1]<1&&t[2]>-1&&t[2]<1}rayPlanetIntersection(e,t){let n=O.dot(e,t),i=1,o=Ne(),a=Ne();O.scale(a,t,n),O.sub(o,e,a);let s=i-O.dot(o,o);if(s<0)return null;let l=O.dot(e,e)-i,u=-n+(n<0?1:-1)*Math.sqrt(s),c=l/u,p=u,h=Math.min(c,p),m=Math.max(c,p);return{tMin:h,tMax:m}}unprojectScreenPoint(e){let t=this._cameraPosition,n=this.getRayDirectionFromPixel(e),i=this.rayPlanetIntersection(t,n);if(i){let m=Ne();O.add(m,t,[n[0]*i.tMin,n[1]*i.tMin,n[2]*i.tMin]);let f=Ne();return O.normalize(f,m),Df(f)}let o=this._cachedClippingPlane,a=o[0]*n[0]+o[1]*n[1]+o[2]*n[2],l=-Mo(o,t)/a,u=2,c=Ne();if(l>0)O.add(c,t,[n[0]*l,n[1]*l,n[2]*l]);else{let m=Ne();O.add(m,t,[n[0]*u,n[1]*u,n[2]*u]);let f=Mo(this._cachedClippingPlane,m);O.sub(c,m,[this._cachedClippingPlane[0]*f,this._cachedClippingPlane[1]*f,this._cachedClippingPlane[2]*f])}let p=b0(o),h=v0(p.center,p.radius,c);return Df(h)}getMatrixForModel(e,t){let n=W.convert(e),i=1/kt,o=tn();return F.rotateY(o,o,n.lng/180*Math.PI),F.rotateX(o,o,-n.lat/180*Math.PI),F.translate(o,o,[0,0,1+t/kt]),F.rotateX(o,o,Math.PI*.5),F.scale(o,o,[i,i,i]),o}getProjectionDataForCustomLayer(e=!0){let t=this.getProjectionData({overscaledTileID:new Be(0,0,0,0,0),applyGlobeMatrix:e});return t.tileMercatorCoords=[0,0,1,1],t}getFastPathSimpleProjectionMatrix(e){}};var Ts=class r{constructor(){this._globeLatitudeErrorCorrectionRadians=0;this._globeness=1;this._helper=new Ln({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)}),this._globeness=1,this._mercatorTransform=new Wr,this._verticalPerspectiveTransform=new _o}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){return this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,n=!0){this._helper.resize(e,t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,t){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}clone(){let e=new r;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){let t=this._mercatorTransform.getProjectionData(e),n=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?n.mainMatrix:t.mainMatrix,clippingPlane:n.clippingPlane,tileMercatorCoords:n.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return Fr(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return Fr(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,t,n){let i=this._mercatorTransform.getPitchedTextCorrection(e,t,n),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,t,n);return Fr(i,o,this._globeness)}projectTileCoordinates(e,t,n,i){return this.currentTransform.projectTileCoordinates(e,t,n,i)}_calcMatrices(){!this._helper._width||!this._helper._height||(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,t){return this.currentTransform.getConstrained(e,t)}calculateCenterFromCameraLngLatAlt(e,t,n,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,i)}setLocationAtPoint(e,t){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(e,t),this.apply(this._mercatorTransform);return}this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,t){return this.currentTransform.getMatrixForModel(e,t)}getProjectionDataForCustomLayer(e=!0){let t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;let n=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return n.fallbackMatrix=t.mainMatrix,n}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}};d();d();var Bc=ie(le(),1);var xo=class r{get useGlobeControls(){return!0}handlePanInertia(e,t){let n=kf(e,t);return Math.abs(n.lng-t.center.lng)>180&&(n.lng=t.center.lng+179.5*Math.sign(n.lng-t.center.lng)),{easingCenter:n,easingOffset:new Bc.default(0,0)}}handleMapControlsRollPitchBearingZoom(e,t){let n=e.around,i=t.screenPointToLocation(n);e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta);let o=t.zoom;e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta);let a=t.zoom-o;if(a===0)return;let s=.3,l=.5,u=45,c=85,p=.25,h=.75,m=.35,f=.9,y=.5,g=.25,_=bt(t.center.lng,i.lng),x=_/(Math.abs(_/180)+1),b=bt(t.center.lat,i.lat),v=t.getRayDirectionFromPixel(n),P=t.cameraPosition,S=O.dot(P,v)*-1,T=Ne();O.add(T,P,[v[0]*S,v[1]*S,v[2]*S]);let C=O.length(T)-1,A=Math.exp(-Math.max(C-s,0)*l),E=gi(t.worldSize,t.center.lat)/Math.min(t.width,t.height),k=Ti(E,f,y,1,g),R=(1-We(-a))*Math.min(A,k),V=t.center.lat,M=t.zoom,L=new W(t.center.lng+x*R,ae(t.center.lat+b*R,-vt,vt));t.setLocationAtPoint(i,n);let $=t.center,q=Ti(Math.abs(_),u,c,0,1),Y=Ti(E,h,m,0,1),he=Math.pow(Math.max(q,Y),p),Oe=bt($.lng,L.lng),_e=bt($.lat,L.lat);t.setCenter(new W($.lng+Oe*he,$.lat+_e*he).wrap()),t.setZoom(M+nt(V,t.center.lat))}handleMapControlsPan(e,t,n){if(!e.panDelta)return;let i=t.center.lat,o=t.zoom;t.setCenter(kf(e.panDelta,t).wrap()),t.setZoom(o+nt(i,t.center.lat))}cameraForBoxAndBearing(e,t,n,i,o){let a=Ec(e,t,n,i,o),s=t.left/o.width*2-1,l=(o.width-t.right)/o.width*2-1,u=t.top/o.height*-2+1,c=(o.height-t.bottom)/o.height*-2+1,p=bt(n.getWest(),n.getEast())<0,h=p?n.getEast():n.getWest(),m=p?n.getWest():n.getEast(),f=Math.max(n.getNorth(),n.getSouth()),y=Math.min(n.getNorth(),n.getSouth()),g=h+bt(h,m)*.5,_=f+bt(f,y)*.5,x=o.clone();x.setCenter(a.center),x.setBearing(a.bearing),x.setPitch(0),x.setRoll(0),x.setZoom(a.zoom);let b=x.modelViewProjectionMatrix,v=[lt(n.getNorthWest()),lt(n.getNorthEast()),lt(n.getSouthWest()),lt(n.getSouthEast()),lt(new W(m,_)),lt(new W(h,_)),lt(new W(g,f)),lt(new W(g,y))],P=lt(a.center),S=Number.POSITIVE_INFINITY;for(let T of v)s<0&&(S=r.getLesserNonNegativeNonNull(S,r.solveVectorScale(T,P,b,"x",s))),l>0&&(S=r.getLesserNonNegativeNonNull(S,r.solveVectorScale(T,P,b,"x",l))),u>0&&(S=r.getLesserNonNegativeNonNull(S,r.solveVectorScale(T,P,b,"y",u))),c<0&&(S=r.getLesserNonNegativeNonNull(S,r.solveVectorScale(T,P,b,"y",c)));if(!Number.isFinite(S)||S===0){Af();return}return a.zoom=x.zoom+Ge(S),a}handleJumpToCenterZoom(e,t){let n=e.center.lat,i=e.getConstrained(t.center?W.convert(t.center):e.center,e.zoom).center;e.setCenter(i.wrap());let o=typeof t.zoom<"u"?+t.zoom:e.zoom+nt(n,i.lat);e.zoom!==o&&e.setZoom(o)}handleEaseTo(e,t){let n=e.zoom,i=e.center,o=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s=t.roll===void 0?e.roll:t.roll,l=t.pitch===void 0?e.pitch:t.pitch,u=t.bearing===void 0?e.bearing:t.bearing,c={roll:s,pitch:l,bearing:u},p=typeof t.zoom<"u",h=!e.isPaddingEqual(t.padding),m=!1,f=t.center?W.convert(t.center):i,y=e.getConstrained(f,n).center;ho(e,y);let g=e.clone();g.setCenter(y),g.setZoom(p?+t.zoom:n+nt(i.lat,f.lat)),g.setBearing(t.bearing);let _=new Bc.default(ae(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),ae(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));g.setLocationAtPoint(y,_);let x=(t.offset&&t.offsetAsPoint.mag())>0?g.center:y,b=p?+t.zoom:n+nt(i.lat,x.lat),v=n+nt(i.lat,0),P=b+nt(x.lat,0),S=bt(i.lng,x.lng),T=bt(i.lat,x.lat),C=We(P-v);return m=b!==n,{easeFunc:E=>{if(fl(a,c)||Ic({startEulerAngles:a,endEulerAngles:c,tr:e,k:E,useSlerp:a.roll!=c.roll}),h&&e.interpolatePadding(o,t.padding,E),t.around)ue("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(t.around,t.aroundPoint);else{let k=P>v?Math.min(2,C):Math.max(.5,C),R=Math.pow(k,1-E),V=E*R,M=Rf(i,S,T,V);e.setCenter(M.wrap())}if(m){let R=Me.number(v,P,E)+nt(0,e.center.lat);e.setZoom(R)}},isZooming:m,elevationCenter:x}}handleFlyTo(e,t){let n=typeof t.zoom<"u",i=e.center,o=e.zoom,a=e.padding,s=!e.isPaddingEqual(t.padding),l=e.getConstrained(W.convert(t.center||t.locationAtOffset),o).center,u=n?+t.zoom:e.zoom+nt(e.center.lat,l.lat),c=e.clone();c.setCenter(l),c.setZoom(u),c.setBearing(t.bearing);let p=new Bc.default(ae(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),ae(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));c.setLocationAtPoint(l,p);let h=c.center;ho(e,h);let m=_0(e,i,h),f=o+nt(i.lat,0),y=u+nt(h.lat,0),g=We(y-f),_=typeof t.minZoom=="number",x;if(_){let S=+t.minZoom+nt(h.lat,0),C=Math.min(S,f,y)+nt(0,h.lat),E=e.getConstrained(h,C).zoom+nt(h.lat,0);x=We(E-f)}let b=bt(i.lng,h.lng),v=bt(i.lat,h.lat);return{easeFunc:(S,T,C,A)=>{let E=Rf(i,b,v,C);s&&e.interpolatePadding(a,t.padding,S);let k=S===1?h:E;e.setCenter(k.wrap());let R=f+Ge(T);e.setZoom(S===1?u:R+nt(0,k.lat))},scaleOfZoom:g,targetCenter:h,scaleOfMinZoom:x,pixelPathLength:m}}static solveVectorScale(e,t,n,i,o){let a=o,s=i==="x"?[n[0],n[4],n[8],n[12]]:[n[1],n[5],n[9],n[13]],l=[n[3],n[7],n[11],n[15]],u=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],c=e[0]*l[0]+e[1]*l[1]+e[2]*l[2],p=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],h=t[0]*l[0]+t[1]*l[1]+t[2]*l[2],m=(p+s[3]-a*h-a*l[3])/(p-u-a*h+a*c);return p+a*c===u+a*h||l[3]*(u-p)+s[3]*(h-c)+u*h===p*c?null:m}static getLesserNonNegativeNonNull(e,t){return t!==null&&t>=0&&t<e?t:e}};var Ms=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new Xr,this._verticalPerspectiveCameraHelper=new xo}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,n){this.currentHelper.handleMapControlsPan(e,t,n)}cameraForBoxAndBearing(e,t,n,i,o){return this.currentHelper.cameraForBoxAndBearing(e,t,n,i,o)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};function P0(r){if(Array.isArray(r)){let e=new Ss({type:r});return{projection:e,transform:new Ts,cameraHelper:new Ms(e)}}switch(r){case"mercator":return{projection:new yi,transform:new Wr,cameraHelper:new Xr};case"globe":{let e=new Ss({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new Ts,cameraHelper:new Ms(e)}}case"vertical-perspective":return{projection:new yo,transform:new _o,cameraHelper:new xo};default:return ue(`Unknown projection name: ${r}. Falling back to mercator projection.`),{projection:new yi,transform:new Wr,cameraHelper:new Xr}}}var Oc=(r,e)=>hn(r,e&&e.filter(t=>t.identifier!=="source.canvas")),PL=Fg(),bo=class extends xe{constructor(t,n={}){super();this._rtlPluginLoaded=()=>{for(let t in this.sourceCaches){let n=this.sourceCaches[t].getSource().type;(n==="vector"||n==="geojson")&&this.sourceCaches[t].reload()}};this.map=t,this.dispatcher=new is(ns(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(i,o)=>this.getGlyphs(i,o)),this.dispatcher.registerMessageHandler("GI",(i,o)=>this.getImages(i,o)),this.imageManager=new ec,this.imageManager.setEventedParent(this),this.glyphManager=new tc(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new ic(256,512),this.crossTileSymbolIndex=new co,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new Qn,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",xl()),Tn().on(ps,this._rtlPluginLoaded),this.on("data",i=>{if(i.dataType!=="source"||i.sourceDataType!=="metadata")return;let o=this.sourceCaches[i.sourceId];if(!o)return;let a=o.getSource();if(!(!a||!a.vectorLayerIds))for(let s in this._layers){let l=this._layers[s];l.source===a.id&&this._validateLayer(l)}})}setGlobalStateProperty(t,n){this._checkLoaded();let i=n===null?this.stylesheet.state?.[t]?.default??null:n;if(Xt(i,this._globalState[t]))return this;this._globalState[t]=i;let o=this._findGlobalStateAffectedSources([t]);for(let a in this.sourceCaches)o.has(a)&&(this._reloadSource(a),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let n=[];for(let o in t)!Xt(this._globalState[o],t[o].default)&&(n.push(o),this._globalState[o]=t[o].default);let i=this._findGlobalStateAffectedSources(n);for(let o in this.sourceCaches)i.has(o)&&(this._reloadSource(o),this._changed=!0)}_findGlobalStateAffectedSources(t){if(t.length===0)return new Set;let n=new Set;for(let i in this._layers){let o=this._layers[i],a=o.getLayoutAffectingGlobalStateRefs();for(let s of t)a.has(s)&&n.add(o.source)}return n}loadURL(t,n={},i){this.fire(new z("dataloading",{dataType:"style"})),n.validate=typeof n.validate=="boolean"?n.validate:!0;let o=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;let a=this._loadStyleRequest;nn(o,this._loadStyleRequest).then(s=>{this._loadStyleRequest=null,this._load(s.data,n,i)}).catch(s=>{this._loadStyleRequest=null,s&&!a.signal.aborted&&this.fire(new K(s))})}loadJSON(t,n={},i){this.fire(new z("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,re.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,i)}).catch(()=>{})}loadEmpty(){this.fire(new z("dataloading",{dataType:"style"})),this._load(PL,{validate:!1})}_load(t,n,i){let o=n.transformStyle?n.transformStyle(i,t):t;if(!(n.validate&&Oc(this,Ue(o)))){this._loaded=!0,this.stylesheet=o;for(let a in o.sources)this.addSource(a,o.sources[a],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new rc(this.stylesheet.light),this._setProjectionInternal(this.stylesheet.projection?.type||"mercator"),this.sky=new nc(this.stylesheet.sky),this.map.setTerrain(this.stylesheet.terrain??null),this.setGlobalState(this.stylesheet.state??null),this.fire(new z("data",{dataType:"style"})),this.fire(new z("style.load"))}}_createLayers(){let t=pm(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(let n of t){let i=Ju(n);i.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=i}}_loadSprite(t,n=!1,i=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let o;Jx(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(a=>{if(this._spriteRequest=null,a)for(let s in a){this._spritesImagesIds[s]=[];let l=this._spritesImagesIds[s]?this._spritesImagesIds[s].filter(u=>!(u in a)):[];for(let u of l)this.imageManager.removeImage(u),this._changedImages[u]=!0;for(let u in a[s]){let c=s==="default"?u:`${s}:${u}`;this._spritesImagesIds[s].push(c),c in this.imageManager.images?this.imageManager.updateImage(c,a[s][u],!1):this.imageManager.addImage(c,a[s][u]),n&&(this._changedImages[c]=!0)}}}).catch(a=>{this._spriteRequest=null,o=a,this.fire(new K(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"})),i&&i(o)})}_unloadSprite(){for(let t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"}))}_validateLayer(t){let n=this.sourceCaches[t.source];if(!n)return;let i=t.sourceLayer;if(!i)return;let o=n.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(i)===-1)&&this.fire(new K(new Error(`Source layer "${i}" does not exist on source "${o.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,n=!1){let i=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n?dt(i):i);let o=[];for(let a of t)if(i[a]){let s=n?dt(i[a]):i[a];o.push(s)}return o}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};let n=Object.keys(this._layers);for(let i of n){let o=this._layers[i];o.type!=="custom"&&(t[i]=o.serialize())}return t}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;let n=this._changed;if(n){let o=Object.keys(this._updatedLayers),a=Object.keys(this._removedLayers);(o.length||a.length)&&this._updateWorkerLayers(o,a);for(let s in this._updatedSources){let l=this._updatedSources[s];if(l==="reload")this._reloadSource(s);else if(l==="clear")this._clearSource(s);else throw new Error(`Invalid action ${l}`)}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}let i={};for(let o in this.sourceCaches){let a=this.sourceCaches[o];i[o]=a.used,a.used=!1}for(let o of this._order){let a=this._layers[o];a.recalculate(t,this._availableImages),!a.isHidden(t.zoom)&&a.source&&(this.sourceCaches[a.source].used=!0)}for(let o in i){let a=this.sourceCaches[o];!!i[o]!=!!a.used&&a.fire(new z("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,n&&this.fire(new z("data",{dataType:"style"}))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();let i=this.serialize();if(t=n.transformStyle?n.transformStyle(i,t):t,(n.validate??!0)&&Oc(this,Ue(t)))return!1;t=dt(t),t.layers=pm(t.layers);let a=pg(i,t),s=this._getOperationsToPerform(a);if(s.unimplemented.length>0)throw new Error(`Unimplemented: ${s.unimplemented.join(", ")}.`);if(s.operations.length===0)return!1;for(let l of s.operations)l();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){let n=[],i=[];for(let o of t)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":n.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":n.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":n.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":n.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":n.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":n.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":n.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":n.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":n.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":n.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":n.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":n.push(()=>this.setSprite.apply(this,o.args));break;case"setTerrain":n.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setSky":n.push(()=>this.setSky.apply(this,o.args));break;case"setProjection":this.setProjection.apply(this,o.args);break;case"setGlobalState":n.push(()=>this.setGlobalState.apply(this,o.args));break;case"setTransition":n.push(()=>{});break;default:i.push(o.command);break}return{operations:n,unimplemented:i}}addImage(t,n){if(this.getImage(t))return this.fire(new K(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new K(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,i={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(Ue.source,`sources.${t}`,n,null,i))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let s=this.sourceCaches[t]=new Hr(t,n,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:t})),s.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(let i in this._layers)if(this._layers[i].source===t)return this.fire(new K(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));let n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new z("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);let i=this.sourceCaches[t].getSource();if(i.type!=="geojson")throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,i={}){this._checkLoaded();let o=t.id;if(this.getLayer(o)){this.fire(new K(new Error(`Layer "${o}" already exists on this map.`)));return}let a;if(t.type==="custom"){if(Oc(this,Xx(t)))return;a=Ju(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(o,t.source),t=dt(t),t=N(t,{source:o})),this._validate(Ue.layer,`layers.${o}`,t,{arrayIndex:-1},i))return;a=Ju(t),this._validateLayer(a),a.setEventedParent(this,{layer:{id:o}})}let s=n?this._order.indexOf(n):this._order.length;if(n&&s===-1){this.fire(new K(new Error(`Cannot add layer "${o}" before non-existing layer "${n}".`)));return}if(this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=a,this._removedLayers[o]&&a.source&&a.type!=="custom"){let l=this._removedLayers[o];delete this._removedLayers[o],l.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t]){this.fire(new K(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));return}if(t===n)return;let o=this._order.indexOf(t);this._order.splice(o,1);let a=n?this._order.indexOf(n):this._order.length;if(n&&a===-1){this.fire(new K(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`)));return}this._order.splice(a,0,t),this._layerOrderChanged=!0}removeLayer(t){this._checkLoaded();let n=this._layers[t];if(!n){this.fire(new K(new Error(`Cannot remove non-existing layer "${t}".`)));return}n.setEventedParent(null);let i=this._order.indexOf(t);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,i){this._checkLoaded();let o=this.getLayer(t);if(!o){this.fire(new K(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)));return}o.minzoom===n&&o.maxzoom===i||(n!=null&&(o.minzoom=n),i!=null&&(o.maxzoom=i),this._updateLayer(o))}setFilter(t,n,i={}){this._checkLoaded();let o=this.getLayer(t);if(!o){this.fire(new K(new Error(`Cannot filter non-existing layer "${t}".`)));return}if(!Xt(o.filter,n)){if(n==null){o.setFilter(void 0),this._updateLayer(o);return}this._validate(Ue.filter,`layers.${o.id}.filter`,n,null,i)||(o.setFilter(dt(n)),this._updateLayer(o))}}getFilter(t){return dt(this.getLayer(t).filter)}setLayoutProperty(t,n,i,o={}){this._checkLoaded();let a=this.getLayer(t);if(!a){this.fire(new K(new Error(`Cannot style non-existing layer "${t}".`)));return}Xt(a.getLayoutProperty(n),i)||(a.setLayoutProperty(n,i,o),this._updateLayer(a))}getLayoutProperty(t,n){let i=this.getLayer(t);if(!i){this.fire(new K(new Error(`Cannot get style of non-existing layer "${t}".`)));return}return i.getLayoutProperty(n)}setPaintProperty(t,n,i,o={}){this._checkLoaded();let a=this.getLayer(t);if(!a){this.fire(new K(new Error(`Cannot style non-existing layer "${t}".`)));return}if(Xt(a.getPaintProperty(n),i))return;a.setPaintProperty(n,i,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();let i=t.source,o=t.sourceLayer,a=this.sourceCaches[i];if(a===void 0){this.fire(new K(new Error(`The source '${i}' does not exist in the map's style.`)));return}let s=a.getSource().type;if(s==="geojson"&&o){this.fire(new K(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!o){this.fire(new K(new Error("The sourceLayer parameter must be provided for vector source types.")));return}t.id===void 0&&this.fire(new K(new Error("The feature id parameter must be provided."))),a.setFeatureState(o,t.id,n)}removeFeatureState(t,n){this._checkLoaded();let i=t.source,o=this.sourceCaches[i];if(o===void 0){this.fire(new K(new Error(`The source '${i}' does not exist in the map's style.`)));return}let a=o.getSource().type,s=a==="vector"?t.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new K(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(n&&typeof t.id!="string"&&typeof t.id!="number"){this.fire(new K(new Error("A feature id is required to remove its specific state property.")));return}o.removeFeatureState(s,t.id,n)}getFeatureState(t){this._checkLoaded();let n=t.source,i=t.sourceLayer,o=this.sourceCaches[n];if(o===void 0){this.fire(new K(new Error(`The source '${n}' does not exist in the map's style.`)));return}if(o.getSource().type==="vector"&&!i){this.fire(new K(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return t.id===void 0&&this.fire(new K(new Error("The feature id parameter must be provided."))),o.getFeatureState(i,t.id)}getTransition(){return N({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let t=Lo(this.sourceCaches,a=>a.serialize()),n=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,o=this.stylesheet;return ml({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,projection:o.projection,sources:t,layers:n,terrain:i},a=>a!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let n=s=>this._layers[s].type==="fill-extrusion",i={},o=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(n(l)){i[l]=s;for(let u of t){let c=u[l];if(c)for(let p of c)o.push(p)}}}o.sort((s,l)=>l.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(n(l))for(let u=o.length-1;u>=0;u--){let c=o[u].feature;if(i[c.layer.id]<s)break;a.push(c),o.pop()}else for(let u of t){let c=u[l];if(c)for(let p of c)a.push(p.feature)}}return a}queryRenderedFeatures(t,n,i){n&&n.filter&&this._validate(Ue.filter,"queryRenderedFeatures.filter",n.filter,null,n);let o={};if(n&&n.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new K(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(let p of n.layers){let h=this._layers[p];if(!h)return this.fire(new K(new Error(`The layer '${p}' does not exist in the map's style and cannot be queried for features.`))),[];o[h.source]=!0}}let a=[];n.availableImages=this._availableImages;let s=this._serializedAllLayers(),l=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,u={...n,layers:l};for(let c in this.sourceCaches)n.layers&&!o[c]||a.push(ab(this.sourceCaches[c],this._layers,s,t,u,i,this.map.terrain?(p,h,m)=>this.map.terrain.getElevation(p,h,m):void 0));return this.placement&&a.push(sb(this._layers,s,this.sourceCaches,t,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(t,n){n&&n.filter&&this._validate(Ue.filter,"querySourceFeatures.filter",n.filter,null,n);let i=this.sourceCaches[t];return i?lb(i,n):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();let i=this.light.getLight(),o=!1;for(let s in t)if(!Xt(t[s],i[s])){o=!0;break}if(!o)return;let a={now:re.now(),transition:N({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(a)}getProjection(){return this.stylesheet?.projection}setProjection(t){if(this._checkLoaded(),this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=t,this._setProjectionInternal(t.type)}getSky(){return this.stylesheet?.sky}setSky(t,n={}){this._checkLoaded();let i=this.getSky(),o=!1;if(!t&&!i)return;if(t&&!i)o=!0;else if(!t&&i)o=!0;else for(let s in t)if(!Xt(t[s],i[s])){o=!0;break}if(!o)return;let a={now:re.now(),transition:N({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(a)}_setProjectionInternal(t){let n=P0(t);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(let i in this.sourceCaches)this.sourceCaches[i].reload()}_validate(t,n,i,o,a={}){return a&&a.validate===!1?!1:Oc(this,t.call(Ue,N({key:n,style:this.serialize(),value:i,styleSpec:I},o)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Tn().off(ps,this._rtlPluginLoaded);for(let n in this._layers)this._layers[n].setEventedParent(null);for(let n in this.sourceCaches){let i=this.sourceCaches[n];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(let n in this.sourceCaches)this.sourceCaches[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,i,o,a=!1){let s=!1,l=!1,u={};for(let p of this._order){let h=this._layers[p];if(h.type!=="symbol")continue;if(!u[h.source]){let f=this.sourceCaches[h.source];u[h.source]=f.getRenderableIds(!0).map(y=>f.getTileByID(y)).sort((y,g)=>g.tileID.overscaledZ-y.tileID.overscaledZ||(y.tileID.isLessThan(g.tileID)?-1:1))}let m=this.crossTileSymbolIndex.addLayer(h,u[h.source],t.center.lng);s=s||m}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||i===0,(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(re.now(),t.zoom))&&(this.pauseablePlacement=new Cc(t,this.map.terrain,this._order,a,n,i,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,u),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(re.now()),l=!0),s&&this.pauseablePlacement.placement.setStale()),l||s)for(let p of this._order){let h=this._layers[p];h.type==="symbol"&&this.placement.updateLayerOpacities(h,u[h.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(re.now())}_releaseSymbolFadeTiles(){for(let t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}async getImages(t,n){let i=await this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();let o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,n.icons),i}async getGlyphs(t,n){let i=await this.glyphManager.getGlyphs(n.stacks),o=this.sourceCaches[n.source];return o&&o.setDependencies(n.tileID.key,n.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),!(t&&this._validate(Ue.glyphs,"glyphs",t,null,n))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,i={},o){this._checkLoaded();let a=[{id:t,url:n}],s=[...no(this.stylesheet.sprite),...a];this._validate(Ue.sprite,"sprite",s,null,i)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,o))}removeSprite(t){this._checkLoaded();let n=no(this.stylesheet.sprite);if(!n.find(i=>i.id===t)){this.fire(new K(new Error(`Sprite "${t}" doesn't exists on this map.`)));return}if(this._spritesImagesIds[t])for(let i of this._spritesImagesIds[t])this.imageManager.removeImage(i),this._changedImages[i]=!0;n.splice(n.findIndex(i=>i.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"}))}getSprite(){return no(this.stylesheet.sprite)}setSprite(t,n={},i){this._checkLoaded(),!(t&&this._validate(Ue.sprite,"sprite",t,null,n))&&(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,i):(this._unloadSprite(),i&&i(null)))}};d();d();var S0=Ie([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);d();d();var Vc=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,n,i,o,a,s,l,u){this.context=e;let c=this.boundPaintVertexBuffers.length!==i.length;for(let h=0;!c&&h<i.length;h++)this.boundPaintVertexBuffers[h]!==i[h]&&(c=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==n||c||this.boundIndexBuffer!==o||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==u?this.freshBind(t,n,i,o,a,s,l,u):(e.bindVertexArray.set(this.vao),s&&s.bind(),o&&o.dynamicDraw&&o.bind(),l&&l.bind(),u&&u.bind())}freshBind(e,t,n,i,o,a,s,l){let u=e.numAttributes,c=this.context,p=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=i,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=l,t.enableAttributes(p,e);for(let h of n)h.enableAttributes(p,e);a&&a.enableAttributes(p,e),s&&s.enableAttributes(p,e),l&&l.enableAttributes(p,e),t.bind(),t.setVertexAttribPointers(p,e,o);for(let h of n)h.bind(),h.setVertexAttribPointers(p,e,o);a&&(a.bind(),a.setVertexAttribPointers(p,e,o)),i&&i.bind(),s&&(s.bind(),s.setVertexAttribPointers(p,e,o)),l&&(l.bind(),l.setVertexAttribPointers(p,e,o)),c.currentNumAttributes=u}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};d();var T0=(r,e)=>({u_depth:new ee(r,e.u_depth),u_terrain:new ee(r,e.u_terrain),u_terrain_dim:new U(r,e.u_terrain_dim),u_terrain_matrix:new Qe(r,e.u_terrain_matrix),u_terrain_unpack:new gt(r,e.u_terrain_unpack),u_terrain_exaggeration:new U(r,e.u_terrain_exaggeration)}),M0=(r,e)=>({u_texture:new ee(r,e.u_texture),u_ele_delta:new U(r,e.u_ele_delta),u_fog_matrix:new Qe(r,e.u_fog_matrix),u_fog_color:new _t(r,e.u_fog_color),u_fog_ground_blend:new U(r,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new U(r,e.u_fog_ground_blend_opacity),u_horizon_color:new _t(r,e.u_horizon_color),u_horizon_fog_blend:new U(r,e.u_horizon_fog_blend),u_is_globe_mode:new U(r,e.u_is_globe_mode)}),C0=(r,e)=>({u_ele_delta:new U(r,e.u_ele_delta)}),A0=(r,e)=>({u_texture:new ee(r,e.u_texture),u_terrain_coords_id:new U(r,e.u_terrain_coords_id),u_ele_delta:new U(r,e.u_ele_delta)}),I0=(r,e,t,n,i)=>({u_texture:0,u_ele_delta:r,u_fog_matrix:e,u_fog_color:t?t.properties.get("fog-color"):X.white,u_fog_ground_blend:t?t.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:i?0:t?t.calculateFogBlendOpacity(n):0,u_horizon_color:t?t.properties.get("horizon-color"):X.white,u_horizon_fog_blend:t?t.properties.get("horizon-fog-blend"):1,u_is_globe_mode:i?1:0}),E0=r=>({u_ele_delta:r}),L0=(r,e)=>({u_terrain_coords_id:r/255,u_texture:0,u_ele_delta:e});d();var D0=(r,e)=>({u_projection_matrix:new Qe(r,e.u_projection_matrix),u_projection_tile_mercator_coords:new gt(r,e.u_projection_tile_mercator_coords),u_projection_clipping_plane:new gt(r,e.u_projection_clipping_plane),u_projection_transition:new U(r,e.u_projection_transition),u_projection_fallback_matrix:new Qe(r,e.u_projection_fallback_matrix)}),k0={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Uc(r){let e=[];for(let t=0;t<r.length;t++){if(r[t]===null)continue;let n=r[t].split(" ");e.push(n.pop())}return e}var jc=class{constructor(e,t,n,i,o,a,s,l,u=[]){let c=e.gl;this.program=c.createProgram();let p=Uc(t.staticAttributes),h=n?n.getBinderAttributes():[],m=p.concat(h),f=Rt.prelude.staticUniforms?Uc(Rt.prelude.staticUniforms):[],y=s.staticUniforms?Uc(s.staticUniforms):[],g=t.staticUniforms?Uc(t.staticUniforms):[],_=n?n.getBinderUniforms():[],x=f.concat(y).concat(g).concat(_),b=[];for(let E of x)b.indexOf(E)<0&&b.push(E);let v=n?n.defines():[];Ht(c)&&v.unshift("#version 300 es"),o&&v.push("#define OVERDRAW_INSPECTOR;"),a&&v.push("#define TERRAIN3D;"),l&&v.push(l),u&&v.push(...u);let P=v.concat(Rt.prelude.fragmentSource,s.fragmentSource,t.fragmentSource).join(`
743
+ `),S=v.concat(Rt.prelude.vertexSource,s.vertexSource,t.vertexSource).join(`
744
+ `);Ht(c)||(P=l0(P),S=s0(S));let T=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}if(c.shaderSource(T,P),c.compileShader(T),!c.getShaderParameter(T,c.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${c.getShaderInfoLog(T)}`);c.attachShader(this.program,T);let C=c.createShader(c.VERTEX_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}if(c.shaderSource(C,S),c.compileShader(C),!c.getShaderParameter(C,c.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${c.getShaderInfoLog(C)}`);c.attachShader(this.program,C),this.attributes={};let A={};this.numAttributes=m.length;for(let E=0;E<this.numAttributes;E++)m[E]&&(c.bindAttribLocation(this.program,E,m[E]),this.attributes[m[E]]=E);if(c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS))throw new Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`);c.deleteShader(C),c.deleteShader(T);for(let E=0;E<b.length;E++){let k=b[E];if(k&&!A[k]){let R=c.getUniformLocation(this.program,k);R&&(A[k]=R)}}this.fixedUniforms=i(e,A),this.terrainUniforms=T0(e,A),this.projectionUniforms=D0(e,A),this.binderUniforms=n?n.getUniforms(e,A):[]}draw(e,t,n,i,o,a,s,l,u,c,p,h,m,f,y,g,_,x,b){let v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(n),e.setStencilMode(i),e.setColorMode(o),e.setCullFace(a),l){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,l.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,l.texture);for(let S in this.terrainUniforms)this.terrainUniforms[S].set(l[S])}if(u)for(let S in u){let T=k0[S];this.projectionUniforms[T].set(u[S])}if(s)for(let S in this.fixedUniforms)this.fixedUniforms[S].set(s[S]);g&&g.setUniforms(e,this.binderUniforms,f,{zoom:y});let P=0;switch(t){case v.LINES:P=2;break;case v.TRIANGLES:P=3;break;case v.LINE_STRIP:P=1;break}for(let S of m.get()){let T=S.vaos||(S.vaos={});(T[c]||(T[c]=new Vc)).bind(e,this,p,g?g.getPaintVertexBuffers():[],h,S.vertexOffset,_,x,b),v.drawElements(t,S.primitiveLength*P,v.UNSIGNED_SHORT,S.primitiveOffset*P*2)}}};d();d();d();function Nc(r,e,t){let n=1/et(t,1,e.transform.tileZoom),i=Math.pow(2,t.tileID.overscaledZ),o=t.tileSize*Math.pow(2,e.transform.tileZoom)/i,a=o*(t.tileID.canonical.x+t.tileID.wrap*i),s=o*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture.size,u_scale:[n,r.fromScale,r.toScale],u_fade:r.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[a&65535,s&65535]}}function R0(r,e,t,n){let i=t.imageManager.getPattern(r.from.toString()),o=t.imageManager.getPattern(r.to.toString()),{width:a,height:s}=t.imageManager.getPixelSize(),l=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,t.transform.tileZoom)/l,c=u*(n.tileID.canonical.x+n.tileID.wrap*l),p=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/et(n,1,t.transform.tileZoom),u_pixel_coord_upper:[c>>16,p>>16],u_pixel_coord_lower:[c&65535,p&65535]}}var F0=(r,e)=>({u_lightpos:new tt(r,e.u_lightpos),u_lightpos_globe:new tt(r,e.u_lightpos_globe),u_lightintensity:new U(r,e.u_lightintensity),u_lightcolor:new tt(r,e.u_lightcolor),u_vertical_gradient:new U(r,e.u_vertical_gradient),u_opacity:new U(r,e.u_opacity),u_fill_translate:new J(r,e.u_fill_translate)}),z0=(r,e)=>({u_lightpos:new tt(r,e.u_lightpos),u_lightpos_globe:new tt(r,e.u_lightpos_globe),u_lightintensity:new U(r,e.u_lightintensity),u_lightcolor:new tt(r,e.u_lightcolor),u_vertical_gradient:new U(r,e.u_vertical_gradient),u_height_factor:new U(r,e.u_height_factor),u_opacity:new U(r,e.u_opacity),u_fill_translate:new J(r,e.u_fill_translate),u_image:new ee(r,e.u_image),u_texsize:new J(r,e.u_texsize),u_pixel_coord_upper:new J(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new J(r,e.u_pixel_coord_lower),u_scale:new tt(r,e.u_scale),u_fade:new U(r,e.u_fade)}),zf=(r,e,t,n)=>{let i=r.style.light,o=i.properties.get("position"),a=[o.x,o.y,o.z],s=Rr.create();i.properties.get("anchor")==="viewport"&&Rr.fromRotation(s,r.transform.bearingInRadians),O.transformMat3(a,a,s);let l=r.transform.transformLightDirection(a),u=i.properties.get("color");return{u_lightpos:a,u_lightpos_globe:l,u_lightintensity:i.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+e,u_opacity:t,u_fill_translate:n}},B0=(r,e,t,n,i,o,a)=>N(zf(r,e,t,n),Nc(o,r,a),{u_height_factor:-Math.pow(2,i.overscaledZ)/a.tileSize/8});d();var O0=(r,e)=>({u_fill_translate:new J(r,e.u_fill_translate)}),V0=(r,e)=>({u_image:new ee(r,e.u_image),u_texsize:new J(r,e.u_texsize),u_pixel_coord_upper:new J(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new J(r,e.u_pixel_coord_lower),u_scale:new tt(r,e.u_scale),u_fade:new U(r,e.u_fade),u_fill_translate:new J(r,e.u_fill_translate)}),U0=(r,e)=>({u_world:new J(r,e.u_world),u_fill_translate:new J(r,e.u_fill_translate)}),j0=(r,e)=>({u_world:new J(r,e.u_world),u_image:new ee(r,e.u_image),u_texsize:new J(r,e.u_texsize),u_pixel_coord_upper:new J(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new J(r,e.u_pixel_coord_lower),u_scale:new tt(r,e.u_scale),u_fade:new U(r,e.u_fade),u_fill_translate:new J(r,e.u_fill_translate)}),Bf=(r,e,t,n)=>N(Nc(e,r,t),{u_fill_translate:n}),N0=r=>({u_fill_translate:r}),G0=(r,e)=>({u_world:r,u_fill_translate:e}),Z0=(r,e,t,n,i)=>N(Bf(r,e,t,i),{u_world:n});d();var $0=(r,e)=>({u_camera_to_center_distance:new U(r,e.u_camera_to_center_distance),u_scale_with_map:new ee(r,e.u_scale_with_map),u_pitch_with_map:new ee(r,e.u_pitch_with_map),u_extrude_scale:new J(r,e.u_extrude_scale),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_globe_extrude_scale:new U(r,e.u_globe_extrude_scale),u_translate:new J(r,e.u_translate)}),H0=(r,e,t,n,i)=>{let o=r.transform,a,s,l=0;if(t.paint.get("circle-pitch-alignment")==="map"){let u=et(e,1,o.zoom);a=!0,s=[u,u],l=u/(8192*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*i}else a=!1,s=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(t.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+a,u_device_pixel_ratio:r.pixelRatio,u_extrude_scale:s,u_globe_extrude_scale:l,u_translate:n}};d();var q0=(r,e)=>({u_pixel_extrude_scale:new J(r,e.u_pixel_extrude_scale)}),W0=(r,e)=>({u_viewport_size:new J(r,e.u_viewport_size)}),X0=r=>({u_pixel_extrude_scale:[1/r.width,1/r.height]}),Y0=r=>({u_viewport_size:[r.width,r.height]});d();var K0=(r,e)=>({u_color:new _t(r,e.u_color),u_overlay:new ee(r,e.u_overlay),u_overlay_scale:new U(r,e.u_overlay_scale)}),Of=(r,e=1)=>({u_color:r,u_overlay:0,u_overlay_scale:e});d();var J0=(r,e)=>({u_extrude_scale:new U(r,e.u_extrude_scale),u_intensity:new U(r,e.u_intensity),u_globe_extrude_scale:new U(r,e.u_globe_extrude_scale)}),Q0=(r,e)=>({u_matrix:new Qe(r,e.u_matrix),u_world:new J(r,e.u_world),u_image:new ee(r,e.u_image),u_color_ramp:new ee(r,e.u_color_ramp),u_opacity:new U(r,e.u_opacity)}),Vf=(r,e,t,n)=>{let o=et(r,1,e)/(8192*Math.pow(2,r.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:et(r,1,e),u_intensity:t,u_globe_extrude_scale:o}},Uf=(r,e,t,n)=>{let i=F.create();F.ortho(i,0,r.width,r.height,0,0,1);let o=r.context.gl;return{u_matrix:i,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:t,u_color_ramp:n,u_opacity:e.paint.get("heatmap-opacity")}};d();var e1=(r,e)=>({u_image:new ee(r,e.u_image),u_latrange:new J(r,e.u_latrange),u_exaggeration:new U(r,e.u_exaggeration),u_altitudes:new Ra(r,e.u_altitudes),u_azimuths:new Ra(r,e.u_azimuths),u_accent:new _t(r,e.u_accent),u_method:new ee(r,e.u_method),u_shadows:new ka(r,e.u_shadows),u_highlights:new ka(r,e.u_highlights)}),t1=(r,e)=>({u_matrix:new Qe(r,e.u_matrix),u_image:new ee(r,e.u_image),u_dimension:new J(r,e.u_dimension),u_zoom:new U(r,e.u_zoom),u_unpack:new gt(r,e.u_unpack)}),r1=(r,e,t)=>{let n=t.paint.get("hillshade-accent-color"),i;switch(t.paint.get("hillshade-method")){case"basic":i=4;break;case"combined":i=1;break;case"igor":i=2;break;case"multidirectional":i=3;break;case"standard":default:i=0;break}let o=t.getIlluminationProperties();for(let a=0;a<o.directionRadians.length;a++)t.paint.get("hillshade-illumination-anchor")==="viewport"&&(o.directionRadians[a]+=r.transform.bearingInRadians);return{u_image:0,u_latrange:SL(r,e.tileID),u_exaggeration:t.paint.get("hillshade-exaggeration"),u_altitudes:o.altitudeRadians,u_azimuths:o.directionRadians,u_accent:n,u_method:i,u_highlights:o.highlightColor,u_shadows:o.shadowColor}},n1=(r,e)=>{let t=e.stride,n=F.create();return F.ortho(n,0,8192,-8192,0,0,1),F.translate(n,n,[0,-8192,0]),{u_matrix:n,u_image:1,u_dimension:[t,t],u_zoom:r.overscaledZ,u_unpack:e.getUnpackVector()}};function SL(r,e){let t=Math.pow(2,e.canonical.z),n=e.canonical.y;return[new fe(0,n/t).toLngLat().lat,new fe(0,(n+1)/t).toLngLat().lat]}d();var i1=(r,e)=>({u_image:new ee(r,e.u_image),u_unpack:new gt(r,e.u_unpack),u_dimension:new J(r,e.u_dimension),u_elevation_stops:new ee(r,e.u_elevation_stops),u_color_stops:new ee(r,e.u_color_stops),u_opacity:new U(r,e.u_opacity)}),o1=(r,e)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_opacity:r.paint.get("color-relief-opacity")});d();var a1=(r,e)=>({u_translation:new J(r,e.u_translation),u_ratio:new U(r,e.u_ratio),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_units_to_pixels:new J(r,e.u_units_to_pixels)}),s1=(r,e)=>({u_translation:new J(r,e.u_translation),u_ratio:new U(r,e.u_ratio),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_units_to_pixels:new J(r,e.u_units_to_pixels),u_image:new ee(r,e.u_image),u_image_height:new U(r,e.u_image_height)}),l1=(r,e)=>({u_translation:new J(r,e.u_translation),u_texsize:new J(r,e.u_texsize),u_ratio:new U(r,e.u_ratio),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_image:new ee(r,e.u_image),u_units_to_pixels:new J(r,e.u_units_to_pixels),u_scale:new tt(r,e.u_scale),u_fade:new U(r,e.u_fade)}),u1=(r,e)=>({u_translation:new J(r,e.u_translation),u_ratio:new U(r,e.u_ratio),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_units_to_pixels:new J(r,e.u_units_to_pixels),u_patternscale_a:new J(r,e.u_patternscale_a),u_patternscale_b:new J(r,e.u_patternscale_b),u_sdfgamma:new U(r,e.u_sdfgamma),u_image:new ee(r,e.u_image),u_tex_y_a:new U(r,e.u_tex_y_a),u_tex_y_b:new U(r,e.u_tex_y_b),u_mix:new U(r,e.u_mix)}),Gc=(r,e,t,n)=>{let i=r.transform;return{u_translation:f1(r,e,t),u_ratio:n/et(e,1,i.zoom),u_device_pixel_ratio:r.pixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},c1=(r,e,t,n,i)=>N(Gc(r,e,t,n),{u_image:0,u_image_height:i}),p1=(r,e,t,n,i)=>{let o=r.transform,a=m1(e,o);return{u_translation:f1(r,e,t),u_texsize:e.imageAtlasTexture.size,u_ratio:n/et(e,1,o.zoom),u_device_pixel_ratio:r.pixelRatio,u_image:0,u_scale:[a,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},h1=(r,e,t,n,i,o)=>{let a=r.transform,s=r.lineAtlas,l=m1(e,a),u=t.layout.get("line-cap")==="round",c=s.getDash(i.from,u),p=s.getDash(i.to,u),h=c.width*o.fromScale,m=p.width*o.toScale;return N(Gc(r,e,t,n),{u_patternscale_a:[l/h,-c.height/2],u_patternscale_b:[l/m,-p.height/2],u_sdfgamma:s.width/(Math.min(h,m)*256*r.pixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:p.y,u_mix:o.t})};function m1(r,e){return 1/et(r,1,e.tileZoom)}function f1(r,e,t){return Tt(r.transform,e,t.paint.get("line-translate"),t.paint.get("line-translate-anchor"))}d();var d1=(r,e)=>({u_tl_parent:new J(r,e.u_tl_parent),u_scale_parent:new U(r,e.u_scale_parent),u_buffer_scale:new U(r,e.u_buffer_scale),u_fade_t:new U(r,e.u_fade_t),u_opacity:new U(r,e.u_opacity),u_image0:new ee(r,e.u_image0),u_image1:new ee(r,e.u_image1),u_brightness_low:new U(r,e.u_brightness_low),u_brightness_high:new U(r,e.u_brightness_high),u_saturation_factor:new U(r,e.u_saturation_factor),u_contrast_factor:new U(r,e.u_contrast_factor),u_spin_weights:new tt(r,e.u_spin_weights),u_coords_top:new gt(r,e.u_coords_top),u_coords_bottom:new gt(r,e.u_coords_bottom)}),y1=(r,e,t,n,i)=>({u_tl_parent:r,u_scale_parent:e,u_buffer_scale:1,u_fade_t:t.mix,u_opacity:t.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:CL(n.paint.get("raster-saturation")),u_contrast_factor:ML(n.paint.get("raster-contrast")),u_spin_weights:TL(n.paint.get("raster-hue-rotate")),u_coords_top:[i[0].x,i[0].y,i[1].x,i[1].y],u_coords_bottom:[i[3].x,i[3].y,i[2].x,i[2].y]});function TL(r){r*=Math.PI/180;let e=Math.sin(r),t=Math.cos(r);return[(2*t+1)/3,(-Math.sqrt(3)*e-t+1)/3,(Math.sqrt(3)*e-t+1)/3]}function ML(r){return r>0?1/(1-r):1+r}function CL(r){return r>0?1-1/(1.001-r):-r}d();var g1=(r,e)=>({u_is_size_zoom_constant:new ee(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new ee(r,e.u_is_size_feature_constant),u_size_t:new U(r,e.u_size_t),u_size:new U(r,e.u_size),u_camera_to_center_distance:new U(r,e.u_camera_to_center_distance),u_pitch:new U(r,e.u_pitch),u_rotate_symbol:new ee(r,e.u_rotate_symbol),u_aspect_ratio:new U(r,e.u_aspect_ratio),u_fade_change:new U(r,e.u_fade_change),u_label_plane_matrix:new Qe(r,e.u_label_plane_matrix),u_coord_matrix:new Qe(r,e.u_coord_matrix),u_is_text:new ee(r,e.u_is_text),u_pitch_with_map:new ee(r,e.u_pitch_with_map),u_is_along_line:new ee(r,e.u_is_along_line),u_is_variable_anchor:new ee(r,e.u_is_variable_anchor),u_texsize:new J(r,e.u_texsize),u_texture:new ee(r,e.u_texture),u_translation:new J(r,e.u_translation),u_pitched_scale:new U(r,e.u_pitched_scale)}),_1=(r,e)=>({u_is_size_zoom_constant:new ee(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new ee(r,e.u_is_size_feature_constant),u_size_t:new U(r,e.u_size_t),u_size:new U(r,e.u_size),u_camera_to_center_distance:new U(r,e.u_camera_to_center_distance),u_pitch:new U(r,e.u_pitch),u_rotate_symbol:new ee(r,e.u_rotate_symbol),u_aspect_ratio:new U(r,e.u_aspect_ratio),u_fade_change:new U(r,e.u_fade_change),u_label_plane_matrix:new Qe(r,e.u_label_plane_matrix),u_coord_matrix:new Qe(r,e.u_coord_matrix),u_is_text:new ee(r,e.u_is_text),u_pitch_with_map:new ee(r,e.u_pitch_with_map),u_is_along_line:new ee(r,e.u_is_along_line),u_is_variable_anchor:new ee(r,e.u_is_variable_anchor),u_texsize:new J(r,e.u_texsize),u_texture:new ee(r,e.u_texture),u_gamma_scale:new U(r,e.u_gamma_scale),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_is_halo:new ee(r,e.u_is_halo),u_translation:new J(r,e.u_translation),u_pitched_scale:new U(r,e.u_pitched_scale)}),x1=(r,e)=>({u_is_size_zoom_constant:new ee(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new ee(r,e.u_is_size_feature_constant),u_size_t:new U(r,e.u_size_t),u_size:new U(r,e.u_size),u_camera_to_center_distance:new U(r,e.u_camera_to_center_distance),u_pitch:new U(r,e.u_pitch),u_rotate_symbol:new ee(r,e.u_rotate_symbol),u_aspect_ratio:new U(r,e.u_aspect_ratio),u_fade_change:new U(r,e.u_fade_change),u_label_plane_matrix:new Qe(r,e.u_label_plane_matrix),u_coord_matrix:new Qe(r,e.u_coord_matrix),u_is_text:new ee(r,e.u_is_text),u_pitch_with_map:new ee(r,e.u_pitch_with_map),u_is_along_line:new ee(r,e.u_is_along_line),u_is_variable_anchor:new ee(r,e.u_is_variable_anchor),u_texsize:new J(r,e.u_texsize),u_texsize_icon:new J(r,e.u_texsize_icon),u_texture:new ee(r,e.u_texture),u_texture_icon:new ee(r,e.u_texture_icon),u_gamma_scale:new U(r,e.u_gamma_scale),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_is_halo:new ee(r,e.u_is_halo),u_translation:new J(r,e.u_translation),u_pitched_scale:new U(r,e.u_pitched_scale)}),jf=(r,e,t,n,i,o,a,s,l,u,c,p,h)=>{let m=a.transform;return{u_is_size_zoom_constant:+(r==="constant"||r==="source"),u_is_size_feature_constant:+(r==="constant"||r==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:m.cameraToCenterDistance,u_pitch:m.pitch/360*2*Math.PI,u_rotate_symbol:+t,u_aspect_ratio:m.width/m.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+n,u_is_along_line:i,u_is_variable_anchor:o,u_texsize:p,u_texture:0,u_translation:u,u_pitched_scale:h}},Nf=(r,e,t,n,i,o,a,s,l,u,c,p,h,m)=>{let f=a.transform;return N(jf(r,e,t,n,i,o,a,s,l,u,c,p,m),{u_gamma_scale:n?Math.cos(f.pitch*Math.PI/180)*f.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:+h})},b1=(r,e,t,n,i,o,a,s,l,u,c,p,h)=>N(Nf(r,e,t,n,i,o,a,s,l,u,!0,c,!0,h),{u_texsize_icon:p,u_texture_icon:1});d();var v1=(r,e)=>({u_opacity:new U(r,e.u_opacity),u_color:new _t(r,e.u_color)}),w1=(r,e)=>({u_opacity:new U(r,e.u_opacity),u_image:new ee(r,e.u_image),u_pattern_tl_a:new J(r,e.u_pattern_tl_a),u_pattern_br_a:new J(r,e.u_pattern_br_a),u_pattern_tl_b:new J(r,e.u_pattern_tl_b),u_pattern_br_b:new J(r,e.u_pattern_br_b),u_texsize:new J(r,e.u_texsize),u_mix:new U(r,e.u_mix),u_pattern_size_a:new J(r,e.u_pattern_size_a),u_pattern_size_b:new J(r,e.u_pattern_size_b),u_scale_a:new U(r,e.u_scale_a),u_scale_b:new U(r,e.u_scale_b),u_pixel_coord_upper:new J(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new J(r,e.u_pixel_coord_lower),u_tile_units_to_pixels:new U(r,e.u_tile_units_to_pixels)}),P1=(r,e)=>({u_opacity:r,u_color:e}),S1=(r,e,t,n,i)=>N(R0(t,i,e,n),{u_opacity:r});d();var T1=(r,e)=>({u_sun_pos:new tt(r,e.u_sun_pos),u_atmosphere_blend:new U(r,e.u_atmosphere_blend),u_globe_position:new tt(r,e.u_globe_position),u_globe_radius:new U(r,e.u_globe_radius),u_inv_proj_matrix:new Qe(r,e.u_inv_proj_matrix)}),M1=(r,e,t,n,i)=>({u_sun_pos:r,u_atmosphere_blend:e,u_globe_position:t,u_globe_radius:n,u_inv_proj_matrix:i});d();var C1=(r,e)=>({u_sky_color:new _t(r,e.u_sky_color),u_horizon_color:new _t(r,e.u_horizon_color),u_horizon:new J(r,e.u_horizon),u_horizon_normal:new J(r,e.u_horizon_normal),u_sky_horizon_blend:new U(r,e.u_sky_horizon_blend),u_sky_blend:new U(r,e.u_sky_blend)}),A1=(r,e,t)=>{let n=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),o=lo(e),s=e.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:r.properties.get("sky-color"),u_horizon_color:r.properties.get("horizon-color"),u_horizon:[(e.width/2-o*i)*t,(e.height/2+o*n)*t],u_horizon_normal:[-i,n],u_sky_horizon_blend:r.properties.get("sky-horizon-blend")*e.height/2*t,u_sky_blend:s}};var I1=(r,e)=>{},E1={fillExtrusion:F0,fillExtrusionPattern:z0,fill:O0,fillPattern:V0,fillOutline:U0,fillOutlinePattern:j0,circle:$0,collisionBox:q0,collisionCircle:W0,debug:K0,depth:I1,clippingMask:I1,heatmap:J0,heatmapTexture:Q0,hillshade:e1,hillshadePrepare:t1,colorRelief:i1,line:a1,lineGradient:s1,linePattern:l1,lineSDF:u1,raster:d1,symbolIcon:g1,symbolSDF:_1,symbolTextAndIcon:x1,background:v1,backgroundPattern:w1,terrain:M0,terrainDepth:C0,terrainCoords:A0,projectionErrorMeasurement:h0,atmosphere:T1,sky:C1};d();d();var Zc=class{constructor(e,t,n){this.context=e;let i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!n,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)}};d();var AL={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},$c=class{constructor(e,t,n,i){this.length=t.length,this.attributes=n,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,this.context=e;let o=e.gl;this.buffer=o.createBuffer(),e.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.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 n=0;n<this.attributes.length;n++){let i=this.attributes[n],o=t.attributes[i.name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,t,n){for(let i=0;i<this.attributes.length;i++){let o=this.attributes[i],a=t.attributes[o.name];a!==void 0&&e.vertexAttribPointer(a,o.components,e[AL[o.type]],!1,this.itemSize,o.offset+this.itemSize*(n||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};d();d();var Ce=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)}},Hc=class extends Ce{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)}},qc=class extends Ce{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},Wc=class extends Ce{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},Xc=class extends Ce{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)}},Yc=class extends Ce{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},Kc=class extends Ce{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},Jc=class extends Ce{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)}},Qc=class extends Ce{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)}},ep=class extends Ce{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}},tp=class extends Ce{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)}},rp=class extends Ce{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}},np=class extends Ce{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},ip=class extends Ce{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}},op=class extends Ce{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)}},ap=class extends Ce{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)}},sp=class extends Ce{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},lp=class extends Ce{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}},up=class extends Ce{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},cp=class extends Ce{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},pp=class extends Ce{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},hp=class extends Ce{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},mp=class extends Ce{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)}},fp=class extends Ce{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}},dp=class extends Ce{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}},yp=class extends Ce{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}},gp=class extends Ce{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}},_p=class extends Ce{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},xp=class extends Ce{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;Ht(t)?t.bindVertexArray(e):t.getExtension("OES_vertex_array_object")?.bindVertexArrayOES(e),this.current=e,this.dirty=!1}},bp=class extends Ce{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}},vp=class extends Ce{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}},wp=class extends Ce{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}},Cs=class extends Ce{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},Pp=class extends Cs{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}},Sp=class extends Cs{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}},Tp=class extends Cs{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}};d();var L1="Framebuffer is not complete";function D1(r){return r.message===L1}function k1(){return new Error(L1)}var Mp=class{constructor(e,t,n,i,o){this.context=e,this.width=t,this.height=n;let a=e.gl,s=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new Pp(e,s),i)this.depthAttachment=o?new Tp(e,s):new Sp(e,s);else if(o)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw k1()}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let n=this.depthAttachment.get();n&&e.deleteRenderbuffer(n)}e.deleteFramebuffer(this.framebuffer)}};var Cp=class{constructor(e){if(this.gl=e,this.clearColor=new Hc(this),this.clearDepth=new qc(this),this.clearStencil=new Wc(this),this.colorMask=new Xc(this),this.depthMask=new Yc(this),this.stencilMask=new Kc(this),this.stencilFunc=new Jc(this),this.stencilOp=new Qc(this),this.stencilTest=new ep(this),this.depthRange=new tp(this),this.depthTest=new rp(this),this.depthFunc=new np(this),this.blend=new ip(this),this.blendFunc=new op(this),this.blendColor=new ap(this),this.blendEquation=new sp(this),this.cullFace=new lp(this),this.cullFaceSide=new up(this),this.frontFace=new cp(this),this.program=new pp(this),this.activeTexture=new hp(this),this.viewport=new mp(this),this.bindFramebuffer=new fp(this),this.bindRenderbuffer=new dp(this),this.bindTexture=new yp(this),this.bindVertexBuffer=new gp(this),this.bindElementBuffer=new _p(this),this.bindVertexArray=new xp(this),this.pixelStoreUnpack=new bp(this),this.pixelStoreUnpackPremultiplyAlpha=new vp(this),this.pixelStoreUnpackFlipY=new wp(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),Ht(e)){this.HALF_FLOAT=e.HALF_FLOAT;let t=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=e.RGBA16F??t?.RGBA16F_EXT,this.RGB16F=e.RGB16F??t?.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=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 Zc(this,e,t)}createVertexBuffer(e,t,n){return new $c(this,e,t,n)}createRenderbuffer(e,t,n){let i=this.gl,o=i.createRenderbuffer();return this.bindRenderbuffer.set(o),i.renderbufferStorage(i.RENDERBUFFER,e,t,n),this.bindRenderbuffer.set(null),o}createFramebuffer(e,t,n,i){return new Mp(this,e,t,n,i)}clear({color:e,depth:t,stencil:n}){let i=this.gl,o=0;e&&(o|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),typeof t<"u"&&(o|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),typeof n<"u"&&(o|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),i.clear(o)}setCullFace(e){e.enable===!1?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(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(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}))}setColorMode(e){Xt(e.blendFunction,Te.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(){return Ht(this.gl)?this.gl.createVertexArray():this.gl.getExtension("OES_vertex_array_object")?.createVertexArrayOES()}deleteVertexArray(e){return Ht(this.gl)?this.gl.deleteVertexArray(e):this.gl.getExtension("OES_vertex_array_object")?.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}};d();var Ip=ie(le(),1);d();var Ap;function Gf(r,e,t,n,i){let o=r.context,a=r.transform,s=o.gl,l=r.useProgram("collisionBox"),u=[],c=0,p=0;for(let _=0;_<n.length;_++){let x=n[_],v=e.getTile(x).getBucket(t);if(!v)continue;let P=i?v.textCollisionBox:v.iconCollisionBox,S=v.collisionCircleArray;S.length>0&&(u.push({circleArray:S,circleOffset:p,coord:x}),c+=S.length/4,p=c),P&&l.draw(o,s.LINES,te.disabled,se.disabled,r.colorModeForRenderPass(),ne.disabled,X0(r.transform),r.style.map.terrain&&r.style.map.terrain.getTerrainData(x),a.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),t.id,P.layoutVertexBuffer,P.indexBuffer,P.segments,null,r.transform.zoom,null,null,P.collisionVertexBuffer)}if(!i||!u.length)return;let h=r.useProgram("collisionCircle"),m=new gu;m.resize(c*4),m._trim();let f=0;for(let _ of u)for(let x=0;x<_.circleArray.length/4;x++){let b=x*4,v=_.circleArray[b+0],P=_.circleArray[b+1],S=_.circleArray[b+2],T=_.circleArray[b+3];m.emplace(f++,v,P,S,T,0),m.emplace(f++,v,P,S,T,1),m.emplace(f++,v,P,S,T,2),m.emplace(f++,v,P,S,T,3)}(!Ap||Ap.length<c*2)&&(Ap=IL(c));let y=o.createIndexBuffer(Ap,!0),g=o.createVertexBuffer(m,wx.members,!0);for(let _ of u){let x=Y0(r.transform);h.draw(o,s.TRIANGLES,te.disabled,se.disabled,r.colorModeForRenderPass(),ne.disabled,x,r.style.map.terrain&&r.style.map.terrain.getTerrainData(_.coord),null,t.id,g,y,pe.simpleSegment(0,_.circleOffset*2,_.circleArray.length,_.circleArray.length/2),null,r.transform.zoom,null,null,null)}g.destroy(),y.destroy()}function IL(r){let e=r*2,t=new xu;t.resize(e),t._trim();for(let n=0;n<e;n++){let i=n*6;t.uint16[i+0]=n*4+0,t.uint16[i+1]=n*4+1,t.uint16[i+2]=n*4+2,t.uint16[i+3]=n*4+2,t.uint16[i+4]=n*4+3,t.uint16[i+5]=n*4+0}return t}var EL=F.identity(new Float32Array(16));function z1(r,e,t,n,i,o){if(r.renderPass!=="translucent")return;let{isRenderingToTexture:a}=o,s=se.disabled,l=r.colorModeForRenderPass();(t._unevaluatedLayout.hasValue("text-variable-anchor")||t._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&DL(n,r,t,e,t.layout.get("text-rotation-alignment"),t.layout.get("text-pitch-alignment"),t.paint.get("text-translate"),t.paint.get("text-translate-anchor"),i),t.paint.get("icon-opacity").constantOr(1)!==0&&R1(r,e,t,n,!1,t.paint.get("icon-translate"),t.paint.get("icon-translate-anchor"),t.layout.get("icon-rotation-alignment"),t.layout.get("icon-pitch-alignment"),t.layout.get("icon-keep-upright"),s,l,a),t.paint.get("text-opacity").constantOr(1)!==0&&R1(r,e,t,n,!0,t.paint.get("text-translate"),t.paint.get("text-translate-anchor"),t.layout.get("text-rotation-alignment"),t.layout.get("text-pitch-alignment"),t.layout.get("text-keep-upright"),s,l,a),e.map.showCollisionBoxes&&(Gf(r,e,t,n,!0),Gf(r,e,t,n,!1))}function LL(r,e,t,n,i,o){let{horizontalAlign:a,verticalAlign:s}=Zu(r),l=-(a-.5)*e,u=-(s-.5)*t;return new Ip.default((l/i+n[0])*o,(u/i+n[1])*o)}function DL(r,e,t,n,i,o,a,s,l){let u=e.transform,c=e.style.map.terrain,p=i==="map",h=o==="map";for(let m of r){let f=n.getTile(m),y=f.getBucket(t);if(!y||!y.text||!y.text.segments.get().length)continue;let g=y.textSizeData,_=ui(g,u.zoom),x=et(f,1,e.transform.zoom),b=fs(p,e.transform,x),v=t.layout.get("icon-text-fit")!=="none"&&y.hasIconData();if(_){let P=Math.pow(2,u.zoom-f.tileID.overscaledZ),S=c?(C,A)=>c.getElevation(m,C,A):null,T=Tt(u,f,a,s);RL(y,p,h,l,u,b,P,_,v,T,m.toUnwrapped(),S)}}}function kL(r,e,t,n,i,o){let a=e.tileAnchorPoint.add(new Ip.default(e.translation[0],e.translation[1]));if(e.pitchWithMap){let s=n.mult(o);t||(s=s.rotate(-i));let l=a.add(s);return wc(l.x,l.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}else if(t){let l=In(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(r),u=Math.atan(l.y/l.x)+(l.x<0?Math.PI:0);return r.add(n.rotate(u))}else return r.add(n)}function RL(r,e,t,n,i,o,a,s,l,u,c,p){let h=r.text.placedSymbolArray,m=r.text.dynamicLayoutVertexArray,f=r.icon.dynamicLayoutVertexArray,y={};m.clear();for(let g=0;g<h.length;g++){let _=h.get(g),x=r.allowVerticalPlacement&&!_.placedOrientation,b=!_.hidden&&_.crossTileID&&!x?n[_.crossTileID]:null;if(!b)fi(_.numGlyphs,m);else{let v=new Ip.default(_.anchorX,_.anchorY),P={getElevation:p,width:i.width,height:i.height,pitchedLabelPlaneMatrix:o,lineVertexArray:null,pitchWithMap:t,transform:i,projectionCache:null,tileAnchorPoint:v,translation:u,unwrappedTileID:c},S=t?ff(v.x,v.y,P):In(v.x,v.y,P),T=hf(i.cameraToCenterDistance,S.signedDistanceFromCamera),C=to(r.textSizeData,s,_)*T/vn;t&&(C*=r.tilePixelRatio/a);let{width:A,height:E,anchor:k,textOffset:R,textBoxScale:V}=b,M=LL(k,A,E,R,V,C),L=i.getPitchedTextCorrection(v.x+u[0],v.y+u[1],c),$=kL(S.point,P,e,M,-i.bearingInRadians,L),q=r.allowVerticalPlacement&&_.placedOrientation===2?Math.PI/2:0;for(let Y=0;Y<_.numGlyphs;Y++)ci(m,$,q);l&&_.associatedIconIndex>=0&&(y[_.associatedIconIndex]={shiftedAnchor:$,angle:q})}}if(l){f.clear();let g=r.icon.placedSymbolArray;for(let _=0;_<g.length;_++){let x=g.get(_);if(x.hidden)fi(x.numGlyphs,f);else{let b=y[_];if(!b)fi(x.numGlyphs,f);else for(let v=0;v<x.numGlyphs;v++)ci(f,b.shiftedAnchor,b.angle)}}r.icon.dynamicLayoutVertexBuffer.updateData(f)}r.text.dynamicLayoutVertexBuffer.updateData(m)}function FL(r,e,t){return t.iconsInText&&e?"symbolTextAndIcon":r?"symbolSDF":"symbolIcon"}function R1(r,e,t,n,i,o,a,s,l,u,c,p,h){let m=r.context,f=m.gl,y=r.transform,g=s==="map",_=l==="map",x=s!=="viewport"&&t.layout.get("symbol-placement")!=="point",b=g&&!_&&!x,v=!t.layout.get("symbol-sort-key").isConstant(),P=!1,S=r.getDepthModeForSublayer(0,te.ReadOnly),T=t._unevaluatedLayout.hasValue("text-variable-anchor")||t._unevaluatedLayout.hasValue("text-variable-anchor-offset"),C=[],A=y.getCircleRadiusCorrection();for(let E of n){let k=e.getTile(E),R=k.getBucket(t);if(!R)continue;let V=i?R.text:R.icon;if(!V||!V.segments.get().length||!V.hasVisibleVertices)continue;let M=V.programConfigurations.get(t.id),L=i||R.sdfIcons,$=i?R.textSizeData:R.iconSizeData,q=_||y.pitch!==0,Y=r.useProgram(FL(L,i,R),M),he=ui($,y.zoom),Oe=r.style.map.terrain&&r.style.map.terrain.getTerrainData(E),_e,de=[0,0],He,st,xt=null,ut;if(i){if(He=k.glyphAtlasTexture,st=f.LINEAR,_e=k.glyphAtlasTexture.size,R.iconsInText){de=k.imageAtlasTexture.size,xt=k.imageAtlasTexture;let ct=$.kind==="composite"||$.kind==="camera";ut=q||r.options.rotating||r.options.zooming||ct?f.LINEAR:f.NEAREST}}else{let ct=t.layout.get("icon-size").constantOr(0)!==1||R.iconsNeedLinear;He=k.imageAtlasTexture,st=L||r.options.rotating||r.options.zooming||ct||q?f.LINEAR:f.NEAREST,_e=k.imageAtlasTexture.size}let qt=et(k,1,r.transform.zoom),yr=fs(g,r.transform,qt),Jr=F.create();F.invert(Jr,yr);let ir=Rb(_,g,r.transform,qt),gr=Tt(y,k,o,a),el=y.getProjectionData({overscaledTileID:E,applyGlobeMatrix:!h,applyTerrainMatrix:!0}),lh=T&&R.hasTextData(),uh=t.layout.get("icon-text-fit")!=="none"&&lh&&R.hasIconData();if(x){let ct=r.style.map.terrain?(Fn,wi)=>r.style.map.terrain.getElevation(E,Fn,wi):null,Wt=t.layout.get("text-rotation-alignment")==="map";Fb(R,r,i,yr,Jr,_,u,Wt,E.toUnwrapped(),y.width,y.height,gr,ct)}let bi=i&&T||uh,ch=_?yr:r.transform.clipSpaceToPixelsMatrix,_r=x||bi?EL:ch,vi=L&&t.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1)!==0,kr;L?R.iconsInText?kr=b1($.kind,he,b,_,x,bi,r,_r,ir,gr,_e,de,A):kr=Nf($.kind,he,b,_,x,bi,r,_r,ir,gr,i,_e,!0,A):kr=jf($.kind,he,b,_,x,bi,r,_r,ir,gr,i,_e,A);let mt={program:Y,buffers:V,uniformValues:kr,projectionData:el,atlasTexture:He,atlasTextureIcon:xt,atlasInterpolation:st,atlasInterpolationIcon:ut,isSDF:L,hasHalo:vi};if(v&&R.canOverlap){P=!0;let ct=V.segments.get();for(let Wt of ct)C.push({segments:new pe([Wt]),sortKey:Wt.sortKey,state:mt,terrainData:Oe})}else C.push({segments:V.segments,sortKey:0,state:mt,terrainData:Oe})}P&&C.sort((E,k)=>E.sortKey-k.sortKey);for(let E of C){let k=E.state;if(m.activeTexture.set(f.TEXTURE0),k.atlasTexture.bind(k.atlasInterpolation,f.CLAMP_TO_EDGE),k.atlasTextureIcon&&(m.activeTexture.set(f.TEXTURE1),k.atlasTextureIcon&&k.atlasTextureIcon.bind(k.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),k.isSDF){let R=k.uniformValues;k.hasHalo&&(R.u_is_halo=1,F1(k.buffers,E.segments,t,r,k.program,S,c,p,R,k.projectionData,E.terrainData)),R.u_is_halo=0}F1(k.buffers,E.segments,t,r,k.program,S,c,p,k.uniformValues,k.projectionData,E.terrainData)}}function F1(r,e,t,n,i,o,a,s,l,u,c){let p=n.context,h=p.gl;i.draw(p,h.TRIANGLES,o,a,s,ne.backCCW,l,c,u,t.id,r.layoutVertexBuffer,r.indexBuffer,e,t.paint,n.transform.zoom,r.programConfigurations.get(t.id),r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer)}d();function B1(r,e,t,n,i){if(r.renderPass!=="translucent")return;let{isRenderingToTexture:o}=i,a=t.paint.get("circle-opacity"),s=t.paint.get("circle-stroke-width"),l=t.paint.get("circle-stroke-opacity"),u=!t.layout.get("circle-sort-key").isConstant();if(a.constantOr(1)===0&&(s.constantOr(1)===0||l.constantOr(1)===0))return;let c=r.context,p=c.gl,h=r.transform,m=r.getDepthModeForSublayer(0,te.ReadOnly),f=se.disabled,y=r.colorModeForRenderPass(),g=[],_=h.getCircleRadiusCorrection();for(let x=0;x<n.length;x++){let b=n[x],v=e.getTile(b),P=v.getBucket(t);if(!P)continue;let S=t.paint.get("circle-translate"),T=t.paint.get("circle-translate-anchor"),C=Tt(h,v,S,T),A=P.programConfigurations.get(t.id),E=r.useProgram("circle",A),k=P.layoutVertexBuffer,R=P.indexBuffer,V=r.style.map.terrain&&r.style.map.terrain.getTerrainData(b),M=H0(r,v,t,C,_),L=h.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),$={programConfiguration:A,program:E,layoutVertexBuffer:k,indexBuffer:R,uniformValues:M,terrainData:V,projectionData:L};if(u){let q=P.segments.get();for(let Y of q)g.push({segments:new pe([Y]),sortKey:Y.sortKey,state:$})}else g.push({segments:P.segments,sortKey:0,state:$})}u&&g.sort((x,b)=>x.sortKey-b.sortKey);for(let x of g){let{programConfiguration:b,program:v,layoutVertexBuffer:P,indexBuffer:S,uniformValues:T,terrainData:C,projectionData:A}=x.state,E=x.segments;v.draw(c,p.TRIANGLES,m,f,y,ne.backCCW,T,C,A,t.id,P,S,E,t.paint,r.transform.zoom,b)}}d();function O1(r,e,t,n,i){if(t.paint.get("heatmap-opacity")===0)return;let o=r.context,{isRenderingToTexture:a,isRenderingGlobe:s}=i;if(r.style.map.terrain){for(let l of n){let u=e.getTile(l);e.hasRenderableParent(l)||(r.renderPass==="offscreen"?OL(r,u,t,l,s):r.renderPass==="translucent"&&VL(r,t,l,a,s))}o.viewport.set([0,0,r.width,r.height])}else r.renderPass==="offscreen"?zL(r,e,t,n):r.renderPass==="translucent"&&BL(r,t)}function zL(r,e,t,n){let i=r.context,o=i.gl,a=r.transform,s=se.disabled,l=new Te([o.ONE,o.ONE],X.transparent,[!0,!0,!0,!0]);UL(i,r,t),i.clear({color:X.transparent});for(let u=0;u<n.length;u++){let c=n[u];if(e.hasRenderableParent(c))continue;let p=e.getTile(c),h=p.getBucket(t);if(!h)continue;let m=h.programConfigurations.get(t.id),f=r.useProgram("heatmap",m),y=a.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=a.getCircleRadiusCorrection();f.draw(i,o.TRIANGLES,te.disabled,s,l,ne.backCCW,Vf(p,a.zoom,t.paint.get("heatmap-intensity"),g),null,y,t.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,t.paint,a.zoom,m)}i.viewport.set([0,0,r.width,r.height])}function BL(r,e){let t=r.context,n=t.gl;t.setColorMode(r.colorModeForRenderPass());let i=e.heatmapFbos.get(Hi);if(!i)return;t.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),t.activeTexture.set(n.TEXTURE1),U1(t,e).bind(n.LINEAR,n.CLAMP_TO_EDGE),r.useProgram("heatmapTexture").draw(t,n.TRIANGLES,te.disabled,se.disabled,r.colorModeForRenderPass(),ne.disabled,Uf(r,e,0,1),null,null,e.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,e.paint,r.transform.zoom)}function OL(r,e,t,n,i){let o=r.context,a=o.gl,s=se.disabled,l=new Te([a.ONE,a.ONE],X.transparent,[!0,!0,!0,!0]),u=e.getBucket(t);if(!u)return;let c=n.key,p=t.heatmapFbos.get(c);p||(p=V1(o,e.tileSize,e.tileSize),t.heatmapFbos.set(c,p)),o.bindFramebuffer.set(p.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:X.transparent});let h=u.programConfigurations.get(t.id),m=r.useProgram("heatmap",h,!i),f=r.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),y=r.style.map.terrain.getTerrainData(n);m.draw(o,a.TRIANGLES,te.disabled,s,l,ne.disabled,Vf(e,r.transform.zoom,t.paint.get("heatmap-intensity"),1),y,f,t.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,t.paint,r.transform.zoom,h)}function VL(r,e,t,n,i){let o=r.context,a=o.gl,s=r.transform;o.setColorMode(r.colorModeForRenderPass());let l=U1(o,e),u=t.key,c=e.heatmapFbos.get(u);if(!c)return;o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,c.colorAttachment.get()),o.activeTexture.set(a.TEXTURE1),l.bind(a.LINEAR,a.CLAMP_TO_EDGE);let p=s.getProjectionData({overscaledTileID:t,applyTerrainMatrix:i,applyGlobeMatrix:!n});r.useProgram("heatmapTexture").draw(o,a.TRIANGLES,te.disabled,se.disabled,r.colorModeForRenderPass(),ne.disabled,Uf(r,e,0,1),null,p,e.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments,e.paint,s.zoom),c.destroy(),e.heatmapFbos.delete(u)}function UL(r,e,t){let n=r.gl;r.activeTexture.set(n.TEXTURE1),r.viewport.set([0,0,e.width/4,e.height/4]);let i=t.heatmapFbos.get(Hi);i?(n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),r.bindFramebuffer.set(i.framebuffer)):(i=V1(r,e.width/4,e.height/4),t.heatmapFbos.set(Hi,i))}function V1(r,e,t){let n=r.gl,i=n.createTexture();n.bindTexture(n.TEXTURE_2D,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);let o=r.HALF_FLOAT??n.UNSIGNED_BYTE,a=r.RGBA16F??n.RGBA;n.texImage2D(n.TEXTURE_2D,0,a,e,t,0,n.RGBA,o,null);let s=r.createFramebuffer(e,t,!1,!1);return s.colorAttachment.set(i),s}function U1(r,e){return e.colorRampTexture||(e.colorRampTexture=new ve(r,e.colorRamp,r.gl.RGBA)),e.colorRampTexture}d();function j1(r,e,t,n,i){if(r.renderPass!=="translucent")return;let{isRenderingToTexture:o}=i,a=t.paint.get("line-opacity"),s=t.paint.get("line-width");if(a.constantOr(1)===0||s.constantOr(1)===0)return;let l=r.getDepthModeForSublayer(0,te.ReadOnly),u=r.colorModeForRenderPass(),c=t.paint.get("line-dasharray"),p=t.paint.get("line-pattern"),h=p.constantOr(1),m=t.paint.get("line-gradient"),f=t.getCrossfadeParameters(),y=h?"linePattern":c?"lineSDF":m?"lineGradient":"line",g=r.context,_=g.gl,x=r.transform,b=!0;for(let v of n){let P=e.getTile(v);if(h&&!P.patternsLoaded())continue;let S=P.getBucket(t);if(!S)continue;let T=S.programConfigurations.get(t.id),C=r.context.program.get(),A=r.useProgram(y,T),E=b||A.program!==C,k=r.style.map.terrain&&r.style.map.terrain.getTerrainData(v),R=p.constantOr(null);if(R&&P.imageAtlas){let q=P.imageAtlas,Y=q.patternPositions[R.to.toString()],he=q.patternPositions[R.from.toString()];Y&&he&&T.setConstantPatternPositions(Y,he)}let V=x.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),M=x.getPixelScale(),L=h?p1(r,P,t,M,f):c?h1(r,P,t,M,c,f):m?c1(r,P,t,M,S.lineClipsArray.length):Gc(r,P,t,M);if(h)g.activeTexture.set(_.TEXTURE0),P.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),T.updatePaintBuffers(f);else if(c&&(E||r.lineAtlas.dirty))g.activeTexture.set(_.TEXTURE0),r.lineAtlas.bind(g);else if(m){let q=S.gradients[t.id],Y=q.texture;if(t.gradientVersion!==q.version){let he=256;if(t.stepInterpolant){let Oe=e.getSource().maxzoom,_e=v.canonical.z===Oe?Math.ceil(1<<r.transform.maxZoom-v.canonical.z):1,st=S.maxLineLength/8192*1024*_e;he=ae(xy(st),256,g.maxTextureSize)}q.gradient=Cu({expression:t.gradientExpression(),evaluationKey:"lineProgress",resolution:he,image:q.gradient||void 0,clips:S.lineClipsArray}),q.texture?q.texture.update(q.gradient):q.texture=new ve(g,q.gradient,_.RGBA),q.version=t.gradientVersion,Y=q.texture}g.activeTexture.set(_.TEXTURE0),Y.bind(t.stepInterpolant?_.NEAREST:_.LINEAR,_.CLAMP_TO_EDGE)}let $=r.stencilModeForClipping(v);A.draw(g,_.TRIANGLES,l,$,u,ne.disabled,L,k,V,t.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,t.paint,r.transform.zoom,T,S.layoutVertexBuffer2),b=!1}}d();d();function Ep(r,e,t,n,i){if(!t||!n||!n.imageAtlas)return;let o=n.imageAtlas.patternPositions,a=o[t.to.toString()],s=o[t.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){let l=i.getPaintProperty(e);a=o[l],s=o[l]}a&&s&&r.setConstantPatternPositions(a,s)}function G1(r,e,t,n,i){let o=t.paint.get("fill-color"),a=t.paint.get("fill-opacity");if(a.constantOr(1)===0)return;let{isRenderingToTexture:s}=i,l=r.colorModeForRenderPass(),u=t.paint.get("fill-pattern"),c=r.opaquePassEnabledForLayer()&&!u.constantOr(1)&&o.constantOr(X.transparent).a===1&&a.constantOr(0)===1?"opaque":"translucent";if(r.renderPass===c){let p=r.getDepthModeForSublayer(1,r.renderPass==="opaque"?te.ReadWrite:te.ReadOnly);N1(r,e,t,n,p,l,!1,s)}if(r.renderPass==="translucent"&&t.paint.get("fill-antialias")){let p=r.getDepthModeForSublayer(t.getPaintProperty("fill-outline-color")?2:0,te.ReadOnly);N1(r,e,t,n,p,l,!0,s)}}function N1(r,e,t,n,i,o,a,s){let l=r.context.gl,u="fill-pattern",c=t.paint.get(u),p=c&&c.constantOr(1),h=t.getCrossfadeParameters(),m,f,y,g,_,x=r.transform,b=t.paint.get("fill-translate"),v=t.paint.get("fill-translate-anchor");a?(f=p&&!t.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",m=l.LINES):(f=p?"fillPattern":"fill",m=l.TRIANGLES);let P=c.constantOr(null);for(let S of n){let T=e.getTile(S);if(p&&!T.patternsLoaded())continue;let C=T.getBucket(t);if(!C)continue;let A=C.programConfigurations.get(t.id),E=r.useProgram(f,A),k=r.style.map.terrain&&r.style.map.terrain.getTerrainData(S);p&&(r.context.activeTexture.set(l.TEXTURE0),T.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),A.updatePaintBuffers(h)),Ep(A,u,P,T,t);let R=x.getProjectionData({overscaledTileID:S,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),V=Tt(x,T,b,v);if(!a)g=C.indexBuffer,_=C.segments,y=p?Bf(r,h,T,V):N0(V);else{g=C.indexBuffer2,_=C.segments2;let L=[l.drawingBufferWidth,l.drawingBufferHeight];y=f==="fillOutlinePattern"&&p?Z0(r,h,T,L,V):G0(L,V)}let M=r.stencilModeForClipping(S);E.draw(r.context,m,i,M,o,ne.backCCW,y,k,R,t.id,C.layoutVertexBuffer,g,_,t.paint,r.transform.zoom,A)}}d();function Z1(r,e,t,n,i){let o=t.paint.get("fill-extrusion-opacity");if(o===0)return;let{isRenderingToTexture:a}=i;if(r.renderPass==="translucent"){let s=new te(r.context.gl.LEQUAL,te.ReadWrite,r.depthRangeFor3D);if(o===1&&!t.paint.get("fill-extrusion-pattern").constantOr(1)){let l=r.colorModeForRenderPass();Zf(r,e,t,n,s,se.disabled,l,a)}else Zf(r,e,t,n,s,se.disabled,Te.disabled,a),Zf(r,e,t,n,s,r.stencilModeFor3D(),r.colorModeForRenderPass(),a)}}function Zf(r,e,t,n,i,o,a,s){let l=r.context,u=l.gl,c="fill-extrusion-pattern",p=t.paint.get(c),h=p.constantOr(1),m=t.getCrossfadeParameters(),f=t.paint.get("fill-extrusion-opacity"),y=p.constantOr(null),g=r.transform;for(let _ of n){let x=e.getTile(_),b=x.getBucket(t);if(!b)continue;let v=r.style.map.terrain&&r.style.map.terrain.getTerrainData(_),P=b.programConfigurations.get(t.id),S=r.useProgram(h?"fillExtrusionPattern":"fillExtrusion",P);h&&(r.context.activeTexture.set(u.TEXTURE0),x.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),P.updatePaintBuffers(m));let T=g.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!s,applyTerrainMatrix:!0});Ep(P,c,y,x,t);let C=Tt(g,x,t.paint.get("fill-extrusion-translate"),t.paint.get("fill-extrusion-translate-anchor")),A=t.paint.get("fill-extrusion-vertical-gradient"),E=h?B0(r,A,f,C,_,m,x):zf(r,A,f,C);S.draw(l,l.gl.TRIANGLES,i,o,a,ne.backCCW,E,v,T,t.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,t.paint,r.transform.zoom,P,r.style.map.terrain&&b.centroidVertexBuffer)}}d();function $1(r,e,t,n,i){if(r.renderPass!=="offscreen"&&r.renderPass!=="translucent")return;let{isRenderingToTexture:o}=i,a=r.context,l=r.style.projection.useSubdivision,u=r.getDepthModeForSublayer(0,te.ReadOnly),c=r.colorModeForRenderPass();if(r.renderPass==="offscreen")jL(r,e,n,t,u,se.disabled,c),a.viewport.set([0,0,r.width,r.height]);else if(r.renderPass==="translucent")if(l){let[p,h,m]=r.stencilConfigForOverlapTwoPass(n);$f(r,e,t,m,p,u,c,!1,o),$f(r,e,t,m,h,u,c,!0,o)}else{let[p,h]=r.getStencilConfigForOverlapAndUpdateStencilID(n);$f(r,e,t,h,p,u,c,!1,o)}}function $f(r,e,t,n,i,o,a,s,l){let u=r.style.projection,c=r.context,p=r.transform,h=c.gl,m=[`#define NUM_ILLUMINATION_SOURCES ${t.paint.get("hillshade-highlight-color").values.length}`],f=r.useProgram("hillshade",null,!1,m),y=!r.options.moving;for(let g of n){let _=e.getTile(g),x=_.fbo;if(!x)continue;let b=u.getMeshFromTileID(c,g.canonical,s,!0,"raster"),v=r.style.map.terrain?.getTerrainData(g);c.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,x.colorAttachment.get());let P=p.getProjectionData({overscaledTileID:g,aligned:y,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(c,h.TRIANGLES,o,i[g.overscaledZ],a,ne.backCCW,r1(r,_,t),v,P,t.id,b.vertexBuffer,b.indexBuffer,b.segments)}}function jL(r,e,t,n,i,o,a){let s=r.context,l=s.gl;for(let u of t){let c=e.getTile(u),p=c.dem;if(!p||!p.data||!c.needsHillshadePrepare)continue;let h=p.dim,m=p.stride,f=p.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),c.demTexture=c.demTexture||r.getTileTexture(m),c.demTexture){let g=c.demTexture;g.update(f,{premultiply:!1}),g.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else c.demTexture=new ve(s,f,l.RGBA,{premultiply:!1}),c.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let y=c.fbo;if(!y){let g=new ve(s,{width:h,height:h,data:null},l.RGBA);g.bind(l.LINEAR,l.CLAMP_TO_EDGE),y=c.fbo=s.createFramebuffer(h,h,!0,!1),y.colorAttachment.set(g.texture)}s.bindFramebuffer.set(y.framebuffer),s.viewport.set([0,0,h,h]),r.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,i,o,a,ne.disabled,n1(c.tileID,p),null,null,n.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments),c.needsHillshadePrepare=!1}}d();function H1(r,e,t,n,i){if(r.renderPass!=="translucent"||!n.length)return;let{isRenderingToTexture:o}=i,s=r.style.projection.useSubdivision,l=r.getDepthModeForSublayer(0,te.ReadOnly),u=r.colorModeForRenderPass();if(s){let[c,p,h]=r.stencilConfigForOverlapTwoPass(n);Hf(r,e,t,h,c,l,u,!1,o),Hf(r,e,t,h,p,l,u,!0,o)}else{let[c,p]=r.getStencilConfigForOverlapAndUpdateStencilID(n);Hf(r,e,t,p,c,l,u,!1,o)}}function Hf(r,e,t,n,i,o,a,s,l){let u=r.style.projection,c=r.context,p=r.transform,h=c.gl,m=r.useProgram("colorRelief"),f=!r.options.moving,y=!0;for(let g of n){let _=e.getTile(g),x=_.dem;if(y){let C=h.getParameter(h.MAX_TEXTURE_SIZE),{elevationTexture:A,colorTexture:E}=t.getColorRampTextures(c,C,x.getUnpackVector());c.activeTexture.set(h.TEXTURE1),A.bind(h.NEAREST,h.CLAMP_TO_EDGE),c.activeTexture.set(h.TEXTURE4),E.bind(h.LINEAR,h.CLAMP_TO_EDGE),y=!1}if(!x||!x.data)continue;let b=x.stride,v=x.getPixels();if(c.activeTexture.set(h.TEXTURE0),c.pixelStoreUnpackPremultiplyAlpha.set(!1),_.demTexture=_.demTexture||r.getTileTexture(b),_.demTexture){let C=_.demTexture;C.update(v,{premultiply:!1}),C.bind(h.LINEAR,h.CLAMP_TO_EDGE)}else _.demTexture=new ve(c,v,h.RGBA,{premultiply:!1}),_.demTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE);let P=u.getMeshFromTileID(c,g.canonical,s,!0,"raster"),S=r.style.map.terrain?.getTerrainData(g),T=p.getProjectionData({overscaledTileID:g,aligned:f,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(c,h.TRIANGLES,o,i[g.overscaledZ],a,ne.backCCW,o1(t,_.dem),S,T,t.id,P.vertexBuffer,P.indexBuffer,P.segments)}}d();var As=ie(le(),1),qf=[new As.default(0,0),new As.default(8192,0),new As.default(8192,8192),new As.default(0,8192)];function q1(r,e,t,n,i){if(r.renderPass!=="translucent"||t.paint.get("raster-opacity")===0||!n.length)return;let{isRenderingToTexture:o}=i,a=e.getSource(),l=r.style.projection.useSubdivision;if(a instanceof Gt)Lp(r,e,t,n,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(l){let[u,c,p]=r.stencilConfigForOverlapTwoPass(n);Lp(r,e,t,p,u,!1,!0,qf,!1,o),Lp(r,e,t,p,c,!0,!0,qf,!1,o)}else{let[u,c]=r.getStencilConfigForOverlapAndUpdateStencilID(n);Lp(r,e,t,c,u,!1,!0,qf,!1,o)}}function Lp(r,e,t,n,i,o,a,s,l=!1,u=!1){let c=n[n.length-1].overscaledZ,p=r.context,h=p.gl,m=r.useProgram("raster"),f=r.transform,y=r.style.projection,g=r.colorModeForRenderPass(),_=!r.options.moving;for(let x of n){let b=r.getDepthModeForSublayer(x.overscaledZ-c,t.paint.get("raster-opacity")===1?te.ReadWrite:te.ReadOnly,h.LESS),v=e.getTile(x);v.registerFadeDuration(t.paint.get("raster-fade-duration"));let P=e.findLoadedParent(x,0),S=e.findLoadedSibling(x),C=NL(v,P||S||null,e,t,r.transform,r.style.map.terrain),A,E,k=t.paint.get("raster-resampling")==="nearest"?h.NEAREST:h.LINEAR;p.activeTexture.set(h.TEXTURE0),v.texture.bind(k,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(h.TEXTURE1),P?(P.texture.bind(k,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST),A=Math.pow(2,P.tileID.overscaledZ-v.tileID.overscaledZ),E=[v.tileID.canonical.x*A%1,v.tileID.canonical.y*A%1]):v.texture.bind(k,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST),v.texture.useMipmap&&p.extTextureFilterAnisotropic&&r.transform.pitch>20&&h.texParameterf(h.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let R=r.style.map.terrain&&r.style.map.terrain.getTerrainData(x),V=f.getProjectionData({overscaledTileID:x,aligned:_,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),M=y1(E||[0,0],A||1,C,t,s),L=y.getMeshFromTileID(p,x.canonical,o,a,"raster"),$=i?i[x.overscaledZ]:se.disabled;m.draw(p,h.TRIANGLES,b,$,g,l?ne.frontCCW:ne.backCCW,M,R,V,t.id,L.vertexBuffer,L.indexBuffer,L.segments)}}function NL(r,e,t,n,i,o){let a=n.paint.get("raster-fade-duration");if(!o&&a>0){let s=re.now(),l=(s-r.timeAdded)/a,u=e?(s-e.timeAdded)/a:-1,c=t.getSource(),p=mi(i,{tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!e||Math.abs(e.tileID.overscaledZ-p)>Math.abs(r.tileID.overscaledZ-p),m=h&&r.refreshedUponExpiration?1:ae(h?l:1-u,0,1);return r.refreshedUponExpiration&&l>=1&&(r.refreshedUponExpiration=!1),e?{opacity:1,mix:1-m}:{opacity:m,mix:0}}else return{opacity:1,mix:0}}d();function W1(r,e,t,n,i){let o=t.paint.get("background-color"),a=t.paint.get("background-opacity");if(a===0)return;let{isRenderingToTexture:s}=i,l=r.context,u=l.gl,c=r.style.projection,p=r.transform,h=p.tileSize,m=t.paint.get("background-pattern");if(r.isPatternMissing(m))return;let f=!m&&o.a===1&&a===1&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==f)return;let y=se.disabled,g=r.getDepthModeForSublayer(0,f==="opaque"?te.ReadWrite:te.ReadOnly),_=r.colorModeForRenderPass(),x=r.useProgram(m?"backgroundPattern":"background"),b=n||An(p,{tileSize:h,terrain:r.style.map.terrain});m&&(l.activeTexture.set(u.TEXTURE0),r.imageManager.bind(r.context));let v=t.getCrossfadeParameters();for(let P of b){let S=p.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),T=m?S1(a,r,m,{tileID:P,tileSize:h},v):P1(a,o),C=r.style.map.terrain&&r.style.map.terrain.getTerrainData(P),A=c.getMeshFromTileID(l,P.canonical,!1,!0,"raster");x.draw(l,u.TRIANGLES,g,y,_,ne.backCCW,T,C,S,t.id,A.vertexBuffer,A.indexBuffer,A.segments)}}d();var GL=new X(1,0,0,1),ZL=new X(0,1,0,1),$L=new X(0,0,1,1),HL=new X(1,0,1,1),qL=new X(0,1,1,1);function K1(r){let e=r.transform.padding,t=3;X1(r,r.transform.height-(e.top||0),t,GL),X1(r,e.bottom||0,t,ZL),Y1(r,e.left||0,t,$L),Y1(r,r.transform.width-(e.right||0),t,HL);let n=r.transform.centerPoint;WL(r,n.x,r.transform.height-n.y,qL)}function WL(r,e,t,n){Dp(r,e-2/2,t-20/2,2,20,n),Dp(r,e-20/2,t-2/2,20,2,n)}function X1(r,e,t,n){Dp(r,0,e+t/2,r.transform.width,t,n)}function Y1(r,e,t,n){Dp(r,e-t/2,0,t,r.transform.height,n)}function Dp(r,e,t,n,i,o){let a=r.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*r.pixelRatio,t*r.pixelRatio,n*r.pixelRatio,i*r.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function J1(r,e,t){for(let n=0;n<t.length;n++)XL(r,e,t[n])}function XL(r,e,t){let n=r.context,i=n.gl,o=r.useProgram("debug"),a=te.disabled,s=se.disabled,l=r.colorModeForRenderPass(),u="$debug",c=r.style.map.terrain&&r.style.map.terrain.getTerrainData(t);n.activeTexture.set(i.TEXTURE0);let p=e.getTileByID(t.key).latestRawTileData,h=p&&p.byteLength||0,m=Math.floor(h/1024),f=e.getTile(t).tileSize,y=512/Math.min(f,512)*(t.overscaledZ/r.transform.zoom)*.5,g=t.canonical.toString();t.overscaledZ!==t.canonical.z&&(g+=` => ${t.overscaledZ}`);let _=`${g} ${m}kB`;YL(r,_);let x=r.transform.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(n,i.TRIANGLES,a,s,Te.alphaBlended,ne.disabled,Of(X.transparent,y),null,x,u,r.debugBuffer,r.quadTriangleIndexBuffer,r.debugSegments),o.draw(n,i.LINE_STRIP,a,s,l,ne.disabled,Of(X.red),c,x,u,r.debugBuffer,r.tileBorderIndexBuffer,r.debugSegments)}function YL(r,e){r.initDebugOverlayCanvas();let t=r.debugOverlayCanvas,n=r.context.gl,i=r.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,t.width,t.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(e,5,5),i.strokeText(e,5,5),r.debugOverlayTexture.update(t),r.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}function Q1(r,e){let t=null,i=Object.values(r._layers).flatMap(l=>l.source&&!l.isHidden(e)?[r.sourceCaches[l.source]]:[]),o=i.filter(l=>l.getSource().type==="vector"),a=i.filter(l=>l.getSource().type!=="vector"),s=l=>{(!t||t.getSource().maxzoom<l.getSource().maxzoom)&&(t=l)};return o.forEach(l=>s(l)),t||a.forEach(l=>s(l)),t}d();function ew(r,e,t,n){let{isRenderingGlobe:i}=n,o=r.context,a=t.implementation,s=r.style.projection,l=r.transform,u=l.getProjectionDataForCustomLayer(i),c={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
745
+ uniform mat4 u_projection_matrix;
746
+ ${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:u},p=a.renderingMode?a.renderingMode:"2d";if(r.renderPass==="offscreen"){let h=a.prerender;h&&(r.setCustomLayerDefaults(),o.setColorMode(r.colorModeForRenderPass()),h.call(a,o.gl,c),o.setDirty(),r.setBaseState())}else if(r.renderPass==="translucent"){r.setCustomLayerDefaults(),o.setColorMode(r.colorModeForRenderPass()),o.setStencilMode(se.disabled);let h=p==="3d"?r.getDepthModeFor3D():r.getDepthModeForSublayer(0,te.ReadOnly);o.setDepthMode(h),a.render(o.gl,c),o.setDirty(),r.setBaseState(),o.bindFramebuffer.set(null)}}d();function tw(r,e){let t=r.context,n=t.gl,i=r.transform,o=Te.unblended,a=new te(n.LEQUAL,te.ReadWrite,[0,1]),s=e.sourceCache.getRenderableTiles(),l=r.useProgram("terrainDepth");t.bindFramebuffer.set(e.getFramebuffer("depth").framebuffer),t.viewport.set([0,0,r.width/devicePixelRatio,r.height/devicePixelRatio]),t.clear({color:X.transparent,depth:1});for(let u of s){let c=e.getTerrainMesh(u.tileID),p=e.getTerrainData(u.tileID),h=i.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),m=E0(e.getMeshFrameDelta(i.zoom));l.draw(t,n.TRIANGLES,a,se.disabled,o,ne.backCCW,m,p,h,"terrain",c.vertexBuffer,c.indexBuffer,c.segments)}t.bindFramebuffer.set(null),t.viewport.set([0,0,r.width,r.height])}function rw(r,e){let t=r.context,n=t.gl,i=r.transform,o=Te.unblended,a=new te(n.LEQUAL,te.ReadWrite,[0,1]),s=e.getCoordsTexture(),l=e.sourceCache.getRenderableTiles(),u=r.useProgram("terrainCoords");t.bindFramebuffer.set(e.getFramebuffer("coords").framebuffer),t.viewport.set([0,0,r.width/devicePixelRatio,r.height/devicePixelRatio]),t.clear({color:X.transparent,depth:1}),e.coordsIndex=[];for(let c of l){let p=e.getTerrainMesh(c.tileID),h=e.getTerrainData(c.tileID);t.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,s.texture);let m=L0(255-e.coordsIndex.length,e.getMeshFrameDelta(i.zoom)),f=i.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(t,n.TRIANGLES,a,se.disabled,o,ne.backCCW,m,h,f,"terrain",p.vertexBuffer,p.indexBuffer,p.segments),e.coordsIndex.push(c.tileID.key)}t.bindFramebuffer.set(null),t.viewport.set([0,0,r.width,r.height])}function Wf(r,e,t,n){let{isRenderingGlobe:i}=n,o=r.context,a=o.gl,s=r.transform,l=r.colorModeForRenderPass(),u=r.getDepthModeFor3D(),c=r.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,r.width,r.height]);for(let p of t){let h=e.getTerrainMesh(p.tileID),m=r.renderToTexture.getTexture(p),f=e.getTerrainData(p.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,m.texture);let y=e.getMeshFrameDelta(s.zoom),g=s.calculateFogMatrix(p.tileID.toUnwrapped()),_=I0(y,g,r.style.sky,s.pitch,i),x=s.getProjectionData({overscaledTileID:p.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(o,a.TRIANGLES,u,se.disabled,l,ne.backCCW,_,f,x,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}}d();function nw(r,e){if(!e.mesh){let t=new pt;t.emplaceBack(-1,-1),t.emplaceBack(1,-1),t.emplaceBack(1,1),t.emplaceBack(-1,1);let n=new je;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),e.mesh=new Ft(r.createVertexBuffer(t,$t.members),r.createIndexBuffer(n),pe.simpleSegment(0,0,t.length,n.length))}return e.mesh}function iw(r,e){let t=r.context,n=t.gl,i=A1(e,r.style.map.transform,r.pixelRatio),o=new te(n.LEQUAL,te.ReadWrite,[0,1]),a=se.disabled,s=r.colorModeForRenderPass(),l=r.useProgram("sky"),u=nw(t,e);l.draw(t,n.TRIANGLES,o,a,s,ne.disabled,i,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function KL(r,e){let t=r.properties.get("position"),n=[-t.x,-t.y,-t.z],i=F.identity(new Float64Array(16));return r.properties.get("anchor")==="map"&&(F.rotateZ(i,i,e.rollInRadians),F.rotateX(i,i,-e.pitchInRadians),F.rotateZ(i,i,e.bearingInRadians),F.rotateX(i,i,e.center.lat*Math.PI/180),F.rotateY(i,i,-e.center.lng*Math.PI/180)),O.transformMat4(n,n,i),n}function ow(r,e,t){let n=r.context,i=n.gl,o=r.useProgram("atmosphere"),a=new te(i.LEQUAL,te.ReadOnly,[0,1]),s=r.transform,l=KL(t,r.transform),u=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),c=e.properties.get("atmosphere-blend")*u.projectionTransition;if(c===0)return;let p=gi(s.worldSize,s.center.lat),h=s.inverseProjectionMatrix,m=new Float64Array(4);m[3]=1,De.transformMat4(m,m,s.modelViewProjectionMatrix),m[0]/=m[3],m[1]/=m[3],m[2]/=m[3],m[3]=1,De.transformMat4(m,m,h),m[0]/=m[3],m[1]/=m[3],m[2]/=m[3],m[3]=1;let f=[m[0],m[1],m[2]],y=M1(l,c,f,p,h),g=nw(n,e);o.draw(n,i.TRIANGLES,a,se.disabled,Te.alphaBlended,ne.disabled,y,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}var kp=class{constructor(e,t){this.context=new Cp(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:F.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Hr.maxUnderzooming+Hr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new co}resize(e,t,n){if(this.width=Math.floor(e*n),this.height=Math.floor(t*n),this.pixelRatio=n,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style._order)this.style._layers[i].resize()}setup(){let e=this.context,t=new pt;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,$t.members),this.tileExtentSegments=pe.simpleSegment(0,0,4,2);let n=new pt;n.emplaceBack(0,0),n.emplaceBack(8192,0),n.emplaceBack(0,8192),n.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(n,$t.members),this.debugSegments=pe.simpleSegment(0,0,4,5);let i=new lu;i.emplaceBack(0,0,0,0),i.emplaceBack(8192,0,8192,0),i.emplaceBack(0,8192,0,8192),i.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=e.createVertexBuffer(i,S0.members),this.rasterBoundsSegments=pe.simpleSegment(0,0,4,2);let o=new pt;o.emplaceBack(0,0),o.emplaceBack(8192,0),o.emplaceBack(0,8192),o.emplaceBack(8192,8192),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,$t.members),this.rasterBoundsSegmentsPosOnly=pe.simpleSegment(0,0,4,5);let a=new pt;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,$t.members),this.viewportSegments=pe.simpleSegment(0,0,4,2);let s=new Ea;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);let l=new je;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new se({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new Ft(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let n=F.create();F.ortho(n,0,this.width,this.height,0,0,1),F.scale(n,n,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let i={mainMatrix:n,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:n};this.useProgram("clippingMask",null,!0).draw(e,t.TRIANGLES,te.disabled,this.stencilClearMode,Te.disabled,ne.disabled,null,null,i,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let i=this.context;i.setColorMode(Te.disabled),i.setDepthMode(te.disabled);let o={};for(let a of t)o[a.key]=this.nextStencilID++;this._renderTileMasks(o,t,n,!0),this._renderTileMasks(o,t,n,!1),this._tileClippingMaskIDs=o}_renderTileMasks(e,t,n,i){let o=this.context,a=o.gl,s=this.style.projection,l=this.transform,u=this.useProgram("clippingMask");for(let c of t){let p=e[c.key],h=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),m=s.getMeshFromTileID(this.context,c.canonical,i,!0,"stencil"),f=l.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!n,applyTerrainMatrix:!0});u.draw(o,a.TRIANGLES,te.disabled,new se({func:a.ALWAYS,mask:0},p,255,a.KEEP,a.KEEP,a.REPLACE),Te.disabled,n?ne.disabled:ne.backCCW,null,h,f,"$clipping",m.vertexBuffer,m.indexBuffer,m.segments)}}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,n=this.style.projection,i=this.transform,o=this.useProgram("depth"),a=this.getDepthModeFor3D(),s=An(i,{tileSize:i.tileSize});for(let l of s){let u=this.style.map.terrain&&this.style.map.terrain.getTerrainData(l),c=n.getMeshFromTileID(this.context,l.canonical,!0,!0,"raster"),p=i.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(e,t.TRIANGLES,a,se.disabled,Te.disabled,ne.backCCW,null,u,p,"$clipping",c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new se({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new se({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,n=e.sort((a,s)=>s.overscaledZ-a.overscaledZ),i=n[n.length-1].overscaledZ,o=n[0].overscaledZ-i+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let a={};for(let s=0;s<o;s++)a[s+i]=new se({func:t.GEQUAL,mask:255},s+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=o,[a,n]}return[{[i]:se.disabled},n]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,n=e.sort((a,s)=>s.overscaledZ-a.overscaledZ),i=n[n.length-1].overscaledZ,o=n[0].overscaledZ-i+1;if(this.clearStencil(),o>1){let a={},s={};for(let l=0;l<o;l++)a[l+i]=new se({func:t.GREATER,mask:255},o+1+l,255,t.KEEP,t.KEEP,t.REPLACE),s[l+i]=new se({func:t.GREATER,mask:255},1+l,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=o*2+1,[a,s,n]}else return this.nextStencilID=3,[{[i]:new se({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[i]:new se({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},n]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Te([e.CONSTANT_COLOR,e.ONE],new X(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Te.unblended:Te.alphaBlended}getDepthModeForSublayer(e,t,n){if(!this.opaquePassEnabledForLayer())return te.disabled;let i=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new te(n||this.context.gl.LEQUAL,t,[i,i])}getDepthModeFor3D(){return new te(this.context.gl.LEQUAL,te.ReadWrite,this.depthRangeFor3D)}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(re.now()),this.imageManager.beginFrame();let n=this.style._order,i=this.style.sourceCaches,o={},a={},s={},l={isRenderingToTexture:!1,isRenderingGlobe:e.projection?.transitionState>0};for(let c in i){let p=i[c];p.used&&p.prepare(this.context),o[c]=p.getVisibleCoordinates(!1),a[c]=o[c].slice().reverse(),s[c]=p.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let c=0;c<n.length;c++){let p=n[c];if(this.style._layers[p].is3D()){this.opaquePassCutoff=c;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let c of n){let p=this.style._layers[c];if(!p.hasOffscreenPass()||p.isHidden(this.transform.zoom))continue;let h=a[p.source];p.type!=="custom"&&!h.length||this.renderLayer(this,i[p.source],p,h,l)}if(this.style.projection?.updateGPUdependent({context:this.context,useProgram:c=>this.useProgram(c)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?X.black:X.transparent,depth:1}),this.clearStencil(),this.style.sky&&iw(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){let c=this.style._layers[n[this.currentLayer]],p=i[c.source],h=o[c.source];this._renderTileClippingMasks(c,h,!1),this.renderLayer(this,p,c,h,l)}this.renderPass="translucent";let u=!1;for(this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){let c=this.style._layers[n[this.currentLayer]],p=i[c.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(c,l))continue;!this.opaquePassEnabledForLayer()&&!u&&(u=!0,l.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let h=(c.type==="symbol"?s:a)[c.source];this._renderTileClippingMasks(c,o[c.source],!!this.renderToTexture),this.renderLayer(this,p,c,h,l)}if(l.isRenderingGlobe&&ow(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let c=Q1(this.style,this.transform.zoom);c&&J1(this,c,c.getVisibleCoordinates())}this.options.showPadding&&K1(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let t=this.terrainFacilitator.matrix,n=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.dirty;i||(i=e?!F.exactEquals(t,n):!F.equals(t,n)),i||(i=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),i&&(F.copy(t,n),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,tw(this,this.style.map.terrain),rw(this,this.style.map.terrain))}renderLayer(e,t,n,i,o){n.isHidden(this.transform.zoom)||n.type!=="background"&&n.type!=="custom"&&!(i||[]).length||(this.id=n.id,Nx(n)?z1(e,t,n,i,this.style.placement.variableOffsets,o):A_(n)?B1(e,t,n,i,o):k_(n)?O1(e,t,n,i,o):_x(n)?j1(e,t,n,i,o):X_(n)?G1(e,t,n,i,o):lx(n)?Z1(e,t,n,i,o):z_(n)?$1(e,t,n,i,o):V_(n)?H1(e,t,n,i,o):Wx(n)?q1(e,t,n,i,o):$x(n)?W1(e,t,n,i,o):Yx(n)&&ew(e,t,n,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()),n=this.imageManager.getPattern(e.to.toString());return!t||!n}useProgram(e,t,n=!1,i=[]){this.cache=this.cache||{};let o=!!this.style.map.terrain,a=this.style.projection,s=n?Rt.projectionMercator:a.shaderPreludeCode,l=n?Mf:a.shaderDefine,u=`/${n?Cf:a.shaderVariantName}`,c=t?t.cacheKey:"",p=this._showOverdrawInspector?"/overdraw":"",h=o?"/terrain":"",m=i?`/${i.join("/")}`:"",f=e+c+u+p+h+m;return this.cache[f]||(this.cache[f]=new jc(this.context,Rt[e],t,E1[e],this._showOverdrawInspector,o,s,l,i)),this.cache[f]}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(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new ve(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}};d();d();function Rp(r,e){let t=!1,n=null,i=null,o,a=()=>{n=null,t&&(r.apply(i,o),n=setTimeout(a,e),t=!1)};return(...s)=>(t=!0,i=this,o=s,n||a(),n)}var Is=class{constructor(e){this._getCurrentHash=()=>{let e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(n=>n.split("=")).forEach(n=>{n[0]===this._hashName&&(t=n)}),(t&&t[1]||"").split("/")}return e.split("/")};this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;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};this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)};this._removeHash=()=>{let e=this._getCurrentHash();if(e.length===0)return;let t=e.join("/"),n=t;n.split("&").length>0&&(n=n.split("&")[0]),this._hashName&&(n=`${this._hashName}=${t}`);let i=window.location.hash.replace(n,"");i.startsWith("#&")?i=i.slice(0,1)+i.slice(2):i==="#"&&(i="");let o=window.location.href.replace(/(#.+)?$/,i);o=o.replace("&&","&"),window.history.replaceState(window.history.state,null,o)};this._updateHash=Rp(this._updateHashUnthrottled,30*1e3/100);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()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),n=Math.round(this._map.getZoom()*100)/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,i),a=Math.round(t.lng*o)/o,s=Math.round(t.lat*o)/o,l=this._map.getBearing(),u=this._map.getPitch(),c="";if(e?c+=`/${a}/${s}/${n}`:c+=`${n}/${s}/${a}`,(l||u)&&(c+=`/${Math.round(l*10)/10}`),u&&(c+=`/${Math.round(u)}`),this._hashName){let p=this._hashName,h=!1,m=window.location.hash.slice(1).split("&").map(f=>{let y=f.split("=")[0];return y===p?(h=!0,`${y}=${c}`):f}).filter(f=>f);return h||m.push(`${p}=${c}`),`#${m.join("&")}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new W(+e[2],+e[1])}catch{return!1}let t=+e[0],n=+(e[3]||0),i=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&n>=-180&&n<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}};d();d();var aw=ie(le(),1),Ds={linearity:.3,easing:Io(0,0,.3,1)},JL=N({deceleration:2500,maxSpeed:1400},Ds),QL=N({deceleration:20,maxSpeed:1400},Ds),eD=N({deceleration:1e3,maxSpeed:360},Ds),tD=N({deceleration:1e3,maxSpeed:90},Ds),rD=N({deceleration:1e3,maxSpeed:360},Ds),Fp=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:re.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=re.now(),n=160;for(;e.length>0&&t-e[0].time>n;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let t={zoom:0,bearing:0,pitch:0,roll:0,pan:new aw.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:a}of this._inertiaBuffer)t.zoom+=a.zoomDelta||0,t.bearing+=a.bearingDelta||0,t.pitch+=a.pitchDelta||0,t.roll+=a.rollDelta||0,a.panDelta&&t.pan._add(a.panDelta),a.around&&(t.around=a.around),a.pinchAround&&(t.pinchAround=a.pinchAround);let i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(t.pan.mag()){let a=Ls(t.pan.mag(),i,N({},JL,e||{})),s=t.pan.mult(a.amount/t.pan.mag()),l=this._map.cameraHelper.handlePanInertia(s,this._map.transform);o.center=l.easingCenter,o.offset=l.easingOffset,Es(o,a)}if(t.zoom){let a=Ls(t.zoom,i,QL);o.zoom=this._map.transform.zoom+a.amount,Es(o,a)}if(t.bearing){let a=Ls(t.bearing,i,eD);o.bearing=this._map.transform.bearing+ae(a.amount,-179,179),Es(o,a)}if(t.pitch){let a=Ls(t.pitch,i,tD);o.pitch=this._map.transform.pitch+a.amount,Es(o,a)}if(t.roll){let a=Ls(t.roll,i,rD);o.roll=this._map.transform.roll+ae(a.amount,-179,179),Es(o,a)}if(o.zoom||o.bearing){let a=t.pinchAround===void 0?t.around:t.pinchAround;o.around=a?this._map.unproject(a):this._map.getCenter()}return this.clear(),N(o,{noMoveStart:!0})}};function Es(r,e){(!r.duration||r.duration<e.duration)&&(r.duration=e.duration,r.easing=e.easing)}function Ls(r,e,t){let{maxSpeed:n,linearity:i,deceleration:o}=t,a=ae(r*i/(e/1e3),-n,n),s=Math.abs(a)/(o*i);return{easing:t.easing,duration:s*1e3,amount:a*(s/2)}}d();d();var sw=ie(le(),1);var ht=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n,i={}){n=n instanceof MouseEvent?n:new MouseEvent(e,n);let o=B.mousePos(t.getCanvas(),n),a=t.unproject(o);super(e,N({point:o,lngLat:a,originalEvent:n},i)),this._defaultPrevented=!1,this.target=t}},Dn=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n){let i=e==="touchend"?n.changedTouches:n.touches,o=B.touchPos(t.getCanvasContainer(),i),a=o.map(u=>t.unproject(u)),s=o.reduce((u,c,p,h)=>u.add(c.div(h.length)),new sw.default(0,0)),l=t.unproject(s);super(e,{points:o,point:s,lngLats:a,lngLat:l,originalEvent:n}),this._defaultPrevented=!1}},ks=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}};var zp=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new ks(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new ht(e.type,this._map,e))}mouseup(e){this._map.fire(new ht(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new ht(e.type,this._map,e))}dblclick(e){return this._firePreventable(new ht(e.type,this._map,e))}mouseover(e){this._map.fire(new ht(e.type,this._map,e))}mouseout(e){this._map.fire(new ht(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Dn(e.type,this._map,e))}touchmove(e){this._map.fire(new Dn(e.type,this._map,e))}touchend(e){this._map.fire(new Dn(e.type,this._map,e))}touchcancel(e){this._map.fire(new Dn(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},Bp=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new ht(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ht("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new ht(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};d();d();var lw=ie(le(),1),nr=class{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(lw.default.convert(e),this._map.terrain)}};var Rs=class{constructor(e,t){this._map=e,this._tr=new nr(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(B.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let n=t;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;let i=this._startPos;this._lastPos=n,this._box||(this._box=B.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let o=Math.min(i.x,n.x),a=Math.max(i.x,n.x),s=Math.min(i.y,n.y),l=Math.max(i.y,n.y);B.setTransform(this._box,`translate(${o}px,${s}px)`),this._box.style.width=`${a-o}px`,this._box.style.height=`${l-s}px`}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let n=this._startPos,i=t;if(this.reset(),B.suppressClick(),n.x===i.x&&n.y===i.y)this._fireEvent("boxzoomcancel",e);else return this._map.fire(new z("boxzoomend",{originalEvent:e})),{cameraAnimation:o=>o.fitScreenCoordinates(n,i,this._tr.bearing,{linear:!0})}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(B.remove(this._box),this._box=null),B.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new z(e,{originalEvent:t}))}};d();d();var uw=ie(le(),1);d();function Fs(r,e){if(r.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${r.length}, points ${e.length}`);let t={};for(let n=0;n<r.length;n++)t[r[n].identifier]=e[n];return t}function nD(r){let e=new uw.default(0,0);for(let t of r)e._add(t);return e.div(r.length)}var Yf=500,iD=500,Op=30,Xf=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=nD(t),this.touches=Fs(n,t)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;let i=Fs(n,t);for(let o in this.touches){let a=this.touches[o],s=i[o];(!s||s.dist(a)>Op)&&(this.aborted=!0)}}touchend(e,t,n){if((!this.centroid||e.timeStamp-this.startTime>iD)&&(this.aborted=!0),n.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}},_i=class{constructor(e){this.singleTap=new Xf(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,n){this.singleTap.touchstart(e,t,n)}touchmove(e,t,n){this.singleTap.touchmove(e,t,n)}touchend(e,t,n){let i=this.singleTap.touchend(e,t,n);if(i){let o=e.timeStamp-this.lastTime<Yf,a=!this.lastTap||this.lastTap.dist(i)<Op;if((!o||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}};var Vp=class{constructor(e){this._tr=new nr(e),this._zoomIn=new _i({numTouches:1,numTaps:2}),this._zoomOut=new _i({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,n){this._zoomIn.touchstart(e,t,n),this._zoomOut.touchstart(e,t,n)}touchmove(e,t,n){this._zoomIn.touchmove(e,t,n),this._zoomOut.touchmove(e,t,n)}touchend(e,t,n){let i=this._zoomIn.touchend(e,t,n),o=this._zoomOut.touchend(e,t,n),a=this._tr;if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(i)},{originalEvent:e})};if(o)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(o)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};d();var cw=ie(le(),1);d();var Yr=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.rollDelta||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=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let n=this._lastPoint;if(!n)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let i=Array.isArray(t)?t[0]:t;if(!(!this._moved&&i.dist(n)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(n,i)}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&B.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}};d();var oD=0,aD=2,sD={[oD]:1,[aD]:2};function lD(r,e){let t=sD[e];return r.buttons===void 0||(r.buttons&t)!==t}var kn=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=B.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!lD(e,this._eventButton)}isValidEndEvent(e){return B.mouseButton(e)===this._eventButton}},Kf=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_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)}},Up=class{constructor(e=new kn({checkCorrectEvent:()=>!0}),t=new Kf){this.mouseMoveStateManager=e;this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,n){if(e instanceof MouseEvent)return t(e);if(typeof TouchEvent<"u"&&e instanceof TouchEvent)return n(e)}startMove(e){this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.startMove(t),t=>this.oneFingerTouchMoveStateManager.startMove(t))}endMove(e){this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.endMove(t),t=>this.oneFingerTouchMoveStateManager.endMove(t))}isValidStartEvent(e){return this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(e){return this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(e){return this._executeRelevantHandler(e,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}};var Jf=0,Qf=2,jp=r=>{r.mousedown=r.dragStart,r.mousemoveWindow=r.dragMove,r.mouseup=r.dragEnd,r.contextmenu=e=>{e.preventDefault()}};function pw({enable:r,clickTolerance:e}){let t=new kn({checkCorrectEvent:n=>B.mouseButton(n)===Jf&&!n.ctrlKey});return new Yr({clickTolerance:e,move:(n,i)=>({around:i,panDelta:i.sub(n)}),activateOnStart:!0,moveStateManager:t,enable:r,assignEvents:jp})}function hw({enable:r,clickTolerance:e,aroundCenter:t=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:i=.8},o){let a=new kn({checkCorrectEvent:s=>B.mouseButton(s)===Jf&&s.ctrlKey||B.mouseButton(s)===Qf&&!s.ctrlKey});return new Yr({clickTolerance:e,move:(s,l)=>{let u=o();if(t&&Math.abs(u.y-s.y)>n)return{bearingDelta:dl(new cw.default(s.x,l.y),l,u)};let c=(l.x-s.x)*i;return t&&l.y<u.y&&(c=-c),{bearingDelta:c}},moveStateManager:a,enable:r,assignEvents:jp})}function mw({enable:r,clickTolerance:e,pitchDegreesPerPixelMoved:t=-.5}){let n=new kn({checkCorrectEvent:i=>B.mouseButton(i)===Jf&&i.ctrlKey||B.mouseButton(i)===Qf});return new Yr({clickTolerance:e,move:(i,o)=>({pitchDelta:(o.y-i.y)*t}),moveStateManager:n,enable:r,assignEvents:jp})}function fw({enable:r,clickTolerance:e,rollDegreesPerPixelMoved:t=.3},n){let i=new kn({checkCorrectEvent:o=>B.mouseButton(o)===Qf&&o.ctrlKey});return new Yr({clickTolerance:e,move:(o,a)=>{let s=n(),l=(a.x-o.x)*t;return a.y<s.y&&(l=-l),{rollDelta:l}},moveStateManager:i,enable:r,assignEvents:jp})}d();var Np=ie(le(),1);var Gp=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Np.default(0,0)}_shouldBePrevented(e){let t=this._map.cooperativeGestures.isEnabled()?2:1;return e<t}touchstart(e,t,n){return this._calculateTransform(e,t,n)}touchmove(e,t,n){if(this._active){if(this._shouldBePrevented(n.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,t,n)}}touchend(e,t,n){this._calculateTransform(e,t,n),this._active&&this._shouldBePrevented(n.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,n){n.length>0&&(this._active=!0);let i=Fs(n,t),o=new Np.default(0,0),a=new Np.default(0,0),s=0;for(let c in i){let p=i[c],h=this._touches[c];h&&(o._add(p),a._add(p.sub(h)),s++,i[c]=p)}if(this._touches=i,this._shouldBePrevented(s)||!a.mag())return;let l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};d();var zs=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,n){if(!this._firstTwoTouches)return;e.preventDefault();let[i,o]=this._firstTwoTouches,a=Zp(n,t,i),s=Zp(n,t,o);if(!a||!s)return;let l=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],l,e)}touchend(e,t,n){if(!this._firstTwoTouches)return;let[i,o]=this._firstTwoTouches,a=Zp(n,t,i),s=Zp(n,t,o);a&&s||(this._active&&B.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function Zp(r,e,t){for(let n=0;n<r.length;n++)if(r[n].identifier===t)return e[n]}var uD=.1;function dw(r,e){return Math.log(r/e)/Math.LN2}var Bs=class extends zs{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let n=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(dw(this._distance,this._startDistance))<uD))return this._active=!0,{zoomDelta:dw(this._distance,n),pinchAround:t}}},cD=25;function yw(r,e){return r.angleWith(e)*180/Math.PI}var Os=class extends zs{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,n){let i=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:yw(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=Math.PI*this._minDiameter,n=cD/t*360,i=yw(e,this._startVector);return Math.abs(i)<n}};function ed(r){return Math.abs(r.y)>Math.abs(r.x)}var pD=100,Vs=class extends zs{constructor(t){super();this._currentTouchCount=0;this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,i){super.touchstart(t,n,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,ed(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let o=t[0].sub(this._lastPoints[0]),a=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,a,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,i){if(this._valid!==void 0)return this._valid;let o=2,a=t.mag()>=o,s=n.mag()>=o;if(!a&&!s)return;if(!a||!s)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<pD?void 0:!1;let l=t.y>0==n.y>0;return ed(t)&&ed(n)&&l}};d();var hD={panStep:100,bearingStep:15,pitchStep:10},Us=class{constructor(e){this._tr=new nr(e);let t=hD;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,n=0,i=0,o=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?n=-1:(e.preventDefault(),o=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),o=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,i=0),{cameraAnimation:s=>{let l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:mD,zoom:t?Math.round(l.zoom)+t*(e.shiftKey?2:1):l.zoom,bearing:l.bearing+n*this._bearingStep,pitch:l.pitch+i*this._pitchStep,offset:[-o*this._panStep,-a*this._panStep],center:l.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function mD(r){return r*(2-r)}d();var gw=4.000244140625,fD=1/100,dD=1/450,yD=2,gD=5,js=class{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)};this._map=e,this._tr=new nr(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=fD,this._wheelZoomRate=dD}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,n=re.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,t!==0&&t%gw===0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t=t/4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=B.mousePos(this._map.getCanvas(),e),n=this._tr;this._aroundCenter?this._aroundPoint=n.transform.locationToScreenPoint(W.convert(n.center)):this._aroundPoint=t,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let s=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=s),typeof this._targetZoom=="number"&&(this._targetZoom+=s)}if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>gw?this._wheelZoomRate:this._defaultZoomRate,l=yD/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&l!==0&&(l=1/l);let u=typeof this._targetZoom!="number"?e.scale:We(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),Ge(u*l)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,n=this._startZoom,i=this._easing,o=!1,a;if(this._type==="wheel"&&n&&i){let s=re.now()-this._lastWheelEventTime,l=Math.min((s+gD)/200,1),u=i(l);a=Me.number(n,t,u),l<1?this._frameId||(this._frameId=!0):o=!0}else a=t,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=a,{noInertia:!0,needsRenderFrame:!o,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=Eo;if(this._prevEase){let n=this._prevEase,i=(re.now()-n.start)/n.duration,o=n.easing(i+.01)-n.easing(i),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.27*.27-a*a);t=Io(a,s,.25,1)}return this._prevEase={start:re.now(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}};d();var Ns=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}};d();var $p=class{constructor(e){this._tr=new nr(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};d();var Hp=class{constructor(){this._tap=new _i({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,n){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,n);else{let i=t[0],o=e.timeStamp-this._tapTime<Yf,a=this._tapPoint.dist(i)<Op;!o||!a?this.reset():n.length>0&&(this._swipePoint=i,this._swipeTouch=n[0].identifier)}}touchmove(e,t,n){if(!this._tapTime)this._tap.touchmove(e,t,n);else if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;let i=t[0],o=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:o/128}}}touchend(e,t,n){if(this._tapTime)this._swipePoint&&n.length===0&&this.reset();else{let i=this._tap.touchend(e,t,n);i&&(this._tapTime=e.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};d();var Gs=class{constructor(e,t,n){this._el=e,this._mousePan=t,this._touchPan=n}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}};d();var Zs=class{constructor(e,t,n,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=n,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}};d();var $s=class{constructor(e,t,n,i){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}};d();var Hs=class{constructor(e,t){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey";this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=B.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let n=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=t,this._container.appendChild(i);let o=document.createElement("div");o.className="maplibregl-mobile-message",o.textContent=n,this._container.appendChild(o),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(B.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new z("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}};var _w=ie(le(),1),qp=r=>r.zoom||r.drag||r.roll||r.pitch||r.rotate,rd=class extends z{};function td(r){return r.panDelta&&r.panDelta.mag()||r.zoomDelta||r.bearingDelta||r.pitchDelta||r.rollDelta}var Wp=class{constructor(e,t){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)};this.handleEvent=(e,t)=>{if(e.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let n=e.type==="renderFrame"?void 0:e,i={needsRenderFrame:!1},o={},a={};for(let{handlerName:u,handler:c,allowed:p}of this._handlers){if(!c.isEnabled())continue;let h;if(this._blockedByActive(a,p,u))c.reset();else if(c[t||e.type]){if(Ly(e,t||e.type)){let m=B.mousePos(this._map.getCanvas(),e);h=c[t||e.type](e,m)}else if(Ey(e,t||e.type)){let m=e.touches,f=this._getMapTouches(m),y=B.touchPos(this._map.getCanvas(),f);h=c[t||e.type](e,y,f)}else Dy(t||e.type)||(h=c[t||e.type](e));this.mergeHandlerResult(i,o,h,u,n),h&&h.needsRenderFrame&&this._triggerRenderFrame()}(h||c.isActive())&&(a[u]=c)}let s={};for(let u in this._previousActiveHandlers)a[u]||(s[u]=n);this._previousActiveHandlers=a,(Object.keys(s).length||td(i))&&(this._changes.push([i,o,s]),this._triggerRenderFrame()),(Object.keys(a).length||td(i))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:l}=i;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map))};this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Fp(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(t);let n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(let[i,o,a]of this._listeners)B.addEventListener(i,o,i===document?this.handleWindowEvent:this.handleEvent,a)}destroy(){for(let[e,t,n]of this._listeners)B.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){let t=this._map,n=t.getCanvasContainer();this._add("mapEvent",new zp(t,e));let i=t.boxZoom=new Rs(t,e);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let o=t.cooperativeGestures=new Hs(t,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();let a=new Vp(t),s=new $p(t);t.doubleClickZoom=new Ns(s,a),this._add("tapZoom",a),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let l=new Hp;this._add("tapDragZoom",l);let u=t.touchPitch=new Vs(t);this._add("touchPitch",u),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let c=()=>t.project(t.getCenter()),p=hw(e,c),h=mw(e),m=fw(e,c);t.dragRotate=new Zs(e,p,h,m),this._add("mouseRotate",p,["mousePitch"]),this._add("mousePitch",h,["mouseRotate","mouseRoll"]),this._add("mouseRoll",m,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let f=pw(e),y=new Gp(e,t);t.dragPan=new Gs(n,f,y),this._add("mousePan",f),this._add("touchPan",y,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let g=new Os,_=new Bs;t.touchZoomRotate=new $s(n,_,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",_,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate);let x=t.scrollZoom=new js(t,()=>this._triggerRenderFrame());this._add("scrollZoom",x,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let b=t.keyboard=new Us(t);this._add("keyboard",b),e.interactive&&e.keyboard&&t.keyboard.enable(),this._add("blockableMapEvent",new Bp(t))}_add(e,t,n){this._handlers.push({handlerName:e,handler:t,allowed:n}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.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||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!qp(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,n){for(let i in e)if(i!==n&&(!t||t.indexOf(i)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let n of e){let i=n.target;this._el.contains(i)&&t.push(n)}return t}mergeHandlerResult(e,t,n,i,o){if(!n)return;N(e,n);let a={handlerName:i,originalEvent:n.originalEvent||o};n.zoomDelta!==void 0&&(t.zoom=a),n.panDelta!==void 0&&(t.drag=a),n.rollDelta!==void 0&&(t.roll=a),n.pitchDelta!==void 0&&(t.pitch=a),n.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},n={};for(let[i,o,a]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new _w.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),i.rollDelta&&(e.rollDelta=(e.rollDelta||0)+i.rollDelta),i.around!==void 0&&(e.around=i.around),i.pinchAround!==void 0&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),N(t,o),N(n,a);this._updateMapTransform(e,t,n),this._changes=[]}_updateMapTransform(e,t,n){let i=this._map,o=i._getTransformForUpdate(),a=i.terrain;if(!td(e)&&!(a&&this._terrainMovement))return this._fireEvents(t,n,!0);i._stop(!0);let{panDelta:s,zoomDelta:l,bearingDelta:u,pitchDelta:c,rollDelta:p,around:h,pinchAround:m}=e;m!==void 0&&(h=m),h=h||i.transform.centerPoint,a&&!o.isPointOnMapSurface(h)&&(h=o.centerPoint);let f={panDelta:s,zoomDelta:l,rollDelta:p,pitchDelta:c,bearingDelta:u,around:h};this._map.cameraHelper.useGlobeControls&&!o.isPointOnMapSurface(h)&&(h=o.centerPoint);let y=h.distSqr(o.centerPoint)<.01?o.center:o.screenPointToLocation(s?h.sub(s):h);a?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(f,o),!this._terrainMovement&&(t.drag||t.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(f,o,y)):t.drag&&this._terrainMovement?o.setCenter(o.screenPointToLocation(o.centerPoint.sub(s))):this._map.cameraHelper.handleMapControlsPan(f,o,y)):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(f,o),this._map.cameraHelper.handleMapControlsPan(f,o,y)),i._applyUpdatedTransform(o),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,n,!0)}_fireEvents(e,t,n){let i=qp(this._eventsInProgress),o=qp(e),a={};for(let p in e){let{originalEvent:h}=e[p];this._eventsInProgress[p]||(a[`${p}start`]=h),this._eventsInProgress[p]=e[p]}!i&&o&&this._fireEvent("movestart",o.originalEvent);for(let p in a)this._fireEvent(p,a[p]);o&&this._fireEvent("move",o.originalEvent);for(let p in e){let{originalEvent:h}=e[p];this._fireEvent(p,h)}let s={},l;for(let p in this._eventsInProgress){let{handlerName:h,originalEvent:m}=this._eventsInProgress[p];this._handlersById[h].isActive()||(delete this._eventsInProgress[p],l=t[h]||m,s[`${p}end`]=l)}for(let p in s)this._fireEvent(p,s[p]);let u=qp(this._eventsInProgress),c=(i||o)&&!u;if(c&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let p=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&p.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(p)}if(n&&c){this._updatingCamera=!0;let p=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),h=m=>m!==0&&-this._bearingSnap<m&&m<this._bearingSnap;p&&(p.essential||!re.prefersReducedMotion)?(h(p.bearing||this._map.getBearing())&&(p.bearing=0),p.freezeElevation=!0,this._map.easeTo(p,{originalEvent:l})):(this._map.fire(new z("moveend",{originalEvent:l})),h(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 rd("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}};d();var vo=ie(le(),1);var Xp=class extends xe{constructor(t,n,i){super();this._renderFrameCallback=()=>{let t=Math.min((re.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()};this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this.cameraHelper=n,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(t,n){t.apply(this.transform),this.transform=t,this.cameraHelper=n}getCenter(){return new W(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,n){return this.jumpTo({elevation:t},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,n,i){return t=vo.default.convert(t).mult(-1),this.panTo(this.transform.center,N({offset:t},n),i)}panTo(t,n,i){return this.easeTo(N({center:t},n),i)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,i){return this.easeTo(N({zoom:t},n),i)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,n){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new z("movestart",n)).fire(new z("move",n)).fire(new z("moveend",n))),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,i){return this.easeTo(N({bearing:t},n),i)}resetNorth(t,n){return this.rotateTo(0,N({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(N({bearing:0,pitch:0,roll:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}getRoll(){return this.transform.roll}setRoll(t,n){return this.jumpTo({roll:t},n),this}cameraForBounds(t,n){t=rt.convert(t).adjustAntiMeridian();let i=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,n)}_cameraForBoxAndBearing(t,n,i,o){let a={top:0,bottom:0,right:0,left:0};if(o=N({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},o),typeof o.padding=="number"){let c=o.padding;o.padding={top:c,bottom:c,right:c,left:c}}let s=N(a,o.padding);o.padding=s;let l=this.transform,u=new rt(t,n);return this.cameraHelper.cameraForBoxAndBearing(o,s,u,i,l)}fitBounds(t,n,i){return this._fitInternal(this.cameraForBounds(t,n),n,i)}fitScreenCoordinates(t,n,i,o,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(vo.default.convert(t)),this.transform.screenPointToLocation(vo.default.convert(n)),i,o),o,a)}_fitInternal(t,n,i){return t?(n=N(t,n),delete n.padding,n.linear?this.easeTo(n,i):this.flyTo(n,i)):this}jumpTo(t,n){this.stop();let i=this._getTransformForUpdate(),o=!1,a=!1,s=!1,l=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,t);let u=i.zoom!==l;return"elevation"in t&&i.elevation!==+t.elevation&&i.setElevation(+t.elevation),"bearing"in t&&i.bearing!==+t.bearing&&(o=!0,i.setBearing(+t.bearing)),"pitch"in t&&i.pitch!==+t.pitch&&(a=!0,i.setPitch(+t.pitch)),"roll"in t&&i.roll!==+t.roll&&(s=!0,i.setRoll(+t.roll)),t.padding!=null&&!i.isPaddingEqual(t.padding)&&i.setPadding(t.padding),this._applyUpdatedTransform(i),this.fire(new z("movestart",n)).fire(new z("move",n)),u&&this.fire(new z("zoomstart",n)).fire(new z("zoom",n)).fire(new z("zoomend",n)),o&&this.fire(new z("rotatestart",n)).fire(new z("rotate",n)).fire(new z("rotateend",n)),a&&this.fire(new z("pitchstart",n)).fire(new z("pitch",n)).fire(new z("pitchend",n)),s&&this.fire(new z("rollstart",n)).fire(new z("roll",n)).fire(new z("rollend",n)),this.fire(new z("moveend",n))}calculateCameraOptionsFromTo(t,n,i,o=0){let a=fe.fromLngLat(t,n),s=fe.fromLngLat(i,o),l=s.x-a.x,u=s.y-a.y,c=s.z-a.z,p=Math.hypot(l,u,c);if(p===0)throw new Error("Can't calculate camera options with same From and To");let h=Math.hypot(l,u),m=Ge(this.transform.cameraToCenterDistance/p/this.transform.tileSize),f=Math.atan2(l,-u)*180/Math.PI,y=Math.acos(h/p)*180/Math.PI;return y=c<0?90-y:90+y,{center:s.toLngLat(),elevation:o,zoom:m,pitch:y,bearing:f}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,i,o,a){let s=this.transform.calculateCenterFromCameraLngLatAlt(t,n,i,o);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:i,pitch:o,roll:a}}easeTo(t,n){this._stop(!1,t.easeId),t=N({offset:[0,0],duration:500,easing:Eo},t),(t.animate===!1||!t.essential&&re.prefersReducedMotion)&&(t.duration=0);let i=this._getTransformForUpdate(),o=this.getBearing(),a=i.pitch,s=i.roll,l="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:a,c="roll"in t?this._normalizeBearing(t.roll,s):s,p="padding"in t?t.padding:i.padding,h=vo.default.convert(t.offset),m,f;t.around&&(m=W.convert(t.around),f=i.locationToScreenPoint(m));let y={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(i,{bearing:l,pitch:u,roll:c,padding:p,around:m,aroundPoint:f,offsetAsPoint:h,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||o!==l,this._pitching=this._pitching||u!==a,this._rolling=this._rolling||c!==s,this._padding=!i.isPaddingEqual(p),this._zooming=this._zooming||g.isZooming,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,y),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease(_=>{g.easeFunc(_),this.terrain&&!t.freezeElevation&&this._updateElevation(_),this._applyUpdatedTransform(i),this._fireMoveEvents(n)},_=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,_)},t),this}_prepareEase(t,n,i={}){this._moving=!0,!n&&!i.moving&&this.fire(new z("movestart",t)),this._zooming&&!i.zooming&&this.fire(new z("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new z("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new z("pitchstart",t)),this._rolling&&!i.rolling&&this.fire(new z("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,o=(n-(i*t+this._elevationStart))/(1-t);this._elevationStart+=t*(i-o),this._elevationTarget=n}this.transform.setElevation(Me.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(t){return{}}_applyUpdatedTransform(t){let n=[];if(n.push(o=>this._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&n.push(o=>this.transformCameraUpdate(o)),!n.length)return;let i=t.clone();for(let o of n){let a=i.clone(),{center:s,zoom:l,roll:u,pitch:c,bearing:p,elevation:h}=o(a);s&&a.setCenter(s),h!==void 0&&a.setElevation(h),l!==void 0&&a.setZoom(l),u!==void 0&&a.setRoll(u),c!==void 0&&a.setPitch(c),p!==void 0&&a.setBearing(p),i.apply(a)}this.transform.apply(i)}_fireMoveEvents(t){this.fire(new z("move",t)),this._zooming&&this.fire(new z("zoom",t)),this._rotating&&this.fire(new z("rotate",t)),this._pitching&&this.fire(new z("pitch",t)),this._rolling&&this.fire(new z("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let i=this._zooming,o=this._rotating,a=this._pitching,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new z("zoomend",t)),o&&this.fire(new z("rotateend",t)),a&&this.fire(new z("pitchend",t)),s&&this.fire(new z("rollend",t)),this.fire(new z("moveend",t))}flyTo(t,n){if(!t.essential&&re.prefersReducedMotion){let M=xr(t,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(M,n)}this.stop(),t=N({offset:[0,0],speed:1.2,curve:1.42,easing:Eo},t);let i=this._getTransformForUpdate(),o=i.bearing,a=i.pitch,s=i.roll,l=i.padding,u="bearing"in t?this._normalizeBearing(t.bearing,o):o,c="pitch"in t?+t.pitch:a,p="roll"in t?this._normalizeBearing(t.roll,s):s,h="padding"in t?t.padding:i.padding,m=vo.default.convert(t.offset),f=i.centerPoint.add(m),y=i.screenPointToLocation(f),g=this.cameraHelper.handleFlyTo(i,{bearing:u,pitch:c,roll:p,padding:h,locationAtOffset:y,offsetAsPoint:m,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),_=t.curve,x=Math.max(i.width,i.height),b=x/g.scaleOfZoom,v=g.pixelPathLength;if(typeof g.scaleOfMinZoom=="number"){let M=x/g.scaleOfMinZoom;_=Math.sqrt(M/v*2)}let P=_*_;function S(M){let L=(b*b-x*x+(M?-1:1)*P*P*v*v)/(2*(M?b:x)*P*v);return Math.log(Math.sqrt(L*L+1)-L)}function T(M){return(Math.exp(M)-Math.exp(-M))/2}function C(M){return(Math.exp(M)+Math.exp(-M))/2}function A(M){return T(M)/C(M)}let E=S(!1),k=function(M){return C(E)/C(E+_*M)},R=function(M){return x*((C(E)*A(E+_*M)-T(E))/P)/v},V=(S(!0)-E)/_;if(Math.abs(v)<2e-6||!isFinite(V)){if(Math.abs(x-b)<1e-6)return this.easeTo(t,n);let M=b<x?-1:1;V=Math.abs(Math.log(b/x))/_,R=()=>0,k=L=>Math.exp(M*_*L)}if("duration"in t)t.duration=+t.duration;else{let M="screenSpeed"in t?+t.screenSpeed/_:+t.speed;t.duration=1e3*V/M}return t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=o!==u,this._pitching=c!==a,this._rolling=p!==s,this._padding=!i.isPaddingEqual(h),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease(M=>{let L=M*V,$=1/k(L),q=R(L);this._rotating&&i.setBearing(Me.number(o,u,M)),this._pitching&&i.setPitch(Me.number(a,c,M)),this._rolling&&i.setRoll(Me.number(s,p,M)),this._padding&&(i.interpolatePadding(l,h,M),f=i.centerPoint.add(m)),g.easeFunc(M,$,q,f),this.terrain&&!t.freezeElevation&&this._updateElevation(M),this._applyUpdatedTransform(i),this._fireMoveEvents(n)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,n)}return t||this.handlers?.stop(!1),this}_ease(t,n,i){i.animate===!1||i.duration===0?(t(1),n()):(this._easeStart=re.now(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=Yt(t,-180,180);let i=Math.abs(t-n);return Math.abs(t-360-n)<i&&(t-=360),Math.abs(t+360-n)<i&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(W.convert(t),this.transform.tileZoom):null}};var Kr=ie(le(),1);d();var nd={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},qs=class{constructor(e=nd){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))};this._updateData=e=>{e&&(e.sourceDataType==="metadata"||e.sourceDataType==="visibility"||e.dataType==="style"||e.type==="terrain")&&this._updateAttributions()};this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))};this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")};this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=B.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=B.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=B.create("div","maplibregl-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._container}onRemove(){B.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 n=this._map._getUIString(`AttributionControl.${t}`);e.title=n,e.setAttribute("aria-label",n)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(i=>typeof i!="string"?"":i)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let t=this._map.style.sourceCaches;for(let i in t){let o=t[i];if(o.used||o.usedForTerrain){let a=o.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.attribution)}}e=e.filter(i=>String(i).trim()),e.sort((i,o)=>i.length-o.length),e=e.filter((i,o)=>{for(let a=o+1;a<e.length;a++)if(e[a].indexOf(i)>=0)return!1;return!0});let n=e.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,e.length?(this._innerContainer.innerHTML=B.sanitize(n),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}};d();var Ws=class{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}};this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=B.create("div","maplibregl-ctrl");let t=B.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(){B.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};d();var Yp=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,n=t?this._queue.concat(t):this._queue;for(let i of n)if(i.id===e){i.cancelled=!0;return}}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 n of t)if(!n.cancelled&&(n.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};d();var Jp=(n=>(n.create="create",n.load="load",n.fullLoad="fullLoad",n))(Jp||{}),Kp=null,Xs=[],_D=60,id=1e3/_D,od="loadTime",ad="fullLoadTime",wo={mark(r){performance.mark(r)},frame(r){let e=r;if(Kp!=null){let t=e-Kp;Xs.push(t)}Kp=e},clearMetrics(){Kp=null,Xs=[],performance.clearMeasures(od),performance.clearMeasures(ad);for(let r in Jp)performance.clearMarks(Jp[r])},getPerformanceMetrics(){performance.measure(od,"create","load"),performance.measure(ad,"create","fullLoad");let r=performance.getEntriesByName(od)[0].duration,e=performance.getEntriesByName(ad)[0].duration,t=Xs.length,i=1/(Xs.reduce((s,l)=>s+l,0)/t/1e3),o=Xs.filter(s=>s>id).reduce((s,l)=>s+(l-id)/id,0),a=o/(t+o)*100;return{loadTime:r,fullLoadTime:e,fps:i,percentDroppedFrames:a,totalFrames:t}}};d();d();var xw=Ie([{name:"a_pos3d",type:"Int16",components:3}]);d();var Qp=class extends xe{constructor(t){super();this._lastTilesetChange=re.now();this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];let i={};for(let o of An(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))i[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.terrainRttPosMatrix32f=new Float64Array(16),F.ortho(o.terrainRttPosMatrix32f,0,8192,8192,0,0,1),this._tiles[o.key]=new so(o,this.tileSize),this._lastTilesetChange=re.now());for(let o in this._tiles)i[o]||delete this._tiles[o]}freeRtt(t){for(let n in this._tiles){let i=this._tiles[n];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,n){return n?this._getTerrainCoordsForTileRanges(t,n):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let n={};for(let i of this._renderableTilesKeys){let o=this._tiles[i].tileID,a=t.clone(),s=ar();if(o.canonical.equals(t.canonical))F.ortho(s,0,8192,8192,0,0,1);else if(o.canonical.isChildOf(t.canonical)){let l=o.canonical.z-t.canonical.z,u=o.canonical.x-(o.canonical.x>>l<<l),c=o.canonical.y-(o.canonical.y>>l<<l),p=8192>>l;F.ortho(s,0,p,p,0,0,1),F.translate(s,s,[-u*p,-c*p,0])}else if(t.canonical.isChildOf(o.canonical)){let l=t.canonical.z-o.canonical.z,u=t.canonical.x-(t.canonical.x>>l<<l),c=t.canonical.y-(t.canonical.y>>l<<l),p=8192>>l;F.ortho(s,0,8192,8192,0,0,1),F.translate(s,s,[u*p,c*p,0]),F.scale(s,s,[1/2**l,1/2**l,0])}else continue;a.terrainRttPosMatrix32f=new Float32Array(s),n[i]=a}return n}_getTerrainCoordsForTileRanges(t,n){let i={};for(let o of this._renderableTilesKeys){let a=this._tiles[o].tileID;if(!this._isWithinTileRanges(a,n))continue;let s=t.clone(),l=ar();if(a.canonical.z===t.canonical.z){let u=t.canonical.x-a.canonical.x,c=t.canonical.y-a.canonical.y;F.ortho(l,0,8192,8192,0,0,1),F.translate(l,l,[u*8192,c*8192,0])}else if(a.canonical.z>t.canonical.z){let u=a.canonical.z-t.canonical.z,c=a.canonical.x-(a.canonical.x>>u<<u),p=a.canonical.y-(a.canonical.y>>u<<u),h=t.canonical.x-(a.canonical.x>>u),m=t.canonical.y-(a.canonical.y>>u),f=8192>>u;F.ortho(l,0,f,f,0,0,1),F.translate(l,l,[-c*f+h*8192,-p*f+m*8192,0])}else{let u=t.canonical.z-a.canonical.z,c=t.canonical.x-(t.canonical.x>>u<<u),p=t.canonical.y-(t.canonical.y>>u<<u),h=(t.canonical.x>>u)-a.canonical.x,m=(t.canonical.y>>u)-a.canonical.y,f=8192<<u;F.ortho(l,0,f,f,0,0,1),F.translate(l,l,[c*8192+h*f,p*8192+m*f,0])}s.terrainRttPosMatrix32f=new Float32Array(l),i[o]=s}return i}getSourceTile(t,n){let i=this.sourceCache._source,o=t.overscaledZ-this.deltaZoom;if(o>i.maxzoom&&(o=i.maxzoom),o<i.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(o).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if(!(a&&a.dem)&&n)for(;o>=i.minzoom&&!(a&&a.dem);)a=this.sourceCache.getTileByID(t.scaledTo(o--).key);return a}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,n){return n[t.canonical.z]&&t.canonical.x>=n[t.canonical.z].minTileX&&t.canonical.x<=n[t.canonical.z].maxTileX&&t.canonical.y>=n[t.canonical.z].minTileY&&t.canonical.y<=n[t.canonical.z].maxTileY}};var eh=class{constructor(e,t,n){this._meshCache={};this.painter=e,this.sourceCache=new Qp(t),this.options=n,this.exaggeration=typeof n.exaggeration=="number"?n.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,t,n,i=8192){if(!(t>=0&&t<i&&n>=0&&n<i))return 0;let o=this.getTerrainData(e),a=o.tile?.dem;if(!a)return 0;let s=it.transformMat4([],[t/i*8192,n/i*8192],o.u_terrain_matrix),l=[s[0]*a.dim,s[1]*a.dim],u=Math.floor(l[0]),c=Math.floor(l[1]),p=l[0]-u,h=l[1]-c;return a.get(u,c)*(1-p)*(1-h)+a.get(u+1,c)*p*(1-h)+a.get(u,c+1)*(1-p)*h+a.get(u+1,c+1)*p*h}getElevationForLngLatZoom(e,t){if(!yb(t,e.wrap()))return 0;let{tileID:n,mercatorX:i,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(n,i%8192,o%8192,8192)}getElevation(e,t,n,i=8192){return this.getDEMElevation(e,t,n,i)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let i=this.painter.context,o=new Se({width:1,height:1},new Uint8Array(1*4));this._emptyDepthTexture=new ve(i,o,i.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new ve(i,new Se({width:1,height:1}),i.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=F.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let i=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new ve(i,t.dem.getPixels(),i.gl.RGBA,{premultiply:!1}),t.demTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let n=t&&t+t.tileID.key+e.key;if(n&&!this._demMatrixCache[n]){let i=this.sourceCache.sourceCache._source.maxzoom,o=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?o=e.canonical.z-i:ue("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>o<<o),s=e.canonical.y-(e.canonical.y>>o<<o),l=F.fromScaling(new Float64Array(16),[1/(8192<<o),1/(8192<<o),0]);F.translate(l,l,[a*8192,s*8192,0]),this._demMatrixCache[e.key]={matrix:l,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:t&&t.dem&&t.dem.dim||1,u_terrain_matrix:n?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,n=t.width/devicePixelRatio,i=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==n||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 ve(t.context,{width:n,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 ve(t.context,{width:n,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(n,i,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,i))),this._fbo.colorAttachment.set(e==="coords"?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 o=0,a=0;o<this._coordsTextureSize;o++)for(let s=0;s<this._coordsTextureSize;s++,a+=4)t[a+0]=s&255,t[a+1]=o&255,t[a+2]=s>>8<<4|o>>8,t[a+3]=0;let n=new Se({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),i=new ve(e,n,e.gl.RGBA,{premultiply:!1});return i.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let t=new Uint8Array(4),n=this.painter.context,i=n.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);n.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(o,s-a-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),n.bindFramebuffer.set(null);let l=t[0]+(t[2]>>4<<8),u=t[1]+((t[2]&15)<<8),c=this.coordsIndex[255-t[3]],p=c&&this.sourceCache.getTileByID(c);if(!p)return null;let h=this._coordsTextureSize,m=(1<<p.tileID.canonical.z)*h;return new fe((p.tileID.canonical.x*h+l)/m+p.tileID.wrap,(p.tileID.canonical.y*h+u)/m,this.getElevation(p.tileID,l,u,h))}depthAtPoint(e){let t=new Uint8Array(4),n=this.painter.context,i=n.gl;return n.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),n.bindFramebuffer.set(null),(t[0]/(256*256*256)+t[1]/(256*256)+t[2]/256+t[3])/256}getTerrainMesh(e){let t=this.painter.style.projection?.transitionState>0,n=t&&e.canonical.y===0,i=t&&e.canonical.y===(1<<e.canonical.z)-1,o=`m_${n?"n":""}_${i?"s":""}`;if(this._meshCache[o])return this._meshCache[o];let a=this.painter.context,s=new su,l=new je,u=this.meshSize,c=8192/u,p=u*u;for(let T=0;T<=u;T++)for(let C=0;C<=u;C++)s.emplaceBack(C*c,T*c,0);for(let T=0;T<p;T+=u+1)for(let C=0;C<u;C++)l.emplaceBack(C+T,u+C+T+1,u+C+T+2),l.emplaceBack(C+T,u+C+T+2,C+T+1);let h=s.length,m=0,f=h+(u+1),y=(u+1)*u,g=n?Ar:0,_=n?0:1,x=i?Gr:8192,b=i?0:1;for(let T=0;T<=u;T++)s.emplaceBack(T*c,g,_);for(let T=0;T<=u;T++)s.emplaceBack(T*c,x,b);for(let T=0;T<u;T++)l.emplaceBack(y+T,f+T,f+T+1),l.emplaceBack(y+T,f+T+1,y+T+1),l.emplaceBack(m+T,h+T+1,h+T),l.emplaceBack(m+T,m+T+1,h+T+1);let v=s.length,P=v+(u+1)*2;for(let T of[0,1])for(let C=0;C<=u;C++)for(let A of[0,1])s.emplaceBack(T*8192,C*c,A);for(let T=0;T<u*2;T+=2)l.emplaceBack(v+T,v+T+1,v+T+3),l.emplaceBack(v+T,v+T+3,v+T+2),l.emplaceBack(P+T,P+T+3,P+T+1),l.emplaceBack(P+T,P+T+2,P+T+3);let S=new Ft(a.createVertexBuffer(s,xw.members),a.createIndexBuffer(l),pe.simpleSegment(0,0,s.length,l.length));return this._meshCache[o]=S,S}getMeshFrameDelta(e){return 2*Math.PI*kt/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,t){let{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getMinMaxElevation(n).minElevation??0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,n={minElevation:null,maxElevation:null};return t&&t.dem&&(n.minElevation=t.dem.min*this.exaggeration,n.maxElevation=t.dem.max*this.exaggeration),n}_getOverscaledTileIDFromLngLatZoom(e,t){let n=fe.fromLngLat(e.wrap()),i=(1<<t)*8192,o=n.x*i,a=n.y*i,s=Math.floor(o/8192),l=Math.floor(a/8192);return{tileID:new Be(t,0,t,s,l),mercatorX:o,mercatorY:a}}};d();d();var th=class{constructor(e,t,n){this._context=e;this._size=t;this._tileSize=n;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),n=new ve(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return n.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(n.texture),{id:e,fbo:t,texture:n,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 t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];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)===!1}};var Po={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},rh=class{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new th(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(n=>!e._layers[n].isHidden(t)),this._coordsAscending={};for(let n in e.sourceCaches){this._coordsAscending[n]={};let i=e.sourceCaches[n].getVisibleCoordinates(),o=e.sourceCaches[n].getSource(),a=o instanceof Gt?o.terrainTileRanges:null;for(let s of i){let l=this.terrain.sourceCache.getTerrainCoords(s,a);for(let u in l)this._coordsAscending[n][u]||(this._coordsAscending[n][u]=[]),this._coordsAscending[n][u].push(l[u])}}this._coordsAscendingStr={};for(let n of e._order){let i=e._layers[n],o=i.source;if(Po[i.type]&&!this._coordsAscendingStr[o]){this._coordsAscendingStr[o]={};for(let a in this._coordsAscending[o])this._coordsAscendingStr[o][a]=this._coordsAscending[o][a].map(s=>s.key).sort().join()}}for(let n of this._renderableTiles)for(let i in this._coordsAscendingStr){let o=this._coordsAscendingStr[i][n.tileID.key];o&&o!==n.rttCoords[i]&&(n.rtt=[])}}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let n={...t,isRenderingToTexture:!0},i=e.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Po[i]&&((!this._prevType||!Po[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(Po[this._prevType]||Po[i]&&a){this._prevType=i;let s=this._stacks.length-1,l=this._stacks[s]||[];for(let u of this._renderableTiles){if(this.pool.isFull()&&(Wf(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(u),u.rtt[s]){let p=this.pool.getObjectForId(u.rtt[s].id);if(p.stamp===u.rtt[s].stamp){this.pool.useObject(p);continue}}let c=this.pool.getOrCreateFreeObject();this.pool.useObject(c),this.pool.stampObject(c),u.rtt[s]={id:c.id,stamp:c.stamp},o.context.bindFramebuffer.set(c.fbo.framebuffer),o.context.clear({color:X.transparent,stencil:0}),o.currentStencilSource=void 0;for(let p=0;p<l.length;p++){let h=o.style._layers[l[p]],m=h.source?this._coordsAscending[h.source][u.tileID.key]:[u.tileID];o.context.viewport.set([0,0,c.fbo.width,c.fbo.height]),o._renderTileClippingMasks(h,m,!0),o.renderLayer(o,o.style.sourceCaches[h.source],h,m,n),h.source&&(u.rttCoords[h.source]=this._coordsAscendingStr[h.source][u.tileID.key])}}return Wf(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects(),Po[i]}return!1}};d();var bw={"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":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"};var xD=tl.version,ih=-2,ww=22,Rn=0,Pw=60,nh=180,vw={hash:!1,interactive:!0,bearingSnap:7,attributionControl:nd,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:ih,maxZoom:ww,minPitch:Rn,maxPitch:Pw,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:ot.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},sd=class extends Xp{constructor(t){wo.mark("create");let n={...vw,...t,canvasContextAttributes:{...vw.canvasContextAttributes,...t.canvasContextAttributes}};if(n.minZoom!=null&&n.maxZoom!=null&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(n.minPitch!=null&&n.maxPitch!=null&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(n.minPitch!=null&&n.minPitch<Rn)throw new Error(`minPitch must be greater than or equal to ${Rn}`);if(n.maxPitch!=null&&n.maxPitch>nh)throw new Error(`maxPitch must be less than or equal to ${nh}`);let i=new Wr,o=new Xr;n.minZoom!==void 0&&i.setMinZoom(n.minZoom),n.maxZoom!==void 0&&i.setMaxZoom(n.maxZoom),n.minPitch!==void 0&&i.setMinPitch(n.minPitch),n.maxPitch!==void 0&&i.setMaxPitch(n.maxPitch),n.renderWorldCopies!==void 0&&i.setRenderWorldCopies(n.renderWorldCopies);super(i,o,{bearingSnap:n.bearingSnap});this._idleTriggered=!1;this._crossFadingFactor=1;this._renderTaskQueue=new Yp;this._controls=[];this._mapId=hl();this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new z("webglcontextlost",{originalEvent:t}))};this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new z("webglcontextrestored",{originalEvent:t}))};this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1};this._onWindowOnline=()=>{this._update()};if(this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes={...n.canvasContextAttributes},this._trackResize=n.trackResize===!0,this._bearingSnap=n.bearingSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=n.refreshExpiredTiles===!0,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=n.crossSourceCollisions===!0,this._collectResourceTiming=n.collectResourceTiming===!0,this._locale={...bw,...n.locale},this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this.transformCameraUpdate=n.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=n.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=wt.addThrottleControl(()=>this.isMoving()),this._requestManager=new bl(n.transformRequest),typeof n.container=="string"){if(this._container=document.getElementById(n.container),!this._container)throw new Error(`Container '${n.container}' not found.`)}else if(n.container instanceof HTMLElement)this._container=n.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(n.maxBounds&&this.setMaxBounds(n.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}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let l=!1,u=Rp(c=>{this._trackResize&&!this._removed&&(this.resize(c),this.redraw())},50);this._resizeObserver=new ResizeObserver(c=>{if(!l){l=!0;return}u(c)}),this._resizeObserver.observe(this._container)}this.handlers=new Wp(this,n);let a=typeof n.hash=="string"&&n.hash||void 0;this._hash=n.hash&&new Is(a).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,N({},n.fitBoundsOptions,{duration:0}))));let s=typeof n.style=="string"||n.style?.projection?.type!=="globe";this.resize(null,s),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new qs(typeof n.attributionControl=="boolean"?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new Ws,n.logoPosition),this.on("style.load",()=>{if(s||this._resizeTransform(),this.transform.unmodified){let l=xr(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(l)}}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new z(`${l.dataType}data`,l))}),this.on("dataloading",l=>{this.fire(new z(`${l.dataType}dataloading`,l))}),this.on("dataabort",l=>{this.fire(new z("sourcedataabort",l))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,n){return this.style.setGlobalStateProperty(t,n),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,n){if(n===void 0&&(t.getDefaultPosition?n=t.getDefaultPosition():n="top-right"),!t||!t.onAdd)return this.fire(new K(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=t.onAdd(this);this._controls.push(t);let o=this._controlPositions[n];return n.indexOf("bottom")!==-1?o.insertBefore(i,o.firstChild):o.appendChild(i),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new K(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let n=this._controls.indexOf(t);return n>-1&&this._controls.splice(n,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,n,i,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,n,i,o)}resize(t,n=!0){let[i,o]=this._containerDimensions(),a=this._getClampedPixelRatio(i,o);if(this._resizeCanvas(i,o,a),this.painter.resize(i,o,a),this.painter.overLimit()){let l=this.painter.context.gl;this._maxCanvasSize=[l.drawingBufferWidth,l.drawingBufferHeight];let u=this._getClampedPixelRatio(i,o);this._resizeCanvas(i,o,u),this.painter.resize(i,o,u)}this._resizeTransform(n);let s=!this._moving;return s&&(this.stop(),this.fire(new z("movestart",t)).fire(new z("move",t))),this.fire(new z("resize",t)),s&&this.fire(new z("moveend",t)),this}_resizeTransform(t=!0){let[n,i]=this._containerDimensions();this.transform.resize(n,i,t),this._requestedCameraState?.resize(n,i,t)}_getClampedPixelRatio(t,n){let{0:i,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),s=t*a,l=n*a,u=s>i?i/s:1,c=l>o?o/l:1;return Math.min(u,c)*a}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(rt.convert(t)),this._update()}setMinZoom(t){if(t=t??ih,t>=ih&&t<=this.transform.maxZoom)return this.transform.setMinZoom(t),this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error(`minZoom must be between ${ih} and the current maxZoom, inclusive`)}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if(t=t??ww,t>=this.transform.minZoom)return this.transform.setMaxZoom(t),this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if(t=t??Rn,t<Rn)throw new Error(`minPitch must be greater than or equal to ${Rn}`);if(t>=Rn&&t<=this.transform.maxPitch)return this.transform.setMinPitch(t),this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error(`minPitch must be between ${Rn} and the current maxPitch, inclusive`)}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if(t=t??Pw,t>nh)throw new Error(`maxPitch must be less than or equal to ${nh}`);if(t>=this.transform.minPitch)return this.transform.setMaxPitch(t),this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.setRenderWorldCopies(t),this._update()}project(t){return this.transform.locationToScreenPoint(W.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(Kr.default.convert(t),this.terrain)}isMoving(){return this._moving||this.handlers?.isMoving()}isZooming(){return this._zooming||this.handlers?.isZooming()}isRotating(){return this._rotating||this.handlers?.isRotating()}_createDelegatedListener(t,n,i){if(t==="mouseenter"||t==="mouseover"){let o=!1;return{layers:n,listener:i,delegates:{mousemove:l=>{let u=n.filter(p=>this.getLayer(p)),c=u.length!==0?this.queryRenderedFeatures(l.point,{layers:u}):[];c.length?o||(o=!0,i.call(this,new ht(t,this,l.originalEvent,{features:c}))):o=!1},mouseout:()=>{o=!1}}}}else if(t==="mouseleave"||t==="mouseout"){let o=!1;return{layers:n,listener:i,delegates:{mousemove:l=>{let u=n.filter(p=>this.getLayer(p));(u.length!==0?this.queryRenderedFeatures(l.point,{layers:u}):[]).length?o=!0:o&&(o=!1,i.call(this,new ht(t,this,l.originalEvent)))},mouseout:l=>{o&&(o=!1,i.call(this,new ht(t,this,l.originalEvent)))}}}}else{let o=a=>{let s=n.filter(u=>this.getLayer(u)),l=s.length!==0?this.queryRenderedFeatures(a.point,{layers:s}):[];l.length&&(a.features=l,i.call(this,a),delete a.features)};return{layers:n,listener:i,delegates:{[t]:o}}}}_saveDelegatedListener(t,n){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(n)}_removeDelegatedListener(t,n,i){if(!this._delegatedListeners||!this._delegatedListeners[t])return;let o=this._delegatedListeners[t];for(let a=0;a<o.length;a++){let s=o[a];if(s.listener===i&&s.layers.length===n.length&&s.layers.every(l=>n.includes(l))){for(let l in s.delegates)this.off(l,s.delegates[l]);o.splice(a,1);return}}}on(t,n,i){if(i===void 0)return super.on(t,n);let o=typeof n=="string"?[n]:n,a=this._createDelegatedListener(t,o,i);this._saveDelegatedListener(t,a);for(let s in a.delegates)this.on(s,a.delegates[s]);return{unsubscribe:()=>{this._removeDelegatedListener(t,o,i)}}}once(t,n,i){if(i===void 0)return super.once(t,n);let o=typeof n=="string"?[n]:n,a=this._createDelegatedListener(t,o,i);for(let s in a.delegates){let l=a.delegates[s];a.delegates[s]=(...u)=>{this._removeDelegatedListener(t,o,i),l(...u)}}this._saveDelegatedListener(t,a);for(let s in a.delegates)this.once(s,a.delegates[s]);return this}off(t,n,i){if(i===void 0)return super.off(t,n);let o=typeof n=="string"?[n]:n;return this._removeDelegatedListener(t,o,i),this}queryRenderedFeatures(t,n){if(!this.style)return[];let i,o=t instanceof Kr.default||Array.isArray(t),a=o?t:[[0,0],[this.transform.width,this.transform.height]];if(n=n||(o?{}:t)||{},a instanceof Kr.default||typeof a[0]=="number")i=[Kr.default.convert(a)];else{let s=Kr.default.convert(a[0]),l=Kr.default.convert(a[1]);i=[s,new Kr.default(l.x,s.y),l,new Kr.default(s.x,l.y),s]}return this.style.queryRenderedFeatures(i,n,this.transform)}querySourceFeatures(t,n){return this.style.querySourceFeatures(t,n)}setStyle(t,n){return n=N({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},n),n.diff!==!1&&n.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,n),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._updateStyle(t,n))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let n=this._locale[t];if(n==null)throw new Error(`Missing UI string '${t}'`);return n}_updateStyle(t,n){if(n.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(t,n));return}let i=this.style&&n.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t)this.style=new bo(this,n||{});else return this.style?.projection?.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof t=="string"?this.style.loadURL(t,n,i):this.style.loadJSON(t,n,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new bo(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,n){if(typeof t=="string"){let i=t,o=this._requestManager.transformRequest(i,"Style");nn(o,new AbortController).then(a=>{this._updateDiff(a.data,n)}).catch(a=>{a&&this.fire(new K(a))})}else typeof t=="object"&&this._updateDiff(t,n)}_updateDiff(t,n){try{this.style.setState(t,n)&&this._update(!0)}catch(i){ue(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(t,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():ue("There is no style added to the map.")}addSource(t,n){return this._lazyInitEmptyStyle(),this.style.addSource(t,n),this._update(!0)}isSourceLoaded(t){let n=this.style&&this.style.sourceCaches[t];if(n===void 0){this.fire(new K(new Error(`There is no source with ID '${t}'`)));return}return n.loaded()}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!t)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);else{let n=this.style.sourceCaches[t.source];if(!n)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain===null&&n.reload();for(let i in this.style._layers){let o=this.style._layers[i];o.type==="hillshade"&&o.source===t.source&&ue("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),o.type==="color-relief"&&o.source===t.source&&ue("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new eh(this.painter,n,t),this.painter.renderToTexture=new rh(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId===t.source&&!this._elevationFreeze&&(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),i.source?.type==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new z("terrain",{terrain:t})),this}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let t=this.style&&this.style.sourceCaches;for(let n in t){let o=t[n]._tiles;for(let a in o){let s=o[a];if(!(s.state==="loaded"||s.state==="errored"))return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}setSourceTileLodParams(t,n,i){if(i){let o=this.getSource(i);if(!o)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);o.calculateTileZoom=yc(Math.max(1,t),Math.max(1,n))}else for(let o in this.style.sourceCaches)this.style.sourceCaches[o].getSource().calculateTileZoom=yc(Math.max(1,t),Math.max(1,n));return this._update(!0),this}refreshTiles(t,n){let i=this.style.sourceCaches[t];if(!i)throw new Error(`There is no source cache with ID "${t}", cannot refresh tile`);n===void 0?i.reload(!0):i.refreshTiles(n.map(o=>new Pn(o.z,o.x,o.y)))}addImage(t,n,i={}){let{pixelRatio:o=1,sdf:a=!1,stretchX:s,stretchY:l,content:u,textFitWidth:c,textFitHeight:p}=i;this._lazyInitEmptyStyle();let h=0;if(n instanceof HTMLImageElement||Mt(n)){let{width:m,height:f,data:y}=re.getImageData(n);this.style.addImage(t,{data:new Se({width:m,height:f},y),pixelRatio:o,stretchX:s,stretchY:l,content:u,textFitWidth:c,textFitHeight:p,sdf:a,version:h})}else{if(n.width===void 0||n.height===void 0)return this.fire(new K(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:m,height:f,data:y}=n,g=n;return this.style.addImage(t,{data:new Se({width:m,height:f},new Uint8Array(y)),pixelRatio:o,stretchX:s,stretchY:l,content:u,textFitWidth:c,textFitHeight:p,sdf:a,version:h,userImage:g}),g.onAdd&&g.onAdd(this,t),this}}}updateImage(t,n){let i=this.style.getImage(t);if(!i)return this.fire(new K(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let o=n instanceof HTMLImageElement||Mt(n)?re.getImageData(n):n,{width:a,height:s,data:l}=o;if(a===void 0||s===void 0)return this.fire(new K(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!==i.data.width||s!==i.data.height)return this.fire(new K(new Error("The width and height of the updated image must be that same as the previous version of the image")));let u=!(n instanceof HTMLImageElement||Mt(n));return i.data.replace(l,u),this.style.updateImage(t,i),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new K(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return wt.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,n){return this._lazyInitEmptyStyle(),this.style.addLayer(t,n),this._update(!0)}moveLayer(t,n){return this.style.moveLayer(t,n),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,n,i){return this.style.setLayerZoomRange(t,n,i),this._update(!0)}setFilter(t,n,i={}){return this.style.setFilter(t,n,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,n,i,o={}){return this.style.setPaintProperty(t,n,i,o),this._update(!0)}getPaintProperty(t,n){return this.style.getPaintProperty(t,n)}setLayoutProperty(t,n,i,o={}){return this.style.setLayoutProperty(t,n,i,o),this._update(!0)}getLayoutProperty(t,n){return this.style.getLayoutProperty(t,n)}setGlyphs(t,n={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,n),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,n,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,n,i,o=>{o||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,n={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,n,i=>{i||this._update(!0)}),this}setLight(t,n={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,n),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,n={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,n),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,n){return this.style.setFeatureState(t,n),this._update()}removeFeatureState(t,n){return this.style.removeFeatureState(t,n),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,n=0;return this._container&&(t=this._container.clientWidth||400,n=this._container.clientHeight||300),[t,n]}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let n=this._canvasContainer=B.create("div","maplibregl-canvas-container",t);this._interactive&&n.classList.add("maplibregl-interactive"),this._canvas=B.create("canvas","maplibregl-canvas",n),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let i=this._containerDimensions(),o=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],o);let a=this._controlContainer=B.create("div","maplibregl-control-container",t),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(l=>{s[l]=B.create("div",`maplibregl-ctrl-${l} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,n,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*n),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${n}px`}_setupPainter(){let t={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},n=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{n={requestedAttributes:t},o&&(n.statusMessage=o.statusMessage,n.type=o.type)},{once:!0});let i=null;if(this._canvasContextAttributes.contextType?i=this._canvas.getContext(this._canvasContextAttributes.contextType,t):i=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t),!i){let o="Failed to initialize WebGL";throw n?(n.message=o,new Error(JSON.stringify(n))):new Error(o)}this.painter=new kp(i,this.transform),Fo.testSupport(i)}migrateProjection(t,n){super.migrateProjection(t,n),this.painter.transform=t,this.fire(new z("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){let n=this._idleTriggered?this._fadeDuration:0,i=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let l=this.transform.zoom,u=re.now();this.style.zoomHistory.update(l,u);let c=new be(l,{now:u,fadeDuration:n,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),p=c.crossFadingFactor();(p!==1||p!==this._crossFadingFactor)&&(o=!0,this._crossFadingFactor=p),this.style.update(c)}let a=this.style.projection?.transitionState>0!==i;this.style.projection?.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(this.style.projection?.transitionState,this.style.projection?.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||a)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,n,this._crossSourceCollisions,a),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:n,showPadding:this.showPadding}),this.fire(new z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,wo.mark("load"),this.fire(new z("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new z("idle")),this._loaded&&!this._fullyLoaded&&!s&&(this._fullyLoaded=!0,wo.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),wt.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t?.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),B.remove(this._canvasContainer),B.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),wo.clearMetrics(),this._removed=!0,this.fire(new z("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,re.frame(this._frameRequest,t=>{wo.frame(t),this._frameRequest=null;try{this._render(t)}catch(n){if(!Ry(n)&&!D1(n))throw n}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return xD}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}};d();var ld=ie(le(),1);var bD={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0},ud=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),n=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())};this._rotateCompassArrow=()=>{if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`;return}this._compassIcon.style.transform=`rotate(${-this._map.transform.bearing}deg)`};this._setButtonTitle=(e,t)=>{let n=this._map._getUIString(`NavigationControl.${t}`);e.title=n,e.setAttribute("aria-label",n)};this.options=N({},bD,e),this._container=B.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),B.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),B.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=B.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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new cd(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){B.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let n=B.create("button",e,this._container);return n.type="button",n.addEventListener("click",t),n}},cd=class{constructor(e,t,n=!1){this.mousedown=e=>{this.startMove(e,B.mousePos(this.element,e)),B.addEventListener(window,"mousemove",this.mousemove),B.addEventListener(window,"mouseup",this.mouseup)};this.mousemove=e=>{this.move(e,B.mousePos(this.element,e))};this.mouseup=e=>{this._rotatePitchHanlder.dragEnd(e),this.offTemp()};this.touchstart=e=>{e.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=B.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),B.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),B.addEventListener(window,"touchend",this.touchend))};this.touchmove=e=>{e.targetTouches.length!==1?this.reset():(this._lastPos=B.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))};this.touchend=e=>{e.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()};this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};this._clickTolerance=10,this.element=t;let i=new Up;this._rotatePitchHanlder=new Yr({clickTolerance:3,move:(o,a)=>{let s=t.getBoundingClientRect(),l=new ld.default((s.bottom-s.top)/2,(s.right-s.left)/2),u=dl(new ld.default(o.x,a.y),a,l),c=n?(a.y-o.y)*-.5:void 0;return{bearingDelta:u,pitchDelta:c}},moveStateManager:i,enable:!0,assignEvents:()=>{}}),this.map=e,B.addEventListener(t,"mousedown",this.mousedown),B.addEventListener(t,"touchstart",this.touchstart,{passive:!1}),B.addEventListener(t,"touchcancel",this.reset)}startMove(e,t){this._rotatePitchHanlder.dragStart(e,t),B.disableDrag()}move(e,t){let n=this.map,{bearingDelta:i,pitchDelta:o}=this._rotatePitchHanlder.dragMove(e,t)||{};i&&n.setBearing(n.getBearing()+i),o&&n.setPitch(n.getPitch()+o)}off(){let e=this.element;B.removeEventListener(e,"mousedown",this.mousedown),B.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),B.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),B.removeEventListener(window,"touchend",this.touchend),B.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){B.enableDrag(),B.removeEventListener(window,"mousemove",this.mousemove),B.removeEventListener(window,"mouseup",this.mouseup),B.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),B.removeEventListener(window,"touchend",this.touchend)}};d();d();var xi;async function Sw(r=!1){if(xi!==void 0&&!r)return xi;if(window.navigator.permissions===void 0)return xi=!!window.navigator.geolocation,xi;try{xi=(await window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{xi=!!window.navigator.geolocation}return xi}d();var Ks=ie(le(),1);d();function oh(r,e,t,n=!1){if(n||!t.getCoveringTilesDetailsProvider().allowWorldCopies())return r?.wrap();let i=new W(r.lng,r.lat);if(r=new W(r.lng,r.lat),e){let o=new W(r.lng-360,r.lat),a=new W(r.lng+360,r.lat),s=t.locationToScreenPoint(r).distSqr(e);t.locationToScreenPoint(o).distSqr(e)<s?r=o:t.locationToScreenPoint(a).distSqr(e)<s&&(r=a)}for(;Math.abs(r.lng-t.center.lng)>180;){let o=t.locationToScreenPoint(r);if(o.x>=0&&o.y>=0&&o.x<=t.width&&o.y<=t.height)break;r.lng>t.center.lng?r.lng-=360:r.lng+=360}return r.lng!==i.lng&&t.isPointOnMapSurface(t.locationToScreenPoint(r))?r:i}d();var Ys={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 ah(r,e,t){let n=r.classList;for(let i in Ys)n.remove(`maplibregl-${t}-anchor-${i}`);n.add(`maplibregl-${t}-anchor-${e}`)}var So=class extends xe{constructor(t){super();this._onKeyPress=t=>{let n=t.code,i=t.charCode||t.keyCode;(n==="Space"||n==="Enter"||i===32||i===13)&&this.togglePopup()};this._onMapClick=t=>{let n=t.originalEvent.target,i=this._element;this._popup&&(n===i||i.contains(n))&&this.togglePopup()};this._update=t=>{if(!this._map)return;let n=this._map.loaded()&&!this._map.isMoving();(t?.type==="terrain"||t?.type==="render"&&!n)&&this._map.once("render",this._update),this._lngLat=oh(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?i=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let o="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?o="rotateX(0deg)":this._pitchAlignment==="map"&&(o=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&(!t||t.type==="moveend")&&(this._pos=this._pos.round()),B.setTransform(this._element,`${Ys[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${o} ${i}`),re.frameAsync(new AbortController).then(()=>{this._updateOpacity(t&&t.type==="moveend")}).catch(()=>{})};this._onMove=t=>{if(!this._isDragging){let n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new z("dragstart"))),this.fire(new z("drag")))};this._onUp=()=>{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),this._state==="active"&&this.fire(new z("dragend")),this._state="inactive"};this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.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))};if(this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),!t||!t.element){this._defaultMarker=!0,this._element=B.create("div");let n=B.createNS("http://www.w3.org/2000/svg","svg"),i=41,o=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${i}px`),n.setAttributeNS(null,"width",`${o}px`),n.setAttributeNS(null,"viewBox",`0 0 ${o} ${i}`);let a=B.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 s=B.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");let l=B.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");let u=[{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 x of u){let b=B.createNS("http://www.w3.org/2000/svg","ellipse");b.setAttributeNS(null,"opacity","0.04"),b.setAttributeNS(null,"cx","10.5"),b.setAttributeNS(null,"cy","5.80029008"),b.setAttributeNS(null,"rx",x.rx),b.setAttributeNS(null,"ry",x.ry),l.appendChild(b)}let c=B.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);let p=B.createNS("http://www.w3.org/2000/svg","path");p.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"),c.appendChild(p);let h=B.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"opacity","0.25"),h.setAttributeNS(null,"fill","#000000");let m=B.createNS("http://www.w3.org/2000/svg","path");m.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(m);let f=B.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");let y=B.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(8.0, 8.0)");let g=B.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");let _=B.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),y.appendChild(g),y.appendChild(_),s.appendChild(l),s.appendChild(c),s.appendChild(h),s.appendChild(f),s.appendChild(y),n.appendChild(s),n.setAttributeNS(null,"height",`${i*this._scale}px`),n.setAttributeNS(null,"width",`${o*this._scale}px`),this._element.appendChild(n),this._offset=Ks.default.convert(t&&t.offset||[0,-14])}else this._element=t.element,this._offset=Ks.default.convert(t&&t.offset||[0,0]);if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",n=>{n.preventDefault()}),this._element.addEventListener("mousedown",n=>{n.preventDefault()}),ah(this._element,this._anchor,"marker"),t&&t.className)for(let n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",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("terrain",this._update),this._map.off("projectiontransition",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),B.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=W.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){let o=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,(38.1-13.5+o)*-1],"bottom-right":[-o,(38.1-13.5+o)*-1],left:[13.5,(38.1-13.5)*-1],right:[-13.5,(38.1-13.5)*-1]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){let t=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(t)t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map));else return this;return this}_updateOpacity(t=!1){let n=this._map?.terrain,i=this._map.transform.isLocationOccluded(this._lngLat);if(!n||i){let y=i?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==y&&(this._element.style.opacity=y);return}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,a=o.terrain.depthAtPoint(this._pos),s=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom),l=o.transform.lngLatToCameraDepth(this._lngLat,s),u=.006;if(l-a<u){this._element.style.opacity=this._opacity;return}let c=-this._offset.y/o.transform.pixelsPerMeter,p=Math.sin(o.getPitch()*Math.PI/180)*c,h=o.terrain.depthAtPoint(new Ks.default(this._pos.x,this._pos.y-this._offset.y)),f=o.transform.lngLatToCameraDepth(this._lngLat,s+p)-h>u;this._popup?.isOpen()&&f&&this._popup.remove(),this._element.style.opacity=f?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=Ks.default.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(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(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return(this._opacity===void 0||t===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}};var vD={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},sh=0,Js=!1,pd=class extends xe{constructor(t){super();this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t)){this._setErrorState(),this.fire(new z("outofmaxbounds",t)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,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&&this._watchState!=="OFF"&&this._updateMarker(t),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new z("geolocate",t)),this._finish()}};this._updateCamera=t=>{let n=new W(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,o=this._map.getBearing(),a=N({bearing:o},this.options.fitBoundsOptions),s=rt.fromLngLat(n,i);this._map.fitBounds(s,a,{geolocateSource:!0})};this._updateMarker=t=>{if(t){let n=new W(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()};this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()};this._onError=t=>{if(this._map){if(t.code===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._geolocateButton.disabled=!0;let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Js)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new z("error",t)),this._finish()}};this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0};this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=B.create("button","maplibregl-ctrl-geolocate",this._container),B.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)};this._finishSetupUI=t=>{if(this._map){if(t===!1){ue("Geolocation support is not available so the GeolocateControl will be disabled.");let n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{let n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=B.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new So({element:this._dotElement}),this._circleElement=B.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new So({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",n=>{let i=n.originalEvent&&n.originalEvent.type==="resize";!n.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!i&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new z("trackuserlocationend")),this.fire(new z("userlocationlostfocus")))})}};this.options=N({},vD,t)}onAdd(t){return this._map=t,this._container=B.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),Sw().then(n=>this._finishSetupUI(n)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(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(),B.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,sh=0,Js=!1}_isOutOfMapMaxBounds(t){let n=this._map.getMaxBounds(),i=t.coords;return n&&(i.longitude<n.getWest()||i.longitude>n.getEast()||i.latitude<n.getSouth()||i.latitude>n.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 t=this._map.getBounds(),n=t.getSouthEast(),i=t.getNorthEast(),o=n.distanceTo(i),a=this._map._container.clientHeight,s=Math.ceil(2*(this._accuracy/(o/a)));this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}px`}trigger(){if(!this._setup)return ue("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":sh--,Js=!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")),this.fire(new z("userlocationfocus"));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(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),sh++;let t;sh>1?(t={maximumAge:6e5,timeout:0},Js=!0):(t=this.options.positionOptions,Js=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}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)}};d();var wD={maxWidth:100,unit:"metric"},hd=class{constructor(e){this._onMove=()=>{Tw(this._map,this._container,this.options)};this.setUnit=e=>{this.options.unit=e,Tw(this._map,this._container,this.options)};this.options={...wD,...e}}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=B.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){B.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}};function Tw(r,e,t){let n=t&&t.maxWidth||100,i=r._container.clientHeight/2,o=r._container.clientWidth/2,a=r.unproject([o-n/2,i]),s=r.unproject([o+n/2,i]),l=Math.round(r.project(s).x-r.project(a).x),u=Math.min(n,l,r._container.clientWidth),c=a.distanceTo(s);if(t&&t.unit==="imperial"){let p=3.2808*c;if(p>5280){let h=p/5280;Qs(e,u,h,r._getUIString("ScaleControl.Miles"))}else Qs(e,u,p,r._getUIString("ScaleControl.Feet"))}else if(t&&t.unit==="nautical"){let p=c/1852;Qs(e,u,p,r._getUIString("ScaleControl.NauticalMiles"))}else c>=1e3?Qs(e,u,c/1e3,r._getUIString("ScaleControl.Kilometers")):Qs(e,u,c,r._getUIString("ScaleControl.Meters"))}function Qs(r,e,t,n){let i=SD(t),o=i/t;r.style.width=`${e*o}px`,r.innerHTML=`${i}&nbsp;${n}`}function PD(r){let e=Math.pow(10,Math.ceil(-Math.log(r)/Math.LN10));return Math.round(r*e)/e}function SD(r){let e=Math.pow(10,`${Math.floor(r)}`.length-1),t=r/e;return t=t>=10?10:t>=5?5:t>=3?3:t>=2?2:t>=1?1:PD(t),e*t}d();var md=class extends xe{constructor(t={}){super();this._onFullscreenChange=()=>{let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;t?.shadowRoot?.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()};this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()};this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:ue("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(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=B.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){B.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=B.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);B.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_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._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new z("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_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()}};d();var fd=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()};this._updateTerrainIcon=()=>{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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))};this.options=e}onAdd(e){return this._map=e,this._container=B.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=B.create("button","maplibregl-ctrl-terrain",this._container),B.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(){B.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}};d();var dd=class{constructor(){this._toggleProjection=()=>{let e=this._map.getProjection()?.type;e==="mercator"||!e?this._map.setProjection({type:"globe"}):this._map.setProjection({type:"mercator"}),this._updateGlobeIcon()};this._updateGlobeIcon=()=>{this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),this._map.getProjection()?.type==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=B.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=B.create("button","maplibregl-ctrl-globe",this._container),B.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){B.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}};d();var Ke=ie(le(),1);var TD={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},MD=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),yd=class extends xe{constructor(t){super();this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._map.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity=void 0)};this.remove=()=>(this._content&&B.remove(this._content),this._container&&(B.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new z("close"))),this);this._onMouseUp=t=>{this._update(t.point)};this._onMouseMove=t=>{this._update(t.point)};this._onDrag=t=>{this._update(t.point)};this._update=t=>{let n=this._lngLat||this._trackPointer;if(!this._map||!n||!this._content)return;if(!this._container){if(this._container=B.create("div","maplibregl-popup",this._map.getContainer()),this._tip=B.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let l of this.options.className.split(" "))this._container.classList.add(l);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),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._lngLat=oh(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!t)return;let i=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let o=this.options.anchor,a=Mw(this.options.offset);if(!o){let l=this._container.offsetWidth,u=this._container.offsetHeight,c;i.y+a.bottom.y<u?c=["top"]:i.y>this._map.transform.height-u?c=["bottom"]:c=[],i.x<l/2?c.push("left"):i.x>this._map.transform.width-l/2&&c.push("right"),c.length===0?o="bottom":o=c.join("-")}let s=i.add(a[o]);this.options.subpixelPositioning||(s=s.round()),B.setTransform(this._container,`${Ys[o]} translate(${s.x}px,${s.y}px)`),ah(this._container,o,"popup"),this._updateOpacity()};this._onClose=()=>{this.remove()};this.options=N(Object.create(TD),t)}addTo(t){return this._map&&this.remove(),this._map=t,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(t){return this._lngLat=W.convert(t),this._pos=null,this._flatPos=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._flatPos=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(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let n=document.createDocumentFragment(),i=document.createElement("body"),o;for(i.innerHTML=t;o=i.firstChild,!!o;)n.appendChild(o);return this.setDOMContent(n)}getMaxWidth(){return this._container?.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=B.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}_createCloseButton(){this.options.closeButton&&(this._closeButton=B.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let t=this._container.querySelector(MD);t&&t.focus()}};function Mw(r){if(r)if(typeof r=="number"){let e=Math.round(Math.abs(r)/Math.SQRT2);return{center:new Ke.default(0,0),top:new Ke.default(0,r),"top-left":new Ke.default(e,e),"top-right":new Ke.default(-e,e),bottom:new Ke.default(0,-r),"bottom-left":new Ke.default(e,-e),"bottom-right":new Ke.default(-e,-e),left:new Ke.default(r,0),right:new Ke.default(-r,0)}}else if(r instanceof Ke.default||Array.isArray(r)){let e=Ke.default.convert(r);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}else return{center:Ke.default.convert(r.center||[0,0]),top:Ke.default.convert(r.top||[0,0]),"top-left":Ke.default.convert(r["top-left"]||[0,0]),"top-right":Ke.default.convert(r["top-right"]||[0,0]),bottom:Ke.default.convert(r.bottom||[0,0]),"bottom-left":Ke.default.convert(r["bottom-left"]||[0,0]),"bottom-right":Ke.default.convert(r["bottom-right"]||[0,0]),left:Ke.default.convert(r.left||[0,0]),right:Ke.default.convert(r.right||[0,0])};else return Mw(new Ke.default(0,0))}var CD=ie(le(),1);var AD=tl.version;function $se(r,e){return Tn().setRTLTextPlugin(r,e)}function Hse(){return Tn().getRTLTextPluginStatus()}function qse(){return AD}function Wse(){return wn.workerCount}function Xse(r){wn.workerCount=r}function Yse(){return ot.MAX_PARALLEL_IMAGE_REQUESTS}function Kse(r){ot.MAX_PARALLEL_IMAGE_REQUESTS=r}function Jse(){return ot.WORKER_URL}function Qse(r){ot.WORKER_URL=r}function ele(r){return uc().broadcast("IS",r)}export{ot as a,O2 as b,V2 as c,rn as d,z as e,xe as f,AE as g,IE as h,W as i,rt as j,fe as k,os as l,pi as m,as as n,ss as o,Gt as p,us as q,cs as r,jE as s,po as t,d0 as u,bo as v,Rp as w,Is as x,ht as y,Dn as z,ks as A,Rs as B,Bs as C,Os as D,Vs as E,Us as F,js as G,Ns as H,Gs as I,Zs as J,$s as K,Hs as L,qs as M,Ws as N,sd as O,ud as P,So as Q,pd as R,hd as S,md as T,fd as U,dd as V,yd as W,CD as X,$se as Y,Hse as Z,qse as _,Wse as $,Xse as aa,Yse as ba,Kse as ca,Jse as da,Qse as ea,ele as fa};
747
+ //# sourceMappingURL=chunk-R6ACEBVD.js.map