PageSourceSearch

https://backroadstatus.com/js/bundle.js

js backroadstatus.com collected 2026-10-05 22:49:55 UTC 1,560,983 bytes, 2 lines download raw bytes

1/*! For license information please see bundle.js.LICENSE.txt */
2(()=>{var e={778:(e,t,i)=>{var r=i(628);function n(e){var t=0;if(e&&e.length>0){t+=Math.abs(o(e[0]));for(var i=1;i<e.length;i++)t-=Math.abs(o(e[i]))}return t}function o(e){var t,i,n,o,a,l,c=0,u=e.length;if(u>2){for(l=0;l<u;l++)l===u-2?(n=u-2,o=u-1,a=0):l===u-1?(n=u-1,o=0,a=1):(n=l,o=l+1,a=l+2),t=e[n],i=e[o],c+=(s(e[a][0])-s(t[0]))*Math.sin(s(i[1]));c=c*r.RADIUS*r.RADIUS/2}return c}function s(e){return e*Math.PI/180}e.exports.geometry=function e(t){var i,r=0;switch(t.type){case"Polygon":return n(t.coordinates);case"MultiPolygon":for(i=0;i<t.coordinates.length;i++)r+=n(t.coordinates[i]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(i=0;i<t.geometries.length;i++)r+=e(t.geometries[i]);return r}},e.exports.ring=o},186:e=>{e.exports=function(e){if(!e||!e.type)return null;var i=t[e.type];return i?"geometry"===i?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:e}]}:"feature"===i?{type:"FeatureCollection",features:[e]}:"featurecollection"===i?e:void 0:null};var t={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"}},17:e=>{"use strict";e.exports=function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var r,n,o;if(Array.isArray(t)){if((r=t.length)!=i.length)return!1;for(n=r;0!=n--;)if(!e(t[n],i[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(i,o[n]))return!1;for(n=r;0!=n--;){var s=o[n];if(!e(t[s],i[s]))return!1}return!0}return t!=t&&i!=i}},181:(e,t,i)=>{var r=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=parseInt,l="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),h=Object.prototype.toString,d=Math.max,p=Math.min,f=function(){return u.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==h.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var i=o.test(e);return i||s.test(e)?a(e.slice(2),i?2:8):n.test(e)?NaN:+e}e.exports=function(e,t,i){var r,n,o,s,a,l,c=0,u=!1,h=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function _(t){var i=r,o=n;return r=n=void 0,c=t,s=e.apply(o,i)}function v(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-c>=o}function b(){var e=f();if(v(e))return x(e);a=setTimeout(b,function(e){var i=t-(e-l);return h?p(i,o-(e-c)):i}(e))}function x(e){return a=void 0,y&&r?_(e):(r=n=void 0,s)}function w(){var e=f(),i=v(e);if(r=arguments,n=this,l=e,i){if(void 0===a)return function(e){return c=e,a=setTimeout(b,t),u?_(e):s}(l);if(h)return a=setTimeout(b,t),_(l)}return void 0===a&&(a=setTimeout(b,t)),s}return t=g(t)||0,m(i)&&(u=!!i.leading,o=(h="maxWait"in i)?d(g(i.maxWait)||0,t):o,y="trailing"in i?!!i.trailing:y),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=l=n=a=void 0},w.flush=function(){return void 0===a?s:x(f())},w}},254:function(e){e.exports=function(){"use strict";var e=Math.PI/180,t=180/Math.PI;function i(e){var t=r(e[0]+1,e[2]);return[r(e[0],e[2]),n(e[1]+1,e[2]),t,n(e[1],e[2])]}function r(e,t){return e/Math.pow(2,t)*360-180}function n(e,i){var r=Math.PI-2*Math.PI*e/Math.pow(2,i);return t*Math.atan(.5*(Math.exp(r)-Math.exp(-r)))}function o(e,t,i){var r=h(e,t,i);return r[0]=Math.floor(r[0]),r[1]=Math.floor(r[1]),r}function s(e){return[[2*e[0],2*e[1],e[2]+1],[2*e[0]+1,2*e[1],e[2]+1],[2*e[0]+1,2*e[1]+1,e[2]+1],[2*e[0],2*e[1]+1,e[2]+1]]}function a(e){return[e[0]>>1,e[1]>>1,e[2]-1]}function l(e){return s(a(e))}function c(e,t){for(var i=0;i<e.length;i++)if(u(e[i],t))return!0;return!1}function u(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function h(t,i,r){var n=Math.sin(i*e),o=Math.pow(2,r),s=o*(t/360+.5);return(s%=o)<0&&(s+=o),[s,o*(.5-.25*Math.log((1+n)/(1-n))/Math.PI),r]}var d={tileToGeoJSON:function(e){var t=i(e);return{type:"Polygon",coordinates:[[[t[0],t[3]],[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]]]]}},tileToBBOX:i,getChildren:s,getParent:a,getSiblings:l,hasTile:c,hasSiblings:function(e,t){for(var i=l(e),r=0;r<i.length;r++)if(!c(t,i[r]))return!1;return!0},tilesEqual:u,tileToQuadkey:function(e){for(var t="",i=e[2];i>0;i--){var r=0,n=1<<i-1;!!(e[0]&n)&&r++,!!(e[1]&n)&&(r+=2),t+=r.toString()}return t}
vendor: 4,559 bytes, line 2
2,quadkeyToTile:function(e){for(var t=0,i=0,r=e.length,n=r;n>0;n--){var o=1<<n-1,s=+e[r-n];1===s&&(t|=o),2===s&&(i|=o),3===s&&(t|=o,i|=o)}return[t,i,r]},pointToTile:o,bboxToTile:function(e){var t=o(e[0],e[1],32),i=o(e[2],e[3],32),r=[t[0],t[1],i[0],i[1]],n=function(e){for(var t=0;t<28;t++){var i=1<<32-(t+1);if((e[0]&i)!=(e[2]&i)||(e[1]&i)!=(e[3]&i))return t}return 28}(r);return 0===n?[0,0,0]:[r[0]>>>32-n,r[1]>>>32-n,n]},pointToTileFraction:h},p={read:function(e,t,i,r,n){var o,s,a=8*n-r-1,l=(1<<a)-1,c=l>>1,u=-7,h=i?n-1:0,d=i?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},write:function(e,t,i,r,n,o){var s,a,l,c=8*o-n-1,u=(1<<c)-1,h=u>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*l-1)*Math.pow(2,n),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;e[i+p]=255&a,p+=f,a/=256,n-=8);for(s=s<<n|a,c+=n;c>0;e[i+p]=255&s,p+=f,s/=256,c-=8);e[i+p-f]|=128*m}},f=g,m=p;function g(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}g.Varint=0,g.Fixed64=1,g.Bytes=2,g.Fixed32=5;var y,_=4294967296,v=1/_,b="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function x(e){return e.type===g.Bytes?e.readVarint()+e.pos:e.pos+1}function w(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function T(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function E(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function S(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function P(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function I(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function C(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function M(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function A(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function L(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function F(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function D(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function k(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function O(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}g.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,e(n,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=D(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=O(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=D(this.buf,this.pos)+D(this.buf,this.pos+4)*_;return this.pos+=8,e},readSFixed64:function(){var e=D(this.buf,this.pos)+O(this.buf,this.pos+4)*_;return this.pos+=8,e},readFloat:function(){var e=m.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=m.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return w(e,r,t);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return w(e,r,t);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return w(e,r,t);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return w(e,r,t);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return w(e,r,t);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return w(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&b?function(e,t,i){return b.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var r="",n=t;n<i;){var o,s,a,l=e[n],c=null,u=l>239?4:l>223?3:l>191?2:1;if(n+u>i)break;
vendor: 6,214 bytes, line 2
21===u?l<128&&(c=l):2===u?128==(192&(o=e[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(o=e[n+1],s=e[n+2],a=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=u}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==g.Bytes)return e.push(this.readVarint(t));var i=x(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==g.Bytes)return e.push(this.readSVarint());var t=x(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==g.Bytes)return e.push(this.readBoolean());var t=x(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==g.Bytes)return e.push(this.readFloat());var t=x(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==g.Bytes)return e.push(this.readDouble());var t=x(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==g.Bytes)return e.push(this.readFixed32());var t=x(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==g.Bytes)return e.push(this.readSFixed32());var t=x(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==g.Bytes)return e.push(this.readFixed64());var t=x(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==g.Bytes)return e.push(this.readSFixed64());var t=x(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===g.Varint)for(;this.buf[this.pos++]>127;);else if(t===g.Bytes)this.pos=this.readVarint()+this.pos;else if(t===g.Fixed32)this.pos+=4;else{if(t!==g.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),k(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),k(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),k(this.buf,-1&e,this.pos),k(this.buf,Math.floor(e*v),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),k(this.buf,-1&e,this.pos),k(this.buf,Math.floor(e*v),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,o=0;o<t.length;o++){if((r=t.charCodeAt(o))>55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&T(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),m.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),m.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&T(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,g.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,E,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,S,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,C,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,P,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,I,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,M,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,A,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,L,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,F,t)},writeBytesField:function(e,t){this.writeTag(e,g.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,g.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,g.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,g.Fixed64),this.writeFixed64
2(t)},writeSFixed64Field:function(e,t){this.writeTag(e,g.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,g.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,g.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,g.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,g.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,g.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var R=y={};function z(e,t){return{type:"Point",coordinates:q(e.geometry.coords,t)}}function N(e,t){return{type:"LineString",coordinates:j(e.geometry.coords,t,0,2*e.geometry.lengths[0])}}function B(e,t){const i=e.geometry.lengths.length,r={type:"Polygon",coordinates:[]};if(1===i)r.coordinates.push(j(e.geometry.coords,t,0,2*e.geometry.lengths[0]));else{r.type="MultiPolygon";let n=0;for(let o=0;o<i;o++){const i=n+2*e.geometry.lengths[o],s=j(e.geometry.coords,t,n,i);V(s)?r.coordinates.push([s]):r.coordinates.length>0&&r.coordinates[r.coordinates.length-1].push(s),n=i}}return r}function V(e){for(var t,i=0,r=0,n=e.length,o=e[r];r<n-1;r++)i+=((t=e[r+1])[0]-o[0])*(t[1]+o[1]),o=t;return i>=0}function j(e,t,i,r){const n=[];if(0===e.length)return n;const o=e[i],s=e[i+1];n.push(q([o,s],t));let a=o,l=s;for(let o=i+2;o<r;o+=2){const i=Z(a,e[o]),r=Z(l,e[o+1]),s=q([i,r],t);n.push(s),a=i,l=r}return n}function U(e,t){const i={};for(let r=0;r<e.length;r++){const n=e[r];t[r][t[r].value_type]?i[n.name]=t[r][t[r].value_type]:i[n.name]=null}return i}function G(e,t,i){for(let r=0;r<e.length;r++)if(e[r].name===i)return t[r][t[r].value_type];return null}function $(e){switch(e.fieldType){case 1:return"sintValue";case 2:return"floatValue";case 3:return"doubleValue";case 4:return"stringValue";case 5:return"sint64Value";case 6:return"uintValue";default:return null}}function q(e,t){let i=e[0],r=e[1],n=e[2]?e[2]:void 0;t.scale&&(i*=t.scale.xScale,r*=-t.scale.yScale,void 0!==n&&(n*=t.scale.zScale)),t.translate&&(i+=t.translate.xTranslate,r+=t.translate.yTranslate,void 0!==n&&(n+=t.translate.zTranslate));const o=[i,r];return void 0!==n&&o.push(n),o}function Z(e,t){return e+t}return R.read=function(e,t){return e.readFields(R._readField,{version:"",queryResult:null},t)},R._readField=function(e,t,i){1===e?t.version=i.readString():2===e&&(t.queryResult=R.QueryResult.read(i,i.readVarint()+i.pos))},R.write=function(e,t){e.version&&t.writeStringField(1,e.version),e.queryResult&&t.writeMessage(2,R.QueryResult.write,e.queryResult)},R.GeometryType={esriGeometryTypePoint:{value:0,options:{}},esriGeometryTypeMultipoint:{value:1,options:{}},esriGeometryTypePolyline:{value:2,options:{}},esriGeometryTypePolygon:{value:3,options:{}},esriGeometryTypeMultipatch:{value:4,options:{}},esriGeometryTypeNone:{value:127,options:{}}},R.FieldType={esriFieldTypeSmallInteger:{value:0,options:{}},esriFieldTypeInteger:{value:1,options:{}},esriFieldTypeSingle:{value:2,options:{}},esriFieldTypeDouble:{value:3,options:{}},esriFieldTypeString:{value:4,options:{}},esriFieldTypeDate:{value:5,options:{}},esriFieldTypeOID:{value:6,options:{}},esriFieldTypeGeometry:{value:7,options:{}},esriFieldTypeBlob:{value:8,options:{}},esriFieldTypeRaster:{value:9,options:{}},esriFieldTypeGUID:{value:10,options:{}},esriFieldTypeGlobalID:{value:11,options:{}},esriFieldTypeXML:{value:12,options:{}}},R.SQLType={sqlTypeBigInt:{value:0,options:{}},sqlTypeBinary:{value:1,options:{}},sqlTypeBit:{value:2,options:{}},sqlTypeChar:{value:3,options:{}},sqlTypeDate:{value:4,options:{}},sqlTypeDecimal:{value:5,options:{}},sqlTypeDouble:{value:6,options:{}},sqlTypeFloat:{value:7,options:{}},sqlTypeGeometry:{value:8,options:{}},sqlTypeGUID:{value:9,options:{}},sqlTypeInteger:{value:10,options:{}},sqlTypeLongNVarchar:{value:11,options:{}},sqlTypeLongVarbinary:{value:12,options:{}},sqlTypeLongVarchar:{value:13,options:{}},sqlTypeNChar:{value:14,options:{}},sqlTypeNVarchar:{value:15,options:{}},sqlTypeOther:{value:16,options:{}},sqlTypeReal:{value:17,options:{}},sqlTypeSmallInt:{value:18,options:{}},sqlTypeSqlXml:{value:19,options:{}},sqlTypeTime:{value:20,options:{}},sqlTypeTimestamp:{value:21,options:{}},sqlTypeTimestamp2:{value:22,options:{}},sqlTypeTinyInt:{value:23,options:{}},sqlTypeVarbinary:{value:24,options:{}},sqlTypeVarchar:{value:25,options:{}}},R.QuantizeOriginPostion={upperLeft:{value:0,options:{}},lowerLeft:{value:1,options:{}}},R.SpatialReference={},R.SpatialReference.read=function(e,t){return e.readFields(R.SpatialReference._readField,{wkid:0,lastestWkid:0,vcsWkid:0,latestVcsWkid:0,wkt:""},t)},R.SpatialReference._readField=function(e,t,i){1===e?t.wkid=i.readVarint():2===e?t.lastestWkid=i.readVarint():3===e?t.vcsWkid=i.readVarint():4===e?t.latestVcsWkid=i.readVarint():5===e&&(t.wkt=i.readString())},R.SpatialReference.write=function(e,t){e.wkid&&t.writeVarintField(1,e.wkid),e.lastestWkid&&t.writeVarintField(2,e.lastestWkid),e.vcsWkid&&t.writeVarintField(3,e.vcsWkid),e.latestVcsWkid&&t.writeVarintField(4,e.latestVcsWkid),e.wkt&&t.writeStringField(5,e.wkt)},R.Field={},R.Field.read=function(e,t){return e.readFields(R.Field._readField,{name:"",fieldType:0,alias:"",sqlType:0,domain:"",defaultValue:""},t)},R.Field._readField=function(e,t,i){1===e?t.name=i.readString():2===e?t.fieldType=i.readVarint():3===e?t.alias=i.readString():4===e?t.sqlType=i.readVarint():5===e?t.domain=i.readString():6===e&&(t.defaultValue=i.readString())},R.Field.write=function(e,t){e.name&&t.writeStringField(1,e.name),e.fieldType&&t.writeVarintField(2,e.fieldType),e.alias&&t.writeStringField(3,e.alias),e.sqlType&&t.writeVarintField(4,e.
2sqlType),e.domain&&t.writeStringField(5,e.domain),e.defaultValue&&t.writeStringField(6,e.defaultValue)},R.Value={},R.Value.read=function(e,t){return e.readFields(R.Value._readField,{string_value:"",value_type:null,float_value:0,double_value:0,sint_value:0,uint_value:0,int64_value:0,uint64_value:0,sint64_value:0,bool_value:!1},t)},R.Value._readField=function(e,t,i){1===e?(t.string_value=i.readString(),t.value_type="string_value"):2===e?(t.float_value=i.readFloat(),t.value_type="float_value"):3===e?(t.double_value=i.readDouble(),t.value_type="double_value"):4===e?(t.sint_value=i.readSVarint(),t.value_type="sint_value"):5===e?(t.uint_value=i.readVarint(),t.value_type="uint_value"):6===e?(t.int64_value=i.readVarint(!0),t.value_type="int64_value"):7===e?(t.uint64_value=i.readVarint(),t.value_type="uint64_value"):8===e?(t.sint64_value=i.readSVarint(),t.value_type="sint64_value"):9===e&&(t.bool_value=i.readBoolean(),t.value_type="bool_value")},R.Value.write=function(e,t){e.string_value&&t.writeStringField(1,e.string_value),e.float_value&&t.writeFloatField(2,e.float_value),e.double_value&&t.writeDoubleField(3,e.double_value),e.sint_value&&t.writeSVarintField(4,e.sint_value),e.uint_value&&t.writeVarintField(5,e.uint_value),e.int64_value&&t.writeVarintField(6,e.int64_value),e.uint64_value&&t.writeVarintField(7,e.uint64_value),e.sint64_value&&t.writeSVarintField(8,e.sint64_value),e.bool_value&&t.writeBooleanField(9,e.bool_value)},R.Geometry={},R.Geometry.read=function(e,t){return e.readFields(R.Geometry._readField,{lengths:[],coords:[]},t)},R.Geometry._readField=function(e,t,i){2===e?i.readPackedVarint(t.lengths):3===e&&i.readPackedSVarint(t.coords)},R.Geometry.write=function(e,t){e.lengths&&t.writePackedVarint(2,e.lengths),e.coords&&t.writePackedSVarint(3,e.coords)},R.esriShapeBuffer={},R.esriShapeBuffer.read=function(e,t){return e.readFields(R.esriShapeBuffer._readField,{bytes:null},t)},R.esriShapeBuffer._readField=function(e,t,i){1===e&&(t.bytes=i.readBytes())},R.esriShapeBuffer.write=function(e,t){e.bytes&&t.writeBytesField(1,e.bytes)},R.Feature={},R.Feature.read=function(e,t){return e.readFields(R.Feature._readField,{attributes:[],geometry:null,compressed_geometry:null,shapeBuffer:null,centroid:null},t)},R.Feature._readField=function(e,t,i){1===e?t.attributes.push(R.Value.read(i,i.readVarint()+i.pos)):2===e?(t.geometry=R.Geometry.read(i,i.readVarint()+i.pos),t.compressed_geometry="geometry"):3===e?(t.shapeBuffer=R.esriShapeBuffer.read(i,i.readVarint()+i.pos),t.compressed_geometry="shapeBuffer"):4===e&&(t.centroid=R.Geometry.read(i,i.readVarint()+i.pos))},R.Feature.write=function(e,t){if(e.attributes)for(var i=0;i<e.attributes.length;i++)t.writeMessage(1,R.Value.write,e.attributes[i]);e.geometry&&t.writeMessage(2,R.Geometry.write,e.geometry),e.shapeBuffer&&t.writeMessage(3,R.esriShapeBuffer.write,e.shapeBuffer),e.centroid&&t.writeMessage(4,R.Geometry.write,e.centroid)},R.UniqueIdField={},R.UniqueIdField.read=function(e,t){return e.readFields(R.UniqueIdField._readField,{name:"",isSystemMaintained:!1}
2,t)},R.UniqueIdField._readField=function(e,t,i){1===e?t.name=i.readString():2===e&&(t.isSystemMaintained=i.readBoolean())},R.UniqueIdField.write=function(e,t){e.name&&t.writeStringField(1,e.name),e.isSystemMaintained&&t.writeBooleanField(2,e.isSystemMaintained)},R.GeometryProperties={},R.GeometryProperties.read=function(e,t){return e.readFields(R.GeometryProperties._readField,{shapeAreaFieldName:"",shapeLengthFieldName:"",units:""},t)},R.GeometryProperties._readField=function(e,t,i){1===e?t.shapeAreaFieldName=i.readString():2===e?t.shapeLengthFieldName=i.readString():3===e&&(t.units=i.readString())},R.GeometryProperties.write=function(e,t){e.shapeAreaFieldName&&t.writeStringField(1,e.shapeAreaFieldName),e.shapeLengthFieldName&&t.writeStringField(2,e.shapeLengthFieldName),e.units&&t.writeStringField(3,e.units)},R.ServerGens={},R.ServerGens.read=function(e,t){return e.readFields(R.ServerGens._readField,{minServerGen:0,serverGen:0},t)},R.ServerGens._readField=function(e,t,i){1===e?t.minServerGen=i.readVarint():2===e&&(t.serverGen=i.readVarint())},R.ServerGens.write=function(e,t){e.minServerGen&&t.writeVarintField(1,e.minServerGen),e.serverGen&&t.writeVarintField(2,e.serverGen)},R.Scale={},R.Scale.read=function(e,t){return e.readFields(R.Scale._readField,{xScale:0,yScale:0,mScale:0,zScale:0},t)},R.Scale._readField=function(e,t,i){1===e?t.xScale=i.readDouble():2===e?t.yScale=i.readDouble():3===e?t.mScale=i.readDouble():4===e&&(t.zScale=i.readDouble())},R.Scale.write=function(e,t){e.xScale&&t.writeDoubleField(1,e.xScale),e.yScale&&t.writeDoubleField(2,e.yScale),e.mScale&&t.writeDoubleField(3,e.mScale),e.zScale&&t.writeDoubleField(4,e.zScale)},R.Translate={},R.Translate.read=function(e,t){return e.readFields(R.Translate._readField,{xTranslate:0,yTranslate:0,mTranslate:0,zTranslate:0},t)},R.Translate._readField=function(e,t,i){1===e?t.xTranslate=i.readDouble():2===e?t.yTranslate=i.readDouble():3===e?t.mTranslate=i.readDouble():4===e&&(t.zTranslate=i.readDouble())},R.Translate.write=function(e,t){e.xTranslate&&t.writeDoubleField(1,e.xTranslate),e.yTranslate&&t.writeDoubleField(2,e.yTranslate),e.mTranslate&&t.writeDoubleField(3,e.mTranslate),e.zTranslate&&t.writeDoubleField(4,e.zTranslate)},R.Transform={},R.Transform.read=function(e,t){return e.readFields(R.Transform._readField,{quantizeOriginPostion:0,scale:null,translate:null},t)},R.Transform._readField=function(e,t,i){1===e?t.quantizeOriginPostion=i.readVarint():2===e?t.scale=R.Scale.read(i,i.readVarint()+i.pos):3===e&&(t.translate=R.Translate.read(i,i.readVarint()+i.pos))},R.Transform.write=function(e,t){e.quantizeOriginPostion&&t.writeVarintField(1,e.quantizeOriginPostion),e.scale&&t.writeMessage(2,R.Scale.write,e.scale),e.translate&&t.writeMessage(3,R.Translate.write,e.translate)},R.FeatureResult={},R.FeatureResult.read=function(e,t){return e.readFields(R.FeatureResult._readField,{objectIdFieldName:"",uniqueIdField:null,globalIdFieldName:"",geohashFieldName:"",geometryProperties:null,serverGens:null,geometryType:0,spatialReference:null,exceededTransferLimit:!1,hasZ:!1,hasM:!1,transform:null,fields:[],values:[],features:[]},t)},R.FeatureResult._readField=function(e,t,i){1===e?t.objectIdFieldName=i.readString():2===e?t.uniqueIdField=R.UniqueIdField.read(i,i.readVarint()+i.pos):3===e?t.globalIdFieldName=i.readString():4===e?t.geohashFieldName=i.readString():5===e?t.geometryProperties=R.GeometryProperties.read(i,i.readVarint()+i.pos):6===e?t.serverGens=R.ServerGens.read(i,i.readVarint()+i.pos):7===e?t.geometryType=i.readVarint():8===e?t.spatialReference=R.SpatialReference.read(i,i.readVarint()+i.pos):9===e?t.exceededTransferLimit=i.readBoolean():10===e?t.hasZ=i.readBoolean():11===e?t.hasM=i.readBoolean():12===e?t.transform=R.Transform.read(i,i.readVarint()+i.pos):13===e?t.fields.push(R.Field.read(i,i.readVarint()+i.pos)):14===e?t.values.push(R.Value.read(i,i.readVarint()+i.pos)):15===e&&t.features.push(R.Feature.read(i,i.readVarint()+i.pos))},R.FeatureResult.write=function(e,t){if(e.objectIdFieldName&&t.writeStringField(1,e.objectIdFieldName),e.uniqueIdField&&t.writeMessage(2,R.UniqueIdField.write,e.uniqueIdField),e.globalIdFieldName&&t.writeStringField(3,e.globalIdFieldName),e.geohashFieldName&&t.writeStringField(4,e.geohashFieldName),e.geometryProperties&&t.writeMessage(5,R.GeometryProperties.write,e.geometryProperties),e.serverGens&&t.writeMessage(6,R.ServerGens.write,e.serverGens),e.geometryType&&t.writeVarintField(7,e.geometryType),e.spatialReference&&t.writeMessage(8,R.SpatialReference.write,e.spatialReference),e.exceededTransferLimit&&t.writeBooleanField(9,e.exceededTransferLimit),e.hasZ&&t.writeBooleanField(10,e.hasZ),e.hasM&&t.writeBooleanField(11,e.hasM),e.transform&&t.writeMessage(12,R.Transform.write,e.transform),e.fields)for(var i=0;i<e.fields.length;i++)t.writeMessage(13,R.Field.write,e.fields[i]);if(e.values)for(i=0;i<e.values.length;i++)t.writeMessage(14,R.Value.write,e.values[i]);if(e.features)for(i=0;i<e.features.length;i++)t.writeMessage(15,R.Feature.write,e.features[i])},R.CountResult={},R.CountResult.read=function(e,t){return e.readFields(R.CountResult._readField,{count:0},t)},R.CountResult._readField=function(e,t,i){1===e&&(t.count=i.readVarint())},R.CountResult.write=function(e,t){e.count&&t.writeVarintField(1,e.count)},R.ObjectIdsResult={},R.ObjectIdsResult.read=function(e,t){return e.readFields(R.ObjectIdsResult._readField,{objectIdFieldName:"",serverGens:null,objectIds:[]},t)},R.ObjectIdsResult._readField=function(e,t,i){1===e?t.objectIdFieldName=i.readString():2===e?t.serverGens=R.ServerGens.read(i,i.readVarint()+i.pos):3===e&&i.readPackedVarint(t.objectIds)},R.ObjectIdsResult.write=function(e,t){e.objectIdFieldName&&t.writeStringField(1,e.objectIdFieldName),e.serverGens&&t.writeMessage(2,R.ServerGens.write,e.serverGens),e.objectIds&&t.writePackedVarint(3,e.objectIds)},R.QueryResult={},R.QueryResult.read=function(e,t){return e.readFields(R.QueryResult._readField,{featureResult:null,Results:null,countResult:null,idsResult:null},t)},R.QueryResult._readField=function(e,t,i){1===e?(t.featureResult=R.FeatureResult.read(i,i.readVarint()+i.pos),t.Results="featureResult"):2===e?(t.countResult=R.CountResult.read(i,i.readVarint()+i.pos),t.Results="countResult"):3
2===e&&(t.idsResult=R.ObjectIdsResult.read(i,i.readVarint()+i.pos),t.Results="idsResult")},R.QueryResult.write=function(e,t){e.featureResult&&t.writeMessage(1,R.FeatureResult.write,e.featureResult),e.countResult&&t.writeMessage(2,R.CountResult.write,e.countResult),e.idsResult&&t.writeMessage(3,R.ObjectIdsResult.write,e.idsResult)},class{constructor(e,t,i,r){if(!e||!t||!i)throw new Error("Source id, map and arcgisOptions must be supplied as the first three arguments.");if(!i.url)throw new Error("A url must be supplied as part of the esriServiceOptions object.");this.sourceId=e,this._map=t,this._tileIndices=new Map,this._featureIndices=new Map,this._featureCollections=new Map,this._esriServiceOptions=Object.assign({useStaticZoomLevel:!1,minZoom:i.useStaticZoomLevel?7:2,simplifyFactor:.3,precision:8,where:"1=1",to:null,from:null,outFields:"*",setAttributionFromService:!0,f:"pbf",useSeviceBounds:!0,projectionEndpoint:`${i.url.split("rest/services")[0]}rest/services/Geometry/GeometryServer/project`,token:null,fetchOptions:null},i),this._fallbackProjectionEndpoint="https://tasks.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer/project",this.serviceMetadata=null,this._maxExtent=[-1/0,1/0,-1/0,1/0];const n=r||{};this._map.addSource(e,Object.assign(n,{type:"geojson",data:this._getBlankFc()})),this._getServiceMetadata().then((()=>
2{if(!this.supportsPbf){if(!this.supportsGeojson)throw this._map.removeSource(e),new Error("Server does not support PBF or GeoJSON query formats.");this._esriServiceOptions.f="geojson"}if(this._esriServiceOptions.useSeviceBounds){const e=this.serviceMetadata.extent;4326===e.spatialReference.wkid?this._setBounds([e.xmin,e.ymin,e.xmax,e.ymax]):this._projectBounds()}"*"!==this._esriServiceOptions.outFields&&(this._esriServiceOptions.outFields=`${this._esriServiceOptions.outFields},${this.serviceMetadata.uniqueIdField.name}`),this._setAttribution(),this.enableRequests(),this._clearAndRefreshTiles()}))}destroySource(){this.disableRequests(),this._map.removeSource(this.sourceId)}_getBlankFc(){return{type:"FeatureCollection",features:[]}}_setBounds(e){this._maxExtent=e}get supportsGeojson(){return this.serviceMetadata.supportedQueryFormats.indexOf("geoJSON")>-1}get supportsPbf(){return this.serviceMetadata.supportedQueryFormats.indexOf("PBF")>-1}disableRequests(){this._map.off("moveend",this._boundEvent)}enableRequests(){this._boundEvent=this._findAndMapData.bind(this),this._map.on("moveend",this._boundEvent)}_clearAndRefreshTiles(){this._tileIndices=new Map,this._featureIndices=new Map,this._featureCollections=new Map,this._findAndMapData()}setWhere(e){this._esriServiceOptions.where=e,this._clearAndRefreshTiles()}clearWhere(){this._esriServiceOptions.where="1=1",this._clearAndRefreshTiles()}setDate(e,t){this._esriServiceOptions.to=e,this._esriServiceOptions.from=t,this._clearAndRefreshTiles()}setToken(e){this._esriServiceOptions.token=e,this._clearAndRefreshTiles()}_createOrGetTileIndex(e){const t=this._tileIndices.get(e);if(t)return t;const i=new Map;return this._tileIndices.set(e,i),i}_createOrGetFeatureCollection(e){const t=this._featureCollections.get(e);if(t)return t;const i=this._getBlankFc();return this._featureCollections.set(e,i),i}_createOrGetFeatureIdIndex(e){const t=this._featureIndices.get(e);if(t)return t;const i=new Map;return this._featureIndices.set(e,i),i}async _findAndMapData(){const e=this._map.getZoom();if(e<this._esriServiceOptions.minZoom)return;const t=this._map.getBounds().toArray(),i=d.bboxToTile([t[0][0],t[0][1],t[1][0],t[1][1]]);if(this._esriServiceOptions.useSeviceBounds&&this._maxExtent[0]!==-1/0&&!this._doesTileOverlapBbox(this._maxExtent,t))return;const r=this._esriServiceOptions.useStaticZoomLevel?this._esriServiceOptions.minZoom:2*Math.floor(e/2),n=this._createOrGetTileIndex(r),o=this._createOrGetFeatureIdIndex(r),s=this._createOrGetFeatureCollection(r),a=[];if(i[2]<r){let e=d.getChildren(i),n=e[0][2];for(;n<r;){const t=[];e.forEach((e=>t.push(...d.getChildren(e)))),e=t,n=e[0][2]}for(let i=0;i<e.length;i++)this._doesTileOverlapBbox(e[i],t)&&a.push(e[i])}else a.push(i);for(let e=0;e<a.length;e++){const t=d.tileToQuadkey(a[e]);n.has(t)?(a.splice(e,1),e--):n.set(t,!0)}if(0===a.length)return void this._updateFcOnMap(s);const l=Math.abs(t[1][0]-t[0][0])/this._map.getCanvas().width*this._esriServiceOptions.simplifyFactor;await this._loadTiles(a,l,o,s),this._updateFcOnMap(s)}async _loadTiles(e,t,i,r){return new Promise((n=>{const o=e.map((e=>this._getTile(e,t)));Promise.all(o).then((e=>{e.forEach((e=>{e&&this._iterateItems(e,i,r)})),n()}))}))}_iterateItems(e,t,i){e.features.forEach((e=>{t.has(e.id)||(i.features.push(e),t.set(e.id))}))}get _time(){if(!this._esriServiceOptions.to)return!1;let e=this._esriServiceOptions.from,t=this._esriServiceOptions.to;return e instanceof Date&&(e=e.valueOf()),t instanceof Date&&(t=t.valueOf()),`${e},${t}`}_getTile(e,t){const i=d.tileToBBOX(e),r={spatialReference:{latestWkid:4326,wkid:4326},xmin:i[0],ymin:i[1],xmax:i[2],ymax:i[3]},n=new URLSearchParams({f:this._esriServiceOptions.f,geometry:JSON.stringify(r),where:this._esriServiceOptions.where,outFields:this._esriServiceOptions.outFields,outSR:4326,returnZ:!1,returnM:!1,precision:this._esriServiceOptions.precision,quantizationParameters:JSON.stringify({extent:r,tolerance:t,mode:"view"}),resultType:"tile",spatialRel:"esriSpatialRelIntersects",geometryType:"esriGeometryEnvelope",inSR:4326});return this._time&&n.append("time",this._time),this._appendTokenIfExists(n),new Promise((e=>{fetch(`${this._esriServiceOptions.url}/query?${n.toString()}`,this._esriServiceOptions.fetchOptions).then((e=>"pbf"===this._esriServiceOptions.f?e.arrayBuffer():e.json())).then((t=>{let i;try{i="pbf"===this._esriServiceOptions.f?function(e){let t;try{t=y.read(new f(e))}catch(e){throw new Error("Could not parse arcgis-pbf buffer")}const i=t.queryResult.featureResult,r=i.transform,n=i.geometryType,o=i.objectIdFieldName,s=i.fields;for(let e=0;e<s.length;e++){const t=s[e];t.keyName=$(t)}const a={type:"FeatureCollection",features:[]},l=function(e){switch(e){default:return B;case 2:return N;case 0:return z}}(n),c=i.features.length;for(let e=0;e<c;e++){const t=i.features[e];a.features.push({type:"Feature",id:G(s,t.attributes,o),properties:U(s,t.attributes),geometry:l(t,r)})}return{featureCollection:a,exceededTransferLimit:i.exceededTransferLimit}}(new Uint8Array(t)).featureCollection:t}catch(e){console.error("Could not parse arcgis buffer. Please check the url you requested.")}e(i)}))}))}_updateFcOnMap(e){const t=this._map.getSource(this.sourceId);t&&t.setData(e)}_doesTileOverlapBbox(e,t){const i=4===e.length?e:d.tileToBBOX(e);return!(i[2]<t[0][0]||i[0]>t[1][0]||i[3]<t[0][1]||i[1]>t[1][1])}_getServiceMetadata(){if(null!==this.serviceMetadata)return Promise.resolve(this.serviceMetadata);const e=new URLSearchParams({f:"json"});return this._appendTokenIfExists(e),this._requestJson(`${this._esriServiceOptions.url}?${e.toString()}`,this._esriServiceOptions.fetchOptions).then((e=>{if(e.error)throw new Error(JSON.stringify(e.error));return this.serviceMetadata=e,this.serviceMetadata}))}
2getFeaturesByLonLat(e,t,i){i=i||!1,t=t||20;const r=new URLSearchParams({sr:4326,geometryType:"esriGeometryPoint",geometry:JSON.stringify({x:e.lng,y:e.lat,spatialReference:{wkid:4326}}),returnGeometry:i,time:this._time,outFields:"*",spatialRel:"esriSpatialRelIntersects",units:"esriSRUnit_Meter",distance:t,f:"geojson"});return this._appendTokenIfExists(r),new Promise((e=>{this._requestJson(`${this._esriServiceOptions.url}/query?${r.toString()}`,this._esriServiceOptions.fetchOptions).then((t=>e(t)))}))}getFeaturesByObjectIds(e,t){Array.isArray(e)&&(e=e.join(",")),t=t||!1;const i=new URLSearchParams({sr:4326,objectIds:e,returnGeometry:t,outFields:"*",f:"geojson"});return this._appendTokenIfExists(i),new Promise((e=>{this._requestJson(`${this._esriServiceOptions.url}/query?${i.toString()}`,this._esriServiceOptions.fetchOptions).then((t=>e(t)))}))}_projectBounds(){const e=new URLSearchParams({geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[this.serviceMetadata.extent]}),inSR:this.serviceMetadata.extent.spatialReference.wkid,outSR:4326,f:"json"});let t={};this._projectionEndpointIsFallback()||(t=this._esriServiceOptions.fetchOptions,this._appendTokenIfExists(e)),this._requestJson(`${this._esriServiceOptions.projectionEndpoint}?${e.toString()}`,t).then((e=>{const t=e.geometries[0];this._maxExtent=[t.xmin,t.ymin,t.xmax,t.ymax]})).catch((e=>{if(this._projectionEndpointIsFallback())throw e;this._esriServiceOptions.projectionEndpoint=this._fallbackProjectionEndpoint,this._projectBounds()}))}_requestJson(e,t){return new Promise(((i,r)=>{fetch(e,t).then((e=>e.json())).then((e=>{"error"in e&&r(new Error("Endpoint doesnt exist")),i(e)})).catch((e=>r(e)))}))}_projectionEndpointIsFallback(){return this._esriServiceOptions.projectionEndpoint===this._fallbackProjectionEndpoint}_setAttribution(){const e='Powered by <a href="https://www.esri.com">Esri</a>',t=this._map._controls.find((e=>"_attribHTML"in e));if(!t)return;const i=t.options.customAttribution;"string"==typeof i?t.options.customAttribution=`${i} | ${e}`:void 0===i?t.options.customAttribution=e:Array.isArray(i)&&-1===i.indexOf(e)&&i.push(e),this._esriServiceOptions.setAttributionFromService&&this.serviceMetadata.copyrightText.length>0&&(this._map.style.sourceCaches[this.sourceId]._source.attribution=this.serviceMetadata.copyrightText),t._updateAttributions()}_appendTokenIfExists(e){const t=this._esriServiceOptions.token;null!==t&&e.append("token",t)}}}()},356:function(e,t){!function(e){"use strict";const t={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},i={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},r={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},n={POLYGON:"polygon",LINE:"line_string",POINT:"point"},o={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},s={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},a={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},l={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},c={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},u={ACTIVE:"true",INACTIVE:"false"},h=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],d=Object.freeze(Object.defineProperty({__proto__:null,LAT_MAX:90,LAT_MIN:-90,LAT_RENDERED_MAX:85,LAT_RENDERED_MIN:-85,LNG_MAX:270,LNG_MIN:-270,activeStates:u,classes:t,cursors:r,events:a,geojsonTypes:o,interactions:h,meta:c,modes:s,sources:i,types:n,updateActions:l},Symbol.toStringTag,{value:"Module"}));function p(e){return function(t){const i=t.featureTarget;return!(!i||!i.properties)&&i.properties.meta===e}}function f(e){return!(!e.originalEvent||!e.originalEvent.shiftKey)&&0===e.originalEvent.button}function m(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.active===u.ACTIVE&&e.featureTarget.properties.meta===c.FEATURE}function g(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.active===u.INACTIVE&&e.featureTarget.properties.meta===c.FEATURE}function y(e){return void 0===e.featureTarget}function _(e){return!(!e.featureTarget||!e.featureTarget.properties)&&e.featureTarget.properties.meta===c.FEATURE}function v(e){const t=e.featureTarget;return!(!t||!t.properties)&&t.properties.meta===c.VERTEX}function b(e){return!!e.originalEvent&&!0===e.originalEvent.shiftKey}
vendor: 21,544 bytes, line 2
2function x(e){return"Escape"===e.key||27===e.keyCode}function w(e){return"Enter"===e.key||13===e.keyCode}function T(e){return"Backspace"===e.key||8===e.keyCode}function E(e){return"Delete"===e.key||46===e.keyCode}function S(e){return"1"===e.key||49===e.keyCode}function P(e){return"2"===e.key||50===e.keyCode}function I(e){return"3"===e.key||51===e.keyCode}function C(e){const t=e.key||String.fromCharCode(e.keyCode);return t>="0"&&t<="9"}const M=Object.freeze(Object.defineProperty({__proto__:null,isActiveFeature:m,isBackspaceKey:T,isDeleteKey:E,isDigit1Key:S,isDigit2Key:P,isDigit3Key:I,isDigitKey:C,isEnterKey:w,isEscapeKey:x,isFeature:_,isInactiveFeature:g,isOfMetaType:p,isShiftDown:b,isShiftMousedown:f,isTrue:function(){return!0},isVertex:v,noTarget:y},Symbol.toStringTag,{value:"Module"}));function A(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var L,F,D={},k={};const O=A(function(){if(F)return D;F=1;var e=(L||(L=1,k.RADIUS=6378137,k.FLATTENING=1/298.257223563,k.POLAR_RADIUS=6356752.3142),k);function t(e){var t=0;if(e&&e.length>0){t+=Math.abs(i(e[0]));for(var r=1;r<e.length;r++)t-=Math.abs(i(e[r]))}return t}function i(t){var i,n,o,s,a,l,c=0,u=t.length;if(u>2){for(l=0;l<u;l++)l===u-2?(o=u-2,s=u-1,a=0):l===u-1?(o=u-1,s=0,a=1):(o=l,s=l+1,a=l+2),i=t[o],n=t[s],c+=(r(t[a][0])-r(i[0]))*Math.sin(r(n[1]));c=c*e.RADIUS*e.RADIUS/2}return c}function r(e){return e*Math.PI/180}return D.geometry=function e(i){var r,n=0;switch(i.type){case"Polygon":return t(i.coordinates);case"MultiPolygon":for(r=0;r<i.coordinates.length;r++)n+=t(i.coordinates[r]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(r=0;r<i.geometries.length;r++)n+=e(i.geometries[r]);return n}},D.ring=i,D}()),R={Point:0,LineString:1,MultiLineString:1,Polygon:2};function z(e,t){const i=R[e.geometry.type]-R[t.geometry.type];return 0===i&&e.geometry.type===o.POLYGON?e.area-t.area:i}function N(e){return e.map((e=>(e.geometry.type===o.POLYGON&&(e.area=O.geometry({type:o.FEATURE,property:{},geometry:e.geometry})),e))).sort(z).map((e=>(delete e.area,e)))}function B(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]}function V(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(let t=0,i=e.length;t<i;t++)this.add(e[t]),void 0!==e[t]&&("string"==typeof e[t]?this._items[e[t]]=t:this._nums[e[t]]=t)}V.prototype.add=function(e){return this.has(e)||(this._length++,"string"==typeof e?this._items[e]=this._length:this._nums[e]=this._length),this},V.prototype.delete=function(e){return!1===this.has(e)||(this._length--,delete this._items[e],delete this._nums[e]),this},V.prototype.has=function(e){return!("string"!=typeof e&&"number"!=typeof e||void 0===this._items[e]&&void 0===this._nums[e])},V.prototype.values=function(){const e=[];return Object.keys(this._items).forEach((t=>{e.push({k:t,v:this._items[t]})})),Object.keys(this._nums).forEach((t=>{e.push({k:JSON.parse(t),v:this._nums[t]})})),e.sort(((e,t)=>e.v-t.v)).map((e=>e.k))},V.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const j=[c.FEATURE,c.MIDPOINT,c.VERTEX],U={click:function(e,t,i){return G(e,t,i,i.options.clickBuffer)},touch:function(e,t,i){return G(e,t,i,i.options.touchBuffer)}};function G(e,t,i,r){if(null===i.map)return[];const n=e?B(e,r):t,o={};i.options.styles&&(o.layers=i.options.styles.map((e=>e.id)).filter((e=>null!=i.map.getLayer(e))));const s=i.map.queryRenderedFeatures(n,o).filter((e=>-1!==j.indexOf(e.properties.meta))),a=new V,l=[];return s.forEach((e=>{const t=e.properties.id;a.has(t)||(a.add(t),l.push(e))})),N(l)}function $(e,t){const i=U.click(e,null,t),n={mouse:r.NONE};return i[0]&&(n.mouse=i[0].properties.active===u.ACTIVE?r.MOVE:r.POINTER,n.feature=i[0].properties.meta),-1!==t.events.currentModeName().indexOf("draw")&&(n.mouse=r.ADD),t.ui.queueMapClasses(n),t.ui.updateMapClasses(),i[0]}function q(e,t){const i=e.x-t.x,r=e.y-t.y;return Math.sqrt(i*i+r*r)}function Z(e,t,i={}){const r=null!=i.fineTolerance?i.fineTolerance:4,n=null!=i.grossTolerance?i.grossTolerance:12,o=null!=i.interval?i.interval:500;e.point=e.point||t.point,e.time=e.time||t.time;const s=q(e.point,t.point);return s<r||s<n&&t.time-e.time<o}function W(e,t,i={}){const r=null!=i.tolerance?i.tolerance:25,n=null!=i.interval?i.interval:250;return e.point=e.point||t.point,e.time=e.time||t.time,q(e.point,t.point)<r&&t.time-e.time<n}const H=function(e,t){const i={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on(e,t,r){if(void 0===i[e])throw new Error(`Invalid event type: ${e}`);i[e].push({selector:t,fn:r})},render(e){t.store.featureChanged(e)}},n=function(e,n){const o=i[e];let s=o.length;for(;s--;){const e=o[s];if(e.selector(n)){e.fn.call(r,n)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(e){n("drag",e)},click(e){n("click",e)},mousemove(e){n("mousemove",e)},mousedown(e){n("mousedown",e)},mouseup(e){n("mouseup",e)},mouseout(e){n("mouseout",e)},keydown(e){n("keydown",e)},keyup(e){n("keyup",e)},touchstart(e){n("touchstart",e)},touchmove(e){n("touchmove",e)},touchend(e){n("touchend",e)},tap(e){n("tap",e)}}},X=((e,t=21)=>(i=t)=>{let r="",n=0|i;for(;n--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function Y(){return X()}const J=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||Y(),this.type=t.geometry.type};J.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},J.prototype.incomingCoords=function(e){this.setCoordinates(e)},J.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},J.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},J.prototype.setProperty=function(e,t){this.properties[e]=t},J.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:o.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},J.prototype.internal=function(e){const t={id:this.id,meta:c.FEATURE,"meta:type":this.type,active:u.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const e in this.properties)t[`user_${e}`]=this.properties[e];return{type:o.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const K=function(e,t){J.call(this,e,t)};(K.prototype=Object.create(J.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},K.prototype.updateCoordinate=function(e,t,i){this.coordinates=3===arguments.length?[t,i]:[e,t],this.changed()},K.prototype.getCoordinate=function(){return this.getCoordinates()};const Q=function(e,t){J.call(this,e,t)};(Q.prototype=Object.create(J.prototype)).isValid=function(){return this.coordinates.length>1},Q.prototype.addCoordinate=function(e,t,i){this.changed();const r=parseInt(e,10);this.coordinates.splice(r,0,[t,i])},Q.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},Q.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},Q.prototype.updateCoordinate=function(e,t,i){const r=parseInt(e,10);this.coordinates[r]=[t,i],this.changed()};const ee=function(e,t){J.call(this,e,t),this.coordinates=this.coordinates.map((e=>e.slice(0,-1)))};(ee.prototype=Object.create(J.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((e=>e.length>2))},ee.prototype.incomingCoords=function(e){this.coordinates=e.map((e=>e.slice(0,-1))),this.changed()},ee.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},ee.prototype.addCoordinate=function(e,t,i){this.changed();const r=e.split(".").map((e=>parseInt(e,10)));this.coordinates[r[0]].splice(r[1],0,[t,i])},ee.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map((e=>parseInt(e,10))),i=this.coordinates[t[0]];i&&(i.splice(t[1],1),i.length<3&&this.coordinates.splice(t[0],1))},ee.prototype.getCoordinate=function(e){const t=e.split(".").map((e=>parseInt(e,10))),i=this.coordinates[t[0]];return JSON.parse(JSON.stringify(i[t[1]]))},ee.prototype.getCoordinates=function(){return this.coordinates.map((e=>e.concat([e[0]])))},ee.prototype.updateCoordinate=function(e,t,i){this.changed();const r=e.split("."),n=parseInt(r[0],10),o=parseInt(r[1],10);void 0===this.coordinates[n]&&(this.coordinates[n]=[]),this.coordinates[n][o]=[t,i]};const te={MultiPoint:K,MultiLineString:Q,MultiPolygon:ee},ie=(e,t,i,r,n)=>{const o=i.split("."),s=parseInt(o[0],10),a=o[1]?o.slice(1).join("."):null;return e[s][t](a,r,n)},re=function(e,t){if(J.call(this,e,t),delete this.coordinates,this.model=te[t.geometry.type],void 0===this.model)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};function ne(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}(re.prototype=Object.create(J.prototype))._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map((e=>new t(this.ctx,{id:Y(),type:o.FEATURE,properties:{},geometry:{coordinates:e,type:this.type.replace("Multi","")}})))},re.prototype.isValid=function(){return this.features.every((e=>e.isValid()))},re.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},re.prototype.getCoordinate=function(e){return ie(this.features,"getCoordinate",e)},re.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((e=>e.type===o.POLYGON?e.getCoordinates():e.coordinates))))},re.prototype.updateCoordinate=function(e,t,i){ie(this.features,"updateCoordinate",e,t,i),this.changed()},re.prototype.addCoordinate=function(e,t,i){ie(this.features,"addCoordinate",e,t,i),this.changed()},re.prototype.removeCoordinate=function(e){ie(this.features,"removeCoordinate",e),this.changed()},re.prototype.getFeatures=function(){return this.features},ne.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},ne.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce(((e,t)=>(void 0===e[t.feature_id]&&(e[t.feature_id]=!0,this._ctx.store.get(t.feature_id).changed()),e)),{})},ne.prototype.getSelected=function(){return this._ctx.store.getSelected()},ne.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},ne.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},ne.prototype.getFeature=function(e){return this._ctx.store.get(e)},ne.prototype.select=function(e){return this._ctx.store.select(e)},ne.prototype.deselect=function(e){return this._ctx.store.deselect(e)},ne.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)},ne.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)},ne.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},ne.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},ne.prototype.setActionableState=function(e={}){const t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)},ne.prototype.changeMode=function(e,t={},i={}){return this._ctx.events.changeMode(e,t,i)},ne.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)},ne.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},ne.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},ne.prototype.featuresAt=function(e,t,i="click"){if("click"!==i&&"touch"!==i)throw new Error("invalid buffer type");return U[i](e,t,this._ctx)},ne.prototype.newFeature=function(e){const t=e.geometry.type;return t===o.POINT?new K(this._ctx,e):t===o.LINE_STRING?new Q(this._ctx,e):t===o.POLYGON?new ee(this._ctx,e):new re(this._ctx,e)},ne.prototype.isInstanceOf=function(e,t){if(e===o.POINT)return t instanceof K;if(e===o.LINE_STRING)return t instanceof Q;if(e===o.POLYGON)return t instanceof ee;if("MultiFeature"===e)return t instanceof re;throw new Error(`Unknown feature class: ${e}`)},ne.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)},ne.prototype.onSetup=function(){},ne.prototype.onDrag=function(){},ne.prototype.onClick=function(){},ne.prototype.onMouseMove=function(){},ne.prototype.onMouseDown=function(){},ne.prototype.onMouseUp=function(){},ne.prototype.onMouseOut=function(){},ne.prototype.onKeyUp=function(){},ne.prototype.onKeyDown=function(){},ne.prototype.onTouchStart=function(){},ne.prototype.onTouchMove=function(){},ne.prototype.onTouchEnd=function(){},ne.prototype.onTap=function(){},ne.prototype.onStop=function(){},ne.prototype.onTrash=function(){},ne.prototype.onCombineFeature=function(){},ne.prototype.onUncombineFeature=function(){},ne.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const oe={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},se=Object.keys(oe);function ae(e){const t=Object.keys(e);return function(i,r={}){let n={};const o=t.reduce(((t,i)=>(t[i]=e[i],t)),new ne(i));return{start(){n=o.onSetup(r),se.forEach((t=>{const i=oe[t];let r=()=>!1;e[i]&&(r=()=>!0),this.on(t,r,function(e){return t=>o[e](n,t)}(i))}))},stop(){o.onStop(n)},trash(){o.onTrash(n)},combineFeatures(){o.onCombineFeatures(n)},uncombineFeatures(){o.onUncombineFeatures(n)},render(e,t){o.toDisplayFeatures(n,e,t)}}}}function le(e){return[].concat(e).filter((e=>void 0!==e))}function ce(){const e=this;if(!e.ctx.map||void 0===e.ctx.map.getSource(i.HOT))return c();const t=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:t});let r=[],n=[];e.isDirty?n=e.getAllIds():(r=e.getChangedIds().filter((t=>void 0!==e.get(t))),n=e.sources.hot.filter((t=>t.properties.id&&-1===r.indexOf(t.properties.id)&&void 0!==e.get(t.properties.id))).map((e=>e.properties.id))),e.sources.hot=[];const s=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter((e=>{const t=e.properties.id||e.properties.parent;return-1===r.indexOf(t)}));const a=s!==e.sources.cold.length||n.length>0;function l(i,r){const n=e.get(i).internal(t);e.ctx.events.currentModeRender(n,(i=>{i.properties.mode=t,e.sources[r].push(i)}))}function c(){e.isDirty=!1,e.clearChangedIds()}r.forEach((e=>l(e,"hot"))),n.forEach((e=>l(e,"cold"))),a&&e.ctx.map.getSource(i.COLD).setData({type:o.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(i.HOT).setData({type:o.FEATURE_COLLECTION,features:e.sources.hot}),c()}function ue(e){let t;this._features={},this._featureIds=new V,this._selectedFeatureIds=new V,this._selectedCoordinates=[],this._changedFeatureIds=new V,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=()=>{t||(t=requestAnimationFrame((()=>{t=null,ce.call(this),this._emitSelectionChange&&(this.ctx.events.fire(a.SELECTION_CHANGE,{features:this.getSelected().map((e=>e.toGeoJSON())),points:this.getSelectedCoordinates().map((e=>({type:o.FEATURE,properties:{},geometry:{type:o.POINT,coordinates:e.coordinates}})))}),this._emitSelectionChange=!1),this.ctx.events.fire(a.RENDER,{})})))},this.isDirty=!1}function he(e,t={}){const i=e._selectedCoordinates.filter((t=>e._selectedFeatureIds.has(t.feature_id)));e._selectedCoordinates.length!==i.length&&!t.silent&&(e._emitSelectionChange=!0),e._selectedCoordinates=i}ue.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}},ue.prototype.setDirty=function(){return this.isDirty=!0,this},ue.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)){const t=this.get(e);this.ctx.events.fire(a.CREATE,{features:[t.toGeoJSON()]})}return this},ue.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)&&this.ctx.events.fire(a.UPDATE,{action:t.action?t.action:l.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this},ue.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},ue.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},ue.prototype.getAllIds=function(){return this._featureIds.values()},ue.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this},ue.prototype.delete=function(e,t={}){const i=[];return le(e).forEach((e=>{this._featureIds.has(e)&&(this._featureIds.delete(e),this._selectedFeatureIds.delete(e),t.silent||-1===i.indexOf(this._features[e])&&i.push(this._features[e].toGeoJSON()),delete this._features[e],this.isDirty=!0)})),i.length&&this.ctx.events.fire(a.DELETE,{features:i}),he(this,t),this},ue.prototype.get=function(e){return this._features[e]},ue.prototype.getAll=function(){return Object.keys(this._features).map((e=>this._features[e]))},ue.prototype.select=function(e,t={}){return le(e).forEach((e=>{this._selectedFeatureIds.has(e)||(this._selectedFeatureIds.add(e),this._changedFeatureIds.add(e),t.silent||(this._emitSelectionChange=!0))})),this},ue.prototype.deselect=function(e,t={}){return le(e).forEach((e=>{this._selectedFeatureIds.has(e)&&(this._selectedFeatureIds.delete(e),this._changedFeatureIds.add(e),t.silent||(this._emitSelectionChange=!0))})),he(this,t),this},ue.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},ue.prototype.setSelected=function(e,t={}){return e=le(e),this.deselect(this._selectedFeatureIds.values().filter((t=>-1===e.indexOf(t))),{silent:t.silent}),this.select(e.filter((e=>!this._selectedFeatureIds.has(e))),{silent:t.silent}),this},ue.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},ue.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},ue.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},ue.prototype.getSelected=function(){return this.getSelectedIds().map((e=>this.get(e)))},ue.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map((e=>({coordinates:this.get(e.feature_id).getCoordinate(e.coord_path)})))},ue.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},ue.prototype.setFeatureProperty=function(e,t,i,r={}){this.get(e).setProperty(t,i),this.featureChanged(e,{silent:r.silent,action:l.CHANGE_PROPERTIES})},ue.prototype.storeMapConfig=function(){h.forEach((e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())}))},ue.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach((e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()}))},ue.prototype.getInitialConfigValue=function(e){return void 0===this._mapInitialConfig[e]||this._mapInitialConfig[e]};const de=["mode","feature","mouse"];function pe(e){let l=null,c=null;const u={onRemove(){return e.map.off("load",u.connect),clearInterval(c),u.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,l&&l.parentNode&&l.parentNode.removeChild(l),l=null,this},connect(){e.map.off("load",u.connect),clearInterval(c),u.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(i){if(e.map=i,e.events=function(e){const i=Object.keys(e.options.modes).reduce(((t,i)=>(t[i]=ae(e.options.modes[i]),t)),{});let n={},o={};const l={};let c=null,u=null;l.drag=function(t,i){i({point:t.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:r.DRAG}),u.drag(t)):t.originalEvent.stopPropagation()},l.mousedrag=function(e){l.drag(e,(e=>!Z(n,e)))},l.touchdrag=function(e){l.drag(e,(e=>!W(o,e)))},l.mousemove=function(t){if(1===(void 0!==t.originalEvent.buttons?t.originalEvent.buttons:t.originalEvent.which))return l.mousedrag(t);const i=$(t,e);t.featureTarget=i,u.mousemove(t)},l.mousedown=function(t){n={time:(new Date).getTime(),point:t.point};const i=$(t,e);t.featureTarget=i,u.mousedown(t)},l.mouseup=function(t){const i=$(t,e);t.featureTarget=i,Z(n,{point:t.point,time:(new Date).getTime()})?u.click(t):u.mouseup(t)},l.mouseout=function(e){u.mouseout(e)},l.touchstart=function(t){if(!e.options.touchEnabled)return;o={time:(new Date).getTime(),point:t.point};const i=U.touch(t,null,e)[0];t.featureTarget=i,u.touchstart(t)},l.touchmove=function(t){if(e.options.touchEnabled)return u.touchmove(t),l.touchdrag(t)},l.touchend=function(t){if(t.originalEvent.preventDefault(),!e.options.touchEnabled)return;const i=U.touch(t,null,e)[0];t.featureTarget=i,W(o,{time:(new Date).getTime(),point:t.point})?u.tap(t):u.touchend(t)};const h=e=>{const t=T(e),i=E(e),r=C(e);return!(t||i||r)};function d(t,r,n={}){u.stop();const o=i[t];if(void 0===o)throw new Error(`${t}
2 is not valid`);c=t;const s=o(e,r);u=H(s,e),n.silent||e.map.fire(a.MODE_CHANGE,{mode:t}),e.store.setDirty(),e.store.render()}l.keydown=function(i){(i.srcElement||i.target).classList.contains(t.CANVAS)&&((T(i)||E(i))&&e.options.controls.trash?(i.preventDefault(),u.trash()):h(i)?u.keydown(i):S(i)&&e.options.controls.point?d(s.DRAW_POINT):P(i)&&e.options.controls.line_string?d(s.DRAW_LINE_STRING):I(i)&&e.options.controls.polygon&&d(s.DRAW_POLYGON))},l.keyup=function(e){h(e)&&u.keyup(e)},l.zoomend=function(){e.store.changeZoom()},l.data=function(t){if("style"===t.dataType){const{setup:t,map:i,options:r,store:n}=e;r.styles.some((e=>i.getLayer(e.id)))||(t.addLayers(),n.setDirty(),n.render())}};const p={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start(){c=e.options.defaultMode,u=H(i[c](e),e)},changeMode:d,actionable:function(t){let i=!1;Object.keys(t).forEach((e=>{if(void 0===p[e])throw new Error("Invalid action type");p[e]!==t[e]&&(i=!0),p[e]=t[e]})),i&&e.map.fire(a.ACTIONABLE,{actions:p})},currentModeName:()=>c,currentModeRender:(e,t)=>u.render(e,t),fire(t,i){e.map&&e.map.fire(t,i)},addEventListeners(){e.map.on("mousemove",l.mousemove),e.map.on("mousedown",l.mousedown),e.map.on("mouseup",l.mouseup),e.map.on("data",l.data),e.map.on("touchmove",l.touchmove),e.map.on("touchstart",l.touchstart),e.map.on("touchend",l.touchend),e.container.addEventListener("mouseout",l.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",l.keydown),e.container.addEventListener("keyup",l.keyup))},removeEventListeners(){e.map.off("mousemove",l.mousemove),e.map.off("mousedown",l.mousedown),e.map.off("mouseup",l.mouseup),e.map.off("data",l.data),e.map.off("touchmove",l.touchmove),e.map.off("touchstart",l.touchstart),e.map.off("touchend",l.touchend),e.container.removeEventListener("mouseout",l.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",l.keydown),e.container.removeEventListener("keyup",l.keyup))},trash(e){u.trash(e)},combineFeatures(){u.combineFeatures()},uncombineFeatures(){u.uncombineFeatures()},getMode:()=>c}}(e),e.ui=function(e){const i={};let r=null,o={mode:null,feature:null,mouse:null},a={mode:null,feature:null,mouse:null};function l(e){a=Object.assign(a,e)}function c(){if(!e.container)return;const t=[],i=[];de.forEach((e=>{a[e]!==o[e]&&(t.push(`${e}-${o[e]}`),null!==a[e]&&i.push(`${e}-${a[e]}`))})),t.length>0&&e.container.classList.remove(...t),i.length>0&&e.container.classList.add(...i),o=Object.assign(o,a)}function u(e,i={}){const n=document.createElement("button");return n.className=`${t.CONTROL_BUTTON} ${i.className}`,n.setAttribute("title",i.title),i.container.appendChild(n),n.addEventListener("click",(t=>{if(t.preventDefault(),t.stopPropagation(),t.target===r)return h(),void i.onDeactivate();d(e),i.onActivate()}),!0),n}function h(){r&&(r.classList.remove(t.ACTIVE_BUTTON),r=null)}function d(e){h();const n=i[e];n&&n&&"trash"!==e&&(n.classList.add(t.ACTIVE_BUTTON),r=n)}return{setActiveButton:d,queueMapClasses:l,updateMapClasses:c,clearMapClasses:function(){l({mode:null,feature:null,mouse:null}),c()},addButtons:function(){const r=e.options.controls,o=document.createElement("div");return o.className=`${t.CONTROL_GROUP} ${t.CONTROL_BASE}`,r&&(r[n.POINT]&&(i[n.POINT]=u(n.POINT,{container:o,className:t.CONTROL_BUTTON_POINT,title:"Marker tool "+(e.options.keybindings?"(1)":""),onActivate:()=>e.events.changeMode(s.DRAW_POINT),onDeactivate:()=>e.events.trash()})),r[n.LINE]&&(i[n.LINE]=u(n.LINE,{container:o,className:t.CONTROL_BUTTON_LINE,title:"LineString tool "+(e.options.keybindings?"(2)":""),onActivate:()=>e.events.changeMode(s.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),r[n.POLYGON]&&(i[n.POLYGON]=u(n.POLYGON,{container:o,className:t.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(e.options.keybindings?"(3)":""),onActivate:()=>e.events.changeMode(s.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),r.trash&&(i.trash=u("trash",{container:o,className:t.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),r.combine_features&&(i.combine_features=u("combineFeatures",{container:o,className:t.CONTROL_BUTTON_COMB
vendor: 4,194 bytes, line 2
2INE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),r.uncombine_features&&(i.uncombine_features=u("uncombineFeatures",{container:o,className:t.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}}))),o},removeButtons:function(){Object.keys(i).forEach((e=>{const t=i[e];t.parentNode&&t.parentNode.removeChild(t),delete i[e]}))}}}(e),e.container=i.getContainer(),e.store=new ue(e),l=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=i.boxZoom.isEnabled(),i.boxZoom.disable();const t=i.dragPan.isEnabled();i.dragPan.disable(),i.dragPan.enable(),t||i.dragPan.disable()}return i.loaded()?u.connect():(i.on("load",u.connect),c=setInterval((()=>{i.loaded()&&u.connect()}),16)),e.events.start(),l},addLayers(){e.map.addSource(i.COLD,{data:{type:o.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(i.HOT,{data:{type:o.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach((t=>{e.map.addLayer(t)})),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach((t=>{e.map.getLayer(t.id)&&e.map.removeLayer(t.id)})),e.map.getSource(i.COLD)&&e.map.removeSource(i.COLD),e.map.getSource(i.HOT)&&e.map.removeSource(i.HOT)}};return e.setup=u,u}const fe="#3bb2d0",me="#fbb03b",ge="#fff",ye=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],me,fe],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],me,fe],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":ge}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],me,fe]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":ge}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":me}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":me}}];function _e(e,t){this.x=e,this.y=t}function ve(e,t){const i=t.getBoundingClientRect();return new _e(e.clientX-i.left-(t.clientLeft||0),e.clientY-i.top-(t.clientTop||0))}function be(e,t,i,r){return{type:o.FEATURE,properties:{meta:c.VERTEX,parent:e,coord_path:i,active:r?u.ACTIVE:u.INACTIVE},geometry:{type:o.POINT,coordinates:t}}}_e.prototype={clone(){return new _e(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add(e){return this.x+=e.x,this.y+=e.y,this}
2,_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),i=Math.sin(e),r=t*this.x-i*this.y,n=i*this.x+t*this.y;return this.x=r,this.y=n,this},_rotateAround(e,t){const i=Math.cos(e),r=Math.sin(e),n=t.x+i*(this.x-t.x)-r*(this.y-t.y),o=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=n,this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:_e},_e.convert=function(e){if(e instanceof _e)return e;if(Array.isArray(e))return new _e(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new _e(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};var xe=6371008.8,we={centimeters:100*xe,centimetres:100*xe,degrees:360/(2*Math.PI),feet:3.28084*xe,inches:39.37*xe,kilometers:xe/1e3,kilometres:xe/1e3,meters:xe,metres:xe,miles:xe/1609.344,millimeters:1e3*xe,millimetres:1e3*xe,nauticalmiles:xe/1852,radians:1,yards:1.0936*xe};function Te(e,t,i={}){const r={type:"Feature"};return(0===i.id||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=t||{},r.geometry=e,r}function Ee(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return Te({type:"LineString",coordinates:e},t,i)}function Se(e){return e%360*Math.PI/180}function Pe(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function Ie(e,t,i){if(null!==e)for(var r,n,o,s,a,l,c,u,h=0,d=0,p=e.type,f="FeatureCollection"===p,m="Feature"===p,g=f?e.features.length:1,y=0;y<g;y++){a=(u=!!(c=f?e.features[y].geometry:m?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var _=0;_<a;_++){var v=0,b=0;if(null!==(s=u?c.geometries[_]:c)){l=s.coordinates;var x=s.type;switch(h=!i||"Polygon"!==x&&"MultiPolygon"!==x?0:1,x){case null:break;case"Point":if(!1===t(l,d,y,v,b))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===t(l[r],d,y,v,b))return!1;d++,"MultiPoint"===x&&v++}"LineString"===x&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(n=0;n<l[r].length-h;n++){if(!1===t(l[r][n],d,y,v,b))return!1;d++}"MultiLineString"===x&&v++,"Polygon"===x&&b++}"Polygon"===x&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(b=0,n=0;n<l[r].length;n++){for(o=0;o<l[r][n].length-h;o++){if(!1===t(l[r][n][o],d,y,v,b))return!1;d++}b++}v++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===Ie(s.geometries[r],t,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Ce(e,t){var i,r,n,o,s,a,l,c,u,h,d=0,p="FeatureCollection"===e.type,f="Feature"===e.type,m=p?e.features.length:1;for(i=0;i<m;i++){for(a=p?e.features[i].geometry:f?e.geometry:e,c=p?e.features[i].properties:f?e.properties:{},u=p?e.features[i].bbox:f?e.bbox:void 0,h=p?e.features[i].id:f?e.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,n=0;n<s;n++)if(null!==(o=l?a.geometries[n]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,d,c,u,h))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],d,c,u,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,d,c,u,h))return!1;d++}}function Me(e,t){Ce(e,(function(e,i,r,n,o){var s,a=null===e?null:e.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==t(Te(e,r,{bbox:n,id:o}),i,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<e.coordinates.length;l++){var c=e.coordinates[l];if(!1===t(Te({type:s,coordinates:c},r),i,l))return!1}}))}function Ae(e,t,i){var r=i,n=!1;return function(e,t){Me(e,(function(e,i,r){var n=0;if(e.geometry){var o=e.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,l=0,c=0;if(!1===Ie(e,(function(o,u,h,d,p){if(void 0===s||i>a||d>l||p>c)return s=o,a=i,l=d,c=p,void(n=0);var f=Ee([s,o],e.properties);if(!1===t(f,i,r,p,n))return!1;n++,s=o})))return!1}}}))}(e,(function(e,o,s,a,l){r=!1===n&&void 0===i?e:t(r,e,o,s,a,l),n=!0})),r}function Le(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return Fe(e);case"FeatureCollection":return function(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach((i=>{switch(i){case"type":case"features":return;default:t[i]=e[i]}})),t.features=e.features.map((e=>Fe(e))),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ke(e);default:throw new Error("unknown GeoJSON type")}}function Fe(e){const t={type:"Feature"};return Object.keys(e).forEach((i=>{switch(i){case"type":case"properties":case"geometry":return;default:t[i]=e[i]}})),t.properties=De(e.properties),null==e.geometry?t.geometry=null:t.geometry=ke(e.geometry),t}function De(e){const t={};return e&&Object.keys(e).forEach((i=>{const r=e[i];"object"==typeof r?null===r?t[i]=null:Array.isArray(r)?t[i]=r.map((e=>e)):t[i]=De(r):t[i]=r})),t}function ke(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map((e=>ke(e))),t):(t.coordinates=Oe(e.coordinates),t)}function Oe(e){const t=e;return"object"!=typeof t[0]?t.slice():t.map((e=>Oe(e)))}function Re(e,t={}){return ze(e,"mercator",t)}function ze(e,t,i={}){var r=(i=i||{}).mutate;if(!e)throw new Error("geojson is required");return Array.isArray(e)&&Pe(e[0])?e="mercator"===t?Ne(e):Be(e):(!0!==r&&(e=Le(e)),Ie(e,(function(e){var i="mercator"===t?Ne(e):Be(e);e[0]=i[0],e[1]=i[1]}))),e}function Ne(e){var t=Math.PI/180,i=6378137,r=20037508.342789244,n=[i*(Math.abs(e[0])<=180?e[0]:e[0]-360*Ve(e[0]))*t,i*Math.log(Math.tan(.25*Math.PI+.5*e[1]*t))];return n[0]>r&&(n[0]=r),n[0]<-r&&(n[0]=-r),n[1]>r&&(n[1]=r),n[1]<-r&&(n[1]=-r),n}function Be(e){var t=180/Math.PI,i=6378137;return[e[0]*t/i,(.5*Math.PI-2*Math.atan(Math.exp(-e[1]/i)))*t]}function Ve(e){return e<0?-1:e>0?1:0}function je(e,t,i){const r=t.geometry.coordinates,n=i.geometry.coordinates;if(r[1]>85||r[1]<-85||n[1]>85||n[1]<-85)return null;const s=Re(r),a=Re(n),l=e=>Number(e.toFixed(8)),u=(e,t)=>
vendor: 4,100 bytes, line 2
2(e+t)/2,h=function(e,t={}){return ze(e,"wgs84",t)}([u(s[0],a[0]),u(s[1],a[1])]),d=[l(h[0]),l(h[1])];return{type:o.FEATURE,properties:{meta:c.MIDPOINT,parent:e,lng:d[0],lat:d[1],coord_path:i.properties.coord_path},geometry:{type:o.POINT,coordinates:d}}}function Ue(e,t={},i=null){const{type:r,coordinates:n}=e.geometry,s=e.properties&&e.properties.id;let a=[];function l(e,i){let r="",n=null;e.forEach(((e,o)=>{const l=null!=i?`${i}.${o}`:String(o),u=be(s,e,l,c(l));if(t.midpoints&&n){const e=je(s,n,u);e&&a.push(e)}n=u;const h=JSON.stringify(e);r!==h&&a.push(u),0===o&&(r=h)}))}function c(e){return!!t.selectedPaths&&-1!==t.selectedPaths.indexOf(e)}return r===o.POINT?a.push(be(s,n,i,c(i))):r===o.POLYGON?n.forEach(((e,t)=>{l(e,null!==i?`${i}.${t}`:String(t))})):r===o.LINE_STRING?l(n,i):0===r.indexOf(o.MULTI_PREFIX)&&function(){const i=r.replace(o.MULTI_PREFIX,"");n.forEach(((r,n)=>{const s={type:o.FEATURE,properties:e.properties,geometry:{type:i,coordinates:r}};a=a.concat(Ue(s,t,n))}))}(),a}const Ge={enable(e){setTimeout((()=>{!e.map||!e.map.doubleClickZoom||!e._ctx||!e._ctx.store||!e._ctx.store.getInitialConfigValue||e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()}),0)},disable(e){setTimeout((()=>{!e.map||!e.map.doubleClickZoom||e.map.doubleClickZoom.disable()}),0)}},{LAT_MIN:$e,LAT_MAX:qe,LAT_RENDERED_MIN:Ze,LAT_RENDERED_MAX:We,LNG_MIN:He,LNG_MAX:Xe}=d;function Ye(e,t){let i=$e,r=qe,n=$e,o=qe,s=Xe,a=He;e.forEach((e=>{const t=function(e){const t={Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type],i=[e.geometry.coordinates].flat(t),r=i.map((e=>e[0])),n=i.map((e=>e[1])),o=e=>Math.min.apply(null,e),s=e=>Math.max.apply(null,e);return[o(r),o(n),s(r),s(n)]}(e),l=t[1],c=t[3],u=t[0],h=t[2];l>i&&(i=l),c<r&&(r=c),c>n&&(n=c),l<o&&(o=l),u<s&&(s=u),h>a&&(a=h)}));const l=t;return i+l.lat>We&&(l.lat=We-i),n+l.lat>qe&&(l.lat=qe-n),r+l.lat<Ze&&(l.lat=Ze-r),o+l.lat<$e&&(l.lat=$e-o),s+l.lng<=He&&(l.lng+=360*Math.ceil(Math.abs(l.lng)/360)),a+l.lng>=Xe&&(l.lng-=360*Math.ceil(Math.abs(l.lng)/360)),l}function Je(e,t){const i=Ye(e.map((e=>e.toGeoJSON())),t);e.forEach((e=>{const t=e.getCoordinates(),r=e=>{const t={lng:e[0]+i.lng,lat:e[1]+i.lat};return[t.lng,t.lat]},n=e=>e.map((e=>r(e)));let s;e.type===o.POINT?s=r(t):e.type===o.LINE_STRING||e.type===o.MULTI_POINT?s=t.map(r):e.type===o.POLYGON||e.type===o.MULTI_LINE_STRING?s=t.map(n):e.type===o.MULTI_POLYGON&&(s=t.map((e=>e.map((e=>n(e)))))),e.incomingCoords(s)}))}const Ke={onSetup:function(e){const t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter((e=>void 0!==this.getFeature(e)))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t},fireUpdate:function(){this.fire(a.UPDATE,{action:l.MOVE,features:this.getSelected().map((e=>e.toGeoJSON()))})},fireActionable:function(){const e=this.getSelected(),t=e.filter((e=>this.isInstanceOf("MultiFeature",e)));let i=!1;if(e.length>1){i=!0;const t=e[0].type.replace("Multi","");e.forEach((e=>{e.type.replace("Multi","")!==t&&(i=!1)}))}const r=t.length>0,n=e.length>0;this.setActionableState({combineFeatures:i,uncombineFeatures:r,trash:n})},getUniqueIds:function(e){return e.length?e.map((e=>e.properties.id)).filter((e=>void 0!==e)).reduce(((e,t)=>(e.add(t),e)),new V).values():[]},stopExtendedInteractions:function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},onStop:function(){Ge.enable(this)},onMouseMove:function(e,t){return _(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0},onMouseOut:function(e){return!e.dragMoving||this.fireUpdate()}};
2Ke.onTap=Ke.onClick=function(e,t){return y(t)?this.clickAnywhere(e,t):p(c.VERTEX)(t)?this.clickOnVertex(e,t):_(t)?this.clickOnFeature(e,t):void 0},Ke.clickAnywhere=function(e){const t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach((e=>this.doRender(e)))),Ge.enable(this),this.stopExtendedInteractions(e)},Ke.clickOnVertex=function(e,t){this.changeMode(s.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:r.MOVE})},Ke.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},Ke.clickOnFeature=function(e,t){Ge.disable(this),this.stopExtendedInteractions(e);const i=b(t),n=this.getSelectedIds(),a=t.featureTarget.properties.id,l=this.isSelected(a);if(!i&&l&&this.getFeature(a).type!==o.POINT)return this.changeMode(s.DIRECT_SELECT,{featureId:a});l&&i?(this.deselect(a),this.updateUIClasses({mouse:r.POINTER}),1===n.length&&Ge.enable(this)):!l&&i?(this.select(a),this.updateUIClasses({mouse:r.MOVE})):!l&&!i&&(n.forEach((e=>this.doRender(e))),this.setSelected(a),this.updateUIClasses({mouse:r.MOVE})),this.doRender(a)},Ke.onMouseDown=function(e,t){return e.initialDragPanState=this.map.dragPan.isEnabled(),m(t)?this.startOnActiveFeature
vendor: 19,140 bytes, line 2
2(e,t):this.drawConfig.boxSelect&&f(t)?this.startBoxSelect(e,t):void 0},Ke.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=ve(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},Ke.onTouchStart=function(e,t){if(m(t))return this.startOnActiveFeature(e,t)},Ke.onDrag=function(e,t){return e.canDragMove?this.dragMove(e,t):this.drawConfig.boxSelect&&e.canBoxSelect?this.whileBoxSelect(e,t):void 0},Ke.whileBoxSelect=function(e,i){e.boxSelecting=!0,this.updateUIClasses({mouse:r.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(t.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));const n=ve(i.originalEvent,this.map.getContainer()),o=Math.min(e.boxSelectStartLocation.x,n.x),s=Math.max(e.boxSelectStartLocation.x,n.x),a=Math.min(e.boxSelectStartLocation.y,n.y),l=Math.max(e.boxSelectStartLocation.y,n.y),c=`translate(${o}px, ${a}px)`;e.boxSelectElement.style.transform=c,e.boxSelectElement.style.WebkitTransform=c,e.boxSelectElement.style.width=s-o+"px",e.boxSelectElement.style.height=l-a+"px"},Ke.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const i={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};Je(this.getSelected(),i),e.dragMoveLocation=t.lngLat},Ke.onTouchEnd=Ke.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){const i=[e.boxSelectStartLocation,ve(t.originalEvent,this.map.getContainer())],n=this.featuresAt(null,i,"click"),o=this.getUniqueIds(n).filter((e=>!this.isSelected(e)));o.length&&(this.select(o),o.forEach((e=>this.doRender(e))),this.updateUIClasses({mouse:r.MOVE}))}this.stopExtendedInteractions(e)},Ke.toDisplayFeatures=function(e,t,i){t.properties.active=this.isSelected(t.properties.id)?u.ACTIVE:u.INACTIVE,i(t),this.fireActionable(),t.properties.active===u.ACTIVE&&t.geometry.type!==o.POINT&&Ue(t).forEach(i)},Ke.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},Ke.onCombineFeatures=function(){const e=this.getSelected();if(0===e.length||e.length<2)return;const t=[],i=[],r=e[0].type.replace("Multi","");for(let n=0;n<e.length;n++){const o=e[n];if(o.type.replace("Multi","")!==r)return;o.type.includes("Multi")?o.getCoordinates().forEach((e=>{t.push(e)})):t.push(o.getCoordinates()),i.push(o.toGeoJSON())}if(i.length>1){const e=this.newFeature({type:o.FEATURE,properties:i[0].properties,geometry:{type:`Multi${r}`,coordinates:t}});this.addFeature(e),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([e.id]),this.fire(a.COMBINE_FEATURES,{createdFeatures:[e.toGeoJSON()],deletedFeatures:i})}this.fireActionable()},Ke.onUncombineFeatures=function(){const e=this.getSelected();if(0===e.length)return;const t=[],i=[];for(let r=0;r<e.length;r++){const n=e[r];this.isInstanceOf("MultiFeature",n)&&(n.getFeatures().forEach((e=>{this.addFeature(e),e.properties=n.properties,t.push(e.toGeoJSON()),this.select([e.id])})),this.deleteFeature(n.id,{silent:!0}),i.push(n.toGeoJSON()))}t.length>1&&this.fire(a.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:i}),this.fireActionable()};const Qe=p(c.VERTEX),et=p(c.MIDPOINT),tt={fireUpdate:function(){this.fire(a.UPDATE,{action:l.CHANGE_COORDINATES,features:this.getSelected().map((e=>e.toGeoJSON()))})},fireActionable:function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},startDragging:function(e,t){null==e.initialDragPanState&&(e.initialDragPanState=this.map.dragPan.isEnabled()),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},stopDragging:function(e){e.canDragMove&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.initialDragPanState=null,e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},onVertex:function(e,t){this.startDragging(e,t);const i=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(i.coord_path);b(t)||-1!==r?b(t)&&-1===r&&e.selectedCoordPaths.push(i.coord_path):e.selectedCoordPaths=[i.coord_path];const n=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(n)},onMidpoint:function(e,t){this.startDragging(e,t);const i=t.featureTarget.properties;e.feature.addCoordinate(i.coord_path,i.lng,i.lat),this.fireUpdate(),e.selectedCoordPaths=[i.coord_path]},pathsToCoordinates:function(e,t){return t.map((t=>({feature_id:e,coord_path:t})))},onFeature:function(e,t){0===e.selectedCoordPaths.length?this.startDragging(e,t):this.stopDragging(e)},dragFeature:function(e,t,i){Je(this.getSelected(),i),e.dragMoveLocation=t.lngLat},dragVertex:function(e,t,i){const r=e.selectedCoordPaths.map((t=>e.feature.getCoordinate(t))),n=Ye(r.map((e=>({type:o.FEATURE,properties:{},geometry:{type:o.POINT,coordinates:e}}))),i);for(let t=0;t<r.length;t++){const i=r[t];e.feature.updateCoordinate(e.selectedCoordPaths[t],i[0]+n.lng,i[1]+n.lat)}},clickNoTarget:function(){this.changeMode(s.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(s.SIMPLE_SELECT)},clickActiveFeature:function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},onSetup:function(e){const t=e.featureId,i=this.getFeature(t);if(!i)throw new Error("You must provide a featureId to enter direct_select mode");if(i.type===o.POINT)throw new TypeError("direct_select mode doesn't handle point features");const r={featureId:t,feature:i,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),Ge.disable(this),this.setActionableState({trash:!0}),r},onStop:function(){Ge.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(e,t,i){e.featureId===t.properties.id?(t.properties.active=u.ACTIVE,i(t),Ue(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(i)):(t.properties.active=u.INACTIVE,i(t)),this.fireActionable(e)},onTrash:function(e){e.selectedCoordPaths.sort(((e,t)=>t.localeCompare(e,"en",{numeric:!0}))).forEach((t=>e.feature.removeCoordinate(t))),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),!1===e.feature.isValid()&&(this.deleteFeature([e.featureId]),this.changeMode(s.SIMPLE_SELECT,{}))},onMouseMove:function(e,t){const i=m(t),n=Qe(t),o=et(t),s=0===e.selectedCoordPaths.length;return i&&s||n&&!s?this.updateUIClasses({mouse:r.MOVE}):this.updateUIClasses({mouse:r.NONE}),(n||i||o)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0},onMouseOut:function(e){return e.dragMoving&&this.fireUpdate(),!0}};tt.onTouchStart=tt.onMouseDown=function(e,t){return Qe(t)?this.onVertex(e,t):m(t)?this.onFeature(e,t):et(t)?this.onMidpoint(e,t):void 0},tt.onDrag=function(e,t){if(!0!==e.canDragMove)return;e.dragMoving=!0,t.originalEvent.stopPropagation();const i={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,i):this.dragFeature(e,t,i),e.dragMoveLocation=t.lngLat},tt.onClick=function(e,t){return y(t)?this.clickNoTarget(e,t):m(t)?this.clickActiveFeature(e,t):g(t)?this.clickInactive(e,t):void this.stopDragging(e)},tt.onTap=function(e,t){return y(t)?this.clickNoTarget(e,t):m(t)?this.clickActiveFeature(e,t):g(t)?this.clickInactive(e,t):void 0},tt.onTouchEnd=tt.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};const it={};function rt(e,t){return!!e.lngLat&&e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]}it.onSetup=function(){const e=this.newFeature({type:o.FEATURE,properties:{},geometry:{type:o.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:r.ADD}),this.activateUIButton(n.POINT),this.setActionableState({trash:!0}),{point:e}},it.stopDrawingAndRemove=function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(s.SIMPLE_SELECT)},it.onTap=it.onClick=function(e,t){this.updateUIClasses({mouse:r.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(a.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(s.SIMPLE_SELECT,{featureIds:[e.point.id]})},it.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},it.toDisplayFeatures=function(e,t,i){const r=t.properties.id===e.point.id;if(t.properties.active=r?u.ACTIVE:u.INACTIVE,!r)return i(t)},it.onTrash=it.stopDrawingAndRemove,it.onKeyUp=function(e,t){if(x(t)||w(t))return this.stopDrawingAndRemove(e,t)};const nt={onSetup:function(){const e=this.newFeature({type:o.FEATURE,properties:{},geometry:{type:o.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),Ge.disable(this),this.updateUIClasses({mouse:r.ADD}),this.activateUIButton(n.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&rt(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(s.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:r.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(s.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},onMouseMove:function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),v(t)&&this.updateUIClasses({mouse:r.POINTER})}};nt.onTap=nt.onClick=function(e,t){return v(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},nt.onKeyUp=function(e,t){x(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(s.SIMPLE_SELECT)):w(t)&&this.changeMode(s.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},nt.onStop=function(e){this.updateUIClasses({mouse:r.NONE}),Ge.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.polygon.id)&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(a.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(s.SIMPLE_SELECT,{},{silent:!0})))},nt.toDisplayFeatures=function(e,t,i){const r=t.properties.id===e.polygon.id;if(t.properties.active=r?u.ACTIVE:u.INACTIVE,!r)return i(t);if(0===t.geometry.coordinates.length)return;const n=t.geometry.coordinates[0].length;if(!(n<3)){if(t.properties.meta=c.FEATURE,i(be(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),n>3){const r=t.geometry.coordinates[0].length-3;i(be(e.polygon.id,t.geometry.coordinates[0][r],`0.${r}`,!1))}if(n<=4){const e=[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]];if(i({type:o.FEATURE,properties:t.properties,geometry:{coordinates:e,type:o.LINE_STRING}}),3===n)return}return i(t)}},nt.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(s.SIMPLE_SELECT)};const ot={onSetup:function(e){const t=(e=e||{}).featureId;let i,s,a="forward";if(t){if(i=this.getFeature(t),!i)throw new Error("Could not find a feature with the provided featureId");let r=e.from;if(r&&"Feature"===r.type&&r.geometry&&"Point"===r.geometry.type&&(r=r.geometry),r&&"Point"===r.type&&r.coordinates&&2===r.coordinates.length&&(r=r.coordinates),!r||!Array.isArray(r))throw new Error("Please use the `from` property to indicate which point to continue the line from");const n=i.coordinates.length-1;if(i.coordinates[n][0]===r[0]&&i.coordinates[n][1]===r[1])s=n+1,i.addCoordinate(s,...i.coordinates[n]);else{if(i.coordinates[0][0]!==r[0]||i.coordinates[0][1]!==r[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");a="backwards",s=0,i.addCoordinate(s,...i.coordinates[0])}}else i=this.newFeature({type:o.FEATURE,properties:{},geometry:{type:o.LINE_STRING,coordinates:[]}}),s=0,this.addFeature(i);return this.clearSelectedFeatures(),Ge.disable(this),this.updateUIClasses({mouse:r.ADD}),this.activateUIButton(n.LINE),this.setActionableState({trash:!0}),{line:i,currentVertexPosition:s,direction:a}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&rt(t,e.line.coordinates[e.currentVertexPosition-1])||"backwards"===e.direction&&rt(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(s.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:r.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),"forward"===e.direction?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(s.SIMPLE_SELECT,{featureIds:[e.line.id]})},onMouseMove:function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),v(t)&&this.updateUIClasses({mouse:r.POINTER})}};ot.onTap=ot.onClick=function(e,t){if(v(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},ot.onKeyUp=function(e,t){w(t)?this.changeMode(s.SIMPLE_SELECT,{featureIds:[e.line.id]}):x(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(s.SIMPLE_SELECT))},ot.onStop=function(e){Ge.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.line.id)&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(a.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(s.SIMPLE_SELECT,{},{silent:!0})))},ot.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(s.SIMPLE_SELECT)},ot.toDisplayFeatures=function(e,t,i){const r=t.properties.id===e.line.id;if(t.properties.active=r?u.ACTIVE:u.INACTIVE,!r)return i(t);t.geometry.coordinates.length<2||(t.properties.meta=c.FEATURE,i(be(e.line.id,t.geometry.coordinates["forward"===e.direction?t.geometry.coordinates.length-2:1],""+("forward"===e.direction?t.geometry.coordinates.length-2:1),!1)),i(t))};const st={simple_select:Ke,direct_select:tt,draw_point:it,draw_polygon:nt,draw_line_string:ot},at={defaultMode:s.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:ye,modes:st,controls:{},userProperties:!1,suppressAPIEvents:!0},lt={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},ct={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function ut(e,t){return e.map((e=>e.source?e:Object.assign({},e,{id:`${e.id}.${t}`,source:"hot"===t?i.HOT:i.COLD})))}function ht(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),!1===e.displayControlsDefault?t.controls=Object.assign({},ct,e.controls):t.controls=Object.assign({},lt,e.controls),t=Object.assign({},at,t),t.styles=ut(t.styles,"cold").concat(ut(t.styles,"hot")),t}var dt,pt;const ft=A((pt||(pt=1,dt=function e(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;var r,n,o;if(Array.isArray(t)){if((r=t.length)!=i.length)return!1;for(n=r;0!=n--;)if(!e(t[n],i[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(i,o[n]))return!1;for(n=r;0!=n--;){var s=o[n];if(!e(t[s],i[s]))return!1}return!0}return t!=t&&i!=i}),dt));var mt,gt;const yt=A(function(){if(gt)return mt;gt=1;var e={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};return mt=function(t){if(!t||!t.type)return null;var i=e[t.type];return i?"geometry"===i?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]}:"feature"===i?{type:"FeatureCollection",features:[t]}:"featurecollection"===i?t:void 0:null}}());function _t(e,t){return e.length===t.length&&JSON.stringify(e.map((e=>e)).sort())===JSON.stringify(t.map((e=>e)).sort())}const vt={Polygon:ee,LineString:Q,Point:K,MultiPolygon:re,MultiLineString:re,MultiPoint:re};const bt=Object.freeze(Object.defineProperty({__proto__:null,CommonSelectors:M,ModeHandler:H,StringSet:V,constrainFeatureMovement:Ye,createMidPoint:je,createSupplementaryPoints:Ue,createVertex:be,doubleClickZoom:Ge,euclideanDistance:q,featuresAt:U,getFeatureAtAndSetCursors:$,isClick:Z,isEventAtCoordinates:rt,isTap:W,mapEventToBoundingBox:B,moveFeatures:Je,sortFeatures:N,stringSetsAreEqual:_t,theme:ye,toDenseArray:le},Symbol.toStringTag,{value:"Module"})),xt=function(e,t){const i={options:e=ht(e)};t=function(e,t){t.modes=s;const i=void 0===e.options.suppressAPIEvents||!!e.options.suppressAPIEvents;return t.getFeatureIdsAt=function(t){return U.click({point:t},null,e).map((e=>e.properties.id))},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:o.FEATURE_COLLECTION,features:e.store.getSelectedIds().map((t=>e.store.get(t))).map((e=>e.toGeoJSON()))}},t.getSelectedPoints=function(){return{type:o.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map((e=>({type:o.FEATURE,properties:{},geometry:{type:o.POINT,coordinates:e.coordinates}})))}},t.set=function(i){if(void 0===i.type||i.type!==o.FEATURE_COLLECTION||!Array.isArray(i.features))throw new Error("Invalid FeatureCollection");const r=e.store.createRenderBatch();let n=e.store.getAllIds().slice();const s=t.add(i),a=new V(s);return n=n.filter((e=>!a.has(e))),n.length&&t.delete(n),r(),s},t.add=function(t){const r=JSON.parse(JSON.stringify(yt(t))).features.map((t=>{if(t.id=t.id||Y(),null===t.geometry)throw new Error("Invalid geometry: null");if(void 0===e.store.get(t.id)||e.store.get(t.id).type!==t.geometry.type){const r=vt[t.geometry.type];if(void 0===r)throw new Error(`Invalid geometry type: ${t.geometry.type}.`);const n=new r(e,t);e.store.add(n,{silent:i})}else{const r=e.store.get(t.id),n=r.properties;r.properties=t.properties,ft(n,t.properties)||e.store.featureChanged(r.id,{silent:i}),ft(r.getCoordinates(),t.geometry.coordinates)||r.incomingCoords(t.geometry.coordinates)}return t.id}));return e.store.render(),r},t.get=function(t){const i=e.store.get(t);if(i)return i.toGeoJSON()},t.getAll=function(){return{type:o.FEATURE_COLLECTION,features:e.store.getAll().map((e=>e.toGeoJSON()))}},t.delete=function(r){return e.store.delete(r,{silent:i}),t.getMode()!==s.DIRECT_SELECT||e.store.getSelectedIds().length?e.store.render():e.events.changeMode(s.SIMPLE_SELECT,void 0,{silent:i}),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:i}),t.getMode()===s.DIRECT_SELECT?e.events.changeMode(s.SIMPLE_SELECT,void 0,{silent:i}):e.store.render(),t},t.changeMode=function(r,n={}){return r===s.SIMPLE_SELECT&&t.getMode()===s.SIMPLE_SELECT?(_t(n.featureIds||[],e.store.getSelectedIds())||
2(e.store.setSelected(n.featureIds,{silent:i}),e.store.render()),t):(r===s.DIRECT_SELECT&&t.getMode()===s.DIRECT_SELECT&&n.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(r,n,{silent:i}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:i}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:i}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:i}),t},t.setFeatureProperty=function(r,n,o){return e.store.setFeatureProperty(r,n,o,{silent:i}),t},t}(i,t),i.api=t;const r=pe(i);return t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=n,t.options=e,t};function wt(e){xt(e,this)}function Tt(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Et(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function St(e,t,i={}){var r=Tt(e),n=Tt(t),o=Se(n[1]-r[1]),s=Se(n[0]-r[0]),a=Se(r[1]),l=Se(n[1]),c=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return function(e,t="kilometers"){const i=we[t];
2if(!i)throw new Error(t+" units is invalid");return e*i}(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i.units)}function Pt(e){return function(e,t,i){var r=i;return Ce(e,(function(e,i,n,o,s){r=t(r,e,i,n,o,s)})),r}(e,((e,t)=>e+function(e){let t,i=0;switch(e.type){case"Polygon":return It(e.coordinates);case"MultiPolygon":for(t=0;t<e.coordinates.length;t++)i+=It(e.coordinates[t]);return i;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(t)),0)}function It(e){let t=0;if(e&&e.length>0){t+=Math.abs(At(e[0]));for(let i=1;i<e.length;i++)t-=Math.abs(At(e[i]))}return t}wt.modes=st,wt.constants=d,wt.lib=bt;var Ct=xe*xe/2,Mt=Math.PI/180;function At(e){const t=e.length-1;if(t<=2)return 0;let i=0,r=0;for(;r<t;){const n=e[r],o=e[r+1===t?0:r+1],s=e[r+2>=t?(r+2)%t:r+2],a=n[0]*Mt,l=o[1]*Mt;i+=(s[0]*Mt-a)*Math.sin(l),r++}return i*Ct}function Lt(e){if(!e)throw new Error("geojson is required");const t=[];return Me(e,(e=>{!function(e,t){let i=[];const r=e.geometry;if(null!==r){switch(r.type){case"Polygon":i=Et(r);break;case"LineString":i=[Et(r)]}i.forEach((i=>{(function(e,t){const i=[];return e.reduce(((e,r)=>{const n=Ee([e,r],t);return n.bbox=function(e,t){const i=e[0],r=e[1],n=t[0],o=t[1];return[i<n?i:n,r<o?r:o,i>n?i:n,r>o?r:o]}(e,r),i.push(n),r})),i})(i,e.properties).forEach((e=>{e.id=t.length,t.push(e)}))}))}}(e,t)})),function(e,t={}){const i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}(t)}function Ft(e,t={}){let i=0,r=0,n=0;return Ie(e,(function(e){i+=e[0],r+=e[1],n++}),!0),function(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Pe(e[0])||!Pe(e[1]))throw new Error("coordinates must contain numbers");return Te({type:"Point",coordinates:e},t,i)}([i/n,r/n],t.properties)}function Dt(e,t={}){return Ae(e,((e,i)=>{const r=i.geometry.coordinates;return e+St(r[0],r[1],t)}),0)}const kt={mm:{system:"metric",toBase:.001},cm:{system:"metric",toBase:.01},m:{system:"metric",toBase:1},km:{system:"metric",toBase:1e3},in:{system:"imperial",toBase:.0254},ft:{system:"imperial",toBase:.3048},yd:{system:"imperial",toBase:.9144},mi:{system:"imperial",toBase:1609.344}},Ot={mm2:{system:"metric",toBase:1e-6},cm2:{system:"metric",toBase:1e-4},m2:{system:"metric",toBase:1},km2:{system:"metric",toBase:1e6},ha:{system:"metric",toBase:1e4},in2:{system:"imperial",toBase:64516e-8},ft2:{system:"imperial",toBase:.092903},yd2:{system:"imperial",toBase:.836127},ac:{system:"imperial",toBase:4046.8564224},mi2:{system:"imperial",toBase:2589988.110336}},Rt={...kt,...Ot};function zt(e){return{from:function(t){const i=Rt[t];if(!i)throw new Error(`Unknown unit: ${t}`);const r=e*i.toBase;return{to:function(e){const t=Rt[e];if(!t)throw new Error(`Unknown unit: ${e}`);return r/t.toBase},toBest:function(e={}){const i=e.system;if(t.endsWith("2")){if("imperial"===i){const e=r/Ot.ft2.toBase;return e<43560?{val:e,unit:"ft2"}:e<6272640?{val:r/4046.8564224,unit:"ac"}:{val:r/Ot.mi2.toBase,unit:"mi2"}}return r<1e4?{val:r,unit:"m2"}:r<1e6?{val:r/Ot.ha.toBase,unit:"ha"}:{val:r/Ot.km2.toBase,unit:"km2"}}if("imperial"===i){const e=r/kt.ft.toBase;return e<5280?{val:e,unit:"ft"}:{val:r/kt.mi.toBase,unit:"mi"}}return r<1e3?{val:r,unit:"m"}:{val:r/kt.km.toBase,unit:"km"}}}}}}const Nt="source-draw-labels",Bt="layer-draw-labels",Vt={type:"FeatureCollection",features:[]};e.default=class{constructor(e){this.options=e,this._drawCtrl=new wt({displayControlsDefault:!1,styles:[{id:"gl-draw-line",type:"line",filter:["all",["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.options?.style?.lengthMeasurement?.lineColor??"#D20C0C","line-dasharray":[.2,2],"line-width":this.options?.style?.lengthMeasurement?.lineWidth??2}},{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":this.options?.style?.areaMeasurement?.fillColor??"#D20C0C","fill-outline-color":this.options?.style?.areaMeasurement?.fillOutlineColor??"#D20C0C","fill-opacity":this.options?.style?.areaMeasurement?.fillOpacity??.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":this.options?.style?.common?.midPointRadius??3,"circle-color":this.options?.style?.common?.midPointColor??"#fbb03b"}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.options?.style?.areaMeasurement?.fillOutlineColor??"#D20C0C","line-dasharray":[.2,2],"line-width":this.options?.style?.areaMeasurement?.lineWidth??2}},{id:"gl-draw-polygon-and-line-vertex-halo-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":this.options?.style?.common?.midPointHaloRadius??3,"circle-color":this.options?.style?.common?.midPointHaloColor??"#FFF"}},{id:"gl-draw-polygon-and-line-vertex-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":this.options?.style?.common?.midPointRadius??3,"circle-color":this.options?.style?.common?.midPointColor??"#fbb03b"}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","$type","LineString"],["==","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.options?.style?.lengthMeasurement?.lineColor??"#D20C0C","line-width":this.options?.style?.lengthMeasurement?.lineWidth??3}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","$type","Polygon"],["==","mode","static"]],paint:{"fill-color":this.options?.style?.areaMeasurement?.fillColor??"#000","fill-outline-color":this.options?.style?.areaMeasurement?.fillOutlineColor??"#000","fill-opacity":this.options?.style?.areaMeasurement?.fillOpacity??.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","$type","Polygon"],["==","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.options?.style?.areaMeasurement?.fillOutlineColor??"#000","line-width":this.options?.style?.areaMeasurement?.lineWidth??2}}]})}onAdd(e){return this._map=e,this._map.addControl(this._drawCtrl,"top-left"),this._initControl(),this._registerEvents(),this._container}_initControl(){this._container=document.createElement("div"),this._container.className="maplibregl-ctrl mapboxgl-ctrl maplibregl-measures maplibregl-ctrl-group mapboxgl-ctrl-group",this.initDrawBtn(this._drawCtrl.modes.DRAW_LINE_STRING),this.initDrawBtn(this._drawCtrl.modes.DRAW_POLYGON),this.initClearBtn()}_formatMeasure(e,t=!1){return"imperial"===this.options?.units?t?this._formatAreaToImperialSystem(e):this._formatToImperialSystem(e):t?this._formatAreaToMetricSystem(e):this._formatToMetricSystem(e)}_formatAreaToMetricSystem(e){let t,i;return this.options?.fixedAreaUnit?(t=zt(e).from("m2").to(this.options.fixedAreaUnit),i=this.options.fixedAreaUnit):(t=zt(e).from("m2").toBest({system:"metric"}),i=t.unit),`${this._getLocaleNumber(t.val||t)} ${i.replaceAll("2","²")}`}_formatAreaToImperialSystem(e){let t,i;return this.options?.fixedAreaUnit?(t=zt(e).from("m2").to(this.options.fixedAreaUnit),i=this.options.fixedAreaUnit):(t=zt(e).from("m2").to("mi2"),t=zt(t).from("mi2").toBest({system:"imperial"}),i=t.unit),`${this._getLocaleNumber(t.val||t)} ${i.replaceAll("2","²")}`}_formatToMetricSystem(e){let t,i;return this.options?.fixedLengthUnit?(t=zt(e).from("m").to(this.options.fixedLengthUnit),i=this.options.fixedLengthUnit):(t=zt(e).from("m").toBest({system:"metric"}),i=t.unit),`${this._getLocaleNumber(t.val||t)} ${i}`}_formatToImperialSystem(e){let t,i;return this.options?.fixedLengthUnit?(t=zt(e).from("m").to(this.options.fixedLengthUnit),i=this.options.fixedLengthUnit):(t=zt(e).from("m").to("mi"),t=zt(t).from("mi").toBest({system:"imperial"}),i=t.unit),`${this._getLocaleNumber(t.val||t)} ${i}`}_getLocaleNumber(e){let t=("number"==typeof e?e:void 0!==e.val?e.val:e).toLocaleStr
2ing(void 0,{minimumFractionDigits:this.options?.minimumFractionDigits??2,maximumFractionDigits:this.options?.maximumFractionDigits??2,useGrouping:!this.options?.unitsGroupingSeparator}),i=this.options?.unitsGroupingSeparator;return i&&(t=t.replace(/\B(?=(\d{3})+(?!\d))/g,i)),t}initDrawBtn(e){let t=document.createElement("button");switch(t.type="button",e){case this._drawCtrl.modes.DRAW_LINE_STRING:t.title=this.options?.lang?.lengthMeasurementButtonTitle??"",t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" \n                viewBox="0 0 512 512" xml:space="preserve" style="padding:4px">\n               <path d="M503.467,0h-51.2c-4.71,0-8.533,3.814-8.533,8.533v51.2c0,4.719,3.823,8.533,8.533,8.533h16.077\n                   c-15.027,136.132-31.095,243.354-75.81,275.678V332.8c0-4.719-3.823-8.533-8.533-8.533h-51.2c-4.71,0-8.533,3.814-8.533,8.533\n                   v9.207c-24.226-20.591-47.59-60.45-70.298-99.26c-22.485-38.426-43.793-74.795-66.236-93.269V128c0-4.719-3.823-8.533-8.533-8.533\n                   H128c-4.71,0-8.533,3.814-8.533,8.533v20.326c-45.833,25.207-73.916,114.697-93.005,295.407H8.533\n                   c-4.71,0-8.533,3.814-8.533,8.533v51.2C0,508.186,3.823,512,8.533,512h51.2c4.71,0,8.533-3.814,8.533-8.533v-51.2\n                   c0-4.719-3.823-8.533-8.533-8.533H43.622c16.734-157.124,41.054-245.598,75.844-274.765V179.2c0,4.719,3.823,8.533,8.533,8.533\n                   h51.2c4.71,0,8.533-3.814,8.533-8.533v-5.973c16.614,18.56,33.664,47.667,51.499,78.14\n                   c26.539,45.363,53.948,92.117,85.035,111.829V384c0,4.719,3.823,8.533,8.533,8.533H384c4.71,0,8.533-3.814,8.533-8.533v-20.096\n                   c58.539-29.158,75.981-141.21,92.979-295.637h17.954c4.71,0,8.533-3.814,8.533-8.533v-51.2C512,3.814,508.177,0,503.467,0z"/>\n           </svg>';break;case this._drawCtrl.modes.DRAW_POLYGON:t.title=this.options?.lang?.areaMeasurementButtonTitle??"",t.innerHTML='<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n                <path d="M18 38C18 40.2091 16.2091 42 14 42C11.7909 42 10 40.2091 10 38C10 35.7909 11.7909 34 14 34C16.2091 34 18 35.7909 18 38Z" fill="#333333"/>\n                <path fill-rule="evenodd" clip-rule="evenodd" d="M14 40C15.1046 40 16 39.1046 16 38C16 36.8954 15.1046 36 14 36C12.8954 36 12 36.8954 12 38C12 39.1046 12.8954 40 14 40ZM14 42C16.2091 42 18 40.2091 18 38C18 35.7909 16.2091 34 14 34C11.7909 34 10 35.7909 10 38C10 40.2091 11.7909 42 14 42Z" fill="#333333"/>\n                <path d="M14 20C14 22.2091 12.2091 24 10 24C7.79086 24 6 22.2091 6 20C6 17.7909 7.79086 16 10 16C12.2091 16 14 17.7909 14 20Z" fill="#333333"/>\n                <path fill-rule="evenodd" clip-rule="evenodd" d="M10 22C11.1046 22 12 21.1046 12 20C12 18.8954 11.1046 18 10 18C8.89543 18 8 18.8954 8 20C8 21.1046 8.89543 22 10 22ZM10 24C12.2091 24 14 22.2091 14 20C14 17.7909 12.2091 16 10 16C7.79086 16 6 17.7909 6 20C6 22.2091 7.79086 24 10 24Z" fill="#333333"/>\n                <path d="M42 20C42 22.2091 40.2091 24 38 24C35.7909 24 34 22.2091 34 20C34 17.7909 35.7909 16 38 16C40.2091 16 42 17.7909 42 20Z" fill="#333333"/>\n                <path fill-rule="evenodd" clip-rule="evenodd" d="M38 22C39.1046 22 40 21.1046 40 20C40 18.8954 39.1046 18 38 18C36.8954 18 36 18.8954 36 20C36 21.1046 36.8954 22 38 22ZM38 24C40.2091 24 42 22.2091 42 20C42 17.7909 40.2091 16 38 16C35.7909 16 34 17.7909 34 20C34 22.2091 35.7909 24 38 24Z" fill="#333333"/>\n                <path d="M38 38C38 40.2091 36.2091 42 34 42C31.7909 42 30 40.2091 30 38C30 35.7909 31.7909 34 34 34C36.2091 34 38 35.7909 38 38Z" fill="#333333"/>\n                <path fill-rule="evenodd" clip-rule="evenodd" d="M34 40C35.1046 40 36 39.1046 36 38C36 36.8954 35.1046 36 34 36C32.8954 36 32 36.8954 32 38C32 39.1046 32.8954 40 34 40ZM34 42C36.2091 42 38 40.2091 38 38C38 35.7909 36.2091 34 34 34C31.7909 34 30 35.7909 30 38C30 40.2091 31.7909 42 34 42Z" fill="#333333"/>\n                <path d="M28 10C28 12.2091 26.2091 14 24 14C21.7909 14 20 12.2091 20 10C20 7.79086 21.7909 6 24 6C26.2091 6 28 7.79086 28 10Z" fill="#333333"/>\n                <path fill-rule="evenodd" clip-rule="evenodd" d="M24 12C25.1046 12 26 11.
21046 26 10C26 8.89543 25.1046 8 24 8C22.8954 8 22 8.89543 22 10C22 11.1046 22.8954 12 24 12ZM24 14C26.2091 14 28 12.2091 28 10C28 7.79086 26.2091 6 24 6C21.7909 6 20 7.79086 20 10C20 12.2091 21.7909 14 24 14Z" fill="#333333"/>\n                <path fill-rule="evenodd" clip-rule="evenodd" d="M34.9188 19.028L25.9188 12.5994L27.0812 10.9719L36.0812 17.4005L34.9188 19.028ZM21.7844 12.8114L13.0812 19.028L11.9187 17.4005L20.6219 11.1839L21.7844 12.8114ZM11.6428 22.783L14.3095 34.783L12.3571 35.2169L9.69047 23.2169L11.6428 22.783ZM33.6905 34.783L36.246 23.283L38.1984 23.7169L35.6428 35.2169L33.6905 34.783ZM17 36.9999H31V38.9999H17V36.9999Z" fill="#333333"/>\n                </svg>\n                '}t.addEventListener("click",(()=>{this._drawCtrl.changeMode(e)})),this._container.appendChild(t)}initClearBtn(){let e=document.createElement("button");e.type="button",e.title=this.options?.lang?.clearMeasurementsButtonTitle??"",e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg"\n                            viewBox="0 0 465.311 465.311" style="padding:5px" xml:space="preserve">\n                            <g>\n                                <path d="M372.811,51.002h-59.908V36.566C312.902,16.404,296.499,0,276.335,0h-87.356c-20.163,0-36.567,16.404-36.567,36.566v14.436\n                                    H92.5c-20.726,0-37.587,16.861-37.587,37.587v38.91c0,8.284,6.716,15,15,15h7.728v307.812c0,8.284,6.716,15,15,15H372.67\n                                    c8.284,0,15-6.716,15-15V142.499h7.728c8.284,0,15-6.716,15-15v-38.91C410.397,67.863,393.536,51.002,372.811,51.002z\n                                        M182.412,36.566c0-3.621,2.946-6.566,6.567-6.566h87.356c3.621,0,6.567,2.946,6.567,6.566v14.436h-100.49V36.566z M84.914,88.589\n                                    c0-4.184,3.403-7.587,7.587-7.587h280.31c4.184,0,7.587,3.403,7.587,7.587v23.91H84.914V88.589z M357.67,435.311H107.641V142.499\n                                    H357.67V435.311z"/>\n                                <path d="M137.41,413.485c5.523,0,10-4.477,10-10V166.497c0-5.523-4.477-10-10-10s-10,4.477-10,10v236.988\n                                    C127.41,409.008,131.887,413.485,137.41,413.485z"/>\n                                <path d="M200.907,413.485c5.523,0,10-4.477,10-10V166.497c0-5.523-4.477-10-10-10s-10,4.477-10,10v236.988\n                                    C190.907,409.008,195.384,413.485,200.907,413.485z"/>\n                                <path d="M264.404,413.485c5.523,0,10-4.477,10-10V166.497c0-5.523-4.477-10-10-10s-10,4.477-10,10v236.988\n                                    C254.404,409.008,258.881,413.485,264.404,413.485z"/>\n                                <path d="M327.901,413.485c5.523,0,10-4.477,10-10V166.497c0-5.523-4.477-10-10-10s-10,4.477-10,10v236.988\n                                    C317.901,409.008,322.378,413.485,327.901,413.485z"/>\n                            </g>\n                            </svg>',e.addEventListener("click",(()=>{this._drawCtrl.deleteAll(),this._updateLabels()})),this._container.appendChild(e)}_registerEvents(){this._map&&(this._map.on("load",(()=>{this._recreateSourceAndLayers()})),this._map.on("draw.create",(()=>{this._updateLabels(),this._handleOnCreate()})),this._map.on("draw.update",this._updateLabels.bind(this)),this._map.on("draw.delete",this._updateLabels.bind(this)),this._map.on("draw.render",(()=>{this._updateLabels(),this._handleOnRender()})))}_recreateSourceAndLayers(){this._map.getSource(Nt)||this._map.addSource(Nt,{type:"geojson",data:Vt}),this._map.getLayer(Bt)||this._map.addLayer({id:Bt,type:"symbol",source:Nt,layout:{"text-font":[this.options?.style?.text?.font??"Klokantech Noto Sans Bold"],"text-field":["get","measurement"],"text-variable-anchor":["top","bottom","left","right"],"text-radial-offset":this.options?.style?.text?.radialOffset??.5,"text-justify":"auto","text-letter-spacing":this.options?.style?.text?.letterSpacing??.05,"text-size":["interpolate",["linear"],["zoom"],5,10,10,12,13,14,14,16,18,18]},paint:{"text-color":this.options?.style?.text?.color??"#D20C0C","text-halo-color":this.options?.style?.text?.haloColor??"#fff","text-halo-width":this.options?.style?.text?.haloWidth??10}})}_reorderLayers(){if(this._map){let e=Object.values(wt.constants.sources);this._map.getStyle().layers.filter((t=>
2e.includes(t.source))).forEach((e=>{this._map.moveLayer(e.id)})),this._map.moveLayer(Bt)}}_handleOnRender(){if(this.options&&null!==this.options.onRender&&void 0!==this.options.onRender&&this.options.onRender instanceof Function){const e=this._getDrawnFeatures();try{this.options.onRender.call(this,e)}catch(e){console.error(e)}}}_handleOnCreate(){if(this.options&&null!==this.options.onCreate&&void 0!==this.options.onCreate&&this.options.onCreate instanceof Function){const e=this._getDrawnFeatures();try{this.options.onCreate.call(this,e)}catch(e){console.error(e)}}}_updateLabels(){let e=this._map.getSource(Nt);!e&&this._map&&(this._recreateSourceAndLayers(),e=this._map.getSource(Nt));const t=this._getDrawnFeatures();e.setData(t),this._reorderLayers()}_getDrawnFeatures(){let e=[];return this._drawCtrl.getAll().features.forEach((t=>{try{if("Polygon"===t.geometry.type){let i=this._formatMeasure(Pt(t),!0),r=Ft(t),n=`${i}`;r.properties={measurement:n},e.push(r)}else if("LineString"===t.geometry.type)if(this.options?.showOnlyTotalLineLength){const i=this._formatMeasure(1e3*Dt(t)),r=Ft(t),n=`${i}`;r.properties={measurement:n},e.push(r)}else Lt(t).features.forEach((t=>{let i=Ft(t),r=`${this._formatMeasure(1e3*Dt(t))}`;i.properties={measurement:r},e.push(i)}))}catch{}})),{type:"FeatureCollection",features:e}}onRemove(){this._container.parentNode.removeChild(this._container),this._map.removeLayer(Bt),this._map=void 0}},Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}(t)},628:e=>{e.exports.RADIUS=6378137,e.exports.FLATTENING=1/298.257223563,e.exports.POLAR_RADIUS=6356752.3142},443:function(e){e.exports=function(){"use strict";var e={},t={};function i(i,r,n){if(t[i]=n,"index"===i){var o="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",s={};return t.shared(s),t.index(e,s),"undefined"!=typeof window&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),e}}return i("shared",0,(function(e){function t(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}function i(e,t){this.x=e,this.y=t}function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,o;"function"==typeof SuppressedError&&SuppressedError,i.prototype={clone(){return new i(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround(e,t){const i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:i},i.convert=function(e){if(e instanceof i)return e;if(Array.isArray(e))return new i(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new i(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};var s=function(){if(o)return n;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return o=1,n=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)<t)return i;var o=this.sampleCurveDerivativeX(i);
2if(Math.abs(o)<1e-6)break;i-=n/o}var s=0,a=1;for(i=e,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-e)<t));r++)e>n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},n}(),a=r(s);let l,c;function u(){return null!=l||(l="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),l}function h(){if(null==c&&(c=!1,u())){const e=5,t=new OffscreenCanvas(e,e).getContext("2d",{willReadFrequently:!0});if(t){for(let i=0;i<e*e;i++){const r=4*i;t.fillStyle=`rgb(${r},${r+1},${r+2})`,t.fillRect(i%e,Math.floor(i/e),1,1)}const i=t.getImageData(0,0,e,e).data;for(let t=0;t<e*e*4;t++)if(t%4!=3&&i[t]!==t){c=!0;break}}}return c||!1}var d=1e-6,p="undefined"!=typeof Float32Array?Float32Array:Array;function f(){var e=new p(9);return p!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function m(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function g(){var e=new p(3);return p!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function y(e){var t=e[0],i=e[1],r=e[2];return Math.sqrt(t*t+i*i+r*r)}function _(e,t,i){var r=new p(3);return r[0]=e,r[1]=t,r[2]=i,r}function v(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function b(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function x(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[0],a=i[1],l=i[2];return e[0]=n*l-o*a,e[1]=o*s-r*l,e[2]=r*a-n*s,e}var w,T=y;function E(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*s,e[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*s,e[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*s,e[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*s,e}function S(){var e=new p(4);return p!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function P(e,t,i,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;t*=o,r*=o,i*=o;var s=Math.sin(t),a=Math.cos(t),l=Math.sin(i),c=Math.cos(i),u=Math.sin(r),h=Math.cos(r);switch(n){case"xyz":e[0]=s*c*h+a*l*u,e[1]=a*l*h-s*c*u,e[2]=a*c*u+s*l*h,e[3]=a*c*h-s*l*u;break;case"xzy":e[0]=s*c*h-a*l*u,e[1]=a*l*h-s*c*u,e[2]=a*c*u+s*l*h,e[3]=a*c*h+s*l*u;break;case"yxz":e[0]=s*c*h+a*l*u,e[1]=a*l*h-s*c*u,e[2]=a*c*u-s*l*h,e[3]=a*c*h+s*l*u;break;case"yzx":e[0]=s*c*h+a*l*u,e[1]=a*l*h+s*c*u,e[2]=a*c*u-s*l*h,e[3]=a*c*h-s*l*u;break;case"zxy":e[0]=s*c*h-a*l*u,e[1]=a*l*h+s*c*u,e[2]=a*c*u+s*l*h,e[3]=a*c*h-s*l*u;break;case"zyx":e[0]=s*c*h-a*l*u,e[1]=a*l*h+s*c*u,e[2]=a*c*u-s*l*h,e[3]=a*c*h+s*l*u;break;default:throw new Error("Unknown angle order "+n)}return e}function I(){var e=new p(2);return p!=Float32Array&&(e[0]=0,e[1]=0),e}function C(e,t){var i=new p(2);return i[0]=e,i[1]=t,i}g(),w=new p(4),p!=Float32Array&&(w[0]=0,w[1]=0,w[2]=0,w[3]=0),g(),_(1,0,0),_(0,1,0),S(),S(),f(),I();const M=8192;function A(e,t,i){return t*(M/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function L(e){return e instanceof Error?e:new Error("string"==typeof e?e:String(e))}function F(e,t){return(e%t+t)%t}function D(e,t,i){return e*(1-i)+t*i}function k(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function O(e,t,i,r){const n=new a(e,t,i,r);return e=>n.solve(e)}const R=O(.25,.1,.25,1);function z(e,t,i){return Math.min(i,Math.max(t,e))}function N(e,t,i){const r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function B(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let V=1;function j(e,t,i){const r={};for(const i in e)r[i]=t.call(this,e[i],i,e);return r}function U(e,t,i){const r={};for(const i in e)t.call(this,e[i],i,e)&&(r[i]=e[i]);return r}function G(e){return Array.isArray(e)?e.map(G):"object"==typeof e&&e?j(e,G):e}const $={};function q(e){$[e]||("undefined"!=typeof console&&console.warn(e),$[e]=!0)}function Z(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function W(e){return"undefined"!=typeof WorkerGlobalScope&&void 0!==e&&e instanceof WorkerGlobalScope}let H=null;function X(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}const Y="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function J(e,i,r,n,o){return t(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const t=new VideoFrame(e,{timestamp:0});try{const s=null==t?void 0:t.format;if(!s||!s.startsWith("BGR")&&!s.startsWith("RGB"))throw new Error(`Unrecognized format ${s}`);const a=s.startsWith("BGR"),l=new Uint8ClampedArray(n*o*4);if(yield t.copyTo(l,function(e,t,i,r,n){const o=4*Math.max(-t,0),s=(Math.max(0,i)-i)*r*4+o,a=4*r,l=Math.max(0,t),c=Math.max(0,i);return{rect:{x:l,y:c,width:Math.min(e.width,t+r)-l,height:Math.min(e.height,i+n)-c},layout:[{offset:s,stride:a}]}}(e,i,r,n,o)),a)for(let e=0;e<l.length;e+=4){const t=l[e];l[e]=l[e+2],l[e+2]=t}return l}finally{t.close()}}))}let K,Q;function ee(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function te(e){return e*Math.PI/180}function ie(e){return e/Math.PI*180}const re={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0}
2,ne={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},oe="AbortError";class se extends Error{constructor(e=oe){super(e instanceof Error?e.message:e),this.name=oe,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function ae(e){return e instanceof Error&&e.name===oe}function le(e){if(e.aborted)throw new se(e.reason)}const ce={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ue(e){return ce.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const he="global-dispatcher";class de extends Error{constructor(e,t,i,r){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=r}}const pe=()=>{var e;return W(self)?null===(e=self.worker)||void 0===e?void 0:e.referrer:("blob:"===window.location.protocol?window.parent:window).location.href},fe=function(e,i){return t(this,void 0,void 0,(function*(){var r,n;if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){const t=ue(e.url);if(t){const r=yield t(e,i);return r.data||"arrayBuffer"!==e.type?r:B(r,{data:new ArrayBuffer(0)})}if(W(self)&&(null===(r=self.worker)||void 0===r?void 0:r.actor))return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:he},i)}if(!(e=>{var t;return e.startsWith("file:")||(null===(t=pe())||void 0===t?void 0:t.startsWith("file:"))&&!/^\w+:/.test(e)})(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return function(e,i){return t(this,void 0,void 0,(function*(){const t=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:pe(),referrerPolicy:e.referrerPolicy,signal:i.signal});let r,n;"json"!==e.type||t.headers.has("Accept")||t.headers.set("Accept","application/json");try{r=yield fetch(t)}catch(t){if(ae(t))throw t;throw new de(0,L(t).message,e.url,new Blob)}if(!r.ok){const t=yield r.blob();throw new de(r.status,r.statusText,e.url,t)}n="arrayBuffer"===e.type||"image"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text();const o=yield n;return le(i.signal),{data:o,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),etag:r.headers.get("ETag")}}))}(e,i);if(W(self)&&(null===(n=self.worker)||void 0===n?void 0:n.actor))return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:he},i)}return function(e,t){return new Promise(((i,r)=>{var n;const o=new XMLHttpRequest;o.open(e.method||"GET",e.url,!0),"arrayBuffer"!==e.type&&"image"!==e.type||(o.responseType="arraybuffer");for(const t in e.headers)o.setRequestHeader(t,e.headers[t]);"json"===e.type&&(o.responseType="text",(null===(n=e.headers)||void 0===n?void 0:n.Accept)||o.setRequestHeader("Accept","application/json")),o.withCredentials="include"===e.credentials,o.onerror=()=>{r(new Error(o.statusText))},o.onload=()=>{if(!t.signal.aborted)if((o.status>=200&&o.status<300||0===o.status)&&null!==o.response){let t=o.response;if("json"===e.type)try{t=JSON.parse(o.response)}catch(e){return void r(e)}i({data:t,cacheControl:o.getResponseHeader("Cache-Control"),expires:o.getResponseHeader("Expires"),etag:o.getResponseHeader("ETag")})}else{const t=new Blob([o.response],{type:o.getResponseHeader("Content-Type")});r(new de(o.status,o.statusText,e.url,t))}},t.signal.addEventListener("abort",(()=>{o.abort(),r(new se(t.signal.reason))})),o.send(e.body)}))}(e,i)}))};function me(e){if(!e||e.indexOf("://")<=0||e.startsWith("data:image/")||e.startsWith("blob:"))return!0;const t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function ge(e,t,i){var r;(null===(r=i[e])||void 0===r?void 0:r.includes(t))||(i[e]||(i[e]=[]),i[e].push(t))}function ye(e,t,i){if(null==i?void 0:i[e]){const r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class _e{constructor(e,t={}){B(this,t),this.type=e}}class ve extends _e{constructor(e,t={}){super("error",B({error:e},t))}}class be{on(e,t){return this._listeners||(this._listeners={}),ge(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return ye(e,t,this._listeners),ye(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||(this._oneTimeListeners={}),ge(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){var i,r;"string"==typeof e&&(e=new _e(e,t||{}));const n=e.type;if(this.listens(n)){e.target=this;const t=(null===(i=this._listeners)||void 0===i?void 0:i[n])?this._listeners[n].slice():[];for(const i of t)i.call(this,e);const o=(null===(r=this._oneTimeListeners)||void 0===r?void 0:r[n])?this._oneTimeListeners[n].slice():[];for(const t of o)ye(n,t,this._oneTimeListeners),t.call(this,e);const s=this._eventedParent;s&&(B(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),s.fire(e))}else e instanceof ve&&console.error(e.error);return this}listens(e){var t,i,r,n,o;return(null===(i=null===(t=this._listeners)||void 0===t?void 0:t[e])||void 0===i?void 0:i.length)>0||(null===(n=null===(r=this._oneTimeListeners)||void 0===r?void 0:r[e])||void 0===n?void 0:n.length)>0||(null===(o=this._eventedParent)||void 0===o?void 0:o.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var xe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"}
vendor: 21,023 bytes, line 2
2,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"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{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:"*"}},source_raster_dem:{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:"*"}},source_geojson:{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:"filter"},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"}},source_video:{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"}}},source_image:{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"}}},layer:{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"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{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}},sky:{"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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"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"}},"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:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven
vendor: 12,722 bytes, line 2
2"},"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","feature"]},"property-type":"cross-faded-data-driven"},"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"}},paint_circle:{"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"}},paint_heatmap:{"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"}},paint_symbol:{"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"}},paint_raster:{"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"}},paint_hillshade:{"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"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"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"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:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}}
vendor: 6,930 bytes, line 2
2;const we=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Te(e,t){const i={};for(const t in e)"ref"!==t&&(i[t]=e[t]);return we.forEach((e=>{e in t&&(i[e]=t[e])})),i}function Ee(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Ee(e[i],t[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!Ee(e[i],t[i]))return!1;return!0}return e===t}function Se(e,t){e.push(t)}function Pe(e,t,i){Se(i,{command:"addSource",args:[e,t[e]]})}function Ie(e,t,i){Se(t,{command:"removeSource",args:[e]}),i[e]=!0}function Ce(e,t,i,r){Ie(e,i,r),Pe(e,t,i)}function Me(e,t,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&"data"!==r&&!Ee(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!Ee(e[i][r],t[i][r]))return!1;return!0}function Ae(e,t,i,r,n,o){e=e||{},t=t||{};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(Ee(e[s],t[s])||i.push({command:o,args:[r,s,t[s],n]}));for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(Ee(e[s],t[s])||i.push({command:o,args:[r,s,t[s],n]}))}function Le(e){return e.id}function Fe(e,t){return e[t.id]=t,e}class De{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function ke(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}class Oe extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Re{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new Re(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const ze={kind:"null"},Ne={kind:"number"},Be={kind:"string"},Ve={kind:"boolean"},je={kind:"color"},Ue={kind:"projectionDefinition"},Ge={kind:"object"},$e={kind:"value"},qe={kind:"collator"},Ze={kind:"formatted"},We={kind:"padding"},He={kind:"colorArray"},Xe={kind:"numberArray"},Ye={kind:"resolvedImage"},Je={kind:"variableAnchorOffsetCollection"};function Ke(e,t){return{kind:"array",itemType:e,N:t}}function Qe(e){if("array"===e.kind){const t=Qe(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const et=[ze,Ne,Be,Ve,je,Ue,Ze,Ge,Ke($e),We,Xe,He,Ye,Je];function tt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!tt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of et)if(!tt(e,t))return null}return`Expected ${Qe(e)} but found ${Qe(t)} instead.`}function it(e,t){return t.some((t=>t.kind===e.kind))}function rt(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}function nt(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const ot=.96422,st=.82521,at=4/29,lt=6/29,ct=3*lt*lt,ut=lt*lt*lt,ht=Math.PI/180,dt=180/Math.PI;function pt(e){return(e%=360)<0&&(e+=360),e}function ft([e,t,i,r]){let n,o;const s=gt((.2225045*(e=mt(e))+.7168786*(t=mt(t))+.0606169*(i=mt(i)))/1);e===t&&t===i?n=o=s:(n=gt((.4360747*e+.3850649*t+.1430804*i)/ot),o=gt((.0139322*e+.0971045*t+.7141733*i)/st));const a=116*s-16;return[a<0?0:a,500*(n-s),200*(s-o),r]}function mt(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function gt(e){return e>ut?Math.pow(e,1/3):e/ct+at}function yt([e,t,i,r]){let n=(e+16)/116,o=isNaN(t)?n:n+t/500,s=isNaN(i)?n:n-i/200;return n=1*vt(n),o=ot*vt(o),s=st*vt(s),[_t(3.1338561*o-1.6168667*n-.4906146*s),_t(-.9787684*o+1.9161415*n+.033454*s),_t(.0719453*o-.2289914*n+1.4052427*s),r]}function _t(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function vt(e){return e>lt?e*e*e:ct*(e-at)}const bt=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function xt(e,t){return bt(e,t)?e[t]:void 0}function wt(e){return parseInt(e.padEnd(2,e),16)/255}function Tt(e,t){return Et(t?e/100:e,0,1)}function Et(e,t,i){return Math.min(Math.max(t,e),i)}function St(e){return!e.some(Number.isNaN)}const Pt={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],ol
vendor: 17,140 bytes, line 2
2ive:[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 It(e,t,i){return e+i*(t-e)}function Ct(e,t,i){return e.map(((e,r)=>It(e,t[r],i)))}class Mt{constructor(e,t,i,r=1,n=!0){this.r=e,this.g=t,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,i,r]))}static parse(e){if(e instanceof Mt)return e;if("string"!=typeof e)return;const t=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=xt(Pt,e);if(t){const[e,i,r]=t;return[e/255,i/255,r/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let i=1;return[wt(e.slice(i,i+=t)),wt(e.slice(i,i+=t)),wt(e.slice(i,i+=t)),wt(e.slice(i,i+t)||"ff")]}if(e.startsWith("rgb")){const t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[e,i,r,n,o,s,a,l,c,u,h,d]=t,p=[n||" ",a||" ",u].join("");if("  "===p||"  /"===p||",,"===p||",,,"===p){const e=[r,s,c].join(""),t="%%%"===e?100:""===e?255:0;if(t){const e=[Et(+i/t,0,1),Et(+o/t,0,1),Et(+l/t,0,1),h?Tt(+h,d):1];if(St(e))return e}}return}}const i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[e,t,r,n,o,s,a,l,c]=i,u=[r||" ",o||" ",a].join("");if("  "===u||"  /"===u||",,"===u||",,,"===u){const e=[+t,Et(+n,0,100),Et(+s,0,100),l?Tt(+l,c):1];if(St(e))return function([e,t,i,r]){function n(r){const n=(r+e/30)%12,o=t*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return e=pt(e),t/=100,i/=100,[n(0),n(8),n(4),r]}(e)}}}(e);return t?new Mt(...t,!1):void 0}get rgb(){const{r:e,g:t,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[e/n,t/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,i,r,n]=ft(e),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?pt(Math.atan2(r,i)*dt):NaN,o,t,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ft(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,r]=this.rgb;return`rgba(${[e,t,i].map((e=>Math.round(255*e))).join(",")},${r})`}static interpolate(e,t,i,r="rgb"){switch(r){case"rgb":{const[r,n,o,s]=Ct(e.rgb,t.rgb,i);return new Mt(r,n,o,s,!1)}case"hcl":{const[r,n,o,s]=e.hcl,[a,l,c,u]=t.hcl;let h,d;if(isNaN(r)||isNaN(a))isNaN(r)?isNaN(a)?h=NaN:(h=a,1!==o&&0!==o||(d=l)):(h=r,1!==c&&0!==c||(d=n));else{let e=a-r;a>r&&e>180?e-=360:a<r&&r-a>180&&(e+=360),h=r+i*e}const[p,f,m,g]=function([e,t,i,r]){return e=isNaN(e)?0:e*ht,yt([i,Math.cos(e)*t,Math.sin(e)*t,r])}([h,null!=d?d:It(n,l,i),It(o,c,i),It(s,u,i)]);return new Mt(p,f,m,g,!1)}case"lab":{const[r,n,o,s]=yt(Ct(e.lab,t.lab,i));return new Mt(r,n,o,s,!1)}}}}Mt.black=new Mt(0,0,0,1),Mt.white=new Mt(1,1,1,1),Mt.transparent=new Mt(0,0,0,0),Mt.red=new Mt(1,0,0,1);class At{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,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}}const Lt=["bottom","center","top"];class Ft{constructor(e,t,i,r,n,o){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=o}}class Dt{constructor(e){this.sections=e}static fromString(e){return new Dt([new Ft(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof Dt?e:Dt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}}class kt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof kt)return e;if("number"==typeof e)return new kt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new kt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new kt(Ct(e.values,t.values,i))}}class Ot{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ot)return e;if("number"==typeof e)return new Ot([e]);if(Array.isArray(e)){for(const t of e)if("number"!=typeof t)return;return new Ot(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new Ot(Ct(e.values,t.values,i))}}class Rt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Rt)return e;if("string"==typeof e){const t=Mt.parse(e);if(!t)return;return new Rt([t])}if(!Array.isArray(e))return;const t=[];for(const i of e){if("string"!=typeof i)return;const e=Mt.parse(i);if(!e)return;t.push(e)}return new Rt(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i,r="rgb"){const n=[];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 o=0;o<e.values.length;o++)n.push(Mt.interpolate(e.values[o],t.values[o],i,r));return new Rt(n)}}class zt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Nt=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Bt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Bt)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){const i=e[t],r=e[t+1];if("string"!=typeof i||!Nt.has(i))return;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new Bt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){const r=e.values,n=t.values;if(r.length!==n.length)throw new zt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const o=[];for(let e=0;e<r.length;e+=2){if(r[e]!==n[e])throw new zt(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${r[e]}, to[${e}]: ${n[e]}`);o.push(r[e]);const[t,s]=r[e+1],[a,l]=n[e+1];o.push([It(t,a,i),It(s,l,i)])}return new Bt(o)}}class Vt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Vt({name:e,available:!1}):null}}class jt{constructor(e,t,i){this.from=e,this.to=t,this.transition=i}static interpolate(e,t,i){return new jt(e,t,i)}static parse(e){return e instanceof jt?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new jt(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new jt(e.from,e.to,e.transition):"string"==typeof e?new jt(e,e,1):void 0}}function Ut(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Gt(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof jt||e instanceof Mt||e instanceof At||e instanceof Dt||e instanceof kt||e instanceof Ot||e instanceof Rt||e instanceof Bt||e instanceof Vt)return!0;if(Array.isArray(e)){for(const t of e)if(!Gt(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Gt(e[t]))return!1;return!0}return!1}function $t(e){if(null===e)return ze;if("string"==typeof e)return Be;if("boolean"==typeof e)return Ve;if("number"==typeof e)return Ne;if(e instanceof Mt)return je;if(e instanceof jt)return Ue;if(e instanceof At)return qe;if(e instanceof Dt)return Ze;if(e instanceof kt)return We;if(e instanceof Ot)return Xe;if(e instanceof Rt)return He;if(e instanceof Bt)return Je;if(e instanceof Vt)return Ye;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=$t(t);if(i){if(i===e)continue;i=$e;break}i=e}return Ke(i||$e,t)}return Ge}function qt(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Mt||e instanceof jt||e instanceof Dt||e instanceof kt||e instanceof Ot||e instanceof Rt||e instanceof Bt||e instanceof Vt?e.toString():JSON.stringify(e)}class Zt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Gt(e[1]))return t.error("invalid value");const i=e[1];let r=$t(i);const n=t.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new Zt(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Wt={string:Be,number:Ne,boolean:Ve,object:Ge};class Ht{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 i,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in Wt)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=Wt[i],r++}else n=$e;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],r++}i=Ke(n,o)}else{if(!Wt[n])throw new Error(`Types doesn't contain name = ${n}`);i=Wt[n]}const o=[];for(;r<e.length;r++){const i=t.parse(e[r],r,$e);if(!i)return null;o.push(i)}return new Ht(i,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(!tt(this.type,$t(i)))return i;if(t===this.args.length-1)throw new zt(`Expected value to be of type ${Qe(this.type)}, but found ${Qe($t(i))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Xt={"to-boolean":Ve,"to-color":je,"to-number":Ne,"to-string":Be};class Yt{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.");const i=e[0];if(!Xt[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");const r=Xt[i],n=[];for(let i=1;i<e.length;i++){const r=t.parse(e[i],i,$e);if(!r)return null;n.push(r)}return new Yt(r,n)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let t,i;for(const r of this.args){if(t=r.evaluate(e),i=null,t instanceof Mt)return t;if("string"==typeof t){const i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&(i=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Ut(t[0],t[1],t[2],t[3]),!i))return new Mt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new zt(i||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const r=kt.parse(t);if(r)return r}throw new zt(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const i of this.args){t=i.evaluate(e);const r=Ot.parse(t);if(r)return r}throw new zt(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const i of this.args){t=i.evaluate(e);const r=Rt.parse(t);if(r)return r}throw new zt(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const r=Bt.parse(t);if(r)return r}throw new zt(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new zt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Dt.fromString(qt(this.args[0].evaluate(e)));case"resolvedImage":return Vt.fromString(qt(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return qt(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Jt=["Unknown","Point","LineString","Polygon"];class Kt{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?"number"==typeof this.feature.type?Jt[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=Mt.parse(e),this._parseColorCache.set(e,t)),t}}class Qt{constructor(e,t,i=[],r,n=new Re,o=[]){this.registry=e,this.path=i,this.key=i.map((e=>`[${e}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=t}parse(e,t,i,r,n={}){return t?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}_parse(e,t){function i(e,t,i){return"assert"===i?new Ht(t,[e]):"coerce"===i?new Yt(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind){if("projectionDefinition"===e.kind&&["string","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===e.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(n.kind))r=i(r,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof Zt)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const t=new Kt;try{r=new Zt(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const r="number"==typeof e?this.path.concat(e):this.path,n=i?this.scope.concat(i):this.scope;return new Qt(this.registry,this._isConstant,r,t||null,n,this.errors)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new Oe(i,e))}checkSubtype(e,t){const i=tt(e,t);return i&&this.error(i),i}}class ei{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const 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.`);const i=[];for(let r=1;r<e.length-1;r+=2){const n=e[r];if("string"!=typeof n)return t.error(`Expected string, but found ${typeof n} instead.`,r);if(/[^a-zA-Z0-9_]/.test(n))return t.error("Variable names must contain only alphanumeric characters or '_'.",r);const o=t.parse(e[r+1],r+1);if(!o)return null;
vendor: 4,406 bytes, line 2
2i.push([n,o])}const r=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return r?new ei(i,r):null}outputDefined(){return this.result.outputDefined()}}class ti{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new ti(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class ii{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Ne),r=t.parse(e[2],2,Ke(t.expectedType||$e));return i&&r?new ii(r.type.itemType,i,r):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new zt(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new zt(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new zt(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ri{constructor(e,t){this.type=Ve,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,$e),r=t.parse(e[2],2,$e);return i&&r?it(i.type,[Ve,Be,Ne,ze,$e])?new ri(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qe(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!rt(t,["boolean","string","number","null"]))throw new zt(`Expected first argument to be of type boolean, string, number or null, but found ${Qe($t(t))} instead.`);if(!rt(i,["string","array"]))throw new zt(`Expected second argument to be of type array or string, but found ${Qe($t(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class ni{constructor(e,t,i){this.type=Ne,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,$e),r=t.parse(e[2],2,$e);if(!i||!r)return null;if(!it(i.type,[Ve,Be,Ne,ze,$e]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qe(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Ne);return n?new ni(i,r,n):null}return new ni(i,r)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!rt(t,["boolean","string","number","null"]))throw new zt(`Expected first argument to be of type boolean, string, number or null, but found ${Qe($t(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),rt(i,["string"])){const e=i.indexOf(t,r);return-1===e?-1:[...i.slice(0,e)].length}if(rt(i,["array"]))return i.indexOf(t,r);throw new zt(`Expected second argument to be of type array or string, but found ${Qe($t(i))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class oi{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}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 i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let s=2;s<e.length-1;s+=2){let a=e[s];const l=e[s+1];Array.isArray(a)||(a=[a]);const c=t.concat(s);if(0===a.length)return c.error("Expected at least one branch label.");for(const e of a){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,$t(e)))return null}else i=$t(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");
vendor: 23,595 bytes, line 2
2n[String(e)]=o.length}const u=t.parse(l,s,r);if(!u)return null;r=r||u.type,o.push(u)}const s=t.parse(e[1],1,$e);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,r);return a?"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new oi(i,r,s,n,o,a):null}evaluate(e){const t=this.input.evaluate(e);return($t(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()}}class si{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}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 i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const r=[];for(let n=1;n<e.length-1;n+=2){const o=t.parse(e[n],n,Ve);if(!o)return null;const s=t.parse(e[n+1],n+1,i);if(!s)return null;r.push([o,s]),i=i||s.type}const n=t.parse(e[e.length-1],e.length-1,i);if(!n)return null;if(!i)throw new Error("Can't infer output type");return new si(i,r,n)}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}}class ai{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,$e),r=t.parse(e[2],2,Ne);if(!i||!r)return null;if(!it(i.type,[Ke($e),Be,$e]))return t.error(`Expected first argument to be of type array or string, but found ${Qe(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Ne);return n?new ai(i.type,i,r,n):null}return new ai(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),rt(t,["string"]))return[...t].slice(i,r).join("");if(rt(t,["array"]))return t.slice(i,r);throw new zt(`Expected first argument to be of type array or string, but found ${Qe($t(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function li(e,t){const i=e.length-1;let r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=e[a],n=e[a+1],r<=t){if(a===i||t<n)return a;o=a+1}else{if(!(r>t))throw new zt("Input is not a number.");s=a-1}return 0}class ci{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,Ne);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i<e.length;i+=2){const o=1===i?-1/0:e[i],s=e[i+1],a=i,l=i+1;if("number"!=typeof o)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new ci(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[li(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}var ui,hi,di=function(){if(hi)return ui;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return hi=1,ui=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)<t)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=n/o}var s=0,a=1;for(i=e,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-e)<t));r++)e>n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},ui}(),pi=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(di);class fi{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=mi(t,e.base,i,r);else if("linear"===e.name)n=mi(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new pi(o[0],o[1],o[2],o[3]).solve(mi(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,Ne),!n)return null;const s=[];let a=null;"interpolate-hcl"!==i&&"interpolate-lab"!==i||t.expectedType==He?t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType):a=je;for(let e=0;e<o.length;e+=2){const i=o[e],r=o[e+1],n=e+3,l=e+4;if("number"!=typeof i)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(s.length&&s[s.length-1][0]>=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(r,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return nt(a,Ne)||nt(a,Ue)||nt(a,je)||nt(a,We)||nt(a,Xe)||nt(a,He)||nt(a,Je)||nt(a,Ke(Ne))?new fi(a,i,r,n,s):t.error(`Type ${Qe(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=li(t,r),s=fi.interpolationFactor(this.interpolation,r,t[o],t[o+1]),a=i[o].evaluate(e),l=i[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return It(a,l,s);case"color":return Mt.interpolate(a,l,s);case"padding":return kt.interpolate(a,l,s);case"colorArray":return Rt.interpolate(a,l,s);case"numberArray":return Ot.interpolate(a,l,s);case"variableAnchorOffsetCollection":return Bt.interpolate(a,l,s);case"array":return Ct(a,l,s);case"projectionDefinition":return jt.interpolate(a,l,s)}case"interpolate-hcl":switch(this.type.kind){case"color":return Mt.interpolate(a,l,s,"hcl");case"colorArray":return Rt.interpolate(a,l,s,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Mt.interpolate(a,l,s,"lab");case"colorArray":return Rt.interpolate(a,l,s,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function mi(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}const gi={color:Mt.interpolate,number:It,padding:kt.interpolate,numberArray:Ot.interpolate,colorArray:Rt.interpolate,variableAnchorOffsetCollection:Bt.interpolate,array:Ct};class yi{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 i=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of e.slice(1)){const e=t.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}if(!i)throw new Error("No output type");const o=r&&n.some((e=>tt(r,e.type)));return new yi(o?$e:i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(e),i&&i instanceof Vt&&!i.available&&(t||(t=i.name),i=null,r===this.args.length&&(i=t)),null!==i)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function _i(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function vi(e,t,i,r){return 0===r.compare(t,i)}function bi(e,t,i){const r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=Ve,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,$e);if(!o)return null;if(!_i(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${Qe(o.type)}'.`);let s=t.parse(e[2],2,$e);if(!s)return null;if(!_i(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${Qe(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${Qe(o.type)}' and '${Qe(s.type)}'.`);r&&("value"===o.type.kind&&"value"!==s.type.kind?o=new Ht(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new Ht(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,qe),!a)return null}return new n(o,s,a)}evaluate(n){const o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=$t(o),i=$t(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new zt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=$t(o),i=$t(s);if("string"!==e.kind||"string"!==i.kind)return t(n,o,s)}return this.collator?i(n,o,s,this.collator.evaluate(n)):t(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const xi=bi("==",(function(e,t,i){return t===i}),vi),wi=bi("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!vi(0,t,i,r)})),Ti=bi("<",(function(e,t,i){return t<i}),(function(e,t,i,r){return r.compare(t,i)<0})),Ei=bi(">",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),Si=bi("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),Pi=bi(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0}));class Ii{constructor(e,t,i){this.type=qe,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");const r=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,Ve);if(!r)return null;const n=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,Ve);if(!n)return null;let o=null;return i.locale&&(o=t.parse(i.locale,1,Be),!o)?null:new Ii(r,n,o)}evaluate(e){return new At(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}}class Ci{constructor(e,t,i,r,n,o){this.type=Be,this.number=e,this.locale=t,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Ne);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parse(r.locale,1,Be),!n))return null;let o=null;if(r.currency&&(o=t.parse(r.currency,1,Be),!o))return null;let s=null;if(r.unit&&(s=t.parse(r.unit,1,Be),!s))return null;if(o&&s)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let a=null;if(r["min-fraction-digits"]&&(a=t.parse(r["min-fraction-digits"],1,Ne),!a))return null;let l=null;return r["max-fraction-digits"]&&(l=t.parse(r["max-fraction-digits"],1,Ne),!l)?null:new Ci(i,n,o,s,a,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.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.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Mi{constructor(e){this.type=Ze,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,Ne),!e))return null;let i=null;if(o["text-font"]&&(i=t.parse(o["text-font"],1,Ke(Be)),!i))return null;let s=null;if(o["text-color"]&&(s=t.parse(o["text-color"],1,je),!s))return null;let a=null;if(o["vertical-align"]){if("string"==typeof o["vertical-align"]&&!Lt.includes(o["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(a=t.parse(o["vertical-align"],1,Be),!a)return null}const l=r[r.length-1];l.scale=e,l.font=i,l.textColor=s,l.verticalAlign=a}else{const o=t.parse(e[i],1,$e);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Mi(r)}evaluate(e){return new Dt(this.sections.map((t=>{const i=t.content.evaluate(e);return $t(i)===Ye?new Ft("",i,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new Ft(qt(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const 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}}class Ai{constructor(e){this.type=Ye,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Be);return i?new Ai(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=Vt.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class Li{constructor(e){this.type=Ne,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${Qe(i.type)} instead.`):new Li(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new zt(`Expected value to be of type string or array, but found ${Qe($t(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Fi=8192;function Di(e,t){const i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*Fi),Math.round(r*n*Fi)]}function ki(e,t){const i=Math.pow(2,t.z);return[(n=(e[0]/Fi+t.x)/i,360*n-180),(r=(e[1]/Fi+t.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function Oi(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Ri(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function zi(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],s=e[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function Ni(e,t,i,r){return 0!=(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!$i(e,t,i,r)||!$i(i,r,e,t));var n,o}function Bi(e,t,i){for(const r of i)for(let i=0;i<r.length-1;++i)if(Ni(e,t,r[i],r[i+1]))return!0;return!1}function Vi(e,t,i=!1){let r=!1;for(const a of t)for(let t=0;t<a.length-1;t++){if(zi(e,a[t],a[t+1]))return i;(o=a[t])[1]>(n=e)[1]!=(s=a[t+1])[1]>n[1]&&n[0]<(s[0]-o[0])*(n[1]-o[1])/(s[1]-o[1])+o[0]&&(r=!r)}var n,o,s;return r}function ji(e,t){for(const i of t)if(Vi(e,i))return!0;return!1}function Ui(e,t){for(const i of e)if(!Vi(i,t))return!1;for(let i=0;i<e.length-1;++i)if(Bi(e[i],e[i+1],t))return!1;return!0}function Gi(e,t){for(const i of t)if(Ui(e,i))return!0;return!1}function $i(e,t,i,r){const n=r[0]-i[0],o=r[1]-i[1],s=(e[0]-i[0])*o-n*(e[1]-i[1]),a=(t[0]-i[0])*o-n*(t[1]-i[1]);return s>0&&a<0||s<0&&a>0}function qi(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=[];for(let r=0;r<e[n].length;r++){const s=Di(e[n][r],i);Oi(t,s),o.push(s)}r.push(o)}return r}function Zi(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=qi(e[n],t,i);r.push(o)}return r}function Wi(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}Oi(t,e)}function Hi(e,t,i,r){const n=Math.pow(2,r.z)*Fi,o=[r.x*Fi,r.y*Fi],s=[];for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];Wi(r,t,i,n),s.push(r)}return s}function Xi(e,t,i,r){const n=Math.pow(2,r.z)*Fi,o=[r.x*Fi,r.y*Fi],s=[];for(const i of e){const e=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];Oi(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=n/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of s)for(const r of e)Wi(r,t,i,n)}var a;return s}class Yi{constructor(e,t){this.type=Ve,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Gt(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const i of t.features){const{type:t,coordinates:r}=i.geometry;"Polygon"===t&&e.push(r),"MultiPolygon"===t&&e.push(...r)}if(e.length)return new Yi(t,{type:"MultiPolygon",coordinates:e})}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Yi(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Yi(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=qi(t.coordinates,r,n),s=Hi(e.geometry(),i,r,n);if(!Ri(i,r))return!1;for(const e of s)if(!Vi(e,o))return!1}if("MultiPolygon"===t.type){const o=Zi(t.coordinates,r,n),s=Hi(e.geometry(),i,r,n);if(!Ri(i,r))return!1;for(const e of s)if(!ji(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=qi(t.coordinates,r,n),s=Xi(e.geometry(),i,r,n);if(!Ri(i,r))return!1;for(const e of s)if(!Ui(e,o))return!1}if("MultiPolygon"===t.type){const o=Zi(t.coordinates,r,n),s=Xi(e.geometry(),i,r,n);if(!Ri(i,r))return!1;for(const e of s)if(!Gi(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Ji=class{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const 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){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let r=1+(e<<1);const o=r+1;if(o<this.length&&i(t[o],t[r])<0&&(r=o),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}};function Ki(e,t,i=0,r=e.length-1,n=er){for(;r>i;){if(r-i>600){const o=r-i+1,s=t-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);Ki(e,t,Math.max(i,Math.floor(t-s*l/o+c)),Math.min(r,Math.floor(t+(o-s)*l/o+c)),n)}const o=e[t];let s=i,a=r;for(Qi(e,i,t),n(e[r],o)>0&&Qi(e,i,r);s<a;){for(Qi(e,s,a),s++,a--;n(e[s],o)<0;)s++;for(;n(e[a],o)>0;)a--}0===n(e[i],o)?Qi(e,i,a):(a++,Qi(e,a,r)),a<=t&&(i=a+1),t<=a&&(r=a-1)}}function Qi(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function er(e,t){return e<t?-1:e>t?1:0}function tr(e,t){if(e.length<=1)return[e];const i=[];let r,n;for(const t of e){const e=rr(t);0!==e&&(t.area=Math.abs(e),void 0===n&&(n=e<0),n===e<0?(r&&i.push(r),r=[t]):r.push(t))}if(r&&i.push(r),t>1)for(let e=0;e<i.length;e++)i[e].length<=t||(Ki(i[e],t,1,i[e].length-1,ir),i[e]=i[e].slice(0,t));return i}function ir(e,t){return t.area-e.area}function rr(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n<o;s=n++)i=e[n],r=e[s],t+=(r.x-i.x)*(i.y+r.y);return t}const nr=1/298.257223563,or=nr*(2-nr),sr=Math.PI/180;class ar{constructor(e){const t=6378.137*sr*1e3,i=Math.cos(e*sr),r=1/(1-or*(1-i*i)),n=Math.sqrt(r);this.kx=t*n*i,this.ky=t*n*r*(1-or)}distance(e,t){const i=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(e,t){let i,r,n,o,s=1/0;for(let a=0;a<e.length-1;a++){let l=e[a][0],c=e[a][1],u=this.wrap(e[a+1][0]-l)*this.kx,h=(e[a+1][1]-c)*this.ky,d=0;0===u&&0===h||(d=(this.wrap(t[0]-l)*this.kx*u+(t[1]-c)*this.ky*h)/(u*u+h*h),d>1?(l=e[a+1][0],c=e[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;p<s&&(s=p,i=l,r=c,n=a,o=d)}return{point:[i,r],index:n,t:Math.max(0,Math.min(1,o))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function lr(e,t){return t[0]-e[0]}function cr(e){return e[1]-e[0]+1}function ur(e,t){return e[1]>=e[0]&&e[1]<t}function hr(e,t){if(e[0]>
vendor: 6,341 bytes, line 2
2e[1])return[null,null];const i=cr(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===i)return[e,null];const r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function dr(e,t){if(!ur(t,e.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)Oi(i,e[r]);return i}function pr(e){const t=[1/0,1/0,-1/0,-1/0];for(const i of e)for(const e of i)Oi(t,e);return t}function fr(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function mr(e,t,i){if(!fr(e)||!fr(t))return NaN;let r=0,n=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),i.distance([0,0],[r,n])}function gr(e,t,i){const r=i.pointOnLine(t,e);return i.distance(e,r.point)}function yr(e,t,i,r,n){const o=Math.min(gr(e,[i,r],n),gr(t,[i,r],n)),s=Math.min(gr(i,[e,t],n),gr(r,[e,t],n));return Math.min(o,s)}function _r(e,t,i,r,n){if(!ur(t,e.length)||!ur(r,i.length))return 1/0;let o=1/0;for(let s=t[0];s<t[1];++s){const t=e[s],a=e[s+1];for(let e=r[0];e<r[1];++e){const r=i[e],s=i[e+1];if(Ni(t,a,r,s))return 0;o=Math.min(o,yr(t,a,r,s,n))}}return o}function vr(e,t,i,r,n){if(!ur(t,e.length)||!ur(r,i.length))return NaN;let o=1/0;for(let s=t[0];s<=t[1];++s)for(let t=r[0];t<=r[1];++t)if(o=Math.min(o,n.distance(e[s],i[t])),0===o)return o;return o}function br(e,t,i){if(Vi(e,t,!0))return 0;let r=1/0;for(const n of t){const t=n[0],o=n[n.length-1];if(t!==o&&(r=Math.min(r,gr(e,[o,t],i)),0===r))return r;const s=i.pointOnLine(n,e);if(r=Math.min(r,i.distance(e,s.point)),0===r)return r}return r}function xr(e,t,i,r){if(!ur(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(Vi(e[r],i,!0))return 0;let n=1/0;for(let o=t[0];o<t[1];++o){const t=e[o],s=e[o+1];for(const e of i)for(let i=0,o=e.length,a=o-1;i<o;a=i++){const o=e[a],l=e[i];if(Ni(t,s,o,l))return 0;n=Math.min(n,yr(t,s,o,l,r))}}return n}function wr(e,t){for(const i of e)for(const e of i)if(Vi(e,t,!0))return!0;return!1}function Tr(e,t,i,r=1/0){const n=pr(e),o=pr(t);if(r!==1/0&&mr(n,o,i)>=r)return r;if(Ri(n,o)){if(wr(e,t))return 0}else if(wr(t,e))return 0;let s=1/0;for(const r of e)for(let e=0,n=r.length,o=n-1;e<n;o=e++){const n=r[o],a=r[e];for(const e of t)for(let t=0,r=e.length,o=r-1;t<r;o=t++){const r=e[o],l=e[t];if(Ni(n,a,r,l))return 0;s=Math.min(s,yr(n,a,r,l,i))}}return s}function Er(e,t,i,r,n,o){if(!o)return;const s=mr(dr(r,o),n,i);s<t&&e.push([s,o,[0,0]])}function Sr(e,t,i,r,n,o,s){if(!o||!s)return;const a=mr(dr(r,o),dr(n,s),i);a<t&&e.push([a,o,s])}function Pr(e,t,i,r,n=1/0){let o=Math.min(r.distance(e[0],i[0][0]),n);if(0===o)return o;const s=new Ji([[0,[0,e.length-1],[0,0]]],lr),a=pr(i);for(;s.length>0;){const n=s.pop();if(n[0]>=o)continue;const l=n[1],c=t?50:100;if(cr(l)<=c){if(!ur(l,e.length))return NaN;if(t){const t=xr(e,l,i,r);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const n=br(e[t],i,r);if(o=Math.min(o,n),0===o)return 0}}else{const i=hr(l,t);Er(s,o,r,e,a,i[0]),Er(s,o,r,e,a,i[1])}}return o}function Ir(e,t,i,r,n,o=1/0){let s=Math.min(o,n.distance(e[0],i[0]));if(0===s)return s;const a=new Ji([[0,[0,e.length-1],[0,i.length-1]]],lr);for(;a.length>0;){const o=a.pop();if(o[0]>=s)continue;const l=o[1],c=o[2],u=t?50:100,h=r?50:100;if(cr(l)<=u&&cr(c)<=h){if(!ur(l,e.length)&&ur(c,i.length))return NaN;let o;if(t&&r)o=_r(e,l,i,c,n),s=Math.min(s,o);else if(t&&!r){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=gr(i[e],t,n),s=Math.min(s,o),0===s)return s}else if(!t&&r){const t=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(o=gr(e[i],t,n),s=Math.min(s,o),0===s)return s}else o=vr(e,l,i,c,n),s=Math.min(s,o)}else{const o=hr(l,t),u=hr(c,r);Sr(a,s,n,e,i,o[0],u[0]),Sr(a,s,n,e,i,o[0],u[1]),Sr(a,s,n,e,i,o[1],u[0]),Sr(a,s,n,e,i,o[1],u[1])}}return s}function Cr(e){return"MultiPolygon"===e.type?e.coordinates.map((e=>({type:"Polygon",coordinates:e}))):"MultiLineString"===e.type?e.coordinates.map((e=>({type:"LineString",coordinates:e}))):"MultiPoint"===e.type?e.coordinates.map((e=>({type:"Point",coordinates:e}))):[e]}class Mr{constructor(e,t){this.type=Ne,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Gt(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new Mr(t,t.features.map((e=>Cr(e.geometry))).flat());if("Feature"===t.type)return new Mr(t,Cr(t.geometry));if("type"in t&&"coordinates"in t)return new Mr(t,Cr(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>ki([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new ar(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,Ir(r,!1,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Ir(r,!1,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Pr(r,!1,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>ki([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new ar(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,Ir(r,!0,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Ir(r,!0,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Pr(r,!0,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){const i=e.geometry();if(0===i.length||0===i[0].length)return NaN;const r=tr(i,0).map((t=>t.map((t=>t.map((t=>ki([t.x,t.y],e.canonical))))))),n=new ar(r[0][0][0][1]);let o=1/0;for(const e of t)for(const t of r){switch(e.type){case"Point":o=Math.min(o,Pr([e.coordinates],!1,t,n,o));break;case"LineString":o=Math.min(o,Pr(e.coordinates,!0,t,n,o));break;case"Polygon":o=Math.min(o,Tr(t,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Ar{constructor(e){this.type=$e,this.key=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=e[1];return null==i?t.error("Global state property must be defined."):"str
2ing"!=typeof i?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new Ar(i)}evaluate(e){var t;const i=null===(t=e.globals)||void 0===t?void 0:t.globalState;return i&&0!==Object.keys(i).length?xt(i,this.key):null}eachChild(){}outputDefined(){return!1}}const Lr={"==":xi,"!=":wi,">":Ei,"<":Ti,">=":Pi,"<=":Si,array:Ht,at:ii,boolean:Ht,case:si,coalesce:yi,collator:Ii,format:Mi,image:Ai,in:ri,"index-of":ni,interpolate:fi,"interpolate-hcl":fi,"interpolate-lab":fi,length:Li,let:ei,literal:Zt,match:oi,number:Ht,"number-format":Ci,object:Ht,slice:ai,step:ci,string:Ht,"to-boolean":Yt,"to-color":Yt,"to-number":Yt,"to-string":Yt,var:ti,within:Yi,distance:Mr,"global-state":Ar};class Fr{constructor(e,t,i,r){this.name=e,this.type=t,this._evaluate=i,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],r=Fr.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let a=null;for(const[r,o]of s){a=new Qt(t.registry,zr,t.path,null,t.scope);const s=[];let l=!1;for(let t=1;t<e.length;t++){const i=e[t],n=Array.isArray(r)?r[t-1]:r.type,o=a.parse(i,1+s.length,n);if(!o){l=!0;break}s.push(o)}if(!l)if(Array.isArray(r)&&r.length!==s.length)a.error(`Expected ${r.length} arguments, but found ${s.length} instead.`);else{for(let e=0;e<s.length;e++){const t=Array.isArray(r)?r[e]:r.type,i=s[e];a.concat(e+1).checkSubtype(t,i.type)}if(0===a.errors.length)return new Fr(i,n,o,s)}}if(1===s.length)t.errors.push(...a.errors);else{const i=(s.length?s:o).map((([e])=>{return t=e,Array.isArray(t)?`(${t.map(Qe).join(", ")})`:`(${Qe(t.type)}...)`;var t})).join(" | "),r=[];for(let i=1;i<e.length;i++){const n=t.parse(e[i],1+r.length);if(!n)return null;r.push(Qe(n.type))}t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(e,t){Fr.definitions=t;for(const i in t)e[i]=Fr}}function Dr(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,s=Ut(t,i,r,o);if(s)throw new zt(s);return new Mt(t/255,i/255,r/255,o,!1)}function kr(e,t){return e in t}function Or(e,t){const i=t[e];return void 0===i?null:i}function Rr(e){return{type:e}}function zr(e){if(e instanceof ti)return zr(e.boundExpression);if(e instanceof Fr&&"error"===e.name)return!1;if(e instanceof Ii)return!1;if(e instanceof Yi)return!1;if(e instanceof Mr)return!1;if(e instanceof Ar)return!1;const t=e instanceof Yt||e instanceof Ht;let i=!0;return e.eachChild((e=>{i=t?i&&zr(e):i&&e instanceof Zt})),!!i&&Nr(e)&&Vr(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Nr(e){if(e instanceof Fr){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Yi)return!1;if(e instanceof Mr)return!1;let t=!0;return e.eachChild((e=>{t&&!Nr(e)&&(t=!1)})),t}function Br(e){if(e instanceof Fr&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!Br(e)&&(t=!1)})),t}function Vr(e,t){if(e instanceof Fr&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!Vr(e,t)&&(i=!1)})),i}function jr(e){return{result:"success",value:e}}function Ur(e){return{result:"error",value:e}}function Gr(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function $r(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function qr(e){return!!e.expression&&e.expression.interpolated}function Zr(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Wr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&$t(e)===Ge}function Hr(e){return e}function Xr(e,t){const i=e.stops&&"object"==typeof e.stops[0][0],r=i||!(i||void 0!==e.property),n=e.type||(qr(t)?"exponential":"interval"),o=function(e){switch(e.type){case"color":return Mt.parse;case"padding":return kt.parse;case"numberArray":return Ot.parse;case"colorArray":return Rt.parse;default:return null}}(t);
vendor: 5,835 bytes, line 2
2if(o&&((e=ke({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],o(e[1])]))),e.default=o(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==(s=e.colorSpace)&&"hcl"!==s&&"lab"!==s)throw new Error(`Unknown color space: "${e.colorSpace}"`);var s;const a=function(e){switch(e){case"exponential":return Qr;case"interval":return Kr;case"categorical":return Jr;case"identity":return en;default:throw new Error(`Unknown function type "${e}"`)}}(n);let l,c;if("categorical"===n){l=Object.create(null);for(const t of e.stops)l[t[0]]=t[1];c=typeof e.stops[0][0]}if(i){const i={},r=[];for(let t=0;t<e.stops.length;t++){const n=e.stops[t],o=n[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},r.push(o)),i[o].stops.push([n[0].value,n[1]])}const n=[];for(const e of r)n.push([i[e].zoom,Xr(i[e],t)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:fi.interpolationFactor.bind(void 0,o),zoomStops:n.map((e=>e[0])),evaluate:({zoom:i},r)=>Qr({stops:n,base:e.base},t,i).evaluate(i,r)}}if(r){const i="exponential"===n?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:fi.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:i})=>a(e,t,i,l,c)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[e.property]:void 0;return void 0===n?Yr(e.default,t.default):a(e,t,n,l,c)}}}function Yr(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function Jr(e,t,i,r,n){return Yr(typeof i===n?r[i]:void 0,e.default,t.default)}function Kr(e,t,i){if("number"!==Zr(i))return Yr(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const n=li(e.stops.map((e=>e[0])),i);return e.stops[n][1]}function Qr(e,t,i){const r=void 0!==e.base?e.base:1;if("number"!==Zr(i))return Yr(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const o=li(e.stops.map((e=>e[0])),i),s=function(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[o][0],e.stops[o+1][0]),a=e.stops[o][1],l=e.stops[o+1][1],c=gi[t.type]||Hr;return"function"==typeof a.evaluate?{evaluate(...t){const i=a.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==i&&void 0!==r)return c(i,r,s,e.colorSpace)}}:c(a,l,s,e.colorSpace)}function en(e,t,i){switch(t.type){case"color":i=Mt.parse(i);break;case"formatted":i=Dt.fromString(i.toString());break;case"resolvedImage":i=Vt.fromString(i.toString());break;case"padding":i=kt.parse(i);break;case"colorArray":i=Rt.parse(i);break;case"numberArray":i=Ot.parse(i);break;default:Zr(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0)}return Yr(i,e.default,t.default)}Fr.register(Lr,{error:[{kind:"error"},[Be],(e,[t])=>{throw new zt(t.evaluate(e))}],typeof:[Be,[$e],(e,[t])=>Qe($t(t.evaluate(e)))],"to-rgba":[Ke(Ne,4),[je],(e,[t])=>{const[i,r,n,o]=t.evaluate(e).rgb;return[255*i,255*r,255*n,o]}],rgb:[je,[Ne,Ne,Ne],Dr],rgba:[je,[Ne,Ne,Ne,Ne],Dr],has:{type:Ve,overloads:[[[Be],(e,[t])=>kr(t.evaluate(e),e.properties())],[[Be,Ge],(e,[t,i])=>kr(t.evaluate(e),i.evaluate(e))]]},get:{type:$e,overloads:[[[Be],(e,[t])=>Or(t.evaluate(e),e.properties())],[[Be,Ge],(e,[t,i])=>Or(t.evaluate(e),i.evaluate(e))]]},"feature-state":[$e,[Be],(e,[t])=>Or(t.evaluate(e),e.featureState||{})],properties:[Ge,[],e=>e.properties()],"geometry-type":[Be,[],e=>e.geometryType()],id:[$e,[],e=>e.id()],zoom:[Ne,[],e=>e.globals.zoom],"heatmap-density":[Ne,[],e=>e.globals.heatmapDensity||0],elevation:[Ne,[],e=>e.globals.elevation||0],"line-progress":[Ne,[],e=>e.globals.lineProgress||0],accumulated:[$e,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Ne,Rr(Ne),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[Ne,Rr(Ne),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:Ne,overloads:[[[Ne,Ne],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[Ne],(e,[t])=>-t.evaluate(e)]]},"/":[Ne,[Ne,Ne],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[Ne,[Ne,Ne],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[Ne,[],()=>Math.LN2],pi:[Ne,[],()=>Math.PI],e:[Ne,[],()=>Math.E],"^":[Ne,[Ne,Ne],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[Ne,[Ne],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Ne,[Ne],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Ne,[Ne],(e,[t])=>Math.log(t.evaluate(e))],log2:[Ne,[Ne],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Ne,[Ne],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Ne,[Ne],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Ne,[Ne],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Ne,[Ne],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Ne,[Ne],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Ne,[Ne],(e,[t])=>Math.atan(t.evaluate(e))],min:[Ne,Rr(Ne),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[Ne,Rr(Ne),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[Ne,[Ne],(e,[t])=>Math.abs(t.evaluate(e))],round:[Ne,[Ne],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[Ne,[Ne],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Ne,[Ne],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[Ve,[Be,$e],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[Ve,[$e],(e,[t])=>e.id()===t.value],"filter-type-==":[Ve,[Be],(e,[t])=>e.geometryType()===t.value],"filter-<":[Ve,[Be,$e],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[Ve,[$e],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[Ve,[Be,$e],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[Ve,[$e],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}
2],"filter-<=":[Ve,[Be,$e],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[Ve,[$e],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[Ve,[Be,$e],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[Ve,[$e],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[Ve,[$e],(e,[t])=>t.value in e.properties()],"filter-has-id":[Ve,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[Ve,[Ke(Be)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[Ve,[Ke($e)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[Ve,[Be,Ke($e)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[Ve,[Be,Ke($e)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:Ve,overloads:[[[Ve,Ve],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Rr(Ve),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:Ve,overloads:[[[Ve,Ve],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Rr(Ve),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[Ve,[Ve],(e,[t])=>!t.evaluate(e)],"is-supported-script":[Ve,[Be],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[Be,[Be],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Be,[Be],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Be,Rr($e),(e,t)=>t.map((t=>qt(t.evaluate(e)))).join("")],split:[Ke(Be),[Be,Be],(e,[t,i])=>t.evaluate(e).split(i.evaluate(e))],join:[Be,[Ke(Be),Be],(e,[t,i])=>t.evaluate(e).join(i.evaluate(e))],"resolved-locale":[Be,[qe],(e,[t])=>t.evaluate(e).resolvedLocale()]});class tn{constructor(e,t,i){this.expression=e,this._warningHistory={},this._evaluator=new Kt,this._defaultValue=t?function(e){if("color"===e.type&&Wr(e.default))return new Mt(0,0,0,0);switch(e.type){case"color":return Mt.parse(e.default)||null;case"padding":return kt.parse(e.default)||null;case"numberArray":return Ot.parse(e.default)||null;case"colorArray":return Rt.parse(e.default)||null;case"variableAnchorOffsetCollection":return Bt.parse(e.default)||null;case"projectionDefinition":return jt.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this._globalState=i}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._globalState&&(e=hn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,o){this._globalState&&(e=hn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new zt(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function rn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Lr}function nn(e,t,i){const r=new Qt(Lr,zr,[],t?function(e){const t={color:je,string:Be,number:Ne,enum:Be,boolean:Ve,formatted:Ze,padding:We,numberArray:Xe,colorArray:He,projectionDefinition:Ue,resolvedImage:Ye,variableAnchorOffsetCollection:Je};return"array"===e.type?Ke(t[e.value]||$e,e.length):t[e.type]}(t):void 0),n=r.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return n?jr(new tn(n,t,i)):Ur(r.errors)}class on{constructor(e,t,i){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Br(t.expression),this.globalStateRefs=un(t.expression),this._globalState=i}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._globalState&&(e=hn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._globalState&&(e=hn(e,this._globalState)),this._styleExpression.evaluate(e,t,i,r,n,o)}}class sn{constructor(e,t,i,r,n){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Br(t.expression),this.globalStateRefs=un(t.expression),this.interpolationType=r,this._globalState=n}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._globalState&&(e=hn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._globalState&&(e=hn(e,this._globalState)),this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?fi.interpolationFactor(this.interpolationType,e,t,i):0}}function an(e,t,i){const r=nn(e,t,i);if("error"===r.result)return r;const n=r.value.expression,o=Nr(n);if(!o&&!Gr(t))return Ur([new Oe("","data expressions not supported")]);const s=Vr(n,["zoom"]);if(!s&&!$r(t))return Ur([new Oe("","zoom expressions not supported")]);const a=cn(n);return a||s?a instanceof Oe?Ur([a]):a instanceof fi&&!qr(t)?Ur([new Oe("",'"interpolate" expressions cannot be used with this property')]):jr(a?new sn(o?"camera":"composite",r.value,a.labels,a 
vendor: 6,184 bytes, line 2
2instanceof fi?a.interpolation:void 0,i):new on(o?"constant":"source",r.value,i)):Ur([new Oe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ln{constructor(e,t){this._parameters=e,this._specification=t,ke(this,Xr(this._parameters,this._specification))}static deserialize(e){return new ln(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function cn(e){let t=null;if(e instanceof ei)t=cn(e.result);else if(e instanceof yi){for(const i of e.args)if(t=cn(i),t)break}else(e instanceof ci||e instanceof fi)&&e.input instanceof Fr&&"zoom"===e.input.name&&(t=e);return t instanceof Oe||e.eachChild((e=>{const i=cn(e);i instanceof Oe?t=i:!t&&i?t=new Oe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new Oe("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function un(e,t=new Set){return e instanceof Ar&&t.add(e.key),e.eachChild((e=>{un(e,t)})),t}function hn(e,t){const{zoom:i,heatmapDensity:r,elevation:n,lineProgress:o,isSupportedScript:s,accumulated:a}=null!=e?e:{};return{zoom:i,heatmapDensity:r,elevation:n,lineProgress:o,isSupportedScript:s,accumulated:a,globalState:t}}function dn(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!dn(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const pn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function fn(e,t){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};dn(e)||(e=yn(e));const i=nn(e,pn,t);if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return{filter:(e,t,r)=>i.value.evaluate(e,t,{},r),needGeometry:gn(e),getGlobalStateRefs:()=>un(i.value.expression)}}function mn(e,t){return e<t?-1:e>t?1:0}function gn(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(gn(e[t]))return!0;return!1}function yn(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?_n(e[1],e[2],"=="):"!="===t?xn(_n(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?_n(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(yn))):"all"===t?["all"].concat(e.slice(1).map(yn)):"none"===t?["all"].concat(e.slice(1).map(yn).map(xn)):"in"===t?vn(e[1],e.slice(2)):"!in"===t?xn(vn(e[1],e.slice(2))):"has"===t?bn(e[1]):"!has"!==t||xn(bn(e[1]));var i}function _n(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function vn(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(mn)]]:["filter-in-small",e,["literal",t]]}}function bn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function xn(e){return["!",e]}function wn(e){const t=typeof e;if("number"===t||"boolean"===t||"string"===t||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const i of e)t+=`${wn(i)},`;return`${t}]`}const i=Object.keys(e).sort();let r="{";for(let t=0;t<i.length;t++)r+=`${JSON.stringify(i[t])}:${wn(e[i[t]])},`;return`${r}}`}function Tn(e){let t="";for(const i of we)t+=`/${wn(e[i])}`;return t}function En(e){const t=e.value;return t?[new De(e.key,t,"constants have been deprecated as of v8")]:[]}function Sn(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Pn(e){if(Array.isArray(e))return e.map(Pn);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=Pn(e[i]);return t}return Sn(e)}function In(e){const t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},o=e.style,s=e.styleSpec,a=e.validateSpec;let l=[];const c=Zr(i);if("object"!==c)return[new De(t,i,`object expected, ${c} found`)];for(const e in i){const c=e.split(".")[0],u=xt(r,c)||r["*"];let h;if(xt(n,c))h=n[c];else if(xt(r,c)){if(void 0===i[e])continue;h=a}else if(n["*"])h=n["*"];else{if(!r["*"]){l.push(new De(t,i[e],`unknown property "${e}"`));continue}h=a}l=l.concat(h({key:(t?`${t}.`:t)+e,value:i[e],valueSpec:u,style:o,styleSpec:s,object:i,objectKey:e,validateSpec:a},i))}for(const e in r)n[e]||r[e].required&&void 0===r[e].default&&void 0===i[e]&&l.push(new De(t,i,`missing required property "${e}"`));return l}function Cn(e){const t=e.value,i=e.valueSpec,r=e.style,n=e.styleSpec,o=e.key,s=e.arrayElementValidator||e.validateSpec;if("array"!==Zr(t))return[new De(o,t,`array expected, ${Zr(t)} found`)];if(i.length&&t.length!==i.length)return[new De(o,t,`array length ${i.length} expected, length ${t.length} found`)];let a={type:i.value,values:i.values};n.$version<7&&(a.function=i.function),"object"===Zr(i.value)&&(a=i.value);let l=[];for(let i=0;i<t.length;i++)l=l.concat(s({array:t,arrayIndex:i,value:t[i],valueSpec:a,validateSpec:e.validateSpec,style:r,styleSpec:n,key:`${o}[${i}]`}));return l}function Mn(e){const t=e.key,i=e.value,r=e.valueSpec;let n=Zr(i);return"number"===n&&i!=i&&(n="NaN"),"number"!==n?[new De(t,i,`number expected, ${n} found`)]:"minimum"in r&&i<r.minimum?[new De(t,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new De(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function An(e){const t=e.valueSpec,i=Sn(e.value.type);let r,n,o,s={};const a="categorical"!==i&&void 0===e.value.property,l=!a,c="array"===Zr(e.value.stops)&&"array"===Zr(e.value.stops[0])&&"object"===Zr(e.value.stops[0][0]),u=
vendor: 7,508 bytes, line 2
2In({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new De(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(Cn({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===Zr(r)&&0===r.length&&t.push(new De(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&a&&u.push(new De(e.key,e.value,'missing required property "property"')),"identity"===i||e.value.stops||u.push(new De(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!qr(e.valueSpec)&&u.push(new De(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Gr(e.valueSpec)?u.push(new De(e.key,e.value,"property functions not supported")):a&&!$r(e.valueSpec)&&u.push(new De(e.key,e.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==e.value.property||u.push(new De(e.key,e.value,'"property" property is required')),u;function h(e){let i=[];const r=e.value,a=e.key;if("array"!==Zr(r))return[new De(a,r,`array expected, ${Zr(r)} found`)];if(2!==r.length)return[new De(a,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==Zr(r[0]))return[new De(a,r,`object expected, ${Zr(r[0])} found`)];if(void 0===r[0].zoom)return[new De(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new De(a,r,"object stop key must have value")];if(o&&o>Sn(r[0].zoom))return[new De(a,r[0].zoom,"stop zoom values must appear in ascending order")];Sn(r[0].zoom)!==o&&(o=Sn(r[0].zoom),n=void 0,s={}),i=i.concat(In({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Mn,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return rn(Pn(r[1]))?i.concat([new De(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(e.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const a=Zr(e.value),l=Sn(e.value),c=null!==e.value?e.value:o;if(r){if(a!==r)return[new De(e.key,c,`${a} stop domain type must match previous stop domain type ${r}`)]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new De(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let r=`number expected, ${a} found`;return Gr(t)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new De(e.key,c,r)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==n&&l<n?[new De(e.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===i&&l in s?[new De(e.key,c,"stop domain values must be unique")]:(s[l]=!0,[])):[new De(e.key,c,`integer expected, found ${l}`)]}}function Ln(e){const t=("property"===e.expressionContext?an:nn)(Pn(e.value),e.valueSpec);if("error"===t.result)return t.value.map((t=>new De(`${e.key}${t.key}`,e.value,t.message)));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new De(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!Br(i))return[new De(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!Br(i))return[new De(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Vr(i,["zoom","feature-state"]))return[new De(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Nr(i))return[new De(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Fn(e){const t=e.key,i=e.value,r=Zr(i);return"string"!==r?[new De(t,i,`color expected, ${r} found`)]:Mt.parse(String(i))?[]:[new De(t,i,`color expected, "${i}" found`)]}function Dn(e){const t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(Sn(i))&&n.push(new De(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(Sn(i))&&n.push(new De(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function kn(e){return dn(Pn(e.value))?Ln(ke({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):On(e)}function On(e){const t=e.value,i=e.key;if("array"!==Zr(t))return[new De(i,t,`array expected, ${Zr(t)} found`)];const r=e.styleSpec;let n,o=[];if(t.length<1)return[new De(i,t,"filter array must have at least 1 element")];switch(o=o.concat(Dn({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),Sn(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Sn(t[1])&&o.push(new De(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new De(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=Zr(t[1]),"string"!==n&&o.push(new De(`${i}[1]`,t[1],`string expected, ${n} found`)));for(let s=2;s<t.length;s++)n=Zr(t[s]),"$type"===Sn(t[1])?o=o.concat(Dn({key:`${i}[${s}]`,value:t[s],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new De(`${i}[${s}]`,t[s],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let r=1;r<t.length;r++)o=o.concat(On({key:`${i}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=Zr(t[1]),2!==t.length?o.push(new De(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):"string"!==n&&o.push(new De(`${i}[1]`,t[1],`string expected, ${n} found`))}return o}function Rn(e,t){const i=e.key,r=e.validateSpec,n=e.style,o=e.styleSpec,s=e.value,a=e.objectKey,l=o[`${t}_${e.layerType}`];if(!l)return[];const c=a.match(/^(.*)-transition$/);if("paint"===t&&c&&l[c[1]]&&l[c[1]].transition)return r({key:i,value:s,valueSpec:o.transition,style:n,styleSpec:o});const u=e.valueSpec||l[a];if(!u)return[new De(i,s,`unknown property "${a}"`)];let h;if("string"===Zr(s)&&Gr(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(s)))return[new De(i,s,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const d=[];return"symbol"===e.layerType&&"text-font"===a&&Wr(Pn(s))&&"identity"===Sn(s.type)&&d.push(new De(i,s,'"text-font" does not support identity functions')),d.concat(r({key:e.key,value:s,valueSpec:u,style:n,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:a}))}function zn(e){return Rn(e,"paint")}function Nn(e){return Rn(e,"layout")}function Bn(e){var t,i;let r=[];
2const n=e.value,o=e.key,s=e.style,a=e.styleSpec;if("object"!==Zr(n))return[new De(o,n,`object expected, ${Zr(n)} found`)];n.type||n.ref||r.push(new De(o,n,'either "type" or "ref" is required'));let l=Sn(n.type);const c=Sn(n.ref);if(n.id){const t=Sn(n.id);for(let i=0;i<e.arrayIndex;i++){const e=s.layers[i];Sn(e.id)===t&&r.push(new De(o,n.id,`duplicate layer id "${n.id}", previously used at line ${e.id.__line__}`))}}if("ref"in n){let e;["type","source","source-layer","filter","layout"].forEach((e=>{e in n&&r.push(new De(o,n[e],`"${e}" is prohibited for ref layers`))})),s.layers.forEach((t=>{Sn(t.id)===c&&(e=t)})),e?e.ref?r.push(new De(o,n.ref,"ref cannot reference another ref layer")):l=Sn(e.type):r.push(new De(o,n.ref,`ref layer "${c}" not found`))}else if("background"!==l)if(n.source){const e=s.sources&&s.sources[n.source],t=e&&Sn(e.type);e?"vector"===t&&"raster"===l?r.push(new De(o,n.source,`layer "${n.id}" requires a raster source`)):"raster-dem"!==t&&"hillshade"===l||"raster-dem"!==t&&"color-relief"===l?r.push(new De(o,n.source,`layer "${n.id}" requires a raster-dem source`)):"raster"===t&&"raster"!==l?r.push(new De(o,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==t||n["source-layer"]?"raster-dem"===t&&"hillshade"!==l&&"color-relief"!==l?r.push(new De(o,n.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==l||!n.paint||!n.paint["line-gradient"]||"geojson"===t&&e.lineMetrics||r.push(new De(o,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new De(o,n,`layer "${n.id}" must specify a "source-layer"`)):r.push(new De(o,n.source,`source "${n.source}" not found`))}else r.push(new De(o,n,'missing required property "source"'));return"raster"===l&&(null===(t=n.paint)||void 0===t?void 0:t.resampling)&&(null===(i=n.paint)||void 0===i?void 0:i["raster-resampling"])&&r.push(new De(o,n.paint,`layer "${n.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),r=r.concat(In({key:o,value:n,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${o}.type`,value:n.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:n,objectKey:"type"}),filter:kn,layout:e=>In({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Nn(ke({layerType:l},e))}}),paint:e=>In({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>zn(ke({layerType:l},e))}})}})),r}function Vn(e){const t=e.value,i=e.key,r=Zr(t);return"string"!==r?[new De(i,t,`string expected, ${r} found`)]:[]}const jn={promoteId:function({key:e,value:t}){if("string"===Zr(t))return Vn({key:e,value:t});{const i=[];for(const r in t)i.push(...Vn({key:`${e}.${r}`,value:t[r]}));return i}}};function Un(e){const t=e.value,i=e.key,r=e.styleSpec,n=e.style,o=e.validateSpec;if(!t.type)return[new De(i,t,'"type" is required')];const s=Sn(t.type);let a;switch(s){case"vector":case"raster":return a=In({key:i,value:t,valueSpec:r[`source_${s.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:jn,validateSpec:o}),a;case"raster-dem":return a=function(e){var t;const i=null!==(t=e.sourceName)&&void 0!==t?t:"",r=e.value,n=e.styleSpec,o=n.source_raster_dem,s=e.style;let a=[];const l=Zr(r);if(void 0===r)return a;
vendor: 4,808 bytes, line 2
2if("object"!==l)return a.push(new De("source_raster_dem",r,`object expected, ${l} found`)),a;const c="custom"===Sn(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const t in r)!c&&u.includes(t)?a.push(new De(t,r[t],`In "${i}": "${t}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[t]?a=a.concat(e.validateSpec({key:t,value:r[t],valueSpec:o[t],validateSpec:e.validateSpec,style:s,styleSpec:n})):a.push(new De(t,r[t],`unknown property "${t}"`));return a}({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:o}),a;case"geojson":if(a=In({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:jn}),t.cluster)for(const e in t.clusterProperties){const[r,n]=t.clusterProperties[e],o="string"==typeof r?[r,["accumulated"],["get",e]]:r;a.push(...Ln({key:`${i}.${e}.map`,value:n,expressionContext:"cluster-map"})),a.push(...Ln({key:`${i}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return In({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return In({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new De(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Dn({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Gn(e){const t=e.value,i=e.styleSpec,r=i.light,n=e.style;let o=[];const s=Zr(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new De("light",t,`object expected, ${s} found`)]),o;for(const s in t){const a=s.match(/^(.*)-transition$/);o=o.concat(a&&r[a[1]]&&r[a[1]].transition?e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i}):r[s]?e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i}):[new De(s,t[s],`unknown property "${s}"`)])}return o}function $n(e){const t=e.value,i=e.styleSpec,r=i.sky,n=e.style,o=Zr(t);if(void 0===t)return[];if("object"!==o)return[new De("sky",t,`object expected, ${o} found`)];let s=[];for(const o in t)s=s.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i}):[new De(o,t[o],`unknown property "${o}"`)]);return s}function qn(e){const t=e.value,i=e.styleSpec,r=i.terrain,n=e.style;let o=[];const s=Zr(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new De("terrain",t,`object expected, ${s} found`)]),o;for(const s in t)o=o.concat(r[s]?e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i}):[new De(s,t[s],`unknown property "${s}"`)]);return o}function Zn(e){let t=[];const i=e.value,r=e.key;if(Array.isArray(i)){const n=[],o=[];for(const s in i)i[s].id&&n.includes(i[s].id)&&t.push(new De(r,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),n.push(i[s].id),i[s].url&&o.includes(i[s].url)&&t.push(new De(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),o.push(i[s].url),t=t.concat(In({key:`${r}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return Vn({key:r,value:i})}function Wn(e){return Boolean(e)&&e.constructor===Object}function Hn(e){return Wn(e.value)?[]:[new De(e.key,e.value,`object expected, ${Zr(e.value)} found`)]}const Xn={"*":()=>[],array:Cn,boolean:function(e){const t=e.value,i=e.key,r=Zr(t);return"boolean"!==r?[new De(i,t,`boolean expected, ${r} found`)]:[]},number:Mn,color:Fn,constants:En,enum:Dn,filter:kn,function:An,layer:Bn,object:In,source:Un,light:Gn,sky:$n,terrain:qn,projection:function(e){const t=e.value,i=e.styleSpec,r=i.projection,n=e.style,o=Zr(t);if(void 0===t)return[];if("object"!==o)return[new De("projection",t,`object expected, ${o} found`)];let s=[];for(const o in t)s=s.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i}):[new De(o,t[o],`unknown property "${o}"`)]);return s},projectionDefinition:function(e){const t=e.key;let i=e.value;i=i instanceof String?i.valueOf():i;const r=Zr(i);return"array"!==r||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(i)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(i)?["array","string"].includes(r)?[]:[new De(t,i,`projection expected, invalid type "${r}" found`)]:[new De(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Vn,formatted:function(e){return 0===Vn(e).length?[]:Ln(e)},resolvedImage:function(e){return 0===Vn(e).length?[]:Ln(e)},padding:function(e){const t=e.key,i=e.value;
2if("array"===Zr(i)){if(i.length<1||i.length>4)return[new De(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let o=0;o<i.length;o++)n=n.concat(e.validateSpec({key:`${t}[${o}]`,value:i[o],validateSpec:e.validateSpec,valueSpec:r}));return n}return Mn({key:t,value:i,valueSpec:{}})},numberArray:function(e){const t=e.key,i=e.value;if("array"===Zr(i)){const r={type:"number"};if(i.length<1)return[new De(t,i,"array length at least 1 expected, length 0 found")];let n=[];for(let o=0;o<i.length;o++)n=n.concat(e.validateSpec({key:`${t}[${o}]`,value:i[o],validateSpec:e.validateSpec,valueSpec:r}));return n}return Mn({key:t,value:i,valueSpec:{}})},colorArray:function(e){const t=e.key,i=e.value;if("array"===Zr(i)){if(i.length<1)return[new De(t,i,"array length at least 1 expected, length 0 found")];let e=[];for(let r=0;r<i.length;r++)e=e.concat(Fn({key:`${t}[${r}]`,value:i[r]}));return e}return Fn({key:t,value:i})},variableAnchorOffsetCollection:function(e){const t=e.key,i=e.value,r=Zr(i),n=e.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new De(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let r=0;r<i.length;r+=2)o=o.concat(Dn({key:`${t}[${r}]`,value:i[r],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(Cn({key:`${t}[${r+1}]`,value:i[r+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return o},sprite:Zn,state:Hn,fontFaces:function(e){const t=e.key,i=e.value,r=e.validateSpec,n=e.styleSpec,o=e.style;if(!Wn(i))return[new De(t,i,`object expected, ${Zr(i)} found`)];const s=[];for(const e in i){const a=i[e],l=Zr(a);if("string"===l)s.push(...Vn({key:`${t}.${e}`,value:a}));else if("array"===l){const i={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,c]of a.entries())s.push(...In({key:`${t}.${e}[${l}]`,value:c,valueSpec:i,styleSpec:n,style:o,validateSpec:r}))}else s.push(new De(`${t}.${e}`,a,`string or array expected, ${l} found`))}return s}};function Yn(e){const t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=Yn,i.expression&&Wr(Sn(t))?An(e):i.expression&&rn(Pn(t))?Ln(e):i.type&&Xn[i.type]?Xn[i.type](e):In(ke({},e,{valueSpec:i.type?r[i.type]:i}))}function Jn(e){const t=e.value,i=e.key,r=Vn(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new De(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new De(i,t,'"glyphs" url must include a "{range}" token'))),r}function Kn(e,t=xe){let i=[];return i=i.concat(Yn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Yn,objectElementValidators:{glyphs:Jn,"*":()=>[]}})),e.constants&&(i=i.concat(En({key:"constants",value:e.constants}))),eo(i)}function Qn(e){return function(t){return e(Object.assign({},t,{validateSpec:Yn}))}}function eo(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function to(e){return function(...t){return eo(e.apply(this,t))}}Kn.source=to(Qn(Un)),Kn.sprite=to(Qn(Zn)),Kn.glyphs=to(Qn(Jn)),Kn.light=to(Qn(Gn)),Kn.sky=to(Qn($n)),Kn.terrain=to(Qn(qn)),Kn.state=to(Qn(Hn)),Kn.layer=to(Qn(Bn)),Kn.filter=to(Qn(kn)),Kn.paintProperty=to(Qn(zn)),Kn.layoutProperty=to(Qn(Nn));const io={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class ro{constructor(e,t){this._globalState=t,this.setValue(e)}evaluate(){var e;return null!==(e=this._literalValue)&&void 0!==e?e:this._compiledValue.evaluate({})}setValue(e){if(null==e||"visible"===e||"none"===e)return this._literalValue="none"===e?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const t=nn(e,io,this._globalState);if("error"===t.result)throw this._literalValue="visible",this._compiledValue=void 0,new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=un(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const no=xe,oo=Kn,so=oo.light,ao=oo.sky,lo=oo.paintProperty,co=oo.layoutProperty;function uo(e,t){let i=!1;if(null==t?void 0:t.length)for(const r of t)e.fire(new ve(new Error(r.message))),i=!0;return i}class ho{constructor(e,t,i){const r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(i=n[2]);for(let e=0;e<this.d*this.d;e++){const t=n[3+e],i=n[3+e+1];r.push(t===i?null:n.subarray(t,i))}const o=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],o),this.bboxes=n.subarray(o),this.insert=this._insertReadonly}else{this.d=t+2*i;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;const n=i/t*e;this.min=-n,this.max=e+n}
vendor: 8,062 bytes, line 2
2insert(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,i,r,n,o){this.cells[n].push(o)}query(e,t,i,r,n){const o=this.min,s=this.max;if(e<=o&&t<=o&&s<=i&&s<=r&&!n)return[...this.keys];{const o=[];return this._forEachCell(e,t,i,r,this._queryCell,o,{},n),o}}_queryCell(e,t,i,r,n,o,s,a){const l=this.cells[n];if(null!==l){const n=this.keys,c=this.bboxes;for(const u of l)if(void 0===s[u]){const l=4*u;(a?a(c[l+0],c[l+1],c[l+2],c[l+3]):e<=c[l+2]&&t<=c[l+3]&&i>=c[l+0]&&r>=c[l+1])?(s[u]=!0,o.push(n[u])):s[u]=!1}}}_forEachCell(e,t,i,r,n,o,s,a){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(i),h=this._convertToCellCoord(r);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++){const c=this.d*l+d;if((!a||a(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&n.call(this,e,t,i,r,c,o,s,a))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;const e=this.cells,t=3+this.cells.length+1+1;let i=0;for(const e of this.cells)i+=e.length;const r=new Int32Array(t+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let n=t;for(let t=0;t<e.length;t++){const i=e[t];r[3+t]=n,r.set(i,n),n+=i.length}return r[3+e.length]=n,r.set(this.keys,n),n+=this.keys.length,r[3+e.length+1]=n,r.set(this.bboxes,n),n+=this.bboxes.length,r.buffer}static serialize(e,t){const i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}}static deserialize(e){return new ho(e.buffer)}}const po={};function fo(e,t,i={}){if(po[e])throw new Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),po[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}fo("Object",Object),fo("Set",Set),fo("TransferableGridIndex",ho),fo("Color",Mt),fo("Error",Error),fo("AJAXError",de),fo("ResolvedImage",Vt),fo("StylePropertyFunction",ln),fo("StyleExpression",tn,{omit:["_evaluator"]}),fo("ZoomDependentExpression",sn),fo("ZoomConstantExpression",on),fo("CompoundExpression",Fr,{omit:["_evaluate"]});for(const e in Lr)Lr[e]._classRegistryKey||fo(`Expression_${e}`,Lr[e]);function mo(e){var t;return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||"ArrayBuffer"===(null===(t=e.constructor)||void 0===t?void 0:t.name))}function go(e){return e.$name||e.constructor._classRegistryKey}function yo(e){return!function(e){if(null===e||"object"!=typeof e)return!1;const t=go(e);return t&&"Object"!==t}(e)&&(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||mo(e)||X(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function _o(e,t){if(yo(e))return(mo(e)||X(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){const i=[];for(const r of e)i.push(_o(r,t));return i}if("object"!=typeof e)throw new Error("can't serialize object of type "+typeof e);const i=go(e);if(!i)throw new Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!po[i])throw new Error(`${i} is not registered.`);const{klass:r}=po[i],n=r.serialize?r.serialize(e,t):{};if(r.serialize){if(n===(null==t?void 0:t[t.length-1]))throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const r in e){if(!e.hasOwnProperty(r))continue;if(po[i].omit.includes(r))continue;const o=e[r];n[r]=po[i].shallow.includes(r)?o:_o(o,t)}e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(n.$name=i),n}function vo(e){if(yo(e))return e;if(Array.isArray(e))return e.map(vo);if("object"!=typeof e)throw new Error("can't deserialize object of type "+typeof e);const t=go(e)||"Object";if(!po[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:i}=po[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);const r=Object.create(i.prototype);for(const i of Object.keys(e)){if("$name"===i)continue;const n=e[i];r[i]=po[t].shallow.includes(i)?n:vo(n)}return r}class bo{constructor(){this.first=!0}update(e,t){const i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=i,!0))}}function xo(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function wo(e){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function To(e){return/\s/u.test(String.fromCodePoint(e))}function Eo(e){for(const t of e)if(wo(t.codePointAt(0)))return!0;return!1}function So(e){for(const t of e)if(!Co(t.codePointAt(0)))return!1;return!0}function Po(e){const t=e.map((e=>{try{return new RegExp(`\\p{sc=${e}}`,"u").source}catch(e){return null}})).filter((e=>e));return new RegExp(t.join("|"),"u")}const Io=Po(["Arab","Dupl","Mong","Ougr","Syrc"]);function Co(e){return!Io.test(String.fromCodePoint(e))}function Mo(e){return!(wo(e)||(t=e,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t))));var t}
2const Ao=Po(["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"]);function Lo(e){return Ao.test(String.fromCodePoint(e))}function Fo(e,t){return!(!t&&Lo(e)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e)))}function Do(e){for(const t of e)if(Lo(t.codePointAt(0)))return!0;return!1}const ko=new 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(ko.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 null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,i){return t(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;const t=e.pluginURL,r=new Promise((e=>{this.loadScriptResolve=e}));i(t);const n=new Promise((e=>setTimeout((()=>e()),this.TIMEOUT)));if(yield Promise.race([r,n]),this.isParsed()){const e={pluginStatus:"loaded",pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}};class Oo{constructor(e,t){this.isSupportedScript=Ro,this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new bo,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new bo,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}}function Ro(e){return function(e,t){for(const i of e)if(!Fo(i.codePointAt(0),t))return!1;return!0}(e,"loaded"===ko.getRTLTextPluginStatus())}const zo="-transition";class No{constructor(e,t,i){this.property=e,this.value=t,this.expression=function(e,t,i){if(Wr(e))return new ln(e,t);if(rn(e)){const r=an(e,t,i);if("error"===r.result)throw new Error(r.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return r.value}{let i=e;return"color"===t.type&&"string"==typeof e?i=Mt.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"numberArray"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"colorArray"!==t.type||"string"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)?i=Bt.parse(e):"projectionDefinition"===t.type&&"string"==typeof e&&(i=jt.parse(e)):i=Rt.parse(e):i=Ot.parse(e):i=kt.parse(e),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification,i)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class Bo{constructor(e,t){this.property=e,this.value=new No(e,void 0,t)}transitioned(e,t){return new jo(this.property,this.value,t,B({},e.transition,this.transition),e.now)}untransitioned(){return new jo(this.property,this.value,null,{},0)}}class Vo{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=t}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return G(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Bo(this._values[e].property,this._globalState)),this._values[e].value=new No(this._values[e].property,null===t?void 0:G(t),this._globalState)}getTransition(e){return G(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Bo(this._values[e].property,this._globalState)),this._values[e].transition=G(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const r=this.getTransition(t);void 0!==r&&(e[`${t}${zo}`]=r)}return e}transitioned(e,t){const i=new Uo(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){const e=new Uo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class jo{constructor(e,t,i,r,n){this.property=e,this.value=t,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(e,t,i);{const s=(r-this.begin)/(this.end-this.begin);
vendor: 4,807 bytes, line 2
2return this.property.interpolate(o.possiblyEvaluate(e,t,i),n,k(s))}}return n}}class Uo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){const r=new qo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Go{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=t}hasValue(e){return void 0!==this._values[e].value}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return G(this._values[e].value)}setValue(e,t){this._values[e]=new No(this._values[e].property,null===t?void 0:G(t),this._globalState)}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){const r=new qo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}}class $o{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}}class qo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Zo{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,i){const r=gi[this.specification.type];return r?r(e,t,i):e}}class Wo{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r){return new $o(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)}:e.expression,t)}interpolate(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new $o(this,{kind:"constant",value:void 0},e.parameters);const r=gi[this.specification.type];if(r){const n=r(e.value.value,t.value.value,i);return new $o(this,{kind:"constant",value:n},e.parameters)}return e}evaluate(e,t,i,r,n,o){return"constant"===e.kind?e.value:e.evaluate(t,i,r,n,o)}}class Ho extends Wo{possiblyEvaluate(e,t,i,r){if(void 0===e.value)return new $o(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){const n=e.expression.evaluate(t,null,{},i,r),o="resolvedImage"===e.property.specification.type&&"string"!=typeof n?n.name:n,s=this._calculate(o,o,o,t);return new $o(this,{kind:"constant",value:s},t)}if("camera"===e.expression.kind){const i=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 $o(this,{kind:"constant",value:i},t)}return new $o(this,e.expression,t)}evaluate(e,t,i,r,n,o){if("source"===e.kind){const s=e.evaluate(t,i,r,n,o);return this._calculate(s,s,s,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,r),e.evaluate({zoom:Math.floor(t.zoom)},i,r),e.evaluate({zoom:Math.floor(t.zoom)+1},i,r),t):e.value}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class Xo{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){if(void 0!==e.value){if("constant"===e.expression.kind){const n=e.expression.evaluate(t,null,{},i,r);return this._calculate(n,n,n,t)}return this._calculate(e.expression.evaluate(new Oo(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Oo(Math.floor(t.zoom),t)),e.expression.evaluate(new Oo(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class Yo{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class Jo{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const t in e){const i=e[t];i.specification.overridable&&this.overridableProperties.push(t);const r=this.defaultPropertyValues[t]=new No(i,void 0,void 0),n=this.defaultTransitionablePropertyValues[t]=new Bo(i,void 0);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}fo("DataDrivenProperty",Wo),fo("DataConstantProperty",Zo),fo("CrossFadedDataDrivenProperty",Ho),fo("CrossFadedProperty",Xo),fo("
2ColorRampProperty",Yo);const Ko=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Qo=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class es extends be{constructor(e,t,i){if(super(),this.id=e.id,this.type=e.type,this._globalState=i,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(e,t){return new ro(e,t)}(this.visibility,i),"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=fn(e.filter,i)),t.layout&&(this._unevaluatedLayout=new Go(t.layout,i)),t.paint)){this._transitionablePaint=new Vo(t.paint,i);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new qo(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=fn(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){var t;if("visibility"===e)return this.visibility;if(null===(t=this._transitionablePaint)||void 0===t?void 0:t.hasProperty(e))throw new Error(e+Ko);if(!this._unevaluatedLayout)throw new Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(const t in this._unevaluatedLayout._values){const i=this._unevaluatedLayout._values[t];for(const t of i.getGlobalStateRefs())e.add(t)}for(const t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){var e;const t=new globalThis.Map;if(this._transitionablePaint)for(const i in this._transitionablePaint._values){const r=this._transitionablePaint._values[i].value;for(const n of r.getGlobalStateRefs()){const o=null!==(e=t.get(n))&&void 0!==e?e:[];o.push({name:i,value:r.value}),t.set(n,o)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,i={}){var r;if("visibility"===e)return this.visibility=t,this._visibilityExpression.setValue(t),void this.recalculateVisibility();(null===(r=this._transitionablePaint)||void 0===r?void 0:r.hasProperty(e))?this.fire(new ve(new Error(e+Ko))):null!=t&&this._validate(co,`layers.${this.id}.layout.${e}`,e,t,i)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){var t,i;if(e.endsWith(zo)){const i=e.slice(0,-11);if("visibility"===i||(null===(t=this._unevaluatedLayout)||void 0===t?void 0:t.hasProperty(i)))throw new Error(e+Qo);return this._transitionablePaint.getTransition(i)}if("visibility"===e||(null===(i=this._unevaluatedLayout)||void 0===i?void 0:i.hasProperty(e)))throw new Error(e+Qo);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){var r;if("visibility"===e||(null===(r=this._unevaluatedLayout)||void 0===r?void 0:r.hasProperty(e)))return this.fire(new ve(new Error(e+Qo))),!1;if(null!=t&&this._validate(lo,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(e.endsWith(zo))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const i=this._transitionablePaint._values[e],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const s=this._transitionablePaint._values[e].value;return s.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(e,o,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e=this.minzoom,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}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(){var e,t;
2const i={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:null===(e=this._unevaluatedLayout)||void 0===e?void 0:e.serialize(),paint:null===(t=this._transitionablePaint)||void 0===t?void 0:t.serialize()};return this.visibility&&(i.layout||(i.layout={}),i.layout.visibility=this.visibility),U(i,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,i,r,n={}){return!1!==(null==n?void 0:n.validate)&&uo(this,e.call(oo,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:xe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof $o&&Gr(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}let ts;var is={get paint(){return ts=ts||new Jo({"raster-opacity":new Zo(xe.paint_raster["raster-opacity"]),"raster-hue-rotate":new Zo(xe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Zo(xe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Zo(xe.paint_raster["raster-brightness-max"]),"raster-saturation":new Zo(xe.paint_raster["raster-saturation"]),"raster-contrast":new Zo(xe.paint_raster["raster-contrast"]),resampling:new Zo(xe.paint_raster.resampling),"raster-resampling":new Zo(xe.paint_raster["raster-resampling"]),"raster-fade-duration":new Zo(xe.paint_raster["raster-fade-duration"])})}};class rs extends es{constructor(e,t){super(e,is,t)}}const ns={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class os{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}}class ss{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){const 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(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function as(e,t=1){let i=0,r=0;return{members:e.map((e=>{const n=ns[e.type].BYTES_PER_ELEMENT,o=i=ls(i,Math.max(t,n)),s=e.components||1;return r=Math.max(r,n),i+=n*s,{name:e.name,type:e.type,components:s,offset:o}})),size:ls(i,Math.max(r,t)),alignment:t}}function ls(e,t){return Math.ceil(e/t)*t}class cs extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}cs.prototype.bytesPerElement=4,fo("StructArrayLayout2i4",cs);class us extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}us.prototype.bytesPerElement=6,fo("StructArrayLayout3i6",us);class hs extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,e}}hs.prototype.bytesPerElement=8,fo("StructArrayLayout4i8",hs);class ds extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+
vendor: 15,449 bytes, line 2
25]=s,e}}ds.prototype.bytesPerElement=12,fo("StructArrayLayout2i4i12",ds);class ps extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=4*e,l=8*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=s,e}}ps.prototype.bytesPerElement=8,fo("StructArrayLayout2i4ub8",ps);class fs extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}fs.prototype.bytesPerElement=8,fo("StructArrayLayout2f8",fs);class ms extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,n,o,s,a,l,c)}emplace(e,t,i,r,n,o,s,a,l,c,u){const h=10*e;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=n,this.uint16[h+4]=o,this.uint16[h+5]=s,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,e}}ms.prototype.bytesPerElement=20,fo("StructArrayLayout10ui20",ms);class gs extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,i,r,n,o,s,a)}emplace(e,t,i,r,n,o,s,a,l){const c=8*e;return this.uint16[c+0]=t,this.uint16[c+1]=i,this.uint16[c+2]=r,this.uint16[c+3]=n,this.uint16[c+4]=o,this.uint16[c+5]=s,this.uint16[c+6]=a,this.uint16[c+7]=l,e}}gs.prototype.bytesPerElement=16,fo("StructArrayLayout8ui16",gs);class ys extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,o,s,a,l,c,u,h)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=s,this.uint16[p+6]=a,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}ys.prototype.bytesPerElement=24,fo("StructArrayLayout4i4ui4i24",ys);class _s extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}_s.prototype.bytesPerElement=12,fo("StructArrayLayout3f12",_s);class vs extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}vs.prototype.bytesPerElement=4,fo("StructArrayLayout1ul4",vs);class bs extends ss{_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,i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,r,n,o,s,a,l)}emplace(e,t,i,r,n,o,s,a,l,c){const u=10*e,h=5*e;return this.int16[u+0]=t,this.int16[u+1]=i,this.int16[u+2]=r,this.int16[u+3]=n,this.int16[u+4]=o,this.int16[u+5]=s,this.uint32[h+3]=a,this.uint16[u+8]=l,this.uint16[u+9]=c,e}}bs.prototype.bytesPerElement=20,fo("StructArrayLayout6i1ul2ui20",bs);class xs extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,e}}xs.prototype.bytesPerElement=12,fo("StructArrayLayout2i2i2i12",xs);class ws extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=4*e,a=8*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[a+6]=n,this.int16[a+7]=o,e}}ws.prototype.bytesPerElement=16,fo("StructArrayLayout2f1f2i16",ws);class Ts extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=16*e,l=4*e,c=8*e;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[c+6]=o,this.int16[c+7]=s,e}}Ts.prototype.bytesPerElement=16,fo("StructArrayLayout2ub2f2i16",Ts);class Es extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}Es.prototype.bytesPerElement=6,fo("StructArrayLayout3ui6",Es);class Ss extends ss{_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,i,r,n,o,s,a,l,c,u,h,d,p,f,m,g){const y=this.length;return this.resize(y+1),this.emplace(y,e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,m,g)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,m,g,y){const _=24*e,v=12*e,b=48*e;return this.int16[_+0]=t,this.int16[_+1]=i,this.uint16[_+2]=r,this.uint16[_+3]=n,this.uint32[v+2]=o,this.uint32[v+3]=s,this.uint32[v+4]=a,this.uint16[_+10]=l,this.uint16[_+11]=c,this.uint16[_+12]=u,this.float32[v+7]=h,this.float32[v+8]=d,this.uint8[b+36]=p,this.uint8[b+37]=f,this.uint8[b+38]=m,this.uint32[v+10]=g,this.int16[_+22]=y,e}}Ss.prototype.bytesPerElement=48,fo("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ss);class Ps extends ss{_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,i,r,n,o,s,a,l,c,u,h,d,p,f,m,g,y,_,v,b,x,w,T,E,S,P,I){const C=this.length;return this.resize(C+1),this.emplace(C,e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,m,g,y,_,v,b,x,w,T,E,S,P,I)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,m,g,y,_,v,b,x,w,T,E,S,P,I,C){const M=32*e,A=16*e;return this.int16[M+0]=t,this.int16[M+1]=i,this.int16[M+2]=r,this.int16[M+3]=n,this.int16[M+4]=o,this.int16[M+5]=s,this.int16[M+6]=a,this.int16[M+7]=l,this.uint16[M+8]=c,this.uint16[M+9]=u,this.uint16[M+10]=h,this.uint16[M+11]=d,this.uint16[M+12]=p,this.uint16[M+13]=f,this.uint16[M+14]=m,this.uint16[M+15]=g,this.uint16[M+16]=y,this.uint16[M+17]=_,this.uint16[M+18]=v,this.uint16[M+19]=b,this.uint16[M+20]=x,this.uint16[M+21]=w,this.uint16[M+22]=T,this.uint32[A+12]=E,this.float32[A+13]=S,this.float32[A+14]=P,this.uint16[M+30]=I,this.uint16[M+31]=C,e}}Ps.prototype.bytesPerElement=64,fo("StructArrayLayout8i15ui1ul2f2ui64",Ps);class Is extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Is.prototype.bytesPerElement=4,fo("StructArrayLayout1f4",Is);class Cs extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[6*e+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}Cs.prototype.bytesPerElement=12,fo("StructArrayLayout1ui2f12",Cs);class Ms extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e;return this.uint32[2*e+0]=t,this.uint16[n+2]=i,this.uint16[n+3]=r,e}}Ms.prototype.bytesPerElement=8,fo("StructArrayLayout1ul2ui8",Ms);class As extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}As.prototype.bytesPerElement=4,fo("StructArrayLayout2ui4",As);class Ls extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Ls.prototype.bytesPerElement=2,fo("StructArrayLayout1ui2",Ls);class Fs extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,e}}Fs.prototype.bytesPerElement=16,fo("StructArrayLayout4f16",Fs);class Ds extends os{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 i(this.anchorPointX,this.anchorPointY)}}Ds.prototype.size=20;class ks extends bs{get(e){return new Ds(this,e)}}fo("CollisionBoxArray",ks);class Os extends os{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]}}Os.prototype.size=48;class Rs extends Ss{get(e){return new Os(this,e)}}fo("PlacedSymbolArray",Rs);class zs extends os{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]}}zs.prototype.size=64;class Ns extends Ps{get(e){return new zs(this,e)}}fo("SymbolInstanceArray",Ns);class Bs extends Is{getoffsetX(e){return this.float32[1*e+0]}}fo("GlyphOffsetArray",Bs);class Vs extends us{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}fo("SymbolLineVertexArray",Vs);class js extends os{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]}}js.prototype.size=12;class Us extends Cs{get(e){return new js(this,e)}}fo("TextAnchorOffsetArray",Us);class Gs extends os{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]}}Gs.prototype.size=8;class $s extends Ms{get(e){return new Gs(this,e)}}fo("FeatureIndexArray",$s);class qs extends cs{}class Zs extends cs{}class Ws extends cs{}class Hs extends ds{}class Xs extends ps{}class Ys extends fs{}class Js extends ms{}class Ks extends gs{}class Qs extends ys{}class ea extends _s{}class ta extends vs{}class ia extends xs{}class ra extends Ts{}
vendor: 2,108 bytes, line 2
2class na extends Es{}class oa extends As{}const sa=as([{name:"a_pos",components:2,type:"Int16"}],4),{members:aa}=sa;class la{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,i,r){const n=this.segments[this.segments.length-1];return e>la.MAX_VERTEX_ARRAY_LENGTH&&q(`Max vertices per segment is ${la.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${la.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+e>la.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r?this.createNewSegment(t,i,r):n}createNewSegment(e,t,i){const r={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(e,t,i){return this.prepareSegment(0,e,t,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,r){return new la([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function ca(e,t){return 256*(e=z(Math.floor(e),0,255))+z(Math.floor(t),0,255)}la.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,fo("SegmentVector",la);const ua=as([{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"}]),ha=as([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var da,pa,fa,ma={exports:{}},ga={exports:{}},ya={exports:{}},_a=function(){if(fa)return ma.exports;fa=1;var e=(da||(da=1,ga.exports=function(e,t){var i,r,n,o,s,a,l,c;for(r=e.length-(i=3&e.length),n=t,s=3432918353,a=461845907,c=0;c<r;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(6
vendor: 9,362 bytes, line 2
25535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),ga.exports),t=(pa||(pa=1,ya.exports=function(e,t){for(var i,r=e.length,n=t^r,o=0;r>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),ya.exports);return ma.exports=e,ma.exports.murmur3=e,ma.exports.murmur2=t,ma.exports}(),va=r(_a);class ba{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(xa(e)),this.positions.push(t,i,r)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const t=xa(e);let i=0,r=this.ids.length-1;for(;i<r;){const e=i+r>>1;this.ids[e]>=t?r=e:i=e+1}const n=[];for(;this.ids[i]===t;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(e,t){const i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return wa(i,r,0,i.length-1),t&&t.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(e){const t=new ba;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function xa(e){const t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:va(String(e))}function wa(e,t,i,r){for(;i<r;){const n=e[i+r>>1];let o=i-1,s=r+1;for(;;){do{o++}while(e[o]<n);do{s--}while(e[s]>n);if(o>=s)break;Ta(e,o,s),Ta(t,3*o,3*s),Ta(t,3*o+1,3*s+1),Ta(t,3*o+2,3*s+2)}s-i<r-s?(wa(e,t,i,s),i=s+1):(wa(e,t,s+1,r),r=s)}}function Ta(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}fo("FeaturePositionMap",ba);class Ea{constructor(e,t){this.gl=e.gl,this.location=t}}class Sa extends Ea{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Pa extends Ea{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]))}}class Ia extends Ea{constructor(e,t){super(e,t),this.current=Mt.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))}}const Ca=new Float32Array(16);function Ma(e){return[ca(255*e.r,255*e.g),ca(255*e.b,255*e.a)]}class Aa{constructor(e,t,i){this.value=e,this.uniformNames=t.map((e=>`u_${e}`)),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return"color"===this.type?new Ia(e,t):new Sa(e,t)}}class La{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,i,r){let n=null;"u_pattern_to"===r?n=this.patternTo:"u_pattern_from"===r?n=this.patternFrom:"u_dasharray_to"===r?n=this.dashTo:"u_dasharray_from"===r?n=this.dashFrom:"u_pixel_ratio_to"===r?n=this.pixelRatioTo:"u_pixel_ratio_from"===r&&(n=this.pixelRatioFrom),null!==n&&e.set(n)}getBinding(e,t,i){return i.startsWith("u_pattern")||i.startsWith("u_dasharray_")?new Pa(e,t):new Sa(e,t)}}class Fa{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,i){const r=this.paintVertexArray.length,n=this.expression.evaluate(new Oo(0,i),t,{},i.canonical,[],i.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(r,e,n)}updatePaintArray(e,t,i,r,n){const o=this.expression.evaluate(new Oo(0,n),i,r);this._setPaintValue(e,t,o)}_setPaintValue(e,t,i){if("color"===this.type){const r=Ma(i);for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){var t,i;(null===(t=this.paintVertexArray)||void 0===t?void 0:t.arrayBuffer.byteLength)&&((null===(i=this.paintVertexBuffer)||void 0===i?void 0:i.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Da{constructor(e,t,i,r,n,o){this.expression=e,this.uniformNames=t.map((e=>`u_${e}_t`)),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,t,i){const r=this.expression.evaluate(new Oo(this.zoom,i),t,{},i.canonical,[],i.formattedSection),n=this.expression.evaluate(new Oo(this.zoom+1,i),t,{},i.canonical,[],i.formattedSection),o=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(o,e,r,n)}updatePaintArray(e,t,i,r,n){const o=this.expression.evaluate(new Oo(this.zoom,n),i,r),s=this.expression.evaluate(new Oo(this.zoom+1,n),i,r);this._setPaintValue(e,t,o,s)}_setPaintValue(e,t,i,r){if("color"===this.type){const n=Ma(i),o=Ma(r);for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n[0],n[1],o[0],o[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(e){var t,i;(null===(t=this.paintVertexArray)||void 0===t?void 0:t.arrayBuffer.byteLength)&&((null===(i=this.paintVertexBuffer)||void 0===i?void 0:i.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){const i=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=z(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,i){return new Sa(e,t)}}class ka{constructor(e,t,i,r,n,o){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=r,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(e,t,i){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,this.getPositionIds(t),i)}updatePaintArray(e,t,i,r,n){this._setPaintValues(e,t,this.getPositionIds(i),n)}_setPaintValues(e,t,i,r){const n=this.getPositions(r);if(!n||!i)return;const o=n[i.min],s=n[i.mid],a=n[i.max];if(o&&s&&a)for(let i=e;i<t;i++)this.emplace(this.zoomInPaintVertexArray,i,s,o),this.emplace(this.zoomOutPaintVertexArray,i,s,a)}upload(e){var t,i;if((null===(t=this.zoomInPaintVertexArray)||void 0===t?void 0:t.arrayBuffer.byteLength)&&(null===(i=this.zoomOutPaintVertexArray)||void 0===i?void 0:i.arrayBuffer.byteLength)){const t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Oa extends ka{getPositions(e){return e.imagePositions}getPositionIds(e){var t;return null===(t=e.patterns)||void 0===t?void 0:t[this.layerId]}getVertexAttributes(){return ua.members}emplace(e,t,i,r){e.emplace(t,i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.pixelRatio,r.pixelRatio)}}class Ra extends ka{getPositions(e){return e.dashPositions}getPositionIds(e){var t;return null===(t=e.dashes)||void 0===t?void 0:t[this.layerId]}getVertexAttributes(){return ha.members}emplace(e,t,i,r){e.emplace(t,0,i.y,i.height,i.width,0,r.y,r.height,r.width)}}class za{constructor(e,t,i){this.binders={},this._buffers=[];const r=[];for(const n in e.paint._values){if(!i(n))continue;const o=e.paint.get(n);if(!(o instanceof $o&&Gr(o.property.specification)))continue;const s=Ba(n,e.type),a=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,u=o.property.specification["property-type"],h="cross-faded"===u||"cross-faded-data-driven"===u;
vendor: 4,147 bytes, line 2
2if("constant"===a.kind)this.binders[n]=h?new La(a.value,s):new Aa(a.value,s,l),r.push(`/u_${n}`);else if("source"===a.kind||h){const i=Va(n,l,"source");this.binders[n]=h?"line-dasharray"===n?new Ra(a,l,c,t,i,e.id):new Oa(a,l,c,t,i,e.id):new Fa(a,s,l,i),r.push(`/a_${n}`)}else{const e=Va(n,l,"composite");this.binders[n]=new Da(a,s,l,c,t,e),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Fa||t instanceof Da?t.maxValue:0}populatePaintArrays(e,t,i){for(const r in this.binders){const n=this.binders[r];(n instanceof Fa||n instanceof Da||n instanceof ka)&&n.populatePaintArray(e,t,i)}}setConstantPatternPositions(e,t){for(const i in this.binders){const r=this.binders[i];r instanceof La&&r.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(const i in this.binders){const r=this.binders[i];r instanceof La&&r.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,i,r,n){let o=!1;for(const s in e){const a=t.getPositions(s);for(const t of a){const a=i.feature(t.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof Fa||l instanceof Da||l instanceof ka)&&!0===l.expression.isStateDependent){const c=r.paint.get(i);l.expression=c.value,l.updatePaintArray(t.start,t.end,a,e[s],n),o=!0}}}}return o}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof Aa||i instanceof La)&&e.push(...i.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof Fa||i instanceof Da)for(const t of i.paintVertexAttributes)e.push(t.name);else if(i instanceof ka){const t=i.getVertexAttributes();for(const i of t)e.push(i.name)}}return e}getBinderUniforms(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof Aa||i instanceof La||i instanceof Da)for(const t of i.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof Aa||n instanceof La||n instanceof Da)for(const o of n.uniformNames)if(t[o]){const s=n.getBinding(e,t[o],o);i.push({name:o,property:r,binding:s})}}return i}setUniforms(e,t,i,r){for(const{name:e,property:n,binding:o}of t)this.binders[n].setUniform(o,r,i.get(n),e)}updatePaintBuffers(e){this._buffers=[];for(const t in this.binders){const i=this.binders[t];if(e&&i instanceof ka){const t=2===e.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(i instanceof Fa||i instanceof Da)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(const t in this.binders){const i=this.binders[t];(i instanceof Fa||i instanceof Da||i instanceof ka)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof Fa||t instanceof Da||t instanceof ka)&&t.destroy()}}}class Na{constructor(e,t,i=()=>!0){this.programConfigurations={};for(const r of e)this.programConfigurations[r.id]=new za(r,t,i);this.needsUpload=!1,this._featureMap=new ba,this._bufferOffset=0}populatePaintArrays(e,t,i,r){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,r);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r){for(const n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,n,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Ba(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
2pwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function Va(e,t,i){const r={color:{source:fs,composite:Fs},number:{source:Is,composite:fs}},n=function(e){return{"line-pattern":{source:Js,composite:Js},"fill-pattern":{source:Js,composite:Js},"fill-extrusion-pattern":{source:Js,composite:Js},"line-dasharray":{source:Ks,composite:Ks}}[e]}(e);return(null==n?void 0:n[i])||r[t][i]}fo("ConstantBinder",Aa),fo("CrossFadedConstantBinder",La),fo("SourceExpressionBinder",Fa),fo("CrossFadedPatternBinder",Oa),fo("CrossFadedDasharrayBinder",Ra),fo("CompositeExpressionBinder",Da),fo("ProgramConfiguration",za,{omit:["_buffers"]}),fo("ProgramConfigurationSet",Na);const ja=Math.pow(2,14)-1,Ua=-ja-1;function Ga(e){const t=M/e.extent,i=e.loadGeometry();for(const e of i)for(const i of e){const e=Math.round(i.x*t),r=Math.round(i.y*t);i.x=z(e,Ua,ja),i.y=z(r,Ua,ja),(e<i.x||e>i.x+1||r<i.y||r>i.y+1)&&q("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function $a(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Ga(e):[]}}const qa=-32768;function Za(e,t,i,r,n){e.emplaceBack(qa+8*t+r,qa+8*i+n)}class Wa{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Zs,this.indexArray=new na,this.segments=new la,this.programConfigurations=new Na(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){const r=this.layers[0],n=[];let o=null,s=!1,a="heatmap"===r.type;if("circle"===r.type){const e=r;o=e.layout.get("circle-sort-key"),s=!o.isConstant(),a||(a="map"===e.paint.get("circle-pitch-alignment"))}const l=a?t.subdivisionGranularity.circle:1;for(const{feature:t,id:r,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=$a(t,e);if(!this.layers[0]._featureFilter.filter(new Oo(this.zoom),c,i))continue;const u=s?o.evaluate(c,{},i):void 0,h={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:Ga(t),patterns:{},sortKey:u};n.push(h)}s&&n.sort(((e,t)=>
vendor: 8,834 bytes, line 2
2e.sortKey-t.sortKey));for(const r of n){const{geometry:n,index:o,sourceLayerIndex:s}=r,a=e[o].feature;this.addFeature(r,n,o,i,l),t.featureIndex.insert(a,n,o,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,aa),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,i,r,n=1){let o;switch(n){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}const s=o.length;for(const i of t)for(const t of i){const i=t.x,r=t.y;if(i<0||i>=M||r<0||r>=M)continue;const n=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),a=n.vertexLength;for(let e=0;e<s;e++)for(let t=0;t<s;t++)Za(this.layoutVertexArray,i,r,o[t],o[e]);for(let e=0;e<s-1;e++)for(let t=0;t<s-1;t++){const i=a+e*s+t,r=a+(e+1)*s+t;this.indexArray.emplaceBack(i,r+1,i+1),this.indexArray.emplaceBack(i,r,r+1)}n.vertexLength+=s*s,n.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:{},canonical:r})}}function Ha(e,t){for(const i of e)if(rl(t,i))return!0;for(const i of t)if(rl(e,i))return!0;return Ka(e,t)}function Xa(e,t,i){return!!rl(e,t)||el(t,e,i)}function Ya(e,t){if(1===e.length)return il(t,e[0]);for(const i of t)for(const t of i)if(rl(e,t))return!0;for(const i of e)if(il(t,i))return!0;for(const i of t)if(Ka(e,i))return!0;return!1}function Ja(e,t,i){if(e.length>1){if(Ka(e,t))return!0;for(const r of t)if(el(r,e,i))return!0}for(const r of e)if(el(r,t,i))return!0;return!1}function Ka(e,t){if(0===e.length||0===t.length)return!1;for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)if(Qa(r,n,t[e],t[e+1]))return!0}return!1}function Qa(e,t,i,r){return Z(e,i,r)!==Z(t,i,r)&&Z(e,t,i)!==Z(e,t,r)}function el(e,t,i){const r=i*i;if(1===t.length)return e.distSqr(t[0])<r;for(let i=1;i<t.length;i++)if(tl(e,t[i-1],t[i])<r)return!0;return!1}function tl(e,t,i){const r=t.distSqr(i);if(0===r)return e.distSqr(t);const n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(n<0?t:n>1?i:i.sub(t)._mult(n)._add(t))}function il(e,t){let i,r,n,o=!1;for(const s of e){i=s;for(let e=0,s=i.length-1;e<i.length;s=e++)r=i[e],n=i[s],r.y>t.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function rl(e,t){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){const o=e[r],s=e[n];o.y>t.y!=s.y>t.y&&t.x<(s.x-o.x)*(t.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function nl(e,t,i){const r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;const o=Z(e,t,i[0]);return o!==Z(e,t,i[1])||o!==Z(e,t,i[2])||o!==Z(e,t,i[3])}function ol(e,t,i){const r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function sl(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function al(e,t,r,n,o){if(!t[0]&&!t[1])return e;const s=i.convert(t)._mult(o);"viewport"===r&&s._rotate(-n);const a=[];for(const t of e)a.push(t.sub(s));return a}function ll(e){const t=[];for(let i=0;i<e.length;i++){const r=e[i],n=t.at(-1);(0===i||n&&!r.equals(n))&&t.push(r)}return t}function cl({queryGeometry:e,size:t},i){return Xa(e,i,t)}function ul({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:n},o){return Xa(e,o,t*(i.projectTileCoordinates(o.x,o.y,r,n).signedDistanceFromCamera/i.cameraToCenterDistance))}function hl({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:n},o){const s=i.projectTileCoordinates(o.x,o.y,r,n).signedDistanceFromCamera,a=t*(i.cameraToCenterDistance/s);return Xa(e,fl(o,i,r,n),a)}function dl({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:n},o){return Xa(e,fl(o,i,r,n),t)}function pl({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:n,pitchAlignment:o="map",pitchScale:s="map"},a){const l="map"===o?"map"===s?cl:ul:"map"===s?hl:dl,c={queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:n};for(const e of a)for(const t of e)if(l(c,t))return!0;return!1}function fl(e,t,r,n){const o=t.projectTileCoordinates(e.x,e.y,r,n).point;return new i((.5*o.x+.5)*t.width,(.5*-o.y+.5)*t.height)}let ml,gl;fo("CircleBucket",Wa,{omit:["layers"]});var yl={get paint(){return gl=gl||new Jo({"circle-radius":new Wo(xe.paint_circle["circle-radius"]),"circle-color":new Wo(xe.paint_circle["circle-color"]),"circle-blur":new Wo(xe.paint_circle["circle-blur"]),"circle-opacity":new Wo(xe.paint_circle["circle-opacity"]),"circle-translate":new Zo(xe.paint_circle["circle-translate"]),"circle-translate-anchor":new Zo(xe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Zo(xe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Zo(xe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Wo(xe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Wo(xe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Wo(xe.paint_circle["circle-stroke-opacity"])})},get layout(){return ml=ml||new Jo({"circle-sort-key":new Wo(xe.layout_circle["circle-sort-key"])})}};class _l extends es{constructor(e,t){super(e,yl,t)}createBucket(e){return new Wa(e)}queryRadius(e){const t=e;return ol("circle-radius",this,t)+ol("circle-stroke-width",this,t)+sl(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,unwrappedTileID:s,getElevation:a}){const l=al(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i),u=this.paint.get("circle-pitch-scale"),h=this.paint.get("circle-pitch-alignment");let d,p;return"map"===h?(d=l,p=c*o):(d=function(e,t,i,r){return e.map((e=>fl(e,t,i,r)))}(l,n,s,a),p=c),pl({queryGeometry:d,size:p,transform:n,unwrappedTileID:s,getElevation:a,pitchAlignment:h,pitchScale:u},r)}}class vl extends Wa{}let bl;fo("HeatmapBucket",vl,{omit:["layers"]});var xl={get paint(){return bl=bl||new Jo({"heatmap-radius":new Wo(xe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Wo(xe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Zo(xe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yo(xe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Zo(xe.paint_heatmap["heatmap-opacity"])})}};function wl(e,{width:t,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${t*i*r}`)}else n=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=n,e}function Tl(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;const n=wl({},{width:t,height:i},r);El(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},r),e.width=t,e.height=i,e.data=n.data}function El(e,t,i,r,n,o){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const s=e.data,a=t.data;if(s===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){const c=((i.y+l)*e.width+i.x)*o,u=((r.y+l)*t.width+r.x)*o;for(let e=0;e<n.width*o;e++)a[u+e]=s[c+e]}return t}class Sl{constructor(e,t){wl(this,e,1,t)}resize(e){Tl(this,e,1)}clone(){return new Sl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n){El(e,t,i,r,n,1)}}class Pl{constructor(e,t){wl(this,e,4,t)}resize(e){Tl(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Pl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n){El(e,t,i,r,n,4)}setPixel(e,t,i){const r=4*(e*this.width+t);this.data[r+0]=Math.round(255*i.r/i.a),this.data[r+1]=Math.round(255*i.g/i.a),this.data[r+2]=Math.round(255*i.b/i.a),this.data[r+3]=Math.round(255*i.a)}}function Il(e){const t=new Uint8Array(e.length);for(let i=0;i<e.length;i+=4){const r=e[i+3];
2t[i+0]=Math.round(e[i+0]*r/255),t[i+1]=Math.round(e[i+1]*r/255),t[i+2]=Math.round(e[i+2]*r/255),t[i+3]=r}return t}function Cl(e){const t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new Pl({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const o=(r,o,s)=>{t[e.evaluationKey]=s;const a=e.expression.evaluate(t);n.setPixel(r/4/i,o/4,a)};if(e.clips)for(let t=0,n=0;t<r;++t,n+=4*i)for(let r=0,s=0;r<i;r++,s+=4){const a=r/(i-1),{start:l,end:c}=e.clips[t];o(n,s,l*(1-a)+c*a)}else for(let e=0,t=0;e<i;e++,t+=4)o(0,t,e/(i-1));return n}fo("AlphaImage",Sl),fo("RGBAImage",Pl);const Ml="big-fb";class Al extends es{createBucket(e){return new vl(e)}constructor(e,t){super(e,xl,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Cl({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Ml)&&this.heatmapFbos.delete(Ml)}queryRadius(e){return ol("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,unwrappedTileID:s,getElevation:a}){return pl({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(t,i)*o,transform:n,unwrappedTileID:s,getElevation:a},r)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}}let Ll;var Fl={get paint(){return Ll=Ll||new Jo({"hillshade-illumination-direction":new Zo(xe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Zo(xe.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Zo(xe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Zo(xe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Zo(xe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Zo(xe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Zo(xe.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Zo(xe.paint_hillshade["hillshade-method"]),resampling:new Zo(xe.paint_hillshade.resampling)})}};class Dl extends es{constructor(e,t){super(e,Fl,t),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,i=this.paint.get("hillshade-highlight-color").values,r=this.paint.get("hillshade-shadow-color").values;const n=Math.max(e.length,t.length,i.length,r.length);e=e.concat(Array(n-e.length).fill(e.at(-1))),t=t.concat(Array(n-t.length).fill(t.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1)));const o=t.map(te);return{directionRadians:e.map(te),altitudeRadians:o,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}}let kl;var Ol={get paint(){return kl=kl||new Jo({"color-relief-opacity":new Zo(xe["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Yo(xe["paint_color-relief"]["color-relief-color"]),resampling:new Zo(xe["paint_color-relief"].resampling)})}};function Rl(e){return"data"in e}class zl{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,r)}update(e,t,i){var r;const{width:n,height:o}=e,s=((null===(r=this.size)||void 0===r?void 0:r[0])!==n||this.size[1]!==o)&&!i,{context:a}=this,{gl:l}=a;this.useMipmap=Boolean(null==t?void 0:t.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1);const c=this.format===l.RGBA&&!1!==(null==t?void 0:t.premultiply);if(s)this.size=[n,o],Rl(e)?(a.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,c,n,o,l)):(a.pixelStoreUnpackPremultiplyAlpha.set(c),this._uploadDomImage(e,l));else{const{x:t,y:r}=i||{x:0,y:0};Rl(e)?(a.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,c,t,r,n,o,l)):(a.pixelStoreUnpackPremultiplyAlpha.set(c),this._updateDomImage(e,t,r,l))}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,i,r,n){let{data:o}=e;t&&o&&(o=Il(o)),n.texImage2D(n.TEXTURE_2D,0,this.format,i,r,0,this.format,n.UNSIGNED_BYTE,o)}_updateDomImage(e,t,i,r){r.texSubImage2D(r.TEXTURE_2D,0,t,i,r.RGBA,r.UNSIGNED_BYTE,e)}_updateRawData(e,t,i,r,n,o,s){let{data:a}=e;t&&a&&(a=Il(a)),s.texSubImage2D(s.TEXTURE_2D,0,i,r,n,o,s.RGBA,s.UNSIGNED_BYTE,a)}bind(e,t,i){const{context:r}=this,{gl:n}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),e!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.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(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class Nl{constructor(e,t,i,r=1,n=1,o=1,s=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void q(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;const a=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;
vendor: 4,984 bytes, line 2
2case"custom":this.redFactor=r,this.greenFactor=n,this.blueFactor=o,this.baseShift=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=0;e<a;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(a,e)]=this.data[this._idx(a-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,a)]=this.data[this._idx(e,a-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(a,-1)]=this.data[this._idx(a-1,0)],this.data[this._idx(-1,a)]=this.data[this._idx(0,a-1)],this.data[this._idx(a,a)]=this.data[this._idx(a-1,a-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let e=0;e<a;e++)for(let t=0;t<a;t++){const i=this.get(e,t);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(e,t){const i=new Uint8Array(this.data.buffer),r=4*this._idx(e,t);return this.unpack(i[r],i[r+1],i[r+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. x: ${e}, y: ${t}, dim: ${this.dim}`);return(t+1)*this.stride+(e+1)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return Bl(e,this.getUnpackVector())}getPixels(){return new Pl({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-t*this.dim,l=-i*this.dim;for(let t=o;t<s;t++)for(let i=r;i<n;i++)this.data[this._idx(i,t)]=e.data[this._idx(i+a,t+l)]}}function Bl(e,t){const i=t[0],r=t[1],n=t[2],o=t[3],s=Math.min(i,r,n),a=Math.round((e+o)/s);return{r:Math.floor(a*s/i)%256,g:Math.floor(a*s/r)%256,b:Math.floor(a*s/n)%256}}fo("DEMData",Nl);class Vl extends es{constructor(e,t){super(e,Ol,t)}_createColorRamp(e){const t={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof on&&i._styleExpression.expression instanceof fi){this.colorRampExpression=i;const e=i._styleExpression.expression;t.elevationStops=e.labels,t.colorStops=[];for(const i of t.elevationStops)t.colorStops.push(e.evaluate({globals:{elevation:i}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[Mt.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;const r={elevationStops:[],colorStops:[]},n=(t.elevationStops.length-1)/(e-1);for(let e=0;e<t.elevationStops.length-.5;e+=n)r.elevationStops.push(t.elevationStops[Math.round(e)]),r.colorStops.push(t.colorStops[Math.round(e)]);return q(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const r=this._createColorRamp(t),n=new Pl({width:r.colorStops.length,height:1}),o=new Pl({width:r.colorStops.length,height:1});for(let e=0;e<r.elevationStops.length;e++){const t=Bl(r.elevationStops[e],i);o.setPixel(0,e,new Mt(t.r/255,t.g/255,t.b/255,1)),n.setPixel(0,e,r.colorStops[e])}return this.colorRampTextures={elevationTexture:new zl(e,o,e.gl.RGBA),colorTexture:new zl(e,n,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const jl=as([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ul}=jl;function Gl(e,t,i){const r=i.patternDependencies;let n=!1;for(const i of t){const t=i.paint.get(`${e}-pattern`);t.isConstant()||(n=!0);const o=t.constantOr(null);o&&(n=!0,r[o.to]=!0,r[o.from]=!0)}return n}function $l(e,t,i,r,n){const{zoom:o}=r,s=n.patternDependencies;for(const r of t){const t=r.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:o-1},i,{},n.availableImages),a=t.evaluate({zoom:o},i,{},n.availableImages),l=t.evaluate({zoom:o+1},i,{},n.availableImages);e=(null==e?void 0:e.name)?e.name:e,a=(null==a?void 0:a.name)?a.name:a,l=(null==l?void 0:l.name)?l.name:l,s[e]=!0,s[a]=!0,s[l]=!0,i.patterns[r.id]={min:e,mid:a,max:l}}}return i}function ql(e,t,i,r,n){let o;if(n===function(e,t,i,r){let n=0;for(let o=t,s=i-r;o<i;o+=r)n+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return n}(e,t,i,r)>0)for(let n=t;n<i;n+=r)o=pc(n/r|0,e[n],e[n+1],o);else for(let n=i-r;n>=t;n-=r)o=pc(n/r|0,e[n],e[n+1],o);return o&&ac(o,o.next)&&(fc(o),o=o.next),o}function Zl(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!ac(r,r.next)&&0!==sc(r.prev,r,r.next))r=r.next;else{if(fc(r),r=t=r.prev,r===r.next)break;
vendor: 4,283 bytes, line 2
2i=!0}}while(i||r!==t);return t}function Wl(e,t,i,r,n,o,s){if(!e)return;!s&&o&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=tc(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let o=null;for(t=0;n;){t++;let s=n,a=0;for(let e=0;e<i&&(a++,s=s.nextZ,s);e++);let l=i;for(;a>0||l>0&&s;)0!==a&&(0===l||!s||n.z<=s.z)?(r=n,n=n.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=s}o.nextZ=null,i*=2}while(t>1)}(n)}(e,r,n,o);let a=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?Xl(e,r,n,o):Hl(e))t.push(l.i,e.i,c.i),fc(e),e=c.next,a=c.next;else if((e=c)===a){s?1===s?Wl(e=Yl(Zl(e),t),t,i,r,n,o,2):2===s&&Jl(e,t,i,r,n,o):Wl(Zl(e),t,i,r,n,o,1);break}}}function Hl(e){const t=e.prev,i=e,r=e.next;if(sc(t,i,r)>=0)return!1;const n=t.x,o=i.x,s=r.x,a=t.y,l=i.y,c=r.y,u=Math.min(n,o,s),h=Math.min(a,l,c),d=Math.max(n,o,s),p=Math.max(a,l,c);let f=r.next;for(;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&nc(n,a,o,l,s,c,f.x,f.y)&&sc(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Xl(e,t,i,r){const n=e.prev,o=e,s=e.next;if(sc(n,o,s)>=0)return!1;const a=n.x,l=o.x,c=s.x,u=n.y,h=o.y,d=s.y,p=Math.min(a,l,c),f=Math.min(u,h,d),m=Math.max(a,l,c),g=Math.max(u,h,d),y=tc(p,f,t,i,r),_=tc(m,g,t,i,r);let v=e.prevZ,b=e.nextZ;for(;v&&v.z>=y&&b&&b.z<=_;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==s&&nc(a,u,l,h,c,d,v.x,v.y)&&sc(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==s&&nc(a,u,l,h,c,d,b.x,b.y)&&sc(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==s&&nc(a,u,l,h,c,d,v.x,v.y)&&sc(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=_;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==s&&nc(a,u,l,h,c,d,b.x,b.y)&&sc(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Yl(e,t){let i=e;do{const r=i.prev,n=i.next.next;!ac(r,n)&&lc(r,i,i.next,n)&&hc(r,n)&&hc(n,r)&&(t.push(r.i,i.i,n.i),fc(i),fc(i.next),i=e=n),i=i.next}while(i!==e);return Zl(i)}function Jl(e,t,i,r,n,o){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&oc(s,e)){let a=dc(s,e);return s=Zl(s,s.next),a=Zl(a,a.next),Wl(s,t,i,r,n,o,0),void Wl(a,t,i,r,n,o,0)}e=e.next}s=s.next}while(s!==e)}function Kl(e,t){let i=e.x-t.x;return 0===i&&(i=e.y-t.y,0===i)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function Ql(e,t){const i=function(e,t){let i=t;const r=e.x,n=e.y;let o,s=-1/0;if(ac(e,i))return i;do{if(ac(e,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const e=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>s&&(s=e,o=i.x<i.next.x?i:i.next,e===r))return o}i=i.next}while(i!==t);if(!o)return null;const a=o,l=o.x,c=o.y;let u=1/0;i=o;do{if(r>=i.x&&i.x>=l&&r!==i.x&&rc(n<c?r:s,n,l,c,n<c?s:r,n,i.x,i.y)){const t=Math.abs(n-i.y)/(r-i.x);hc(i,e)&&(t<u||t===u&&(i.x>o.x||i.x===o.x&&ec(o,i)))&&(o=i,u=t)}i=i.next}while(i!==a);return o}(e,t);if(!i)return t;const r=dc(i,e);return Zl(r,r.next),Zl(i,i.next)}function ec(e,t){return sc(e.prev,e,t.prev)<0&&sc(t.next,e,e.next)<0}function tc(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ic(e){let t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function rc(e,t,i,r,n,o,s,a){return(n-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(r-a)>=(i-s)*(t-a)&&(i-s)*(o-a)>=(n-s)*(r-a)}function nc(e,t,i,r,n,o,s,a){return!(e===s&&t===a)&&rc(e,t,i,r,n,o,s,a)}function oc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&lc(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(hc(e,t)&&hc(t,e)&&function(e,t){let i=e,r=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(sc(e.prev,e,t.prev)||sc(e,t.prev,t))||ac(e,t)&&sc(e.prev,e,e.next)>0&&sc(t.prev,t,t.next)>0)}function sc(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function ac(e,t){return e.x===t.x&&e.y===t.y}function lc(e,t,i,r){const n=uc(sc(e,t,i)),o=uc(sc(e,t,r)),s=uc(sc(i,r,e)),a=uc(sc(i,r,t));
vendor: 12,077 bytes, line 2
2return n!==o&&s!==a||!(0!==n||!cc(e,i,t))||!(0!==o||!cc(e,r,t))||!(0!==s||!cc(i,e,r))||!(0!==a||!cc(i,t,r))}function cc(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function uc(e){return e>0?1:e<0?-1:0}function hc(e,t){return sc(e.prev,e,e.next)<0?sc(e,t,e.next)>=0&&sc(e,e.prev,t)>=0:sc(e,t,e.prev)<0||sc(e,e.next,t)<0}function dc(e,t){const i=mc(e.i,e.x,e.y),r=mc(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function pc(e,t,i,r){const n=mc(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function fc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function mc(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class gc{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){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class yc{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}yc.noSubdivision=new yc({fill:new gc(0,0),line:new gc(0,0),tile:new gc(0,0),stencil:new gc(0,0),circle:1}),fo("SubdivisionGranularityExpression",gc),fo("SubdivisionGranularitySetting",yc);const _c=-32768,vc=32767;class bc{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=M/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|t+32768}_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.");const i=0|Math.round(e),r=0|Math.round(t),n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(i,r),o}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){const i=[];for(let r=0;r<t.length;r+=3){const n=t[r],o=t[r+1],s=t[r+2],a=e[2*n],l=e[2*n+1];(e[2*o]-a)*(e[2*s+1]-l)-(e[2*o+1]-l)*(e[2*s]-a)>0?(i.push(n),i.push(s),i.push(o)):(i.push(n),i.push(o),i.push(s))}return i}(this._vertexBuffer,e);const t=[],i=e.length;for(let r=0;r<i;r+=3){const i=[e[r+0],e[r+1],e[r+2]],n=[this._vertexBuffer[2*e[r+0]+0],this._vertexBuffer[2*e[r+0]+1],this._vertexBuffer[2*e[r+1]+0],this._vertexBuffer[2*e[r+1]+1],this._vertexBuffer[2*e[r+2]+0],this._vertexBuffer[2*e[r+2]+1]];let o=1/0,s=1/0,a=-1/0,l=-1/0;for(let e=0;e<3;e++){const t=n[2*e],i=n[2*e+1];o=Math.min(o,t),a=Math.max(a,t),s=Math.min(s,i),l=Math.max(l,i)}if(o===a||s===l)continue;const c=Math.floor(o/this._granularityCellSize),u=Math.ceil(a/this._granularityCellSize),h=Math.floor(s/this._granularityCellSize),d=Math.ceil(l/this._granularityCellSize);if(c!==u||h!==d)for(let e=h;e<d;e++){const r=this._scanlineGenerateVertexRingForCellRow(e,n,i);Tc(this._vertexBuffer,r,t)}else t.push(...i)}return t}_scanlineGenerateVertexRingForCellRow(e,t,i){const r=e*this._granularityCellSize,n=r+this._granularityCellSize,o=[];for(let e=0;e<3;e++){const s=t[2*e],a=t[2*e+1],l=t[2*(e+1)%6],c=t[(2*(e+1)+1)%6],u=t[2*(e+2)%6],h=t[(2*(e+2)+1)%6],d=l-s,p=c-a,f=0===d,m=0===p,g=(r-a)/p,y=(n-a)/p,_=Math.min(g,y),v=Math.max(g,y);if(!m&&(_>=1||v<=0)||m&&(a<r||a>n)){c>=r&&c<=n&&o.push(i[(e+1)%3]);continue}!m&&_>0&&o.push(this._vertexToIndex(s+d*_,a+p*_));const b=s+d*Math.max(_,0),x=s+d*Math.min(v,1);f||this._generateIntraEdgeVertices(o,s,a,l,c,b,x),!m&&v<1&&o.push(this._vertexToIndex(s+d*v,a+p*v)),(m||c>=r&&c<=n)&&o.push(i[(e+1)%3]),!m&&(c<=r||c>=n)&&this._generateInterEdgeVertices(o,s,a,l,c,u,h,x,r,n)}return o}_generateIntraEdgeVertices(e,t,i,r,n,o,s){const a=r-t,l=n-i,c=0===l,u=c?Math.min(t,r):Math.min(o,s),h=c?Math.max(t,r):Math.max(o,s),d=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(h/this._granularityCellSize)-1;if(c?t<r:o<s)for(let r=d;r<=p;r++){const n=r*this._granularityCellSize;e.push(this._vertexToIndex(n,i+l*(n-t)/a))}else for(let r=p;r>=d;r--){const n=r*this._granularityCellSize;e.push(this._vertexToIndex(n,i+l*(n-t)/a))}}_generateInterEdgeVertices(e,t,i,r,n,o,s,a,l,c){const u=n-i,h=o-r,d=s-n,p=(l-n)/d,f=(c-n)/d,m=Math.min(p,f),g=Math.max(p,f),y=r+h*m;let _=Math.floor(Math.min(y,a)/this._granularityCellSize)+1,v=Math.ceil(Math.max(y,a)/this._granularityCellSize)-1,b=a<y;const x=0===d;if(x&&(s===l||s===c))return;if(x||m>=1||g<=0){const e=i-s,r=o+(t-o)*Math.min((l-s)/e,(c-s)/e);_=Math.floor(Math.min(r,a)/this._granularityCellSize)+1,v=Math.ceil(Math.max(r,a)/this._granularityCellSize)-1,b=a<r}const w=u>0?c:l;if(b)for(let t=_;t<=v;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,w));else for(let t=v;t>=_;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,w))}_generateOutline(e){const t=[];for(const i of e){const e=wc(i,this._granularity,!0),r=this._pointArrayToIndices(e),n=[];for(let e=1;e<r.length;e++)n.push(r[e-1]),n.push(r[e]);t.push(n)}return t}_handlePoles(e){let t=!1,i=!1;this._canonical&&(0===this._canonical.y&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(t||i)&&this._fillPoles(e,t,i)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){const i=e[t+1];i===_c&&(e[t+1]=-32767),i===vc&&(e[t+1]=32766)}}_generatePoleQuad(e,t,i,r,n,o){r>n!=(o===_c)?(e.push(t),e.push(i),e.push(this._vertexToIndex(r,o)),e.push(i),e.push(this._vertexToIndex(n,o)),e.push(this._vertexToIndex(r,o))):(e.push(i),e.push(t),e.push(this._vertexToIndex(r,o)),e.push(this._vertexToIndex(n,o)),e.push(i),e.push(this._vertexToIndex(r,o)))}_fillPoles(e,t,i){const r=this._vertexBuffer,n=M,o=e.length;for(let s=2;s<o;s+=3){const o=e[s-2],a=e[s-1],l=e[s],c=r[2*o],u=r[2*o+1],h=r[2*a],d=r[2*a+1],p=r[2*l],f=r[2*l+1];t&&(0===u&&0===d&&this._generatePoleQuad(e,o,a,c,h,_c),0===d&&0===f&&this._generatePoleQuad(e,a,l,h,p,_c),0===f&&0===u&&this._generatePoleQuad(e,l,o,p,c,_c)),i&&(u===n&&d===n&&this._generatePoleQuad(e,o,a,c,h,vc),d===n&&f===n&&this._generatePoleQuad(e,a,l,h,p,vc),f===n&&u===n&&this._generatePoleQuad(e,l,o,p,c,vc))}}_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;const{flattened:i,holeIndices:r}=function(e){const t=[],i=[];for(const r of e)if(0!==r.length){r!==e[0]&&t.push(i.length/2);for(const e of r)i.push(e.x),i.push(e.y)}return{flattened:i,holeIndices:t}}(e);let n;this._initializeVertices(i);try{const e=function(e,t,i=2){const r=t&&t.length,n=r?t[0]*i:e.length;let o=ql(e,0,n,i,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c;if(r&&(o=function(e,t,i,r){const n=[];for(let i=0,o=t.length;i<o;i++){const s=ql(e,t[i]*r,i<o-1?t[i+1]*r:e.length,r,!1);s===s.next&&(s.steiner=!0),n.push(ic(s))}n.sort(Kl);for(let e=0;e<n.length;e++)i=Ql(n[e],i);return i}(e,t,o,i)),e.length>80*i){a=e[0],l=e[1];let t=a,r=l;for(let o=i;o<n;o+=i){const i=e[o],n=e[o+1];i<a&&(a=i),n<l&&(l=n),i>t&&(t=i),n>r&&(r=n)}c=Math.max(t-a,r-l),c=0!==c?32767/c:0}return Wl(o,s,i,a,l,c,0),s}(i,r),t=this._convertIndices(i,e);n=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let o=[];return t&&(o=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(e,t){const i=[];for(const r of t)i.push(this._vertexToIndex(e[2*r],e[2*r+1]));return i}_pointArrayToIndices(e){const t=[];for(const i of e)t.push(this._vertexToIndex(i.x,i.y));return t}}function xc(e,t,i,r=!0){return new bc(i,t).subdividePolygonInternal(e,r)}function wc(e,t,r=!1){if(!e||e.length<1)return[];if(e.length<2)return[];const n=e[0],o=e[e.length-1],s=r&&(n.x!==o.x||n.y!==o.y);if(t<2)return s?[...e,e[0]]:[...e];const a=Math.floor(M/t),l=[];l.push(new i(e[0].x,e[0].y));const c=e.length,u=s?c:c-1;for(let t=0;t<u;t++){const r=e[t],n=t<c-1?e[t+1]:e[0],o=r.x,s=r.y,u=n.x,h=n.y,d=o!==u,p=s!==h;if(!d&&!p)continue;const f=u-o,m=h-s,g=Math.abs(f),y=Math.abs(m);let _=o,v=s;for(;;){const e=f>0?(Math.floor(_/a)+1)*a:(Math.ceil(_/a)-1)*a,t=m>0?(Math.floor(v/a)+1)*a:(Math.ceil(v/a)-1)*a,r=Math.abs(_-e),n=Math.abs(v-t),o=Math.abs(_-u),s=Math.abs(v-h),c=d?r/g:Number.POSITIVE_INFINITY,b=p?n/y:Number.POSITIVE_INFINITY;if((o<=r||!d)&&(s<=n||!p))break;if(c<b&&d||!p){_=e,v+=m*c;const t=new i(_,Math.round(v));l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t)}else{_+=f*b,v=t;const e=new i(Math.round(_),v);l[l.length-1].x===e.x&&l[l.length-1].y===e.y||l.push(e)}}const b=new i(u,h);l[l.length-1].x===b.x&&l[l.length-1].y===b.y||l.push(b)}return l}function Tc(e,t,i){if(0===t.length)throw new Error("Subdivision vertex ring is empty.");let r=0,n=e[2*t[0]];for(let i=1;i<t.length;i++){const o=e[2*t[i]];o<n&&(n=o,r=i)}const o=t.length;let s=r,a=(s+1)%o;for(;;){const r=s-1>=0?s-1:o-1,n=(a+1)%o,l=e[2*t[r]],c=e[2*t[n]],u=e[2*t[s]],h=e[2*t[s]+1],d=e[2*t[a]+1];let p=!1;if(l<c)p=!0;else if(l>c)p=!1;else{const i=d-h,o=-(e[2*t[a]]-u),s=h<d?1:-1;((l-u)*i+(e[2*t[r]+1]-h)*o)*s>((c-u)*i+(e[2*t[n]+1]-h)*o)*s&&(p=!0)}if(p){const e=t[r],n=t[s],l=t[a];e!==n&&e!==l&&n!==l&&i.push(l,n,e),s--,s<0&&(s=o-1)}else{const e=t[n],r=t[s],l=t[a];e!==r&&e!==l&&r!==l&&i.push(l,r,e),a++,a>=o&&(a=0)}if(r===n)break}}function Ec(e,t,i,r,n,o,s,a,l){const c=n.length/2,u=s&&a&&l;if(c<la.MAX_VERTEX_ARRAY_LENGTH){const h=t.prepareSegment(c,i,r),d=h.vertexLength;for(let e=0;e<o.length;e+=3)r.emplaceBack(d+o[e],d+o[e+1],d+o[e+2]);let p,f;h.vertexLength+=c,h.primitiveLength+=o.length/3,u&&(f=s.prepareSegment(c,i,a),p=f.vertexLength,f.vertexLength+=c);for(let t=0;t<n.length;t+=2)e(n[t],n[t+1]);if(u)for(const e of l){for(let t=1;t<e.length;t+=2)a.emplaceBack(p+e[t-1],p+e[t]);f.primitiveLength+=e.length/2}}else!function(e,t,i,r,n,o){const s=[];for(let e=0;e<r.length/2;e++)s.push(-1);const a={count:0};let l=0,c=e.getOrCreateLatestSegment(t,i),u=c.vertexLength;for(let h=2;h<n.length;h+=3){const d=n[h-2],p=n[h-1],f=n[h];let m=s[d]<l,g=s[p]<l,y=s[f]<l;c.vertexLength+((m?1:0)+(g?1:0)+(y?1:0))>la.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,i),l=a.count,m=!0,g=!0,y=!0,u=0);const _=Sc(s,r,o,a,d,m,c),v=Sc(s,r,o,a,p,g,c),b=Sc(s,r,o,a,f,y,c);i.emplaceBack(u+_-l,u+v-l,u+b-l),c.primitiveLength++}}(t,i,r,n,o,e),u&&function(e,t,i,r,n,o){const s=[];for(let e=0;e<r.length/2;e++)s.push(-1);const a={count:0};let l=0,c=e.getOrCreateLatestSegment(t,i),u=c.vertexLength;for(const h of n)for(let n=1;n<h.length;n+=2){const d=h[n-1],p=h[n];let f=s[d]<l,m=s[p]<l;c.vertexLength+((f?1:0)+(m?1:0))>la.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,i),l=a.count,f=!0,m=!0,u=0);const g=Sc(s,r,o,a,d,f,c),y=Sc(s,r,o,a,p,m,c);i.emplaceBack(u+g-l,u+y-l),c.primitiveLength++}}(s,i,a,n,l,e),t.forceNewSegmentOnNextPrepare(),null==s||s.forceNewSegmentOnNextPrepare()}function Sc(e,t,i,r,n,o,s){if(o){const o=r.count;return i(t[2*n],t[2*n+1]),e[n]=r.count,r.count++,s.vertexLength++,o}return e[n]}class Pc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new Ws,this.indexArray=new na,this.indexArray2=new oa,this.programConfigurations=new Na(e.layers,e.zoom),this.segments=new la,this.segments2=new la,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.hasDependencies=Gl("fill",this.layers,t);const r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=$a(s,e);if(!this.layers[0]._featureFilter.filter(new Oo(this.zoom),u,i))continue;const h=n?r.evaluate(u,{},i,t.availableImages):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:Ga(s),patterns:{},sortKey:h};o.push(d)}n&&o.sort(((e,t)=>
2e.sortKey-t.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:s}=r;if(this.hasDependencies){const e=$l("fill",this.layers,r,{zoom:this.zoom},t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i})}addFeatures(e,t,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ul),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,i,r,n,o){for(const e of tr(t,500)){const t=xc(e,r,o.fill.getGranularityForZoomLevel(r.z)),i=this.layoutVertexArray;Ec(((e,t)=>{i.emplaceBack(e,t)}),this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:n,canonical:r})}}let Ic,Cc;fo("FillBucket",Pc,{omit:["layers","patternFeatures"]});var Mc={get paint(){return Cc=Cc||new Jo({"fill-antialias":new Zo(xe.paint_fill["fill-antialias"]),"fill-opacity":new Wo(xe.paint_fill["fill-opacity"]),"fill-color":new Wo(xe.paint_fill["fill-color"]),"fill-outline-color":new Wo(xe.paint_fill["fill-outline-color"]),"fill-translate":new Zo(xe.paint_fill["fill-translate"]),"fill-translate-anchor":new Zo(xe.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ho(xe.paint_fill["fill-pattern"])})},get layout(){return Ic=Ic||new Jo({"fill-sort-key":new Wo(xe.layout_fill["fill-sort-key"])})}};class Ac extends es{constructor(e,t){super(e,Mc,t)}recalculate(e,t){super.recalculate(e,t);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Pc(e)}queryRadius(){return sl(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){return Ya(al(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),t)}isTileClipped(){return!0}}const Lc=as([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Fc=as([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Dc}=Lc;class kc{constructor(e,t,i,r,n){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=n,e.readFields(Oc,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,r=[];let n,o=1,s=0,a=0,l=0;for(;e.pos<t;){if(s<=0){const t=e.readVarint();o=7&t,s=t>>3}if(s--,1===o||2===o)a+=e.readSVarint(),l+=e.readSVarint(),1===o&&(n&&r.push(n),n=[]),n&&n.push(new i(a,l));else{if(7!==o)throw new Error(`unknown command ${o}`);n&&n.push(n[0].clone())}}return n&&r.push(n),r}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let i=1,r=0,n=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;for(;e.pos<t;){if(r<=0){const t=e.readVarint();i=7&t,r=t>>3}if(r--,1===i||2===i)n+=e.readSVarint(),o+=e.readSVarint(),n<s&&(s=n),n>a&&(a=n),o<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error(`unknown command ${i}`)}return[s,l,a,c]}toGeoJSON(e,t,i){const r=this.extent*Math.pow(2,i),n=this.extent*e,o=this.extent*t,s=this.loadGeometry();function a(e){return[360*(e.x+n)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+o)/r)*Math.PI))-90]}function l(e){return e.map(a)}let c;if(1===this.type){const e=[];for(const t of s)e.push(t[0]);const t=l(e);c=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=s.map(l);c=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=Rc(s),t=[];for(const i of e)t.push(i.map(l));c=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}const u={type:"Feature",geometry:c,properties:this.properties};return null!=this.id&&(u.id=this.id),u}}function Oc(e,t,i){1===e?t.id=i.readVarint():2===e?function(e,t){const i=e.readVarint()+e.pos;for(;e.pos<i;){const i=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[i]=r}}(i,t):3===e?t.type=i.readVarint():4===e&&(t._geometry=i.pos)}function Rc(e){const t=e.length;if(t<=1)return[e];const i=[];let r,n;for(let o=0;o<t;o++){const t=zc(e[o]);0!==t&&(void 0===n&&(n=t<0),n===t<0?(r&&i.push(r),r=[e[o]]):r&&r.push(e[o]))}return r&&i.push(r),i}function zc(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n<o;s=n++)i=e[n],r=e[s],t+=(r.x-i.x)*(i.y+r.y);return t}kc.types=["Unknown","Point","LineString","Polygon"];class Nc{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Bc,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new kc(this._pbf,t,this.extent,this._keys,this._values)}}function Bc(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){let t=null;const i=e.readVarint()+e.pos;for(;e.pos<i;){const i=e.readVarint()>>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}if(null==t)throw new Error("unknown feature value");return t}(i))}class Vc{constructor(e,t){this.layers=e.readFields(jc,{},t)}}function jc(e,t,i){if(3===e){const e=new Nc(i,i.readVarint()+i.pos);e.length&&(t[e.name]=e)}}const Uc=Math.pow(2,13);function Gc(e,t,i,r,n,o,s,a){e.emplaceBack(t,i,2*Math.floor(r*Uc)+s,n*Uc*2,o*Uc*2,Math.round(a))}class $c{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Hs,this.centroidVertexArray=new qs,this.indexArray=new na,this.programConfigurations=new Na(e.layers,e.zoom),this.segments=new la,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.features=[],this.hasDependencies=Gl("fill-extrusion",this.layers,t);for(const{feature:r,id:n,index:o,sourceLayerIndex:s}of e){const e=this.layers[0]._featureFilter.needGeometry,a=$a(r,e);if(!this.layers[0]._featureFilter.filter(new Oo(this.zoom),a,i))continue;const l={id:n,sourceLayerIndex:s,index:o,geometry:e?a.geometry:Ga(r),properties:r.properties,type:r.type,patterns:{}};this.hasDependencies?this.features.push($l("fill-extrusion",this.layers,l,{zoom:this.zoom},t)):this.addFeature(l,l.geometry,o,i,{},t.subdivisionGranularity),t.featureIndex.insert(r,l.geometry,o,s,this.index,!0)}}addFeatures(e,t,i){for(const r of this.features){const{geometry:n}=r;
vendor: 8,584 bytes, line 2
2this.addFeature(r,n,r.index,t,i,e.subdivisionGranularity)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Dc),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Fc.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,i,r,n,o){for(const i of tr(t,500)){const t={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(t,r,e,i,o);const s=this.layoutVertexArray.length-n,a=Math.floor(t.x/t.sampleCount),l=Math.floor(t.y/t.sampleCount);for(let e=0;e<s;e++)this.centroidVertexArray.emplaceBack(a,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:n,canonical:r})}processPolygon(e,t,i,r,n){if(r.length<1)return;if(Wc(r[0]))return;for(const t of r)0!==t.length&&qc(e,t);const o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=n.fill.getGranularityForZoomLevel(t.z),a="Polygon"===kc.types[i.type];for(const e of r){if(0===e.length)continue;if(Wc(e))continue;const t=wc(e,s,a);this._generateSideFaces(t,o)}if(!a)return;const l=xc(r,t,s,!1),c=this.layoutVertexArray;Ec(((e,t)=>{Gc(c,e,t,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let i=0;for(let r=1;r<e.length;r++){const n=e[r],o=e[r-1];if(Zc(n,o))continue;t.segment.vertexLength+4>la.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const s=n.sub(o)._perp()._unit(),a=o.dist(n);i+a>32768&&(i=0),Gc(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,i),Gc(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,i),i+=a,Gc(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,i),Gc(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,i);const l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}}function qc(e,t){for(let i=0;i<t.length;i++){const r=t[i];i===t.length-1&&t[0].x===r.x&&t[0].y===r.y||(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}function Zc(e,t){return e.x===t.x&&(e.x<0||e.x>M)||e.y===t.y&&(e.y<0||e.y>M)}function Wc(e){return e.every((e=>e.x<0))||e.every((e=>e.x>M))||e.every((e=>e.y<0))||e.every((e=>e.y>M))}let Hc;fo("FillExtrusionBucket",$c,{omit:["layers","features"]});var Xc={get paint(){return Hc=Hc||new Jo({"fill-extrusion-opacity":new Zo(xe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Wo(xe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Zo(xe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Zo(xe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ho(xe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Wo(xe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Wo(xe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Zo(xe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Yc extends es{constructor(e,t){super(e,Xc,t)}createBucket(e){return new $c(e)}queryRadius(){return sl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:n,transform:o,pixelsToTileUnits:s,pixelPosMatrix:a}){const l=al(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,s),c=this.paint.get("fill-extrusion-height").evaluate(t,r),u=this.paint.get("fill-extrusion-base").evaluate(t,r),h=function(e,t){const r=[];for(const n of e){const e=[n.x,n.y,0,1];E(e,e,t),r.push(new i(e[0]/e[3],e[1]/e[3]))}return r}(l,a),d=function(e,t,r,n){const o=[],s=[],a=n[8]*t,l=n[9]*t,c=n[10]*t,u=n[11]*t,h=n[8]*r,d=n[9]*r,p=n[10]*r,f=n[11]*r;for(const t of e){const e=[],r=[];for(const o of t){const t=o.x,s=o.y,m=n[0]*t+n[4]*s+n[12],g=n[1]*t+n[5]*s+n[13],y=n[2]*t+n[6]*s+n[14],_=n[3]*t+n[7]*s+n[15],v=y+c,b=_+u,x=m+h,w=g+d,T=y+p,E=_+f,S=new i((m+a)/b,(g+l)/b);S.z=v/b,e.push(S);const P=new i(x/E,w/E);P.z=T/E,r.push(P)}o.push(e),s.push(r)}return[o,s]}(n,u,c,a);return function(e,t,i){let r=1/0;Ya(i,t)&&(r=Kc(i,t[0]));for(let n=0;n<t.length;n++){const o=t[n],s=e[n];for(let e=0;e<o.length-1;e++){const t=o[e],n=[t,o[e+1],s[e+1],s[e],t];Ha(i,n)&&(r=Math.min(r,Kc(i,n)))}}return r!==1/0&&r}(d[0],d[1],h)}}function Jc(e,t){return e.x*t.x+e.y*t.y}function Kc(e,t){if(1===e.length){let i=0;const r=t[i++];let n;for(;!n||r.equals(n);)if(n=t[i++],!n)return 1/0;for(;i<t.length;i++){const o=t[i],s=e[0],a=n.sub(r),l=o.sub(r),c=s.sub(r),u=Jc(a,a),h=Jc(a,l),d=Jc(l,l),p=Jc(c,a),f=Jc(c,l),m=u*d-h*h,g=(d*p-h*f)/m,y=(u*f-h*p)/m,_=r.z*(1-g-y)+n.z*g+o.z*y;if(isFinite(_))return _}return 1/0}{let e=1/0;for(const i of t)e=Math.min(e,i.z);return e}}const Qc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class eu{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=Qc[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new eu(s,o,n,e)}constructor(e,t=64,i=Float64Array,r){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=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=Qc.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return tu(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:s}=this,a=[0,n.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=s){for(let s=h;s<=u;s++){const a=o[2*s],c=o[2*s+1];a>=e&&a<=i&&c>=t&&c<=r&&l.push(n[s])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=i&&f>=t&&f<=r&&l.push(n[d]),(0===c?e<=p:t<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?i>=p:r>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,s=[0,r.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=o){for(let i=h;i<=u;i++)ou(n[2*i],n[2*i+1],e,t)<=l&&a.push(r[i]);continue}const d=h+u>>1,p=n[2*d],f=n[2*d+1];ou(p,f,e,t)<=l&&a.push(r[d]),(0===c?e-i<=p:t-i<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?e+i>=p:t+i>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return a}}function tu(e,t,i,r,n,o){if(n-r<=i)return;const s=r+n>>1;iu(e,t,s,r,n,o),tu(e,t,i,r,s-1,1-o),tu(e,t,i,s+1,n,1-o)}function iu(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const s=n-r+1,a=i-r+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);iu(e,t,i,Math.max(r,Math.floor(i-a*c/s+u)),Math.min(n,Math.floor(i+(s-a)*c/s+u)),o)}const s=t[2*i+o];let a=r,l=n;
vendor: 5,190 bytes, line 2
2for(ru(e,t,r,i),t[2*n+o]>s&&ru(e,t,r,n);a<l;){for(ru(e,t,a,l),a++,l--;t[2*a+o]<s;)a++;for(;t[2*l+o]>s;)l--}t[2*r+o]===s?ru(e,t,r,l):(l++,ru(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function ru(e,t,i,r){nu(e,i,r),nu(t,2*i,2*r),nu(t,2*i+1,2*r+1)}function nu(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function ou(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}function su(e,t,i,r){let n=r;const o=t+(i-t>>1);let s,a=i-t;const l=e[t],c=e[t+1],u=e[i],h=e[i+1];for(let r=t+3;r<i;r+=3){const t=au(e[r],e[r+1],l,c,u,h);if(t>n)s=r,n=t;else if(t===n){const e=Math.abs(r-o);e<a&&(s=r,a=e)}}n>r&&(s-t>3&&su(e,t,s,r),e[s+2]=n,i-s>3&&su(e,s,i,r))}function au(e,t,i,r,n,o){let s=n-i,a=o-r;if(0!==s||0!==a){const l=((e-i)*s+(t-r)*a)/(s*s+a*a);l>1?(i=n,r=o):l>0&&(i+=s*l,r+=a*l)}return s=e-i,a=t-r,s*s+a*a}function lu(e,t,i,r){const n={type:t,geom:i},o={id:null==e?null:e,type:n.type,geometry:n.geom,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case"Point":case"MultiPoint":uu(o,n.geom);break;case"LineString":uu(o,n.geom.points);break;case"Polygon":uu(o,n.geom[0].points);break;case"MultiLineString":for(const e of n.geom)uu(o,e.points);break;case"MultiPolygon":for(const e of n.geom)uu(o,e[0].points)}return o}function cu(e){e.points.length>64&&(e.points=new Float64Array(e.points))}function uu(e,t){for(let i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function hu(e,t){const i=[];switch(e.type){case"FeatureCollection":for(let r=0;r<e.features.length;r++)du(i,e.features[r],t,r);break;case"Feature":du(i,e,t);break;default:du(i,{geometry:e,properties:void 0},t)}return i}function du(e,t,i,r){if(!t.geometry)return;if("GeometryCollection"===t.geometry.type)return void function(e,t,i,r,n){for(const o of i.geometries)du(e,{id:t.id,geometry:o,properties:t.properties},r,n)}(e,t,t.geometry,i,r);const n=t.geometry.coordinates;if(!n?.length)return;const o=function(e,t,i){return t.promoteId?e.properties?.[t.promoteId]:t.generateId?i||0:e.id}(t,i,r),s=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);switch(t.geometry.type){case"Point":return void function(e,t,i,r){const n=[];n.push(mu(i.coordinates[0]),gu(i.coordinates[1]),0),e.push(lu(t,"Point",n,r))}(e,o,t.geometry,t.properties);case"MultiPoint":return void function(e,t,i,r){const n=[];for(const e of i.coordinates)n.push(mu(e[0]),gu(e[1]),0);e.push(lu(t,"MultiPoint",n,r))}(e,o,t.geometry,t.properties);case"LineString":return void function(e,t,i,r,n){const o={points:[]};pu(i.coordinates,o,r,!1),e.push(lu(t,"LineString",o,n))}(e,o,t.geometry,s,t.properties);case"MultiLineString":return void function(e,t,i,r,n,o){if(n.lineMetrics)for(const n of i.coordinates){const i={points:[]};pu(n,i,r,!1),e.push(lu(t,"LineString",i,o))}else{const n=[];fu(i.coordinates,n,r,!1),e.push(lu(t,"MultiLineString",n,o))}}(e,o,t.geometry,s,i,t.properties);case"Polygon":return void function(e,t,i,r,n){const o=[];fu(i.coordinates,o,r,!0),e.push(lu(t,"Polygon",o,n))}(e,o,t.geometry,s,t.properties);case"MultiPolygon":return void function(e,t,i,r,n){const o=[];for(const e of i.coordinates){const t=[];fu(e,t,r,!0),o.push(t)}e.push(lu(t,"MultiPolygon",o,n))}(e,o,t.geometry,s,t.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function pu(e,t,i,r){let n,o,s=0;for(let i=0;i<e.length;i++){const a=mu(e[i][0]),l=gu(e[i][1]);t.points.push(a,l,0),i>0&&(s+=r?(n*l-a*o)/2:Math.sqrt(Math.pow(a-n,2)+Math.pow(l-o,2))),n=a,o=l}const a=t.points.length-3;t.points[2]=1,i>0&&su(t.points,0,a,i),t.points[a+2]=1,cu(t),t.size=Math.abs(s),t.start=0,t.end=t.size}function fu(e,t,i,r){for(let n=0;n<e.length;n++){const o={points:[]};pu(e[n],o,i,r),t.push(o)}}function mu(e){return e/360+.5}function gu(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function yu(e){const t={type:"Feature",geometry:_u(e),properties:e.tags};return null!=e.id&&(t.id=e.id),t}function _u(e){const{type:t,geometry:i}=e;switch(t){case"Point":return{type:t,coordinates:bu(i[0],i[1])};case"MultiPoint":return{type:t,coordinates:vu(i)};case"LineString":return{type:t,coordinates:vu(i.points)};case"MultiLineString":case"Polygon":return{type:t,coordinates:i.map((e=>vu(e.points)))};case"MultiPolygon":return{type:t,coordinates:i.map((e=>e.map((e=>vu(e.points)))))}}}function vu(e){const t=[];for(let i=0;i<e.length;i+=3)t.push(bu(e[i],e[i+1]));return t}function bu(e,t){return[xu(e),wu(t)]}function xu(e){return 360*(e-.5)}function wu(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var Tu;function Eu(e,t,i,r,n,o,s,a){if(r/=t,o>=(i/=t)&&s<r)return e;if(s<i||o>=r)return null;const l=[];for(const t of e){const e=n===Tu.X?t.minX:t.minY,o=n===Tu.X?t.maxX:t.maxY;if(e>=i&&o<r)l.push(t);else if(!(o<i||e>=r))switch(t.type){case"Point":case"MultiPoint":Su(t,l,i,r,n);continue;case"LineString":Pu(t,l,i,r,n,a);continue;case"MultiLineString":Iu(t,l,i,r,n);continue;case"Polygon":Cu(t,l,i,r,n);continue;case"MultiPolygon":Mu(t,l,i,r,n);continue}}return l.length?l:null}function Su(e,t,i,r,n){const o=[];(function(e,t,i,r,n){for(let o=0;o<e.length;o+=3){const s=e[o+n];s>=i&&s<=r&&Du(t,e[o],e[o+1],e[o+2])}}
2)(e.geometry,o,i,r,n),o.length&&t.push(lu(e.id,3===o.length?"Point":"MultiPoint",o,e.tags))}function Pu(e,t,i,r,n,o){const s=[];if(Au(e.geometry,s,i,r,n,!1,o.lineMetrics),s.length)if(o.lineMetrics)for(const i of s)t.push(lu(e.id,"LineString",i,e.tags));else t.push(s.length>1?lu(e.id,"MultiLineString",s,e.tags):lu(e.id,"LineString",s[0],e.tags))}function Iu(e,t,i,r,n){const o=[];Fu(e.geometry,o,i,r,n,!1),o.length&&t.push(1!==o.length?lu(e.id,"MultiLineString",o,e.tags):lu(e.id,"LineString",o[0],e.tags))}function Cu(e,t,i,r,n){const o=[];Fu(e.geometry,o,i,r,n,!0),o.length&&t.push(lu(e.id,"Polygon",o,e.tags))}function Mu(e,t,i,r,n){const o=[];for(const t of e.geometry){const e=[];Fu(t,e,i,r,n,!0),e.length&&o.push(e)}o.length&&t.push(lu(e.id,"MultiPolygon",o,e.tags))}function Au(e,t,i,r,n,o,s){let a=Lu(e);const l=n===Tu.X?ku:Ou;let c,u,h=e.start;for(let d=0;d<e.points.length-3;d+=3){const p=e.points[d],f=e.points[d+1],m=e.points[d+2],g=e.points[d+3],y=e.points[d+4],_=n===Tu.X?p:f,v=n===Tu.X?g:y;let b=!1;s&&(c=Math.sqrt(Math.pow(p-g,2)+Math.pow(f-y,2))),_<i?v>i&&(u=l(a,p,f,g,y,i),s&&(a.start=h+c*u)):_>r?v<r&&(u=l(a,p,f,g,y,r),s&&(a.start=h+c*u)):Du(a.points,p,f,m),v<i&&_>=i&&(u=l(a,p,f,g,y,i),b=!0),v>r&&_<=r&&(u=l(a,p,f,g,y,r),b=!0),!o&&b&&(s&&(a.end=h+c*u),t.push(a),a=Lu(e)),s&&(h+=c)}let d=e.points.length-3;const p=e.points[d],f=e.points[d+1],m=n===Tu.X?p:f;m>=i&&m<=r&&Du(a.points,p,f,e.points[d+2]),d=a.points.length-3,o&&d>=3&&(a.points[d]!==a.points[0]||a.points[d+1]!==a.points[1])&&Du(a.points,a.points[0],a.points[1],a.points[2]),a.points.length&&(cu(a),t.push(a))}function Lu(e){return{points:[],size:e.size,start:e.start,end:e.end}}function Fu(e,t,i,r,n,o){for(const s of e)Au(s,t,i,r,n,o,!1)}function Du(e,t,i,r){e.push(t,i,r)}function ku(e,t,i,r,n,o){const s=(o-t)/(r-t);return Du(e.points,o,i+(n-i)*s,1),s}function Ou(e,t,i,r,n,o){const s=(o-i)/(n-i);return Du(e.points,t+(r-t)*s,o,1),s}function Ru(e,t){const i=t.buffer/t.extent;let r=e;const n=Eu(e,1,-1-i,i,Tu.X,-1,2,t),o=Eu(e,1,1-i,2+i,Tu.X,-1,2,t);return n||o?(r=Eu(e,1,-i,1+i,Tu.X,-1,2,t)||[],n&&(r=zu(n,1).concat(r)),o&&(r=r.concat(zu(o,-1))),r):r}function zu(e,t){const i=[];for(const r of e)switch(r.type){case"Point":case"MultiPoint":{const e=Nu(r.geometry,t);i.push(lu(r.id,r.type,e,r.tags));continue}case"LineString":{const e=Bu(r.geometry,t);i.push(lu(r.id,r.type,e,r.tags));continue}case"MultiLineString":case"Polygon":{const e=[];for(const i of r.geometry)e.push(Bu(i,t));i.push(lu(r.id,r.type,e,r.tags));continue}case"MultiPolygon":{const e=[];for(const i of r.geometry){const r=[];for(const e of i)r.push(Bu(e,t));e.push(r)}i.push(lu(r.id,r.type,e,r.tags));continue}}return i}function Nu(e,t){const i=[];for(let r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function Bu(e,t){const i={points:[],size:e.size};void 0!==e.start&&(i.start=e.start,i.end=e.end);for(let r=0;r<e.points.length;r+=3)i.points.push(e.points[r]+t,e.points[r+1],e.points[r+2]);return cu(i),i}function Vu(e,t,i){const r=!!t.newGeometry,n=t.removeAllProperties||t.removeProperties?.length>0||t.addOrUpdateProperties?.length>0;if(r){const r=e[0];let o=hu({type:"FeatureCollection",features:[{type:"Feature",id:r.id,geometry:t.newGeometry,properties:n?ju(r.tags,t):r.tags}]},i);return o=Ru(o,i),o}if(n){const i=[];for(const r of e){const e={...r};e.tags=ju(e.tags,t),i.push(e)}return i}return e}function ju(e,t){if(t.removeAllProperties)return{};const i={...e||{}};if(t.removeProperties)for(const e of t.removeProperties)delete i[e];if(t.addOrUpdateProperties)for(const{key:e,value:r}of t.addOrUpdateProperties)i[e]=r;return i}!function(e){e[e.X=0]="X",e[e.Y=1]="Y"}(Tu||(Tu={}));const Uu={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e};class Gu{constructor(e){this.options=Object.assign(Object.create(Uu),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){const t=[];for(const i of e){if(!i.geometry)continue;const[e,r]=i.geometry.coordinates,[n,o]=[mu(e),gu(r)];t.push({id:i.id,type:"Point",geometry:[n,o],tags:i.properties})}this.createIndex(t)}initialize(e){const t=[];for(const i of e)"Point"===i.type&&t.push(i);this.createIndex(t)}updateIndex(e,t,i){this.options=Object.assign(Object.create(Uu),i.clusterOptions),this.initialize(e)}createIndex(e){const{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i?.geometry)continue;let[r,n]=i.geometry;r=Math.fround(r),n=Math.fround(n),o.push(r,n,1/0,t,-1,1),this.options.reduce&&o.push(0)}let s=this.trees[r+1]=this.createTree(o);t&&console.timeEnd(n);for(let e=r;e>=i;e--){const i=Date.now();s=this.trees[e]=this.createTree(this.cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,Date.now()-i)}
vendor: 10,382 bytes, line 2
2t&&console.timeEnd("total time")}getClusters(e,t){return this.getClustersInternal(e,t).map((e=>yu(e)))}getClustersInternal(e,t){let i=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){const e=this.getClustersInternal([i,r,180,o],t),s=this.getClustersInternal([-180,r,n,o],t);return e.concat(s)}const s=this.trees[this.limitZoom(t)],a=s.range(mu(i),gu(o),mu(n),gu(r)),l=s.flatData,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+5]>1?$u(l,t,this.clusterProps):this.points[l[t+3]])}return c}getChildren(e){const t=this.getOriginId(e),i=this.getOriginZoom(e),r=new Error("No cluster with the specified id: "+e),n=this.trees[i];if(!n)throw r;const o=n.flatData;if(t*this.stride>=o.length)throw r;const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=n.within(o[t*this.stride],o[t*this.stride+1],s),l=[];for(const t of a){const i=t*this.stride;o[i+4]===e&&l.push(o[i+5]>1?qu(o,i,this.clusterProps):yu(this.points[o[i+3]]))}if(0===l.length)throw r;return l}getLeaves(e,t,i){const r=[];return this.appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){const r=this.trees[this.limitZoom(e)];if(!r)return null;const n=Math.pow(2,e),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/n,c=(i+1+a)/n,u={transformed:!0,features:[],source:null,x:t,y:i,z:e};return this.addTileFeatures(r.range((t-a)/n,l,(t+1+a)/n,c),r.flatData,t,i,n,u),0===t&&this.addTileFeatures(r.range(1-a/n,l,1,c),r.flatData,n,i,n,u),t===n-1&&this.addTileFeatures(r.range(0,l,a/n,c),r.flatData,-1,i,n,u),u}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,t,i,r,n){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o?.cluster?n+o.point_count<=r?n+=o.point_count:n=this.appendLeaves(e,o.cluster_id,i,r,n):n<r?n++:e.push(t),e.length===i)break}return n}createTree(e){const t=new eu(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.flatData=e,t.data=null,t}addTileFeatures(e,t,i,r,n,o){for(const s of e){const e=s*this.stride,a=t[e+5]>1;let l,c,u;if(a)l=Zu(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+3]];l=i.tags,[c,u]=i.geometry}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(u*n-r))]],tags:l};let d;d=a||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==d&&(h.id=d),o.features.push(h)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,t){const{radius:i,extent:r,reduce:n,minPoints:o}=this.options,s=i/(r*Math.pow(2,t)),a=e.flatData,l=[],c=this.stride;for(let i=0;i<a.length;i+=c){if(a[i+2]<=t)continue;a[i+2]=t;const r=a[i],u=a[i+1],h=e.within(a[i],a[i+1],s),d=a[i+5];let p=d;for(const e of h){const i=e*c;a[i+2]>t&&(p+=a[i+5])}if(p>d&&p>=o){let e,o=r*d,s=u*d,f=-1;const m=(i/c<<5)+(t+1)+this.points.length;for(const r of h){const l=r*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+5];o+=a[l]*u,s+=a[l+1]*u,a[l+4]=m,n&&(e||(e=this.map(a,i,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,this.map(a,l)))}a[i+4]=m,l.push(o/p,s/p,1/0,m,-1,p),n&&l.push(f)}else{for(let e=0;e<c;e++)l.push(a[i+e]);if(p>1)for(const e of h){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e<c;e++)l.push(a[i+e])}}}}return l}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,t,i){if(e[t+5]>1){const r=this.clusterProps[e[t+6]];return i?Object.assign({},r):r}const r=this.points[e[t+3]].tags,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function $u(e,t,i){return{id:e[t+3],type:"Point",tags:Zu(e,t,i),geometry:[e[t],e[t+1]]}}function qu(e,t,i){return{type:"Feature",id:e[t+3],properties:Zu(e,t,i),geometry:{type:"Point",coordinates:[xu(e[t]),wu(e[t+1])]}}}function Zu(e,t,i){const r=e[t+5],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+6],s=-1===o?{}:Object.assign({},i[o]);return Object.assign(s,{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:n})}const Wu="geojsonvt_clip_start",Hu="geojsonvt_clip_end";function Xu(e,t,i,r,n){const o=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),s={transformed:!1,features:[],source:null,x:i,y:r,z:t,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:e.length};for(const t of e)Yu(s,t,o,n);return s}function Yu(e,t,i,r){switch(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),t.type){case"Point":case"MultiPoint":return void function(e,t){const i=[];for(let r=0;r<t.geometry.length;r+=3)i.push(t.geometry[r],t.geometry[r+1]),e.numPoints++,e.numSimplified++;if(!i.length)return;const r={type:1,tags:t.tags||null,geometry:i};null!==t.id&&(r.id=t.id),e.features.push(r)}(e,t);case"LineString":return void function(e,t,i,r){const n=[];if(Ju(n,t.geometry,e,i,!1,!1),!n.length)return;let o=t.tags||null;if(r.lineMetrics){o={};for(const e in t.tags)o[e]=t.tags[e];o[Wu]=t.geometry.start/t.geometry.size,o[Hu]=t.geometry.end/t.geometry.size}const s={type:2,tags:o,geometry:n};null!==t.id&&(s.id=t.id),e.features.push(s)}(e,t,i,r);case"MultiLineString":case"Polygon":return void function(e,t,i){const r=[];for(let n=0;n<t.geometry.length;n++)Ju(r,t.geometry[n],e,i,"Polygon"===t.type,0===n);if(!r.length)return;const n={type:"Polygon"===t.type?3:2,tags:t.tags||null,geometry:r};null!==t.id&&(n.id=t.id),e.features.push(n)}(e,t,i);case"MultiPolygon":return void function(e,t,i){const r=[];for(let n=0;n<t.geometry.length;n++){const o=t.geometry[n];for(let t=0;t<o.length;t++)Ju(r,o[t],e,i,!0,0===t)}if(!r.length)return;const n={type:3,tags:t.tags||null,geometry:r};null!==t.id&&(n.id=t.id),e.features.push(n)}(e,t,i)}}function Ju(e,t,i,r,n,o){const s=r*r;if(r>0&&t.size<(n?s:r))return void(i.numPoints+=t.points.length/3);const a=[];for(let e=0;e<t.points.length;e+=3)(0===r||t.points[e+2]>s)&&(i.numSimplified++,a.push(t.points[e],t.points[e+1])),i.numPoints++;n&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t<r;n=t,t+=2)i+=(e[t]-e[n])*(e[t+1]+e[n+1]);if(i>0===t)for(let t=0,i=e.length;t<i/2;t+=2){const r=e[t],n=e[t+1];e[t]=e[i-2-t],e[t+1]=e[i-1-t],e[i-2-t]=r,e[i-1-t]=n}}(a,o),e.push(a)}function Ku(e,t){if(e.transformed)return e;const i=1<<e.z,r=e.x,n=e.y;for(const o of e.features)1===o.type?Qu(o,t,i,r,n):eh(o,t,i,r,n);return e.transformed=!0,e}function Qu(e,t,i,r,n){const o=e,s=e.geometry,a=[];for(let e=0;e<s.length;e+=2)a.push(th(s[e],s[e+1],t,i,r,n));return o.geometry=a,o}function eh(e,t,i,r,n){const o=e,s=e.geometry,a=[];for(const e of s){const o=[];for(let s=0;s<e.length;s+=2)o.push(th(e[s],e[s+1],t,i,r,n));a.push(o)}return o.geometry=a,o}function th(e,t,i,r,n,o){return[Math.round(i*(e*r-n)),Math.round(i*(t*r-o))]}class ih{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.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)))}updateIndex(e,t,i){i.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(t),i.debug>1&&console.timeEnd("invalidating");const[r,n,o]=[0,0,0],s=Xu(e,r,n,o,i);s.source=e;const a=rh(r,n,o);if(this.tiles[a]=s,this.tileCoords.push({z:r,x:n,y:o,id:a}),i.debug){const e=`z${r}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,t,i){return null}getTile(e,t,i){const{extent:r,debug:n}=this.options,o=1<<e,s=rh(e,t=t+o&o-1,i);if(this.tiles[s])return Ku(this.tiles[s],r);n>1&&console.log("drilling down to z%d-%d-%d",e,t,i);let a,l=e,c=t,u=i;for(;!a&&l>0;)l--,c>>=1,u>>=1,a=this.tiles[rh(l,c,u)];return a?.source?(n>1&&(console.log("found parent tile z%d-%d-%d",l,c,u),console.time("drilling down")),this.splitTile(a.source,l,c,u,e,t,i),n>1&&console.timeEnd("drilling down"),this.tiles[s]?Ku(this.tiles[s],r):null):null}splitTile(e,t,i,r,n,o,s){const a=[e,t,i,r],l=this.options,c=l.debug;for(;a.length;){r=a.pop(),i=a.pop(),t=a.pop(),e=a.pop();const u=1<<t,h=rh(t,i,r);let d=this.tiles[h];if(!d&&(c>1&&console.time("creation"),d=this.tiles[h]=Xu(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r,id:h}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==n){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(i!==o>>e||r!==s>>e)continue}}if(d.source=null,!e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,m=.5+p,g=1+p;let y=null,_=null,v=null,b=null;const x=Eu(e,u,i-p,i+m,Tu.X,d.minX,d.maxX,l),w=Eu(e,u,i+f,i+g,Tu.X,d.minX,d.maxX,l);x&&(y=Eu(x,u,r-p,r+m,Tu.Y,d.minY,d.maxY,l),_=Eu(x,u,r+f,r+g,Tu.Y,d.minY,d.maxY,l)),w&&(v=Eu(w,u,r-p,r+m,Tu.Y,d.minY,d.maxY,l),b=Eu(w,u,r+f,r+g,Tu.Y,d.minY,d.maxY,l)),c>1&&console.timeEnd("clipping"),a.push(y||[],t+1,2*i,2*r),a.push(_||[],t+1,2*i,2*r+1),a.push(v||[],t+1,2*i+1,2*r),a.push(b||[],t+1,2*i+1,2*r+1)}}invalidateTiles(e){if(!e.length)return;const t=this.options,{debug:i}=t;let r=1/0,n=-1/0,o=1/0,s=-1/0;for(const t of e)r=Math.min(r,t.minX),n=Math.max(n,t.maxX),o=Math.min(o,t.minY),s=Math.max(s,t.maxY);const a=t.buffer/t.extent,l=new Set;for(const t in this.tiles){const c=this.tiles[t],u=1<<c.z,h=(c.x-a)/u,d=(c.x+1+a)/u,p=(c.y-a)/u,f=(c.y+1+a)/u;if(n<h||r>=d||s<p||o>=f)continue;let m=!1;for(const t of e)if(t.maxX>=h&&t.minX<d&&t.maxY>=p&&t.minY<f){m=!0;break}if(m){if(i){i>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",c.z,c.x,c.y,c.numFeatures,c.numPoints,c.numSimplified);const e=`z${c.z}`;this.stats[e]=(this.stats[e]||0)-1,this.total--}delete this.tiles[t],l.add(t)}}l.size&&(this.tileCoords=this.tileCoords.filter((e=>!l.has(e.id))))}}function rh(e,t,i){return 32*((1<<e)*i+t)+e}const nh={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,
vendor: 1,445 bytes, line 2
2cluster:!1,clusterOptions:Uu,debug:0},oh=as([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:sh}=oh,ah=as([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:lh}=ah,ch=Math.cos(Math.PI/180*37.5),uh=Math.pow(2,14)/.5;class hh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(const e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Xs,this.layoutVertexArray2=new Ys,this.indexArray=new na,this.programConfigurations=new Na(e.layers,e.zoom),this.segments=new la,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.hasDependencies=Gl("line",this.layers,t)||this.hasLineDasharray(this.layers);const r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),o=[];for(const{feature:t,id:s,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=$a(t,e);if(!this.layers[0]._featureFilter.filter(new Oo(this.zoom),c,i))continue;const u=n?r.evaluate(c,{},i):void 0,h={id:s,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:Ga(t),patterns:{},dashes:{},sortKey:u};o.push(h)}n&&o.sort(((e,t)=>
vendor: 5,587 bytes, line 2
2e.sortKey-t.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:s}=r;this.hasDependencies?(Gl("line",this.layers,t)?$l("line",this.layers,r,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,r,this.zoom,t),this.patternFeatures.push(r)):this.addFeature(r,n,o,i,{},{},t.subdivisionGranularity),t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i,dashPositions:r})}addFeatures(e,t,i,r){for(const n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i,r,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,lh)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,sh),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.hasOwn(e.properties,Wu)&&Object.hasOwn(e.properties,Hu))return{start:+e.properties[Wu],end:+e.properties[Hu]}}addFeature(e,t,i,r,n,o,s){const a=this.layers[0].layout,l=a.get("line-join").evaluate(e,{}),c=a.get("line-cap").evaluate(e,{}),u=a.get("line-miter-limit").evaluate(e,{}),h=a.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(const i of t)this.addLine(i,e,l,c,u,h,r,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:n,dashPositions:o,canonical:r})}addLine(e,t,i,r,n,o,s,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=wc(e,s?a.line.getGranularityForZoomLevel(s.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l="Polygon"===kc.types[t.type];let c=e.length;for(;c>=2&&e[c-1].equals(e[c-2]);)c--;let u=0;for(;u<c-1&&e[u].equals(e[u+1]);)u++;if(c<(l?3:2))return;"bevel"===i&&(n=1.05);const h=this.overscaling<=16?122880/(512*this.overscaling):0,d=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);let p,f,m,g,y;this.e1=this.e2=-1,l&&(p=e[c-2],y=e[u].sub(p)._unit()._perp());for(let t=u;t<c;t++){if(m=t===c-1?l?e[u+1]:void 0:e[t+1],m&&e[t].equals(m))continue;y&&(g=y),p&&(f=p),p=e[t],y=m?m.sub(p)._unit()._perp():g,g||(g=y);let s=g.add(y);0===s.x&&0===s.y||s._unit();const a=g.x*y.x+g.y*y.y,_=s.x*y.x+s.y*y.y,v=0!==_?1/_:1/0,b=2*Math.sqrt(2-2*_),x=_<ch&&f&&m,w=g.x*y.y-g.y*y.x>0;if(x&&t>u){const e=p.dist(f);if(e>2*h){const t=p.sub(p.sub(f)._mult(h/e)._round());this.updateDistance(f,t),this.addCurrentVertex(t,g,0,0,d),f=t}}const T=f&&m;let E=T?i:l?"butt":r;if(T&&"round"===E&&(v<o?E="miter":v<=2&&(E="fakeround")),"miter"===E&&v>n&&(E="bevel"),"bevel"===E&&(v>2&&(E="flipbevel"),v<n&&(E="miter")),f&&this.updateDistance(f,p),"miter"===E)s._mult(v),this.addCurrentVertex(p,s,0,0,d);else if("flipbevel"===E){if(v>100)s=y.mult(-1);else{const e=v*g.add(y).mag()/g.sub(y).mag();s._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(p,s,0,0,d),this.addCurrentVertex(p,s.mult(-1),0,0,d)}else if("bevel"===E||"fakeround"===E){const e=-Math.sqrt(v*v-1),t=w?e:0,i=w?0:e;if(f&&this.addCurrentVertex(p,g,t,i,d),"fakeround"===E){const e=Math.round(180*b/Math.PI/20);for(let t=1;t<e;t++){let i=t/e;if(.5!==i){const e=i-.5;i+=i*e*(i-1)*((1.0904+a*(a*(3.55645-1.43519*a)-3.2452))*e*e+(.848013+a*(.215638*a-1.06021)))}const r=y.sub(g)._mult(i)._add(g)._unit()._mult(w?-1:1);this.addHalfVertex(p,r.x,r.y,!1,w,0,d)}}m&&this.addCurrentVertex(p,y,-t,-i,d)}else if("butt"===E)this.addCurrentVertex(p,s,0,0,d);else if("square"===E){const e=f?1:-1;this.addCurrentVertex(p,s,e,e,d)}else"round"===E&&(f&&(this.addCurrentVertex(p,g,0,0,d),this.addCurrentVertex(p,g,1,1,d,!0)),m&&(this.addCurrentVertex(p,y,-1,-1,d,!0),this.addCurrentVertex(p,y,0,0,d)));if(x&&t<c-1){const e=p.dist(m);if(e>2*h){const t=p.add(m.sub(p)._mult(h/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,y,0,0,d),p=t}}}}addCurrentVertex(e,t,i,r,n,o=!1){const s=t.y*r-t.x,a=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,o,!1,i,n),this.addHalfVertex(e,s,a,o,!0,-r,n),this.distance>uh/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,n,o))}addHalfVertex({x:e,y:t},i,r,n,o,s,a){const l=.5*(this.lineClips?this.scaledDistance*(uh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===s?0:s<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,c,this.e2),a.primitiveLength++),o?this.e2=c:this.e1=c}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()}hasLineDasharray(e){for(const t of e){const e=t.paint.get("line-dasharray");
2if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,i,r){for(const n of e){const e=n.paint.get("line-dasharray");if(!e||"constant"===e.value.kind)continue;const o="round"===n.layout.get("line-cap").evaluate(t,{}),s={dasharray:e.value.evaluate({zoom:i-1},t,{}),round:o},a={dasharray:e.value.evaluate({zoom:i},t,{}),round:o},l={dasharray:e.value.evaluate({zoom:i+1},t,{}),round:o},c=`${s.dasharray.join(",")},${s.round}`,u=`${a.dasharray.join(",")},${a.round}`,h=`${l.dasharray.join(",")},${l.round}`;r.dashDependencies[c]=s,r.dashDependencies[u]=a,r.dashDependencies[h]=l,t.dashes[n.id]={min:c,mid:u,max:h}}}}let dh,ph;fo("LineBucket",hh,{omit:["layers","patternFeatures"]});var fh={get paint(){return ph=ph||new Jo({"line-opacity":new Wo(xe.paint_line["line-opacity"]),"line-color":new Wo(xe.paint_line["line-color"]),"line-translate":new Zo(xe.paint_line["line-translate"]),"line-translate-anchor":new Zo(xe.paint_line["line-translate-anchor"]),"line-width":new Wo(xe.paint_line["line-width"]),"line-gap-width":new Wo(xe.paint_line["line-gap-width"]),"line-offset":new Wo(xe.paint_line["line-offset"]),"line-blur":new Wo(xe.paint_line["line-blur"]),"line-dasharray":new Ho(xe.paint_line["line-dasharray"]),"line-pattern":new Ho(xe.paint_line["line-pattern"]),"line-gradient":new Yo(xe.paint_line["line-gradient"])})},get layout(){return dh=dh||new Jo({"line-cap":new Wo(xe.layout_line["line-cap"]),"line-join":new Wo(xe.layout_line["line-join"]),"line-miter-limit":new Wo(xe.layout_line["line-miter-limit"]),"line-round-limit":new Wo(xe.layout_line["line-round-limit"]),"line-sort-key":new Wo(xe.layout_line["line-sort-key"])})}};class mh extends Wo{possiblyEvaluate(e,t){return t=new Oo(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=B({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}let gh;class yh extends es{constructor(e,t){super(e,fh,t),this.gradientVersion=0,gh||(gh=new mh(fh.paint.properties["line-width"].specification),gh.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this.gradientExpression();this.stepInterpolant=!!function(e){return void 0!==e._styleExpression}(e)&&e._styleExpression.expression instanceof ci,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"]=gh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new hh(e)}queryRadius(e){const t=e,i=_h(ol("line-width",this,t),ol("line-gap-width",this,t)),r=ol("line-offset",this,t);return i/2+Math.abs(r)+sl(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:n,transform:o,pixelsToTileUnits:s}){const a=al(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,s),l=s/2*_h(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),c=this.paint.get("line-offset").evaluate(t,r);return c&&(n=function(e,t){const r=[];for(const n of e){const e=ll(n),o=[];for(let r=0;r<e.length;r++){const n=e[r],s=e[r-1],a=e[r+1],l=0===r?new i(0,0):n.sub(s)._unit()._perp(),c=r===e.length-1?new i(0,0):a.sub(n)._unit()._perp(),u=l._add(c)._unit(),h=u.x*c.x+u.y*c.y;0!==h&&u._mult(1/h),o.push(u._mult(t)._add(n))}r.push(o)}return r}(n,c*s)),function(e,t,i){for(const r of t){if(e.length>=3)for(const t of r)if(rl(e,t))return!0;if(Ja(e,r,i))return!0}return!1}(a,n,l)}isTileClipped(){return!0}}function _h(e,t){return t>0?t+2*e:e}const vh=as([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),bh=as([{name:"a_projected_pos",components:3,type:"Float32"}],4);as([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const xh=as([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);as([{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"}]);const wh=as([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Th=as([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Eh(e,t,i){const r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),ko.applyArabicShaping&&(e=ko.applyArabicShaping(e)),e}function Sh(e,t,i){for(const r of e.sections)r.text=Eh(r.text,t,i);return e}as([{name:"triangle",components:3,type:"Uint16"}]),as([{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"}]),as([{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"}]),as([{type:"Float32",name:"offsetX"}]),as([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),as([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Ph=24;const Ih={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Ch={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},Mh={40:!0};function Ah(e,t,i,r,n,o){if("fontStack"in t){const r=i[t.fontStack],o=null==r?void 0:r[e];return o?o.metrics.advance*t.scale+n:0}{const e=r[t.imageName];return e?e.displaySize[0]*t.scale*Ph/o+n:0}}function Lh(e,t,i,r){const n=Math.pow(e-t,2);return r?e<t?n/2:2*n:n+Math.abs(i)*i}function Fh(e,t,i){let r=0;return 10===e&&(r-=1e4),i&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}function Dh(e,t,i,r,n,o){let s=null,a=Lh(t,i,n,o);for(const e of r){const r=Lh(t-e.x,i,n,o)+e.badness;r<=a&&(s=e,a=r)}return{index:e,x:t,priorBreak:s,badness:a}}function kh(e){return e?kh(e.priorBreak).concat(e.index):[]}class Oh{constructor(e="",t=[],i=[]){this.text=e,this.sections=t,this.sectionIndex=i,this.imageSectionID=null}static fromFeature(e,t){const i=new Oh;for(const r of e.sections)r.image?i.addImageSection(r):i.addTextSection(r,t);return i}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t="",i={premature:!0,value:void 0};const r=e[Symbol.iterator]();let n=r.next();const o=e[Symbol.iterator]();o.next();let s=o.next();for(;!n.done;)t+=!s.done&&Mo(s.value.codePointAt(0))&&!Ih[s.value]||!i.premature&&Mo(i.value.codePointAt(0))&&!Ih[i.value]||!Ih[n.value]?n.value:Ih[n.value],i={value:n.value,premature:!1},n=r.next(),s=o.next();return t}(this.text)}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){const e=this.text.match(/^\s*/),t=e?e[0].length:0,i=this.text.match(/\S\s*$/),r=i?i[0].length-1:0;this.text=this.text.substring(t,this.text.length-r),this.sectionIndex=this.sectionIndex.slice(t,this.sectionIndex.length-r)}substring(e,t){const i=[...this.text].slice(e,t).join(""),r=this.sectionIndex.slice(e,t);return new Oh(i,this.sections,r)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}getMaxImageSize(e){let t=0,i=0;for(let r=0;r<this.length();r++){const n=this.getSection(r);if("imageName"in n){const r=e[n.imageName];if(!r)continue;const o=r.displaySize;t=Math.max(t,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:t,maxImageHeight:i}}addTextSection(e,t){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||t});const i=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>i)))}addImageSection(e){const t=e.image?e.image.name:"";if(0===t.length)return void q("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:t}),this.sectionIndex.push(this.sections.length-1)):q("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,i,r,n){const o=[],s=this.determineAverageLineWidth(e,t,i,r,n),a=this.hasZeroWidthSpaces();let l=0,c=0;const u=this.text[Symbol.iterator]();let h=u.next();const d=this.text[Symbol.iterator]();d.next();let p=d.next();const f=this.text[Symbol.iterator]();f.next(),f.next();let m=f.next();for(;!h.done;){const t=this.getSection(c),g=h.value.codePointAt(0);if(To(g)||(l+=Ah(g,t,i,r,e,n)),!p.done){const e=xo(g),i=p.value.codePointAt(0);(Ch[g]||e||"imageName"in t||!m.done&&Mh[i])&&o.push(Dh(c+1,l,s,o,Fh(g,i,e&&a),!1))}c++,h=u.next(),p=d.next(),m=f.next()}return kh(Dh(this.length(),l,s,o,0,!0))}determineAverageLineWidth(e,t,i,r,n){let o=0,s=0;for(const t of this.text){const a=this.getSection(s);o+=Ah(t.codePointAt(0),a,i,r,e,n),s++}return o/Math.max(1,Math.ceil(o/t))}}const Rh=4294967296,zh=1/Rh,Nh="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class Bh{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){const i=this.readVarint(),r=i>>3,n=this.pos;this.type=7&i,e(r,t,this),this.pos===n&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Rh;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Rh;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,r;return r=t[this.pos++],i=127&r,r<128?i:(r=t[this.pos++],i|=(127&r)<<7,r<128?i:(r=t[this.pos++],i|=(127&r)<<14,r<128?i:(r=t[this.pos++],i|=(127&r)<<21,r<128?i:(r=t[this.pos],i|=(15&r)<<28,function(e,t,i){const r=i.buf;let n,o;
vendor: 6,304 bytes, line 2
2if(o=r[i.pos++],n=(112&o)>>4,o<128)return Vh(e,n,t);if(o=r[i.pos++],n|=(127&o)<<3,o<128)return Vh(e,n,t);if(o=r[i.pos++],n|=(127&o)<<10,o<128)return Vh(e,n,t);if(o=r[i.pos++],n|=(127&o)<<17,o<128)return Vh(e,n,t);if(o=r[i.pos++],n|=(127&o)<<24,o<128)return Vh(e,n,t);if(o=r[i.pos++],n|=(1&o)<<31,o<128)return Vh(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(i,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Nh?Nh.decode(this.buf.subarray(t,e)):function(e,t,i){let r="",n=t;for(;n<i;){const t=e[n];let o,s,a,l=null,c=t>239?4:t>223?3:t>191?2:1;if(n+c>i)break;1===c?t<128&&(l=t):2===c?(o=e[n+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&(l=(15&t)<<12|(63&o)<<6|63&s,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[n+1],s=e[n+2],a=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&t)<<18|(63&o)<<12|(63&s)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=c}return r}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*zh),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*zh),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(i=~(-e%4294967296),r=~(-e/4294967296),4294967295^i?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){const i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,i){for(let r,n,o=0;o<t.length;o++){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);const i=this.pos-t;i>=128&&jh(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const r=this.pos-i;r>=128&&jh(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Uh,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Gh,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Zh,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,$h,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,qh,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Wh,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Hh,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Xh,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Yh,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}
vendor: 4,179 bytes, line 2
2writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function Vh(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function jh(e,t,i){const r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(let t=i.pos-1;t>=e;t--)i.buf[t+r]=i.buf[t]}function Uh(e,t){for(let i=0;i<e.length;i++)t.writeVarint(e[i])}function Gh(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function $h(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function qh(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function Zh(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function Wh(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function Hh(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function Xh(e,t){for(let i=0;i<e.length;i++)t.writeFixed64(e[i])}function Yh(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}function Jh(e,t,i){1===e&&i.readMessage(Kh,t)}function Kh(e,t,i){if(3===e){const{id:e,bitmap:r,width:n,height:o,left:s,top:a,advance:l}=i.readMessage(Qh,{});t.push({id:e,bitmap:new Sl({width:n+6,height:o+6},r),metrics:{width:n,height:o,left:s,top:a,advance:l}})}}function Qh(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}function ed(e){let t=0,i=0;for(const r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort(((e,t)=>t.h-e.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,o=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const i=r[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,o=Math.max(o,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===i.w&&t.h===i.h){const t=r.pop();t&&e<r.length&&(r[e]=t)}else t.h===i.h?(i.x+=t.w,i.w-=t.w):t.w===i.w?(i.y+=t.h,i.h-=t.h):(r.push({x:i.x+t.w,y:i.y,w:i.w-t.w,h:t.h}),i.y+=t.h,i.h-=t.h);break}}return{w:n,h:o,fill:t/(n*o)||0}}class td{constructor(e,{pixelRatio:t,version:i,stretchX:r,stretchY:n,content:o,textFitWidth:s,textFitHeight:a}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=n,this.content=o,this.version=i,this.textFitWidth=s,this.textFitHeight=a}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class id{constructor(e,t){const i={},r={};this.haveRenderCallbacks=[];const n=[];this.addImages(e,i,n),this.addImages(t,r,n);const{w:o,h:s}=ed(n),a=new Pl({width:o||1,height:s||1});for(const t in e){const r=e[t],n=i[t].paddedRect;Pl.copy(r.data,a,{x:0,y:0},{x:n.x+1,y:n.y+1},r.data)}for(const e in t){const i=t[e],n=r[e].paddedRect,o=n.x+1,s=n.y+1,l=i.data.width,c=i.data.height;Pl.copy(i.data,a,{x:0,y:0},{x:o,y:s},i.data),Pl.copy(i.data,a,{x:0,y:c-1},{x:o,y:s-1},{width:l,height:1}),Pl.copy(i.data,a,{x:0,y:0},{x:o,y:s+c},{width:l,height:1}),Pl.copy(i.data,a,{x:l-1,y:0},{x:o-1,y:s},{width:1,height:c}),Pl.copy(i.data,a,{x:0,y:0},{x:o+l,y:s},{width:1,height:c})}this.image=a,this.iconPositions=i,this.patternPositions=r}addImages(e,t,i){for(const r in e){const n=e[r],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};i.push(o),t[r]=new td(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[r,n]=e.tl;i.update(t.data,void 0,{x:r,y:n})}}var rd;
2function nd(t,i,r,n,o,s,a,l,c,u,h,d,p,f,m){const g=Oh.fromFeature(t,o);let y;d===e.ax.vertical&&g.verticalizePunctuation();let _=g.determineLineBreaks(u,s,i,n,f);const{processBidirectionalText:v,processStyledBidirectionalText:b}=ko;if(v&&1===g.sections.length){y=[],_=_.map((e=>g.toCodeUnitIndex(e)));const e=v(g.toString(),_);for(const t of e){const e=[...t].map((()=>0));y.push(new Oh(t,g.sections,e))}}else if(b){y=[],_=_.map((e=>g.toCodeUnitIndex(e)));let e=0;const t=[];for(const i of g.text)t.push(...Array(i.length).fill(g.sectionIndex[e])),e++;const i=b(g.text,t,_);for(const e of i){const t=[];let i="";for(const r of e[0])t.push(e[1][i.length]),i+=r;y.push(new Oh(e[0],g.sections,t))}}else y=function(e,t){const i=[];let r=0;for(const n of t)i.push(e.substring(r,n)),r=n;return r<e.length()&&i.push(e.substring(r,e.length())),i}(g,_);const x=[],w={positionedLines:x,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:d,iconsInText:!1,verticalizable:!1};return function(e,t,i,r,n,o,s,a,l,c,u,h){let d=0,p=0,f=0,m=0;const g="right"===a?1:"left"===a?0:.5,y=Ph/h;let _=0;for(const s of n){s.trim();const n=s.getMaxScale(),a={positionedGlyphs:[],lineOffset:0};e.positionedLines[_]=a;const h=a.positionedGlyphs;let v=0;if(!s.length()){p+=o,++_;continue}const b=sd(r,s,y);let x=0;for(const o of s.text){const a=s.getSection(x),f=o.codePointAt(0),m=ld(l,u,f),g={glyph:f,imageName:null,x:d,y:p+-17,vertical:m,scale:1,fontStack:"",sectionIndex:s.getSectionIndex(x),metrics:null,rect:null};let _;if("fontStack"in a){if(_=cd(a,f,m,b,t,i),!_)continue;g.fontStack=a.fontStack}else{if(e.iconsInText=!0,a.scale*=y,_=ud(a,m,n,b,r),!_)continue;v=Math.max(v,_.imageOffset),g.imageName=a.imageName}const{rect:w,metrics:T,baselineOffset:E}=_;g.y+=E,g.scale=a.scale,g.metrics=T,g.rect=w,h.push(g),m?(e.verticalizable=!0,d+=("imageName"in a?T.advance:Ph)*a.scale+c):d+=T.advance*a.scale+c,x++}0!==h.length&&(f=Math.max(d-c,f),hd(h,0,h.length-1,g)),d=0,a.lineOffset=Math.max(v,(n-1)*Ph);const w=o*n+v;p+=w,m=Math.max(w,m),++_}const{horizontalAlign:v,verticalAlign:b}=od(s);(function(e,t,i,r,n,o,s,a,l){const c=(t-i)*n;let u=0;u=o!==s?-a*r- -17:-r*l*s+.5*s;for(const t of e)for(const e of t.positionedGlyphs)e.x+=c,e.y+=u})(e.positionedLines,g,v,b,f,m,o,p,n.length),e.top+=-b*p,e.bottom=e.top+p,e.left+=-v*f,e.right=e.left+f}(w,i,r,n,y,a,l,c,d,u,p,m),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(x)&&w}function od(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function sd(e,t,i){const r=t.getMaxScale()*Ph,{maxImageWidth:n,maxImageHeight:o}=t.getMaxImageSize(e),s=Math.max(r,o*i);return{verticalLineContentWidth:Math.max(r,n*i),horizontalLineContentHeight:s}}function ad(e){switch(e){case"top":return 0;case"center":return.5;default:return 1}}function ld(t,i,r){return!(t===e.ax.horizontal||!i&&!wo(r)||i&&(To(r)||(n=r,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}function cd(e,t,i,r,n,o){const s=o[e.fontStack],a=function(e,t,i,r){if(null==e?void 0:e.rect)return e;const n=t[i.fontStack],o=null==n?void 0:n[r];return o?{rect:null,metrics:o.metrics}:null}(null==s?void 0:s[t],n,e,t);if(null===a)return null;let l;if(i)l=r.verticalLineContentWidth-e.scale*Ph;else{const t=ad(e.verticalAlign);l=(r.horizontalLineContentHeight-e.scale*Ph)*t}return{rect:a.rect,metrics:a.metrics,baselineOffset:l}}function ud(e,t,i,r,n){const o=n[e.imageName];if(!o)return null;const s=o.paddedRect,a=o.displaySize,l={width:a[0],height:a[1],left:1,top:-3,advance:t?a[1]:a[0]};let c;if(t)c=r.verticalLineContentWidth-a[1]*e.scale;else{const t=ad(e.verticalAlign);c=(r.horizontalLineContentHeight-a[1]*e.scale)*t}return{rect:s,metrics:l,baselineOffset:c,imageOffset:(t?a[0]:a[1])*e.scale-Ph*i}}function hd(e,t,i,r){if(0===r)return;const n=e[i],o=(e[i].x+n.metrics.advance*n.scale)*r;for(let r=t;r<=i;r++)e[r].x-=o}function dd(e,t,i){const{horizontalAlign:r,verticalAlign:n}=od(i),o=t[0]-e.displaySize[0]*r,s=t[1]-e.displaySize[1]*n;return{image:e,top:s,bottom:s+e.displaySize[1],left:o,right:o+e.displaySize[0]}}function pd(e){var t,i;let r=e.left,n=e.top,o=e.right-r,s=e.bottom-n;const a=null!==(t=e.image.textFitWidth)&&void 0!==t?t:"stretchOrShrink",l=null!==(i=e.image.textFitHeight)&&void 0!==i?i:"stretchOrShrink",c=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if("proportional"===l){if("stretchOnly"===a&&o/s<c||"proportional"===a){const e=Math.ceil(s*c);r*=e/o,o=e}}else if("proportional"===a&&"stretchOnly"===l&&0!==c&&o/s>c){const e=Math.ceil(o/c);n*=e/s,s=e}return{x1:r,y1:n,x2:r+o,y2:n+s}}function fd(e,t,i,r,n,o){const s=e.image;let a;if(s.content){const e=s.content,t=s.pixelRatio||1;a=[e[0]/t,e[1]/t,s.displaySize[0]-e[2]/t,s.displaySize[1]-e[3]/t]}const l=t.left*o,c=t.right*o;let u,h,d,p;"width"===i||"both"===i?(p=n[0]+l-r[3],h=n[0]+c+r[1]):(p=n[0]+(l+c-s.displaySize[0])/2,h=p+s.displaySize[0]);const f=t.top*o,m=t.bottom*o;return"height"===i||"both"===i?(u=n[1]+f-r[0],d=n[1]+m+r[2]):(u=n[1]+(f+m-s.displaySize[1])/2,d=u+s.displaySize[1]),{image:s,top:u,right:h,bottom:d,left
vendor: 6,194 bytes, line 2
2:p,collisionPadding:a}}fo("ImagePosition",td),fo("ImageAtlas",id),e.ax=void 0,(rd=e.ax||(e.ax={}))[rd.none=0]="none",rd[rd.horizontal=1]="horizontal",rd[rd.vertical=2]="vertical",rd[rd.horizontalOnly=3]="horizontalOnly";const md=128,gd=32640;function yd(e,t){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Oo(e+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:r}=i;let n=0;for(;n<t.length&&t[n]<=e;)n++;n=Math.max(0,n-1);let o=n;for(;o<t.length&&t[o]<e+1;)o++;o=Math.min(t.length-1,o);const s=t[n],a=t[o];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:a,interpolationType:r}:{kind:"camera",minZoom:s,maxZoom:a,minSize:i.evaluate(new Oo(s)),maxSize:i.evaluate(new Oo(a)),interpolationType:r}}}function _d(e,t,i){let r="never";const n=e.get(t);return n?r=n:e.get(i)&&(r="always"),r}const vd=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function bd(e,t,i,r,n,o,s,a,l,c,u,h,d){const p=a?Math.min(gd,Math.round(a[0])):0,f=a?Math.min(gd,Math.round(a[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),o,s,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function xd(e,t,i){e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i)}function wd(e){for(const t of e.sections)if(Do(t.text))return!0;return!1}class Td{constructor(e){this.layoutVertexArray=new Qs,this.indexArray=new na,this.programConfigurations=e,this.segments=new la,this.dynamicLayoutVertexArray=new ea,this.opacityVertexArray=new ta,this.hasVisibleVertices=!1,this.placedSymbolArray=new Rs}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,vh.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,bh.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,vd,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&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())}}fo("SymbolBuffers",Td);class Ed{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new la,this.collisionVertexArray=new ra}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,xh.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}fo("CollisionBuffers",Ed);class Sd{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=yd(this.zoom,i["text-size"]),this.iconSizeData=yd(this.zoom,i["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),o=r.get("symbol-z-order");this.canOverlap="never"!==_d(r,"text-overlap","text-allow-overlap")||"never"!==_d(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((t=>e.ax[t]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=t.sourceID}createArrays(){this.text=new Td(new Na(this.layers,this.zoom,(e=>e.startsWith("text")))),this.icon=new Td(new Na(this.layers,this.zoom,(e=>e.startsWith("icon")))),this.glyphOffsetArray=new Bs,this.lineVertexArray=new Vs,this.symbolInstances=new Ns,this.textAnchorOffsets=new Us}calculateGlyphDependencies(e,t,i,r,n){for(const o of e)if(t[o.codePointAt(0)]=!0,(i||r)&&n){const e=Ih[o];e&&(t[e.codePointAt(0)]=!0)}}populate(t,i,r){var n;const o=this.layers[0],s=o.layout,a=s.get("text-font"),l=s.get("text-field"),c=s.get("icon-image"),u=("constant"!==l.value.kind||l.value.value instanceof Dt&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),h="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,d=s.get("symbol-sort-key");if(this.features=[],!u&&!h)return;const p=i.iconDependencies,f=i.glyphDependencies,m=i.availableImages,g=new Oo(this.zoom);for(const{feature:i,id:l,index:c,sourceLayerIndex:y}of t){const t=o._featureFilter.needGeometry,_=$a(i,t);if(!o._featureFilter.filter(g,_,r))continue;let v,b;if(t||(_.geometry=Ga(i)),u){const e=o.getValueAndResolveTokens("text-field",_,r,m),t=Dt.factory(e);this.hasRTLText||(this.hasRTLText=wd(t)),(!this.hasRTLText||"unavailable"===ko.getRTLTextPluginStatus()||this.hasRTLText&&ko.isParsed())&&(v=Sh(t,o,_))}if(h){const e=o.getValueAndResolveTokens("icon-image",_,r,m);b=e instanceof Vt?e:Vt.fromString(e)}if(!v&&!b)continue;const x=this.sortFeaturesByKey?d.evaluate(_,{},r):void 0;if(this.features.push({id:l,text:v,icon:b,index:c,sourceLayerIndex:y,geometry:_.geometry,properties:i.properties,type:kc.types[i.type],sortKey:x}),b&&(p[b.name]=!0),v){const t=a.evaluate(_,{},r).join(","),i="viewport"!==s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=null===(n=this.writingModes)||void 0===n?void 0:n.includes(e.ax.vertical);for(const e of v.sections)if(e.image)p[e.image.name]=!0;else{const r=Eo(v.toString()),n=e.fontStack||t;
vendor: 5,513 bytes, line 2
2f[n]||(f[n]={}),this.calculateGlyphDependencies(e.text,f[n],i,this.allowVerticalPlacement,r)}}}"line"===s.get("symbol-placement")&&(this.features=function(e){const t={},i={},r=[];let n=0;function o(t){r.push(e[t]),n++}function s(e,t,n){const o=i[e];return delete i[e],i[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function a(e,i,n){const o=t[i];return delete t[i],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(e,t,i){const r=i?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let c=0;c<e.length;c++){const u=e[c],h=u.geometry,d=u.text?u.text.toString():null;if(!d){o(c);continue}const p=l(d,h),f=l(d,h,!0);if(p in i&&f in t&&i[p]!==t[f]){const e=a(p,f,h),n=s(p,f,r[e].geometry);delete t[p],delete i[f],i[l(d,r[n].geometry,!0)]=n,r[e].geometry=null}else p in i?s(p,f,h):f in t?a(p,f,h):(o(c),t[p]=n-1,i[f]=n-1)}return r.filter((e=>e.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment){let i=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]);const n={};for(let r=e.segment+1;r<t.length;r++)n[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:i},r<t.length-1&&(i+=t[r+1].dist(t[r]));for(let i=e.segment||0;i>=0;i--)n[i]={x:t[i].x,y:t[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=t[i-1].dist(t[i]));for(let e=0;e<t.length;e++){const t=n[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(t,i,r,n,o,s,a,l,c,u,h,d){const p=t.indexArray,f=t.layoutVertexArray,m=t.segments.prepareSegment(4*i.length,f,p,this.canOverlap?s.sortKey:void 0),g=this.glyphOffsetArray.length,y=m.vertexLength,_=this.allowVerticalPlacement&&a===e.ax.vertical?Math.PI/2:0,v=s.text&&s.text.sections;for(let e=0;e<i.length;e++){const{tl:n,tr:o,bl:a,br:c,tex:u,pixelOffsetTL:h,pixelOffsetBR:g,minFontScaleX:y,minFontScaleY:b,glyphOffset:x,isSDF:w,sectionIndex:T}=i[e],E=m.vertexLength,S=x[1];bd(f,l.x,l.y,n.x,S+n.y,u.x,u.y,r,w,h.x,h.y,y,b),bd(f,l.x,l.y,o.x,S+o.y,u.x+u.w,u.y,r,w,g.x,h.y,y,b),bd(f,l.x,l.y,a.x,S+a.y,u.x,u.y+u.h,r,w,h.x,g.y,y,b),bd(f,l.x,l.y,c.x,S+c.y,u.x+u.w,u.y+u.h,r,w,g.x,g.y,y,b),xd(t.dynamicLayoutVertexArray,l,_),p.emplaceBack(E,E+2,E+1),p.emplaceBack(E+1,E+2,E+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),e!==i.length-1&&T===i[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,s,s.index,{imagePositions:{},canonical:d,formattedSection:null==v?void 0:v[T]})}t.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,y,c,u,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,h)}_addCollisionDebugVertex(e,t,i,r,n,o){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,r,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(e,t,r,n,o,s,a){const l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,u=o.layoutVertexArray,h=o.collisionVertexArray,d=a.anchorX,p=a.anchorY;this._addCollisionDebugVertex(u,h,s,d,p,new i(e,t)),this._addCollisionDebugVertex(u,h,s,d,p,new i(r,t)),this._addCollisionDebugVertex(u,h,s,d,p,new i(r,n)),this._addCollisionDebugVertex(u,h,s,d,p,new i(e,n)),l.vertexLength+=4;const f=o.indexArray;f.emplaceBack(c,c+1),f.emplaceBack(c+1,c+2),f.emplaceBack(c+2,c+3),f.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,r){for(let n=e;n<t;n++){const e=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ed(ia,wh.members,oa),this.iconCollisionBox=new Ed(ia,wh.members,oa);for(let e=0;e<this.symbolInstances.length;e++){const 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,i,r,n,o,s,a,l){const c={};for(let r=t;r<i;r++){const t=e.get(r);c.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.textFeatureIndex=t.featureIndex;break}for(let t=r;t<n;t++){const i=e.get(t);c.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anch
vendor: 9,440 bytes, line 2
2orPointY},c.verticalTextFeatureIndex=i.featureIndex;break}for(let t=o;t<s;t++){const i=e.get(t);c.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.iconFeatureIndex=i.featureIndex;break}for(let t=a;t<l;t++){const i=e.get(t);c.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalIconFeatureIndex=i.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.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){const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+2,t+1),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),i=Math.cos(e),r=[],n=[],o=[];for(let e=0;e<this.symbolInstances.length;++e){o.push(e);const s=this.symbolInstances.get(e);r.push(0|Math.round(t*s.anchorX+i*s.anchorY)),n.push(s.featureIndex)}return o.sort(((e,t)=>r[e]-r[t]||n[t]-n[e])),o}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];(null==i?void 0:i.sortKey)===t?i.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(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const i=[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex];for(let e=0;e<i.length;e++){const t=i[e];t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Pd,Id;fo("SymbolBucket",Sd,{omit:["layers","collisionBoxArray","features","compareText"]}),Sd.MAX_GLYPHS=65535,Sd.addDynamicAttributes=xd;var Cd={get paint(){return Id=Id||new Jo({"icon-opacity":new Wo(xe.paint_symbol["icon-opacity"]),"icon-color":new Wo(xe.paint_symbol["icon-color"]),"icon-halo-color":new Wo(xe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Wo(xe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Wo(xe.paint_symbol["icon-halo-blur"]),"icon-translate":new Zo(xe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Zo(xe.paint_symbol["icon-translate-anchor"]),"text-opacity":new Wo(xe.paint_symbol["text-opacity"]),"text-color":new Wo(xe.paint_symbol["text-color"],{runtimeType:je,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Wo(xe.paint_symbol["text-halo-color"]),"text-halo-width":new Wo(xe.paint_symbol["text-halo-width"]),"text-halo-blur":new Wo(xe.paint_symbol["text-halo-blur"]),"text-translate":new Zo(xe.paint_symbol["text-translate"]),"text-translate-anchor":new Zo(xe.paint_symbol["text-translate-anchor"])})},get layout(){return Pd=Pd||new Jo({"symbol-placement":new Zo(xe.layout_symbol["symbol-placement"]),"symbol-spacing":new Zo(xe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Zo(xe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Wo(xe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Zo(xe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Zo(xe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Zo(xe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Zo(xe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Zo(xe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Zo(xe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Wo(xe.layout_symbol["icon-size"]),"icon-text-fit":new Zo(xe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Zo(xe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Wo(xe.layout_symbol["icon-image"]),"icon-rotate":new Wo(xe.layout_symbol["icon-rotate"]),"icon-padding":new Wo(xe.layout_symbol["icon-padding"]),"icon-keep-upright":new Zo(xe.layout_symbol["icon-keep-upright"]),"icon-offset":new Wo(xe.layout_symbol["icon-offset"]),"icon-anchor":new Wo(xe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Zo(xe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Zo(xe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Zo(xe.layout_symbol["text-rotation-alignment"]),"text-field":new Wo(xe.layout_symbol["text-field"]),"text-font":new Wo(xe.layout_symbol["text-font"]),"text-size":new Wo(xe.layout_symbol["text-size"]),"text-max-width":new Wo(xe.layout_symbol["text-max-width"]),"text-line-height":new Zo(xe.layout_symbol["text-line-height"]),"text-letter-spacing":new Wo(xe.layout_symbol["text-letter-spacing"]),"text-justify":new Wo(xe.layout_symbol["text-justify"]),"text-radial-offset":new Wo(xe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Zo(xe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Wo(xe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Wo(xe.layout_symbol["text-anchor"]),"text-max-angle":new Zo(xe.layout_symbol["text-max-angle"]),"text-writing-mode":new Zo(xe.layout_symbol["text-writing-mode"]),"text-rotate":new Wo(xe.layout_symbol["text-rotate"]),"text-padding":new Zo(xe.layout_symbol["text-padding"]),"text-keep-upright":new Zo(xe.layout_symbol["text-keep-upright"]),"text-transform":new Wo(xe.layout_symbol["text-transform"]),"text-offset":new Wo(xe.layout_symbol["text-offset"]),"text-allow-overlap":new Zo(xe.layout_symbol["text-allow-overlap"]),"text-overlap":new Zo(xe.layout_symbol["text-overlap"]),"text-ignore-placement":new Zo(xe.layout_symbol["text-ignore-placement"]),"text-optional":new Zo(xe.layout_symbol["text-optional"])})}};class Md{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:ze,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(null==t?void 0: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){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}fo("FormatSectionOverride",Md,{omit:["defaultValue"]});class Ad extends es{constructor(e,t){super(e,Cd,t)}recalculate(e,t){if(super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const e=this.layout.get("text-writing-mode");if(e){const t=[];for(const i of e)t.includes(i)||t.push(i);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,r){const n=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||rn(o.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,((t,i)=>e&&i in e?String(e[i]):""))}(t.properties,n)}createBucket(e){return new Sd(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Cd.paint.overridableProperties){if(!Ad.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new Md(t),r=new tn(i,t.property.specification);let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new on("source",r):new sn("c
2omposite",r,t.value.zoomStops),this.paint._values[e]=new $o(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&Ad.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),r=Cd.paint.properties[t];let n=!1;const o=e=>{var t;for(const i of e)if(null===(t=r.overrides)||void 0===t?void 0:t.hasOverride(i))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof Dt)o(i.value.value.sections);else if("source"===i.value.kind||"composite"===i.value.kind){const e=t=>{n||(t instanceof Zt&&$t(t.value)===Ze?o(t.value.sections):t instanceof Mi?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}}let Ld;var Fd={get paint(){return Ld=Ld||new Jo({"background-color":new Zo(xe.paint_background["background-color"]),"background-pattern":new Xo(xe.paint_background["background-pattern"]),"background-opacity":new Zo(xe.paint_background["background-opacity"])})}};class Dd extends es{constructor(e,t){super(e,Fd,t)}}class kd extends es{constructor(e,t){super(e,{},t),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Od{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,null===(e=this._channel)||void 0===e||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Rd={once:!0},zd=6371008.8;class Nd{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 Nd(N(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return zd*Math.acos(Math.min(n,1))}static convert(e){if(e instanceof Nd)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Nd(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Nd(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>]")}}const Bd=2*Math.PI*zd;function Vd(e){return Bd*Math.cos(e*Math.PI/180)}function jd(e){return(180+e)/360}function Ud(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Gd(e,t){return e/Vd(t)}function $d(e){return 360*e-180}function qd(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Zd(e,t){return e*Vd(qd(t))}class Wd{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=Nd.convert(e);return new Wd(jd(i.lng),Ud(i.lat),Gd(t,i.lat))}toLngLat(){return new Nd($d(this.x),qd(this.y))}toAltitude(){return Zd(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Bd*(e=qd(this.y),1/Math.cos(e*Math.PI/180));var e}}function Hd(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class Xd{constructor(e,t,i){if(!function(e,t,i){return!(e<0||e>25||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}(e,t,i))throw new Error(`x=${t}, y=${i}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=t,this.y=i,this.key=Kd(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}
2url(e,t,i){const r=(o=this.y,s=this.z,a=Hd(256*(n=this.x),256*(o=Math.pow(2,s)-o-1),s),l=Hd(256*(n+1),256*(o+1),s),a[0]+","+a[1]+","+l[0]+","+l[1]);var n,o,s,a,l;const c=function(e,t,i){let r="";for(let n=e;n>0;n--){const e=1<<n-1;r+=(t&e?1:0)+(i&e?2:0)}return r}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){const t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){const t=Math.pow(2,this.z);return new i((e.x*t-this.x)*M,(e.y*t-this.y)*M)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Yd{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Kd(e,t.z,t.z,t.x,t.y)}}class Jd{constructor(e,t,i,r,n){if(this.terrainRttPosMatrix32f=null,e<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Xd(i,+r,+n),this.key=Kd(t,e,i,r,n)}clone(){return new Jd(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}`);const t=this.canonical.z-e;return e>this.canonical.z?new Jd(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Jd(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?Kd(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Kd(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap)return!1;if(this.overscaledZ-e.overscaledZ<=0)return!1;if(0===e.overscaledZ)return this.overscaledZ>0;const t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Jd(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Jd(t,this.wrap,t,i,r),new Jd(t,this.wrap,t,i+1,r),new Jd(t,this.wrap,t,i,r+1),new Jd(t,this.wrap,t,i+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Jd(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Jd(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 Yd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Wd(e.x-this.wrap,e.y))}normalizeCoordinates(e,t,i=8192){if(e>=0&&e<i&&t>=0&&t<i)return{tileID:this,x:e,y:t};const r=Math.floor(e/i),n=Math.floor(t/i),o=e-r*i,s=t-n*i,a=this.canonical.z,l=1<<a,c=this.canonical.y+n;if(c<0||c>=l)return null;let u=this.canonical.x+r,h=this.wrap;return u<0?(h-=Math.ceil(-u/l),u=(u%l+l)%l):u>=l&&(h+=Math.floor(u/l),u%=l),{tileID:new Jd(this.overscaledZ,h,a,u,c),x:o,y:s}}}function Kd(e,t,i,r,n){(e*=2)<0&&(e=-1*e-1);const o=1<<i;return(o*o*e+o*n+r).toString(36)+i.toString(36)+t.toString(36)}fo("CanonicalTileID",Xd),fo("OverscaledTileID",Jd,{omit:["terrainRttPosMatrix32f"]});class Qd{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){const t=new Qd;return t.extend(e(new i(this.minX,this.minY))),t.extend(e(new i(this.maxX,this.minY))),t.extend(e(new i(this.minX,this.maxY))),t.extend(e(new i(this.maxX,this.maxY))),t}static fromPoints(e){const t=new Qd;for(const i of e)t.extend(i);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}}class ep{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}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]}}class tp{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,this._x=i,this._y=r,this._z=t,this.properties=e.properties,this.id=n}projectPoint(e,t,i,r){return[360*(e.x+t)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+i)/r)*Math.PI))-90]}projectLine(e,t,i,r){return e.map((e=>this.projectPoint(e,t,i,r)))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,t=e.extent*Math.pow(2,this._z),i=e.extent*this._x,r=e.extent*this._y,n=e.loadGeometry();switch(e.type){case 1:{const e=[];for(const t of n)e.push(t[0]);const o=this.projectLine(e,i,r,t);this._geometry=1===e.length?{type:"Point",coordinates:o[0]}:{type:"MultiPoint",coordinates:o};break}case 2:{const e=n.map((e=>this.projectLine(e,i,r,t)));this._geometry=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e};break}case 3:{const e=Rc(n),o=[];for(const n of e)o.push(n.map((e=>this.projectLine(e,i,r,t))));this._geometry=1===o.length?{type:"Polygon",coordinates:o[0]}:{type:"MultiPolygon",coordinates:o};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&"_x"!==t&&"_y"!==t&&"_z"!==t&&(e[t]=this[t]);return e}}class ip{constructor(e,t,i){this._name=e,this.dataBuffer=t,"number"==typeof i?this._size=i:(this.nullabilityBuffer=i,this._size=i.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class rp extends ip{}class np extends rp{getValueFromBuffer(e){return this.dataBuffer[e]}}class op extends rp{getValueFromBuffer(e){return this.dataBuffer[e]}}class sp extends ip{constructor(e,t,i,r){super(e,t,r),this.delta=i}}class ap extends sp{constructor(e,t,i,r){super(e,Int32Array.of(t),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class lp extends ip{constructor(e,t,i,r){super(e,r?Int32Array.of(t):Uint32Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}}class cp{constructor(e,t,i,r,n=4096){this._name=e,this._geometryVector=t,this._idVector=i,this._propertyVectors=r,this._extent=n}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((e=>[e.name,e])))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],t=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let r;if(this.idVector){const e=this.idVector.getValue(i);r=this.containsMaxSafeIntegerValues(this.idVector)&&null!==e?Number(e):e}const n={coordinates:t[i],type:this.geometryVector.geometryType(i)},o={};
2for(const e of this.propertyVectors){if(!e)continue;const t=e.name,r=e.getValue(i);null!==r&&(o[t]=r)}e.push({id:r,geometry:n,properties:o})}return e}containsMaxSafeIntegerValues(e){return e instanceof np||e instanceof lp||e instanceof ap||e instanceof op}}class up{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var hp,dp;!function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON",e.PDE="PDE"}(hp||(hp={})),function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT",e.ALP="ALP"}(dp||(dp={}));const pp=new Uint32Array(33);pp[0]=0;for(let e=1;e<=32;e++)pp[e]=32===e?4294967295:4294967295>>>32-e;const fp=pp,mp=256;function gp(e,t){return e-e%t}function yp(e){const t=e>>>0;return((255&t)<<24|(65280&t)<<8|t>>>8&65280|t>>>24&255)>>>0}const _p=function(){if(!Number.isFinite(65536))return 65536;const e=gp(Math.floor(65536),mp);return 0===e?mp:e}(),vp=3*_p/mp+_p|0;function bp(){const e=new Uint8Array(vp);return{dataToBePacked:new Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function xp(e,t,i,r,n){switch(n){case 1:!function(e,t,i,r){let n=r,o=t;for(let t=0;t<8;t++){const t=e[o++]>>>0;i[n++]=t>>>0&1,i[n++]=t>>>1&1,i[n++]=t>>>2&1,i[n++]=t>>>3&1,i[n++]=t>>>4&1,i[n++]=t>>>5&1,i[n++]=t>>>6&1,i[n++]=t>>>7&1,i[n++]=t>>>8&1,i[n++]=t>>>9&1,i[n++]=t>>>10&1,i[n++]=t>>>11&1,i[n++]=t>>>12&1,i[n++]=t>>>13&1,i[n++]=t>>>14&1,i[n++]=t>>>15&1,i[n++]=t>>>16&1,i[n++]=t>>>17&1,i[n++]=t>>>18&1,i[n++]=t>>>19&1,i[n++]=t>>>20&1,i[n++]=t>>>21&1,i[n++]=t>>>22&1,i[n++]=t>>>23&1,i[n++]=t>>>24&1,i[n++]=t>>>25&1,i[n++]=t>>>26&1,i[n++]=t>>>27&1,i[n++]=t>>>28&1,i[n++]=t>>>29&1,i[n++]=t>>>30&1,i[n++]=t>>>31&1}}(e,t,i,r);break;case 2:!function(e,t,i,r){let n=r,o=t;for(let t=0;t<8;t++){const t=e[o++]>>>0,r=e[o++]>>>0;i[n++]=t>>>0&3,i[n++]=t>>>2&3,i[n++]=t>>>4&3,i[n++]=t>>>6&3,i[n++]=t>>>8&3,i[n++]=t>>>10&3,i[n++]=t>>>12&3,i[n++]=t>>>14&3,i[n++]=t>>>16&3,i[n++]=t>>>18&3,i[n++]=t>>>20&3,i[n++]=t>>>22&3,i[n++]=t>>>24&3,i[n++]=t>>>26&3,i[n++]=t>>>28&3,i[n++]=t>>>30&3,i[n++]=r>>>0&3,i[n++]=r>>>2&3,i[n++]=r>>>4&3,i[n++]=r>>>6&3,i[n++]=r>>>8&3,i[n++]=r>>>10&3,i[n++]=r>>>12&3,i[n++]=r>>>14&3,i[n++]=r>>>16&3,i[n++]=r>>>18&3,i[n++]=r>>>20&3,i[n++]=r>>>22&3,i[n++]=r>>>24&3,i[n++]=r>>>26&3,i[n++]=r>>>28&3,i[n++]=r>>>30&3}}(e,t,i,r);break;case 3:!function(e,t,i,r){let n=r,o=t;for(let t=0;t<8;t++){const t=e[o++]>>>0,r=e[o++]>>>0,s=e[o++]>>>0;i[n++]=t>>>0&7,i[n++]=t>>>3&7,i[n++]=t>>>6&7,i[n++]=t>>>9&7,i[n++]=t>>>12&7,i[n++]=t>>>15&7,i[n++]=t>>>18&7,i[n++]=t>>>21&7,i[n++]=t>>>24&7,i[n++]=t>>>27&7,i[n++]=7&(t>>>30|(1&r)<<2),i[n++]=r>>>1&7,i[n++]=r>>>4&7,i[n++]=r>>>7&7,i[n++]=r>>>10&7,i[n++]=r>>>13&7,i[n++]=r>>>16&7,i[n++]=r>>>19&7,i[n++]=r>>>22&7,i[n++]=r>>>25&7,i[n++]=r>>>28&7,i[n++]=7&(r>>>31|(3&s)<<1),i[n++]=s>>>2&7,i[n++]=s>>>5&7,i[n++]=s>>>8&7,i[n++]=s>>>11&7,i[n++]=s>>>14&7,i[n++]=s>>>17&7,i[n++]=s>>>20&7,i[n++]=s>>>23&7,i[n++]=s>>>26&7,i[n++]=s>>>29&7}}(e,t,i,r);break;case 4:!function(e,t,i,r){let n=r,o=t;for(let t=0;t<8;t++){const t=e[o++]>>>0,r=e[o++]>>>0,s=e[o++]>>>0,a=e[o++]>>>0;i[n++]=t>>>0&15,i[n++]=t>>>4&15,i[n++]=t>>>8&15,i[n++]=t>>>12&15,i[n++]=t>>>16&15,i[n++]=t>>>20&15,i[n++]=t>>>24&15,i[n++]=t>>>28&15,i[n++]=r>>>0&15,i[n++]=r>>>4&15,i[n++]=r>>>8&15,i[n++]=r>>>12&15,i[n++]=r>>>16&15,i[n++]=r>>>20&15,i[n++]=r>>>24&15,i[n++]=r>>>28&15,i[n++]=s>>>0&15,i[n++]=s>>>4&15,i[n++]=s>>>8&15,i[n++]=s>>>12&15,i[n++]=s>>>16&15,i[n++]=s>>>20&15,i[n++]=s>>>24&15,i[n++]=s>>>28&15,i[n++]=a>>>0&15,i[n++]=a>>>4&15,i[n++]=a>>>8&15,i[n++]=a>>>12&15,i[n++]=a>>>16&15,i[n++]=a>>>20&15,i[n++]=a>>>24&15,i[n++]=a>>>28&15}}(e,t,i,r);break;case 5:!function(e,t,i,r){let n=r,o=t;for(let t=0;t<8;t++){const t=e[o++]>>>0,r=e[o++]>>>0,s=e[o++]>>>0,a=e[o++]>>>0,l=e[o++]>>>0;i[n++]=t>>>0&31,i[n++]=t>>>5&31,i[n++]=t>>>10&31,i[n++]=t>>>15&31,i[n++]=t>>>20&31,i[n++]=t>>>25&31,i[n++]=31&(t>>>30|(7&r)<<2),i[n++]=r>>>3&31,i[n++]=r>>>8&31,i[n++]=r>>>13&31,i[n++]=r>>>18&31,i[n++]=r>>>23&31,i[n++]=31&(r>>>28|(1&s)<<4),i[n++]=s>>>1&31,i[n++]=s>>>6&31,i[n++]=s>>>11&31,i[n++]=s>>>16&31,i[n++]=s>>>21&31,i[n++]=s>>>26&31,i[n++]=31&(s>>>31|(15&a)<<1),i[n++]=a>>>4&31,i[n++]=a>>>9&31,i[n++]=a>>>14&31,i[n++]=a>>>19&31,i[n++]=a>>>24&31,i[n++]=31&(a>>>29|(3&l)<<3),i[n++]=l>>>2&31,i[n++]=l>>>7&31,i[n++]=l>>>12&31,i[n++]=l>>>17&31,i[n++]=l>>>22&31,i[n++]=l>>>27&31}}(e,t,i,r);break;case 6:!function(e,t,i,r){let n=r,o=t;for(let t=0;t<8;t++){const t=e[o++]>>>0,r=e[o++]>>>0,s=e[o++]>>>0,a=e[o++]>>>0,l=e[o++]>>>0,c=e[o++]>>>0;i[n++]=t>>>0&63,i[n++]=t>>>6&63,i[n++]=t>>>12&63,i[n++]=t>>>18&63,i[n++]=t>>>24&63,i[n++]=63&(t>>>30|(15&r)<<2),i[n++]=r>>>4&63,i[n++]=r>>>10&63,i[n++]=r>>>16&63,i[n++]=r>>>22&63,i[n++]=63&(r>>>28|(3&s)<<4),i[n++]=s>>>2&63,i[n++]=s>>>8&63,i[n++]=s>>>14&63,i[n++]=s>>>20&63,i[n++]=s>>>26&63,i[n++]=a>>>0&63,i[n++]=a>>>6&63,i[n++]=a>>>12&63,i[n++]=a>>>18&63,i[n++]=a>>>24&63,i[n++]=63&(a>>>30|(15&l)<<2),i[n++]=l>>>4&63,i[n++]=l>>>10&63,i[n++]=l>>>16&63,i[n++]=l>>>22&63,i[n++]=63&(l>>>28|(3&c)<<4),i[n++]=c>>>2&63,i[n++]=c>>>8&63,i[n++]=c>>>14&63,i[n++]=c>>>20&63,i[n++]=c>>>26&63}}(e,t,i,r);break;case 7:!function(e,t,i,r){let n=r,o=t;for(let t=0;t<8;t++){const t=e[o++]>>>0,r=e[o++]>>>0,s=e[o++]>>>0,a=e[o++]>>>0,l=e[o++]>>>0,c=e[o++]>>>0,u=e[o++]>>>0;i[n++]=t>>>0&127,i[n++]=t>>>7&127,i[n++]=t>>>14&127,i[n++]=t>>>21&127,i[n++]=127&(t>>>28|(7&r)<<4),i[n++]=r>>>3&127,i[n++]=r>>>10&127,i[n++]=r>>>17&127,i[n++]=r>>>24&127,i[n++]=127&(r>>>31|(63&s)<<1),i[n++]=s>>>6&127,i[n++]=s>>>13&127,i[n++]=s>>>20&127,i[n++]=127&(s>>>27|(3&a)<<5),i[n++]=a>>>2&127,i[n++]=a>>>9&127,i[n++]=a>>>16&127,i[n++]=a>>>23&127,i[n++]=127&(a>>>30|(31&l)<<2),i[n++]=l>>>5&127,i[n++]=l>>>12&127,i[n++]=l>>>19&127,i[n++]=127&(l>>>26|(1&c)<<6),i[n++]=c>>>1&127,i[n++]=c>>>8&127,i[n++]=c>>>15&127,i[n++]=c>>>22&127,i[n++]=127&(c>>>29|(15&u)<<3),i[n++]=u>>>4&127,i[n++]=u>>>11&127,i[n++]=u>>>18&127,i[n++]=u>>>25&127}}(e,t,i,r);break;case 8:!function(e,t,i,r){let n=r,o=t;for(let t=0;t<8;t++){const t=e[o++]>>>0,r=e[o++]>>>0,s=e[o++]>>>0,a=e[o++]>>>0,l=e[o++]>>>0,c=e[o++]>>>0,u=e[o++]>>>0,h=e[o++]>>>0;i[n++]=t>>>0&255,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=r>>>0&255,i[n++]=r>>>8&255,i[n++]=r>>>16&255,i[n++]=r>>>24&255,i[n++]=s>>>0&255,i[n++]=s>>>8&255,i[n++]=s>>>16&255,i[n++]=s>>>24&255,i[n++]=a>>>0&255,i[n++]=a>>>8&255,i[n++]=a>>>16&255,i[n++]=a>>>24&255,i[n++]=l>>>0&255,i[n++]=l>>>8&255,i[n++]=l>>>16&255,i[n++]=l>>>24&255,i[n++]=c>>>0&255,i[n++]=c>>>8&255,i[n++]=c>>>16&255,i[n++]=c>>>24&255,i[n++]=u>>>0&255,i[n++]=u>>>8&255,i[n++]=u>>>16&255,i[n++]=u>>>24&255,i[n++]=h>>>0&255,i[n++]=h>>>8&255,i[n++]=h>>>16&255,i[n++]=h>>>24&255}}(e,t,i,r);break;case 16:!function(e,t,i,r){let n=r,o=t;for(let t=0;t<128;t++){const t=e[o++]>>>0;i[n++]=65535&t,i[n++]=t>>>16&65535}}(e,t,i,r);break;default:!function(e,t,i,r,n){const o=fp[n]>>>0;let s=t,a=0,l=e[s]>>>0,c=r;for(let t=0;t<8;t++){for(let t=0;t<32;t++)if(a+n<=32)i[c+t]=l>>>a&o,a+=n,32===a&&(a=0,s++,31!==t&&(l=e[s]>>>0));else{const r=32-a,u=l>>>a;s++,l=e[s]>>>0;const h=n-r;i[c+t]=(u|(l&-1>>>32-h>>>0)<<r)&o,a=h}c+=32,a=0,t<7&&(l=e[s]>>>0)}}(e,t,i,r,n)}return t+(n<<3)|0}function wp(e,t,i,r){if(i+2>t)throw new Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${t})`);const n=e[i++],o=e[i++];if(n>32)throw new Error(`FastPFOR decode: invalid bitWidth=${n} at block=${r}
2 (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:o,bytePosIn:i}}function Tp(e,t,i,r,n,o,s,a,l){const{maxBits:c,exceptionBitWidth:u,bytePosIn:h}=function(e,t,i,r,n,o){if(i+1>t)throw new Error(`FastPFOR decode: exception header underflow at block=${o} (need 1 byte for maxBits, bytePos=${i}, byteSize=${t})`);const s=e[i++];if(s<r||s>32)throw new Error(`FastPFOR decode: invalid maxBits=${s} at block=${o} (bitWidth=${r}, expected ${r}..32)`);const a=s-r|0;if(a<1||a>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${a} at block=${o} (bitWidth=${r}, maxBits=${s})`);if(i+n>t)throw new Error(`FastPFOR decode: exception positions underflow at block=${o} (need=${n}, have=${t-i})`);return{maxBits:s,exceptionBitWidth:a,bytePosIn:i}}(n,o,s,i,r,l);if(s=h,1===u){const o=1<<i;for(let i=0;i<r;i=i+1|0)e[n[s++]+t|0]|=o;return s}const d=a.dataToBePacked[u];if(!d)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${u} (bitWidth=${i}, maxBits=${c}) at block ${l}`);const p=a.dataPointers;let f=0|p[u];const m=0|a.exceptionSizes[u];if(f+r>m)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${u} (ptr=${f}, need ${r}, size=${m}) at block ${l}`);for(let o=0;o<r;o=o+1|0){const r=n[s++],o=0|d[f++];e[r+t|0]|=o<<i}return p[u]=f,s}function Ep(e,t,i,r,n,o){const s=0|i,a=0|e[s];if(a<=0||s+a>e.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${a} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);const l=s+1|0,c=s+a|0,u=e[c]>>>0,h=u+3>>>2,d=c+1,p=d+h;if(p>=e.length)throw new Error(`FastPFOR decode: invalid byteSize=${u} (metaInts=${h}, pageStart=${s}, packedEnd=${c}, byteContainerStart=${d}) causes bitmapPos=${p} out of bounds (encoded.length=${e.length})`);const f=function(e,t,i,r){r.byteContainer.length<i&&(r.byteContainer=new Uint8Array(2*i),r.byteContainerI32=void 0);const n=r.byteContainer,o=i>>>2;if(3&n.byteOffset)for(let i=0;i<o;i=i+1|0){const r=0|e[t+i|0],o=i<<2;n[o]=255&r,n[o+1|0]=r>>>8&255,n[o+2|0]=r>>>16&255,n[o+3|0]=r>>>24&255}else{let i=r.byteContainerI32;(!i||i.buffer!==n.buffer||i.byteOffset!==n.byteOffset||i.length<o)&&(i=r.byteContainerI32=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>>2)),i.set(e.subarray(t,t+o))}const s=3&i;if(s>0){const i=0|e[t+o|0],r=o<<2;for(let e=0;e<s;e=e+1|0)n[r+e|0]=i>>>(e<<3)&255}return n}(e,d,u,o),m=u,g=function(e,t,i){const r=0|e[t++],n=i.dataToBePacked;for(let o=2;o<=32;o=o+1|0){if(!(r>>>o-1&1))continue;if(t>=e.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${o}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);const s=e[t++]>>>0,a=gp(s+31,32),l=s*o+31>>>5;if(t+l>e.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${o}, size=${s}, streamWordIndex=${t}, needWords=${l}, availableWords=${e.length-t}, encodedWords=${e.length})`);let c=n[o];(!c||c.length<a)&&(c=n[o]=new Uint32Array(a));let u=0;for(;u<s;u=u+32|0)Sp(e,t,c,u,o),t=t+o|0;t=t-((u-s|0)*o>>>5)|0,i.exceptionSizes[o]=s}return t}(e,p,o);return o.dataPointers.fill(0),function(e,t,i,r,n,o,s,a,l,c){let u=0|i,h=0;for(let t=0;t<s;t=t+1|0){const i=wp(a,l,h,t);h=i.bytePosIn;const r=i.bitWidth,s=i.exceptionCount,d=o+t*mp|0;switch(r){case 0:n.fill(0,d,d+mp);break;case 32:for(let t=0;t<mp;t=t+1|0)n[d+t|0]=0|e[u+t|0];u=u+mp|0;break;default:u=xp(e,u,n,d,r)}s>0&&(h=Tp(n,d,r,s,a,l,h,c,t))}if(u!==r)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${i}, consumedPackedEnd=${u}, expectedPackedEnd=${r}, packedWords=${r-i}, encoded.length=${e.length})`)}(e,s,l,c,t,0|r,n/mp|0,f,m,o),g}function Sp(e,t,i,r,n){switch(n){case 2:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0;i[n++]=o>>>0&3,i[n++]=o>>>2&3,i[n++]=o>>>4&3,i[n++]=o>>>6&3,i[n++]=o>>>8&3,i[n++]=o>>>10&3,i[n++]=o>>>12&3,i[n++]=o>>>14&3,i[n++]=o>>>16&3,i[n++]=o>>>18&3,i[n++]=o>>>20&3,i[n++]=o>>>22&3,i[n++]=o>>>24&3,i[n++]=o>>>26&3,i[n++]=o>>>28&3,i[n++]=o>>>30&3,i[n++]=s>>>0&3,i[n++]=s>>>2&3,i[n++]=s>>>4&3,i[n++]=s>>>6&3,i[n++]=s>>>8&3,i[n++]=s>>>10&3,i[n++]=s>>>12&3,i[n++]=s>>>14&3,i[n++]=s>>>16&3,i[n++]=s>>>18&3,i[n++]=s>>>20&3,i[n++]=s>>>22&3,i[n++]=s>>>24&3,i[n++]=s>>>26&3,i[n++]=s>>>28&3,i[n]=s>>>30&3}(e,t,i,r);case 3:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0;i[n++]=o>>>0&7,i[n++]=o>>>3&7,i[n++]=o>>>6&7,i[n++]=o>>>9&7,i[n++]=o>>>12&7,i[n++]=o>>>15&7,i[n++]=o>>>18&7,i[n++]=o>>>21&7,i[n++]=o>>>24&7,i[n++]=o>>>27&7,i[n++]=7&(o>>>30|(1&s)<<2),i[n++]=s>>>1&7,i[n++]=s>>>4&7,i[n++]=s>>>7&7,i[n++]=s>>>10&7,i[n++]=s>>>13&7,i[n++]=s>>>16&7,i[n++]=s>>>19&7,i[n++]=s>>>22&7,i[n++]=s>>>25&7,i[n++]=s>>>28&7,i[n++]=7&(s>>>31|(3&a)<<1),i[n++]=a>>>2&7,i[n++]=a>>>5&7,i[n++]=a>>>8&7,i[n++]=a>>>11&7,i[n++]=a>>>14&7,i[n++]=a>>>17&7,i[n++]=a>>>20&7,i[n++]=a>>>23&7,i[n++]=a>>>
vendor: 4,121 bytes, line 2
226&7,i[n]=a>>>29&7}(e,t,i,r);case 4:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0,l=e[t+3]>>>0;i[n++]=o>>>0&15,i[n++]=o>>>4&15,i[n++]=o>>>8&15,i[n++]=o>>>12&15,i[n++]=o>>>16&15,i[n++]=o>>>20&15,i[n++]=o>>>24&15,i[n++]=o>>>28&15,i[n++]=s>>>0&15,i[n++]=s>>>4&15,i[n++]=s>>>8&15,i[n++]=s>>>12&15,i[n++]=s>>>16&15,i[n++]=s>>>20&15,i[n++]=s>>>24&15,i[n++]=s>>>28&15,i[n++]=a>>>0&15,i[n++]=a>>>4&15,i[n++]=a>>>8&15,i[n++]=a>>>12&15,i[n++]=a>>>16&15,i[n++]=a>>>20&15,i[n++]=a>>>24&15,i[n++]=a>>>28&15,i[n++]=l>>>0&15,i[n++]=l>>>4&15,i[n++]=l>>>8&15,i[n++]=l>>>12&15,i[n++]=l>>>16&15,i[n++]=l>>>20&15,i[n++]=l>>>24&15,i[n]=l>>>28&15}(e,t,i,r);case 5:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0,l=e[t+3]>>>0,c=e[t+4]>>>0;i[n++]=o>>>0&31,i[n++]=o>>>5&31,i[n++]=o>>>10&31,i[n++]=o>>>15&31,i[n++]=o>>>20&31,i[n++]=o>>>25&31,i[n++]=31&(o>>>30|(7&s)<<2),i[n++]=s>>>3&31,i[n++]=s>>>8&31,i[n++]=s>>>13&31,i[n++]=s>>>18&31,i[n++]=s>>>23&31,i[n++]=31&(s>>>28|(1&a)<<4),i[n++]=a>>>1&31,i[n++]=a>>>6&31,i[n++]=a>>>11&31,i[n++]=a>>>16&31,i[n++]=a>>>21&31,i[n++]=a>>>26&31,i[n++]=31&(a>>>31|(15&l)<<1),i[n++]=l>>>4&31,i[n++]=l>>>9&31,i[n++]=l>>>14&31,i[n++]=l>>>19&31,i[n++]=l>>>24&31,i[n++]=31&(l>>>29|(3&c)<<3),i[n++]=c>>>2&31,i[n++]=c>>>7&31,i[n++]=c>>>12&31,i[n++]=c>>>17&31,i[n++]=c>>>22&31,i[n]=c>>>27&31}(e,t,i,r);case 6:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0,l=e[t+3]>>>0,c=e[t+4]>>>0,u=e[t+5]>>>0;i[n++]=o>>>0&63,i[n++]=o>>>6&63,i[n++]=o>>>12&63,i[n++]=o>>>18&63,i[n++]=o>>>24&63,i[n++]=63&(o>>>30|(15&s)<<2),i[n++]=s>>>4&63,i[n++]=s>>>10&63,i[n++]=s>>>16&63,i[n++]=s>>>22&63,i[n++]=63&(s>>>28|(3&a)<<4),i[n++]=a>>>2&63,i[n++]=a>>>8&63,i[n++]=a>>>14&63,i[n++]=a>>>20&63,i[n++]=a>>>26&63,i[n++]=l>>>0&63,i[n++]=l>>>6&63,i[n++]=l>>>12&63,i[n++]=l>>>18&63,i[n++]=l>>>24&63,i[n++]=63&(l>>>30|(15&c)<<2),i[n++]=c>>>4&63,i[n++]=c>>>10&63,i[n++]=c>>>16&63,i[n++]=c>>>22&63,i[n++]=63&(c>>>28|(3&u)<<4),i[n++]=u>>>2&63,i[n++]=u>>>8&63,i[n++]=u>>>14&63,i[n++]=u>>>20&63,i[n]=u>>>26&63}(e,t,i,r);case 7:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0,l=e[t+3]>>>0,c=e[t+4]>>>0,u=e[t+5]>>>0,h=e[t+6]>>>0;i[n++]=o>>>0&127,i[n++]=o>>>7&127,i[n++]=o>>>14&127,i[n++]=o>>>21&127,i[n++]=127&(o>>>28|(7&s)<<4),i[n++]=s>>>3&127,i[n++]=s>>>10&127,i[n++]=s>>>17&127,i[n++]=s>>>24&127,i[n++]=127&(s>>>31|(63&a)<<1),i[n++]=a>>>6&127,i[n++]=a>>>13&127,i[n++]=a>>>20&127,i[n++]=127&(a>>>27|(3&l)<<5),i[n++]=l>>>2&127,i[n++]=l>>>9&127,i[n++]=l>>>16&127,i[n++]=l>>>23&127,i[n++]=127&(l>>>30|(31&c)<<2),i[n++]=c>>>5&127,i[n++]=c>>>12&127,i[n++]=c>>>19&127,i[n++]=127&(c>>>26|(1&u)<<6),i[n++]=u>>>1&127,i[n++]=u>>>8&127,i[n++]=u>>>15&127,i[n++]=u>>>22&127,i[n++]=127&(u>>>29|(15&h)<<3),i[n++]=h>>>4&127,i[n++]=h>>>11&127,i[n++]=h>>>18&127,i[n]=h>>>25&127}(e,t,i,r);case 8:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0,l=e[t+3]>>>0,c=e[t+4]>>>0,u=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0;i[n++]=o>>>0&255,i[n++]=o>>>8&255,i[n++]=o>>>16&255,i[n++]=o>>>24&255,i[n++]=s>>>0&255,i[n++]=s>>>8&255,i[n++]=s>>>16&255,i[n++]=s>>>24&255,i[n++]=a>>>0&255,i[n++]=a>>>8&255,i[n++]=a>>>16&255,i[n++]=a>>>24&255,i[n++]=l>>>0&255,i[n++]=l>>>8&255,i[n++]=l>>>16&255,i[n++]=l>>>24&255,i[n++]=c>>>0&255,i[n++]=c>>>8&255,i[n++]=c>>>16&255,i[n++]=c>>>24&255,i[n++]=u>>>0&255,i[n++]=u>>>8&255,i[n++]=u>>>16&255,i[n++]=u>>>24&255,i[n++]=h>>>0&255,i[n++]=h>>>8&255,i[n++]=h>>>16&255,i[n++]=h>>>24&255,i[n++]=d>>>0&255,i[n++]=d>>>8&255,i[n++]=d>>>16&255,i[n]=d>>>24&255}(e,t,i,r);case 9:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0,l=e[t+3]>>>0,c=e[t+4]>>>0,u=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0;i[n++]=o>>>0&511,i[n++]=o>>>9&511,i[n++]=o>>>18&511,i[n++]=511&(o>>>27|(15&s)<<5),i[n++]=s>>>4&511,i[n++]=s>>>13&511,i[n++]=s>>>22&511,i[n++]=511&(s>>>31|(255&a)<<1),i[n++]=a>>>8&511,i[n++]=a>>>17&511,i[n++]=511&(a>>>26|(7&l)<<6),i[n++]=l>>>3&511,i[n++]=l>>>12&511,i[n++]=l>>>21&511,i[n++]=511&(l>>>30|(127&c)<<2),i[n++]=c>>>7&511,i[n++]=c>>>16&511,i[n++]=511&(c>>>
225|(3&u)<<7),i[n++]=u>>>2&511,i[n++]=u>>>11&511,i[n++]=u>>>20&511,i[n++]=511&(u>>>29|(63&h)<<3),i[n++]=h>>>6&511,i[n++]=h>>>15&511,i[n++]=511&(h>>>24|(1&d)<<8),i[n++]=d>>>1&511,i[n++]=d>>>10&511,i[n++]=d>>>19&511,i[n++]=511&(d>>>28|(31&p)<<4),i[n++]=p>>>5&511,i[n++]=p>>>14&511,i[n]=p>>>23&511}(e,t,i,r);case 10:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0,l=e[t+3]>>>0,c=e[t+4]>>>0,u=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0;i[n++]=o>>>0&1023,i[n++]=o>>>10&1023,i[n++]=o>>>20&1023,i[n++]=1023&(o>>>30|(255&s)<<2),i[n++]=s>>>8&1023,i[n++]=s>>>18&1023,i[n++]=1023&(s>>>28|(63&a)<<4),i[n++]=a>>>6&1023,i[n++]=a>>>16&1023,i[n++]=1023&(a>>>26|(15&l)<<6),i[n++]=l>>>4&1023,i[n++]=l>>>14&1023,i[n++]=1023&(l>>>24|(3&c)<<8),i[n++]=c>>>2&1023,i[n++]=c>>>12&1023,i[n++]=c>>>22&1023,i[n++]=u>>>0&1023,i[n++]=u>>>10&1023,i[n++]=u>>>20&1023,i[n++]=1023&(u>>>30|(255&h)<<2),i[n++]=h>>>8&1023,i[n++]=h>>>18&1023,i[n++]=1023&(h>>>28|(63&d)<<4),i[n++]=d>>>6&1023,i[n++]=d>>>16&1023,i[n++]=1023&(d>>>26|(15&p)<<6),i[n++]=p>>>4&1023,i[n++]=p>>>14&1023,i[n++]=1023&(p>>>24|(3&f)<<8),i[n++]=f>>>2&1023,i[n++]=f>>>12&1023,i[n]=f>>>22&1023}(e,t,i,r);case 11:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0,l=e[t+3]>>>0,c=e[t+4]>>>0,u=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0;i[n++]=o>>>0&2047,i[n++]=o>>>11&2047,i[n++]=2047&(o>>>22|(1&s)<<10),i[n++]=s>>>1&2047,i[n++]=s>>>12&2047,i[n++]=2047&(s>>>23|(3&a)<<9),i[n++]=a>>>2&2047,i[n++]=a>>>13&2047,i[n++]=2047&(a>>>24|(7&l)<<8),i[n++]=l>>>3&2047,i[n++]=l>>>14&2047,i[n++]=2047&(l>>>25|(15&c)<<7),i[n++]=c>>>4&2047,i[n++]=c>>>15&2047,i[n++]=2047&(c>>>26|(31&u)<<6),i[n++]=u>>>5&2047,i[n++]=u>>>16&2047,i[n++]=2047&(u>>>27|(63&h)<<5),i[n++]=h>>>6&2047,i[n++]=h>>>17&2047,i[n++]=2047&(h>>>28|(127&d)<<4),i[n++]=d>>>7&2047,i[n++]=d>>>18&2047,i[n++]=2047&(d>>>29|(255&p)<<3),i[n++]=p>>>8&2047,i[n++]=p>>>19&2047,i[n++]=2047&(p>>>30|(511&f)<<2),i[n++]=f>>>9&2047,i[n++]=f>>>20&2047,i[n++]=2047&(f>>>31|(1023&m)<<1),i[n++]=m>>>10&2047,i[n]=m>>>21&2047}(e,t,i,r);case 12:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0,l=e[t+3]>>>0,c=e[t+4]>>>0,u=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0;i[n++]=o>>>0&4095,i[n++]=o>>>12&4095,i[n++]=4095&(o>>>24|(15&s)<<8),i[n++]=s>>>4&4095,i[n++]=s>>>16&4095,i[n++]=4095&(s>>>28|(255&a)<<4),i[n++]=a>>>8&4095,i[n++]=a>>>20&4095,i[n++]=l>>>0&4095,i[n++]=l>>>12&4095,i[n++]=4095&(l>>>24|(15&c)<<8),i[n++]=c>>>4&4095,i[n++]=c>>>16&4095,i[n++]=4095&(c>>>28|(255&u)<<4),i[n++]=u>>>8&4095,i[n++]=u>>>20&4095,i[n++]=h>>>0&4095,i[n++]=h>>>12&4095,i[n++]=4095&(h>>>24|(15&d)<<8),i[n++]=d>>>4&4095,i[n++]=d>>>16&4095,i[n++]=4095&(d>>>28|(255&p)<<4),i[n++]=p>>>8&4095,i[n++]=p>>>20&4095,i[n++]=f>>>0&4095,i[n++]=f>>>12&4095,i[n++]=4095&(f>>>24|(15&m)<<8),i[n++]=m>>>4&4095,i[n++]=m>>>16&4095,i[n++]=4095&(m>>>28|(255&g)<<4),i[n++]=g>>>8&4095,i[n]=g>>>20&4095}(e,t,i,r);case 16:return void function(e,t,i,r){let n=r;const o=e[t]>>>0,s=e[t+1]>>>0,a=e[t+2]>>>0,l=e[t+3]>>>0,c=e[t+4]>>>0,u=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0,y=e[t+12]>>>0,_=e[t+13]>>>0,v=e[t+14]>>>0,b=e[t+15]>>>0;i[n++]=o>>>0&65535,i[n++]=o>>>16&65535,i[n++]=s>>>0&65535,i[n++]=s>>>16&65535,i[n++]=a>>>0&65535,i[n++]=a>>>16&65535,i[n++]=l>>>0&65535,i[n++]=l>>>16&65535,i[n++]=c>>>0&65535,i[n++]=c>>>16&65535,i[n++]=u>>>0&65535,i[n++]=u>>>16&65535,i[n++]=h>>>0&65535,i[n++]=h>>>16&65535,i[n++]=d>>>0&65535,i[n++]=d>>>16&65535,i[n++]=p>>>0&65535,i[n++]=p>>>16&65535,i[n++]=f>>>0&65535,i[n++]=f>>>16&65535,i[n++]=m>>>0&65535,i[n++]=m>>>16&65535,i[n++]=g>>>0&65535,i[n++]=g>>>16&65535,i[n++]=y>>>0&65535,i[n++]=y>>>16&65535,i[n++]=_>>>0&65535,i[n++]=_>>>16&65535,i[n++]=v>>>0&65535,i[n++]=v>>>16&65535,i[n++]=b>>>0&65535,i[n]=b>>>16&65535}(e,t,i,r);case 32:for(let n=0;n<32;n=n+1|0)i[r+n|0]=0|e[t+n|0];return}const o=fp[n]>>>0;let s=t,a=0,l=e[s]>>>0;for(let t=0;t<32;t++)if(a+n<=32)i[r+t]=l>>>a&o,a+=n,32===a&&(a=0,s++,31!==t&&(l=e[s]>>>0));
2else{const c=32-a,u=l>>>a;s++,l=e[s]>>>0,i[r+t]=(u|(l&fp[n-c]>>>0)<<c)&o,a=n-c}}function Pp(e,t,i){const r=new Uint32Array(i);let n=0,o=t.get();for(let t=0;t<r.length;t++){let t=e[o++],i=127&t;t<128||(t=e[o++],i|=(127&t)<<7,t<128||(t=e[o++],i|=(127&t)<<14,t<128||(t=e[o++],i|=(127&t)<<21,t<128||(t=e[o++],i|=(15&t)<<28)))),r[n++]=i}return t.set(o),r}function Ip(e,t,i){const r=new BigUint64Array(i);for(let i=0;i<r.length;i++)r[i]=Cp(e,t);return r}function Cp(e,t){let i=0n,r=0,n=t.get();for(;n<e.length;){const t=e[n++];if(i|=BigInt(127&t)<<BigInt(r),!(128&t))break;if(r+=7,r>=64)throw new Error("Varint too long")}return t.set(n),i}function Mp(e,t){let i,r;return r=e[t.get()],t.increment(),i=127&r,r<128?i:(r=e[t.get()],t.increment(),i|=(127&r)<<7,r<128?i:(r=e[t.get()],t.increment(),i|=(127&r)<<14,r<128?i:(r=e[t.get()],t.increment(),i|=(127&r)<<21,r<128?i:(r=e[t.get()],i|=(15&r)<<28,function(e,t,i){let r,n;if(n=t[i.get()],i.increment(),r=(112&n)>>4,n<128)return 4294967296*r+(e>>>0);if(n=t[i.get()],i.increment(),r|=(127&n)<<3,n<128)return 4294967296*r+(e>>>0);if(n=t[i.get()],i.increment(),r|=(127&n)<<10,n<128)return 4294967296*r+(e>>>0);if(n=t[i.get()],i.increment(),r|=(127&n)<<17,n<128)return 4294967296*r+(e>>>0);if(n=t[i.get()],i.increment(),r|=(127&n)<<24,n<128)return 4294967296*r+(e>>>0);if(n=t[i.get()],i.increment(),r|=(1&n)<<31,n<128)return 4294967296*r+(e>>>0);throw new Error("Expected varint not more than 10 bytes")}(i,e,t)))))}function Ap(e){return e>>>1^-(1&e)}function Lp(e){return e>>1n^-(1n&e)}function Fp(e){return e%2==1?(e+1)/-2:e/2}function Dp(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=e[r]}const r=new Uint32Array(i);let n=0;for(let i=0;i<t;i++){const o=e[i];r.fill(e[i+t],n,n+o),n+=o}return r}function kp(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=Number(e[r])}const r=new BigUint64Array(i);let n=0;for(let i=0;i<t;i++){const o=Number(e[i]);r.fill(e[i+t],n,n+o),n+=o}return r}function Op(e,t,i){const r=new Float64Array(i);let n=0;for(let i=0;i<t;i++){const o=e[i];r.fill(e[i+t],n,n+o),n+=o}return r}function Rp(e){const t=new Int32Array(e.length);t[0]=Ap(e[0]);const i=e.length/4*4;let r=1;if(i>=4)for(;r<i-4;r+=4){const i=e[r+1],n=e[r+2],o=e[r+3];t[r]=Ap(e[r])+t[r-1],t[r+1]=Ap(i)+t[r],t[r+2]=Ap(n)+t[r+1],t[r+3]=Ap(o)+t[r+2]}for(;r!==e.length;++r)t[r]=Ap(e[r])+t[r-1];return t}function zp(e){const t=new BigInt64Array(e.length);t[0]=Lp(e[0]);const i=e.length/4*4;let r=1;if(i>=4)for(;r<i-4;r+=4){const i=e[r+1],n=e[r+2],o=e[r+3];t[r]=Lp(e[r])+t[r-1],t[r+1]=Lp(i)+t[r],t[r+2]=Lp(n)+t[r+1],t[r+3]=Lp(o)+t[r+2]}for(;r!==t.length;++r)t[r]=Lp(e[r])+t[r-1];return t}function Np(e){const t=e.length/4*4;let i=1;if(t>=4)for(let r=e[0];i<t-4;i+=4)r=e[i]+=r,r=e[i+1]+=r,r=e[i+2]+=r,r=e[i+3]+=r;for(;i!==e.length;)e[i]+=e[i-1],++i}var Bp,Vp,jp,Up,Gp,$p,qp,Zp;function Wp(e,t){const i=function(e,t){const i=e[t.get()],r=Object.values(Bp)[i>>4];let n=null;switch(r){case Bp.DATA:n={dictionaryType:Object.values(Vp)[15&i]};break;case Bp.OFFSET:n={offsetType:Object.values(jp)[15&i]};break;case Bp.LENGTH:n={lengthType:Object.values(Up)[15&i]}}t.increment();const o=e[t.get()],s=Object.values(hp)[o>>5],a=Object.values(hp)[o>>2&7],l=Object.values(dp)[3&o];t.increment();const c=Pp(e,t,2),u=c[0];return{physicalStreamType:r,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:a,physicalLevelTechnique:l,numValues:u,byteLength:c[1],decompressedCount:u}}(e,t);return i.logicalLevelTechnique1===hp.MORTON?function(e,t,i){const r=Pp(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:r[0],coordinateShift:r[1]}}(i,e,t):hp.RLE!==i.logicalLevelTechnique1&&hp.RLE!==i.logicalLevelTechnique2||dp.NONE===i.physicalLevelTechnique?i:function(e,t,i){const r=Pp(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}(i,e,t)}!function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"}(Bp||(Bp={})),function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"}(Vp||(Vp={})),function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"}(jp||(jp={})),function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"}(Up||(Up={}
2)),function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(Gp||(Gp={}));class Hp{constructor(e,t){this.values=e,this._size=t}get(e){const t=Math.floor(e/8);return 1==(this.values[t]>>e%8&1)}set(e,t){const i=Math.floor(e/8);this.values[i]=this.values[i]|(t?1:0)<<e%8}getInt(e){const t=Math.floor(e/8);return this.values[t]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function Xp(e,t,i){if(!t)return e;const r=t.size(),n=new(0,e.constructor)(r);let o=0;for(let s=0;s<r;s++)n[s]=t.get(s)?e[o++]:i;return n}function Yp(e,t,i,r,n){return function(e,t,i,r){let n;switch(t.logicalLevelTechnique1){case hp.DELTA:if(t.logicalLevelTechnique2===hp.RLE){const i=t;if(!r)return function(e,t,i){const r=new Int32Array(i);let n=0,o=0;for(let i=0;i<t;i++){const s=e[i],a=Ap(e[i+t]);for(let e=0;e<s;e++)o+=a,r[n++]=o}return r}(e,i.runs,i.numRleValues);n=Rp(e=Dp(e,i.runs,i.numRleValues))}else n=Rp(e);break;case hp.RLE:n=function(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=e[r]}const r=new Int32Array(i);let n=0;for(let i=0;i<t;i++){const o=e[i];let s=e[i+t];s=Ap(s),r.fill(s,n,n+o),n+=o}return r}(e,t.runs,t.numRleValues);break;case hp.MORTON:Np(e),n=new Int32Array(e);break;case hp.COMPONENTWISE_DELTA:n=function(e){if(e.length<2)return new Int32Array(e);const t=new Int32Array(e.length);t[0]=Ap(e[0]),t[1]=Ap(e[1]);const i=e.length/4*4;let r=2;if(i>=4)for(;r<i-4;r+=4){const i=e[r+1],n=e[r+2],o=e[r+3];t[r]=Ap(e[r])+t[r-2],t[r+1]=Ap(i)+t[r-1],t[r+2]=Ap(n)+t[r],t[r+3]=Ap(o)+t[r+1]}for(;r!==e.length;r+=2)t[r]=Ap(e[r])+t[r-2],t[r+1]=Ap(e[r+1])+t[r-1];return t}(e);break;case hp.NONE:n=function(e){const t=new Int32Array(e.length);for(let i=0;i<e.length;i++)t[i]=Ap(e[i]);return t}(e);break;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Xp(n,r,0):n}(Qp(e,t,i),i,0,n)}function Jp(e,t,i,r,n){return function(e,t,i,r){let n;switch(t.logicalLevelTechnique1){case hp.DELTA:n=function(e){const t=new Uint32Array(e.length);t[0]=Ap(e[0])>>>0;for(let i=1;i<e.length;i++)t[i]=t[i-1]+Ap(e[i])>>>0;return t}(t.logicalLevelTechnique2===hp.RLE?Dp(e,t.runs,t.numRleValues):e);break;case hp.RLE:n=Dp(e,t.runs,t.numRleValues);break;case hp.MORTON:Np(e),n=e;break;case hp.COMPONENTWISE_DELTA:n=function(e){if(e.length<2)return new Uint32Array(e);const t=new Uint32Array(e.length);t[0]=Ap(e[0])>>>0,t[1]=Ap(e[1])>>>0;for(let i=2;i<e.length;i+=2)t[i]=t[i-2]+Ap(e[i])>>>0,t[i+1]=t[i-1]+Ap(e[i+1])>>>0;return t}(e);break;case hp.NONE:n=e;break;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Xp(n,r,0):n}(Qp(e,t,i),i,0,n)}function Kp(e,t,i){return function(e,t){if(t.logicalLevelTechnique1===hp.DELTA&&t.logicalLevelTechnique2===hp.NONE)return function(e){const t=new Int32Array(e.length+1);t[0]=0,t[1]=Ap(e[0]);let i=t[1];for(let r=2;r!==t.length;++r)i+=Ap(e[r-1]),t[r]=t[r-1]+i;return new Uint32Array(t)}(e);if(t.logicalLevelTechnique1===hp.RLE&&t.logicalLevelTechnique2===hp.NONE)return function(e,t,i){const r=new Uint32Array(i+1);r[0]=0;let n=1,o=r[0];for(let i=0;i<t;i++){const s=e[i],a=e[i+t];for(let e=n;e<n+s;e++)r[e]=a+o,o=r[e];n+=s}return r}(e,t.runs,t.numRleValues);if(t.logicalLevelTechnique1===hp.NONE&&t.logicalLevelTechnique2===hp.NONE){!function(e){let t=0;for(let i=0;i<e.length;i++)e[i]+=t,t=e[i]}(e);const i=new Uint32Array(t.numValues+1);return i[0]=0,i.set(e,1),i}if(t.logicalLevelTechnique1===hp.DELTA&&t.logicalLevelTechnique2===hp.RLE){const i=function(e,t,i){const r=new Int32Array(i+1);r[0]=0;let n=1,o=r[0];for(let i=0;i<t;i++){const s=e[i];let a=e[i+t];a=Ap(a);for(let e=n;e<n+s;e++)r[e]=a+o,o=r[e];n+=s}return r}(e,t.runs,t.numRleValues);return Np(i),new Uint32Array(i)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}(Qp(e,t,i),i)}function Qp(e,t,i){const r=i.physicalLevelTechnique;switch(r){case dp.FAST_PFOR:return function(e,t,i,r){return function(e,t,i,r,n){const o=r.get();
2if(3&i)throw new Error(`FastPFOR: invalid encodedByteLength=${i} at offset=${o} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const s=i>>>2,a=function(e,t){if(t<=e.encodedWords.length)return e.encodedWords;const i=new Uint32Array(Math.max(16,2*t));return e.encodedWords=i,i}(n,s);!function(e,t,i,r){if(t<0||i<0||t+i>e.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${i}, bytes.length=${e.length})`);const n=Math.floor(i/4),o=i%4!=0,s=o?n+1:n;if(r.length<s)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${s}`);if(n>0){const i=e.byteOffset+t;if(3&i)for(let i=0;i<n;i++){const n=t+4*i;r[i]=e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]}else{const t=new Uint32Array(e.buffer,i,n);for(let e=0;e<n;e++)r[e]=0|yp(t[e])}}if(o){const o=t+4*n,s=i-4*n;let a=0;for(let t=0;t<s;t++)a|=e[o+t]<<24-8*t;r[n]=0|a}}(e,o,i,a);const l=function(e,t,i){let r=0,n=0;const o=new Uint32Array(t),s=i??bp();if(e.length>0){const t=0|e[r];if(r=r+1|0,255&t)throw new Error(`FastPFOR decode: invalid alignedLength=${t} (expected multiple of 256)`);if(n+t>o.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${t}, out.length=${o.length})`);r=function(e,t,i,r,n,o){const s=r+gp(n,mp);let a=r,l=i;for(;a!==s;){const i=Math.min(_p,s-a);l=Ep(e,t,l,a,i,o),a=a+i|0}return l}(e,o,r,n,t,s),n=n+t|0}return function(e,t,i,r,n,o){if(0===o)return t;let s=0,a=t;const l=t+i,c=n;let u=n;const h=n+o;let d=0,p=0;for(;a<l&&u<h;){const t=e[a]>>>s&255;if(s+=8,a+=s>>>5,s&=31,d|=(127&t)<<p,128&t)r[u++]=0|d,d=0,p=0;else if(p+=7,p>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${d}, decoded=${u-c}/${o}, inPos=${a}, inEnd=${l})`)}if(u!==h)throw new Error(`FastPFOR VByte: truncated stream (decoded=${u-c}, expected=${o}, consumedWords=${a-t}/${i}, vbyteStart=${t}, vbyteEnd=${l})`)}(e,r,e.length-r|0,o,n,t-n|0),o}(a.subarray(0,s),t,n.decoderWorkspace);return r.add(i),l}(e,t,i,r,function(e=16){if(e<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);const t=Math.max(16,0|e);return{encodedWords:new Uint32Array(t),decoderWorkspace:bp()}}(i>>>2))}(e,i.numValues,i.byteLength,t);case dp.VARINT:return Pp(e,t,i.numValues);case dp.NONE:{const r=t.get();t.add(i.byteLength);const n=e.subarray(r,t.get());return new Uint32Array(n)}default:throw new Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function ef(e,t,i){const r=Qp(e,t,i);return 1===r.length?r[0]:function(e){return e[1]}(r)}function tf(e,t,i){return function(e){if(2===e.length){const t=Ap(e[1]);return[t,t]}return[Ap(e[2]),Ap(e[3])]}(Qp(e,t,i))}function rf(e,t,i){return function(e){if(2===e.length){const t=Lp(e[1]);return[t,t]}return[Lp(e[2]),Lp(e[3])]}(Ip(e,t,i.numValues))}function nf(e,t,i,r){return function(e,t,i){let r;switch(t.logicalLevelTechnique1){case hp.DELTA:r=function(e){const t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,Lp(e[0]));for(let i=1;i<e.length;i++)t[i]=BigInt.asUintN(64,t[i-1]+Lp(e[i]));return t}(t.logicalLevelTechnique2===hp.RLE?kp(e,t.runs,t.numRleValues):e);break;case hp.RLE:r=kp(e,t.runs,t.numRleValues);break;case hp.NONE:r=e;break;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Xp(r,i,0n):r}(Ip(e,t,i.numValues),i,r)}function of(e,t,i){const r=Ip(e,t,i.numValues);return 1===r.length?r[0]:function(e){return e[1]}(r)}function sf(e,t,i,r,n="int32"){const o=e.logicalLevelTechnique1;if(o===hp.RLE)return 1===e.runs?Gp.CONST:Gp.FLAT;if(o!==hp.DELTA||e.logicalLevelTechnique2!==hp.RLE)return 1===e.numValues?Gp.CONST:Gp.FLAT;const s=t instanceof Hp?t.size():t;if(e.numRleValues!==s)return Gp.FLAT;if(1===e.runs)return Gp.SEQUENCE;if(2!==e.runs)return 1===e.numValues?Gp.CONST:Gp.FLAT;const a=r.get();if(e.physicalLevelTechnique===dp.VARINT)return function(e,t,i){const r=new up(t.get());if("int64"===i){const t=Ip(e,r,4);
2return 2n===t[2]&&2n===t[3]}const n=Pp(e,r,4);return 2===n[2]&&2===n[3]}(i,r,n)?Gp.SEQUENCE:1===e.numValues?Gp.CONST:Gp.FLAT;const l=r.get(),c=new Int32Array(i.buffer,i.byteOffset+l,4);return r.set(a),2===c[2]&&2===c[3]?Gp.SEQUENCE:1===e.numValues?Gp.CONST:Gp.FLAT}class af extends rp{getValueFromBuffer(e){return this.dataBuffer[e]}}class lf extends sp{constructor(e,t,i,r){super(e,BigInt64Array.of(t),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function cf(e,t,i){return{x:uf(e,t)-i,y:uf(e>>1,t)-i}}function uf(e,t){let i=0;for(let r=0;r<t;r++)i|=(e&1<<2*r)>>r;return i}function hf(e,t,r,n,o,s,a){return e===Zp.MORTON?function(e,t,r,n,o,s){const a=new Array(o?n+1:n);for(let o=0;o<n;o++){const n=cf(e[t[r+o]],s.numBits,s.coordinateShift);a[o]=new i(n.x,n.y)}return o&&(a[a.length-1]=a[0]),a}(t,r,n,o,s,a):function(e,t,r,n,o){const s=new Array(o?n+1:n);for(let o=0;o<2*n;o+=2){const n=2*t[r+o/2];s[o/2]=new i(e[n],e[n+1])}return o&&(s[s.length-1]=s[0]),s}(t,r,n,o,s)}function df(e,t,r,n){const o=new Array(n?r+1:r);for(let n=0;n<2*r;n+=2)o[n/2]=new i(e[t+n],e[t+n+1]);return n&&(o[o.length-1]=o[0]),o}!function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"}($p||($p={})),function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"}(qp||(qp={})),function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"}(Zp||(Zp={}));class pf{constructor(e,t,i,r,n){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=i,this._vertexBuffer=r,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){const t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const t=cf(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[t.x,t.y]}const t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return function(e){const t=new Array(e.numGeometries);let r=1,n=1,o=1,s=0,a=0,l=0;const c=e.mortonSettings,u=e.topologyVector,h=u.geometryOffsets,d=u.partOffsets,p=u.ringOffsets,f=e.vertexOffsets,m=!f||0===f.length,g=e.containsPolygonGeometry(),y=e.vertexBuffer;for(let u=0;u<e.numGeometries;u++)switch(e.geometryType(u)){case $p.POINT:{let u,g;if(m)u=y[a++],g=y[a++];else if(e.vertexBufferType===Zp.MORTON){const e=cf(y[f[l++]],c.numBits,c.coordinateShift);u=e.x,g=e.y}else{const e=2*f[l++];
2u=y[e],g=y[e+1]}t[s++]=[[new i(u,g)]],h&&o++,d&&r++,p&&n++}break;case $p.MULTIPOINT:{const e=h[o]-h[o-1];o++;const c=new Array(e);if(m)for(let t=0;t<e;t++){const e=y[a++],r=y[a++];c[t]=new i(e,r)}else for(let t=0;t<e;t++){const e=2*f[l++];c[t]=new i(y[e],y[e+1])}t[s++]=c.map((e=>[e])),r+=e,n+=e}break;case $p.LINESTRING:{let i,u;g?(i=p[n]-p[n-1],n++):i=d[r]-d[r-1],r++,m?(u=df(y,a,i,!1),a+=2*i):(u=hf(e.vertexBufferType,y,f,l,i,!1,c),l+=i),t[s++]=[u],h&&o++}break;case $p.POLYGON:{const i=d[r]-d[r-1];r++;const u=new Array(i-1);let g,_=p[n]-p[n-1];if(n++,m){g=df(y,a,_,!0),a+=2*_;for(let e=0;e<u.length;e++)_=p[n]-p[n-1],n++,u[e]=df(y,a,_,!0),a+=2*_}else{g=hf(e.vertexBufferType,y,f,l,_,!0,c),l+=_;for(let t=0;t<u.length;t++)_=p[n]-p[n-1],n++,u[t]=hf(e.vertexBufferType,y,f,l,_,!0,c),l+=_}t[s++]=[g].concat(u),h&&o++}break;case $p.MULTILINESTRING:{const i=h[o]-h[o-1];o++;const u=new Array(i);for(let t=0;t<i;t++){let i;if(g?(i=p[n]-p[n-1],n++):i=d[r]-d[r-1],r++,m)u[t]=df(y,a,i,!1),a+=2*i;else{const r=hf(e.vertexBufferType,y,f,l,i,!1,c);u[t]=r,l+=i}}t[s++]=u}break;case $p.MULTIPOLYGON:{const i=h[o]-h[o-1];o++;const u=new Array(i);for(let t=0;t<i;t++){const i=d[r]-d[r-1];let o;r++;const s=new Array(i-1),h=p[n]-p[n-1];n++,m?(o=df(y,a,h,!0),a+=2*h):(o=hf(e.vertexBufferType,y,f,l,h,!0,c),l+=h);for(let t=0;t<s.length;t++){const i=p[n]-p[n-1];n++,m?(s[t]=df(y,a,i,!0),a+=2*i):(s[t]=hf(e.vertexBufferType,y,f,l,i,!0,c),l+=i)}u[t]=[o].concat(s)}t[s++]=u.flat()}break;default:throw new Error("The specified geometry type is currently not supported.")}return t}(this)}get mortonSettings(){return this._mortonSettings}}class ff extends pf{constructor(e,t,i,r,n,o,s){super(i,r,n,o,s),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===$p.POLYGON||this._geometryType===$p.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class mf extends pf{constructor(e,t,i,r,n,o){super(e,i,r,n,o),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===$p.POLYGON||this.geometryType(e)===$p.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class gf{constructor(e,t,i,r){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=i,this._topologyVector=r}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),t=this._topologyVector,r=t.partOffsets,n=t.ringOffsets,o=t.geometryOffsets;let s=0,a=1,l=1,c=1;for(let t=0;t<this.numGeometries;t++)switch(this.geometryType(t)){case $p.POLYGON:{const u=r[a]-r[a-1];a++;const h=[];for(let e=0;e<u;e++){const e=n[l]-n[l-1];l++;const t=[];for(let r=0;r<e;r++){const e=this._vertexBuffer[s++],r=this._vertexBuffer[s++];t.push(new i(e,r))}t.length>0&&t.push(t[0]),h.push(t)}e[t]=h,o&&c++}break;case $p.MULTIPOLYGON:{const u=o[c]-o[c-1];c++;const h=[];for(let e=0;e<u;e++){const e=r[a]-r[a-1];a++;for(let t=0;t<e;t++){const e=n[l]-n[l-1];l++;const t=[];for(let r=0;r<e;r++){const e=this._vertexBuffer[s++],r=this._vertexBuffer[s++];t.push(new i(e,r))}t.length>0&&t.push(t[0]),h.push(t)}}e[t]=h}}return e}[Symbol.iterator](){return null}}function yf(e,t,i,r,n,o){return new _f(e,t,i,r,n,o)}class _f extends gf{constructor(e,t,i,r,n,o){super(i,r,n,o),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function vf(e,t,i,r,n){return new bf(e,t,i,r,n)}class bf extends gf{constructor(e,t,i,r,n){super(t,i,r,n),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function xf(e,t,i,r,n){const o=Wp(e,i);let s,a,l,c;if(sf(o,r,e,i)===Gp.CONST){const n=ef(e,i,o);let u,h,d,p;for(let r=0;r<t-1;r++){const t=Wp(e,i);switch(t.physicalStreamType){case Bp.LENGTH:switch(t.logicalStreamType.lengthType){case Up.GEOMETRIES:u=Kp(e,i,t);break;case Up.PARTS:h=Kp(e,i,t);break;case Up.RINGS:d=Kp(e,i,t);break;case Up.TRIANGLES:p=Kp(e,i,t)}break;case Bp.OFFSET:switch(t.logicalStreamType.offsetType){case jp.VERTEX:s=Jp(e,i,t);break;case jp.INDEX:c=Jp(e,i,t)}break;case Bp.DATA:Vp.VERTEX===t.logicalStreamType.dictionaryType?a=Yp(e,i,t):(l={numBits:t.numBits,coordinateShift:t.coordinateShift},a=Jp(e,i,t))}}
2return c?void 0!==u||void 0!==h?yf(r,n,p,c,a,{geometryOffsets:u,partOffsets:h,ringOffsets:d}):yf(r,n,p,c,a):void 0===l?function(e,t,i,r,n){return new ff(e,t,Zp.VEC_2,i,r,n)}(r,n,{geometryOffsets:u,partOffsets:h,ringOffsets:d},s,a):function(e,t,i,r,n,o){return new ff(e,t,Zp.MORTON,i,r,n,o)}(r,n,{geometryOffsets:u,partOffsets:h,ringOffsets:d},s,a,l)}const u=Jp(e,i,o);let h,d,p,f,m,g,y;for(let r=0;r<t-1;r++){const t=Wp(e,i);switch(t.physicalStreamType){case Bp.LENGTH:switch(t.logicalStreamType.lengthType){case Up.GEOMETRIES:h=Jp(e,i,t);break;case Up.PARTS:d=Jp(e,i,t);break;case Up.RINGS:p=Jp(e,i,t);break;case Up.TRIANGLES:f=Kp(e,i,t)}break;case Bp.OFFSET:switch(t.logicalStreamType.offsetType){case jp.VERTEX:s=Jp(e,i,t);break;case jp.INDEX:c=Jp(e,i,t)}break;case Bp.DATA:Vp.VERTEX===t.logicalStreamType.dictionaryType?a=Yp(e,i,t):(l={numBits:t.numBits,coordinateShift:t.coordinateShift},a=Jp(e,i,t))}}return h?(m=wf(u,h,2),d&&p?(g=Tf(u,m,d,!1),y=function(e,t,i,r){const n=new Uint32Array(i[i.length-1]+1);let o=0;n[0]=o;let s=1,a=1,l=0;for(let c=0;c<e.length;c++){const u=e[c],h=t[c+1]-t[c];if(0!==u&&3!==u)for(let e=0;e<h;e++){const e=i[s]-i[s-1];s++;for(let t=0;t<e;t++)o=n[a++]=o+r[l++]}else for(let e=0;e<h;e++)n[a++]=++o,s++}return n}(u,m,g,p)):d&&(g=function(e,t,i){const r=new Uint32Array(t[t.length-1]+1);let n=0;r[0]=n;let o=1,s=0;for(let a=0;a<e.length;a++){const l=e[a],c=t[a+1]-t[a];if(4===l||1===l)for(let e=0;e<c;e++)n=r[o++]=n+i[s++];else for(let e=0;e<c;e++)r[o++]=++n}return r}(u,m,d))):d&&p?(g=wf(u,d,1),y=Tf(u,g,p,!0)):d&&(g=wf(u,d,0)),c&&!g?vf(u,f,c,a):c?vf(u,f,c,a,{geometryOffsets:m,partOffsets:g,ringOffsets:y}):void 0===l?function(e,t,i,r){return new mf(Zp.VEC_2,e,t,i,r)}(u,{geometryOffsets:m,partOffsets:g,ringOffsets:y},s,a):function(e,t,i,r,n){return new mf(Zp.MORTON,e,t,i,r,n)}(u,{geometryOffsets:m,partOffsets:g,ringOffsets:y},s,a,l)}function wf(e,t,i){const r=new Uint32Array(e.length+1);let n=0;r[0]=n;let o=0;for(let s=0;s<e.length;s++)n=r[s+1]=n+(e[s]>i?t[o++]:1);return r}function Tf(e,t,i,r){const n=new Uint32Array(t[t.length-1]+1);let o=0;n[0]=o;let s=1,a=0;for(let l=0;l<e.length;l++){const c=e[l],u=t[l+1]-t[l];if(5===c||2===c||r&&(4===c||1===c))for(let e=0;e<u;e++)o=n[s++]=o+i[a++];else for(let e=0;e<u;e++)n[s++]=++o}return n}class Ef extends ip{constructor(e,t,i){super(e,t.getBuffer(),i),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class Sf extends rp{getValueFromBuffer(e){return this.dataBuffer[e]}}class Pf extends ip{constructor(e,t,i,r){super(e,r?BigInt64Array.of(t):BigUint64Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}}function If(e,t,i,r,n){const o=function(e,t,i,r){const n=new Uint8Array(t);let o=0;const s=r.get()+i;for(;o<t&&!(r.get()>=s);){const i=e[r.increment()];if(i<=127){const s=i+3,a=e[r.increment()],l=Math.min(o+s,t);n.fill(a,o,l),o=l}else{const s=256-i;for(let i=0;i<s&&o<t;i++)n[o++]=e[r.increment()]}}return r.set(s),n}(e,Math.ceil(t/8),i,r);return n?function(e,t,i){if(!i)return e;const r=i.size(),n=new Hp(e,t),o=new Hp(new Uint8Array(Math.ceil(r/8)),r);let s=0;for(let e=0;e<r;e++){const t=!!i.get(e)&&n.get(s++);o.set(e,t)}return o.getBuffer()}(o,t,n):o}const Cf=new TextDecoder;function Mf(e,t,i){return i-t>=12?Cf.decode(e.subarray(t,i)):function(e,t,i){let r="",n=t;for(;n<i;){const t=e[n];let o,s,a,l=null,c=t>239?4:t>223?3:t>191?2:1;if(n+c>i)break;1===c?t<128&&(l=t):2===c?(o=e[n+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&(l=(15&t)<<12|(63&o)<<6|63&s,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[n+1],s=e[n+2],a=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&t)<<18|(63&o)<<12|(63&s)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=c}return r}(e,t,i)}class Af extends ip{constructor(e,t,i,r){super(e,i,r),this.offsetBuffer=t}}class Lf extends Af{constructor(e,t,i,r){super(e,t,i,r??t.length-1)}getValueFromBuffer(e){return Mf(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Ff extends Af{constructor(e,t,i,r,n){super(e,i,r,n??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){const t=this.indexBuffer[e];return Mf(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}
2class Df extends Af{constructor(e,t,i,r,n,o,s){super(e,i,r,s),this.indexBuffer=t,this.symbolOffsetBuffer=n,this.symbolTableBuffer=o}getValueFromBuffer(e){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=function(e,t,i){const r=[],n=new Array(t.length).fill(0);for(let e=1;e<t.length;e++)n[e]=n[e-1]+t[e-1];for(let o=0;o<i.length;o++)if(255===i[o])r.push(i[++o]);else{const s=t[i[o]],a=n[i[o]];for(let t=0;t<s;t++)r.push(e[a+t])}return new Uint8Array(r)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const t=this.indexBuffer[e];return Mf(this.decodedDictionary,this.offsetBuffer[t],this.offsetBuffer[t+1])}offsetToLengthBuffer(e){const t=new Uint32Array(e.length-1);let i=e[0];for(let r=1;r<e.length;r++){const n=e[r];t[r-1]=n-i,i=n}return t}}function kf(e,t,i,r,n,o){return"scalarType"===i.type?function(e,t,i,r,n,o){let s=null;if(0===e)return null;if(o.nullable){const e=Wp(t,i),r=e.numValues,n=i.get(),o=If(t,r,e.byteLength,i);i.set(n+e.byteLength),s=new Hp(o,e.numValues)}const a=s??r;switch(n.physicalType){case 4:case 3:return function(e,t,i,r,n){const o=Wp(e,t),s=sf(o,n,e,t),a=3===r.physicalType;if(s===Gp.FLAT){const r=Of(n)?n:void 0,s=a?Yp(e,t,o,0,r):Jp(e,t,o,0,r);return new np(i.name,s,n)}if(s===Gp.SEQUENCE){const r=tf(e,t,o);return new ap(i.name,r[0],r[1],o.numRleValues)}const l=a?function(e,t,i){const r=Qp(e,t,i);return 1===r.length?Ap(r[0]):function(e){return Ap(e[1])}(r)}(e,t,o):ef(e,t,o);return new lp(i.name,l,n,a)}(t,i,o,n,a);case 9:return function(e,t,i,r,n){let o=null,s=null,a=null,l=null,c=null,u=n??null,h=null,d=null;for(let e=0;e<r;e++){const e=Wp(t,i);switch(e.physicalStreamType){case Bp.PRESENT:{const r=If(t,e.numValues,e.byteLength,i),o=new Hp(r,e.numValues);u=n??o;break}case Bp.OFFSET:s=Jp(t,i,e,0,u);break;case Bp.LENGTH:{const r=Kp(t,i,e);Up.DICTIONARY===e.logicalStreamType.lengthType?o=r:Up.SYMBOL===e.logicalStreamType.lengthType?l=r:h=r;break}case Bp.DATA:{const r=t.subarray(i.get(),i.get()+e.byteLength);i.add(e.byteLength);const n=e.logicalStreamType.dictionaryType;Vp.FSST===n?c=r:Vp.SINGLE===n||Vp.SHARED===n?a=r:Vp.NONE===n&&(d=r);break}}}return function(e,t,i,r,n,o,s){return t?new Df(e,i,r,n,o,t,s):null}(e,c,s,o,a,l,u)??function(e,t,i,r,n){return t?n?new Ff(e,i,r,t,n):new Ff(e,i,r,t):null}(e,a,s,o,u)??function(e,t,i,r,n){if(!t||!i)return null;if(r)return n?new Ff(e,r,t,i,n):new Ff(e,r,t,i);if(n&&n.size()!==t.length-1){const r=new Uint32Array(n.size());let o=0;for(let e=0;e<n.size();e++)r[e]=n.get(e)?o++:0;return new Ff(e,r,t,i,n)}return n?new Lf(e,t,i,n):new Lf(e,t,i)}(e,h,d,s,u)}(o.name,t,i,o.nullable?e-1:e,s);case 0:return function(e,t,i,r,n){const o=Wp(e,t),s=o.numValues,a=t.get(),l=Of(n)?n:void 0,c=If(e,s,o.byteLength,t,l);t.set(a+o.byteLength);const u=new Hp(c,s);return new Ef(i.name,u,n)}(t,i,o,0,a);case 6:case 5:return function(e,t,i,r,n){const o=Wp(e,t),s=sf(o,r,e,t,"int64"),a=5===n.physicalType;if(s===Gp.FLAT){const n=Of(r)?r:void 0,s=a?function(e,t,i,r){return function(e,t,i){let r;switch(t.logicalLevelTechnique1){case hp.DELTA:if(t.logicalLevelTechnique2===hp.RLE){const n=t;if(!i)return function(e,t,i){const r=new BigInt64Array(i);let n=0,o=0n;for(let i=0;i<t;i++){const s=Number(e[i]),a=Lp(e[i+t]);for(let e=0;e<s;e++)o+=a,r[n++]=o}return r}(e,n.runs,n.numRleValues);r=zp(e=kp(e,n.runs,n.numRleValues))}else r=zp(e);break;case hp.RLE:r=function(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=Number(e[r])}const r=new BigInt64Array(i);let n=0;for(let i=0;i<t;i++){const o=Number(e[i]);let s=e[i+t];s=Lp(s),r.fill(s,n,n+o),n+=o}return r}(e,t.runs,t.numRleValues);break;case hp.NONE:r=function(e){const t=new BigInt64Array(e.length);for(let i=0;i<e.length;i++)t[i]=Lp(e[i]);return t}(e);break;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Xp(r,i,0n):r}(Ip(e,t,i.numValues),i,r)}(e,t,o,n):nf(e,t,o,n);return new af(i.name,s,r)}if(s===Gp.SEQUENCE){const r=rf(e,t,o);return new lf(i.name,r[0],r[1],o.numRleValues)}const l=a?function(e,t,i){const r=Ip(e,t,i.numValues);return 1===r.length?Lp(r[0]):function(e){return Lp(e[1])}(r)}(e,t,o):of(e,t,o);return new Pf(i.name,l,r,a)}(t,i,o,a,n);case 7:return function(e,t,i,r){const n=Wp(e,t),o=Of(r)?r:void 0,s=function(e,t,i,r){const n=t.get(),o=n+i*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(n,o)).buffer,a=new Float32Array(s);return t.set(o),r?Xp(a,r,0):a}(e,t,n.numValues,o);return new Sf(i.name,s,r)}(t,i,o,a);case 8:return function(e,t,i,r){const n=Wp(e,t),o=Of(r)?r:void 0,s=function(e,t,i,r){const n=t.get(),o=n+i*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(n,o)).buffer,a=new Float64Array(s);return t.set(o),r?Xp(a,r,0):a}(e,t,n.numValues,o);return new op(i.name,s,r)}(t,i,o,a);default:throw new Error(`The specified data type for the field is currently not supported: ${n}`)}}
2(r,e,t,n,i.scalarType,i):0===r?null:function(e,t,i,r){let n=null,o=null,s=null,a=null,l=!1;for(;!l;){const i=Wp(e,t);switch(i.physicalStreamType){case Bp.LENGTH:Up.DICTIONARY===i.logicalStreamType.lengthType?n=Kp(e,t,i):s=Kp(e,t,i);break;case Bp.DATA:Vp.SINGLE===i.logicalStreamType.dictionaryType||Vp.SHARED===i.logicalStreamType.dictionaryType?(o=e.subarray(t.get(),t.get()+i.byteLength),l=!0):a=e.subarray(t.get(),t.get()+i.byteLength),t.add(i.byteLength)}}const c=i.complexType.children,u=[];let h=0;for(const l of c){const c=Pp(e,t,1)[0];if(0===c)continue;const d=l.name?`${i.name}${l.name}`:i.name;if(2!==c||"scalarField"!==l.type||9!==l.scalarField.physicalType)throw new Error("Currently only optional string fields are implemented for a struct.");const p=Wp(e,t),f=If(e,p.numValues,p.byteLength,t),m=Wp(e,t),g=Jp(e,t,m,0,m.decompressedCount!==r?new Hp(f,p.numValues):void 0);u[h++]=a?new Df(d,g,n,o,s,a,new Hp(f,p.numValues)):new Ff(d,g,n,o,new Hp(f,p.numValues))}return u}(e,t,i,n)}function Of(e){return e instanceof Hp}function Rf(e){switch(e){case 0:case 1:case 2:case 3:{const t={};t.nullable=!!(1&e),t.columnScope=0;const i={type:"logicalType",logicalType:0};return i.longID=!!(2&e),t.scalarType=i,t.type="scalarType",t}case 4:{const e={nullable:!1,columnScope:0},t={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=t,e}case 30:{const e={nullable:!1,columnScope:0},t={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=t,e}default:return function(e){let t;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}const i={};i.nullable=!!(1&e),i.columnScope=0;const r={type:"physicalType"};return r.physicalType=t,i.type="scalarType",i.scalarType=r,i}(e)}}function zf(e){return e>=10}function Nf(e){return 30===e}function Bf(e){if("scalarType"===e.type){const t=e.scalarType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if("logicalType"===t.type)return!1}else if("complexType"===e.type){const t=e.complexType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}function Vf(e){return"complexType"===e.type&&"physicalType"===e.complexType?.type&&0===e.complexType.physicalType}const jf=new TextDecoder;function Uf(e,t){const i=Pp(e,t,1)[0];if(0===i)return"";const r=t.get(),n=e.subarray(r,r+i);return t.add(i),jf.decode(n)}function Gf(e,t){const i=Pp(e,t,1)[0]>>>0;if(i<10||i>30)throw new Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT)`);const r=Rf(i);if(zf(i)&&(r.name=Uf(e,t)),Nf(i)){const i=Pp(e,t,1)[0]>>>0;r.complexType.children=new Array(i);for(let n=0;n<i;n++)r.complexType.children[n]=Gf(e,t)}return function(e){return{name:e.name,nullable:e.nullable,scalarField:e.scalarType,complexField:e.complexType,type:"scalarType"===e.type?"scalarField":"complexField"}}(r)}function $f(e,t){const i=Pp(e,t,1)[0]>>>0,r=Rf(i);if(!r)throw new Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(zf(i)?r.name=Uf(e,t):i>=0&&i<=3?r.name="id":4===i&&(r.name="geometry"),Nf(i)){const i=Pp(e,t,1)[0]>>>0,n=r.complexType;n.children=new Array(i);for(let r=0;r<i;r++)n.children[r]=Gf(e,t)}return r}function qf(e,t){const i={featureTables:[]},r={};r.name=Uf(e,t);const n=Pp(e,t,1)[0]>>>0,o=Pp(e,t,1)[0]>>>0;r.columns=new Array(o);for(let i=0;i<o;i++)r.columns[i]=$f(e,t);return i.featureTables.push(r),[i,n]}function Zf(e,t,i,r,n,o,s=!1){const a=t.scalarType;if(!a||"logicalType"!==a.type||0!==a.logicalType)throw new Error(`ID column must be a logical ID scalar type: ${r}`);const l=a.longID?6:4,c="number"==typeof o?void 0:o,u=sf(n,o,e,i,6===l?"int64":"int32");if(4===l)switch(u){case Gp.FLAT:{const t=Jp(e,i,n,0,c);return new np(r,t,o)}case Gp.SEQUENCE:{const t=tf(e,i,n);return new ap(r,t[0],t[1],n.numRleValues)}case Gp.CONST:{const t=ef(e,i,n);return new lp(r,t,o,!1)}}switch(u){case Gp.FLAT:{if(s){const t=function(e,t,i){const r=function(e,t,i){const r=new Float64Array(i);for(let n=0;n<i;n++)r[n]=Mp(e,t);return r}(e,t,i.numValues);return function(e,t){switch(t.logicalLevelTechnique1){case hp.DELTA:return t.logicalLevelTechnique2===hp.RLE&&(e=Op(e,t.runs,t.numRleValues)),function(e){e[0]=Fp(e[0]);const t=e.length/4*4;let i=1;if(t>=4)for(;i<t-4;i+=4){const t=e[i+1],r=e[i+2],n=e[i+3];e[i]=Fp(e[i])+e[i-1],e[i+1]=Fp(t)+e[i],e[i+2]=Fp(r)+e[i+1],e[i+3]=Fp(n)+e[i+2]}for(;i!==e.length;++i)e[i]=Fp(e[i])+e[i-1]}(e),e;case hp.RLE:return function(e,t){return Op(e,t.runs,t.numRleValues)}(e,t);case hp.NONE:return e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}(r,i)}(e,i,n);return new op(r,t,o)}const t=nf(e,i,n,c);return new af(r,t,o)}case Gp.SEQUENCE:{const t=rf(e,i,n);return new lf(r,t[0],t[1],n.numRleValues)}case Gp.CONST:{const t=of(e,i,n);return new Pf(r,t,o,!1)}}throw new Error("Vector type not supported for id column.")}class Wf{constructor(e,t){var i;switch(this._featureData=e,this.properties=this._featureData.properties||{},null===(i=this._featureData.geometry)||void 0===i?void 0:i.type){case $p.POINT:case $p.MULTIPOINT:this.t
2ype=1;break;case $p.LINESTRING:case $p.MULTILINESTRING:this.type=2;break;case $p.POLYGON:case $p.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const t of this._featureData.geometry.coordinates){const r=[];for(const e of t)r.push(new i(e.x,e.y));e.push(r)}return e}}class Hf{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new Wf(this.features[e],this.extent)}}class Xf{constructor(e){this.layers={};const t=function(e,t,i=!0){const r=new up(0),n=[];for(;r.get()<e.length;){const t=Pp(e,r,1)[0]>>>0,s=r.get()+t;if(s>e.length)throw new Error(`Block overruns tile: ${s} > ${e.length}`);if(1!=Pp(e,r,1)[0]>>>0){r.set(s);continue}const[a,l]=qf(e,r),c=a.featureTables[0];let u=null,h=null;const d=[];let p=0;for(const t of c.columns){const n=t.name;if("scalarType"===(o=t).type&&"logicalType"===o.scalarType?.type&&0===o.scalarType.logicalType){let o=null;if(t.nullable){const t=Wp(e,r),i=r.get(),n=If(e,t.numValues,t.byteLength,r);r.set(i+t.byteLength),o=new Hp(n,t.numValues)}const s=Wp(e,r);p=o?o.size():s.decompressedCount,u=Zf(e,t,r,n,s,o??p,i)}else if(Vf(t)){const t=Pp(e,r,1)[0];if(0===p){const t=r.get();p=Wp(e,r).decompressedCount,r.set(t)}h=xf(e,t,r,p)}else{const i=Bf(t)?Pp(e,r,1)[0]:1;if(0===i)continue;const n=kf(e,r,t,i,p);if(n)if(Array.isArray(n))for(const e of n)d.push(e);else d.push(n)}}const f=new cp(c.name,h,u,d,l);n.push(f),r.set(s)}var o;return n}(new Uint8Array(e));this.layers=t.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:new Hf(t)})),{})}}class Yf{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"id"in e&&("string"==typeof e.id?this.id=parseInt(e.id,10):"number"!=typeof e.id||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],t=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const r of t){const t=[];for(const e of r)t.push(new i(e[0],e[1]));e.push(t)}return e}}const Jf="_geojsonTileLayer";function Kf(e,t,i=""){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);const r={jsonPrefix:i,keys:[],values:[],keycache:{},valuecache:{}};for(let i=0;i<e.length;i++)r.feature=e.feature(i),t.writeMessage(2,Qf,r);const n=r.keys;for(const e of n)t.writeStringField(3,e);const o=r.values;for(const e of o)t.writeMessage(4,nm,e)}function Qf(e,t){if(!e.feature)return;const i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,em,e),t.writeVarintField(3,i.type),t.writeMessage(4,rm,i)}function em(e,t){for(const i in e.feature?.properties){let r=e.feature.properties[i],n=e.keycache[i];if(null==r)continue;void 0===n&&(e.keys.push(i),n=e.keys.length-1,e.keycache[i]=n),t.writeVarint(n),"string"!=typeof r&&"boolean"!=typeof r&&"number"!=typeof r&&(r=e.jsonPrefix+JSON.stringify(r));const o=typeof r+":"+r;let s=e.valuecache[o];void 0===s&&(e.values.push(r),s=e.values.length-1,e.valuecache[o]=s),t.writeVarint(s)}}function tm(e,t){return(t<<3)+(7&e)}function im(e){return e<<1^e>>31}function rm(e,t){const i=e.loadGeometry(),r=e.type;let n=0,o=0;for(const s of i){let i=1;1===r&&(i=s.length),t.writeVarint(tm(1,i));const a=3===r?s.length-1:s.length;for(let e=0;e<a;e++){1===e&&1!==r&&t.writeVarint(tm(2,a-1));const i=s[e].x-n,l=s[e].y-o;t.writeVarint(im(i)),t.writeVarint(im(l)),n+=i,o+=l}3===e.type&&t.writeVarint(tm(7,1))}}function nm(e,t){const i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}class om{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ho(M,16,0),this.grid3D=new ho(M,16,0),this.featureIndexArray=new $s,this.promoteId=t}insert(e,t,i,r,n,o){const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);const a=o?this.grid3D:this.grid;for(const e of t){const t=[1/0,1/0,-1/0,-1/0];for(const i of e)t[0]=Math.min(t[0],i.x),t[1]=Math.min(t[1],i.y),t[2]=Math.max(t[2],i.x),t[3]=Math.max(t[3],i.y);t[0]<M&&t[1]<M&&t[2]>=0&&t[3]>=0&&a.insert(s,t[0],t[1],t[2],t[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new Vc(new Bh(this.rawTileData)).layers:new Xf(this.rawTileData).layers,this.sourceLayerCoder=new ep(this.vtLayers?Object.keys(this.vtLayers).sort():[Jf])),this.vtLayers}query(e,t,r,n){this.loadVTLayers();const o=e.params,s=M/e.tileSize/e.scale,a=fn(o.filter,o.globalState),l=e.queryGeometry,c=e.queryPadding*s,u=Qd.fromPoints(l),h=this.grid.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c),d=Qd.fromPoints(e.cameraQueryGeometry).expandBy(c),p=this.grid3D.query(d.minX,d.minY,d.maxX,d.maxY,((t,r,n,o)=>function(e,t,r,n,o){for(const i of e)if(t<=i.x&&r<=i.y&&n>=i.x&&o>=i.y)return!0;const s=[new i(t,r),new i(t,o),new i(n,o),new i(n,r)];if(e.length>2)for(const t of s)if(rl(e,t))return!0;for(let t=0;t<e.length-1;t++)if(nl(e[t],e[t+1],s))return!0;return!1}(e.cameraQueryGeometry,t-c,r-c,n+c,o+c)));for(const e of p)h.push(e);h.sort(am);const f={};let m;
2for(const i of h){if(i===m)continue;m=i;const c=this.featureIndexArray.get(i);let u=null;this.loadMatchingFeature(f,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,a,o.layers,o.availableImages,t,r,n,((t,i,r)=>(u||(u=Ga(t)),i.queryIntersectsFeature({queryGeometry:l,feature:t,featureState:r,geometry:u,zoom:this.z,transform:e.transform,pixelsToTileUnits:s,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return f}loadMatchingFeature(e,t,i,r,n,o,s,a,l,c,u){const h=this.bucketLayerIDs[t];if(o&&!h.some((e=>o.has(e))))return;const d=this.sourceLayerCoder.decode(i),p=this.vtLayers[d].feature(r);if(n.needGeometry){const e=$a(p,!0);if(!n.filter(new Oo(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!n.filter(new Oo(this.tileID.overscaledZ),p))return;const f=this.getId(p,d);for(const t of h){if(o&&!o.has(t))continue;const i=a[t];if(!i)continue;let n={};f&&c&&(n=c.getState(i.sourceLayer||Jf,f));const h=B({},l[t]);h.paint=sm(h.paint,i.paint,p,n,s),h.layout=sm(h.layout,i.layout,p,n,s);const d=!u||u(p,i,n);if(!d)continue;const m=new tp(p,this.z,this.x,this.y,f);m.layer=h;let g=e[t];void 0===g&&(g=e[t]=[]),g.push({featureIndex:r,feature:m,intersectionZ:d})}}lookupSymbolFeatures(e,t,i,r,n,o,s,a){const l={};this.loadVTLayers();const c=fn(n.filterSpec,n.globalState);for(const n of e)this.loadMatchingFeature(l,i,r,n,c,o,s,a,t);return l}hasLayer(e){for(const t of this.bucketLayerIDs)for(const i of t)if(e===i)return!0;return!1}getId(e,t){var i;let r=e.id;return this.promoteId&&(r=e.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[t]],"boolean"==typeof r&&(r=Number(r)),void 0===r&&(null===(i=e.properties)||void 0===i?void 0:i.cluster)&&this.promoteId&&(r=Number(e.properties.cluster_id))),r}}function sm(e,t,i,r,n){return j(e,((e,o)=>{const s=t instanceof qo?t.get(o):null;return(null==s?void 0:s.evaluate)?s.evaluate(i,r,n):s}))}function am(e,t){return t-e}function lm(e,t,r,n,o){const s=[];for(const a of e){let e;for(let l=0;l<a.length-1;l++){let c=a[l],u=a[l+1];c.x<t&&u.x<t||(c.x<t?c=new i(t,c.y+(t-c.x)/(u.x-c.x)*(u.y-c.y))._round():u.x<t&&(u=new i(t,c.y+(t-c.x)/(u.x-c.x)*(u.y-c.y))._round()),c.y<r&&u.y<r||(c.y<r?c=new i(c.x+(r-c.y)/(u.y-c.y)*(u.x-c.x),r)._round():u.y<r&&(u=new i(c.x+(r-c.y)/(u.y-c.y)*(u.x-c.x),r)._round()),c.x>=n&&u.x>=n||(c.x>=n?c=new i(n,c.y+(n-c.x)/(u.x-c.x)*(u.y-c.y))._round():u.x>=n&&(u=new i(n,c.y+(n-c.x)/(u.x-c.x)*(u.y-c.y))._round()),c.y>=o&&u.y>=o||(c.y>=o?c=new i(c.x+(o-c.y)/(u.y-c.y)*(u.x-c.x),o)._round():u.y>=o&&(u=new i(c.x+(o-c.y)/(u.y-c.y)*(u.x-c.x),o)._round()),e&&c.equals(e[e.length-1])||(e=[c],s.push(e)),e.push(u)))))}}return s}function cm(e,t,i,r,n){switch(t){case 1:return function(e,t,i,r){const n=[];for(const o of e)for(const e of o){const o=0===r?e.x:e.y;o>=t&&o<=i&&n.push([e])}return n}(e,i,r,n);case 2:return hm(e,i,r,n,!1);case 3:return hm(e,i,r,n,!0)}return[]}function um(e,t,r,n,o){const s=0===n?dm:pm;let a=[];const l=[];for(let i=0;i<e.length-1;i++){const c=e[i],u=e[i+1],h=0===n?c.x:c.y,d=0===n?u.x:u.y;let p=!1;h<t?d>t&&a.push(s(c,u,t)):h>r?d<r&&a.push(s(c,u,r)):a.push(c),d<t&&h>=t&&(a.push(s(c,u,t)),p=!0),d>r&&h<=r&&(a.push(s(c,u,r)),p=!0),!o&&p&&(l.push(a),a=[])}const c=e.length-1,u=0===n?e[c].x:e[c].y;return u>=t&&u<=r&&a.push(e[c]),o&&a.length>0&&!a[0].equals(a[a.length-1])&&a.push(new i(a[0].x,a[0].y)),a.length>0&&l.push(a),l}function hm(e,t,i,r,n){const o=[];for(const s of e){const e=um(s,t,i,r,n);e.length>0&&o.push(...e)}return o}function dm(e,t,r){return new i(r,e.y+(r-e.x)/(t.x-e.x)*(t.y-e.y))}function pm(e,t,r){return new i(e.x+(r-e.y)/(t.y-e.y)*(t.x-e.x),r)}fo("FeatureIndex",om,{omit:["rawTileData","sourceLayerCoder"]});class fm extends i{constructor(e,t,i,r){super(e,t),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new fm(this.x,this.y,this.angle,this.segment)}}function mm(e,t,i,r,n){if(void 0===t.segment||0===i)return!0;let o=t,s=t.segment+1,a=0;for(;a>-i/2;){if(s--,s<0)return!1;a-=e[s].dist(o),o=e[s]}a+=e[s].dist(e[s+1]),s++;const l=[];let c=0;for(;a<i/2;){const t=e[s],i=e[s+1];if(!i)return!1;let o=e[s-1].angleTo(t)-t.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:o}),c+=o;a-l[0].distance>r;)c-=l.shift().angleDelta;if(c>n)return!1;s++,a+=t.dist(i)}return!0}function gm(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function ym(e,t,i){return e?.6*t*i:0}function _m(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function vm(e,t,i,r,n,o){const s=ym(i,n,o),a=_m(i,r)*o;let l=0;const c=gm(e)/2;for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1],o=r.dist(n);if(l+o>c){const u=(c-l)/o,h=gi.number(r.x,n.x,u),d=gi.number(r.y,n.y,u),p=new fm(h,d,n.angleTo(r),i);
vendor: 4,268 bytes, line 2
2return p._round(),!s||mm(e,p,a,s,t)?p:void 0}l+=o}}function bm(e,t,i,r,n,o,s,a,l){const c=ym(r,o,s),u=_m(r,n),h=u*s,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h<t/4&&(t=h+t/4),xm(e,d?t/2*a%t:(u/2+2*o)*s*a%t,t,c,i,h,d,!1,l)}function xm(e,t,i,r,n,o,s,a,l){const c=o/2,u=gm(e);let h=0,d=t-i,p=[];for(let t=0;t<e.length-1;t++){const s=e[t],a=e[t+1],f=s.dist(a),m=a.angleTo(s);for(;d+i<h+f;){d+=i;const g=(d-h)/f,y=gi.number(s.x,a.x,g),_=gi.number(s.y,a.y,g);if(y>=0&&y<l&&_>=0&&_<l&&d-c>=0&&d+c<=u){const i=new fm(y,_,m,t);i._round(),r&&!mm(e,i,o,r,n)||p.push(i)}}h+=f}return a||p.length||s||(p=xm(e,h/2,i,r,n,o,s,!0,l)),p}function wm(e,t,r,n){const o=[],s=e.image,a=s.pixelRatio,l=s.paddedRect.w-2,c=s.paddedRect.h-2;let u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom};const h=s.stretchX||[[0,l]],d=s.stretchY||[[0,c]],p=(e,t)=>e+t[1]-t[0],f=h.reduce(p,0),m=d.reduce(p,0),g=l-f,y=c-m;let _=0,v=f,b=0,x=m,w=0,T=g,E=0,S=y;if(s.content&&n){const t=s.content,i=t[2]-t[0],r=t[3]-t[1];(s.textFitWidth||s.textFitHeight)&&(u=pd(e)),_=Tm(h,0,t[0]),b=Tm(d,0,t[1]),v=Tm(h,t[0],t[2]),x=Tm(d,t[1],t[3]),w=t[0]-_,E=t[1]-b,T=i-v,S=r-x}const P=u.x1,I=u.y1,C=u.x2-P,M=u.y2-I,A=(e,n,o,l)=>{const c=Sm(e.stretch-_,v,C,P),u=Pm(e.fixed-w,T,e.stretch,f),h=Sm(n.stretch-b,x,M,I),d=Pm(n.fixed-E,S,n.stretch,m),p=Sm(o.stretch-_,v,C,P),g=Pm(o.fixed-w,T,o.stretch,f),y=Sm(l.stretch-b,x,M,I),A=Pm(l.fixed-E,S,l.stretch,m),L=new i(c,h),F=new i(p,h),D=new i(p,y),k=new i(c,y),O=new i(u/a,d/a),R=new i(g/a,A/a),z=t*Math.PI/180;if(z){const e=Math.sin(z),t=Math.cos(z),i=[t,-e,e,t];L._matMult(i),F._matMult(i),k._matMult(i),D._matMult(i)}const N=e.stretch+e.fixed,B=n.stretch+n.fixed;return{tl:L,tr:F,bl:k,br:D,tex:{x:s.paddedRect.x+1+N,y:s.paddedRect.y+1+B,w:o.stretch+o.fixed-N,h:l.stretch+l.fixed-B},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:O,pixelOffsetBR:R,minFontScaleX:T/a/C,minFontScaleY:S/a/M,isSDF:r}};if(n&&(s.stretchX||s.stretchY)){const e=Em(h,g,f),t=Em(d,y,m);for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)o.push(A(r,t[e],n,t[e+1]))}}else o.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function Tm(e,t,i){let r=0;for(const n of e)r+=Math.max(t,Math.min(i,n[1]))-Math.max(t,Math.min(i,n[0]));return r}function Em(e,t,i){const r=[{fixed:-1,stretch:0}];for(const[t,i]of e){const e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(i-t)})}return r.push({fixed:t+1,stretch:i}),r}function Sm(e,t,i,r){return e/t*i+r}function Pm(e,t,i,r){return e-t*i/r}fo("Anchor",fm);class Im{constructor(e,t,r,n,o,s,a,l,c,u){var h;if(this.boxStartIndex=e.length,c){let e=s.top,t=s.bottom;const i=s.collisionPadding;i&&(e-=i[1],t+=i[3]);let r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{const c=(null===(h=s.image)||void 0===h?void 0:h.content)&&(s.image.textFitWidth||s.image.textFitHeight)?pd(s):{x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};c.y1=c.y1*a-l[0],c.y2=c.y2*a+l[2],c.x1=c.x1*a-l[3],c.x2=c.x2*a+l[1];const d=s.collisionPadding;if(d&&(c.x1-=d[0]*a,c.y1-=d[1]*a,c.x2+=d[2]*a,c.y2+=d[3]*a),u){const e=new i(c.x1,c.y1),t=new i(c.x2,c.y1),r=new i(c.x1,c.y2),n=new i(c.x2,c.y2),o=u*Math.PI/180;e._rotate(o),t._rotate(o),r._rotate(o),n._rotate(o),c.x1=Math.min(e.x,t.x,r.x,n.x),c.x2=Math.max(e.x,t.x,r.x,n.x),c.y1=Math.min(e.y,t.y,r.y,n.y),c.y2=Math.max(e.y,t.y,r.y,n.y)}e.emplaceBack(t.x,t.y,c.x1,c.y1,c.x2,c.y2,r,n,o)}this.boxEndIndex=e.length}}class Cm{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const 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){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let r=1+(e<<1);const o=r+1;if(o<this.length&&i(t[o],t[r])<0&&(r=o),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}}function Mm(e,t=1){const r=Qd.fromPoints(e[0]),n=Math.min(r.width(),r.height());let o=n/2;
2const s=new Cm([],Am),{minX:a,minY:l,maxX:c,maxY:u}=r;if(0===n)return new i(a,l);for(let t=a;t<c;t+=n)for(let i=l;i<u;i+=n)s.push(new Lm(t+o,i+o,o,e));const h=function(e){let t=0,i=0,r=0;const n=e[0];for(let e=0,o=n.length,s=o-1;e<o;s=e++){const o=n[e],a=n[s],l=o.x*a.y-a.x*o.y;i+=(o.x+a.x)*l,r+=(o.y+a.y)*l,t+=3*l}return new Lm(i/t,r/t,0,e)}(e);let d=h;for(;s.length;){const i=s.pop();(i.d>d.d||!d.d)&&(d=i),i.max-d.d<=t||(o=i.h/2,s.push(new Lm(i.p.x-o,i.p.y-o,o,e)),s.push(new Lm(i.p.x+o,i.p.y-o,o,e)),s.push(new Lm(i.p.x-o,i.p.y+o,o,e)),s.push(new Lm(i.p.x+o,i.p.y+o,o,e)))}return h.d>0&&d.d-h.d<=t?h.p:d.p}function Am(e,t){return t.max-e.max}class Lm{constructor(e,t,r,n){this.p=new i(e,t),this.h=r,this.d=function(e,t){let i=!1,r=1/0;for(const n of t)for(let t=0,o=n.length,s=o-1;t<o;s=t++){const o=n[t],a=n[s];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(i=!i),r=Math.min(r,tl(e,o,a))}return(i?1:-1)*Math.sqrt(r)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}var Fm;e.aM=void 0,(Fm=e.aM||(e.aM={}))[Fm.center=1]="center",Fm[Fm.left=2]="left",Fm[Fm.right=3]="right",Fm[Fm.top=4]="top",Fm[Fm.bottom=5]="bottom",Fm[Fm["top-left"]=6]="top-left",Fm[Fm["top-right"]=7]="top-right",Fm[Fm["bottom-left"]=8]="bottom-left",Fm[Fm["bottom-right"]=9]="bottom-right";const Dm=Number.POSITIVE_INFINITY;function km(e,t){return t[1]!==Dm?function(e,t,i){let r=0,n=0;switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}return[r,n]}(e,t[0],t[1]):function(e,t){let i=0,r=0;t<0&&(t=0);const n=t/Math.SQRT2;switch(e){case"top-right":case"top-left":r=n-7;break;case"bottom-right":case"bottom-left":r=7-n;break;case"bottom":r=7-t;break;case"top":r=t-7}switch(e){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=t;break;case"right":i=-t}return[i,r]}(e,t[0])}function Om(e,t,i){var r;const n=e.layout,o=null===(r=n.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(t,{},i);if(o){const e=o.values,t=[];for(let i=0;i<e.length;i+=2){const r=t[i]=e[i],n=e[i+1].map((e=>e*Ph));r.startsWith("top")?n[1]-=7:r.startsWith("bottom")&&(n[1]+=7),t[i+1]=n}return new Bt(t)}const s=n.get("text-variable-anchor");if(s){let r;r=void 0!==e._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(t,{},i)*Ph,Dm]:n.get("text-offset").evaluate(t,{},i).map((e=>e*Ph));const o=[];for(const e of s)o.push(e,km(e,r));return new Bt(o)}return null}function Rm(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function zm(t,i,r,n,o,s,a,l,c,u,h,d){let p=s.textMaxSize.evaluate(i,{});void 0===p&&(p=a);const f=t.layers[0].layout,m=f.get("icon-offset").evaluate(i,{},h),g=Bm(r.horizontal),y=a/24,_=t.tilePixelRatio*y,v=t.tilePixelRatio*p/24,b=t.tilePixelRatio*l,x=t.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*t.tilePixelRatio,T=function(e,t,i,r=1){const n=e.get("icon-padding").evaluate(t,{},i),o=null==n?void 0:n.values;return[o[0]*r,o[1]*r,o[2]*r,o[3]*r]}(f,i,h,t.tilePixelRatio),E=f.get("text-max-angle")/180*Math.PI,S="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),P="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),I=f.get("symbol-placement"),C=x/2,A=f.get("icon-text-fit");let L;n&&"none"!==A&&(t.allowVerticalPlacement&&r.vertical&&(L=fd(n,r.vertical,A,f.get("icon-text-fit-padding"),m,y)),g&&(n=fd(n,g,A,f.get("icon-text-fit-padding"),m,y)));const F=h?d.line.getGranularityForZoomLevel(h.z):1,D=(l,d)=>{d.x<0||d.x>=M||d.y<0||d.y>=M||function(t,i,r,n,o,s,a,l,c,u,h,d,p,f,m,g,y,_,v,b,x,w,T,E,S){const P=t.addToLineVertexArray(i,r);let I,C,M,A,L=0,F=0,D=0,k=0,O=-1,R=-1;const z={};let N=va("");if(t.allowVerticalPlacement&&n.vertical){const e=l.layout.get("text-rotate").evaluate(x,{},E)+90;M=new Im(c,i,u,h,d,n.vertical,p,f,m,e),a&&(A=new Im(c,i,u,h,d,a,y,_,m,e))}if(o){const r=l.layout.get("icon-rotate").evaluate(x,{}),n="none"!==l.layout.get("icon-text-fit"),s=wm(o,r,T,n),p=a?wm(a,r,T,n):void 0;C=new Im(c,i,u,h,d,o,y,_,!1,r),L=4*s.length;const f=t.iconSizeData;let m=null;"source"===f.kind?(m=[md*l.layout.get("icon-size").evaluate(x,{})],m[0]>gd&&q(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[md*w.compositeIconSizes[0].evaluate(x,{},E),md*w.compositeIconSizes[1].evaluate(x,{},E)],(m[0]>gd||m[1]>gd)&&q(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,s,m,b,v,x,e.ax.none,i,P.lineStartIndex,P.lineLength,-1,E),O=t.icon.placedSymbolArray.length-1,p&&(F=4*p.length,t.addSymbols(t.icon,p,m,b,v,x,e.ax.vertical,i,P.lineStartIndex,P.lineLength,-1,E),R=t.icon.placedSymbolArray.length-1)}const B=Object.keys(n.horizontal);for(const r of B){const o=n.horizontal[r];if(!I){N=va(o.text);const e=l.layout.get("text-rotate").evaluate(x,{},E);I=new Im(c,i,u,h,d,o,p,f,m,e)}const a=1===o.positionedLines.length;
vendor: 5,600 bytes, line 2
2if(D+=Nm(t,i,o,s,l,m,x,g,P,n.vertical?e.ax.horizontal:e.ax.horizontalOnly,a?B:[r],z,O,w,E),a)break}n.vertical&&(k+=Nm(t,i,n.vertical,s,l,m,x,g,P,e.ax.vertical,["vertical"],z,R,w,E));const V=I?I.boxStartIndex:t.collisionBoxArray.length,j=I?I.boxEndIndex:t.collisionBoxArray.length,U=M?M.boxStartIndex:t.collisionBoxArray.length,G=M?M.boxEndIndex:t.collisionBoxArray.length,$=C?C.boxStartIndex:t.collisionBoxArray.length,Z=C?C.boxEndIndex:t.collisionBoxArray.length,W=A?A.boxStartIndex:t.collisionBoxArray.length,H=A?A.boxEndIndex:t.collisionBoxArray.length;let X=-1;const Y=(e,t)=>(null==e?void 0:e.circleDiameter)?Math.max(e.circleDiameter,t):t;X=Y(I,X),X=Y(M,X),X=Y(C,X),X=Y(A,X);const J=X>-1?1:0;J&&(X*=S/Ph),t.glyphOffsetArray.length>=Sd.MAX_GLYPHS&&q("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);const K=Om(l,x,E),[Q,ee]=function(t,i){const r=t.length,n=null==i?void 0:i.values;if((null==n?void 0:n.length)>0)for(let i=0;i<n.length;i+=2){const r=n[i+1];t.emplaceBack(e.aM[n[i]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,K);t.symbolInstances.emplaceBack(i.x,i.y,z.right>=0?z.right:-1,z.center>=0?z.center:-1,z.left>=0?z.left:-1,z.vertical||-1,O,R,N,V,j,U,G,$,Z,W,H,u,D,k,L,F,J,0,p,X,Q,ee)}(t,d,l,r,n,o,L,t.layers[0],t.collisionBoxArray,i.index,i.sourceLayerIndex,t.index,_,[w,w,w,w],S,c,b,T,P,m,i,s,u,h,a)};if("line"===I)for(const e of lm(i.geometry,0,0,M,M)){const i=wc(e,F),o=bm(i,x,E,r.vertical||g,n,24,v,t.overscaling,M);for(const e of o)g&&Vm(t,g.text,C,e)||D(i,e)}else if("line-center"===I){for(const e of i.geometry)if(e.length>1){const t=wc(e,F),i=vm(t,E,r.vertical||g,n,24,v);i&&D(t,i)}}else if("Polygon"===i.type)for(const e of tr(i.geometry,0)){const t=Mm(e,16);D(wc(e[0],F,!0),new fm(t.x,t.y,0))}else if("LineString"===i.type)for(const e of i.geometry){const t=wc(e,F);D(t,new fm(t[0].x,t[0].y,0))}else if("Point"===i.type)for(const e of i.geometry)for(const t of e)D([t],new fm(t.x,t.y,0))}function Nm(e,t,r,n,o,s,a,l,c,u,h,d,p,f,m){const g=function(e,t,r,n,o,s,a,l){const c=n.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,u=[];for(const e of t.positionedLines)for(const n of e.positionedGlyphs){if(!n.rect)continue;const s=n.rect||{};let h=4,d=!0,p=1,f=0;const m=(o||l)&&n.vertical,g=n.metrics.advance*n.scale/2;if(l&&t.verticalizable&&(f=e.lineOffset/2-(n.imageName?-(Ph-n.metrics.width*n.scale)/2:(n.scale-1)*Ph)),n.imageName){const e=a[n.imageName];d=e.sdf,p=e.pixelRatio,h=1/p}const y=o?[n.x+g,n.y]:[0,0];let _=o?[0,0]:[n.x+g+r[0],n.y+r[1]-f],v=[0,0];m&&(v=_,_=[0,0]);const b=n.metrics.isDoubleResolution?2:1,x=(n.metrics.left-h)*n.scale-g+_[0],w=(-n.metrics.top-h)*n.scale+_[1],T=x+s.w/b*n.scale/p,E=w+s.h/b*n.scale/p,S=new i(x,w),P=new i(T,w),I=new i(x,E),C=new i(T,E);if(m){const e=new i(-g,g- -17),t=-Math.PI/2,r=12-g,o=new i(22-r,-(n.imageName?r:0)),s=new i(...v);S._rotateAround(t,e)._add(o)._add(s),P._rotateAround(t,e)._add(o)._add(s),I._rotateAround(t,e)._add(o)._add(s),C._rotateAround(t,e)._add(o)._add(s)}if(c){const e=Math.sin(c),t=Math.cos(c),i=[t,-e,e,t];S._matMult(i),P._matMult(i),I._matMult(i),C._matMult(i)}const M=new i(0,0),A=new i(0,0);u.push({tl:S,tr:P,bl:I,br:C,tex:s,writingMode:t.writingMode,glyphOffset:y,sectionIndex:n.sectionIndex,isSDF:d,pixelOffsetTL:M,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return u}(0,r,l,o,s,a,n,e.allowVerticalPlacement),y=e.textSizeData;let _=null;"source"===y.kind?(_=[md*o.layout.get("text-size").evaluate(a,{})],_[0]>gd&&q(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===y.kind&&(_=[md*f.compositeTextSizes[0].evaluate(a,{},m),md*f.compositeTextSizes[1].evaluate(a,{},m)],(_[0]>gd||_[1]>gd)&&q(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,_,l,s,a,u,t,c.lineStartIndex,c.lineLength,p,m);for(const t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function Bm(e){for(const t in e)return e[t];return null}function Vm(e,t,i,r){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<i)return!0}else n[t]=[];return n[t].push(r),!1}e.$=ae,e.A=p,e.B=zo,e.C=uo,e.D=Zo,e.E=be,e.F=oo,e.G=function([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(i),y:e*Math.sin(t)*Math.sin(i),z:e*Math.cos(i)}},e.H=gi,e.I=td,e.J=Oo,e.K=ao,e.L=function(e){if(null==H){const t=e.navigator?e.navigator.userAgent:null;H=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return H},e.M=he,e.N=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Od((()=>this.process())),this.subscription=ee(this.target,"message",(e=>this.receive(e)),!1),this.globalScope=W(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise(((i,r)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=t?ee(t.signal,"abort",(()=>{null==o||o.unsubscribe(),delete this.resolveRejects[n];const t={id:n,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)}),Rd):null;this.resolveRejects[n]={resolve:e=>{null==o||o.unsubscribe(),i(e)},reject:e=>{null==o||o.unsubscribe(),r(e)}};const s=[],a=Object.assign(Object.assign({},e),{id:n,sourceMapId:this.mapId,origin:location.origin,data:_o(e.data,s)});
2this.target.postMessage(a,{transfer:s})}))}receive(e){const t=e.data,i=t.id,r=["file://","resource://android","null"],n=[t.origin,location.origin],o=t.origin===location.origin,s=n.some((e=>r.includes(e)));if((o||s)&&(!t.targetMapId||this.mapId===t.targetMapId)){if("<cancel>"===t.type){delete this.tasks[i];const e=this.abortControllers[i];return delete this.abortControllers[i],void(e&&e.abort())}if(W(self)||t.mustQueue)return this.tasks[i]=t,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,t)}}process(){if(0===this.taskQueue.length)return;const e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,i){return t(this,void 0,void 0,(function*(){if("<response>"===i.type){const t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;return void(i.error?t.reject(L(vo(i.error))):t.resolve(vo(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(e,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const t=vo(i.data),r=new AbortController;this.abortControllers[e]=r;try{const n=yield this.messageHandlers[i.type](i.sourceMapId,t,r);this.completeTask(e,null,n)}catch(t){this.completeTask(e,L(t))}}))}completeTask(e,t,i){const r=[];delete this.abortControllers[e];const n={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?_o(t):null,data:_o(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.O=function(){var e=new p(16);return p!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.P=i,e.Q=function(e,t,i){var r,n,o,s,a,l,c,u,h,d,p,f,m=i[0],g=i[1],y=i[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*y+t[12],e[13]=t[1]*m+t[5]*g+t[9]*y+t[13],e[14]=t[2]*m+t[6]*g+t[10]*y+t[14],e[15]=t[3]*m+t[7]*g+t[11]*y+t[15]):(n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=r*m+a*g+h*y+t[12],e[13]=n*m+l*g+d*y+t[13],e[14]=o*m+c*g+p*y+t[14],e[15]=s*m+u*g+f*y+t[15]),e},e.R=Pl,e.S=function(e,t,i){var r=i[0],n=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.T=zl,e.U=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],y=t[14],_=t[15],v=i[0],b=i[1],x=i[2],w=i[3];return e[0]=v*r+b*a+x*h+w*m,e[1]=v*n+b*l+x*d+w*g,e[2]=v*o+b*c+x*p+w*y,e[3]=v*s+b*u+x*f+w*_,e[4]=(v=i[4])*r+(b=i[5])*a+(x=i[6])*h+(w=i[7])*m,e[5]=v*n+b*l+x*d+w*g,e[6]=v*o+b*c+x*p+w*y,e[7]=v*s+b*u+x*f+w*_,e[8]=(v=i[8])*r+(b=i[9])*a+(x=i[10])*h+(w=i[11])*m,e[9]=v*n+b*l+x*d+w*g,e[10]=v*o+b*c+x*p+w*y,e[11]=v*s+b*u+x*f+w*_,e[12]=(v=i[12])*r+(b=i[13])*a+(x=i[14])*h+(w=i[15])*m,e[13]=v*n+b*l+x*d+w*g,e[14]=v*o+b*c+x*p+w*y,e[15]=v*s+b*u+x*f+w*_,e},e.V=function(e,t){const i={};for(const r of t)r in e&&(i[r]=e[r]);return i},e.W=Nd,e.X=N,e.Y=Ud,e.Z=jd,e._=t,e.a=se,e.a$=function(e){var t=new p(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.a0=u,e.a1=h,e.a2=J,e.a3=Jd,e.a4=$d,e.a5=qd,e.a6=M,e.a7=Wd,e.a8=Qd,e.a9=25,e.aA=function(e){var t=e[0],i=e[1];return Math.sqrt(t*t+i*i)},e.aB=function(e){return e[0]=0,e[1]=0,e},e.aC=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},e.aD=xd,e.aE=E,e.aF=function(e,t,r,n){const o=t.y-e.y,s=t.x-e.x,a=n.y-r.y,l=n.x-r.x,c=a*s-l*o;if(0===c)return null;const u=(l*(e.y-r.y)-a*(e.x-r.x))/c;return new i(e.x+u*s,e.y+u*o)},e.aG=lm,e.aH=Ha,e.aI=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return[t,i,r,n]},e.aJ=Ph,e.aK=A,e.aL=function(e,t,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];const o=n?"map"===r?-e.bearingInRadians:0:"viewport"===r?e.bearingInRadians:0;if(o){const e=Math.sin(o),t=Math.cos(o);i=[i[0]*t-i[1]*e,i[0]*e+i[1]*t]}return[n?i[0]:A(t,i[0],e.zoom),n?i[1]:A(t,i[1],e.zoom)]},e.aN=_d,e.aO=Rm,e.aP=od,e.aQ=e=>"symbol"===e.type,e.aR=eu,e.aS=as,e.aT=yc,e.aU=qs,e.aV=la,e.aW=na,e.aX=ie,e.aY=Zd,e.aZ=b,e.a_=v,e.aa=Xd,e.ab=e=>{const t=window.document.createElement("video");return t.muted=!0,new Promise((i=>{t.onloadstart=()=>{i(t)};for(const i of e){const e=window.document.createElement("source");me(i)||(t.crossOrigin="Anonymous"),e.src=i,t.appendChild(e)}}))},e.ac=De,e.ad=function(){return V++},e.ae=ks,e.af=Sd,e.ag=Jf,e.ah=fn,e.ai=$a,e.aj=tp,e.ak=function(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,i,r,n)=>{const o=r||n;return t[i]=!o||o.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t},e.al=z,e.am=85.051129,e.an=te,e.ao=function(e){return Math.pow(2,e)},e.ap=m,e.aq=Gd,e.ar=function(e){return Math.log(e)/Math.LN2},e.as=function(e){var t=e[0],i=e[1];return t*t+i*i},e.at=function(e){if(!e.length)return new Set;const t=Math.max(...e.map((e=>e.canonical.z)));let i=1/0,r=-1/0,n=1/0,o=-1/0;const s=[];for(const a of e){const{x:e,y:l,z:c}=a.canonical,u=Math.pow(2,t-c),h=e*u,d=l*u;s.push({id:a,x:h,y:d}),h<i&&(i=h),h>r&&(r=h),d<n&&(n=d),d>o&&(o=d)}const a=new Set;for(const e of s)e.x!==i&&e.x!==r&&e.y!==n&&e.y!==o||a.add(e.id);return a}
2,e.au=function(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x},e.av=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){const r=e.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:t,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(e,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const 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;const i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const r of this.data[i])e(r.value)||t.push(r);for(const e of t)this.remove(e.value.tileID,e)}},e.aw=function(e,t){let i=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){const{interpolationType:n,minZoom:o,maxZoom:s}=e,a=n?z(fi.interpolationFactor(n,t,o,s),0,1):0;"camera"===e.kind?r=gi.number(e.minSize,e.maxSize,a):i=a}return{uSizeT:i,uSize:r}},e.ay=function(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===e.kind?r/md:"composite"===e.kind?gi.number(r/md,n/md,i):t},e.az=I,e.b=X,e.b$=Ia,e.b0=function(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e},e.b1=function(e,t){var i=t[0],r=t[1],n=t[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e},e.b2=x,e.b3=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.b4=function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e},e.b5=y,e.b6=function(e,t,i){const r=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return 0===r?null:(-(e[0]*i[0]+e[1]*i[1]+e[2]*i[2])-i[3])/r},e.b7=T,e.b8=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e},e.b9=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bA=P,e.bB=function(e,t,i){var r=i[0],n=i[1],o=i[2],s=i[3],a=t[0],l=t[1],c=t[2],u=n*c-o*l,h=o*a-r*c,d=r*l-n*a;return e[0]=a+s*(u+=u)+n*(d+=d)-o*(h+=h),e[1]=l+s*h+o*u-r*d,e[2]=c+s*d+r*h-n*u,e},e.bC=function(e,t,i){const r=(n=[e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]])[0]*((u=n[8])*(s=n[4])-(a=n[5])*(c=n[7]))+n[1]*(-u*(o=n[3])+a*(l=n[6]))+n[2]*(c*o-s*l);var n,o,s,a,l,c,u;if(0===r)return null;const h=x([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),d=x([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),p=x([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),f=b([],h,-e[3]);return v(f,f,b([],d,-t[3])),v(f,f,b([],p,-i[3])),b(f,f,1/r),f},e.bD=zd,e.bE=function(){return new Float64Array(4)},e.bF=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),o[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),o[2]=n[2],e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},e.bG=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[0],o[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),o[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},e.bH=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),o[1]=n[1],o[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},e.bI=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n-c*r,e[1]=s*n-u*r,e[2]=a*n-h*r,e[3]=l*n-d*r,e[8]=o*r+c*n,e[9]=s*r
vendor: 5,590 bytes, line 2
2+u*n,e[10]=a*r+h*n,e[11]=l*r+d*n,e},e.bJ=function(e,t){const i=F(e,360),r=F(t,360),n=r-i,o=r>i?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o},e.bK=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bL=function(e,t,i,r){const n=Math.sqrt(e*e+t*t),o=Math.sqrt(i*i+r*r);e/=n,t/=n,i/=o,r/=o;const s=Math.acos(e*i+t*r);return-t*i+e*r>0?s:-s},e.bM=function(e,t){const i=F(e,2*Math.PI),r=F(t,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))},e.bN=function(){const e={},t=xe.$version;for(const i in xe.$root){const r=xe.$root[i];if(r.required){let n=null;n="version"===i?t:"array"===r.type?[]:{},null!=n&&(e[i]=n)}}return e},e.bO=pe,e.bP=bo,e.bQ=function e(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],i[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(t).length!==Object.keys(i).length)return!1;for(const r in t)if(!e(t[r],i[r]))return!1;return!0}return t===i},e.bR=le,e.bS=function(e){e=e.slice();const t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=Te(e[i],t[e[i].ref]));return e},e.bT=function(e,t){if("custom"===e.type)return new kd(e,t);switch(e.type){case"background":return new Dd(e,t);case"circle":return new _l(e,t);case"color-relief":return new Vl(e,t);case"fill":return new Ac(e,t);case"fill-extrusion":return new Yc(e,t);case"heatmap":return new Al(e,t);case"hillshade":return new Dl(e,t);case"line":return new yh(e,t);case"raster":return new rs(e,t);case"symbol":return new Ad(e,t)}},e.bU=e=>"raster"===e.type,e.bV=G,e.bW=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!Ee(e.version,t.version))return[{command:"setStyle",args:[t]}];Ee(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),Ee(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),Ee(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),Ee(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),Ee(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),Ee(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),Ee(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),Ee(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),Ee(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),Ee(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),Ee(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),Ee(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),Ee(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),Ee(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});const r={},n=[];!function(e,t,i,r){let n;for(n in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||Ie(n,i,r));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?Ee(e[n],t[n])||("geojson"===e[n].type&&"geojson"===t[n].type&&Me(e,t,n)?Se(i,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):Ce(n,t,i,r)):Pe(n,t,i))}(e.sources,t.sources,n,r);const o=[];e.layers&&e.layers.forEach((e=>{"source"in e&&r[e.source]?i.push({command:"removeLayer",args:[e.id]}):o.push(e)})),i=i.concat(n),function(e,t,i){t=t||[];const r=(e=e||[]).map(Le),n=t.map(Le),o=e.reduce(Fe,{}),s=t.reduce(Fe,{}),a=r.slice(),l=Object.create(null);let c,u,h,d,p;for(let e=0,t=0;e<r.length;e++)c=r[e],Object.prototype.hasOwnProperty.call(s,c)?t++:(Se(i,{command:"removeLayer",args:[c]}),a.splice(a.indexOf(c,t),1));for(let e=0,t=0;e<n.length;e++)c=n[n.length-1-e],a[a.length-1-e]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(Se(i,{command:"removeLayer",args:[c]}),a.splice(a.lastIndexOf(c,a.length-t),1)):t++,d=a[a.length-e],Se(i,{command:"addLayer",args:[s[c],d]}),a.splice(a.length-e,0,c),l[c]=!0);for(let e=0;e<n.length;e++)if(c=n[e],u=o[c],h=s[c],!l[c]&&!Ee(u,h))if(Ee(u.source,h.source)&&Ee(u["source-layer"],h["source-layer"])&&Ee(u.type,h.type)){for(p in Ae(u.layout,h.layout,i,c,null,"setLayoutProperty"),Ae(u.paint,h.paint,i,c,null,"setPaintProperty"),Ee(u.filter,h.filter)||Se(i,{command:"setFilter",args:[c,h.filter]}),Ee(u.minzoom,h.minzoom)&&Ee(u.maxzoom,h.maxzoom)||Se(i,{command:"setLayerZoomRange",args:[c,h.minzoom,h.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?Ae(u[p],h[p],i,c,p.slice(6),"setPaintProperty"):Ee(u[p],h[p])||Se(i,{command:"setLayerProperty",args:[c,p,h[p]]}));for(p in h)Object.prototype.hasOwnProperty.call(h,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?Ae(u[p],h[p],i,c,p.slice(6),"setPaintProperty"):Ee(u[p],h[p])||Se(i,{command:"setLayerProperty",args:[c,p,h[p]]}))}else Se(i,{command:"removeLayer",args:[c]}),d=a[a.lastIndexOf(c)+1],Se(i,{command:"addLayer",args:[h,d]})}(o,t.layers,i)}catch(e){console.warn("Unable to compute style diff:",e),i=[{command:"setStyle",args:[t]}]}return i},e.bX=function(e){const t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t}
vendor: 4,492 bytes, line 2
2,e.bY=j,e.bZ=U,e.b_=class extends Ea{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.ba=Yd,e.bb=Kd,e.bc=function(e,t,i,r,n){var o=1/Math.tan(t/2);if(e[0]=o/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0){var s=1/(r-n);e[10]=(n+r)*s,e[14]=2*n*r*s}else e[10]=-1,e[14]=-2*r;return e},e.bd=function(e){var t=new p(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.be=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n+c*r,e[1]=s*n+u*r,e[2]=a*n+h*r,e[3]=l*n+d*r,e[4]=c*n-o*r,e[5]=u*n-s*r,e[6]=h*n-a*r,e[7]=d*n-l*r,e},e.bf=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[4],s=t[5],a=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*n+c*r,e[5]=s*n+u*r,e[6]=a*n+h*r,e[7]=l*n+d*r,e[8]=c*n-o*r,e[9]=u*n-s*r,e[10]=h*n-a*r,e[11]=d*n-l*r,e},e.bg=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],y=t[15],_=i*a-r*s,v=i*l-n*s,b=i*c-o*s,x=r*l-n*a,w=r*c-o*a,T=n*c-o*l,E=u*m-h*f,S=u*g-d*f,P=u*y-p*f,I=h*g-d*m,C=h*y-p*m,M=d*y-p*g,A=_*M-v*C+b*I+x*P-w*S+T*E;return A?(e[0]=(a*M-l*C+c*I)*(A=1/A),e[1]=(n*C-r*M-o*I)*A,e[2]=(m*T-g*w+y*x)*A,e[3]=(d*w-h*T-p*x)*A,e[4]=(l*P-s*M-c*S)*A,e[5]=(i*M-n*P+o*S)*A,e[6]=(g*b-f*T-y*v)*A,e[7]=(u*T-d*b+p*v)*A,e[8]=(s*C-a*P+c*E)*A,e[9]=(r*P-i*C-o*E)*A,e[10]=(f*w-m*b+y*_)*A,e[11]=(h*b-u*w-p*_)*A,e[12]=(a*S-s*I-l*E)*A,e[13]=(i*I-r*S+n*E)*A,e[14]=(m*v-f*x-g*_)*A,e[15]=(u*x-h*v+d*_)*A,e):null},e.bh=function(){const e=new Float32Array(16);return m(e),e},e.bi=function(){const e=new Float64Array(16);return m(e),e},e.bj=function(){return new Float64Array(16)},e.bk=function(e,t,i){const r=new Float64Array(4);return P(r,e,t-90,i),r},e.bl=function(e,t,i,r){var n,o,s,a,l,c=t[0],u=t[1],h=t[2],p=t[3],f=i[0],m=i[1],g=i[2],y=i[3];return(o=c*f+u*m+h*g+p*y)<0&&(o=-o,f=-f,m=-m,g=-g,y=-y),1-o>d?(n=Math.acos(o),s=Math.sin(n),a=Math.sin((1-r)*n)/s,l=Math.sin(r*n)/s):(a=1-r,l=r),e[0]=a*c+l*f,e[1]=a*u+l*m,e[2]=a*h+l*g,e[3]=a*p+l*y,e},e.bm=function(e){const t=new Float64Array(9);var i,r,n,o,s,a,l,c,u,h,d,p,f,m,g,y,_,v;h=(n=(r=e)[0])*(l=n+n),d=(o=r[1])*l,f=(s=r[2])*l,m=s*(c=o+o),y=(a=r[3])*l,_=a*c,v=a*(u=s+s),(i=t)[0]=1-(p=o*c)-(g=s*u),i[3]=d-v,i[6]=f+_,i[1]=d+v,i[4]=1-h-g,i[7]=m-y,i[2]=f-_,i[5]=m+y,i[8]=1-h-p;const b=ie(-Math.asin(z(t[2],-1,1)));let x,w;return Math.hypot(t[5],t[8])<.001?(x=0,w=-ie(Math.atan2(t[3],t[4]))):(x=ie(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),w=ie(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:x,pitch:b+90,bearing:w}},e.bn=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.bo=Mt,e.bp=Sa,e.bq=_c,e.br=vc,e.bs=gc,e.bt=D,e.bu=k,e.bv=jt,e.bw=function(e,t,i,r,n){return D(r,n,z((e-t)/(i-t),0,1))},e.bx=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e},e.by=F,e.bz=function(){return new Float64Array(3)},e.c=ce,e.c$=nn,e.c0=class extends Ea{constructor(e,t){super(e,t),this.current=Ca}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.c1=Pa,e.c2=class extends Ea{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]))}},e.c3=class extends Ea{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]))}},e.c4=f,e.c5=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.c6=function(e,t,i){var r=t[0],n=t[1],o=t[2];return e[0]=r*i[0]+n*i[3]+o*i[6],e[1]=r*i[1]+n*i[4]+o*i[7],e[2]=r*i[2]+n*i[5]+o*i[8],e},e.c7=function(e,t,i,r,n,o,s){var a=1/(t-i),l=1/(r-n),c=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
2]=2*c,e[11]=0,e[12]=(t+i)*a,e[13]=(n+r)*l,e[14]=(s+o)*c,e[15]=1,e},e.c8=class extends Ea{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;const t=new Float32Array(4*e.length);for(let i=0;i<e.length;i++)t[4*i]=e[i].r,t[4*i+1]=e[i].g,t[4*i+2]=e[i].b,t[4*i+3]=e[i].a;this.gl.uniform4fv(this.location,t)}}},e.c9=class extends Ea{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;const t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},e.cA=function(e,t){return re[t]&&"touches"in e},e.cB=function(e){return re[e]||ne[e]},e.cC=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e},e.cD=function(e,t){const{x:i,y:r}=Wd.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||i<0||i>=1)},e.cE=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.cF=class extends us{},e.cG=de,e.cH=function(e,t){ce.REGISTERED_PROTOCOLS[e]=t},e.cI=function(e){delete ce.REGISTERED_PROTOCOLS[e]},e.cJ=function(e,t){const i={};for(let r=0;r<e.length;r++){const n=t&&t[e[r].id]||Tn(e[r]);t&&(t[e[r].id]=n);let o=i[n];o||(o=i[n]=[]),o.push(e[r])}const r=[];for(const e in i)r.push(i[e]);return r},e.cK=fo,e.cL=ep,e.cM=om,e.cN=id,e.cO=function(t){var i,r;t.bucket.createArrays(),t.bucket.tilePixelRatio=M/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;const n=t.bucket.layers[0],o=n.layout,s=n._unevaluatedLayout._values,a={layoutIconSize:s["icon-size"].possiblyEvaluate(new Oo(t.bucket.zoom+1),t.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new Oo(t.bucket.zoom+1),t.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new Oo(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:i}=t.bucket.textSizeData;a.compositeTextSizes=[s["text-size"].possiblyEvaluate(new Oo(e),t.canonical),s["text-size"].possiblyEvaluate(new Oo(i),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:i}=t.bucket.iconSizeData;a.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new Oo(e),t.canonical),s["icon-size"].possiblyEvaluate(new Oo(i),t.canonical)]}const l=o.get("text-line-height")*Ph,c="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement"),u=o.get("text-keep-upright"),h=o.get("text-size");for(const s of t.bucket.features){const d=o.get("text-font").evaluate(s,{},t.canonical).join(","),p=h.evaluate(s,{},t.canonical),f=a.layoutTextSize.evaluate(s,{},t.canonical),m=a.layoutIconSize.evaluate(s,{},t.canonical),g={horizontal:{},vertical:void 0},y=s.text;let _,v=[0,0];if(y){const i=y.toString(),r=o.get("text-letter-spacing").evaluate(s,{},t.canonical)*Ph,a=So(i)?r:0,h=o.get("text-anchor").evaluate(s,{},t.canonical),m=Om(n,s,t.canonical);if(!m){const e=o.get("text-radial-offset").evaluate(s,{},t.canonical);v=e?km(h,[e*Ph,Dm]):o.get("text-offset").evaluate(s,{},t.canonical).map((e=>e*Ph))}let _=c?"center":o.get("text-justify").evaluate(s,{},t.canonical);const b="point"===o.get("symbol-placement")?o.get("text-max-width").evaluate(s,{},t.canonical)*Ph:1/0,x=()=>{t.bucket.allowVerticalPlacement&&Eo(i)&&(g.vertical=nd(y,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,l,h,"left",a,v,e.ax.vertical,!0,f,p))};if(!c&&m){const i=new Set;if("auto"===_)for(let e=0;e<m.values.length;e+=2)i.add(Rm(m.values[e]));else i.add(_);let r=!1;for(const n of i)if(!g.horizontal[n])if(r)g.horizontal[n]=g.horizontal[0];else{const i=nd(y,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,l,"center",n,a,v,e.ax.horizontal,!1,f,p);i&&(g.horizontal[n]=i,r=1===i.positionedLines.length)}x()}else{"auto"===_&&(_=Rm(h));const r=nd(y,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,l,h,_,a,v,e.ax.horizontal,!1,f,p);r&&(g.horizontal[_]=r),x(),Eo(i)&&c&&u&&(g.vertical=nd(y,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,l,h,_,a,v,e.ax.vertical,!1,f,p))}}let b=!1;if(null===(i=s.icon)||void 0===i?void 0:i.name){const e=t.imageMap[s.icon.name];e&&(_=dd(t.imagePositions[s.icon.name],o.get("icon-offset").evaluate(s,{},t.canonical),o.get("icon-anchor").evaluate(s,{},t.canonical)),b=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&&q("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==o.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const x=Bm(g.horizontal)||g.vertical;(r=t.bucket).iconsInText||(r.iconsInText=!!x&&x.iconsInText),(x||_)&&zm(t.bucket,s,g,_,t.imageMap,a,f,m,v,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cP=Pc,e.cQ=$c,e.cR=hh,e.cS=function(e,t=""){const i=new Bh;return function(e,t,i=""){for(const r in e.layers)t.writeMessage(3,((e,t)=>
2Kf(e,t,i)),e.layers[r])}(e,i,t),i.finish()},e.cT=function(e,t,i,r,n,o){let s=cm(e,t,i,n,0);return s=cm(s,t,r,o,1),s},e.cU=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){const t=this.map.get(e);return void 0!==t&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){const e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}clear(){this.map.clear()}},e.cV=Vc,e.cW=Bh,e.cX=Xf,e.cY=function(e,i,r,n,o){return t(this,void 0,void 0,(function*(){if(h())try{return yield J(e,i,r,n,o)}catch(e){}return function(e,t,i,r,n){const o=e.width,s=e.height;K&&Q||(K=new OffscreenCanvas(o,s),Q=K.getContext("2d",{willReadFrequently:!0})),K.width=o,K.height=s,Q.drawImage(e,0,0,o,s);const a=Q.getImageData(t,i,r,n);return Q.clearRect(0,0,o,s),a.data}(e,i,r,n,o)}))},e.cZ=Nl,e.c_=class{constructor(e,t){this.layers={[Jf]:this},this.name=Jf,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new Yf(this.features[e],this.extent)}},e.ca=class extends ws{},e.cb=Th,e.cc=class extends Es{},e.cd=Ml,e.ce=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},e.cf=Cl,e.cg=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[3]*r+i[7]*n+i[11]*o+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/(s=s||1),e[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/s,e[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/s,e},e.ch=class extends hs{},e.ci=class extends Ls{},e.cj=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},e.ck=function(e,t){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],p=e[10],f=e[11],m=e[12],g=e[13],y=e[14],_=e[15],v=t[0],b=t[1],x=t[2],w=t[3],T=t[4],E=t[5],S=t[6],P=t[7],I=t[8],C=t[9],M=t[10],A=t[11],L=t[12],F=t[13],D=t[14],k=t[15];return Math.abs(i-v)<=d*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(r-b)<=d*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(n-x)<=d*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-w)<=d*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-T)<=d*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(a-E)<=d*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(l-S)<=d*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(c-P)<=d*Math.max(1,Math.abs(c),Math.abs(P))&&Math.abs(u-I)<=d*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(h-C)<=d*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(p-M)<=d*Math.max(1,Math.abs(p),Math.abs(M))&&Math.abs(f-A)<=d*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(m-L)<=d*Math.max(1,Math.abs(m),Math.abs(L))&&Math.abs(g-F)<=d*Math.max(1,Math.abs(g),Math.abs(F))&&Math.abs(y-D)<=d*Math.max(1,Math.abs(y),Math.abs(D))&&Math.abs(_-k)<=d*Math.max(1,Math.abs(_),Math.abs(k))},e.cl=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.cm=e=>"circle"===e.type,e.cn=e=>"heatmap"===e.type,e.co=e=>"line"===e.type,e.cp=e=>"fill"===e.type,e.cq=e=>"fill-extrusion"===e.type,e.cr=e=>"hillshade"===e.type,e.cs=e=>"color-relief"===e.type,e.ct=e=>"background"===e.type,e.cu=e=>"custom"===e.type,e.cv=O,e.cw=function(e,t,i){if(t<=0)return e;const r=1/t;return void 0===i||Math.abs(i)<1e-10?Math.round(e*r)/r:(i>0?Math.ceil(e*r-1e-9):Math.floor(e*r+1e-10))/r},e.cx=function(e,t,i){const r=C(t.x-i.x,t.y-i.y),n=C(e.x-i.x,e.y-i.y);var o,s;return ie(Math.atan2(r[0]*n[1]-r[1]*n[0],(o=r)[0]*(s=n)[0]+o[1]*s[1]))},e.cy=R,e.cz=function(e,t){var i;if(!ne[t])return!1;const r=null==e?void 0:e.target,n=(null===(i=null==r?void 0:r.ownerDocument)||void 0===i?void 0:i.defaultView)||window;return e instanceof n.MouseEvent||e instanceof n.WheelEvent},e.d=L,e.d0=class{constructor(e,t){const i=(t=this.options=Object.assign({},nh,t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=hu(e,t);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles")),r=Ru(r,t),t.updateable&&(this.source=r),this.initializeIndex(r,t)}initializeIndex(e,t){this.tileIndex=t.cluster?new Gu(t.clusterOptions):new ih(t),e.length&&this.tileIndex.initialize(e)}getTile(e,t,i){return t=+t,i=+i,(e=+e)<0||e>24?null:this.tileIndex.getTile(e,t,i)}updateData(e,t){const i=this.options;if(!i.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:r,source:n}=function(e,t,i){const r=function(e,t){return e?{removeAll:e.removeAll,remove:ne
2w Set(e.remove||[]),add:new Map(e.add?.map((e=>[t.promoteId?e.properties[t.promoteId]:e.id,e]))),update:new Map(e.update?.map((e=>[e.id,e])))}:{remove:new Set,add:new Map,update:new Map}}(t,i);let n=[];if(r.removeAll&&(n=e,e=[]),r.remove.size||r.add.size){const t=[];for(const i of e)(r.remove.has(i.id)||r.add.has(i.id))&&t.push(i);if(t.length){n.push(...t);const i=new Set(t.map((e=>e.id)));e=e.filter((e=>!i.has(e.id)))}if(r.add.size){let t=hu({type:"FeatureCollection",features:Array.from(r.add.values())},i);t=Ru(t,i),n.push(...t),e.push(...t)}}if(r.update.size){const t=new Map,o=[];for(const i of e)r.update.has(i.id)?t.set(i.id,[...t.get(i.id)||[],i]):o.push(i);for(const[e,s]of r.update){const r=t.get(e);if(!r||0===r.length)continue;const a=Vu(r,s,i);n.push(...r,...a),o.push(...a)}e=o}return{affected:n,source:e}}(this.source,e,i);t&&({affected:r,source:n}=this.filterUpdate(n,r,t)),r.length&&(this.source=n,this.tileIndex.updateIndex(n,r,i))}filterUpdate(e,t,i){const r=new Set;for(const n of e)null!=n.id&&(i(yu(n))||(t.push(n),r.add(n.id)));return{affected:t,source:e=e.filter((e=>!r.has(e.id)))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map((e=>yu(e)))}}updateClusterOptions(e,t){const i=this.options.cluster;this.options.cluster=e,this.options.clusterOptions=t,i!=e?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(e){return this.tileIndex.getClusterExpansionZoom(e)}getClusterChildren(e){return this.tileIndex.getChildren(e)}getClusterLeaves(e,t,i){return this.tileIndex.getLeaves(e,t,i)}},e.d1=ko,e.e=B,e.f=me,e.g=ue,e.h=e=>t(void 0,void 0,void 0,(function*(){if(0===e.byteLength)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(e){throw new Error(`Could not load image because of ${L(e).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),e.i=W,e.j=e=>new Promise(((t,i)=>{const r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>r.src=Y))},r.onerror=()=>i(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."));const n=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(n):Y})),e.k=(e,t)=>fe(B(e,{type:"json"}),t),e.l=ve,e.m=fe,e.n=_e,e.o=(e,t)=>fe(B(e,{type:"arrayBuffer"}),t),e.p=ed,e.q=function(e){return new Bh(e).readFields(Jh,[])},e.r=function(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))},e.s=ee,e.t=Sl,e.u=Jo,e.v=no,e.w=q,e.x=xe,e.y=Vo,e.z=so})),i("worker",0,(function(e){class t{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,i,r){for(const i of t){this._layerConfigs[i.id]=i;const t=this._layers[i.id]=e.bT(i,r);t._featureFilter=e.ah(t.filter,r),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const e of i)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const n=e.cJ(Object.values(this._layerConfigs),this.keyCache);for(const t of n){const i=t.map((e=>this._layers[e.id])),r=i[0];if(r.isHidden())continue;const n=r.source||"";let o=this.familiesBySource[n];o||(o=this.familiesBySource[n]={});const s=r.sourceLayer||e.ag;let a=o[s];a||(a=o[s]=[]),a.push(i)}}}class i{constructor(t){const i={},r=[];for(const e in t){const n=t[e],o=i[e]={};for(const e in n){const t=n[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(i),o[e]={rect:i,metrics:t.metrics}}}const{w:n,h:o}=e.p(r),s=new e.t({width:n||1,height:o||1});for(const r in t){const n=t[r];for(const t in n){const o=n[+t];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const a=i[r][t].rect;e.t.copy(o.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},o.bitmap)}}this.image=s,this.positions=i}}e.cK("GlyphAtlas",i);
2class r{constructor(t){this.tileID=new e.a3(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,r,o,s,a){return e._(this,void 0,void 0,(function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.ae;const l=new e.cL(Object.keys(t.layers).sort()),c=new e.cM(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:o,subdivisionGranularity:a},d=r.familiesBySource[this.source];for(const i in d){const r=t.layers[i];if(!r)continue;1===r.version&&e.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const s=l.encode(i),a=[];for(let e=0;e<r.length;e++){const t=r.feature(e),n=c.getId(t,i);a.push({feature:t,id:n,index:e,sourceLayerIndex:s})}for(const t of d[i]){const i=t[0];i.source!==this.source&&e.w(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.isHidden(this.zoom,!0)||(n(t,this.zoom,o),(u[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:s,sourceID:this.source})).populate(a,h,this.tileID.canonical),c.bucketLayerIDs.push(t.map((e=>e.id))))}}const p=e.bY(h.glyphDependencies,(e=>Object.keys(e).map(Number)));for(const e of this.inFlightDependencies)null==e||e.abort();this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){const e=new AbortController;this.inFlightDependencies.push(e),f=s.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}const m=Object.keys(h.iconDependencies);let g=Promise.resolve({});if(m.length){const e=new AbortController;this.inFlightDependencies.push(e),g=s.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},e)}const y=Object.keys(h.patternDependencies);let _=Promise.resolve({});if(y.length){const e=new AbortController;this.inFlightDependencies.push(e),_=s.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"patterns"}},e)}const v=h.dashDependencies;let b=Promise.resolve({});if(Object.keys(v).length){const e=new AbortController;this.inFlightDependencies.push(e),b=s.sendAsync({type:"GDA",data:{dashes:v}},e)}const[x,w,T,E]=yield Promise.all([f,g,_,b]),S=new i(x),P=new e.cN(w,T);for(const t in u){const i=u[t];i instanceof e.af?(n(i.layers,this.zoom,o),e.cO({bucket:i,glyphMap:x,glyphPositions:S.positions,imageMap:w,imagePositions:P.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:h.subdivisionGranularity})):i.hasDependencies&&(i instanceof e.cP||i instanceof e.cQ||i instanceof e.cR)&&(n(i.layers,this.zoom,o),i.addFeatures(h,this.tileID.canonical,P.patternPositions,E))}return this.status="done",{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:S.image,imageAtlas:P,dashPositions:E,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?w:null,glyphPositions:this.returnDependencies?S.positions:null}}))}}function n(t,i,r){const n=new e.J(i);for(const e of t)e.recalculate(n,r)}class o{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(e,t){this.loading[e]=t}finishLoading(e){delete this.loading[e]}abort(e){const t=this.loading[e];(null==t?void 0:t.abort)&&(t.abort.abort(),delete this.loading[e])}setParsing(e,t){this.parsing[e]=t}consumeParsing(e){const t=this.parsing[e];if(t)return delete this.parsing[e],t}clearParsing(e){delete this.parsing[e]}markLoaded(e,t){this.loaded[e]=t}getLoaded(e){const t=this.loaded[e];if(t)return t}removeLoaded(e){delete this.loaded[e]}clearLoaded(){this.loaded={}}}class s{constructor(e){this.start=`${e}#start`,this.end=`${e}#end`,this.measure=e,performance.mark(this.start)}finish(){performance.mark(this.end);let e=performance.getEntriesByName(this.measure);return 0===e.length&&(performance.measure(this.measure,this.start,this.end),e=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),e}}class a{constructor(e,t,i,r,n){this.type=e,this.properties=i||{},this.extent=n,this.pointsArray=t,this.id=r}loadGeometry(){return this.pointsArray.map((t=>t.map((t=>new e.P(t.x,t.y)))))}}class l{constructor(e,t,i){this.version=2,this._myFeatures=e,this.name=t,this.length=e.length,this.extent=i}feature(e){return this._myFeatures[e]}}class c{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}}function u(t){let i=e.cS(t);return 0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),{vectorTile:t,rawData:i.buffer}}function h(t,i,r){const{extent:n}=t,o=Math.pow(2,r.z-i.z),s=(r.x-i.x*o)*n,c=(r.y-i.y*o)*n,u=[];for(let i=0;i<t.length;i++){const r=t.feature(i);let l=r.loadGeometry();for(const e of l)for(const t of e)t.x=t.x*o-s,t.y=t.y*o-c;const h=128;l=e.cT(l,r.type,-h,-h,n+h,n+h),0!==l.length&&u.push(new a(r.type,l,r.properties,r.id,n))}return new l(u,t.name,n)}class d{constructor(t,i,r){this.actor=t,this.layerIndex=i,this.availableImages=r,this.tileState=new o,this.overzoomedTileResultCache=new e.cU(1e3)}loadVectorTile(t,i){try{return{vectorTile:"mlt"!==t.encoding?new e.cV(new e.cW(i)):new e.cX(i),rawData:i}}catch(r){const n=new Uint8Array(i);let o=`Unable to parse the tile at ${t.request.url}, `;throw o+=31===n[0]&&139===n[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${e.d(r).message}`,new Error(o)}}loadTile(t){return e._(this,void 0,void 0,(function*(){const{uid:i,overzoomParameters:n}=t;n&&(t.request=n.overzoomRequest);const o=this._startRequestTiming(t),s=new r(t);this.tileState.startLoading(i,s);const a=new AbortController;s.abort=a;try{const r=yield e.o(t.request,a);if(t.etag&&t.etag===r.etag)return this.tileState.finishLoading(i),this._getEtagUnmodifiedResult(r,o);const l=this.loadVectorTile(t,r.data);if(this.tileState.finishLoading(i),!l)return null;let{vectorTile:c,rawData:u}=l;n&&({vectorTile:c,rawData:u}=this._getOverzoomTile(t,c));const h=this._getExpiryData(r),d=this._finishRequestTiming(o);s.vectorTile=c,this.tileState.markLoaded(i,s);
2const p={rawData:u,cacheControl:h,resourceTiming:d};this.tileState.setParsing(i,p);try{return yield this._parseWorkerTile(s,t,p)}finally{this.tileState.clearParsing(i)}}catch(e){throw this.tileState.finishLoading(i),s.status="done",this.tileState.markLoaded(i,s),e}}))}_getEtagUnmodifiedResult(t,i){const r=this._getExpiryData(t),n=this._finishRequestTiming(i);return e.e({etagUnmodified:!0},r,n)}_parseWorkerTile(t,i,r){return e._(this,void 0,void 0,(function*(){let n=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity);if(r){const{rawData:t,cacheControl:o,resourceTiming:s}=r;n=e.e({rawTileData:t.slice(0),encoding:i.encoding},n,o,s)}return n}))}_getExpiryData({expires:e,cacheControl:t,etag:i}){const r={};return e&&(r.expires=e),t&&(r.cacheControl=t),i&&(r.etag=i),r}_startRequestTiming(e){var t;if(null===(t=e.request)||void 0===t?void 0:t.collectResourceTiming)return new s(e.request.url)}_finishRequestTiming(e){const t=null==e?void 0:e.finish();return t?{resourceTiming:JSON.parse(JSON.stringify(t))}:{}}_getOverzoomTile(e,t){var i;const{tileID:r,source:n,overzoomParameters:o}=e,{maxZoomTileID:s}=o,a=`${s.key}_${r.key}_${null===(i=e.request)||void 0===i?void 0:i.url}`,l=this.overzoomedTileResultCache.get(a);if(l)return l;const d=new c,p=this.layerIndex.familiesBySource[n];for(const e in p){const i=t.layers[e];if(!i)continue;const n=h(i,s,r.canonical);n.length>0&&d.addLayer(n)}const f=u(d);return this.overzoomedTileResultCache.set(a,f),f}reloadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.uid,i=this.tileState.getLoaded(e);if(!i)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status){const r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(i,t,r)}if("done"===i.status&&i.vectorTile)return yield this._parseWorkerTile(i,t)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.abort(t.uid)}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(t.uid)}))}}class p{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,(function*(){const{uid:i,encoding:r,rawImageData:n,redFactor:o,greenFactor:s,blueFactor:a,baseShift:l}=t,c=n.width+2,u=n.height+2,h=e.b(n)?new e.R({width:c,height:u},yield e.cY(n,-1,-1,c,u)):n,d=new e.cZ(i,h,r,o,s,a,l);return this.loaded||(this.loaded={}),this.loaded[i]=d,d}))}removeTile(e){const t=this.loaded,i=e.uid;(null==t?void 0:t[i])&&delete t[i]}}class f{constructor(e,t,i,r=m){this.actor=e,this.layerIndex=t,this.availableImages=i,this.tileState=new o,this._createGeoJSONIndex=r}loadVectorTile(t){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const{z:i,x:r,y:n}=t.tileID.canonical,o=this._geoJSONIndex.getTile(i,r,n);return o?u(new e.c_(o.features,{version:2,extent:e.a6})):null}loadTile(t){return e._(this,void 0,void 0,(function*(){const{uid:e}=t,i=new r(t);i.abort=new AbortController;try{const r=this.loadVectorTile(t);if(!r)return null;const{vectorTile:n,rawData:o}=r;i.vectorTile=n,this.tileState.markLoaded(e,i);const s={rawData:o};this.tileState.setParsing(e,s);try{return yield this._parseWorkerTile(i,t,s)}finally{this.tileState.clearParsing(e)}}catch(t){throw i.status="done",this.tileState.markLoaded(e,i),t}}))}_reloadLoadedTile(t){return e._(this,void 0,void 0,(function*(){const e=t.uid,i=this.tileState.getLoaded(e);if(!i)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status){const r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(i,t,r)}if("done"===i.status&&i.vectorTile)return yield this._parseWorkerTile(i,t)}))}_parseWorkerTile(t,i,r){return e._(this,void 0,void 0,(function*(){let n=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity);if(r){const{rawData:t}=r;n=e.e({rawTileData:t.slice(0),encoding:"mvt"},n)}return n}))}abortTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.abort(t.uid)}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(t.uid)}))}loadData(t){return e._(this,void 0,void 0,(function*(){var i;
2null===(i=this._pendingRequest)||void 0===i||i.abort();const r=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();const e={};return t.request&&(e.data=t.data),this._finishRequestTiming(r,t,e),e}catch(t){if(delete this._pendingRequest,!e.$(t))throw t;return{abandoned:!0}}}))}_startRequestTiming(e){var t;if(null===(t=e.request)||void 0===t?void 0:t.collectResourceTiming)return new s(e.request.url)}_finishRequestTiming(e,t,i){const r=null==e?void 0:e.finish();r&&(i.resourceTiming={[t.source]:JSON.parse(JSON.stringify(r))})}reloadTile(e){return this.tileState.getLoaded(e.uid)?this._reloadLoadedTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,i){return e._(this,void 0,void 0,(function*(){var r;if(t.request&&(t.data=(yield e.k(t.request,i)).data),t.data)return t.data=this._filterGeoJSON(t.data,t.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(t.data,t));if(t.dataDiff)return null!==(r=this._geoJSONIndex)&&void 0!==r||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},t)),void this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter));if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,g(t)),null==this._geoJSONIndex)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(e,t){if("FeatureCollection"!==e.type)return e;const i=this._getFilterPredicate(t);return i?{type:"FeatureCollection",features:e.features.filter((e=>i(e)))}:e}_getFilterPredicate(t){if("boolean"!=typeof t&&!(null==t?void 0:t.length))return;const i=e.c$(t,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return e=>i.value.evaluate({zoom:0},e)}removeSource(t){return e._(this,void 0,void 0,(function*(){var e;null===(e=this._pendingRequest)||void 0===e||e.abort()}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getClusterChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getClusterLeaves(e.clusterId,e.limit,e.offset)}}function m(t,i){const r=e.e(i.geojsonVtOptions||{},{updateable:!0,clusterOptions:g(i)});return new e.d0(t,r)}function g({geojsonVtOptions:t,clusterProperties:i}){if(!i||!t.clusterOptions)return t.clusterOptions;const r={},n={},o={accumulated:null,zoom:0},s={properties:null},a=Object.keys(i);for(const t of a){const[o,s]=i[t],a=e.c$(s),l=e.c$("string"==typeof o?[o,["accumulated"],["get",t]]:o);r[t]=a.value,n[t]=l.value}return t.clusterOptions.map=e=>{s.properties=e;const t={};for(const e of a)t[e]=r[e].evaluate(o,s);return t},t.clusterOptions.reduce=(e,t)=>{s.properties=t;for(const t of a)o.accumulated=e[t],e[t]=n[t].evaluate(o,s)},t.clusterOptions}class y{constructor(t){this.self=t,this.actor=new e.N(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cH,this.self.removeProtocol=e.cI,this.self.registerRTLTextPlugin=t=>{e.d1.setMethods(t)},this.self.makeRequest=e.m,this.actor.registerMessageHandler("LDT",((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler("RDT",((t,i)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,i.source).removeTile(i)})))),this.actor.registerMessageHandler("GCEZ",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterExpansionZoom(i)})))),this.actor.registerMessageHandler("GCC",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterChildren(i)})))),this.actor.registerMessageHandler("GCL",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterLeaves(i)})))),this.actor.registerMessageHandler("LD",((e,t)=>
2this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler("LT",((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler("RT",((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler("AT",((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler("RMT",((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler("RS",((t,i)=>e._(this,void 0,void 0,(function*(){var e,r;if(!(null===(r=null===(e=this.workerSources[t])||void 0===e?void 0:e[i.type])||void 0===r?void 0:r[i.source]))return;const n=this.workerSources[t][i.type][i.source];delete this.workerSources[t][i.type][i.source],void 0!==n.removeSource&&n.removeSource(i)})))),this.actor.registerMessageHandler("RM",(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],this.globalStates.delete(t)})))),this.actor.registerMessageHandler("SR",((t,i)=>e._(this,void 0,void 0,(function*(){this.referrer=i})))),this.actor.registerMessageHandler("SRPS",((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler("IS",((t,i)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(i)})))),this.actor.registerMessageHandler("SI",((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler("UL",((t,i)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(i.layers,i.removedIds,this._getGlobalState(t))})))),this.actor.registerMessageHandler("UGS",((t,i)=>e._(this,void 0,void 0,(function*(){const e=this._getGlobalState(t);for(const t in i)e[t]=i[t]})))),this.actor.registerMessageHandler("SL",((t,i)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(i,this._getGlobalState(t))}))))}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}_setImages(t,i){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=i;for(const e in this.workerSources[t]){const r=this.workerSources[t][e];for(const e in r)r[e].availableImages=i}}))}_syncRTLPluginState(t,i){return e._(this,void 0,void 0,(function*(){return yield e.d1.syncState(i,this.self.importScripts)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let i=this.layerIndexes[e];return i||(i=this.layerIndexes[e]=new t),i}_getWorkerSource(e,t,i){var r,n;if((r=this.workerSources)[e]||(r[e]={}),(n=this.workerSources[e])[t]||(n[t]={}),!this.workerSources[e][t][i]){const r={sendAsync:(t,i)=>(t.targetMapId=e,this.actor.sendAsync(t,i))};switch(t){case"vector":this.workerSources[e][t][i]=new d(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][i]=new f(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][i]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][i]}_getDEMWorkerSource(e,t){var i,r;return(i=this.demWorkerSources)[e]||(i[e]={}),(r=this.demWorkerSources[e])[t]||(r[t]=new p),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new y(self)),y})),i("index",0,(function(e,t){var i="5.24.0";function r(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let n,o,s;const a={frame(e,i,r,n){const o=n||window,s=o.requestAnimationFrame((e=>{a(),i(e)})),{unsubscribe:a}=t.s(e.signal,"abort",(()=>{a(),o.cancelAnimationFrame(s),r(new t.a(e.signal.reason))}),!1)},frameAsync(e,t){return new Promise(((i,r)=>{this.frame(e,i,r,t)}))},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){const t=window.document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0,e.width,e.height),i},resolveURL:e=>(n||(n=document.createElement("a")),n.href=e,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==s?s:!!matchMedia&&(null!=o||(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)},set prefersReducedMotion(e){s=e}},l=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:performance.now()}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function c(){return l.getCurrentTime()}var u,h;class d{static create(e,t,i){const r=window.document.createElement(e);return void 0!==t&&(r.className=t),i&&i.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){d.docStyle&&d.selectProp&&(d.userSelect=d.docStyle[d.selectProp],d.docStyle[d.selectProp]="none")}static enableDrag(){d.docStyle&&d.selectProp&&(d.docStyle[d.selectProp]=d.userSelect)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",d.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",d.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",d.suppressClickInternal,!0)}),0)}static getScale(e){const t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,i,r){const n=i.boundingClientRect;return new t.P((r.clientX-n.left)/i.x-e.clientLeft,(r.clientY-n.top)/i.y-e.clientTop)}static mousePos(e,t){const i=d.getScale(e);return d.getPoint(e,i,t)}static touchPos(e,t){const i=[],r=d.getScale(e);for(const n of t)i.push(d.getPoint(e,r,n));return i}static sanitize(e){const t=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body"),i=t.querySelectorAll("script");for(const e of i)e.remove();return d.clean(t),t.innerHTML}static isPossiblyDangerous(e,t){const i=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!i.includes("javascript:")&&!i.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const t=e.children;for(const e of t)d.removeAttributes(e),d.clean(e)}static removeAttributes(e){for(const{name:t,value:i}of e.attributes)d.isPossiblyDangerous(t,i)&&e.removeAttribute(t)}}d.docStyle="undefined"!=typeof window&&(null===(u=window.document)||void 0===u?void 0:u.documentElement.style),d.selectProp=!d.docStyle||"userSelect"in d.docStyle?"userSelect":"webkitUserSelect",function(e){let i,r,n,o;e.resetRequestQueue=()=>{i=[],r=0,n=0,o={}},e.addThrottleControl=e=>{const t=n++;return o[t]=e,t},e.removeThrottleControl=e=>{delete o[e],a()},e.getImage=(e,r,n=!0)=>new Promise(((o,s)=>{e.headers||(e.headers={}),e.headers.accept="image/webp,*/*",t.e(e,{type:"image"}),i.push({abortController:r,requestParameters:e,supportImageRefresh:n,state:"queued",onError:e=>{s(e)},onSuccess:e=>{o(e)}}),a()}));const s=e=>
2t._(this,void 0,void 0,(function*(){e.state="running";const{requestParameters:i,supportImageRefresh:n,onError:o,onSuccess:s,abortController:c}=e,u=!1===n&&!t.i(self)&&!t.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce(((e,t)=>e&&"accept"===t),!0));r++;const h=u?l(i,c):t.m(i,c);try{const i=yield h;delete e.abortController,e.state="completed",i.data instanceof HTMLImageElement||t.b(i.data)?s(i):i.data&&s({data:yield(d=i.data,"function"==typeof createImageBitmap?t.h(d):t.j(d)),cacheControl:i.cacheControl,expires:i.expires})}catch(i){delete e.abortController,o(t.d(i))}finally{r--,a()}var d})),a=()=>{const e=(()=>{for(const e of Object.keys(o))if(o[e]())return!0;return!1})()?t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&i.length>0;t++){const e=i.shift();e.abortController.signal.aborted?t--:s(e)}},l=(e,i)=>new Promise(((r,n)=>{const o=new Image,s=e.url,a=e.credentials;a&&"include"===a?o.crossOrigin="use-credentials":(a&&"same-origin"===a||!t.f(s))&&(o.crossOrigin="anonymous"),i.signal.addEventListener("abort",(()=>{o.src="",n(new t.a(i.signal.reason))})),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,r({data:o})},o.onerror=()=>{o.onerror=o.onload=null,i.signal.aborted||n(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."))},o.src=s}))}(h||(h={})),h.resetRequestQueue();class p{constructor(e){this._transformRequestFn=null!=e?e:null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function f(e){const t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){const i=[];for(const{id:r,url:n}of e){const e=`${r}${n}`;i.includes(e)||(i.push(e),t.push({id:r,url:n}))}}return t}function m(e,t,i){try{const r=new URL(e);return r.pathname+=`${t}${i}`,r.toString()}catch(t){throw new Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function g(e){const{userImage:t}=e;return!(!(null==t?void 0:t.render)||!t.render()||(e.data.replace(new Uint8Array(t.data.buffer)),0))}class y extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const e of Object.keys(this.images))this.removeImage(e);this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const e=i.spriteData;i.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}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,i){let r=!0;const n=i.data||i.spriteData;return this._validateStretch(i.stretchX,null==n?void 0:n.width)||(this.fire(new t.l(new Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,null==n?void 0:n.height)||(this.fire(new t.l(new Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.l(new Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let i=0;for(const r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;const i=t.spriteData,r=(null==i?void 0:i.width)||t.data.width,n=(null==i?void 0:i.height)||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||n<e[1]||e[2]<0||r<e[2]||e[3]<0||n<e[3]||e[2]<e[0]||!(e[3]>=e[1]))}updateImage(e,t,i=!0){const r=this.getImage(e);if(i&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw new Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){var t;const i=this.images[e];delete this.images[e],delete this.patterns[e],(null===(t=i.userImage)||void 0===t?void 0:t.onRemove)&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((t,i)=>{let r=!0;if(!this.isLoaded())for(const t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})}))}_getImagesForIds(e){var i;const r={};for(const n of e){let e=this.getImage(n);e||(this.fire(new t.n("styleimagemissing",{id:n})),e=this.getImage(n)),e?r[n]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:Boolean(null===(i=e.userImage)||void 0===i?void 0:i.render)}:t.w(`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 r}getPixelSize(){const{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){const i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{const i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new t.I(i,r);this.patterns[e]={bin:i,position:n}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.T(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:r}=t.p(e),n=this.atlasImage;n.resize({width:i||1,height:r||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],r=i.x+1,o=i.y+1,s=this.getImage(e).data,a=s.width,l=s.height;t.R.copy(s,n,{x:0,y:0},{x:r,y:o},{width:a,height:l}),t.R.copy(s,n,{x:0,y:l-1},{x:r,y:o-1},{width:a,height:1}),t.R.copy(s,n,{x:0,y:0},{x:r,y:o+l},{width:a,height:1}),t.R.copy(s,n,{x:a-1,y:0},{x:r-1,y:o},{width:1,height:l}),t.R.copy(s,n,{x:0,y:0},{x:r+a,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}
2dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const e=this.getImage(i);e||t.w(`Image with ID: "${i}" was not found`),g(e)&&this.updateImage(i,e)}}cloneImages(){const e={};for(const t in this.images){const i=this.images[t];e[t]=Object.assign(Object.assign({},i),{data:i.data?i.data.clone():null})}return e}}const _=1e20,v=new Float64Array(256);for(let e=0;e<256;e++){const t=.5-Math.pow(e/255,1/2.2);v[e]=t*Math.abs(t)}function b(e,t,i,r,n,o,s,a,l){for(let c=t;c<t+r;c++)x(e,i*o+c,o,n,s,a,l);for(let c=i;c<i+n;c++)x(e,c*o+t,1,r,s,a,l)}function x(e,t,i,r,n,o,s){o[0]=0,s[0]=-_,s[1]=_,n[0]=e[t];for(let a=1,l=0,c=0;a<r;a++){n[a]=e[t+a*i];const r=a*a;do{const e=o[l];c=(n[a]-n[e]+r-e*e)/(a-e)/2}while(c<=s[l]&&--l>-1);l++,o[l]=a,s[l]=c,s[l+1]=_}for(let a=0,l=0;a<r;a++){for(;s[l+1]<a;)l++;const r=o[l],c=a-r;e[t+a*i]=n[r]+c*c}}v[255]=-_;const w=t.v.layout_symbol["text-font"].default.join(",");class T{constructor(e,t,i){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=i}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,(function*(){const t=[];for(const i in e)for(const r of e[i])t.push(this._getAndCacheGlyphsPromise(i,r));const i=yield Promise.all(t),r={};for(const{stack:e,id:t,glyph:n}of i)r[e]||(r[e]={}),r[e][t]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return r}))}_getAndCacheGlyphsPromise(e,i){return t._(this,void 0,void 0,(function*(){var t,r;null!==(t=(r=this.entries)[e])&&void 0!==t||(r[e]={glyphs:{},requests:{},ranges:{}});const n=this.entries[e];let o=n.glyphs[i];return void 0!==o?{stack:e,id:i,glyph:o}:!this.url||this._charUsesLocalIdeographFontFamily(i)?(o=n.glyphs[i]=this._drawGlyph(n,e,i),{stack:e,id:i,glyph:o}):yield this._downloadAndCacheRangePromise(e,i)}))}_downloadAndCacheRangePromise(e,i){return t._(this,void 0,void 0,(function*(){var r;const n=this.entries[e],o=Math.floor(i/256);if(n.ranges[o])return{stack:e,id:i,glyph:null};(r=n.requests)[o]||(r[o]=T.loadGlyphRange(e,o,this.url,this.requestManager));try{const t=yield n.requests[o];for(const e in t)n.glyphs[+e]=t[+e];return n.ranges[o]=!0,{stack:e,id:i,glyph:t[i]||null}}catch(r){const s=n.glyphs[i]=this._drawGlyph(n,e,i);return this._warnOnMissingGlyphRange(s,o,i,t.d(r)),{stack:e,id:i,glyph:s}}}))}_warnOnMissingGlyphRange(e,i,r,n){const o=256*i,s=o+255,a=r.toString(16).padStart(4,"0").toUpperCase();t.w(`Unable to load glyph range ${i}, ${o}-${s}. Rendering codepoint U+${a} locally instead. ${n}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&t.r(e)}_drawGlyph(e,i,r){const n=i===w&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(r),o=n?"ideographTinySDF":"tinySDF";e[o]||(e[o]=this._createTinySDF(n?this.localIdeographFontFamily:i));const s=e[o].draw(String.fromCodePoint(r)),a=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(r));return{id:r,bitmap:new t.t({width:s.width||60,height:s.height||60},s.data),metrics:{width:a?0:s.glyphWidth/2||24,height:s.glyphHeight/2||24,left:s.glyphLeft/2+.5||0,top:s.glyphTop/2-27.5||-8,advance:a?0:s.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(e){const t=e?e.split(","):[];t.push("sans-serif");const i=t.map((e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`)).join(",");return new T.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:i,fontWeight:this._fontWeight(t[0]),fontStyle:this._fontStyle(t[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){const t={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let i;for(const[r,n]of Object.entries(t))new RegExp(`\\b${r}\\b`,"i").test(e)&&(i=`${n}`);return i}destroy(){for(const e in this.entries){const t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.glyphs={},t.requests={},t.ranges={}}this.entries={}}}T.loadGlyphRange=function(e,i,r,n){return t._(this,void 0,void 0,(function*(){const o=256*i,s=o+255,a=yield n.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${o}-${s}`),"Glyphs"),l=yield t.o(a,new AbortController);if(!(null==l?void 0:l.data))throw new Error(`Could not load glyph range. range: ${i}, ${o}-${s}`);const c={};for(const e of t.q(l.data))c[e.id]=e;return c}))},T.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal",lang:a=null}={}){this.buffer=t,this.radius=i,this.cutoff=r,this.lang=a;const l=this.size=e+4*t,c=this._createCanvas(l),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${o} ${e}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.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){if("undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(e,e);const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(i),a=Math.floor(n),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o)-a)),c=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(r))),u=l+2*this.buffer,h=c+2*this.buffer,d=Math.max(u*h,0),p=new Uint8ClampedArray(d),f={data:p,width:u,height:h,glyphWidth:l,glyphHeight:c,glyphTop:s,glyphLeft:a,glyphAdvance:t};if(0===l||0===c)return f;const{ctx:m,buffer:g,gridInner:y,gridOuter:x}=this;this.lang&&(m.lang=this.lang),m.clearRect(g,g,l,c),m.fillText(e,g-a,g+s);const w=m.getImageData(g,g,l,c);x.fill(_,0,d),y.fill(0,0,d);let T=3;for(let e=0;e<c;e++){let t=(e+g)*u+g;for(let e=0;e<l;e++,T+=4,t++){const e=w.data[T];if(0===e)continue;const i=v[e];x[t]=Math.max(0,i),y[t]=Math.max(0,-i)}}b(x,0,0,u,h,u,this.f,this.v,this.z),b(y,g,g,l,c,u,this.f,this.v,this.z);const E=255/this.radius,S=255*(1-this.cutoff);for(let e=0;e<d;e++){const t=Math.sqrt(x[e])-Math.sqrt(y[e]);p[e]=Math.round(S-E*t)}return f}};class E{constructor(){this.specification=t.x.light.position}possiblyEvaluate(e,i){return t.G(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t.H.number(e.x,i.x,r),y:t.H.number(e.y,i.y,r),z:t.H.number(e.z,i.z,r)}}}let S;class P extends t.E{constructor(e){super(),S||(S=new t.u({anchor:new t.D(t.x.light.anchor),position:new E,color:new t.D(t.x.light.color),intensity:new t.D(t.x.light.intensity)}
2)),this._transitionable=new t.y(S,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.z,e,i))for(const i in e){const r=e[i];i.endsWith(t.B)?this._transitionable.setTransition(i.slice(0,-t.B.length),r):this._transitionable.setValue(i,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,r){return!1!==(null==r?void 0:r.validate)&&t.C(this,e.call(t.F,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.x}))}}const I=new t.u({"sky-color":new t.D(t.x.sky["sky-color"]),"horizon-color":new t.D(t.x.sky["horizon-color"]),"fog-color":new t.D(t.x.sky["fog-color"]),"fog-ground-blend":new t.D(t.x.sky["fog-ground-blend"]),"horizon-fog-blend":new t.D(t.x.sky["horizon-fog-blend"]),"sky-horizon-blend":new t.D(t.x.sky["sky-horizon-blend"]),"atmosphere-blend":new t.D(t.x.sky["atmosphere-blend"])});class C extends t.E{constructor(e){super(),this._transitionable=new t.y(I,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.J(0))}setSky(e,i={}){if(!this._validate(t.K,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const i in e){const r=e[i];i.endsWith(t.B)?this._transitionable.setTransition(i.slice(0,-t.B.length),r):this._transitionable.setValue(i,r)}}}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,i,r={}){return!1!==(null==r?void 0:r.validate)&&t.C(this,e.call(t.F,t.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.x})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class M{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){var i;const r=e.join(",")+String(t);return(i=this.dashEntry)[r]||(i[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,i){const r=[];let n=e.length%2==1?-e[e.length-1]*i:0,o=e[0]*i,s=!0;r.push({left:n,right:o,isDash:s,zeroLength:0===e[0]});let a=e[0];for(let t=1;t<e.length;t++){s=!s;const l=e[t];n=a*i,a+=l,o=a*i,r.push({left:n,right:o,isDash:s,zeroLength:0===l})}return r}addRoundDash(e,t,i){const r=t/2;for(let t=-i;t<=i;t++){const n=this.width*(this.nextRow+i+t);let o=0,s=e[o];for(let a=0;a<this.width;a++){a/s.right>1&&(s=e[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),u=Math.min(l,c);let h;const d=t/i*(r+1);if(s.isDash){const e=r-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=r-Math.sqrt(u*u+d*d);this.data[n+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){const i=e[t],r=e[t+1];i.zeroLength?e.splice(t,1):r&&r.isDash===i.isDash&&(r.left=i.left,e.splice(t,1))}const t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);const r=this.width*this.nextRow;let n=0,o=e[n];for(let t=0;t<this.width;t++){t/o.right>1&&(o=e[++n]);const i=Math.abs(t-o.left),s=Math.abs(t-o.right),a=Math.min(i,s);this.data[r+t]=Math.max(0,Math.min(255,(o.isDash?a:-a)+128))}}addDash(e,i){const r=i?7:0,n=2*r+1;if(this.nextRow+n>this.height)return t.w("LineAtlas out of space"),null;let o=0;for(const t of e)o+=t;if(0!==o){const t=this.width/o,n=this.getDashRanges(e,this.width,t);i?this.addRoundDash(n,t,r):this.addRegularDash(n)}const s={y:this.nextRow+r,height:2*r,width:o};return this.nextRow+=n,this.dirty=!0,s}bind(e){const 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))}}const A="maplibre_preloaded_worker_pool";class L{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<L.workerCount;)this.workers.push(new Worker(t.c.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){if(delete this.active[e],0===this.numActive()){for(const e of this.workers)e.terminate();this.workers=null}}isPreloaded(){return!!this.active[A]}numActive(){return Object.keys(this.active).length}}const F=Math.floor(a.hardwareConcurrency/2);let D,k;function O(){return D||(D=new L),D}
2L.workerCount=t.L(globalThis)?Math.max(Math.min(F,3),1):1;class R{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let e=0;e<r.length;e++){const n=new t.N(r[e],i);n.name=`Worker ${e}`,this.actors.push(n)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){const i=[];for(const r of this.actors)i.push(r.sendAsync({type:e,data:t}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){for(const e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(const i of this.actors)i.registerMessageHandler(e,t)}unregisterMessageHandler(e){for(const t of this.actors)t.unregisterMessageHandler(e)}}function z(){return k||(k=new R(O(),t.M),k.registerMessageHandler("GR",((e,i,r)=>t.m(i,r)))),k}function N(e,i){const r=t.O();return t.Q(r,r,[1,1,0]),t.S(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.U(r,r,e.calculatePosMatrix(i.toUnwrapped())):r}function B(e,t,i,r,n,o,s){var a;const l=function(e,t,i){if(e)for(const r of e){const e=t[r];if((null==e?void 0:e.source)===i&&"fill-extrusion"===e.type)return!0}else for(const e in t){const r=t[e];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(null!==(a=null==n?void 0:n.layers)&&void 0!==a?a:null,t,e.id),c=o.maxPitchScaleFactor(),u=e.tilesIn(r,c,l);u.sort(V);const h=[];for(const r of u)h.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,i,e.getState(),r.queryGeometry,r.cameraQueryGeometry,r.scale,n,o,c,N(o,r.tileID),s?(e,t)=>s(r.tileID,e,t):void 0)});return function(e,t){for(const i in e)for(const r of e[i])j(r,t);return e}(function(e){const t={},i={};for(const{queryResults:r,wrappedTileID:n}of e){i[n]||(i[n]={});const e=i[n];for(const i in r){const n=r[i];e[i]||(e[i]={});const o=e[i];t[i]||(t[i]=[]);for(const e of n)o[e.featureIndex]||(o[e.featureIndex]=!0,t[i].push(e))}}return t}(h),e)}function V(e,t){const i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function j(e,t){const i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}function U(e,i,r,n){return t._(this,void 0,void 0,(function*(){let o=e;if(e.url?o=(yield t.k(yield i.transformRequest(e.url,"Source"),r)).data:yield a.frameAsync(r,n),!o)return null;const s=t.V(t.e(o,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in o&&o.vector_layers&&(s.vectorLayerIds=o.vector_layers.map((e=>e.id))),s}))}class G{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}extend(e){const i=this._sw,r=this._ne;let n,o;if(e instanceof t.W)n=e,o=e;else{if(!(e instanceof G))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(G.convert(e)):this.extend(t.W.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.W.convert(e)):this;if(n=e._sw,o=e._ne,!n||!o)return this}return i||r?(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(o.lng,r.lng),r.lat=Math.max(o.lat,r.lat)):(this._sw=new t.W(n.lng,n.lat),this._ne=new t.W(o.lng,o.lat)),this}getCenter(){return new t.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 t.W(this.getWest(),this.getNorth())}getSouthEast(){return new t.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){const{lng:i,lat:r}=t.W.convert(e);let n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}intersects(e){if(!((e=G.convert(e)).getNorth()>=this.getSouth()&&e.getSouth()<=this.getNorth()))return!1;const i=Math.abs(this.getEast()-this.getWest()),r=Math.abs(e.getEast()-e.getWest());if(i>=360||r>=360)return!0;const n=t.X(this.getWest(),-180,180),o=t.X(this.getEast(),-180,180),s=t.X(e.getWest(),-180,180),a=t.X(e.getEast(),-180,180),l=n>o,c=s>a;return!(!l||!c)||(l?a>=n||s<=o:c?o>=s||n<=a:s<=o&&a>=n)}static convert(e){return e instanceof G?e:e?new G(e):e}static fromLngLat(e,i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*e.lat);return new G(new t.W(e.lng-n,e.lat-r),new t.W(e.lng+n,e.lat+r))}adjustAntiMeridian(){const e=new t.W(this._sw.lng,this._sw.lat),i=new t.W(this._ne.lng,this._ne.lat);return new G(e,e.lng>i.lng?new t.W(i.lng+360,i.lat):i)}}class ${constructor(e,t,i){this.bounds=G.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}
vendor: 2,395 bytes, line 2
2validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),r=Math.floor(t.Z(this.bounds.getWest())*i),n=Math.floor(t.Y(this.bounds.getNorth())*i),o=Math.ceil(t.Z(this.bounds.getEast())*i),s=Math.ceil(t.Y(this.bounds.getSouth())*i);return e.x>=r&&e.x<o&&e.y>=n&&e.y<s}}class q extends t.E{constructor(e,i,r,n){if(super(),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.V(i,["url","scheme","tileSize","promoteId","encoding"])),this._options=t.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield U(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new $(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(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(!0)}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 t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:yield this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.t
2ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(e),etag:e.etag};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise(((t,i)=>{e.reloadPromise={resolve:t,reject:i}}))}else e.actor=this.dispatcher.getActor(),r="LT";e.abortController=new AbortController;try{const t=yield e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t);const n={};return(null==t?void 0:t.etagUnmodified)&&(n.unmodified=!0),n}catch(t){if(delete e.abortController,e.aborted)return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}}))}_getOverzoomParameters(e){return t._(this,void 0,void 0,(function*(){if(e.tileID.canonical.z<=this.maxzoom)return;if(void 0===this.map._zoomLevelsToOverscale)return;const t=e.tileID.scaledTo(this.maxzoom).canonical,i=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:yield this.map._requestManager.transformRequest(i,"Tile")}}))}_afterTileLoadWorkerResponse(e,t){if((null==t?void 0:t.resourceTiming)&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=null==t?void 0:t.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){const t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.t
2ype,source:this.id}}))}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Z extends t.E{constructor(e,i,r,n){super(),this.id=e,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.e({type:"raster"},i),t.e(this,t.V(i,["url","scheme","tileSize"]))}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield U(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new $(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}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 t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const r=yield h.getImage(yield this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(null==r?void 0:r.data){this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});const i=this.map.painter.context,n=i.gl,o=r.data;e.texture=this.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0}):(e.texture=new t.T(i,o,n.RGBA,{useMipmap:!0}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class W extends Z{constructor(e,i,r,n){super(e,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=yield this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const i=yield h.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(null==i?void 0:i.data){const r=i.data;this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const n=t.b(r)&&t.a0()?r:yield this.readImageNow(r),o={type:this.type,uid:e.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&"expired"!==e.state&&"reloading"!==e.state)return;e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor()),e.dem=yield e.actor.sendAsync({type:"LDT",data:o}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}))}readImageNow(e){return t._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&t.a1()){const i=e.width+2,r=e.height+2;try{return new t.R({width:i,height:r},yield t.a2(e,-1,-1,i,r))}catch(e){}}return a.getImageData(e,1)}))}_getNeighboringTiles(e){const i=e.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?e.wrap-1:e.wrap,s=(i.x+1+r)%r,a=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.a3(e.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new t.a3(e.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new t.a3(e.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new t.a3(e.overscaledZ,o,i.z,n,i.y+1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,a,i.z,s,i.y+1).key]={backfilled:!1}),l}unloadTile(e){return t._(this,void 0,void 0,(function*(){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&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.t
2ype,uid:e.uid,source:this.id}}))}))}}function H(e,t){return t?e.properties[t]:e.id}function X(e,t){const i={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const i of t.removeProperties){const t=e.addOrUpdateProperties.findIndex((e=>e.key===i));t>-1&&e.addOrUpdateProperties.splice(t,1)}return(e.removeAllProperties||t.removeAllProperties)&&(i.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(i.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(i.newGeometry=t.newGeometry||e.newGeometry),i}function Y(e){var t,i;if(!e)return{};const r={};return r.removeAll=e.removeAll,r.remove=new Set(e.remove||[]),r.add=new Map(null===(t=e.add)||void 0===t?void 0:t.map((e=>[e.id,e]))),r.update=new Map(null===(i=e.update)||void 0===i?void 0:i.map((e=>[e.id,e]))),r}function J(e){return e&&0!==e.length?"number"==typeof e[0]?[e]:e.flatMap((e=>J(e))):[]}function K(e){return"GeometryCollection"===e.type?e.geometries.flatMap((e=>K(e))):J(e.coordinates)}function Q(e){const t=new G;let i;switch(e.type){case"FeatureCollection":i=e.features.flatMap((e=>K(e.geometry)));break;case"Feature":i=K(e.geometry);break;default:i=K(e)}if(0===i.length)return t;for(const e of i){const[i,r]=e;t.extend([i,r])}return t}class ee extends t.E{constructor(e,i,r,n){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._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:i.data},this.actor=r.getActor(),this.setEventedParent(n),this._data="string"==typeof i.data?{url:i.data}:{geojson:i.data},this._options=t.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==i.buffer?i.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==i.tolerance?i.tolerance:.375),extent:t.a6,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1,promoteId:"string"==typeof i.promoteId?i.promoteId:void 0,cluster:i.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.a6,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1}},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(t.a6/this.tileSize)}_getClusterMaxZoom(e){const i=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||void 0===e||t.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${i}"`),i}load(){return t._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e,t){this._data="string"==typeof e?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};const i=this._updateWorkerData();return t?i:this}updateData(e,t){this._pendingWorkerUpdate.diff=function(e,t){if(!e)return t||{};if(!t)return e||{};const i=Y(e),r=Y(t);!function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(const i of t.remove)e.add.delete(i),e.update.delete(i);for(const[i,r]of t.update){const n=e.update.get(i);n&&(t.update.set(i,X(n,r)),e.update.delete(i))}}(i,r);const n={};if((i.removeAll||r.removeAll)&&(n.removeAll=!0),n.remove=new Set([...i.remove,...r.remove]),n.add=new Map([...i.add,...r.add]),n.update=new Map([...i.update,...r.update]),n.remove.size&&n.add.size)for(const e of n.add.keys())n.remove.delete(e);return function(e){const t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())
2),e.update&&(t.update=Array.from(e.update.values())),t}(n)}(this._pendingWorkerUpdate.diff,e);const i=this._updateWorkerData();return t?i:this}getData(){return t._(this,void 0,void 0,(function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}))}getBounds(){return t._(this,void 0,void 0,(function*(){return Q(yield this.getData())}))}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,void 0!==e.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,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,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}_updateWorkerData(){return t._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void t.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:e,diff:i,updateCluster:r}=this._pendingWorkerUpdate,n=this._getLoadGeoJSONParameters(e,i,r);void 0!==e?this._pendingWorkerUpdate.data=void 0:i?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(n)}))}_getLoadGeoJSONParameters(e,i,r){return t._(this,void 0,void 0,(function*(){const n=t.e({type:this.type},this.workerOptions);return"string"==typeof e?(n.request=yield this.map._requestManager.transformRequest(a.resolveURL(e),"Source"),n.request.collectResourceTiming=this._collectResourceTiming,n):void 0!==e?(n.data=e,n):i?(n.dataDiff=i,n):r?(n.updateCluster=!0,n):void 0}))}_dispatchWorkerUpdate(e){return t._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new t.n("dataloading",{dataType:"source"}));try{const i=yield e,r=yield this.actor.sendAsync({type:"LD",data:i});if(this._isUpdatingWorker=!1,this._removed||r.abandoned)return void this.fire(new t.n("dataabort",{dataType:"source"}));r.data&&(this._data={geojson:r.data});const n=this._applyDiffToSource(i.dataDiff),o=this._getShouldReloadTileOptions(n),s={dataType:"source"};this._applyResourceTiming(s,r),this.fire(new t.n("data",Object.assign(Object.assign({},s),{sourceDataType:"metadata"}))),this.fire(new t.n("data",Object.assign(Object.assign({},s),{sourceDataType:"content",shouldReloadTileOptions:o})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new t.n("dataabort",{dataType:"source"}));this.fire(new t.l(t.d(e)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(e,i){var r;if(!this._collectResourceTiming)return;const n=null===(r=i.resourceTiming)||void 0===r?void 0:r[this.id];if(!n)return;const o=n.slice(0);(null==o?void 0:o.length)&&t.e(e,{resourceTiming:o})}_applyDiffToSource(e){if(!e)return;const t="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const e=function(e,t){const i=new Map;if(null==e)return i;if(null==e.type)return i;if("Feature"===e.type){const r=H(e,t);if(null==r)return;return i.set(r,e),i}if("FeatureCollection"===e.type){const r=new Set;for(const n of e.features){const e=H(n,t);if(null==e)return;if(r.has(e))return;r.add(e),i.set(e,n)}return i}}(this._data.geojson,t);if(!e)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;const i=function(e,t,i){var r,n;const o=[];if(t.removeAll)e.clear();else if(t.remove)for(const i of t.remove){const t=e.get(i);t&&(o.push(t.geometry),e.delete(i))}if(t.add)for(const r of t.add){const t=H(r,i);if(null==t)continue;const n=e.get(t);n&&o.push(n.geometry),o.push(r.geometry),e.set(t,r)}if(t.update)for(const i of t.update){const t=e.get(i.id);if(!t)continue;const s=!!i.newGeometry,a=i.removeAllProperties||(null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0||(null===(n=i.addOrUpdateProperties)||void 0===n?void 0:n.length)>0;if(!s&&!a)continue;o.push(t.geometry);const l=Object.assign({},t);if(e.set(i.id,l),s&&(o.push(i.newGeometry),l.geometry=i.newGeometry),a){if(l.properties=i.removeAllProperties?{}:Object.assign({},l.properties||{}),i.removeProperties)for(const e of i.removeProperties)delete l.properties[e];if(i.addOrUpdateProperties)for(const{key:e,value:t}of i.addOrUpdateProperties)l.properties[e]=t}}return o}(this._data.updateable,e,t);return e.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map((e=>Q(e)))}}shouldReloadTile(e,{affectedBounds:i}){if("loading"===e.state)return!0;
2if("unloaded"===e.state)return!1;const{buffer:r,extent:n}=this.workerOptions.geojsonVtOptions,o=function({x:e,y:i,z:r},n=0){const o=t.a4((e-n)/Math.pow(2,r)),s=t.a5((i+1+n)/Math.pow(2,r)),a=t.a4((e+1+n)/Math.pow(2,r)),l=t.a5((i-n)/Math.pow(2,r));return new G([o,s],[a,l])}(e.tileID.canonical,r/n);for(const e of i)if(o.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.actor?"RT":"LT";e.actor=this.actor;const i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const r=yield this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,"RT"===t)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.t
2ype,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return t.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class te extends t.E{constructor(e,t,i,r){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}load(e){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.n("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const t=yield h.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,(null==t?void 0:t.data)&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally((()=>this.texture=null)),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.n("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(t.a7.fromLngLat);var r;return this.tileID=function(e){const i=t.a8.fromPoints(e),r=i.width(),n=i.height(),o=Math.max(r,n),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),a=Math.pow(2,s);return new t.aa(s,Math.floor((i.minX+i.maxX)/2*a),Math.floor((i.minY+i.maxY)/2*a))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map((e=>this.tileID.getTilePoint(e)._round())),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new t.n("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new t.T(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,(function*(){var t;(null===(t=this.tileID)||void 0===t?void 0:t.equals(e.tileID.canonical))?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){const{minX:i,minY:r,maxX:n,maxY:o}=t.a8.fromPoints(e),s={};for(let e=0;e<=t.a9;e++){const t=Math.pow(2,e),a=Math.floor(i*t),l=Math.floor(r*t),c=Math.floor(n*t),u=Math.floor(o*t),h=(a%t+t)%t,d=c%t,p=Math.floor(a/t),f=Math.floor(c/t);s[e]={minWrap:p,maxWrap:f,minTileXWrapped:h,maxTileXWrapped:d,minTileY:l,maxTileY:u}}return s}}class ie extends te{constructor(e,t,i,r){super(e,t,i,r),this._onPlayingHandler=()=>{var e;null===(e=this.map)||void 0===e||e.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=t}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push((yield this.map._requestManager.transformRequest(t,"Source")).url);try{const e=yield t.ab(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.l(t.d(e)))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.l(new t.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}
vendor: 4,365 bytes, line 2
2onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new t.T(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.n("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}}class re extends te{constructor(e,i,r,n){super(e,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new t.l(new t.ac(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.l(new t.ac(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.l(new t.ac(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.l(new t.ac(`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 t.l(new t.ac(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return t._(this,void 0,void 0,(function*(){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 t.l(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}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())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,r=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new t.T(i,this.canvas,r.RGBA,{premultiply:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let n=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,n=!0)}n&&this.fire(new t.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const ne={},oe=e=>{switch(e){case"geojson":return ee;case"image":return te;case"raster":return Z;case"raster-dem":return W;case"vector":return q;case"video":return ie;case"canvas":return re}return ne[e]},se="RTLPluginLoaded";class ae extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=z()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((e=>{throw this.status="error",e}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,(function*(e,t=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=a.resolveURL(e),!this.url)throw new Error(`requested url ${e}
2 is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}))}_requestImport(){return t._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new t.n(se))}))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let le=null;function ce(){return le||(le=new ae),le}var ue,he;!function(e){e[e.Base=0]="Base",e[e.Parent=1]="Parent"}(ue||(ue={})),function(e){e[e.Departing=0]="Departing",e[e.Incoming=1]="Incoming"}(he||(he={}));class de{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t.ad(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:i,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=i,this.fadeEndTime=r}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=c(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,r){if(!0!==(null==e?void 0:e.etagUnmodified))if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){const i={};if(!t)return i;for(const r of e){const e=r.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.id]=r}}return i}(e.buckets,null==i?void 0:i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.af){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.af&&i.hasRTLText){this.hasRTLText=!0,ce().lazyLoad();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new t.ae;else this.state="loaded"}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const i=this.buckets[t];i.uploadPending()&&i.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new t.T(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new t.T(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,n,o,s,a,l,c,u){var h;return(null===(h=this.latestFeatureIndex)||void 0===h?void 0:h.rawTileData)?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:a,params:s,queryPadding:this.queryPadding*l,getElevation:u},e,t,i):{}}querySourceFeatures(e,i){const r=this.latestFeatureIndex;if(!(null==r?void 0:r.rawTileData))return;const n=r.loadVTLayers(),o=(null==i?void 0:i.sourceLayer)?i.sourceLayer:"",s=n[t.ag]||n[o];if(!s)return;const a=t.ah(null==i?void 0:i.filter,null==i?void 0:i.globalState),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let i=0;i<s.length;i++){const n=s.feature(i);if(a.needGeometry){const e=t.ai(n,!0);
2if(!a.filter(new t.J(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!a.filter(new t.J(this.tileID.overscaledZ),n))continue;const d=r.getId(n,o),p=new t.aj(n,l,c,u,d);p.tile=h,e.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const i=t.ak(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const e=Date.now();let t=!1;if(this.expirationTime>e)t=!1;else if(i)if(this.expirationTime<i)t=!0;else{const r=this.expirationTime-i;r?this.expirationTime=e+Math.max(r,3e4):t=!0}else t=!0;t?(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,i){var r,n,o;if(!(null===(r=this.latestFeatureIndex)||void 0===r?void 0:r.rawTileData)||0===Object.keys(e).length)return;const s=this.latestFeatureIndex.loadVTLayers();for(const r in this.buckets){if(!i.style.hasLayer(r))continue;const a=this.buckets[r],l=a.layers[0].sourceLayer||t.ag,c=s[l],u=e[l];if(!c||!u||0===Object.keys(u).length)continue;a.update(u,c,(null===(n=this.imageAtlas)||void 0===n?void 0:n.patternPositions)||{},this.dashPositions||{});const h=null===(o=null==i?void 0:i.style)||void 0===o?void 0:o.getLayer(r);h&&(this.queryPadding=Math.max(this.queryPadding,h.queryRadius(a)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<c()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=c()+e}setDependencies(e,t){const i={};for(const e of t)i[e]=!0;this.dependencies[e]=i}hasDependency(e,t){for(const i of e){const e=this.dependencies[i];if(e)for(const i of t)if(e[i])return!0}return!1}}class pe{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,i,r){var n,o,s,a,l;const c=String(i);if((a=this.stateChanges)[e]||(a[e]={}),(l=this.stateChanges[e])[c]||(l[c]={}),t.e(this.stateChanges[e][c],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==c&&(this.deletedStates[e][t]=null)}else if(null===(null===(n=this.deletedStates[e])||void 0===n?void 0:n[c])){this.deletedStates[e][c]={};for(const t in this.state[e][c])r[t]||(this.deletedStates[e][c][t]=null)}else for(const t in r)null===(null===(s=null===(o=this.deletedStates[e])||void 0===o?void 0:o[c])||void 0===s?void 0:s[t])&&delete this.deletedStates[e][c][t]}removeFeatureState(e,t,i){var r,n,o;if(null===this.deletedStates[e])return;const s=String(t);if((n=this.deletedStates)[e]||(n[e]={}),i&&void 0!==t)null!==this.deletedStates[e][s]&&((o=this.deletedStates[e])[s]||(o[s]={}),this.deletedStates[e][s][i]=null);else if(void 0!==t)if(null===(r=this.stateChanges[e])||void 0===r?void 0:r[s])for(i in this.deletedStates[e][s]={},this.stateChanges[e][s])this.deletedStates[e][s][i]=null;else this.deletedStates[e][s]=null;else this.deletedStates[e]=null}getState(e,i){const r=String(i),n=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return{};for(const e in t)delete n[e]}return n}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,i){var r,n,o;const s={};for(const e in this.stateChanges){(r=this.state)[e]||(r[e]={});const i={};for(const r in this.stateChanges[e])(n=this.state[e])[r]||(n[r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),i[r]=this.state[e][r];s[e]=i}for(const e in this.deletedStates){(o=this.state)[e]||(o[e]={});const i={};if(null===this.deletedStates[e])for(const t in this.state[e])i[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t]}s[e]||(s[e]={}),t.e(s[e],i)}this.stateChanges={},this.deletedStates={},0!==Object.keys(s).length&&(this.revision++,e.setFeatureState(s,i))}}const fe=89.25;function me(e,i){const r=t.al(i.lat,-t.am,t.am);return new t.P(t.Z(i.lng)*e,t.Y(r)*e)}function ge(e,i){return new t.a7(i.x/e,i.y/e).toLngLat()}function ye(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.an(90-e.pitch)),Math.tan(t.an(fe-e.pitch)))}function _e(e,i){const r=e.canonical,n=i/t.ao(r.z),o=r.x+Math.pow(2,r.z)*e.wrap,s=t.ap(new Float64Array(16));return t.Q(s,s,[o*n,r.y*n,0]),t.S(s,s,[n/t.a6,n/t.a6,1]),s}function ve(e,i,r,n,o){const s=t.a7.fromLngLat(e,i),a=o*t.aq(1,e.lat),{x:l,y:c,z:u}=be(r,n);return new t.a7(s.x+a*-l,s.y+a*-c,s.z+a*-u)}function be(e,i){const r=t.an(e),n=t.an(i),o=Math.cos(-r),s=Math.sin(r);return{x:s*Math.sin(n),y:-s*Math.cos(n),z:o}}function xe(e,t,i){const r=t.intersectsFrustum(e);if(!i||0===r)return r;const n=t.intersectsPlane(i);return 0===n?0:2===r&&2===n?2:1}function we(e,t,i){let r=0;const n=(i-t)/10;for(let o=0;o<10;o++)r+=n*Math.pow(Math.cos(t+(o+.5)/10*(i-t)),e);return r}function Te(e,i){return function(r,n,o,s,a){const l=2*((e-1)/t.ar(Math.cos(t.an(fe-a))/M
2ath.cos(t.an(fe)))-1),c=Math.acos(o/s),u=2*we(l-1,0,t.an(a/2)),h=Math.min(t.an(fe),c+t.an(a/2)),d=we(l-1,Math.min(h,c-t.an(a/2)),h),p=Math.atan(n/o),f=Math.hypot(n,o);let m=r;return m+=t.ar(s/f/Math.max(.5,Math.cos(t.an(a/2)))),m+=l*t.ar(Math.cos(p))/2,m-=t.ar(Math.max(1,d/u/i))/2,m}}const Ee=Te(9.314,3);function Se(e,i){const r=(i.roundZoom?Math.round:Math.floor)(e.zoom+t.ar(e.tileSize/i.tileSize));return Math.max(0,r)}function Pe(e,i){const r=e.getCameraFrustum(),n=e.getClippingPlane(),o=e.screenPointToMercatorCoordinate(e.getCameraPoint()),s=t.a7.fromLngLat(e.center,e.elevation);o.z=s.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;const a=e.getCoveringTilesDetailsProvider(),l=a.allowVariableZoom(e,i),c=Se(e,i),u=i.minzoom||0,h=void 0!==i.maxzoom?i.maxzoom:e.maxZoom,d=Math.min(Math.max(0,c),h),p=Math.pow(2,d),f=[p*o.x,p*o.y,0],m=[p*s.x,p*s.y,0],g=Math.hypot(s.x-o.x,s.y-o.y),y=Math.abs(s.z-o.z),_=Math.hypot(g,y),v=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),b=[],x=[];if(e.renderWorldCopies&&a.allowWorldCopies())for(let e=1;e<=3;e++)b.push(v(-e)),b.push(v(e));for(b.push(v(0));b.length>0;){const p=b.pop(),g=p.x,v=p.y;let w=p.fullyVisible;const T={x:g,y:v,z:p.zoom},E=a.getTileBoundingVolume(T,p.wrap,e.elevation,i);if(!w){const e=xe(r,E,n);if(0===e)continue;w=2===e}const S=a.distanceToTile2d(o.x,o.y,T,E);let P=c;l&&(P=(i.calculateTileZoom||Ee)(e.zoom+t.ar(e.tileSize/i.tileSize),S,y,_,e.fov)),P=(i.roundZoom?Math.round:Math.floor)(P),P=Math.max(0,P);const I=Math.min(P,h);if(p.wrap=a.getWrap(s,T,p.wrap),p.zoom>=I){if(p.zoom<u)continue;const e=d-p.zoom,r=f[0]-.5-(g<<e),n=f[1]-.5-(v<<e),o=i.reparseOverscaled?Math.max(p.zoom,P):p.zoom;x.push({tileID:new t.a3(p.zoom===h?o:p.zoom,p.wrap,p.zoom,g,v),distanceSq:t.as([m[0]-.5-g,m[1]-.5-v]),tileDistanceToCamera:Math.sqrt(r*r+n*n)})}else for(let e=0;e<4;e++)b.push({zoom:p.zoom+1,x:(g<<1)+e%2,y:(v<<1)+(e>>1),wrap:p.wrap,fullyVisible:w})}return x.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}const Ie=t.a8.fromPoints([new t.P(0,0),new t.P(t.a6,t.a6)]);function Ce(e){return"raster"===e||"image"===e||"video"===e}function Me(e,t,i,r,n,o,s){if(!t.hasData())return!1;const{tileID:a,fadingRole:l,fadingDirection:c,fadingParentID:u}=t;if(l===ue.Base&&c===he.Incoming&&u)return i[u.key]=u,!0;const h=Math.max(a.overscaledZ-n,o);for(let n=a.overscaledZ-1;n>=h;n--){const o=a.scaledTo(n),l=e.getLoadedTile(o);if(l)return t.setCrossFadeLogic({fadingRole:ue.Base,fadingDirection:he.Incoming,fadingParentID:l.tileID,fadeEndTime:r+s}),l.setCrossFadeLogic({fadingRole:ue.Parent,fadingDirection:he.Departing,fadeEndTime:r+s}),i[o.key]=o,!0}return!1}function Ae(e,t,i,r,n,o){if(!t.hasData())return!1;const s=t.tileID.children(n);let a=Le(e,t,s,i,r,n,o);if(a)return!0;for(const l of s)Le(e,t,l.children(n),i,r,n,o)&&(a=!0);return a}function Le(e,t,i,r,n,o,s){if(i[0].overscaledZ>=o)return!1;let a=!1;for(const o of i){const i=e.getLoadedTile(o);if(!i)continue;const{fadingRole:l,fadingDirection:c,fadingParentID:u}=i;l===ue.Base&&c===he.Departing&&u||(i.setCrossFadeLogic({fadingRole:ue.Base,fadingDirection:he.Departing,fadingParentID:t.tileID,fadeEndTime:n+s}),t.setCrossFadeLogic({fadingRole:ue.Parent,fadingDirection:he.Incoming,fadeEndTime:n+s})),r[o.key]=o,a=!0}return a}function Fe(e,t,i,r){const n=e.tileID;return!!e.selfFading||!e.hasData()&&!!t.has(n)&&(e.setSelfFadeLogic(i+r),!0)}function De(e,t){var i;e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x;const n=t.tileID.canonical.y-e.tileID.canonical.y,o=Math.pow(2,e.tileID.canonical.z),s=t.tileID.key;0===r&&0===n||Math.abs(n)>1||(Math.abs(r)>1&&(1===Math.abs(r+o)?r+=o:1===Math.abs(r-o)&&(r-=o)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,n),(null===(i=e.neighboringTiles)||void 0===i?void 0:i[s])&&(e.neighboringTiles[s].backfilled=!0)))}class ke{constructor(){this._tiles={}}handleWrapJump(e){const t={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t}setFeatureState(e,t){for(const i in this._tiles)this._tiles[i].setFeatureState(e,t)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map((e=>e.tileID)).sort(t.au).map((e=>e.key)):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){const t=this.getTileById(e.key);return(null==t?void 0:t.hasData())?t:null}isIdRenderable(e,t=!1){var i;return null===(i=this.getTileById(e))||void 0===i?void 0:i.isRenderable(t)}getRenderableIds(e=0,i){const r=[];for(const e of this.getAllIds())this.isIdRenderable(e,i)&&r.push(this.getTileById(e));return i?r.sort(((i,r)=>{const n=i.tileID,o=r.tileID,s=new t.P(n.canonical.x,n.canonical.y)._rotate(-e),a=new t.P(o.canonical.x,o.canonical.y)._rotate(-e);return n.overscaledZ-o.overscaledZ||a.y-s.y||a.x-s.x})).map((e=>e.tileID.key)):r.map((e=>e.tileID)).sort(t.au).map((e=>e.key))}}class Oe extends t.E{constructor(e,i,r){super(),this.id=e,this.dispatcher=r,this.on("data",(e=>{this._dataHandler(e)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((e,t,i,r)=>{const n=new(oe(t.type))(e,t,i,r);if(n.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${n.id}`);return n})(e,i,r,this),this._inViewTiles=new ke,this._outOfViewCache=new t.av(0,(e=>this._unloadTile(e))),this._timers={}
2,this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new pe,this._didEmitContent=!1,this._updated=!1}onAdd(e){var t;this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,(null===(t=this._source)||void 0===t?void 0:t.onAdd)&&this._source.onAdd(e)}onRemove(e){var t;for(const e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),(null===(t=this._source)||void 0===t?void 0:t.onRemove)&&this._source.onRemove(e),this._inViewTiles=new ke}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,r){return t._(this,void 0,void 0,(function*(){try{const t=yield this._source.loadTile(e);this._tileLoaded(e,i,r,t)}catch(i){e.state="errored",404!==i.status?this._source.fire(new t.l(t.d(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 t.n("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._inViewTiles,this.map?this.map.painter:null);for(const t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){var t;return this._inViewTiles.getRenderableIds(null===(t=this.transform)||void 0===t?void 0:t.bearingInRadians,e)}hasRenderableParent(e){const t=e.overscaledZ-1;if(t>=this._source.minzoom){const i=this.getLoadedTile(e.scaledTo(t));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const i of this._inViewTiles.getAllIds()){const r=this._inViewTiles.getTileById(i);t&&!this._source.shouldReloadTile(r,t)||(e?this._reloadTile(i,"expired"):"errored"!==r.state&&this._reloadTile(i,"reloading"))}}}_reloadTile(e,i){return t._(this,void 0,void 0,(function*(){const t=this._inViewTiles.getTileById(e);t&&("loading"!==t.state&&(t.state=i),yield this._loadTile(t,e,i))}))}_tileLoaded(e,i,r,n){e.timeAdded=c(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),(null==n?void 0:n.unmodified)||("raster-dem"===this.getSource().type&&e.dem&&function(e,t){var i,r,n;const o=t.getRenderableIds();for(const s of o){if(!(null===(i=e.neighboringTiles)||void 0===i?void 0:i[s]))continue;const o=t.getTileById(s);e.neighboringTiles[s].backfilled||De(e,o),(null===(n=null===(r=o.neighboringTiles)||void 0===r?void 0:r[e.tileID.key])||void 0===n?void 0:n.backfilled)||De(o,e)}}(e,this._inViewTiles),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.n("data",{dataType:"source",tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(e,t){const i=this._getLoadedDescendents(t),r=new Set;for(const n of t){const t=i[n.key];if(!(null==t?void 0:t.length)){r.add(n);continue}const o=n.overscaledZ+Oe.maxOverzooming,s=t.filter((e=>e.tileID.overscaledZ<=o));if(!s.length){r.add(n);continue}const a=Math.min(...s.map((e=>e.tileID.overscaledZ))),l=s.filter((e=>e.tileID.overscaledZ===a)).map((e=>e.tileID));for(const t of l)e[t.key]=t;
2this._areDescendentsComplete(l,a,n.overscaledZ)||r.add(n)}return r}_getLoadedDescendents(e){var t;const i={};for(const r of this._inViewTiles.getAllTiles().filter((e=>e.hasData())))for(const n of e)r.tileID.isChildOf(n)&&(i[t=n.key]||(i[t]=[]),i[n.key].push(r));return i}_areDescendentsComplete(e,t,i){return 1===e.length&&e[0].isOverscaled()?e[0].overscaledZ===t:Math.pow(4,t-i)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,n=Math.floor(i*r*(null===this._maxTileCacheZoomLevels?t.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._outOfViewCache.setMaxSize(o)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);this._prevLng=e,t&&(this._inViewTiles.handleWrapJump(t),this._resetTileReloadTimers())}update(e,i){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.a3(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=Pe(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?e.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[],this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));const n=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new t.n("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const o=Se(e,this._source),s=this._updateRetainedTiles(r,o),a=Ce(this._source.type);a&&this._rasterFadeDuration>0&&!i&&function(e,i,r,n,o,s,a){const l=c(),u=t.at(i);for(const t of i){const i=e.getTileById(t.key);i.fadingDirection!==he.Departing&&0!==i.fadeOpacity||i.resetFadeLogic(),Me(e,i,r,l,n,o,a)||Ae(e,i,r,l,s,a)||Fe(i,u,l,a)||i.resetFadeLogic()}}(this._inViewTiles,r,s,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),a?this._cleanUpRasterTiles(s):this._cleanUpVectorTiles(s)}_cleanUpRasterTiles(e){for(const t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(const t of this._inViewTiles.getAllIds()){const i=this._inViewTiles.getTileById(t);e[t]?i.clearSymbolFadeHold():i.hasSymbolBuckets?i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(t):i.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){const t=[];for(const i of e)if(i.canonical.z>this._source.minzoom){const e=i.scaledTo(i.canonical.z-1);t.push(e);const r=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));t.push(r)}return e.concat(t)}releaseSymbolFadeTiles(){for(const e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var i;const r=new Set;for(const t of e)this._addTile(t).hasData()||r.add(t);const n=e.reduce(((e,t)=>(e[t.key]=t,e)),{}),o=this._retainLoadedChildren(n,r),s={},a=Math.max(t-Oe.maxUnderzooming,this._source.minzoom);for(const e of o){let t=this._inViewTiles.getTileById(e.key),r=null==t?void 0:t.wasRequested();for(let o=e.overscaledZ-1;o>=a;--o){const a=e.scaledTo(o);if(s[a.key])break;if(s[a.key]=!0,t=this.getTile(a),!t&&r&&(t=this._addTile(a)),t){const e=t.hasData();if((e||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||r)&&(n[a.key]=a),r=t.wasRequested(),e)break}}}return n}_addTile(e){let i=this._inViewTiles.getTileById(e.key);if(i)return i;i=this._outOfViewCache.getAndRemove(e),i&&(i.resetFadeLogic(),this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null));const r=i;
2return i||(i=new de(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._inViewTiles.setTile(e.key,i),r||this._source.fire(new t.n("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),i))}_clearTileReloadTimer(e){const t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e of this._inViewTiles.getAllIds()){const t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(const t of this._inViewTiles.getAllIds()){const i=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||"errored"==i.state)&&e.some((e=>e.equals(i.tileID.canonical)))&&this._reloadTile(t,"expired")}}_removeTile(e){const t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){"source"===e.dataType&&("metadata"!==e.sourceDataType?"content"===e.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,i,r){const n=[],o=this.transform;if(!o)return n;const s=o.getCoveringTilesDetailsProvider().allowWorldCopies(),a=r?o.getCameraQueryGeometry(e):e,l=e=>o.screenPointToMercatorCoordinate(e,this.terrain),c=this.transformBbox(e,l,!s),u=this.transformBbox(a,l,!s),h=this.getIds(),d=t.a8.fromPoints(u);for(const e of h){const r=this._inViewTiles.getTileById(e);if(r.holdingForSymbolFade())continue;const a=s?[r.tileID]:[r.tileID.unwrapTo(-1),r.tileID.unwrapTo(0)],l=Math.pow(2,o.zoom-r.tileID.overscaledZ),h=i*r.queryPadding*t.a6/r.t
2ileSize/l;for(const e of a){const i=d.map((i=>e.getTilePoint(new t.a7(i.x,i.y))));if(i.expandBy(h),i.intersects(Ie)){const t=c.map((t=>e.getTilePoint(t))),i=u.map((t=>e.getTilePoint(t)));n.push({tile:r,tileID:s?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:i,scale:l})}}}return n}transformBbox(e,i,r){let n=e.map(i);if(r){const r=t.a8.fromPoints(e);r.shrinkBy(.001*Math.min(r.width(),r.height()));const o=r.map(i);t.a8.fromPoints(n).covers(o)||(n=n.map((e=>e.x>.5?new t.a7(e.x-1,e.y,e.z):e)))}return n}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map((e=>this._inViewTiles.getTileById(e).tileID));return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||Ce(this._source.type)&&function(e,t){if(t<=0)return!1;const i=c();for(const t of e.getAllTiles())if(t.fadeEndTime>=i)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,i,r){e||(e=t.ag),this._state.updateState(e,i,r)}removeFeatureState(e,i,r){e||(e=t.ag),this._state.removeFeatureState(e,i,r)}getFeatureState(e,i){return e||(e=t.ag),this._state.getState(e,i)}setDependencies(e,t,i){const r=this._inViewTiles.getTileById(e);r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(e,t)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter((i=>!i.hasDependency(e,t)))}areTilesLoaded(){for(const e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}}Oe.maxUnderzooming=10,Oe.maxOverzooming=3;class Re{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.al(e,0,1);let i=1,r=this._distances[i];const n=e*this.paddedLength+this.padding;for(;r<n&&i<this._distances.length;)r=this._distances[++i];const o=i-1,s=this._distances[o],a=r-s,l=a>0?(n-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function ze(e,t){let i=!0;return"always"===e||"never"!==e&&"never"!==t||(i=!1),i}class Ne{constructor(e,t,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),n.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,i,r,n){this._forEachCell(t,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t,i,r,n,o){this.boxCells[n].push(o)}_insertCircleCell(e,t,i,r,n,o){this.circleCells[n].push(o)}_query(e,t,i,r,n,o,s){if(i<0||e>this.width||r<0||t>this.height)return[];const a=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:e,y1:t,x2:i,y2:r}];for(let e=0;e<this.boxKeys.length;e++)a.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){const t=this.circles[3*e],i=this.circles[3*e+1],r=this.circles[3*e+2];a.push({key:this.circleKeys[e],x1:t-r,y1:i-r,x2:t+r,y2:i+r})}}else this._forEachCell(e,t,i,r,this._queryCell,a,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},s);return a}query(e,t,i,r){return this._query(e,t,i,r,!1,null)}hitTest(e,t,i,r,n,o){return this._query(e,t,i,r,!0,n,o).length>0}hitTestCircle(e,t,i,r,n){const o=e-i,s=e+i,a=t-i,l=t+i;if(s<0||o>this.width||l<0||a>this.height)return!1;const c=[];
2return this._forEachCell(o,a,s,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(e,t,i,r,n,o,s,a){const{seenUids:l,hitTest:c,overlapMode:u}=s,h=this.boxCells[n],d=1e-6;if(null!==h){const n=this.bboxes;for(const s of h)if(!l.box[s]){l.box[s]=!0;const h=4*s,p=this.boxKeys[s];if(e<=n[h+2]+d&&t<=n[h+3]+d&&i>=n[h+0]-d&&r>=n[h+1]-d&&(!a||a(p))&&(!c||!ze(u,p.overlapMode))&&(o.push({key:p,x1:n[h],y1:n[h+1],x2:n[h+2],y2:n[h+3]}),c))return!0}}const p=this.circleCells[n];if(null!==p){const n=this.circles;for(const s of p)if(!l.circle[s]){l.circle[s]=!0;const h=3*s,d=this.circleKeys[s];if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],e,t,i,r)&&(!a||a(d))&&(!c||!ze(u,d.overlapMode))){const e=n[h],t=n[h+1],i=n[h+2];if(o.push({key:d,x1:e-i,y1:t-i,x2:e+i,y2:t+i}),c)return!0}}}return!1}_queryCellCircle(e,t,i,r,n,o,s,a){const{circle:l,seenUids:c,overlapMode:u}=s,h=this.boxCells[n];if(null!==h){const e=this.bboxes;for(const t of h)if(!c.box[t]){c.box[t]=!0;const i=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(r))&&!ze(u,r.overlapMode))return o.push(!0),!0}}const d=this.circleCells[n];if(null!==d){const e=this.circles;for(const t of d)if(!c.circle[t]){c.circle[t]=!0;const i=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(r))&&!ze(u,r.overlapMode))return o.push(!0),!0}}}_forEachCell(e,t,i,r,n,o,s,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(n.call(this,e,t,i,r,this.xCellCount*l+d,o,s,a))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,i,r,n,o){const s=r-e,a=n-t,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(e,t,i,r,n,o,s){const a=(o-r)/2,l=Math.abs(e-(r+a));if(l>a+i)return!1;const c=(s-n)/2,u=Math.abs(t-(n+c));if(u>c+i)return!1;if(l<=a||u<=c)return!0;const h=l-a,d=u-c;return h*h+d*d<=i*i}}function Be(e,t){const i=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),r=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),n=t[0]*i,o=t[4]*i,s=t[8]*r,a=t[1]*i,l=t[5]*i,c=t[9]*r,u=t[2]*i,h=t[6]*i,d=t[10]*r;e[0]=n,e[1]=o,e[2]=s,e[4]=a,e[5]=l,e[6]=c,e[8]=u,e[9]=h,e[10]=d;const p=t[12],f=t[13],m=t[14];return e[12]=-n*p-a*f-u*m,e[13]=-o*p-l*f-h*m,e[14]=-s*p-c*f-d*m,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}const Ve=t.O();function je(e,i,n){const o=t.O();if(!e){const{vecSouth:e,vecEast:t}=Ge(i),n=r();n[0]=t[0],n[1]=t[1],n[2]=e[0],n[3]=e[1],s=n,(d=(l=(a=n)[0])*(h=a[3])-(u=a[2])*(c=a[1]))&&(s[0]=h*(d=1/d),s[1]=-c*d,s[2]=-u*d,s[3]=l*d),o[0]=n[0],o[1]=n[1],o[4]=n[2],o[5]=n[3]}var s,a,l,c,u,h,d;return t.S(o,o,[1/n,1/n,1]),o}function Ue(e,i,r,n){if(e){const e=t.O();if(!i){const{vecSouth:t,vecEast:i}=Ge(r);e[0]=i[0],e[1]=i[1],e[4]=t[0],e[5]=t[1]}return t.S(e,e,[n,n,1]),e}return r.pixelsToClipSpaceMatrix}function Ge(e){const i=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),n=Math.cos(e.pitchInRadians),o=Math.cos(e.bearingInRadians),s=Math.sin(e.bearingInRadians),a=t.az();a[0]=-o*n*r-s*i,a[1]=-s*n*r+o*i;const l=t.aA(a);l<1e-9?t.aB(a):t.aC(a,a,1/l);const c=t.az();c[0]=o*n*i-s*r,c[1]=s*n*i+o*r;const u=t.aA(c);return u<1e-9?t.aB(c):t.aC(c,c,1/u),{vecEast:c,vecSouth:a}}function $e(e,i,r,n){let o;n?(o=[e,i,n(e,i),1],t.aE(o,o,r)):(o=[e,i,0,1],at(o,o,r));const s=o[3];return{point:new t.P(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}function qe(e,t){return.5+e/t*.5}function Ze(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function We(e,i,r,n,o,s,a,l,c,u,h,d,p){const f=r?e.textSizeData:e.iconSizeData,m=t.aw(f,i.transform.zoom),g=[256/i.width*2+1,256/i.height*2+1],y=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;y.clear();const _=e.lineVertexArray,v=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=i.transform.width/i.transform.height;let x=!1;for(let r=0;r<v.length;r++){const w=v.get(r);if(w.hidden||w.writingMode===t.ax.vertical&&!x){st(w.numGlyphs,y);continue}x=!1;
vendor: 4,682 bytes, line 2
2const T=new t.P(w.anchorX,w.anchorY),E={getElevation:p,pitchedLabelPlaneMatrix:n,lineVertexArray:_,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:T,unwrappedTileID:c,width:u,height:h,translation:d},S=tt(w.anchorX,w.anchorY,E);if(!Ze(S.point,g)){st(w.numGlyphs,y);continue}const P=qe(i.transform.cameraToCenterDistance,S.signedDistanceFromCamera),I=t.ay(f,m,w),C=s?I*i.transform.getPitchedTextCorrection(w.anchorX,w.anchorY,c)/P:I*P,M=Ye({projectionContext:E,pitchedLabelPlaneMatrixInverse:o,symbol:w,fontSize:C,flip:!1,keepUpright:a,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:l});x=M.useVertical,(M.notEnoughRoom||x||M.needsFlipping&&Ye({projectionContext:E,pitchedLabelPlaneMatrixInverse:o,symbol:w,fontSize:C,flip:!0,keepUpright:a,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:l}).notEnoughRoom)&&st(w.numGlyphs,y)}r?e.text.dynamicLayoutVertexBuffer.updateData(y):e.icon.dynamicLayoutVertexBuffer.updateData(y)}function He(e,t,i,r,n,o,s,a){const l=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,u=o.lineStartIndex+o.lineLength,h=t.getoffsetX(o.glyphStartIndex),d=t.getoffsetX(l-1),p=nt(e*h,i,r,n,o.segment,c,u,a,s);if(!p)return null;const f=nt(e*d,i,r,n,o.segment,c,u,a,s);return f?a.projectionCache.anyProjectionOccluded?null:{first:p,last:f}:null}function Xe(e,i,r,n){return e===t.ax.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*n?{useVertical:!0}:(e===t.ax.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function Ye(e){const{projectionContext:i,pitchedLabelPlaneMatrixInverse:r,symbol:n,fontSize:o,flip:s,keepUpright:a,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=e,d=o/24,p=n.lineOffsetX*d,f=n.lineOffsetY*d;let m;if(n.numGlyphs>1){const e=n.glyphStartIndex+n.numGlyphs,t=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,c=He(d,l,p,f,s,n,h,i);if(!c)return{notEnoughRoom:!0};const g=et(c.first.point.x,c.first.point.y,i,r),y=et(c.last.point.x,c.last.point.y,i,r);if(a&&!s){const e=Xe(n.writingMode,g,y,u);if(e)return e}m=[c.first];for(let r=n.glyphStartIndex+1;r<e-1;r++){const e=nt(d*l.getoffsetX(r),p,f,s,n.segment,t,o,i,h);if(!e)return{notEnoughRoom:!0};m.push(e)}m.push(c.last)}else{if(a&&!s){const e=Qe(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,o=n.lineStartIndex+n.segment+1,s=new t.P(i.lineVertexArray.getx(o),i.lineVertexArray.gety(o)),a=Qe(s.x,s.y,i),l=a.signedDistanceFromCamera>0?a.point:Je(i.tileAnchorPoint,s,e,1,i),c=et(e.x,e.y,i,r),h=et(l.x,l.y,i,r),d=Xe(n.writingMode,c,h,u);if(d)return d}const e=nt(d*l.getoffsetX(n.glyphStartIndex),p,f,s,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,i,h);if(!e||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[e]}for(const e of m)t.aD(c,e.point,e.angle);return{}}function Je(e,t,i,r,n){const o=e.add(e.sub(t)._unit()),s=Qe(o.x,o.y,n).point,a=i.sub(s);return i.add(a._mult(r/a.mag()))}function Ke(e,i,r){const n=i.projectionCache;if(n.projections[e])return n.projections[e];const o=new t.P(i.lineVertexArray.getx(e),i.lineVertexArray.gety(e)),s=Qe(o.x,o.y,i);if(s.signedDistanceFromCamera>0)return n.projections[e]=s.point,n.anyProjectionOccluded||(n.anyProjectionOccluded=s.isOccluded),s.point;const a=e-r.direction;return Je(0===r.distanceFromAnchor?i.tileAnchorPoint:new t.P(i.lineVertexArray.getx(a),i.lineVertexArray.gety(a)),o,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,i)}function Qe(e,t,i){const r=e+i.translation[0],n=t+i.translation[1];let o;return i.pitchWithMap?(o=$e(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),o.isOccluded=!1):(o=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),o.point.x=(.5*o.point.x+.5)*i.width,o.point.y=(.5*-o.point.y+.5)*i.height),o}function et(e,i,r,n){if(r.pitchWithMap){const o=[e,i,0,1];return t.aE(o,o,n),r.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],r.unwrappedTileID,r.getElevation).point}return{x:e/r.width*2-1,y:1-i/r.height*2}}function tt(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function it(e,t,i){return e._unit()._perp()._mult(t*i)}function rt(e,i,r,n,o,s,a,l,c){if(l.projectionCache.offsets[e])return l.projectionCache.offsets[e];const u=r.add(i);if(e+c.direction<n||e+c.direction>=o)return l.projectionCache.offsets[e]=u,u;const h=Ke(e+c.direction,l,c),d=it(h.sub(r),a,c.direction),p=r.add(d),f=h.add(d);return l.projectionCache.offsets[e]=t.aF(s,u,p,f)||u,l.projectionCache.offsets[e]}function nt(e,t,i,r,n,o,s,a,l){const c=r?e-t:e+t;let u=c>0?1:-1,h=0;r&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let d,p=u>0?o+n:o+n+1;
vendor: 10,023 bytes, line 2
2a.projectionCache.cachedAnchorPoint?d=a.projectionCache.cachedAnchorPoint:(d=Qe(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,a.projectionCache.cachedAnchorPoint=d);let f,m,g=d,y=d,_=0,v=0;const b=Math.abs(c),x=[];let w;for(;_+v<=b;){if(p+=u,p<o||p>=s)return null;_+=v,y=g,m=f;const e={absOffsetX:b,direction:u,distanceFromAnchor:_,previousVertex:y};if(g=Ke(p,a,e),0===i)x.push(y),w=g.sub(y);else{let t;const r=g.sub(y);t=0===r.mag()?it(Ke(p+u,a,e).sub(g),i,u):it(r,i,u),m||(m=y.add(t)),f=rt(p,t,g,o,s,m,i,a,e),x.push(m),w=f.sub(m)}v=w.mag()}const T=w._mult((b-_)/v)._add(m||y),E=h+Math.atan2(g.y-y.y,g.x-y.x);return x.push(T),{point:T,angle:l?E:0,path:x}}const ot=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function st(e,t){for(let i=0;i<e;i++){const e=t.length;t.resize(e+4),t.float32.set(ot,3*e)}}function at(e,t,i){const r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}const lt=100;class ct{constructor(e,t=new Ne(e.width+200,e.height+200,25),i=new Ne(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+lt,this.screenBottomBoundary=e.height+lt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,r,n,o,s,a,l,c,u,h){const d=this.projectAndGetPerspectiveRatio(e.anchorPointX+a[0],e.anchorPointY+a[1],n,c,h),p=i*d.perspectiveRatio;let f;if(o||s)f=this._projectCollisionBox(e,p,r,n,o,s,a,d,c,u,h);else{const t=d.x+(u?u.x*p:0),i=d.y+(u?u.y*p:0);f={allPointsOccluded:!1,box:[t+e.x1*p,i+e.y1*p,t+e.x2*p,i+e.y2*p]}}const[m,g,y,_]=f.box,v=o?f.allPointsOccluded:d.isOccluded;let b=v;return b||(b=d.perspectiveRatio<this.perspectiveRatioCutoff),b||(b=!this.isInsideGrid(m,g,y,_)),b||"always"!==t&&this.grid.hitTest(m,g,y,_,t,l)?{box:[m,g,y,_],placeable:!1,offscreen:!1,occluded:v}:{box:[m,g,y,_],placeable:!0,offscreen:this.isOffscreen(m,g,y,_),occluded:v}}placeCollisionCircles(e,i,r,n,o,s,a,l,c,u,h,d,p,f){const m=[],g=new t.P(i.anchorX,i.anchorY),y=this.getPerspectiveRatio(g.x,g.y,s,f),_=(c?o*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,s)/y:o*y)/t.aJ,v={getElevation:f,pitchedLabelPlaneMatrix:a,lineVertexArray:r,pitchWithMap:c,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:p},b=He(_,n,i.lineOffsetX*_,i.lineOffsetY*_,!1,i,!1,v);let x=!1,w=!1,T=!0;if(b){const i=.5*h*y+d,r=new t.P(-100,-100),n=new t.P(this.screenRightBoundary,this.screenBottomBoundary),o=new Re,s=b.first,a=b.last;let p=[];for(let e=s.path.length-1;e>=1;e--)p.push(s.path[e]);for(let e=1;e<a.path.length;e++)p.push(a.path[e]);const f=2.5*i;if(c){const e=this.projectPathToScreenSpace(p,v);p=e.some((e=>e.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let g=[];if(p.length>0){const e=p[0].clone(),i=p[0].clone();for(let t=1;t<p.length;t++)e.x=Math.min(e.x,p[t].x),e.y=Math.min(e.y,p[t].y),i.x=Math.max(i.x,p[t].x),i.y=Math.max(i.y,p[t].y);g=e.x>=r.x&&i.x<=n.x&&e.y>=r.y&&i.y<=n.y?[p]:i.x<r.x||e.x>n.x||i.y<r.y||e.y>n.y?[]:t.aG([p],r.x,r.y,n.x,n.y)}for(const t of g){o.reset(t,.25*i);let r=0;r=o.length<=.5*i?1:Math.ceil(o.paddedLength/f)+1;for(let t=0;t<r;t++){const n=t/Math.max(r-1,1),s=o.lerp(n),a=s.x+lt,c=s.y+lt;m.push(a,c,i,0);const h=a-i,d=c-i,p=a+i,f=c+i;if(T&&(T=this.isOffscreen(h,d,p,f)),w||(w=this.isInsideGrid(h,d,p,f)),"always"!==e&&this.grid.hitTestCircle(a,c,i,e,u)&&(x=!0,!l))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!l&&x||!w||y<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:x}}projectPathToScreenSpace(e,t){const i=function(e,t){const i=Ve;return function(e,t){const i=1/(t[0]*t[5]-t[1]*t[4]);e[0]=t[5]*i,e[1]=-t[1]*i,e[2]=0,e[3]=0,e[4]=-t[4]*i,e[5]=t[0]*i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15]}(i,t.pitchedLabelPlaneMatrix),e.map((e=>{const r=$e(e.x,e.y,i,t.getElevation),n=t.transform.projectTileCoordinates(r.point.x,r.point.y,t.unwrappedTileID,t.getElevation);return n.point.x=(.5*n.point.x+.5)*t.width,n.point.y=(.5*-n.point.y+.5)*t.height,n}))}(e,t);return function(e){let t=0,i=0,r=0,n=0;for(let o=0;o<e.length;o++)e[o].isOccluded?(r=o+1,n=0):(n++,n>i&&(i=n,t=r));return e.slice(t,t+i)}(i)}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[],r=new t.a8;for(const n of e){const e=new t.P(n.x+lt,n.y+lt);r.extend(e),i.push(e)}const{minX:n,minY:o,maxX:s,maxY:a}=r,l=this.grid.query(n,o,s,a).concat(this.ignoredGrid.query(n,o,s,a)),c={},u={};for(const e of l){const r=e.key;if(void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]={}),c[r.bucketInstanceId][r.featureIndex])continue;const n=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.aH(i,n)&&(c[r.bucketInstanceId][r.featureIndex]=!0,void 0===u[r.bucketInstanceId]&&(u[r.bucketInstanceId]=[]),u[r.bucketInstanceId].push(r.featureIndex))}return u}insertCollisionBox(e,t,i,r,n,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n,o){const s=i?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:t};for(let t=0;t<e.length;t+=4)s.insertCircle(a,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,i,r,n,o){if(o){let r;n?(r=[e,i,n(e,i),1],t.aE(r,r,o)):(r=[e,i,0,1],at(r,r,o));const s=r[3];return{x:(r[0]/s+1)/2*this.transform.width+lt,y:(-r[1]/s+1)/2*this.transform.height+lt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/s*.5,isOccluded:!1,signedDistanceFromCamera:s}}{const t=this.transform.projectTileCoordinates(e,i,r,n);return{x:(t.point.x+1)/2*this.transform.width+lt,y:(1-t.point.y)/2*this.transform.height+lt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/t.signedDistanceFromCamera*.5,isOccluded:t.isOccluded,signedDistanceFromCamera:t.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,r){const n=this.transform.projectTileCoordinates(e,t,i,r);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(e,t,i,r){return i<lt||e>=this.screenRightBoundary||r<lt||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const e=t.ap([]);return t.Q(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,r,n,o,s,a,l,c,u,h){let d=1,p=0,f=0,m=1;const g=e.anchorPointX+a[0],y=e.anchorPointY+a[1];if(s&&!o){const e=this.projectAndGetPerspectiveRatio(g+1,y,n,c,h),t=e.x-l.x,i=Math.atan((e.y-l.y)/t)+(t<0?Math.PI:0),r=Math.sin(i),o=Math.cos(i);d=o,p=r,f=-r,m=o}else if(!s&&o){const e=Ge(this.transform);d=e.vecEast[0],p=e.vecEast[1],f=e.vecSouth[0],m=e.vecSouth[1]}let _=l.x,v=l.y,b=i;o&&(_=g,v=y,b=Math.pow(2,-(this.transform.zoom-r.overscaledZ)),b*=this.transform.getPitchedTextCorrection(g,y,n),u||(b*=t.al(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(_+=d*u.x*b+f*u.y*b,v+=p*u.x*b+m*u.y*b);const x=e.x1*b,w=e.x2*b,T=(x+w)/2,E=e.y1*b,S=e.y2*b,P=(E+S)/2,I=[{offsetX:x,offsetY:E},{offsetX:T,offsetY:E},{offsetX:w,offsetY:E},{offsetX:w,offsetY:P},{offsetX:w,offsetY:S},{offsetX:T,offsetY:S},{offsetX:x,offsetY:S},{offsetX:x,offsetY:P}];let C=[];for(const{offsetX:e,offsetY:i}of I)C.push(new t.P(_+d*e+f*i,v+p*e+m*i));let M=!1;if(o){const e=C.map((e=>this.projectAndGetPerspectiveRatio(e.x,e.y,n,c,h)));M=e.some((e=>!e.isOccluded)),C=e.map((e=>new t.P(e.x,e.y)))}else M=!0;return{box:t.aI(C),allPointsOccluded:!M}}}class ut{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class ht{constructor(e,t,i,r,n){this.text=new ut(e?e.text:null,t,i,n),this.icon=new ut(e?e.icon:null,t,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class dt{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}}class pt{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class ft{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function mt(e,i,r,n,o){const{horizontalAlign:s,verticalAlign:a}=t.aP(e);return new t.P(-(s-.5)*i+n[0]*o,-(a-.5)*r+n[1]*o)}class gt{constructor(e,t,i,r,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new ct(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new ft(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const t=this.terrain;return t?(i,r)=>t.getElevation(e,i,r):null}getBucketParts(e,i,r,n){const o=r.getBucket(i),s=r.latestFeatureIndex;if(!o||!s||i.id!==o.layerIds[0])return;const a=r.collisionBoxArray,l=o.layers[0].layout,c=o.layers[0].paint,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),h=r.tileSize/t.a6,d=r.tileID.toUnwrapped(),p="map"===l.get("text-rotation-alignment"),f=t.aK(r,1,this.transform.zoom),m=t.aL(this.collisionIndex.transform,r,c.get("text-translate"),c.get("text-translate-anchor")),g=t.aL(this.collisionIndex.transform,r,c.get("icon-translate"),c.get("icon-translate-anchor")),y=je(p,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new pt(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,r.tileID);const _={bucket:o,layout:l,translationText:m,translationIcon:g,unwrappedTileID:d,pitchedLabelPlaneMatr
2ix:y,scale:u,textPixelRatio:h,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:t.aw(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=t;e.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,i,r,n,o,s,a,l,c,u,h,d,p,f,m,g,y,_,v,b){var x,w,T;const E=t.aM[e.textAnchor],S=[e.textOffset0,e.textOffset1],P=mt(E,r,n,S,o),I=this.collisionIndex.placeCollisionBox(i,d,l,c,u,a,s,g,h.predicate,v,P,b);if((!_||this.collisionIndex.placeCollisionBox(_,d,l,c,u,a,s,y,h.predicate,v,P,b).placeable)&&I.placeable){let e;if((null===(x=this.prevPlacement)||void 0===x?void 0:x.variableOffsets[p.crossTileID])&&(null===(T=null===(w=this.prevPlacement)||void 0===w?void 0:w.placements[p.crossTileID])||void 0===T?void 0:T.text)&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:S,width:r,height:n,anchor:E,textBoxScale:o,prevAnchor:e},this.markUsedJustification(f,E,p,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,p),this.placedOrientations[p.crossTileID]=m),{shift:P,placedGlyphBoxes:I}}}placeLayerBucketPart(e,i,r){const{bucket:n,layout:o,translationText:s,translationIcon:a,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:u,holdingForFade:h,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:f}=e.parameters,m=o.get("text-optional"),g=o.get("icon-optional"),y=t.aN(o,"text-overlap","text-allow-overlap"),_="always"===y,v=t.aN(o,"icon-overlap","icon-allow-overlap"),b="always"===v,x="map"===o.get("text-rotation-alignment"),w="map"===o.get("text-pitch-alignment"),T="none"!==o.get("icon-text-fit"),E="viewport-y"===o.get("symbol-z-order"),S=_&&(b||!n.hasIconData()||g),P=b&&(_||!n.hasTextData()||m);!n.collisionArrays&&d&&n.deserializeCollisionBoxes(d);const I=this.retainedQueryData[n.bucketInstanceId].tileID,C=this._getTerrainElevationFunc(I),M=this.transform.getFastPathSimpleProjectionMatrix(I),A=(e,d,b)=>{var E,A;if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new dt(!1,!1,!1));let L=!1,F=!1,D=!0,k=null,O={box:null,placeable:!1,offscreen:null,occluded:!1},R={placeable:!1},z=null,N=null,B=null,V=0,j=0,U=0;d.textFeatureIndex?V=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(V=e.featureIndex),d.verticalTextFeatureIndex&&(j=d.verticalTextFeatureIndex);const G=d.textBox;if(G){const i=i=>{let r=t.ax.horizontal;if(n.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(n,r,e))}return r},o=(i,r)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const e of n.writingModes)if(e===t.ax.vertical?(O=r(),R=O):O=i(),null==O?void 0:O.placeable)break}else O=i()},c=e.textAnchorOffsetStartIndex,h=e.textAnchorOffsetEndIndex;if(h===c){const r=(t,i)=>{const r=this.collisionIndex.placeCollisionBox(t,y,u,I,l,w,x,s,f.predicate,C,void 0,M);return(null==r?void 0:r.placeable)&&(this.markUsedOrientation(n,i,e),this.placedOrientations[e.crossTileID]=i),r};o((()=>r(G,t.ax.horizontal)),(()=>{const i=d.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?r(i,t.ax.vertical):{box:null,offscreen:null}})),i(null==O?void 0:O.placeable)}else{let p=t.aM[null===(A=null===(E=this.prevPlacement)||void 0===E?void 0:E.variableOffsets[e.crossTileID])||void 0===A?void 0:A.anchor];const m=(t,i,o)=>{const d=t.x2-t.x1,m=t.y2-t.y1,g=e.textBoxScale,_=T&&"never"===v?i:null;let b=null,E="never"===y?1:2,S="never";p&&E++;for(let i=0;i<E;i++){for(let i=c;i<h;i++){const r=n.textAnchorOffsets.get(i);if(p&&r.textAnchor!==p)continue;const c=this.attemptAnchorPlacement(r,t,d,m,g,x,w,u,I,l,f,S,e,n,o,s,a,_,C);if(c&&(b=c.placedGlyphBoxes,null==b?void 0:b.placeable))return L=!0,k=c.shift,b}p?p=null:S=y}return r&&!b&&(b={box:this.collisionIndex.placeCollisionBox(G,"always",u,I,l,w,x,s,f.predicate,C,void 0,M).box,offscreen:!1,placeable:!1,occluded:!1}),b};o((()=>m(G,d.iconBox,t.ax.horizontal)),(()=>{const i=d.verticalTextBox;return n.allowVerticalPlacement&&!(null==O?void 0:O.placeable)&&e.numVerticalGlyphVertices>0&&i?m(i,d.verticalIconBox,t.ax.vertical):{box:null,occluded:!0,offscreen:null}})),O&&(L=O.placeable,D=O.offscreen);const g=i(null==O?void 0:O.placeable);if(!L&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,g))}}}if(z=O,L=null==z?void 0:z.placeable,D=null==z?void 0:z.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){const i=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),a=t.ay(n.textSizeData,p,i),u=o.get("text-padding");N=this.collisionIndex.placeCollisionCircles(y,i,n.lineVertexArray,n.glyphOffsetArray,a,l,c,r,w,f.predicate,e.collisionCircleDiameter,u,s,C),N.circles.length&&N.collisionDetected&&!r&&t.w("Collisions detected, but collision boxes are not shown"),L=_||N.circles.length>0&&!N.collisionDetected,D&&(D=N.offscreen)}if(d.iconFeatureIndex&&(U=d.iconFeatureIndex),d.iconBox){const e=e=>this.collisionIndex.placeCollisionBox(e,v,u,I,l,w,x,a,f.predicate,C,T&&k?k:void 0,M);R&&R.placeable&&d.verticalIconBox?(B=e(d.verticalIconBox),F=B.placeable):(B=e(d.iconBox),F=B.placeable),D&&(D=B.offscreen)}const $=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,q=g||0===e.numIconVertices;$||q?q?$||F&&(F=L):L=F&&L:F=L=F&&L;const Z=F&&B.placeable;if(L&&z.placeable&&this.collisionIndex.insertCollisionBox(z.box,y,o.get("text-ignore-placement"),n.bucketInstanceId,R&&R.placeable&&j?j:V,f.ID),Z&&this.collisionIndex.insertCollisionBox(B.box,v,o.get("icon-ignore-placement"),n.bucketInstanceId,U,f.ID),N&&L&&this.collisionIndex.insertCollisionCircles(N.circles,y,o.get("text-ignore-placement"),n.bucketInstanceId,V,f.ID),r&&this.storeCollisionData(n.bucketInstanceId,b,d,z,B,N),0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new dt((L||S)&&!(null==z?void 0:z.occluded),(F||P)&&!(null==B?void 0:B.occluded),D||n.justReloaded),i[e.crossTileID]=!0};if(E){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");
vendor: 4,951 bytes, line 2
2const t=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){const i=t[e];A(n.symbolInstances.get(i),n.collisionArrays[i],i)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(n.symbolInstances.get(t),n.collisionArrays[t],t);n.justReloaded=!1}storeCollisionData(e,t,i,r,n,o){if(i.textBox||i.iconBox){let o,s;this.collisionBoxArrays.has(e)?o=this.collisionBoxArrays.get(e):(o=new Map,this.collisionBoxArrays.set(e,o)),o.has(t)?s=o.get(t):(s={text:null,icon:null},o.set(t,s)),i.textBox&&(s.text=r.box),i.iconBox&&(s.icon=n.box)}if(o){let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<o.circles.length;e+=4)t.push(o.circles[e+0]-lt),t.push(o.circles[e+1]-lt),t.push(o.circles[e+2]),t.push(o.collisionDetected?1:0)}}markUsedJustification(e,i,r,n){let o;o=n===t.ax.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.aO(i)];const s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const t of s)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:r.crossTileID)}markUsedOrientation(e,i,r){const n=i===t.ax.horizontal||i===t.ax.horizontalOnly?i:0,o=i===t.ax.vertical?i:0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const t of s)e.text.placedSymbolArray.get(t).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=n[e];o?(this.opacities[e]=new ht(o,r,t.text,t.icon),i||(i=t.text!==o.text.placed),i||(i=t.icon!==o.icon.placed)):(this.opacities[e]=new ht(null,r,t.text,t.icon,t.skipFade),i||(i=t.text||t.icon))}for(const e in n){const t=n[e];if(!this.opacities[e]){const n=new ht(t,r,!1,!1);n.isHidden()||(this.opacities[e]=n,i||(i=t.text.placed),i||(i=t.icon.placed))}}for(const e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(const e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const i={};for(const r of t){const t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,i,r,n){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();const o=e.layers[0],s=o.layout,a=new ht(null,0,!1,!1,!0),l=s.get("text-allow-overlap"),c=s.get("icon-allow-overlap"),u=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h="map"===s.get("text-rotation-alignment"),d="map"===s.get("text-pitch-alignment"),p="none"!==s.get("icon-text-fit"),f=new ht(null,0,l&&(c||!e.hasIconData()||s.get("icon-optional")),c&&(l||!e.hasTextData()||s.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);const m=(e,t,i)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i);e.hasVisibleVertices||(e.hasVisibleVertices=i!==Pt)},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let i=0;i<e.symbolInstances.length;i++){const n=e.symbolInstances.get(i),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:s,crossTileID:l}=n;let c=this.opacities[l];r[l]?c=a:c||(c=f,this.opacities[l]=c),r[l]=!0;const y=n.numIconVertices>0,_=this.placedOrientations[n.crossTileID],v=_===t.ax.vertical,b=_===t.ax.horizontal||_===t.ax.horizontalOnly;if(o>0||s>0){const t=St(c.text);m(e.text,o,v?Pt:t),m(e.text,s,b?Pt:t);const i=c.text.isHidden(),r=[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex];for(const t of r)t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||v?1:0);n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=i||b?1:0);const a=this.variableOffsets[n.crossTileID];
vendor: 1,044 bytes, line 2
2a&&this.markUsedJustification(e,a.anchor,n,_);const l=this.placedOrientations[n.crossTileID];l&&(this.markUsedJustification(e,"left",n,l),this.markUsedOrientation(e,l,n))}if(y){const t=St(c.icon),i=!(p&&n.verticalPlacedIconSymbolIndex&&v);n.placedIconSymbolIndex>=0&&(m(e.icon,n.numIconVertices,i?t:Pt),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=c.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(m(e.icon,n.numVerticalIconVertices,i?Pt:t),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=c.icon.isHidden())}const x=(null==g?void 0:g.has(i))?g.get(i):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const r=e.collisionArrays[i];if(r){let i=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){const e=this.variableOffsets[l];e?(i=mt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),h&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let n;r.textBox&&(n=v),r.verticalTextBox&&(n=b),yt
vendor: 9,580 bytes, line 2
2(e.textCollisionBox.collisionVertexArray,c.text.placed,!t||n,x.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){const t=Boolean(!b&&r.verticalIconBox);let n;r.iconBox&&(n=t),r.verticalIconBox&&(n=!t),yt(e.iconCollisionBox.collisionVertexArray,c.icon.placed,n,x.icon,p?i.x:0,p?i.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 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}}function yt(e,t,i,r,n,o){r&&0!==r.length||(r=[0,0,0,0]);const s=r[0]-lt,a=r[1]-lt,l=r[2]-lt,c=r[3]-lt;e.emplaceBack(t?1:0,i?1:0,n||0,o||0,s,a),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,l,a),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,l,c),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,s,c)}const _t=Math.pow(2,25),vt=Math.pow(2,24),bt=Math.pow(2,17),xt=Math.pow(2,16),wt=Math.pow(2,9),Tt=Math.pow(2,8),Et=Math.pow(2,1);function St(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*_t+t*vt+i*bt+t*xt+i*wt+t*Tt+i*Et+t}const Pt=0;class It{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,r,n){const o=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(o,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<o.length;)if(t.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1}}class Ct{constructor(e,t,i,r,n,o,s,a){this.placement=new gt(e,t,o,s,a),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,i,r){const n=c(),o=()=>!this._forceFullPlacement&&c()-n>2;for(;this._currentPlacementIndex>=0;){const n=i[e[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if(t.aQ(n)&&n.layout&&(!n.minzoom||n.minzoom<=s)&&(!n.maxzoom||n.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new It(n)),this._inProgressLayer.continuePlacement(r[n.source],this.placement,this._showCollisionBoxes,n,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Mt=512/t.a6/2;class At{constructor(e,i,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};const n=new Map;for(let e=0;e<i.length;e++){const t=i.get(e),r=t.key,o=n.get(r);o?o.push(t):n.set(r,[t])}for(const[e,i]of n){const r={positions:i.map((e=>({x:Math.floor(e.anchorX*Mt),y:Math.floor(e.anchorY*Mt)}))),crossTileIDs:i.map((e=>e.crossTileID))};if(r.positions.length>128){const e=new t.aR(r.positions.length,16,Uint16Array);for(const{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,i){const{x:r,y:n,z:o}=this.tileID.canonical,{x:s,y:a,z:l}=i.canonical,c=Mt/Math.pow(2,l-o),u=(a*t.a6+e.anchorY)*c,h=n*t.a6*Mt;return{x:Math.floor((s*t.a6+e.anchorX)*c-r*t.a6*Mt),y:Math.floor(u-h)}}findMatches(e,t,i){const r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let n=0;n<e.length;n++){const o=e.get(n);if(o.crossTileID)continue;const s=this._symbolsByKey[o.key];if(!s)continue;const a=this.getScaledCoordinates(o,t);if(s.index){const e=s.index.range(a.x-r,a.y-r,a.x+r,a.y+r).sort();for(const t of e){const e=s.crossTileIDs[t];if(!i[e]){i[e]=!0,o.crossTileID=e;break}}}else if(s.positions)for(let e=0;e<s.positions.length;e++){const t=s.positions[e],n=s.crossTileIDs[e];if(Math.abs(t.x-a.x)<=r&&Math.abs(t.y-a.y)<=r&&!i[n]){i[n]=!0,o.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class Lt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ft{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const e in this.indexes){const i=this.indexes[e],r={};for(const e in i){const n=i[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),r[n.tileID.key]=n}this.indexes[e]=r}this.lng=e}addBucket(e,t,i){var r,n,o;if(null===(r=this.indexes[e.overscaledZ])||void 0===r?void 0:r[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;(n=this.usedCrossTileIDs)[o=e.overscaledZ]||(n[o]={});const s=this.usedCrossTileIDs[e.overscaledZ];for(const i in this.indexes){const r=this.indexes[i];if(Number(i)>e.overscaledZ)for(const i in r){const n=r[i];n.tileID.isChildOf(e)&&n.findMatches(t.symbolInstances,e,s)}else{const n=r[e.scaledTo(Number(i)).key];n&&n.findMatches(t.symbolInstances,e,s)}}for(let e=0;e<t.symbolInstances.length;e++){const r=t.symbolInstances.get(e);r.crossTileID||(r.crossTileID=i.generate(),s[r.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new At(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const i of t.getCrossTileIDsLists())for(const t of i)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(const i in this.indexes){const r=this.indexes[i];for(const n in r)e[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],t=!0)}return t}}class Dt{constructor(){this.layerIndexes={},this.crossTileIDs=new Lt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];void 0===r&&(r=this.layerIndexes[e.id]=new Ft);let n=!1;const o={};r.handleWrapJump(i);for(const i of t){const t=i.getBucket(e);e.id===(null==t?void 0:t.layerIds[0])&&(t.bucketInstanceId||(this.maxBucketInstanceId+=1,t.bucketInstanceId=this.maxBucketInstanceId),r.addBucket(i.tileID,t,this.crossTileIDs)&&(n=!0),o[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(e){const t={};for(const i of e)t[i]=!0;for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var kt="void main() {fragColor=vec4(1.0);}";const Ot={prelude:Rt("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
2return (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\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(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));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:Rt("","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);}"),projectionGlobe:Rt("","#define GLOBE_RADIUS 6371008.8\nuniform 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\n);}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); \nif (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\n);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);}"),background:Rt("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Rt("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;
2uniform 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;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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);}"),circle:Rt("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);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;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat 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 {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_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);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} 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);}"),clippingMask:Rt(kt,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Rt("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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);\n#ifdef GLOBE\nvec2 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);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:Rt("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;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","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;}"),collisionBox:Rt("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;}}","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;}"),collisionCircle:Rt("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;}","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);}"),colorRelief:Rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;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(u_color_ramp_size);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 r=(u_color_ramp_size-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\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;}}"),debug:Rt("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);}","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));}"),depth:Rt(kt,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:Rt("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:Rt("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:Rt("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;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=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;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:Rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=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;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=patte
2rn_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);}"),fillExtrusion:Rt("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat 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);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=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;}"),fillExtrusionPattern:Rt("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;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=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;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: 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;}"),hillshadePrepare:Rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform 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/p
2ow(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);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;}"),hillshade:Rt("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];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat 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\n{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\n{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;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;}}"),line:Rt("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
2float 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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:Rt("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;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:Rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin 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;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
2float 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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:Rt("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;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;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=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);
2float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin 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_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:Rt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
2float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin 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;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;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;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat 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;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:Rt("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);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Rt("uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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_total_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;\n#ifdef GLOBE\nif(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);}\n#endif\nvec4 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;}"),symbolSDF:Rt("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform bool u_is_plain;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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;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);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));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;\n#ifdef GLOBE\nif(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);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,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;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}"),symbolTextAndIcon:Rt("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform bool u_is_text;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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;
2fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","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;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);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));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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;\n#ifdef GLOBE\nif(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);}\n#endif\nvec4 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;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}"),terrain:Rt("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 && u_fog_ground_blend_opacity > 0.0 && 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);
2float 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;}}","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,ele-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;}"),terrainDepth:Rt("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);}","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;}"),terrainCoords:Rt("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);}","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);}"),projectionErrorMeasurement:Rt("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","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);}"),atmosphere:Rt("#ifdef GL_ES\nprecision highp float;\n#endif\nin 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\n);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;}","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);}"),sky:Rt("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);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};
2function Rt(e,t){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=o?o.concat(n):n,a={};return{fragmentSource:e=e.replace(i,((e,t,i,r,n)=>(a[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n    ${i} ${r} ${n} = u_${n};\n#endif\n`))),vertexSource:t=t.replace(i,((e,t,i,r,n)=>{const o="float"===r?"vec2":"vec4",s=n.match(/color/)?"color":o;return a[n]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${n}\n    ${n} = a_${n};\n#else\n    ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n    ${n} = unpack_mix_${s}(a_${n}, u_${n}_t);\n#else\n    ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${n}\n    ${i} ${r} ${n} = a_${n};\n#else\n    ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n    ${i} ${r} ${n} = unpack_mix_${s}(a_${n}, u_${n}_t);\n#else\n    ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:r,staticUniforms:s}}class zt{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Nt=t.aS([{name:"a_pos",type:"Int16",components:2}]);const Bt="#define PROJECTION_MERCATOR",Vt="mercator";class jt{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Vt}get shaderDefine(){return Bt}get shaderPreludeCode(){return Ot.projectionMercator}get vertexShaderPreludeCode(){return Ot.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aT.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,r,n,o){if(this._cachedMesh)return this._cachedMesh;const s=new t.aU;s.emplaceBack(0,0),s.emplaceBack(t.a6,0),s.emplaceBack(0,t.a6),s.emplaceBack(t.a6,t.a6);const a=e.createVertexBuffer(s,Nt.members),l=t.aV.simpleSegment(0,0,4,2),c=new t.aW;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const u=e.createIndexBuffer(c);return this._cachedMesh=new zt(a,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class Ut{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<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=i,this.right=r}interpolate(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.H.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.H.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.H.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.H.number(e.right,i.right,r)),this}getCenter(e,i){const r=t.al((this.left+e-this.right)/2,0,e),n=t.al((this.top+i-this.bottom)/2,0,i);return new t.P(r,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Ut(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Gt(e,t){if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function $t(e){return Math.max(0,Math.floor(e))}class qt{constructor(e,i){var r;this.applyConstrain=(e,t)=>null!==this._constrainOverride?this._constrainOverride(e,t):this._callbacks.defaultConstrain(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===(null==i?void 0:i.renderWorldCopies)||!!(null==i?void 0:i.renderWorldCopies),this._minZoom=(null==i?void 0:i.minZoom)||0,this._maxZoom=(null==i?void 0:i.maxZoom)||22,this._minPitch=null==(null==i?void 0:i.minPitch)?0:null==i?void 0:i.minPitch,this._maxPitch=null==(null==i?void 0:i.maxPitch)?60:null==i?void 0:i.maxPitch,this._constrainOverride=null!==(r=null==i?void 0:i.constrainOverride)&&void 0!==r?r:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=$t(this._zoom),this._scale=t.ao(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Ut,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,r){this._constrainOverride=e.constrainOverride,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=$t(this._zoom),this._scale=t.ao(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 Ut(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=!r&&e.autoCalculateNearFarZ,i&&this.constrainInternal(),this._calcMatrices()}
2get 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.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.applyConstrain(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){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){void 0===e&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=t.X(e,-180,180)*Math.PI/180;var n,o,s,a,l,c,u,h,d;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=r(),n=this._rotationMatrix,s=-this._bearingInRadians,a=(o=this._rotationMatrix)[0],l=o[1],c=o[2],u=o[3],h=Math.sin(s),d=Math.cos(s),n[0]=a*d+c*h,n[1]=l*d+u*h,n[2]=a*-h+c*d,n[3]=l*-h+u*d)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=t.al(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return t.aX(this._fovInRadians)}setFov(e){e=t.al(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.an(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const i=this.applyConstrain(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=t.ao(i),this.constrainInternal(),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.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),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,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this.constrainInternal(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var e,t;return 2!==(null===(e=this._latRange)||void 0===e?void 0:e.length)||2!==(null===(t=this._lngRange)||void 0===t?void 0:t.length)?null:new G([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.constrainInternal()):(this._lngRange=null,this._latRange=[-t.am,t.am])}getCameraQueryGeometry(e,i){if(1===i.length)return[i[0],e];{const{minX:r,minY:n,maxX:o,maxY:s}=t.a8.fromPoints(i).extend(e);return[new t.P(r,n),new t.P(o,n),new t.P(o,s),new t.P(r,s),new t.P(r,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:t,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}
2_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.ap(new Float64Array(16));t.S(e,e,[this._width/2,-this._height/2,1]),t.Q(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.ap(new Float64Array(16)),t.S(e,e,[1,-1,1]),t.Q(e,e,[-1,-1,0]),t.S(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,r,n){const o=void 0!==r?r:this.bearing,s=n=void 0!==n?n:this.pitch,{distanceToCenter:a,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(i,this.elevation,s),{x:c,y:u}=be(s,o),h=t.a7.fromLngLat(e,i);let d,p,f=t.aY(1,h.y),m=0;do{if(m+=1,m>10)break;p=a/f,d=new t.a7(h.x+c*p,h.y+u*p),f=1/d.meterInMercatorCoordinateUnits()}while(Math.abs(a-p*f)>1e-12);return{center:d.toLngLat(),elevation:l,zoom:t.ar(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=1/this.worldSize,r=t.aq(1,this.center.lat)*this.worldSize,n=t.a7.fromLngLat(this.center,this.elevation),o=n.x/i,s=n.y/i,a=n.z/i,l=this.pitch,c=this.bearing,{x:u,y:h,z:d}=be(l,c),p=this.cameraToCenterDistance,f=o+p*-u,m=s+p*-h,g=a+p*d,{distanceToCenter:y,clampedElevation:_}=this._distanceToCenterFromAltElevationPitch(g/r,e,l),v=y*r,b=new t.a7((f+u*v)*i,(m+h*v)*i,0).toLngLat(),x=t.aq(1,b.lat),w=t.ar(this.height/2/Math.tan(this.fovInRadians/2)/y/x/this.tileSize);this._elevation=_,this._center=b,this.setZoom(w)}_distanceToCenterFromAltElevationPitch(e,i,r){const n=-Math.cos(t.an(r)),o=e-i;let s,a=i;return n*o>=0||Math.abs(n)<.1?(s=1e4,a=e+s*n):s=-o/n,{distanceToCenter:s,clampedElevation:a}}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=t.aq(1,this.center.lat)*this.worldSize;return ve(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const i=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/i,e.canonical.y/i,1/i/t.a6,1/i/t.a6]}}class Zt{constructor(e,i){this.min=e,this.max=i,this.center=t.aZ([],t.a_([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],r=t.a$(this.min),n=t.a$(this.max);for(let e=0;e<i.length;e++)r[e]=i[e]?this.min[e]:this.center[e],n[e]=i[e]?this.center[e]:this.max[e];return n[2]=this.max[2],new Zt(r,n)}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(const i of e.planes){const e=this.intersectsPlane(i);if(0===e)return 0;1===e&&(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],i=e[3];for(let r=0;r<3;r++)e[r]>0?(t+=e[r]*this.min[r],i+=e[r]*this.max[r]):(i+=e[r]*this.min[r],t+=e[r]*this.max[r]);return t>=0?2:i<0?0:1}}class Wt{distanceToTile2d(e,t,i,r){const n=r,o=n.distanceX([e,t]),s=n.distanceY([e,t]);return Math.hypot(o,s)}getWrap(e,t,i){return i}getTileBoundingVolume(e,i,r,n){var o,s;let a=0,l=0;if(null==n?void 0:n.terrain){const c=new t.a3(e.z,i,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(c);a=null!==(o=u.minElevation)&&void 0!==o?o:Math.min(0,r),l=null!==(s=u.maxElevation)&&void 0!==s?s:Math.max(0,r)}const c=1<<e.z;return new Zt([i+e.x/c,e.y/c,a],[i+(e.x+1)/c,(e.y+1)/c,l])}allowVariableZoom(e,i){const r=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,n=t.al(78.5-r/2,0,60);return!!i.terrain||e.pitch>n}allowWorldCopies(){return!0}prepareNextFrame(){}}class Ht{constructor(e,t,i){this.points=e,this.planes=t,this.aabb=i}static fromInvProjectionMatrix(e,i=1,r=0,n,o){const 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]],a=Math.pow(2,r),l=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((r=>function(e,i,r,n){const o=t.aE([],e,i),s=1/o[3]/r*n;return t.b4(o,o,[s,s,1/o[3],s])}(r,e,i,a)));n&&function(e,i,r,n){const o=n?4:0,s=n?0:4;let a=0;const l=[],c=[];for(let i=0;i<4;i++){const r=t.b0([],e[i+s],e[i+o]),n=t.b5(r);t.aZ(r,r,1/n),l.push(n),c.push(r)}for(let i=0;i<4;i++){const n=t.b6(e[i+o],c[i],r);a=null!==n&&n>=0?Math.max(a,n):Math.max(a,l[i])}const u=function(e,i){const r=t.b0([],e[i[0]],e[i[1]]),n=t.b0([],e[i[2]],e[i[1]]),o=[0,0,0,0];return t.b1(o,t.b2([],r,n)),o[3]=-t.b3(o,e[i[0]]),o}(e,i),h=function(e,i){const r=t.b7(e),n=t.b8([],e,1/r),o=t.b0([],i,t.aZ([],n,t.b3(i,n))),s=t.b7(o);if(s>0){const e=Math.sqrt(1-n[3]*n[3]),r=t.aZ([],n,-n[3]),a=t.a_([],r,t.aZ([],o,e/s));return t.b9(i,a)}return null}(r,u);if(null!==h){const e=h/t.b3(c[0],u);a=Math.min(a,e)}for(let t=0;t<4;t++){const i=Math.min(a,l[t]);e[t+s]=[e[t+o][0]+c[t][0]*i,e[t+o][1]+c[t][1]*i,e[t+o][2]+c[t][2]*i,1]}}(l,s[0],n,o);const c=s.map((e=>{const i=t.b0([],l[e[0]],l[e[1]]),r=t.b0([],l[e[2]],l[e[1]]),n=t.b1([],t.b2([],i,r)),o=-t.b3(n,l[e[1]]);return n.concat(o)})),u=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],h=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const e of l)for(let t=0;t<3;t++)u[t]=Math.min(u[t],e[t]),h[t]=Math.max(h[t],e[t]);return new Ht(l,c,new Zt(u,h))}}
vendor: 4,007 bytes, line 2
2class Xt{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,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,i)=>{i=t.al(+i,this.minZoom,this.maxZoom);const r={center:new t.W(e.lng,e.lat),zoom:i};let n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&null===n){const e=180-1e-10;n=[-e,e]}const o=this.tileSize*t.ao(r.zoom);let s=0,a=o,l=0,c=o,u=0,h=0;const{x:d,y:p}=this.size;if(this._helper._latRange){const e=this._helper._latRange;s=t.Y(e[1])*o,a=t.Y(e[0])*o,a-s<p&&(u=p/(a-s))}n&&(l=t.X(t.Z(n[0])*o,0,o),c=t.X(t.Z(n[1])*o,0,o),c<l&&(c+=o),c-l<d&&(h=d/(c-l)));const{x:f,y:m}=me(o,e);let g,y;const _=Math.max(h||0,u||0);if(_){const e=new t.P(h?(c+l)/2:f,u?(a+s)/2:m);return r.center=ge(o,e).wrap(),r.zoom+=t.ar(_),r}if(this._helper._latRange){const e=p/2;m-e<s&&(y=s+e),m+e>a&&(y=a-e)}if(n){const e=(l+c)/2;let i=f;
vendor: 4,630 bytes, line 2
2this._helper._renderWorldCopies&&(i=t.X(f,e-o/2,e+o/2));const r=d/2;i-r<l&&(g=l+r),i+r>c&&(g=c-r)}if(void 0!==g||void 0!==y){const e=new t.P(null!=g?g:f,null!=y?y:m);r.center=ge(o,e).wrap()}return r},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new qt({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new Wt}clone(){const e=new Xt;return e.apply(this,!1),e}apply(e,t,i){this._helper.apply(e,t,i)}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){const i=[new t.ba(0,e)];if(this._helper._renderWorldCopies){const r=this.screenPointToMercatorCoordinate(new t.P(0,0)),n=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new t.P(0,this._helper._height)),a=Math.floor(Math.min(r.x,n.x,o.x,s.x)),l=Math.floor(Math.max(r.x,n.x,o.x,s.x)),c=1;for(let r=a-c;r<=l+c;r++)0!==r&&i.push(new t.ba(r,e))}return i}getCameraFrustum(){return Ht.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const t=this.screenPointToLocation(this.centerPoint,e),i=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(e,i){const r=t.aq(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(i,r),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),s=t.a7.fromLngLat(e),a=new t.a7(s.x-(n.x-o.x),s.y-(n.y-o.y));this.setCenter(null==a?void 0:a.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(t.a7.fromLngLat(e),i.getElevationForLngLat(e,this),this._pixelMatrix3D):this.coordinatePoint(t.a7.fromLngLat(e))}screenPointToLocation(e,t){var i;return null===(i=this.screenPointToMercatorCoordinate(e,t))||void 0===i?void 0:i.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){const i=t.pointCoordinate(e);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){const r=i||0,n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.aE(n,n,this._pixelMatrixInverse),t.aE(o,o,this._pixelMatrixInverse);const s=n[3],a=o[3],l=n[1]/s,c=o[1]/a,u=n[2]/s,h=o[2]/a,d=u===h?0:(r-u)/(h-u);return new t.a7(t.H.number(n[0]/s,o[0]/a,d)/this.worldSize,t.H.number(l,c,d)/this.worldSize,r)}coordinatePoint(e,i=0,r=this._pixelMatrix){const n=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.aE(n,n,r),new t.P(n[0]/n[3],n[1]/n[3])}getBounds(){const e=Math.max(0,this._helper._height/2-ye(this));return(new G).extend(this.screenPointToLocation(new t.P(0,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new t.P(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=t.pointCoordinate(e):e.y>this.height/2-ye(this)}calculatePosMatrix(e,i=!1,r){var n;const o=null!==(n=e.key)&&void 0!==n?n:t.bb(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),s=i?this._alignedPosMatrixCache:this._posMatrixCache;if(s.has(o)){const e=s.get(o);return r?e.f32:e.f64}const a=_e(e,this.worldSize);t.U(a,i?this._alignedProjMatrix:this._viewProjMatrix,a);const l={f64:a,f32:new Float32Array(a)};return s.set(o,l),r?l.f32:l.f64}calculateFogMatrix(e){const i=e.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);const n=_e(e,this.worldSize);return t.U(n,this._fogMatrix,n),r.set(i,new Float32Array(n)),r.get(i)}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}_calculateNearFarZIfNeeded(e,i,r){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=e-n*this._helper._pixelPerMeter/Math.cos(i),s=n<0?o:e,a=Math.PI/2+this.pitchInRadians,l=t.an(this.fov)*(Math.abs(Math.cos(t.an(this.roll)))*this.height+Math.abs(Math.sin(t.an(this.roll)))*this.width)/this.height*(.5+r.y/this.height),c=Math.sin(l)*s/Math.sin(t.al(Math.PI-a-l,.01,Math.PI-.01)),u=ye(this),h=Math.atan(u/this._helper.cameraToCenterDistance),d=t.an(.75),p=
vendor: 6,037 bytes, line 2
2h>d?2*h*(.5+r.y/(2*u)):d,f=Math.sin(p)*s/Math.sin(t.al(Math.PI-a-p,.01,Math.PI-.01)),m=Math.min(c,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*m+s),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=me(this.worldSize,this.center),r=i.x,n=i.y;this._helper._pixelPerMeter=t.aq(1,this.center.lat)*this.worldSize;const o=t.an(Math.min(this.pitch,fe)),s=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));let a;var l,c;this._calculateNearFarZIfNeeded(s,o,e),a=new Float64Array(16),t.bc(a,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),(l=this._invProjMatrix)[0]=1/(c=a)[0],l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=1/c[5],l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=0,l[11]=1/c[14],l[12]=0,l[13]=0,l[14]=-1,l[15]=c[10]/c[14],a[8]=2*-e.x/this._helper._width,a[9]=2*e.y/this._helper._height,this._projectionMatrix=t.bd(a),t.S(a,a,[1,-1,1]),t.Q(a,a,[0,0,-this._helper.cameraToCenterDistance]),t.be(a,a,-this.rollInRadians),t.bf(a,a,this.pitchInRadians),t.be(a,a,-this.bearingInRadians),t.Q(a,a,[-r,-n,0]),this._mercatorMatrix=t.S([],a,[this.worldSize,this.worldSize,this.worldSize]),t.S(a,a,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,a),t.Q(a,a,[0,0,-this.elevation]),this._viewProjMatrix=a,this._invViewProjMatrix=t.bg([],a);const u=[0,0,-1,1];t.aE(u,u,this._invViewProjMatrix),this._cameraPosition=[u[0]/u[3],u[1]/u[3],u[2]/u[3]],this._fogMatrix=new Float64Array(16),t.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,s,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,t.S(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.Q(this._fogMatrix,this._fogMatrix,[-r,-n,0]),t.S(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,a);const h=this._helper._width%2/2,d=this._helper._height%2/2,p=Math.cos(this.bearingInRadians),f=Math.sin(-this.bearingInRadians),m=r-Math.round(r)+p*h+f*d,g=n-Math.round(n)+p*d+f*h,y=new Float64Array(a);if(t.Q(y,y,[m>.5?m-1:m,g>.5?g-1:g,0]),this._alignedProjMatrix=y,a=t.bg(new Float64Array(16),this._pixelMatrix),!a)throw new Error("failed to invert matrix");this._pixelMatrixInverse=a,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new t.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.aE(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=t.aq(1,this.center.lat)*this.worldSize;return ve(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const r=t.a7.fromLngLat(e),n=[r.x*this.worldSize,r.y*this.worldSize,i,1];return t.aE(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(e){const{overscaledTileID:i,aligned:r,applyTerrainMatrix:n}=e,o=this._helper.getMercatorTileCoordinates(i),s=i?this.calculatePosMatrix(i,r,!0):null;let a;return a=(null==i?void 0:i.terrainRttPosMatrix32f)&&n?i.terrainRttPosMatrix32f:s||t.bh(),{mainMatrix:a,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,i){return 1}transformLightDirection(e){return t.a$(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,r,n){const o=this.calculatePosMatrix(r);let s;n?(s=[e,i,n(e,i),1],t.aE(s,s,o)):(s=[e,i,0,1],at(s,s,o));const a=s[3];return{point:new t.P(s[0]/a,s[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}populateCache(e){for(const t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,i){const r=t.a7.fromLngLat(e,i),n=r.meterInMercatorCoordinateUnits(),o=t.bi();return t.Q(o,o,[r.x,r.y,r.z]),t.be(o,o,Math.PI),t.bf(o,o,Math.PI/2),t.S(o,o,[-n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const i=new t.a3(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),n=_e(i,this.worldSize);t.U(n,this._viewProjMatrix,n),r.tileMercatorCoords=[0,0,1,1];const o=[t.a6,t.a6,this.worldSize/this._helper.pixelsPerMeter],s=t.bj();return t.S(s,n,o),r.fallbackMatrix=s,r.mainMatrix=s,r}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Yt(){t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Jt(e){if(e.useSlerp)if(e.k<1){const i=t.bk(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=t.bk(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),n=new Float64Array(4);t.bl(n,i,r,e.k);const o=t.bm(n);e.tr.setRoll(o.roll),e.tr.setPitch(o.pitch),e.tr.setBearing(o.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(t.H.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.H.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.H.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function Kt(e,i,r,n,o){const s=o.padding,a=me(o.worldSize,r.getNorthWest()),l=me(o.worldSize,r.getNorthEast()),c=me(o.worldSize,r.getSouthEast()),u=me(o.worldSize,r.getSouthWest
vendor: 10,954 bytes, line 2
2()),h=t.an(-n),d=a.rotate(h),p=l.rotate(h),f=c.rotate(h),m=u.rotate(h),g=new t.P(Math.max(d.x,p.x,m.x,f.x),Math.max(d.y,p.y,m.y,f.y)),y=new t.P(Math.min(d.x,p.x,m.x,f.x),Math.min(d.y,p.y,m.y,f.y)),_=g.sub(y),v=(o.width-(s.left+s.right+i.left+i.right))/_.x,b=(o.height-(s.top+s.bottom+i.top+i.bottom))/_.y;if(b<0||v<0)return void Yt();const x=Math.min(t.ar(o.scale*Math.min(v,b)),e.maxZoom),w=t.P.convert(e.offset),T=new t.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(t.an(n)),E=w.add(T).mult(o.scale/t.ao(x));return{center:ge(o.worldSize,a.add(c).div(2).sub(E)),zoom:x,bearing:n}}class Qt{get useGlobeControls(){return!1}handlePanInertia(e,t){const i=e.mag(),r=Math.abs(ye(t));return{easingOffset:e.mult(Math.min(.75*r/i,1)),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,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around)}cameraForBoxAndBearing(e,t,i,r,n){return Kt(e,t,i,r,n)}handleJumpToCenterZoom(e,i){e.zoom!==(void 0!==i.zoom?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),void 0!==i.center&&e.setCenter(t.W.convert(i.center))}handleEaseTo(e,i){const r=e.zoom,n=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},a=void 0!==i.zoom,l=!e.isPaddingEqual(i.padding);let c=!1;const u=a?+i.zoom:e.zoom;let h=e.centerPoint.add(i.offsetAsPoint);const d=e.screenPointToLocation(h),{center:p,zoom:f}=e.applyConstrain(t.W.convert(i.center||d),null!=u?u:r);Gt(e,p);const m=me(e.worldSize,d),g=me(e.worldSize,p).sub(m),y=t.ao(f-r);return c=f!==r,{easeFunc:a=>{if(c&&e.setZoom(t.H.number(r,f,a)),t.bn(o,s)||Jt({startEulerAngles:o,endEulerAngles:s,tr:e,k:a,useSlerp:o.roll!=s.roll}),l&&(e.interpolatePadding(n,i.padding,a),h=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const i=t.ao(e.zoom-r),n=f>r?Math.min(2,y):Math.max(.5,y),o=Math.pow(n,1-a),s=ge(e.worldSize,m.add(g.mult(a*o)).mult(i));e.setLocationAtPoint(e.renderWorldCopies?s.wrap():s,h)}},isZooming:c,elevationCenter:p}}handleFlyTo(e,i){const r=void 0!==i.zoom,n=e.zoom,o=e.applyConstrain(t.W.convert(i.center||i.locationAtOffset),r?+i.zoom:n),s=o.center,a=o.zoom;Gt(e,s);const l=me(e.worldSize,i.locationAtOffset),c=me(e.worldSize,s).sub(l),u=c.mag(),h=t.ao(a-n);let d;if(void 0!==i.minZoom){const r=Math.min(+i.minZoom,n,a),o=e.applyConstrain(s,r).zoom;d=t.ao(o-n)}return{easeFunc:(i,r,o,u)=>{e.setZoom(1===i?a:n+t.ar(r));const h=1===i?s:ge(e.worldSize,l.add(c.mult(o)).mult(r));e.setLocationAtPoint(e.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:s,scaleOfMinZoom:d,pixelPathLength:u}}}class ei{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}ei.Replace=[1,0],ei.disabled=new ei(ei.Replace,t.bo.transparent,[!1,!1,!1,!1]),ei.unblended=new ei(ei.Replace,t.bo.transparent,[!0,!0,!0,!0]),ei.alphaBlended=new ei([1,771],t.bo.transparent,[!0,!0,!0,!0]);const ti=2305;class ii{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}ii.disabled=new ii(!1,1029,ti),ii.backCCW=new ii(!0,1029,ti),ii.frontCCW=new ii(!0,1028,ti);class ri{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}ri.ReadOnly=!1,ri.ReadWrite=!0,ri.disabled=new ri(519,ri.ReadOnly,[0,1]);const ni=7680;class oi{constructor(e,t,i,r,n,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}function si(e){return"undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext}oi.disabled=new oi({func:519,mask:0},0,0,ni,ni,ni);class ai{get awaitingQuery(){return!!this._readbackQueue}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;const i=e.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;const n=new t.aU;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const o=new t.aW;o.emplaceBack(0,1,2),this._fullscreenTriangle=new zt(i.createVertexBuffer(n,Nt.members),i.createIndexBuffer(o),t.aV.simpleSegment(0,0,n.length,o.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);const s=r.createTexture();r.bindTexture(r.TEXTURE_2D,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(s),si(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}destroy(){const 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){const i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){const 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,i){const r=this._cachedRenderContext.context,n=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:t.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,n.TRIANGLES,ri.disabled,oi.disabled,ei.unblended,ii.disabled,((e,t)=>({u_input:e,u_output_expected:t}))(e,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&si(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);const e=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:e}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&si(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return t.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===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=ai._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}}const li=t.a6/128;function ci(e,i){const r=void 0!==e.granularity?Math.max(e.granularity,1):1,n=r+(e.generateBorders?2:0),o=r+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),s=n+1,a=o+1,l=e.generateBorders?-1:0,c=e.generateBorders||e.extendToNorthPole?-1:0,u=r+(e.generateBorders?1:0),h=r+(e.generateBorders||e.extendToSouthPole?1:0),d=s*a,p=n*o*6,f=s*a>65536;if(f&&"16bit"===i)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const m=f||"32bit"===i,g=new Int16Array(2*d);let y=0;for(let i=c;i<=h;i++)for(let n=l;n<=u;n++){let o=n/r*t.a6;-1===n&&(o=-li),n===r+1&&(o=t.a6+li);let s=i/r*t.a6;-1===i&&(s=e.extendToNorthPole?t.bq:-li),i===r+1&&(s=e.extendToSouthPole?t.br:t.a6+li),g[y++]=o,g[y++]=s}const _=m?new Uint32Array(p):new Uint16Array(p);let v=0;for(let e=0;e<o;e++)for(let t=0;t<n;t++){const i=t+1+e*s,r=t+(e+1)*s,n=t+1+(e+1)*s;_[v++]=t+e*s,_[v++]=r,_[v++]=i,_[v++]=i,_[v++]=r,_[v++]=n}return{vertices:g.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:m}}const ui=new t.aT({fill:new t.bs(128,2),line:new t.bs(512,0),tile:new t.bs(128,32),stencil:new t.bs(128,1),circle:3});class hi{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"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return Ot.projectionGlobe}get vertexShaderPreludeCode(){return Ot.projectionMercator.vertexSource}get subdivisionGranularity(){return ui}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new ai(e));const i=t.Y(this._errorQueryLatitudeDegrees),r=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(i,r),o=c();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=o);const s=Math.min(Math.max((o-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=t.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,t.bu(s))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,i,r,n){const o=("stencil"===n?ui.stencil:ui.tile).getGranularityForZoomLevel(t.z);return this._getMesh(e,{granularity:o,generateBorders:i,extendToNorthPole:0===t.y&&r,extendToSouthPole:t.y===(1<<t.z)-1&&r})}_getMesh(e,i){const r=this._getMeshKey(i);if(r in this._tileMeshCache)return this._tileMeshCache[r];const n=function(e,i){const r=ci(i,"16bit"),n=t.aU.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),o=t.aW.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new zt(e.createVertexBuffer(n,Nt.members),e.createIndexBuffer(o),t.aV.simpleSegment(0,0,n.length,o.length))}(e,i);return this._tileMeshCache[r]=n,n}recalculate(e){}hasTransition(){var e;const t=c();let i=!1;
2return i||(i=(t-this._errorMeasurementLastChangeTime)/1e3<.7),i||(i=null===(e=this._errorMeasurement)||void 0===e?void 0:e.awaitingQuery),i}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const di=new t.u({type:new t.D(t.x.projection.type)});class pi extends t.E{constructor(e){super(),this._transitionable=new t.y(di,void 0),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.J(0)),this._mercatorProjection=new jt,this._verticalPerspectiveProjection=new hi}get transitionState(){const e=this.properties.get("type");if("string"==typeof e&&"mercator"===e)return 0;if("string"==typeof e&&"vertical-perspective"===e)return 1;if(e instanceof t.bv){if("vertical-perspective"===e.from&&"mercator"===e.to)return 1-e.transition;if("mercator"===e.from&&"vertical-perspective"===e.to)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,i,r,n){return this.currentProjection.getMeshFromTileID(e,t,i,r,n)}setProjection(e){this._transitionable.setValue("type",(null==e?void 0: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)}}function fi(e){const t=yi(e.worldSize,e.center.lat);return 2*Math.PI*t}function mi(e,i,r,n,o){const s=1/(1<<o),a=i/t.a6*s+n*s,l=t.by((e/t.a6*s+r*s)*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI,u=Math.cos(c),h=new Float64Array(3);return h[0]=Math.sin(l)*u,h[1]=Math.sin(c),h[2]=Math.cos(l)*u,h}function gi(e){return function(e,t){const i=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*i,r[1]=Math.sin(t),r[2]=Math.cos(e)*i,r}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function yi(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function _i(e){const i=Math.asin(e[1])/Math.PI*180,r=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(r>1e-6){const n=e[0]/r,o=Math.acos(e[2]/r),s=(n>0?o:-o)/Math.PI*180;return new t.W(t.X(s,-180,180),i)}return new t.W(0,i)}function vi(e){return Math.cos(e*Math.PI/180)}function bi(e,i){const r=vi(e),n=vi(i);return t.ar(n/r)}function xi(e,i){const r=e.rotate(i.bearingInRadians),n=i.zoom+bi(i.center.lat,0),o=t.bt(1/vi(i.center.lat),1/vi(Math.min(Math.abs(i.center.lat),60)),t.bw(n,7,3,0,1)),s=360/fi({worldSize:i.worldSize,center:{lat:i.center.lat}});return new t.W(i.center.lng-r.x*s*o,t.al(i.center.lat+r.y*s,-t.am,t.am))}function wi(e){const t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function Ti(e,i,r,n){const o=e.lat+r*n;if(Math.abs(r)>1){const s=(Math.sign(e.lat+r)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,a=Math.abs(e.lat+r)*Math.PI/180,l=wi(s+n*(a-s)),c=wi(s),u=wi(a);return new t.W(e.lng+i*((l-c)/(u-c)),o)}return new t.W(e.lng+i*n,o)}class Ei{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,i,r){const n=`${e.z}_${e.x}_${e.y}_${(null==r?void 0:r.terrain)?"t":""}`,o=this._cache.get(n);if(o)return o;const s=this._cachePrevious.get(n);if(s)return this._cache.set(n,s),s;const a=this._boundingVolumeFactory(e,t,i,r);return this._cache.set(n,a),this._hadAnyChanges=!0,a}}class Si{constructor(e,t,i,r){this.min=i,this.max=r,this.points=e,this.planes=t}static fromAabb(e,t){const i=[];for(let r=0;r<8;r++)i.push([1&~r?e[0]:t[0],1==(r>>1&1)?t[1]:e[1],1==(r>>2&1)?t[2]:e[2]]);return new Si(i,[[-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,i,r){const n=t.bA([],r[0],r[1],r[2]),o=t.bB([],[i[0],0,0],n),s=t.bB([],[0,i[1],0],n),a=t.bB([],[0,0,i[2]],n),l=[...e],c=[...e];for(let t=0;t<8;t++)for(let i=0;i<3;i++){const r=e[i]+o[i]*(1&~t?-1:1)+s[i]*(1==(t>>1&1)?1:-1)+a[i]*(1==(t>>2&1)?1:-1);l[i]=Math.min(l[i],r),c[i]=Math.max(c[i],r)}const u=[];for(let i=0;i<8;i++){const r=[...e];t.a_(r,r,t.aZ([],o,1&~i?-1:1)),t.a_(r,r,t.aZ([],s,1==(i>>1&1)?1:-1)),t.a_(r,r,t.aZ([],a,1==(i>>2&1)?1:-1)),u.push(r)}return new Si(u,[[...o,-t.b3(o,u[0])],[...s,-t.b3(s,u[0])],[...a,-t.b3(a,u[0])],[-o[0],-o[1],-o[2],-t.b3
vendor: 9,343 bytes, line 2
2(o,u[7])],[-s[0],-s[1],-s[2],-t.b3(s,u[7])],[-a[0],-a[1],-a[2],-t.b3(a,u[7])]],l,c)}intersectsFrustum(e){let t=!0;const i=this.points.length,r=this.planes.length,n=e.planes.length,o=e.points.length;for(let r=0;r<n;r++){const n=e.planes[r];let o=0;for(let e=0;e<i;e++){const t=this.points[e];n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]>=0&&o++}if(0===o)return 0;o<i&&(t=!1)}if(t)return 2;for(let t=0;t<r;t++){const i=this.planes[t];let r=0;for(let t=0;t<o;t++){const n=e.points[t];i[0]*n[0]+i[1]*n[1]+i[2]*n[2]+i[3]>=0&&r++}if(0===r)return 0}return 1}intersectsPlane(e){const t=this.points.length;let i=0;for(let r=0;r<t;r++){const t=this.points[r];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&i++}return i===t?2:0===i?0:1}}function Pi(e,t,i){const r=e-t;return r<0?-r:Math.max(0,r-i)}function Ii(e,t,i,r,n){const o=e-i;let s;return s=o<0?Math.min(-o,1+o-n):o>n?Math.min(Math.max(o-n,0),1-o):0,Math.max(s,Pi(t,r,n))}class Ci{constructor(){this._boundingVolumeCache=new Ei(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,i,r){const n=1<<i.z,o=1/n,s=i.x/n,a=i.y/n;let l=2;return l=Math.min(l,Ii(e,t,s,a,o)),l=Math.min(l,Ii(e,t,s+.5,-a-o,o)),l=Math.min(l,Ii(e,t,s+.5,2-a-o,o)),l}getWrap(e,t,i){const r=1<<t.z,n=1/r,o=t.x/r,s=Pi(e.x,o,n),a=Pi(e.x,o-1,n),l=Pi(e.x,o+1,n),c=Math.min(s,a,l);return c===l?1:c===a?-1:0}allowVariableZoom(e,t){return Se(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,r)}_computeTileBoundingVolume(e,i,r,n){var o,s;let a=0,l=0;if(null==n?void 0:n.terrain){const c=new t.a3(e.z,i,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(c);a=null!==(o=u.minElevation)&&void 0!==o?o:Math.min(0,r),l=null!==(s=u.maxElevation)&&void 0!==s?s:Math.max(0,r)}if(a/=t.bD,l/=t.bD,a+=1,l+=1,e.z<=0)return Si.fromAabb([-l,-l,-l],[l,l,l]);if(1===e.z)return Si.fromAabb([0===e.x?-l:0,0===e.y?0:-l,-l],[0===e.x?0:l,0===e.y?l:0,l]);{const i=[mi(0,0,e.x,e.y,e.z),mi(t.a6,0,e.x,e.y,e.z),mi(t.a6,t.a6,e.x,e.y,e.z),mi(0,t.a6,e.x,e.y,e.z)],r=[];for(const e of i)r.push(t.aZ([],e,l));if(l!==a)for(const e of i)r.push(t.aZ([],e,a));0===e.y&&r.push([0,1,0]),e.y===(1<<e.z)-1&&r.push([0,-1,0]);const n=[1,1,1],o=[-1,-1,-1];for(const e of r)for(let t=0;t<3;t++)n[t]=Math.min(n[t],e[t]),o[t]=Math.max(o[t],e[t]);const s=mi(t.a6/2,t.a6/2,e.x,e.y,e.z),c=t.b2([],[0,1,0],s);t.b1(c,c);const u=t.b2([],s,c);t.b1(u,u);const h=t.b2([],i[2],i[1]);t.b1(h,h);const d=t.b2([],i[0],i[3]);t.b1(d,d),r.push(t.aZ([],s,l)),e.y>=(1<<e.z)/2&&r.push(t.aZ([],mi(t.a6/2,0,e.x,e.y,e.z),l)),e.y<(1<<e.z)/2&&r.push(t.aZ([],mi(t.a6/2,t.a6,e.x,e.y,e.z),l));const p=Mi(s,r),f=Mi(u,r),m=[-s[0],-s[1],-s[2],p.max],g=[s[0],s[1],s[2],-p.min],y=[-u[0],-u[1],-u[2],f.max],_=[u[0],u[1],u[2],-f.min],v=[...h,0],b=[...d,0],x=[];return 0===e.y?x.push(t.bC(b,v,m),t.bC(b,v,g)):x.push(t.bC(y,v,m),t.bC(y,v,g),t.bC(y,b,m),t.bC(y,b,g)),e.y===(1<<e.z)-1?x.push(t.bC(b,v,m),t.bC(b,v,g)):x.push(t.bC(_,v,m),t.bC(_,v,g),t.bC(_,b,m),t.bC(_,b,g)),new Si(x,[m,g,y,_,v,b],n,o)}}}function Mi(e,i){let r=1/0,n=-1/0;for(const o of i){const i=t.b3(e,o);r=Math.min(r,i),n=Math.max(n,i)}return{min:r,max:n}}class Ai{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,i){this._helper.interpolatePadding(e,t,i)}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)}setConstrainOverride(e){this._helper.setConstrainOverride(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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=t.bE(),this._projectionMatrix=t.bi(),this._globeViewProjMatrix32f=t.bh(),this._globeViewProjMatrixNoCorrection=t.bi(),this._globeViewProjMatrixNoCorrectionInverted=t.bi(),this._globeProjMatrixInverted=t.bi(),this._cameraPosition=t.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(e,i)=>{const r=t.al(e.lat,-t.am,t.am),n=t.al(+i,this.minZoom+bi(0,r),this.maxZoom);return{center:new t.W(e.lng,r),zoom:n}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new qt({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new Ci}clone(){const e=new Ai;return e.apply(this,!1),e}apply(e,t,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(e,t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=t.bz();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){const{overscaledTileID:t,applyGlobeMatrix:i}=e,r=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,r=this.cameraToCenterDistance/e,n=Math.sin(i)*r,o=Math.cos(i)*r+1,s=1/Math.sqrt(n*n+o*o)*1;let a=-n,l=o;const c=Math.sqrt(a*a+l*l);a/=c,l/=c;const u=[0,a,l];t.bF(u,u,[0,0,0],-this.bearingInRadians),t.bG(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.bH(u,u,[0,0,0],this.center.lng*Math.PI/180);const h=1/t.b5(u);return t.aZ(u,u,h),[...u,-s*h]}isLocationOccluded(e){return!this.isSurfacePointVisible(gi(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,n=Math.cos(r),o=[Math.sin(i)*n,Math.sin(r),Math.cos(i)*n],s=[o[2],0,-o[0]],a=[0,0,0];t.b2(a,s,o),t.b1(s,s),t.b1(a,a);const l=[0,0,0];return t.b1(l,[s[0]*e[0]+a[0]*e[1]+o[0]*e[2],s[1]*e[0]+a[1]*e[1]+o[1]*e[2],s[2]*e[0]+a[2]*e[1]+o[2]*e[2]]),l}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,i,r){const n=function(e,i,r){const n=1/(1<<r.z);return new t.a7(e/t.a6*n+r.x*n,i/t.a6*n+r.y*n)}(e,i,r.canonical),o=(s=n.y,[t.by(n.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI]);var s;return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(e,i,r,n){const o=r.canonical,s=mi(e,i,o.x,o.y,o.z),a=1+(n?n(e,i):0)/t.bD,l=[s[0]*a,s[1]*a,s[2]*a,1];t.aE(l,l,this._globeViewProjMatrixNoCorrection);const c=this._cachedClippingPlane,u=c[0]*s[0]+c[1]*s[1]+c[2]*s[2]+c[3]<0;return{point:new t.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:u}}
vendor: 4,947 bytes, line 2
2_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=yi(this.worldSize,this.center.lat),i=t.bj(),r=t.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),t.bc(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const n=this.centerOffset;i[8]=2*-n.x/this._helper._width,i[9]=2*n.y/this._helper._height,this._projectionMatrix=t.bd(i),this._globeProjMatrixInverted=t.bj(),t.bg(this._globeProjMatrixInverted,i),t.Q(i,i,[0,0,-this.cameraToCenterDistance]),t.be(i,i,this.rollInRadians),t.bf(i,i,-this.pitchInRadians),t.be(i,i,this.bearingInRadians),t.Q(i,i,[0,0,-e]);const o=t.bz();o[0]=e,o[1]=e,o[2]=e,t.bf(r,i,this.center.lat*Math.PI/180),t.bI(r,r,-this.center.lng*Math.PI/180),t.S(r,r,o),this._globeViewProjMatrixNoCorrection=r,t.bf(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),t.bI(i,i,-this.center.lng*Math.PI/180),t.S(i,i,o),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=t.bj(),t.bg(this._globeViewProjMatrixNoCorrectionInverted,r);const s=t.bz();this._cameraPosition=t.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/e,t.bF(this._cameraPosition,this._cameraPosition,s,-this.rollInRadians),t.bG(this._cameraPosition,this._cameraPosition,s,this.pitchInRadians),t.bF(this._cameraPosition,this._cameraPosition,s,-this.bearingInRadians),t.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),t.bG(this._cameraPosition,this._cameraPosition,s,-this.center.lat*Math.PI/180),t.bH(this._cameraPosition,this._cameraPosition,s,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const a=t.bd(this._globeViewProjMatrixNoCorrectionInverted);t.S(a,a,[1,1,-1]),this._cachedFrustum=Ht.fromInvProjectionMatrix(a,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){t.w("calculateFogMatrix is not supported on globe projection.");const i=t.bj();return t.ap(i),i}getVisibleUnwrappedCoordinates(e){return[new t.ba(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&t.w("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,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const r=gi(e);t.aZ(r,r,1+i/t.bD);const n=t.bE();return t.aE(n,[r[0],r[1],r[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(e){}getBounds(){const e=.5*this.width,i=.5*this.height,r=[new t.P(0,0),new t.P(e,0),new t.P(this.width,0),new t.P(this.width,i),new t.P(this.width,this.height),new t.P(e,this.height),new t.P(0,this.height),new t.P(0,i)],n=[];for(const e of r)n.push(this.unprojectScreenPoint(e));let o=0,s=0,a=0,l=0;const c=this.center;for(const e of n){const i=t.bJ(c.lng,e.lng),r=t.bJ(c.lat,e.lat);i<s&&(s=i),i>o&&(o=i),r<l&&(l=r),r>a&&(a=r)}const u=[c.lng+s,c.lat+l,c.lng+o,c.lat+a];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new G(u)}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,i){const r=gi(this.unprojectScreenPoint(i)),n=gi(e),o=t.bz();t.bK(o);const s=t.bz();t.bH(s,r,o,-this.center.lng*Math.PI/180),t.bG(s,s,o,this.center.lat*Math.PI/180);const a=n[0]*n[0]+n[2]*n[2],l=s[0]*s[0];if(a<l)return;const c=Math.sqrt(a-l),u=-c,h=t.bL(n[0],n[2],s[0],c),d=t.bL(n[0],n[2],s[0],u),p=t.bz();t.bH(p,n,o,-h);const f=t.bL(p[1],p[2],s[1],s[2]),m=t.bz();t.bH(m,n,o,-d);const g=t.bL(m[1],m[2],s[1],s[2]),y=.5*Math.PI,_=f>=-y&&f<=y,v=g>=-y&&g<=y;let b,x;if(_&&v){const e=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;t.bM(h,e)+t.bM(f,i)<t.bM(d,e)+t.bM(g,i)?(b=h,x=f):(b=d,x=g)}else if(_)b=h,x=f;else{if(!v)return;b=d,x=g}const w=b/Math.PI*180,T=x/Math.PI*180,E=this.center.lat;this.setCenter(new t.W(w,t.al(T,-90,90))),this.setZoom(this.zoom+bi(E,this.center.lat))}locationToScreenPoint(e,i){const r=gi(e);if(i){const n=i.getElevationForLngLatZoom(e,this._helper._tileZoom);t.aZ(r,r,1+n/t.bD)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(e){const i=t.bE();return t.aE(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new t.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,i){if(i){const t=i.pointCoordinate(e);if(t)return t}return t.a7.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){var i;return null===(i=this.screenPointToMercatorCoordinate(e,t))||void 0===i?void 0:i.toLngLat()}
vendor: 10,072 bytes, line 2
2isPointOnMapSurface(e,t){const i=this._cameraPosition,r=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(i,r)}getRayDirectionFromPixel(e){const i=t.bE();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,t.aE(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const r=t.bz();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];const n=t.bz();return t.b1(n,r),n}isSurfacePointVisible(e){const 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;const i=t.bE();return t.aE(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){const r=t.b3(e,i),n=t.bz(),o=t.bz();t.aZ(o,i,r),t.b0(n,e,o);const s=1-t.b3(n,n);if(s<0)return null;const a=t.b3(e,e)-1,l=-r+(r<0?1:-1)*Math.sqrt(s),c=a/l,u=l;return{tMin:Math.min(c,u),tMax:Math.max(c,u)}}unprojectScreenPoint(e){const i=this._cameraPosition,r=this.getRayDirectionFromPixel(e),n=this.rayPlanetIntersection(i,r);if(n){const e=t.bz();t.a_(e,i,[r[0]*n.tMin,r[1]*n.tMin,r[2]*n.tMin]);const o=t.bz();return t.b1(o,e),_i(o)}const o=this._cachedClippingPlane,s=o[0]*r[0]+o[1]*r[1]+o[2]*r[2],a=-t.b9(o,i)/s,l=t.bz();if(a>0)t.a_(l,i,[r[0]*a,r[1]*a,r[2]*a]);else{const e=t.bz();t.a_(e,i,[2*r[0],2*r[1],2*r[2]]);const n=t.b9(this._cachedClippingPlane,e);t.b0(l,e,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const c=function(e){const i=t.bz();return i[0]=e[0]*-e[3],i[1]=e[1]*-e[3],i[2]=e[2]*-e[3],{center:i,radius:Math.sqrt(1-e[3]*e[3])}}(o);return _i(function(e,i,r){const n=t.bz();t.b0(n,r,e);const o=t.bz();return t.bx(o,e,n,i/t.b7(n)),o}(c.center,c.radius,l))}getMatrixForModel(e,i){const r=t.W.convert(e),n=1/t.bD,o=t.bi();return t.bI(o,o,r.lng/180*Math.PI),t.bf(o,o,-r.lat/180*Math.PI),t.Q(o,o,[0,0,1+i/t.bD]),t.bf(o,o,.5*Math.PI),t.S(o,o,[n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new t.a3(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class Li{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,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(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 constrainOverride(){return this._helper.constrainOverride}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}constructor(e){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new qt({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new Xt,this._verticalPerspectiveTransform=new Ai}clone(){const e=new Li;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this,!1),e}apply(e,t){this._helper.apply(e,t),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,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){const t=this._mercatorTransform.getProjectionData(e),i=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:t.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.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 t.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,r){const n=this._mercatorTransform.getPitchedTextCorrection(e,i,r),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,r);return t.bt(n,o,this._globeness)}projectTileCoordinates(e,t,i,r){return this.currentTransform.projectTileCoordinates(e,t,i,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,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()}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,t){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform,!1)}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)}
vendor: 7,300 bytes, line 2
2isPointOnMapSurface(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){const t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;const i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return i.fallbackMatrix=t.mainMatrix,i}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class Fi{get useGlobeControls(){return!0}handlePanInertia(e,i){const r=xi(e,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new t.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const r=e.around,n=i.screenPointToLocation(r);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);const o=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);const s=i.zoom-o;if(0===s)return;const a=t.bJ(i.center.lng,n.lng),l=a/(Math.abs(a/180)+1),c=t.bJ(i.center.lat,n.lat),u=i.getRayDirectionFromPixel(r),h=i.cameraPosition,d=-1*t.b3(h,u),p=t.bz();t.a_(p,h,[u[0]*d,u[1]*d,u[2]*d]);const f=t.b5(p)-1,m=Math.exp(.5*-Math.max(f-.3,0)),g=yi(i.worldSize,i.center.lat)/Math.min(i.width,i.height),y=t.bw(g,.9,.5,1,.25),_=(1-t.ao(-s))*Math.min(m,y),v=i.center.lat,b=i.zoom,x=new t.W(i.center.lng+l*_,t.al(i.center.lat+c*_,-t.am,t.am));i.setLocationAtPoint(n,r);const w=i.center,T=t.bw(Math.abs(a),45,85,0,1),E=t.bw(g,.75,.35,0,1),S=Math.pow(Math.max(T,E),.25),P=t.bJ(w.lng,x.lng),I=t.bJ(w.lat,x.lat);i.setCenter(new t.W(w.lng+P*S,w.lat+I*S).wrap()),i.setZoom(b+bi(v,i.center.lat))}handleMapControlsPan(e,t,i){if(!e.panDelta)return;const r=t.center.lat,n=t.zoom;t.setCenter(xi(e.panDelta,t).wrap()),t.setZoom(n+bi(r,t.center.lat))}cameraForBoxAndBearing(e,i,r,n,o){const s=Kt(e,i,r,n,o),a=i.left/o.width*2-1,l=(o.width-i.right)/o.width*2-1,c=i.top/o.height*-2+1,u=(o.height-i.bottom)/o.height*-2+1,h=t.bJ(r.getWest(),r.getEast())<0,d=h?r.getEast():r.getWest(),p=h?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),m=Math.min(r.getNorth(),r.getSouth()),g=d+.5*t.bJ(d,p),y=f+.5*t.bJ(f,m),_=o.clone();_.setCenter(s.center),_.setBearing(s.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(s.zoom);const v=_.modelViewProjectionMatrix,b=[gi(r.getNorthWest()),gi(r.getNorthEast()),gi(r.getSouthWest()),gi(r.getSouthEast()),gi(new t.W(p,y)),gi(new t.W(d,y)),gi(new t.W(g,f)),gi(new t.W(g,m))],x=gi(s.center);let w=Number.POSITIVE_INFINITY;for(const e of b)a<0&&(w=Fi.getLesserNonNegativeNonNull(w,Fi.solveVectorScale(e,x,v,"x",a))),l>0&&(w=Fi.getLesserNonNegativeNonNull(w,Fi.solveVectorScale(e,x,v,"x",l))),c>0&&(w=Fi.getLesserNonNegativeNonNull(w,Fi.solveVectorScale(e,x,v,"y",c))),u<0&&(w=Fi.getLesserNonNegativeNonNull(w,Fi.solveVectorScale(e,x,v,"y",u)));if(Number.isFinite(w)&&0!==w)return s.zoom=Math.min(_.zoom+t.ar(w),e.maxZoom),s;Yt()}handleJumpToCenterZoom(e,i){const r=e.center.lat,n=e.applyConstrain(i.center?t.W.convert(i.center):e.center,e.zoom).center;e.setCenter(n.wrap());const o=void 0!==i.zoom?+i.zoom:e.zoom+bi(r,n.lat);e.zoom!==o&&e.setZoom(o)}handleEaseTo(e,i){const r=e.zoom,n=e.center,o=e.padding,s={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},l=void 0!==i.zoom,c=!e.isPaddingEqual(i.padding);let u=!1;const h=i.center?t.W.convert(i.center):n,d=e.applyConstrain(h,r).center;Gt(e,d);const p=e.clone();p.setCenter(d),p.setZoom(l?+i.zoom:r+bi(n.lat,h.lat)),p.setBearing(i.bearing);const f=new t.P(t.al(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.al(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(d,f);const m=(i.offset&&i.offsetAsPoint.mag())>0?p.center:d,g=l?+i.zoom:r+bi(n.lat,m.lat),y=r+bi(n.lat,0),_=g+bi(m.lat,0),v=t.bJ(n.lng,m.lng),b=t.bJ(n.lat,m.lat),x=t.ao(_-y);return u=g!==r,{easeFunc:r=>{if(t.bn(s,a)||Jt({startEulerAngles:s,endEulerAngles:a,tr:e,k:r,useSlerp:s.roll!=a.roll}),c&&e.interpolatePadding(o,i.padding,r),i.around)t.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const t=_>y?Math.min(2,x):Math.max(.5,x),i=Math.pow(t,1-r),o=Ti(n,v,b,r*i);e.setCenter(o.wrap())}if(u){const i=t.H.number(y,_,r)+bi(0,e.center.lat);e.setZoom(i)}},isZooming:u,elevationCenter:m}}handleFlyTo(e,i){const r=void 0!==i.zoom,n=e.center,o=e.zoom,s=e.padding,a=!e.isPaddingEqual(i.padding),l=e.applyConstrain(t.W.convert(i.center||i.locationAtOffset),o).center,c=r?+i.zoom:e.zoom+bi(e.center.lat,l.lat),u=e.clone();u.setCenter(l),u.setZoom(c),u.setBearing(i.bearing);const h=new t.P(t.al(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.al(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));u.setLocationAtPoint(l,h);const d=u.center;Gt(e,d);const p=function(e,i,r){const n=gi(i),o=gi(r),s=t.b3(n,o),a=Math.acos(s),l=fi(e);return a/(2*Math.PI)*l}(e,n,d),f=o+bi(n.lat,0),m=c+bi(d.lat,0),g=t.ao(m-f);let y;if("number"==typeof i.minZoom){const r=+i.minZoom+bi(d.lat,0),n=Math.min(r,f,m)+bi(0,d.lat),o=e.applyConstrain(d,n).zoom+bi(d.lat,0);y=t.ao(o-f)}const _=t.bJ(n.lng,d.lng),v=t.bJ(n.lat,d.lat);return{easeFunc:(r,o,l,u)=>{const h=Ti(n,_,v,l);a&&e.interpolatePadding(s,i.padding,r);const p=1===r?d:h;e.setCenter(p.wrap());const m=f+t.ar(o);e.setZoom(1===r?c:m+bi(0,p.lat))},scaleOfZoom:g,targetCenter:d,scaleOfMinZoom:y,pixelPathLength:p}}static solveVectorScale(e,t,i,r,n){const o="x"===r?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],s=[i[3],i[7],i[11],i[15]],a=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],l=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],c=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2];return c+n*l===a+n*u||s[3]*(a-c)+o[3]*(u-l)+a*u==c*l?null:(c+o[3]-n*u-n*s[3])/(c-a-n*u+n*l)}static getLesserNonNegativeNonNull(e,t){return null!==t&&t>=0&&t<e?t:e}}class Di{constructor(e){this._globe=e,this._mercatorCameraHelper=new Qt,this._verticalPerspectiveCameraHelper=new Fi}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){this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,r,n){return this.currentHelper.cameraForBoxAndBearing(e,t,i,r,n)}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)}}const ki=(e,i)=>t.C(e,null==i?void 0:i.filter((e=>"source.canvas"!==e.identifier))),Oi=t.bN();class Ri extends t.E{constructor(e,i={}){var r,n;super(),this._rtlPluginLoaded=()=>{for(const e in this.tileManagers){const t=this.tileManagers[e].getSource().type;"vector"!==t&&"geojson"!==t||this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new R(O(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",((e,t)=>
2this.getGlyphs(e,t))),this.dispatcher.registerMessageHandler("GI",((e,t)=>this.getImages(e,t))),this.dispatcher.registerMessageHandler("GDA",((e,t)=>this.getDashes(e,t))),this.imageManager=new y,this.imageManager.setEventedParent(this);const o=(null===(r=e._container)||void 0===r?void 0:r.lang)||"undefined"!=typeof document&&(null===(n=document.documentElement)||void 0===n?void 0:n.lang)||void 0;this.glyphManager=new T(e._requestManager,i.localIdeographFontFamily,o),this.lineAtlas=new M(256,512),this.crossTileSymbolIndex=new Dt,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",t.bO()),ce().on(se,this._rtlPluginLoaded),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.tileManagers[e.sourceId];if(!t)return;const i=t.getSource();if(null==i?void 0:i.vectorLayerIds)for(const e in this._layers){const t=this._layers[e];t.source===i.id&&this._validateLayer(t)}}))}_setInitialValues(){var e;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new t.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null===(e=this.crossTileSymbolIndex)||void 0===e?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,i){var r,n,o;this._checkLoaded();const s=null===i?null!==(o=null===(n=null===(r=this.stylesheet.state)||void 0===r?void 0:r[e])||void 0===n?void 0:n.default)&&void 0!==o?o:null:i;if(t.bQ(s,this._globalState[e]))return this;this._globalState[e]=s,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const i=[];for(const r in e)!t.bQ(this._globalState[r],e[r].default)&&(i.push(r),this._globalState[r]=e[r].default);this._applyGlobalStateChanges(i)}_applyGlobalStateChanges(e){if(0===e.length)return;const t=new Set,i={};for(const r of e){i[r]=this._globalState[r];for(const e in this._layers){const i=this._layers[e],n=i.getLayoutAffectingGlobalStateRefs(),o=i.getPaintAffectingGlobalStateRefs(),s=i.getVisibilityAffectingGlobalStateRefs();if(n.has(r)&&t.add(i.source),o.has(r))for(const{name:e,value:t}of o.get(r))this._updatePaintProperty(i,e,t);(null==s?void 0:s.has(r))&&(i.recalculateVisibility(),this._updateLayer(i))}}this.dispatcher.broadcast("UGS",i);for(const e in this.tileManagers)t.has(e)&&(this._reloadSource(e),this._changed=!0)}loadURL(e){return t._(this,arguments,void 0,(function*(e,i={},r){this.fire(new t.n("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate,this._loadStyleRequest=new AbortController;const n=this._loadStyleRequest;try{const o=yield this.map._requestManager.transformRequest(e,"Style");t.bR(n.signal);const s=yield t.k(o,n);this._loadStyleRequest===n&&(this._loadStyleRequest=null),this._load(s.data,i,r)}catch(e){this._loadStyleRequest===n&&(this._loadStyleRequest=null),e&&!n.signal.aborted&&this.fire(new t.l(t.d(e)))}}))}loadJSON(e,i={},r){this.fire(new t.n("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,a.frameAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(e,i,r)})).catch((()=>{}))}loadEmpty(){this.fire(new t.n("dataloading",{dataType:"style"})),this._load(Oi,{validate:!1})}_load(e,i,r){var n,o;let s=i.transformStyle?i.transformStyle(r,e):e;if(!i.validate||!ki(this,t.F(s))){s=Object.assign({},s),this._loaded=!0,this.stylesheet=s;for(const e in s.sources)this.addSource(e,s.sources[e],{validate:!1});s.sprite?this._loadSprite(s.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(s.glyphs),this._createLayers(),this.light=new P(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new C(this.stylesheet.sky),this.map.setTerrain(null!==(o=this.stylesheet.terrain)&&void 0!==o?o:null),this.fire(new t.n("data",{dataType:"style"})),this.fire(new t.n("style.load"))}}_createLayers(){var e,i,r;
2const n=t.bS(this.stylesheet.layers);this.setGlobalState(null!==(e=this.stylesheet.state)&&void 0!==e?e:null),this.dispatcher.broadcast("SL",n),this._order=n.map((e=>e.id)),this._layers={},this._serializedLayers=null;for(const e of n){const n=t.bT(e,this._globalState);if(n.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=n,t.bU(n)&&this.tileManagers[n.source]){const t=null!==(r=null===(i=e.paint)||void 0===i?void 0:i["raster-fade-duration"])&&void 0!==r?r:n.paint.get("raster-fade-duration");this.tileManagers[n.source].setRasterFadeDuration(t)}}}_loadSprite(e,i=!1,r=void 0){this.imageManager.setLoaded(!1);const n=new AbortController;let o;this._spriteRequest=n,function(e,i,r,n){return t._(this,void 0,void 0,(function*(){const o=f(e),s=r>1?"@2x":"",l={},c={};for(const{id:e,url:r}of o){const o=yield i.transformRequest(m(r,s,".json"),"SpriteJSON");l[e]=t.k(o,n);const a=yield i.transformRequest(m(r,s,".png"),"SpriteImage");c[e]=h.getImage(a,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(e,i){return t._(this,void 0,void 0,(function*(){const t={};for(const r in e){t[r]={};const n=a.getImageCanvasContext((yield i[r]).data),o=(yield e[r]).data;for(const e in o){const{width:i,height:s,x:a,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:m}=o[e];t[r][e]={data:null,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:m,spriteData:{width:i,height:s,x:a,y:l,context:n}}}}return t}))}(l,c)}))}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((e=>{if(this._spriteRequest=null,e)for(const t in e){this._spritesImagesIds[t]=[];const r=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in e))):[];for(const e of r)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(const r in e[t]){const n="default"===t?r:`${t}:${r}`;this._spritesImagesIds[t].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,e[t][r],!1):this.imageManager.addImage(n,e[t][r]),i&&(this._changedImages[n]=!0)}}})).catch((e=>{this._spriteRequest=null,o=e,n.signal.aborted||this.fire(new t.l(o))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.n("data",{dataType:"style"})),r&&r(o)}))}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.n("data",{dataType:"style"}))}_validateLayer(e){const i=this.tileManagers[e.source];if(!i)return;const r=e.sourceLayer;if(!r)return;const n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&!n.vectorLayerIds.includes(r))&&this.fire(new t.l(new Error(`Source layer "${r}" does not exist on source "${n.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,i=!1){const r=this._serializedAllLayers();if(!e||0===e.length)return Object.values(i?t.bV(r):r);const n=[];for(const o of e)if(r[o]){const e=i?t.bV(r[o]):r[o];n.push(e)}return n}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const t=Object.keys(this._layers);for(const i of t){const t=this._layers[i];"custom"!==t.type&&(e[i]=t.serialize())}return e}hasTransitions(){var e,t,i;if(null===(e=this.light)||void 0===e?void 0:e.hasTransition())return!0;if(null===(t=this.sky)||void 0===t?void 0:t.hasTransition())return!0;if(null===(i=this.projection)||void 0===i?void 0:i.hasTransition())return!0;for(const e in this.tileManagers)if(this.tileManagers[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(i){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const e in this._updatedSources){const t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const r={};for(const e in this.tileManagers){const t=this.tileManagers[e];r[e]=t.used,t.used=!1}for(const t of this._order){const i=this._layers[t];
vendor: 9,858 bytes, line 2
2i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.tileManagers[i.source].used=!0)}for(const e in r){const i=this.tileManagers[e];!!r[e]!=!!i.used&&i.fire(new t.n("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new t.n("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var r;this._checkLoaded();const n=this.serialize();if(e=i.transformStyle?i.transformStyle(n,e):e,(null===(r=i.validate)||void 0===r||r)&&ki(this,t.F(e)))return!1;(e=t.bV(e)).layers=t.bS(e.layers);const o=t.bW(n,e),s=this._getOperationsToPerform(o);if(s.unimplemented.length>0)throw new Error(`Unimplemented: ${s.unimplemented.join(", ")}.`);if(0===s.operations.length)return!1;for(const e of s.operations)e();return this.stylesheet=e,this._serializedLayers=null,this.fire(new t.n("style.load",{style:this})),!0}_getOperationsToPerform(e){const t=[],i=[];for(const r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push((()=>this.addLayer.apply(this,r.args)));break;case"removeLayer":t.push((()=>this.removeLayer.apply(this,r.args)));break;case"setPaintProperty":t.push((()=>this.setPaintProperty.apply(this,r.args)));break;case"setLayoutProperty":t.push((()=>this.setLayoutProperty.apply(this,r.args)));break;case"setFilter":t.push((()=>this.setFilter.apply(this,r.args)));break;case"addSource":t.push((()=>this.addSource.apply(this,r.args)));break;case"removeSource":t.push((()=>this.removeSource.apply(this,r.args)));break;case"setLayerZoomRange":t.push((()=>this.setLayerZoomRange.apply(this,r.args)));break;case"setLight":t.push((()=>this.setLight.apply(this,r.args)));break;case"setGeoJSONSourceData":t.push((()=>this.setGeoJSONSourceData.apply(this,r.args)));break;case"setGlyphs":t.push((()=>this.setGlyphs.apply(this,r.args)));break;case"setSprite":t.push((()=>this.setSprite.apply(this,r.args)));break;case"setTerrain":t.push((()=>this.map.setTerrain.apply(this,r.args)));break;case"setSky":t.push((()=>this.setSky.apply(this,r.args)));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setGlobalState":t.push((()=>this.setGlobalState.apply(this,r.args)));break;case"setTransition":t.push((()=>{}));break;default:i.push(r.command)}return{operations:t,unimplemented:i}}addImage(e,i){if(this.getImage(e))return this.fire(new t.l(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.l(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.n("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,r={}){var n;if(this._checkLoaded(),void 0!==this.tileManagers[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(i.type)&&this._validate(t.F.source,`sources.${e}`,i,null,r))return;(null===(n=this.map)||void 0===n?void 0:n._collectResourceTiming)&&(i.collectResourceTiming=!0);const o=this.tileManagers[e]=new Oe(e,i,this.dispatcher);o.style=this,o.setEventedParent(this,(()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e}))),o.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error(`There is no source with this ID=${e}`);for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.l(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],i.fire(new t.n("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error(`There is no source with this ID=${e}`);const i=this.tileManagers[e].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){var t;return null===(t=this.tileManagers[e])||void 0===t?void 0:t.getSource()}addLayer(e,i,r={}){this._checkLoaded();const n=e.id;if(this.getLayer(n))return void this.fire(new t.l(new Error(`Layer "${n}" already exists on this map.`)));let o;if("custom"===e.type){if(ki(this,t.bX(e)))return;o=t.bT(e,this._globalState)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=t.bV(e),e=t.e(e,{source:n})),this._validate(t.F.layer,`layers.${n}`,e,{arrayIndex:-1},r))return;o=t.bT(e,this._globalState),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)this.fire(new t.l(new Error(`Cannot add layer "${n}" before non-existing layer "${i}".`)));else{if(this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source&&"custom"!==o.type){const e=this._removedLayers[n];delete this._removedLayers[n],e.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.tileManagers[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.l(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const r=this._order.indexOf(e);this._order.splice(r,1);const n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new t.l(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.l(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,r){this._checkLoaded();const n=this.getLayer(e);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new t.l(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,r={}){this._checkLoaded();const n=this.getLayer(e);if(n){if(!t.bQ(n.filter,i))return null==i?(n.setFilter(void 0),void this._updateLayer(n)):void(this._validate(t.F.filter,`layers.${n.id}.filter`,i,null,r)||(n.setFilter(t.bV(i)),this._updateLayer(n)))}else this.fire(new t.l(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bV(this.getLayer(e).filter)}setLayoutProperty(e,i,r,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bQ(o.getLayoutProperty(i),r)||(o.setLayoutProperty(i,r,n),this._updateLayer(o)):this.fire(new t.l(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.l(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,r,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bQ(o.getPaintProperty(i),r)||this._updatePaintProperty(o,i,r,n):this.fire(new t.l(new Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,i,r,n={}){e.setPaintProperty(i,r,n)&&this._updateLayer(e),t.bU(e)&&"raster-fade-duration"===i&&this.tileManagers[e.source].setRasterFadeDuration(r),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,i){this._checkLoaded();const r=e.source,n=e.sourceLayer,o=this.tileManagers[r];if(void 0===o)return void this.fire(new t.l(new Error(`The source '${r}' does not exist in the map's style.`)));const s=o.getSource().type;"geojson"===s&&n?this.fire(new t.l(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||n?(void 0===e.id&&this.fire(new t.l(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,e.id,i)):this.fire(new t.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const r=e.source,n=this.tileManagers[r];if(void 0===n)return void this.fire(new t.l(new Error(`The source '${r}' does not exist in the map's style.`)));
2const o=n.getSource().type,s="vector"===o?e.sourceLayer:void 0;"vector"!==o||s?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.l(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(s,e.id,i):this.fire(new t.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,r=e.sourceLayer,n=this.tileManagers[i];if(void 0!==n)return"vector"!==n.getSource().type||r?(void 0===e.id&&this.fire(new t.l(new Error("The feature id parameter must be provided."))),n.getFeatureState(r,e.id)):void this.fire(new t.l(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.l(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){var e;return t.e({duration:300,delay:0},null===(e=this.stylesheet)||void 0===e?void 0:e.transition)}serialize(){if(!this._loaded)return;const e=t.bY(this.tileManagers,(e=>e.serialize())),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,n=this.stylesheet;return t.bZ({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:e,layers:i,terrain:r},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.tileManagers[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,i={},r=[];for(let n=this._order.length-1;n>=0;n--){const o=this._order[n];if(t(o)){i[o]=n;for(const t of e){const e=t[o];if(e)for(const t of e)r.push(t)}}}r.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const n=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if(t(s))for(let e=r.length-1;e>=0;e--){const t=r[e].feature;if(i[t.layer.id]<o)break;n.push(t),r.pop()}else for(const t of e){const e=t[s];if(e)for(const t of e)n.push(t.feature)}}return n}queryRenderedFeatures(e,i,r){(null==i?void 0:i.filter)&&this._validate(t.F.filter,"queryRenderedFeatures.filter",i.filter,null,i);const n={};if(null==i?void 0:i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new t.l(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.l(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];n[i.source]=!0}}const o=[];i.availableImages=this._availableImages;const s=this._serializedAllLayers(),a=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,l=Object.assign(Object.assign({},i),{layers:a,globalState:this._globalState});for(const t in this.tileManagers)i.layers&&!n[t]||o.push(B(this.tileManagers[t],this._layers,s,e,l,r,this.map.terrain?(e,t,i)=>this.map.terrain.getElevation(e,t,i):void 0));return this.placement&&o.push(function(e,t,i,r,n,o,s){const a={},l=o.queryRenderedSymbols(r),c=[];for(const e of Object.keys(l).map(Number))c.push(s[e]);c.sort(V);for(const i of c){const r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,{filterSpec:n.filter,globalState:n.globalState},n.layers,n.availableImages,e);for(const e in r){a[e]||(a[e]=[]);const t=r[e];t.sort(((e,t)=>{const r=i.featureSortOrder;if(r){const i=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex}));for(const i of t)a[e].push(i)}}return function(e,t,i){for(const r in e)for(const n of e[r])j(n,i[t[r].source]);return e}(a,e,i)}(this._layers,s,this.tileManagers,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){(null==i?void 0:i.filter)&&this._validate(t.F.filter,"querySourceFeatures.filter",i.filter,null,i);const r=this.tileManagers[e];return r?function(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],n={};for(const e of i){const i=e.tileID.canonical.key;n[i]||(n[i]=!0,e.querySourceFeatures(r,t))}return r}(r,i?Object.assign(Object.assign({},i),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const r=this.light.getLight();let n=!1;for(const i in e)if(!t.bQ(e[i],r[i])){n=!0;break}if(!n)return;const o={now:c(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(o)}getProjection(){var e;return null===(e=this.stylesheet)||void 0===e?void 0:e.projection}setProjection(e){this._checkLoaded();const t=null!=e?e:{type:"mercator"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){var e;return null===(e=this.stylesheet)||void 0===e?void 0:e.sky}setSky(e,i={}){this._checkLoaded();const r=this.getSky();let n=!1;if(!e&&!r)return;if(e&&!r)n=!0;else if(!e&&r)n=!0;else for(const i in e)if(!t.bQ(e[i],r[i])){n=!0;break}if(!n)return;const o={now:c(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,i),this.sky.updateTransitions(o)}_setProjectionInternal(e){const i=function(e,i){const r={constrainOverride:i};if(Array.isArray(e)){const t=new pi({type:e});return{projection:t,transform:new Li(r),cameraHelper:new Di(t)}}switch(e){case"mercator":return{projection:new jt,transform:new Xt(r),cameraHelper:new Qt};case"globe":{const e=new pi({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new Li(r),cameraHelper:new Di(e)}}case"vertical-perspective":return{projection:new hi,transform:new Ai(r),cameraHelper:new Fi};default:return t.w(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new jt,transform:new Xt(r),cameraHelper:new Qt}}}(e,this.map.transformConstrain);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const e in this.tileManagers)this.tileManagers[e].reload()}_validate(e,i,r,n,o={}){return!1!==(null==o?void 0:o.validate)&&ki(this,e.call(t.F,t.e({key:i,style:this.serialize(),value:r,styleSpec:t.x},n)))}_remove(e=!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),ce().off(se,this._rtlPluginLoaded);for(const e in this._layers)this._layers[e].setEventedParent(null);for(const e in this.tileManagers){const t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(const t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.tileManagers)this._reloadSource(e)}_updatePlacement(e,t,i,r,n=!1){let o=!1,s=!1;const a={};for(const t of this._order){const i=this._layers[t];
vendor: 7,078 bytes, line 2
2if("symbol"!==i.type)continue;if(!a[i.source]){const e=this.tileManagers[i.source];a[i.source]=e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const r=this.crossTileSymbolIndex.addLayer(i,a[i.source],e.center.lng);o||(o=r)}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n||(n=this._layerOrderChanged||0===i),(n||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c(),e.zoom))&&(this.pauseablePlacement=new Ct(e,this.map.terrain,this._order,n,t,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,a),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(const e of this._order){const t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,a[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c())}_releaseSymbolFadeTiles(){for(const e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}getImages(e,i){return t._(this,void 0,void 0,(function*(){const e=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const t=this.tileManagers[i.source];return t&&t.setDependencies(i.tileID.key,i.type,i.icons),e}))}getGlyphs(e,i){return t._(this,void 0,void 0,(function*(){const e=yield this.glyphManager.getGlyphs(i.stacks),t=this.tileManagers[i.source];return t&&t.setDependencies(i.tileID.key,i.type,[""]),e}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.F.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getDashes(e,i){return t._(this,void 0,void 0,(function*(){const e={};for(const[t,r]of Object.entries(i.dashes))e[t]=this.lineAtlas.getDash(r.dasharray,r.round);return e}))}addSprite(e,i,r={},n){this._checkLoaded();const o=[{id:e,url:i}],s=[...f(this.stylesheet.sprite),...o];this._validate(t.F.sprite,"sprite",s,null,r)||(this.stylesheet.sprite=s,this._loadSprite(o,!0,n))}removeSprite(e){this._checkLoaded();const i=f(this.stylesheet.sprite);if(i.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;i.splice(i.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.n("data",{dataType:"style"}))}else this.fire(new t.l(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return f(this.stylesheet.sprite)}setSprite(e,i={},r){this._checkLoaded(),e&&this._validate(t.F.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const e in this.tileManagers){const t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const e in this._layers){const t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var zi=t.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ni{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,r,n,o,s,a,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!c&&e<r.length;e++)this.boundPaintVertexBuffers[e]!==r[e]&&(c=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==a||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,r,n,o,s,a,l):(e.bindVertexArray.set(this.vao),s&&s.bind(),(null==n?void 0:n.dynamicDraw)&&n.bind(),a&&a.bind(),l&&l.bind())}freshBind(e,t,i,r,n,o,s,a){const l=e.numAttributes,c=this.context,u=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=a,t.enableAttributes(u,e);for(const t of i)t.enableAttributes(u,e);o&&o.enableAttributes(u,e),s&&s.enableAttributes(u,e),a&&a.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,n);for(const t of i)t.bind(),t.setVertexAttribPointers(u,e,n);o&&(o.bind(),o.setVertexAttribPointers(u,e,n)),r&&r.bind(),s&&(s.bind(),s.setVertexAttribPointers(u,e,n)),a&&(a.bind(),a.setVertexAttribPointers(u,e,n)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Bi=(e,i,r,n,o)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:i,u_fog_color:r?r.properties.get("fog-color"):t.bo.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:r?r.calculateFogBlendOpacity(n):0,u_horizon_color:r?r.properties.get("horizon-color"):t.bo.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),Vi={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 ji(e){const t=[];for(const i of e){if(null===i)continue;const e=i.split(" ");t.push(e.pop())}return t}class Ui{constructor(e,i,r,n,o,s,a,l,c=[]){const u=e.gl;this.program=u.createProgram();const h=ji(i.staticAttributes),d=r?r.getBinderAttributes():[],p=h.concat(d),f=Ot.prelude.staticUniforms?ji(Ot.prelude.staticUniforms):[],m=a.staticUniforms?ji(a.staticUniforms):[],g=i.staticUniforms?ji(i.staticUniforms):[],y=r?r.getBinderUniforms():[],_=f.concat(m).concat(g).concat(y),v=[];for(const e of _)v.includes(e)||v.push(e);const b=r?r.defines():[];si(u)&&b.unshift("#version 300 es"),o&&b.push("#define OVERDRAW_INSPECTOR;"),s&&b.push("#define TERRAIN3D;
2"),l&&b.push(l),c&&b.push(...c);let x=b.concat(Ot.prelude.fragmentSource,a.fragmentSource,i.fragmentSource).join("\n"),w=b.concat(Ot.prelude.vertexSource,a.vertexSource,i.vertexSource).join("\n");si(u)||(x=function(e){return e.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(x),w=function(e){return e.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(w));const T=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(T,x),u.compileShader(T),!u.getShaderParameter(T,u.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${u.getShaderInfoLog(T)}`);u.attachShader(this.program,T);const E=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(E,w),u.compileShader(E),!u.getShaderParameter(E,u.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${u.getShaderInfoLog(E)}`);u.attachShader(this.program,E),this.attributes={};const S={};this.numAttributes=p.length;for(let e=0;e<this.numAttributes;e++)p[e]&&(u.bindAttribLocation(this.program,e,p[e]),this.attributes[p[e]]=e);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw new Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);u.deleteShader(E),u.deleteShader(T);for(const e of v)if(e&&!S[e]){const t=u.getUniformLocation(this.program,e);t&&(S[e]=t)}this.fixedUniforms=n(e,S),this.terrainUniforms=((e,i)=>({u_depth:new t.b_(e,i.u_depth),u_terrain:new t.b_(e,i.u_terrain),u_terrain_dim:new t.bp(e,i.u_terrain_dim),u_terrain_matrix:new t.c0(e,i.u_terrain_matrix),u_terrain_unpack:new t.c1(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.bp(e,i.u_terrain_exaggeration)}))(e,S),this.projectionUniforms=((e,i)=>({u_projection_matrix:new t.c0(e,i.u_projection_matrix),u_projection_tile_mercator_coords:new t.c1(e,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.c1(e,i.u_projection_clipping_plane),u_projection_transition:new t.bp(e,i.u_projection_transition),u_projection_fallback_matrix:new t.c0(e,i.u_projection_fallback_matrix)}))(e,S),this.binderUniforms=r?r.getUniforms(e,S):[]}draw(e,t,i,r,n,o,s,a,l,c,u,h,d,p,f,m,g,y,_){var v;const b=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(n),e.setCullFace(o),a){e.activeTexture.set(b.TEXTURE2),b.bindTexture(b.TEXTURE_2D,a.depthTexture),e.activeTexture.set(b.TEXTURE3),b.bindTexture(b.TEXTURE_2D,a.texture);for(const e in this.terrainUniforms)this.terrainUniforms[e].set(a[e])}if(l)for(const e in l)this.projectionUniforms[Vi[e]].set(l[e]);if(s)for(const e in this.fixedUniforms)this.fixedUniforms[e].set(s[e]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let x=0;switch(t){case b.LINES:x=2;break;case b.TRIANGLES:x=3;break;case b.LINE_STRIP:x=1}for(const i of d.get())i.vaos||(i.vaos={}),(v=i.vaos)[c]||(v[c]=new Ni),i.vaos[c].bind(e,this,u,m?m.getPaintVertexBuffers():[],h,i.vertexOffset,g,y,_),b.drawElements(t,i.primitiveLength*x,b.UNSIGNED_SHORT,i.primitiveOffset*x*2)}}function Gi(e,i,r){const n=1/t.aK(r,1,i.transform.tileZoom),o=Math.pow(2,r.tileID.overscaledZ),s=r.tileSize*Math.pow(2,i.transform.tileZoom)/o,a=s*(r.tileID.canonical.x+r.tileID.wrap*o),l=s*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[n,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[a>>16,l>>16],u_pixel_coord_lower:[65535&a,65535&l]}}const $i=(e,i,r,n)=>{const o=e.style.light,s=o.properties.get("position"),a=[s.x,s.y,s.z],l=t.c4();"viewport"===o.properties.get("anchor")&&t.c5(l,e.transform.bearingInRadians),t.c6(a,a,l);const c=e.transform.transformLightDirection(a),u=o.properties.get("color");return{u_lightpos:a,u_lightpos_globe:c,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:n}},qi=(e,i,r,n,o,s,a)=>t.e($i(e,i,r,n),Gi(s,e,a),{u_height_factor:-Math.pow(2,o.overscaledZ
vendor: 4,950 bytes, line 2
2)/a.tileSize/8}),Zi=(e,i,r,n)=>t.e(Gi(i,e,r),{u_fill_translate:n}),Wi=(e,t)=>({u_world:e,u_fill_translate:t}),Hi=(e,i,r,n,o)=>t.e(Zi(e,i,r,o),{u_world:n}),Xi=(e,i,r,n,o)=>{const s=e.transform;let a,l,c=0;if("map"===r.paint.get("circle-pitch-alignment")){const e=t.aK(i,1,s.zoom);a=!0,l=[e,e],c=e/(t.a6*Math.pow(2,i.tileID.overscaledZ))*2*Math.PI*o}else a=!1,l=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+a,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:n}},Yi=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),Ji=e=>({u_viewport_size:[e.width,e.height]}),Ki=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),Qi=(e,i,r,n)=>{const o=t.aK(e,1,i)/(t.a6*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:t.aK(e,1,i),u_intensity:r,u_globe_extrude_scale:o}},er=(e,i,r,n)=>{const o=t.O();t.c7(o,0,e.width,e.height,0,0,1);const s=e.context.gl;return{u_matrix:o,u_world:[s.drawingBufferWidth,s.drawingBufferHeight],u_image:r,u_color_ramp:n,u_opacity:i.paint.get("heatmap-opacity")}},tr=(e,t,i)=>{const r=i.paint.get("hillshade-accent-color");let n;switch(i.paint.get("hillshade-method")){case"basic":n=4;break;case"combined":n=1;break;case"igor":n=2;break;case"multidirectional":n=3;break;default:n=0}const o=i.getIlluminationProperties();for(let t=0;t<o.directionRadians.length;t++)"viewport"===i.paint.get("hillshade-illumination-anchor")&&(o.directionRadians[t]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:rr(0,t.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:o.altitudeRadians,u_azimuths:o.directionRadians,u_accent:r,u_method:n,u_highlights:o.highlightColor,u_shadows:o.shadowColor}},ir=(e,i)=>{const r=i.stride,n=t.O();return t.c7(n,0,t.a6,-t.a6,0,0,1),t.Q(n,n,[0,-t.a6,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}};function rr(e,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new t.a7(0,n/r).toLngLat().lat,new t.a7(0,(n+1)/r).toLngLat().lat]}const nr=(e,t,i=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:e.paint.get("color-relief-opacity")}),or=(e,i,r,n)=>{const o=e.transform;return{u_translation:hr(e,i,r),u_ratio:n/t.aK(i,1,o.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},sr=(e,i,r,n,o)=>t.e(or(e,i,r,n),{u_image:0,u_image_height:o}),ar=(e,i,r,n,o)=>{const s=e.transform,a=ur(i,s);return{u_translation:hr(e,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:n/t.aK(i,1,s.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[a,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},lr=(e,i,r,n,o)=>{const s=ur(i,e.transform);return t.e(or(e,i,r,n),{u_tileratio:s,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image:0,u_mix:o.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},cr=(e,i,r,n,o,s)=>{const a=ur(i,e.transform);return t.e(or(e,i,r,n),{u_image:0,u_image_height:s,u_tileratio:a,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image_dash:1,u_mix:o.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function ur(e,i){return 1/t.aK(e,1,i.tileZoom)}function hr(e,i,r){return t.aL(e.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const dr=(e,t,i,r,n)=>{return{u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(s=r.paint.get("raster-saturation"),s>0?1-1/(1.001-s):-s),u_contrast_factor:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:pr(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]};var o,s};function pr(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const fr=(e,t,i,r,n,o,s,a,l,c,u,h,d)=>{const p=s.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:p.width/p.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:o,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:d}},mr=(e,i,r,n,o,s,a,l,c,u,h,d,p,f)=>{const m=a.transform;return t.e(fr(e,i,r,n,o,s,a,l,c,u,h,d,f),{u_gamma_scale:n?Math.cos(m.pitch
vendor: 7,566 bytes, line 2
2*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:p?1:0,u_is_plain:1})},gr=(e,i,r,n,o,s,a,l,c,u,h,d,p)=>t.e(mr(e,i,r,n,o,s,a,l,c,u,!0,h,!0,p),{u_texsize_icon:d,u_texture_icon:1}),yr=(e,t)=>({u_opacity:e,u_color:t}),_r=(e,i,r,n,o)=>t.e(function(e,i,r,n){const o=r.imageManager.getPattern(e.from.toString()),s=r.imageManager.getPattern(e.to.toString()),{width:a,height:l}=r.imageManager.getPixelSize(),c=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,r.transform.tileZoom)/c,h=u*(n.tileID.canonical.x+n.tileID.wrap*c),d=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[a,l],u_mix:i.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/t.aK(n,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(r,o,i,n),{u_opacity:e}),vr=(e,t)=>{},br={fillExtrusion:(e,i)=>({u_lightpos:new t.c2(e,i.u_lightpos),u_lightpos_globe:new t.c2(e,i.u_lightpos_globe),u_lightintensity:new t.bp(e,i.u_lightintensity),u_lightcolor:new t.c2(e,i.u_lightcolor),u_vertical_gradient:new t.bp(e,i.u_vertical_gradient),u_opacity:new t.bp(e,i.u_opacity),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillExtrusionPattern:(e,i)=>({u_lightpos:new t.c2(e,i.u_lightpos),u_lightpos_globe:new t.c2(e,i.u_lightpos_globe),u_lightintensity:new t.bp(e,i.u_lightintensity),u_lightcolor:new t.c2(e,i.u_lightcolor),u_vertical_gradient:new t.bp(e,i.u_vertical_gradient),u_height_factor:new t.bp(e,i.u_height_factor),u_opacity:new t.bp(e,i.u_opacity),u_fill_translate:new t.c3(e,i.u_fill_translate),u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade)}),fill:(e,i)=>({u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillPattern:(e,i)=>({u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillOutline:(e,i)=>({u_world:new t.c3(e,i.u_world),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillOutlinePattern:(e,i)=>({u_world:new t.c3(e,i.u_world),u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade),u_fill_translate:new t.c3(e,i.u_fill_translate)}),circle:(e,i)=>({u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_scale_with_map:new t.b_(e,i.u_scale_with_map),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_extrude_scale:new t.c3(e,i.u_extrude_scale),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_globe_extrude_scale:new t.bp(e,i.u_globe_extrude_scale),u_translate:new t.c3(e,i.u_translate)}),collisionBox:(e,i)=>({u_pixel_extrude_scale:new t.c3(e,i.u_pixel_extrude_scale)}),collisionCircle:(e,i)=>({u_viewport_size:new t.c3(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.b$(e,i.u_color),u_overlay:new t.b_(e,i.u_overlay),u_overlay_scale:new t.bp(e,i.u_overlay_scale)}),depth:vr,clippingMask:vr,heatmap:(e,i)=>({u_extrude_scale:new t.bp(e,i.u_extrude_scale),u_intensity:new t.bp(e,i.u_intensity),u_globe_extrude_scale:new t.bp(e,i.u_globe_extrude_scale)}),heatmapTexture:(e,i)=>({u_matrix:new t.c0(e,i.u_matrix),u_world:new t.c3(e,i.u_world),u_image:new t.b_(e,i.u_image),u_color_ramp:new t.b_(e,i.u_color_ramp),u_opacity:new t.bp(e,i.u_opacity)}),hillshade:(e,i)=>({u_image:new t.b_(e,i.u_image),u_latrange:new t.c3(e,i.u_latrange),u_exaggeration:new t.bp(e,i.u_exaggeration),u_altitudes:new t.c9(e,i.u_altitudes),u_azimuths:new t.c9(e,i.u_azimuths),u_accent:new t.b$(e,i.u_accent),u_method:new t.b_(e,i.u_method),u_shadows:new t.c8(e,i.u_shadows),u_highlights:new t.c8(e,i.u_highlights)}),hillshadePrepare:(e,i)=>({u_matrix:new t.c0(e,i.u_matrix),u_image:new t.b_(e,i.u_image),u_dimension:new t.c3(e,i.u_dimension),u_zoom:new t.bp(e,i.u_zoom),u_unpack:new t.c1(e,i.u_unpack)}),colorRelief:(e,i)=>({u_image:new t.b_(e,i.u_image),u_unpack:new t.c1(e,i.u_unpack),u_dimension:new t.c3(e,i.u_dimension),u_elevation_stops:new t.b_(e,i.u_elevation_stops),u_color_stops:new t.b_(e,i.u_color_stops),u_color_ramp_size:new t.b_(e,i.u_color_ramp_size),u_opacity:new t.bp(e,i.u_opacity)}),line:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_image_height:new t.bp(e,i.u_image_height)}),linePattern:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_texsize:new t.c3(e,i.u_texsize),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_image:new t.b_(e,i.u_image),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade)}),lineSDF:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_mix:new t.bp(e,i.u_mix),u_tileratio:new t.bp(e,i.u_tileratio),u_crossfade_from:new t.bp(e,i.u_crossfade_from),u_crossfade_to:new t.bp(e,i.u_crossfade_to),u_lineatlas_width:new t.bp(e,i.u_lineatlas_width),u_lineatlas_height:new t.bp(e,i.u_lineatlas_height)}),lineGradientSDF:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_image_height:new t.bp(e,i.u_image_height),u_tileratio:new t.bp(e,i.u_tileratio),u_crossfade_from:new t.bp(e,i.u_crossfade_from),u_crossfade_to:new t.bp(e,i.u_crossfade_to),u_image_dash:new t.b_(e,i.u_image_dash),u_mix:new t.bp(e,i.u_mix),u_lineatlas_width:new t.bp(e,i.u_lineatlas_width),u_lineatlas_height:new t.bp(e,i.u_lineatlas_height)}),raster:(e,i)=>({u_tl_parent:new t.c3(e,i.u_tl_parent),u_scale_parent:new t.bp(e,i.u_scale_parent),u_buffer_scale:new t.bp(e,i.u_buffer_scale),u_fade_t:new t.bp(e,i.u_fade_t),u_opacity:new t.bp(e,i.u_opacity),u_image0:new t.b_(e,i.u_image0),u_image1:new t.b_(e,i.u_image1),u_brightness_low:new t.bp(e,i.u_brightness_low),u_brightness_high:new t.bp(e,i.u_brightness_high),u_saturation_factor:new t.bp(e,i.u_saturation_factor),u_contrast_factor:new t.bp(e,i.u_contrast_factor),u_spin_weights:new t.c2(e,i.u_spin_weights),u_coords_top:new t.c1(e,i.u_coords_top),u_coords_bottom:new t.c1(e,i.u_coords_bottom)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bp(e,i.u_size_t),u_size:new t.bp(e,i.u_size),u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_pitch:new t.bp(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bp(e,i.u_aspect_ratio),u_fade_change:new t.bp(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix
vendor: 6,032 bytes, line 2
2),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texture:new t.b_(e,i.u_texture),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bp(e,i.u_pitched_scale)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bp(e,i.u_size_t),u_size:new t.bp(e,i.u_size),u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_pitch:new t.bp(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bp(e,i.u_aspect_ratio),u_fade_change:new t.bp(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texture:new t.b_(e,i.u_texture),u_gamma_scale:new t.bp(e,i.u_gamma_scale),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_is_halo:new t.b_(e,i.u_is_halo),u_is_plain:new t.b_(e,i.u_is_plain),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bp(e,i.u_pitched_scale)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bp(e,i.u_size_t),u_size:new t.bp(e,i.u_size),u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_pitch:new t.bp(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bp(e,i.u_aspect_ratio),u_fade_change:new t.bp(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texsize_icon:new t.c3(e,i.u_texsize_icon),u_texture:new t.b_(e,i.u_texture),u_texture_icon:new t.b_(e,i.u_texture_icon),u_gamma_scale:new t.bp(e,i.u_gamma_scale),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_is_halo:new t.b_(e,i.u_is_halo),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bp(e,i.u_pitched_scale)}),background:(e,i)=>({u_opacity:new t.bp(e,i.u_opacity),u_color:new t.b$(e,i.u_color)}),backgroundPattern:(e,i)=>({u_opacity:new t.bp(e,i.u_opacity),u_image:new t.b_(e,i.u_image),u_pattern_tl_a:new t.c3(e,i.u_pattern_tl_a),u_pattern_br_a:new t.c3(e,i.u_pattern_br_a),u_pattern_tl_b:new t.c3(e,i.u_pattern_tl_b),u_pattern_br_b:new t.c3(e,i.u_pattern_br_b),u_texsize:new t.c3(e,i.u_texsize),u_mix:new t.bp(e,i.u_mix),u_pattern_size_a:new t.c3(e,i.u_pattern_size_a),u_pattern_size_b:new t.c3(e,i.u_pattern_size_b),u_scale_a:new t.bp(e,i.u_scale_a),u_scale_b:new t.bp(e,i.u_scale_b),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.bp(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_texture:new t.b_(e,i.u_texture),u_ele_delta:new t.bp(e,i.u_ele_delta),u_fog_matrix:new t.c0(e,i.u_fog_matrix),u_fog_color:new t.b$(e,i.u_fog_color),u_fog_ground_blend:new t.bp(e,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.bp(e,i.u_fog_ground_blend_opacity),u_horizon_color:new t.b$(e,i.u_horizon_color),u_horizon_fog_blend:new t.bp(e,i.u_horizon_fog_blend),u_is_globe_mode:new t.bp(e,i.u_is_globe_mode)}),terrainDepth:(e,i)=>({u_ele_delta:new t.bp(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_texture:new t.b_(e,i.u_texture),u_terrain_coords_id:new t.bp(e,i.u_terrain_coords_id),u_ele_delta:new t.bp(e,i.u_ele_delta)}),projectionErrorMeasurement:(e,i)=>({u_input:new t.bp(e,i.u_input),u_output_expected:new t.bp(e,i.u_output_expected)}),atmosphere:(e,i)=>({u_sun_pos:new t.c2(e,i.u_sun_pos),u_atmosphere_blend:new t.bp(e,i.u_atmosphere_blend),u_globe_position:new t.c2(e,i.u_globe_position),u_globe_radius:new t.bp(e,i.u_globe_radius),u_inv_proj_matrix:new t.c0(e,i.u_inv_proj_matrix)}),sky:(e,i)=>({u_sky_color:new t.b$(e,i.u_sky_color),u_horizon_color:new t.b$(e,i.u_horizon_color),u_horizon:new t.c3(e,i.u_horizon),u_horizon_normal:new t.c3(e,i.u_horizon_normal),u_sky_horizon_blend:new t.bp(e,i.u_sky_horizon_blend),u_sky_blend:new t.bp(e,i.u_sky_blend)})};class xr{constructor(e,t,i){this.context=e;const r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const 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(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const wr={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Tr{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}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}`);const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}
vendor: 17,115 bytes, line 2
2enableAttributes(e,t){for(const i of this.attributes){const r=t.attributes[i.name];void 0!==r&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,i){for(const r of this.attributes){const n=t.attributes[r.name];void 0!==n&&e.vertexAttribPointer(n,r.components,e[wr[r.type]],!1,this.itemSize,r.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Er{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)}}class Sr extends Er{getDefault(){return t.bo.transparent}set(e){const 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)}}class Pr extends Er{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Ir extends Er{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Cr extends Er{getDefault(){return[!0,!0,!0,!0]}set(e){const 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)}}class Mr extends Er{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Ar extends Er{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Lr extends Er{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const 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)}}class Fr extends Er{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const 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)}}class Dr extends Er{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class kr extends Er{getDefault(){return[0,1]}set(e){const 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)}}class Or extends Er{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class Rr extends Er{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class zr extends Er{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class Nr extends Er{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const 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)}}class Br extends Er{getDefault(){return t.bo.transparent}set(e){const 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)}}class Vr extends Er{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class jr extends Er{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class Ur extends Er{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Gr extends Er{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class $r extends Er{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class qr extends Er{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Zr extends Er{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const 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)}}class Wr extends Er{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Hr extends Er{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Xr extends Er{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Yr extends Er{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Jr extends Er{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Kr extends Er{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;const i=this.gl;si(i)?i.bindVertexArray(e):null===(t=i.getExtension("OES_vertex_array_object"))||void 0===t||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Qr extends Er{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class en extends Er{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class tn extends Er{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class rn extends Er{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class nn extends rn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class on extends rn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class sn extends rn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const an="Framebuffer is not complete";class ln{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;const o=e.gl,s=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new nn(e,s),r)this.depthAttachment=n?new sn(e,s):new on(e,s);else if(n)throw new Error("Stencil cannot be set without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error(an)}destroy(){const e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}}class cn{constructor(e){var t,i;if(this.gl=e,this.clearColor=new Sr(this),this.clearDepth=new Pr(this),this.clearStencil=new Ir(this),this.colorMask=new Cr(this),this.depthMask=new Mr(this),this.stencilMask=new Ar(this),this.stencilFunc=new Lr(this),this.stencilOp=new Fr(this),this.stencilTest=new Dr(this),this.depthRange=new kr(this),this.depthTest=new Or(this),this.depthFunc=new Rr(this),this.blend=new zr(this),this.blendFunc=new Nr(this),this.blendColor=new Br(this),this.blendEquation=new Vr(this),this.cullFace=new jr(this),this.cullFaceSide=new Ur(this),this.frontFace=new Gr(this),this.program=new $r(this),this.activeTexture=new qr(this),this.viewport=new Zr(this),this.bindFramebuffer=new Wr(this),this.bindRenderbuffer=new Hr(this),this.bindTexture=new Xr(this),this.bindVertexBuffer=new Yr(this),this.bindElementBuffer=new Jr(this),this.bindVertexArray=new Kr(this),this.pixelStoreUnpack=new Qr(this),this.pixelStoreUnpackPremultiplyAlpha=new en(this),this.pixelStoreUnpackFlipY=new tn(this),this.extTextureFilterAnisotropic=e.getExtension("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),si(e)){this.HALF_FLOAT=e.HALF_FLOAT;const r=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(t=e.RGBA16F)&&void 0!==t?t:null==r?void 0:r.RGBA16F_EXT,this.RGB16F=null!==(i=e.RGB16F)&&void 0!==i?i:null==r?void 0:r.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const t=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==t?void 0:t.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new xr(this,e,t)}createVertexBuffer(e,t,i){return new Tr(this,e,t,i)}createRenderbuffer(e,t,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new ln(this,e,t,i,r)}clear({color:e,depth:t,stencil:i}){const r=this.gl;let n=0;e&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.bQ(e.blendFunction,ei.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return si(this.gl)?this.gl.createVertexArray():null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;si(this.gl)?this.gl.deleteVertexArray(e):null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t||t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let un;function hn(e,i,r,n,o){var s,a;const l=e.context,c=e.transform,u=l.gl,h=e.useProgram("collisionBox"),d=[];let p=0,f=0;for(const t of n){const n=i.getTile(t).getBucket(r);if(!n)continue;const a=o?n.textCollisionBox:n.iconCollisionBox,m=n.collisionCircleArray;m.length>0&&(d.push({circleArray:m,circleOffset:f,coord:t}),p+=m.length/4,f=p),a&&h.draw(l,u.LINES,ri.disabled,oi.disabled,e.colorModeForRenderPass(),ii.disabled,Yi(e.transform),null===(s=e.style.map.terrain)||void 0===s?void 0:s.getTerrainData(t),c.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,a.layoutVertexBuffer,a.indexBuffer,a.segments,null,e.transform.zoom,null,null,a.collisionVertexBuffer)}if(!o||!d.length)return;const m=e.useProgram("collisionCircle"),g=new t.ca;g.resize(4*p),g._trim();let y=0;for(const e of d)for(let t=0;t<e.circleArray.length/4;t++){const i=4*t,r=e.circleArray[i+0],n=e.circleArray[i+1],o=e.circleArray[i+2],s=e.circleArray[i+3];g.emplace(y++,r,n,o,s,0),g.emplace(y++,r,n,o,s,1),g.emplace(y++,r,n,o,s,2),g.emplace(y++,r,n,o,s,3)}(!un||un.length<2*p)&&(un=function(e){const i=2*e,r=new t.cc;r.resize(i),r._trim();for(let e=0;e<i;e++){const t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(p));const _=l.createIndexBuffer(un,!0),v=l.createVertexBuffer(g,t.cb.members,!0);for(const i of d){const n=Ji(e.transform);m.draw(l,u.TRIANGLES,ri.disabled,oi.disabled,e.colorModeForRenderPass(),ii.disabled,n,null===(a=e.style.map.terrain)||void 0===a?void 0:a.getTerrainData(i.coord),null,r.id,v,_,t.aV.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}v.destroy(),_.destroy()}const dn=t.ap(new Float32Array(16));function pn(e,i,r,n,o,s){const{horizontalAlign:a,verticalAlign:l}=t.aP(e);return new t.P((-(a-.5)*i/o+n[0])*s,(-(l-.5)*r/o+n[1])*s)}function fn(e,i,r,n,o,s){const a=i.tileAnchorPoint.add(new t.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let e=n.mult(s);r||(e=e.rotate(-o));const t=a.add(e);return $e(t.x,t.y,i.pitchedLabelPlaneMatrix,i.getElevation).point}if(r){const t=Qe(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(e),r=Math.atan(t.y/t.x)+(t.x<0?Math.PI:0);return e.add(n.rotate(r))}return e.add(n)}function mn(e,i,r,n,o,s,a,l,c,u,h,d){const p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let m=0;m<p.length;m++){const y=p.get(m),_=y.hidden||!y.crossTileID||e.allowVerticalPlacement&&!y.placedOrientation?null:n[y.crossTileID];if(_){const n=new t.P(y.anchorX,y.anchorY),p={getElevation:d,width:o.width,height:o.height,pitchedLabelPlaneMatrix:s,pitchWithMap:r,transform:o,tileAnchorPoint:n,translation:u,unwrappedTileID:h},m=r?tt(n.x,n.y,p):Qe(n.x,n.y,p),v=qe(o.cameraToCenterDistance,m.signedDistanceFromCamera);let b=t.ay(e.textSizeData,l,y)*v/t.aJ;r&&(b*=e.tilePixelRatio/a);const{width:x,height:w,anchor:T,textOffset:E,textBoxScale:S}=_,P=pn(T,x,w,E,S,b),I=o.getPitchedTextCorrection(n.x+u[0],n.y+u[1],h),C=fn(m.point,p,i,P,-o.bearingInRadians,I),M=e.allowVerticalPlacement&&y.placedOrientation===t.ax.vertical?Math.PI/2:0;for(let e=0;e<y.numGlyphs;e++)t.aD(f,C,M);c&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:C,angle:M})}else st(y.numGlyphs,f)}if(c){m.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const r=i.get(e);if(r.hidden)st(r.numGlyphs,m);else{const i=g[e];if(i)for(let e=0;e<r.numGlyphs;e++)t.aD(m,i.shiftedAnchor,i.angle);else st(r.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function gn(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function yn(e,i,r,n,o,s,a,l,c,u,h,d,p){var f,m;const g=e.context,y=g.gl,_=e.transform,v="map"===l,b="map"===c,x="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),w=v&&!b&&!x,T=!r.layout.get("symbol-sort-key").isConstant();let E=!1;const S=e.getDepthModeForSublayer(0,ri.ReadOnly),P=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),I=[],C=_.getCircleRadiusCorrection();for(const l of n){const n=i.getTile(l),c=n.getBucket(r);
2if(!c)continue;const h=o?c.text:c.icon;if(!(null==h?void 0:h.segments.get().length)||!h.hasVisibleVertices)continue;const d=h.programConfigurations.get(r.id),m=o||c.sdfIcons,g=o?c.textSizeData:c.iconSizeData,S=b||0!==_.pitch,M=e.useProgram(gn(m,o,c),d),A=t.aw(g,_.zoom),L=null===(f=e.style.map.terrain)||void 0===f?void 0:f.getTerrainData(l);let F,D,k,O,R=[0,0],z=null;if(o)D=n.glyphAtlasTexture,k=y.LINEAR,F=n.glyphAtlasTexture.size,c.iconsInText&&(R=n.imageAtlasTexture.size,z=n.imageAtlasTexture,O=S||e.options.rotating||e.options.zooming||"composite"===g.kind||"camera"===g.kind?y.LINEAR:y.NEAREST);else{const t=1!==r.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;D=n.imageAtlasTexture,k=m||e.options.rotating||e.options.zooming||t||S?y.LINEAR:y.NEAREST,F=n.imageAtlasTexture.size}const N=t.aK(n,1,e.transform.zoom),B=je(v,e.transform,N),V=Ue(b,v,e.transform,N),j=t.aL(_,n,s,a),U=_.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),G=P&&c.hasTextData(),$="none"!==r.layout.get("icon-text-fit")&&G&&c.hasIconData();if(x){const i=t.O();Be(i,B);const n=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(l,t,i):null,s="map"===r.layout.get("text-rotation-alignment");We(c,e,o,B,i,b,u,s,l.toUnwrapped(),_.width,_.height,j,n)}const q=o&&P||$,Z=x||q?dn:b?B:e.transform.clipSpaceToPixelsMatrix,W=m&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let H;H=m?c.iconsInText?gr(g.kind,A,w,b,x,q,e,Z,V,j,F,R,C):mr(g.kind,A,w,b,x,q,e,Z,V,j,o,F,W,C):fr(g.kind,A,w,b,x,q,e,Z,V,j,o,F,C);const X={program:M,buffers:h,uniformValues:H,projectionData:U,atlasTexture:D,atlasTextureIcon:z,atlasInterpolation:k,atlasInterpolationIcon:O,isSDF:m,hasHalo:W};
2if(T&&c.canOverlap){E=!0;const e=h.segments.get();for(const i of e)I.push({segments:new t.aV([i]),sortKey:i.sortKey,state:X,terrainData:L})}else I.push({segments:h.segments,sortKey:0,state:X,terrainData:L})}E&&I.sort(((e,t)=>e.sortKey-t.sortKey));const M=null!==(m=r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(null))&&void 0!==m?m:1/0,A=r.layout.get("text-letter-spacing").constantOr(0)*t.aJ<0||M>1;for(const t of I){const i=t.state;g.activeTexture.set(y.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,y.CLAMP_TO_EDGE),i.atlasTextureIcon&&(g.activeTexture.set(y.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,y.CLAMP_TO_EDGE));const n=i.isSDF&&i.hasHalo;if(n){const n=i.uniformValues;n.u_is_halo=1,A&&(n.u_is_plain=0,_n(i.buffers,t.segments,r,e,i.program,S,h,d,n,i.projectionData,t.terrainData),n.u_is_halo=0,n.u_is_plain=1)}_n(i.buffers,t.segments,r,e,i.program,S,h,d,i.uniformValues,i.projectionData,t.terrainData),n&&!A&&(i.uniformValues.u_is_halo=0)}}function _n(e,t,i,r,n,o,s,a,l,c,u){const h=r.context;n.draw(h,h.gl.TRIANGLES,o,s,a,ii.backCCW,l,u,c,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function vn(e,i,r,n,o){const s=e.context,a=s.gl,l=oi.disabled,c=new ei([a.ONE,a.ONE],t.bo.transparent,[!0,!0,!0,!0]),u=i.getBucket(r);if(!u)return;const h=n.key;let d=r.heatmapFbos.get(h);d||(d=xn(s,i.tileSize,i.tileSize),r.heatmapFbos.set(h,d)),s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,i.tileSize,i.tileSize]),s.clear({color:t.bo.transparent});const p=u.programConfigurations.get(r.id),f=e.useProgram("heatmap",p,!o),m=e.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=e.style.map.terrain.getTerrainData(n);f.draw(s,a.TRIANGLES,ri.disabled,l,c,ii.disabled,Qi(i,e.transform.zoom,r.paint.get("heatmap-intensity"),1),g,m,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,p)}function bn(e,t,i,r,n){const o=e.context,s=o.gl,a=e.transform;o.setColorMode(e.colorModeForRenderPass());const l=wn(o,t),c=i.key,u=t.heatmapFbos.get(c);if(!u)return;o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u.colorAttachment.get()),o.activeTexture.set(s.TEXTURE1),l.bind(s.LINEAR,s.CLAMP_TO_EDGE);const h=a.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});e.useProgram("heatmapTexture").draw(o,s.TRIANGLES,ri.disabled,oi.disabled,e.colorModeForRenderPass(),ii.disabled,er(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,a.zoom),u.destroy(),t.heatmapFbos.delete(c)}function xn(e,t,i){var r,n;const o=e.gl,s=o.createTexture();o.bindTexture(o.TEXTURE_2D,s),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);const a=null!==(r=e.HALF_FLOAT)&&void 0!==r?r:o.UNSIGNED_BYTE,l=null!==(n=e.RGBA16F)&&void 0!==n?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,t,i,0,o.RGBA,a,null);const c=e.createFramebuffer(t,i,!1,!1);return c.colorAttachment.set(s),c}function wn(e,i){return i.colorRampTexture||(i.colorRampTexture=new t.T(e,i.colorRamp,e.gl.RGBA)),i.colorRampTexture}function Tn(e,i,r,n,o,s,a,l){let c=256;if(o.stepInterpolant){const n=i.getSource().maxzoom,o=a.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-a.canonical.z):1;c=t.al(t.ce(s.maxLineLength/t.a6*1024*o),256,r.maxTextureSize)}return l.gradient=t.cf({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:l.gradient||void 0,clips:s.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new t.T(r,l.gradient,n.RGBA),l.version=o.gradientVersion,l.texture}function En(e,t,i,r,n){e.activeTexture.set(t.TEXTURE0),i.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),r.updatePaintBuffers(n)}function Sn(e,t,i,r,n,o){(n||e.lineAtlas.dirty)&&(t.activeTexture.set(i.TEXTURE0),e.lineAtlas.bind(t)),r.updatePaintBuffers(o)}function Pn(e,t,i,r,n,o,s){const a=o.gradients[n.id];let l=a.texture;n.gradientVersion!==a.version&&(l=Tn(e,t,i,r,n,o,s,a)),i.activeTexture.set(r.TEXTURE0),l.bind(n.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE)}function In(e,t,i,r,n,o,s,a,l){const c=o.gradients[n.id];let u=c.texture;n.gradientVersion!==c.version&&(u=Tn(e,t,i,r,n,o,s,c)),i.activeTexture.set(r.TEXTURE0),u.bind(n.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),i.activeTexture.set(r.TEXTURE1),e.lineAtlas.bind(i),a.updatePaintBuffers(l)}function Cn(e,t,i,r,n){if(!i||!(null==r?void 0:r.imageAtlas))return;const o=r.imageAtlas.patternPositions;let s=o[i.to.toString()],a=o[i.from.toString()];if(!s&&a&&(s=a),!a&&s&&(a=s),!s||!a){const e=n.getPaintProperty(t);s=o[e],a=o[e]}s&&a&&e.setConstantPatternPositions(s,a)}function Mn(e,i,r,n,o,s,a,l){var c;const u=e.context.gl,h="fill-pattern",d=r.paint.get(h),p=null==d?void 0:d.constantOr(1),f=r.getCrossfadeParameters();let m,g,y,_,v;const b=e.transform,x=r.paint.get("fill-translate"),w=r.paint.get("fill-translate-anchor");a?(g=p&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",m=u.LINES):(g=p?"fillPattern":"fill",m=u.TRIANGLES);const T=d.constantOr(null);for(const d of n){const n=i.getTile(d);if(p&&!n.patternsLoaded())continue;const E=n.getBucket(r);
2if(!E)continue;const S=E.programConfigurations.get(r.id),P=e.useProgram(g,S),I=null===(c=e.style.map.terrain)||void 0===c?void 0:c.getTerrainData(d);p&&(e.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),S.updatePaintBuffers(f)),Cn(S,h,T,n,r);const C=b.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),M=t.aL(b,n,x,w);if(a){_=E.indexBuffer2,v=E.segments2;const t=[u.drawingBufferWidth,u.drawingBufferHeight];y="fillOutlinePattern"===g&&p?Hi(e,f,n,t,M):Wi(t,M)}else _=E.indexBuffer,v=E.segments,y=p?Zi(e,f,n,M):{u_fill_translate:M};const A=e.stencilModeForClipping(d);P.draw(e.context,m,o,A,s,ii.backCCW,y,I,C,r.id,E.layoutVertexBuffer,_,v,r.paint,e.transform.zoom,S)}}function An(e,i,r,n,o,s,a,l){var c;const u=e.context,h=u.gl,d="fill-extrusion-pattern",p=r.paint.get(d),f=p.constantOr(1),m=r.getCrossfadeParameters(),g=r.paint.get("fill-extrusion-opacity"),y=p.constantOr(null),_=e.transform;for(const p of n){const n=i.getTile(p),v=n.getBucket(r);if(!v)continue;const b=null===(c=e.style.map.terrain)||void 0===c?void 0:c.getTerrainData(p),x=v.programConfigurations.get(r.id),w=e.useProgram(f?"fillExtrusionPattern":"fillExtrusion",x);f&&(e.context.activeTexture.set(h.TEXTURE0),n.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),x.updatePaintBuffers(m));const T=_.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!l,applyTerrainMatrix:!0});Cn(x,d,y,n,r);const E=t.aL(_,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),S=r.paint.get("fill-extrusion-vertical-gradient"),P=f?qi(e,S,g,E,p,m,n):$i(e,S,g,E);w.draw(u,u.gl.TRIANGLES,o,s,a,ii.backCCW,P,b,T,r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,r.paint,e.transform.zoom,x,e.style.map.terrain&&v.centroidVertexBuffer)}}function Ln(e,t,i,r,n,o,s,a,l){var c;const u=e.style.projection,h=e.context,d=e.transform,p=h.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],m=e.useProgram("hillshade",null,!1,f),g=!e.options.moving;for(const f of r){const r=t.getTile(f),y=r.fbo;if(!y)continue;const _=u.getMeshFromTileID(h,f.canonical,a,!0,"raster"),v=null===(c=e.style.map.terrain)||void 0===c?void 0:c.getTerrainData(f);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,y.colorAttachment.get());const b=d.getProjectionData({overscaledTileID:f,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(h,p.TRIANGLES,o,n[f.overscaledZ],s,ii.backCCW,tr(e,r,i),v,b,i.id,_.vertexBuffer,_.indexBuffer,_.segments)}}let Fn=0;function Dn(e,i,r,n,o,s,a,l,c){var u;const h=e.style.projection,d=e.context,p=e.transform,f=d.gl,m=e.useProgram("colorRelief"),g=!e.options.moving,y="nearest"===r.paint.get("resampling")?f.NEAREST:f.LINEAR;let _=!0,v=0;for(const b of n){const n=i.getTile(b),x=n.dem;if(_){Fn||(Fn=f.getParameter(f.MAX_TEXTURE_SIZE));const e=Fn,{elevationTexture:t,colorTexture:i}=r.getColorRampTextures(d,e,x.getUnpackVector());d.activeTexture.set(f.TEXTURE1),t.bind(f.NEAREST,f.CLAMP_TO_EDGE),d.activeTexture.set(f.TEXTURE4),i.bind(f.LINEAR,f.CLAMP_TO_EDGE),_=!1,v=t.size[0]}if(!(null==x?void 0:x.data))continue;const w=x.stride,T=x.getPixels();if(d.activeTexture.set(f.TEXTURE0),d.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture||(n.demTexture=e.getTileTexture(w)),n.demTexture){const e=n.demTexture;e.update(T,{premultiply:!1}),e.bind(y,f.CLAMP_TO_EDGE)}else n.demTexture=new t.T(d,T,f.RGBA,{premultiply:!1}),n.demTexture.bind(y,f.CLAMP_TO_EDGE);const E=h.getMeshFromTileID(d,b.canonical,l,!0,"raster"),S=null===(u=e.style.map.terrain)||void 0===u?void 0:u.getTerrainData(b),P=p.getProjectionData({overscaledTileID:b,aligned:g,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(d,f.TRIANGLES,s,o[b.overscaledZ],a,ii.backCCW,nr(r,n.dem,v),S,P,r.id,E.vertexBuffer,E.indexBuffer,E.segments)}}const kn=[new t.P(0,0),new t.P(t.a6,0),new t.P(t.a6,t.a6),new t.P(0,t.a6)];function On(e,t,i,r,n,o,s,a,l=!1,c=!1){var u;const h=r[r.length-1].overscaledZ,d=e.context,p=d.gl,f=e.useProgram("raster"),m=e.transform,g=e.style.projection,y=e.colorModeForRenderPass(),_=!e.options.moving,v=i.paint.get("raster-opacity"),b="nearest"===i.paint.get("resampling")||"nearest"===i.paint.get("raster-resampling")?p.NEAREST:p.LINEAR,x=i.paint.get("raster-fade-duration"),w=!!e.style.map.terrain;for(const T of r){const r=e.getDepthModeForSublayer(T.overscaledZ-h,1===v?ri.ReadWrite:ri.ReadOnly,p.LESS),E=t.getTile(T);d.activeTexture.set(p.TEXTURE0),E.texture.bind(b,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(p.TEXTURE1);const{parentTile:S,parentScaleBy:P,parentTopLeft:I,fadeValues:C}=Rn(E,t,x,w);E.fadeOpacity=C.tileOpacity,S?(S.fadeOpacity=C.parentTileOpacity,S.texture.bind(b,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST)):E.texture.bind(b,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),E.texture.useMipmap&&d.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&p.texParameterf(p.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax);const M=null===(u=e.style.map.terrain)||void 0===u?void 0:u.getTerrainData(T),A=m.getProjectionData({overscaledTileID:T,aligned:_,applyGlobeMatrix:!c,applyTerrainMatrix:!0}
2),L=dr(I,P,C.fadeMix,i,a),F=g.getMeshFromTileID(d,T.canonical,o,s,"raster");f.draw(d,p.TRIANGLES,r,n?n[T.overscaledZ]:oi.disabled,y,l?ii.frontCCW:ii.backCCW,L,M,A,i.id,F.vertexBuffer,F.indexBuffer,F.segments)}}function Rn(e,i,r,n){const o={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===r||n)return o;if(e.fadingParentID){const n=i.getLoadedTile(e.fadingParentID);if(!n)return o;const s=Math.pow(2,n.tileID.overscaledZ-e.tileID.overscaledZ),a=[e.tileID.canonical.x*s%1,e.tileID.canonical.y*s%1],l=function(e,i,r){const n=c(),o=(n-i.timeAdded)/r,s=e.fadingDirection===he.Incoming,a=t.al((n-e.timeAdded)/r,0,1),l=t.al(1-o,0,1),u=s?a:l;return{tileOpacity:u,parentTileOpacity:s?l:a,fadeMix:{opacity:1,mix:1-u}}}(e,n,r);return{parentTile:n,parentScaleBy:s,parentTopLeft:a,fadeValues:l}}if(e.selfFading){const i=function(e,i){const r=(c()-e.timeAdded)/i,n=t.al(r,0,1);return{tileOpacity:n,fadeMix:{opacity:n,mix:0}}}(e,r);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:i}}return o}const zn=new t.bo(1,0,0,1),Nn=new t.bo(0,1,0,1),Bn=new t.bo(0,0,1,1),Vn=new t.bo(1,0,1,1),jn=new t.bo(0,1,1,1);function Un(e,t,i,r){$n(e,0,t+i/2,e.transform.width,i,r)}function Gn(e,t,i,r){$n(e,t-i/2,0,i,e.transform.height,r)}function $n(e,t,i,r,n,o){const s=e.context,a=s.gl;a.enable(a.SCISSOR_TEST),a.scissor(t*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,n*e.pixelRatio),s.clear({color:o}),a.disable(a.SCISSOR_TEST)}function qn(e,i,r){var n;const o=e.context,s=o.gl,a=e.useProgram("debug"),l=ri.disabled,c=oi.disabled,u=e.colorModeForRenderPass(),h="$debug",d=null===(n=e.style.map.terrain)||void 0===n?void 0:n.getTerrainData(r);o.activeTexture.set(s.TEXTURE0);const p=i.getTileByID(r.key).latestRawTileData,f=Math.floor(((null==p?void 0:p.byteLength)||0)/1024),m=i.getTile(r).tileSize,g=512/Math.min(m,512)*(r.overscaledZ/e.transform.zoom)*.5;let y=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(y+=` => ${r.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,`${y} ${f}kB`);const _=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(o,s.TRIANGLES,l,c,ei.alphaBlended,ii.disabled,Ki(t.bo.transparent,g),null,_,h,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(o,s.LINE_STRIP,l,c,u,ii.disabled,Ki(t.bo.red),d,_,h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function Zn(e,t,i,r){const{isRenderingGlobe:n}=r,o=e.context,s=o.gl,a=e.transform,l=e.colorModeForRenderPass(),c=e.getDepthModeFor3D(),u=e.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,e.width,e.height]);for(const r of i){const i=t.getTerrainMesh(r.tileID),h=e.renderToTexture.getTexture(r),d=t.getTerrainData(r.tileID);o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,h.texture);const p=t.getMeshFrameDelta(a.zoom),f=a.calculateFogMatrix(r.tileID.toUnwrapped()),m=Bi(p,f,e.style.sky,a.pitch,n),g=a.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(o,s.TRIANGLES,c,oi.disabled,l,ii.backCCW,m,d,g,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}function Wn(e,i){if(!i.mesh){const r=new t.aU;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);const n=new t.aW;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),i.mesh=new zt(e.createVertexBuffer(r,Nt.members),e.createIndexBuffer(n),t.aV.simpleSegment(0,0,r.length,n.length))}return i.mesh}const Hn={symbol:function(e,i,r,n,o,s){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:a}=s,l=oi.disabled,c=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,i,r,n,o,s,a,l,c){var u;const h=i.transform,d=i.style.map.terrain,p="map"===o,f="map"===s;for(const o of e){const e=n.getTile(o),s=e.getBucket(r);
2if(!(null===(u=null==s?void 0:s.text)||void 0===u?void 0:u.segments.get().length))continue;const m=t.aw(s.textSizeData,h.zoom),g=t.aK(e,1,i.transform.zoom),y=je(p,i.transform,g),_="none"!==r.layout.get("icon-text-fit")&&s.hasIconData();if(m){const i=Math.pow(2,h.zoom-e.tileID.overscaledZ),r=d?(e,t)=>d.getElevation(o,e,t):null;mn(s,p,f,c,h,y,i,m,_,t.aL(h,e,a,l),o.toUnwrapped(),r)}}}(n,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&yn(e,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),l,c,a),0!==r.paint.get("text-opacity").constantOr(1)&&yn(e,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),l,c,a),i.map.showCollisionBoxes&&(hn(e,i,r,n,!0),hn(e,i,r,n,!1))},circle:function(e,i,r,n,o){var s;if("translucent"!==e.renderPass)return;const{isRenderingToTexture:a}=o,l=r.paint.get("circle-opacity"),c=r.paint.get("circle-stroke-width"),u=r.paint.get("circle-stroke-opacity"),h=!r.layout.get("circle-sort-key").isConstant();if(0===l.constantOr(1)&&(0===c.constantOr(1)||0===u.constantOr(1)))return;const d=e.context,p=d.gl,f=e.transform,m=e.getDepthModeForSublayer(0,ri.ReadOnly),g=oi.disabled,y=e.colorModeForRenderPass(),_=[],v=f.getCircleRadiusCorrection();for(const o of n){const n=i.getTile(o),l=n.getBucket(r);if(!l)continue;const c=r.paint.get("circle-translate"),u=r.paint.get("circle-translate-anchor"),d=t.aL(f,n,c,u),p=l.programConfigurations.get(r.id),m=e.useProgram("circle",p),g=l.layoutVertexBuffer,y=l.indexBuffer,b=null===(s=e.style.map.terrain)||void 0===s?void 0:s.getTerrainData(o),x={programConfiguration:p,program:m,layoutVertexBuffer:g,indexBuffer:y,uniformValues:Xi(e,n,r,d,v),terrainData:b,projectionData:f.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(h){const e=l.segments.get();for(const i of e)_.push({segments:new t.aV([i]),sortKey:i.sortKey,state:x})}else _.push({segments:l.segments,sortKey:0,state:x})}h&&_.sort(((e,t)=>
2e.sortKey-t.sortKey));for(const t of _){const{programConfiguration:i,program:n,layoutVertexBuffer:o,indexBuffer:s,uniformValues:a,terrainData:l,projectionData:c}=t.state;n.draw(d,p.TRIANGLES,m,g,y,ii.backCCW,a,l,c,r.id,o,s,t.segments,r.paint,e.transform.zoom,i)}},heatmap:function(e,i,r,n,o){if(0===r.paint.get("heatmap-opacity"))return;const s=e.context,{isRenderingToTexture:a,isRenderingGlobe:l}=o;if(e.style.map.terrain){for(const t of n){const n=i.getTile(t);i.hasRenderableParent(t)||("offscreen"===e.renderPass?vn(e,n,r,t,l):"translucent"===e.renderPass&&bn(e,r,t,a,l))}s.viewport.set([0,0,e.width,e.height])}else"offscreen"===e.renderPass?function(e,i,r,n){const o=e.context,s=o.gl,a=e.transform,l=oi.disabled,c=new ei([s.ONE,s.ONE],t.bo.transparent,[!0,!0,!0,!0]);(function(e,i,r){const n=e.gl;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,i.width/4,i.height/4]);let o=r.heatmapFbos.get(t.cd);o?(n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),e.bindFramebuffer.set(o.framebuffer)):(o=xn(e,i.width/4,i.height/4),r.heatmapFbos.set(t.cd,o))})(o,e,r),o.clear({color:t.bo.transparent});for(const t of n){if(i.hasRenderableParent(t))continue;const n=i.getTile(t),u=n.getBucket(r);if(!u)continue;const h=u.programConfigurations.get(r.id),d=e.useProgram("heatmap",h),p=a.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),f=a.getCircleRadiusCorrection();d.draw(o,s.TRIANGLES,ri.disabled,l,c,ii.backCCW,Qi(n,a.zoom,r.paint.get("heatmap-intensity"),f),null,p,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,a.zoom,h)}o.viewport.set([0,0,e.width,e.height])}(e,i,r,n):"translucent"===e.renderPass&&function(e,i){const r=e.context,n=r.gl;r.setColorMode(e.colorModeForRenderPass());const o=i.heatmapFbos.get(t.cd);o&&(r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1),wn(r,i).bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,n.TRIANGLES,ri.disabled,oi.disabled,e.colorModeForRenderPass(),ii.disabled,er(e,i,0,1),null,null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom))}(e,r)},line:function(e,t,i,r,n){var o;if("translucent"!==e.renderPass)return;const{isRenderingToTexture:s}=n,a=i.paint.get("line-opacity"),l=i.paint.get("line-width");if(0===a.constantOr(1)||0===l.constantOr(1))return;const c=e.getDepthModeForSublayer(0,ri.ReadOnly),u=e.colorModeForRenderPass(),h=i.paint.get("line-dasharray"),d=h.constantOr(1),p=i.paint.get("line-pattern"),f=p.constantOr(1),m=i.paint.get("line-gradient"),g=i.getCrossfadeParameters();let y;y=f?"linePattern":d&&m?"lineGradientSDF":d?"lineSDF":m?"lineGradient":"line";const _=e.context,v=_.gl,b=e.transform;let x=!0;for(const n of r){const r=t.getTile(n);if(f&&!r.patternsLoaded())continue;const a=r.getBucket(i);if(!a)continue;const l=a.programConfigurations.get(i.id),w=e.context.program.get(),T=e.useProgram(y,l),E=x||T.program!==w,S=null===(o=e.style.map.terrain)||void 0===o?void 0:o.getTerrainData(n),P=p.constantOr(null),I=null==h?void 0:h.constantOr(null);if(P&&r.imageAtlas){const e=r.imageAtlas,t=e.patternPositions[P.to.toString()],i=e.patternPositions[P.from.toString()];t&&i&&l.setConstantPatternPositions(t,i)}else if(I){const t="round"===i.layout.get("line-cap").constantOr(null),r=e.lineAtlas.getDash(I.to,t),n=e.lineAtlas.getDash(I.from,t);l.setConstantDashPositions(r,n)}const C=b.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),M=b.getPixelScale();let A;f?(A=ar(e,r,i,M,g),En(_,v,r,l,g)):d&&m?(A=cr(e,r,i,M,g,a.lineClipsArray.length),In(e,t,_,v,i,a,n,l,g)):d?(A=lr(e,r,i,M,g),Sn(e,_,v,l,E,g)):m?(A=sr(e,r,i,M,a.lineClipsArray.length),Pn(e,t,_,v,i,a,n)):A=or(e,r,i,M);const L=e.stencilModeForClipping(n);T.draw(_,v.TRIANGLES,c,L,u,ii.disabled,A,S,C,i.id,a.layoutVertexBuffer,a.indexBuffer,a.segments,i.paint,e.transform.zoom,l,a.layoutVertexBuffer2),x=!1}},fill:function(e,i,r,n,o){const s=r.paint.get("fill-color"),a=r.paint.get("fill-opacity");if(0===a.constantOr(1))return;const{isRenderingToTexture:l}=o,c=e.colorModeForRenderPass(),u=r.paint.get("fill-pattern"),h=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===s.constantOr(t.bo.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(e.renderPass===h){const t=e.getDepthModeForSublayer(1,"opaque"===e.renderPass?ri.ReadWrite:ri.ReadOnly);Mn(e,i,r,n,t,c,!1,l)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){const t=e.getDepthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,ri.ReadOnly);Mn(e,i,r,n,t,c,!0,l)}},fillExtrusion:function(e,t,i,r,n){const o=i.paint.get("fill-extrusion-opacity");if(0===o)return;const{isRenderingToTexture:s}=n;if("translucent"===e.renderPass){const n=new ri(e.context.gl.LEQUAL,ri.ReadWrite,e.depthRangeFor3D);if(1!==o||i.paint.get("fill-extrusion-pattern").constantOr(1))An(e,t,i,r,n,oi.disabled,ei.disabled,s),An(e,t,i,r,n,e.stencilModeFor3D(),e.colorModeForRenderPass(),s);else{const o=e.colorModeForRenderPass();An(e,t,i,r,n,oi.disabled,o,s)}}},hillshade:function(e,i,r,n,o){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;const{isRenderingToTexture:s}=o,a=e.context,l=e.style.projection.useSubdivision,c=e.getDepthModeForSublayer(0,ri.ReadOnly),u=e.colorModeForRenderPass();if("offscreen"===e.renderPass)!function(e,i,r,n,o,s,a){const l=e.context,c=l.gl,u="nearest"===n.paint.get("resampling")?c.NEAREST:c.LINEAR;for(const h of r){const r=i.getTile(h),d=r.dem;if(!(null==d?void 0:d.data))continue;if(!r.needsHillshadePrepare)continue;
2const p=d.dim,f=d.stride,m=d.getPixels();if(l.activeTexture.set(c.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture||(r.demTexture=e.getTileTexture(f)),r.demTexture){const e=r.demTexture;e.update(m,{premultiply:!1}),e.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else r.demTexture=new t.T(l,m,c.RGBA,{premultiply:!1}),r.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);l.activeTexture.set(c.TEXTURE0);let g=r.fbo;if(!g){const e=new t.T(l,{width:p,height:p,data:null},c.RGBA);e.bind(u,c.CLAMP_TO_EDGE),g=r.fbo=l.createFramebuffer(p,p,!0,!1),g.colorAttachment.set(e.texture)}l.bindFramebuffer.set(g.framebuffer),l.viewport.set([0,0,p,p]),e.useProgram("hillshadePrepare").draw(l,c.TRIANGLES,o,s,a,ii.disabled,ir(r.tileID,d),null,null,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),r.needsHillshadePrepare=!1}}(e,i,n,r,c,oi.disabled,u),a.viewport.set([0,0,e.width,e.height]);else if("translucent"===e.renderPass)if(l){const[t,o,a]=e.stencilConfigForOverlapTwoPass(n);Ln(e,i,r,a,t,c,u,!1,s),Ln(e,i,r,a,o,c,u,!0,s)}else{const[t,o]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Ln(e,i,r,o,t,c,u,!1,s)}},colorRelief:function(e,t,i,r,n){if("translucent"!==e.renderPass)return;if(!r.length)return;const{isRenderingToTexture:o}=n,s=e.style.projection.useSubdivision,a=e.getDepthModeForSublayer(0,ri.ReadOnly),l=e.colorModeForRenderPass();if(s){const[n,s,c]=e.stencilConfigForOverlapTwoPass(r);Dn(e,t,i,c,n,a,l,!1,o),Dn(e,t,i,c,s,a,l,!0,o)}else{const[n,s]=e.getStencilConfigForOverlapAndUpdateStencilID(r);Dn(e,t,i,s,n,a,l,!1,o)}},raster:function(e,t,i,r,n){if("translucent"!==e.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!r.length)return;const{isRenderingToTexture:o}=n,s=t.getSource(),a=e.style.projection.useSubdivision;if(s instanceof te)On(e,t,i,r,null,!1,!1,s.tileCoords,s.flippedWindingOrder,o);else if(a){const[n,s,a]=e.stencilConfigForOverlapTwoPass(r);On(e,t,i,a,n,!1,!0,kn,!1,o),On(e,t,i,a,s,!0,!0,kn,!1,o)}else{const[n,s]=e.getStencilConfigForOverlapAndUpdateStencilID(r);On(e,t,i,s,n,!1,!0,kn,!1,o)}},background:function(e,t,i,r,n){var o;const s=i.paint.get("background-color"),a=i.paint.get("background-opacity");if(0===a)return;const{isRenderingToTexture:l}=n,c=e.context,u=c.gl,h=e.style.projection,d=e.transform,p=d.tileSize,f=i.paint.get("background-pattern");if(e.isPatternMissing(f))return;const m=!f&&1===s.a&&1===a&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==m)return;const g=oi.disabled,y=e.getDepthModeForSublayer(0,"opaque"===m?ri.ReadWrite:ri.ReadOnly),_=e.colorModeForRenderPass(),v=e.useProgram(f?"backgroundPattern":"background"),b=r||Pe(d,{tileSize:p,terrain:e.style.map.terrain});f&&(c.activeTexture.set(u.TEXTURE0),e.imageManager.bind(e.context));const x=i.getCrossfadeParameters();for(const t of b){const r=d.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),n=f?_r(a,e,f,{tileID:t,tileSize:p},x):yr(a,s),m=null===(o=e.style.map.terrain)||void 0===o?void 0:o.getTerrainData(t),b=h.getMeshFromTileID(c,t.canonical,!1,!0,"raster");v.draw(c,u.TRIANGLES,y,g,_,ii.backCCW,n,m,r,i.id,b.vertexBuffer,b.indexBuffer,b.segments)}},sky:function(e,t){const i=e.context,r=i.gl,n=((e,t,i)=>{const r=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),o=ye(t),s=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-o*n)*i,(t.height/2+o*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:s}})(t,e.style.map.transform,e.pixelRatio),o=new ri(r.LEQUAL,ri.ReadWrite,[0,1]),s=oi.disabled,a=e.colorModeForRenderPass(),l=e.useProgram("sky"),c=Wn(i,t);l.draw(i,r.TRIANGLES,o,s,a,ii.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)},atmosphere:function(e,i,r){const n=e.context,o=n.gl,s=e.useProgram("atmosphere"),a=new ri(o.LEQUAL,ri.ReadOnly,[0,1]),l=e.transform,c=function(e,i){const r=e.properties.get("position"),n=[-r.x,-r.y,-r.z],o=t.ap(new Float64Array(16));return"map"===e.properties.get("anchor")&&(t.be(o,o,i.rollInRadians),t.bf(o,o,-i.pitchInRadians),t.be(o,o,i.bearingInRadians),t.bf(o,o,i.center.lat*Math.PI/180),t.bI(o,o,-i.center.lng*Math.PI/180)
vendor: 11,869 bytes, line 2
2),t.cg(n,n,o),n}(r,e.transform),u=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=i.properties.get("atmosphere-blend")*u.projectionTransition;if(0===h)return;const d=yi(l.worldSize,l.center.lat),p=l.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,t.aE(f,f,l.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,t.aE(f,f,p),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;const m=((e,t,i,r,n)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:n}))(c,h,[f[0],f[1],f[2]],d,p),g=Wn(n,i);s.draw(n,o.TRIANGLES,a,oi.disabled,ei.alphaBlended,ii.disabled,m,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)},custom:function(e,t,i,r){const{isRenderingGlobe:n}=r,o=e.context,s=i.implementation,a=e.style.projection,l=e.transform,c=l.getProjectionDataForCustomLayer(n),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:a.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${a.shaderPreludeCode.vertexSource}`,define:a.shaderDefine},defaultProjectionData:c},h=s.renderingMode?s.renderingMode:"2d";if("offscreen"===e.renderPass){const t=s.prerender;t&&(e.setCustomLayerDefaults(),o.setColorMode(e.colorModeForRenderPass()),t.call(s,o.gl,u),o.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),o.setColorMode(e.colorModeForRenderPass()),o.setStencilMode(oi.disabled);const t="3d"===h?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,ri.ReadOnly);o.setDepthMode(t),s.render(o.gl,u),o.setDirty(),e.setBaseState(),o.bindFramebuffer.set(null)}},debug:function(e,t,i){for(const r of i)qn(e,t,r)},debugPadding:function(e){const t=e.transform.padding;Un(e,e.transform.height-(t.top||0),3,zn),Un(e,t.bottom||0,3,Nn),Gn(e,t.left||0,3,Bn),Gn(e,e.transform.width-(t.right||0),3,Vn);const i=e.transform.centerPoint;!function(e,t,i,r){$n(e,t-1,i-10,2,20,r),$n(e,t-10,i-1,20,2,r)}(e,i.x,e.transform.height-i.y,jn)},terrainDepth:function(e,i){const r=e.context,n=r.gl,o=e.transform,s=ei.unblended,a=new ri(n.LEQUAL,ri.ReadWrite,[0,1]),l=i.tileManager.getRenderableTiles(),c=e.useProgram("terrainDepth");r.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.bo.transparent,depth:1});for(const e of l){const t=i.getTerrainMesh(e.tileID),l=i.getTerrainData(e.tileID),u=o.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),h={u_ele_delta:i.getMeshFrameDelta(o.zoom)};c.draw(r,n.TRIANGLES,a,oi.disabled,s,ii.backCCW,h,l,u,"terrain",t.vertexBuffer,t.indexBuffer,t.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])},terrainCoords:function(e,i){const r=e.context,n=r.gl,o=e.transform,s=ei.unblended,a=new ri(n.LEQUAL,ri.ReadWrite,[0,1]),l=i.getCoordsTexture(),c=i.tileManager.getRenderableTiles(),u=e.useProgram("terrainCoords");r.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.bo.transparent,depth:1}),i.coordsIndex=[];for(const e of c){const t=i.getTerrainMesh(e.tileID),c=i.getTerrainData(e.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);const h={u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(o.zoom)},d=o.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(r,n.TRIANGLES,a,oi.disabled,s,ii.backCCW,h,c,d,"terrain",t.vertexBuffer,t.indexBuffer,t.segments),i.coordsIndex.push(e.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}};class Xn{constructor(e,i){this.drawFunctions=Hn,this.context=new cn(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:t.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Oe.maxOverzooming+Oe.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Dt}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style._order)this.style._layers[e].resize()}setup(){const e=this.context,i=new t.aU;i.emplaceBack(0,0),i.emplaceBack(t.a6,0),i.emplaceBack(0,t.a6),i.emplaceBack(t.a6,t.a6),this.tileExtentBuffer=e.createVertexBuffer(i,Nt.members),this.tileExtentSegments=t.aV.simpleSegment(0,0,4,2);const r=new t.aU;r.emplaceBack(0,0),r.emplaceBack(t.a6,0),r.emplaceBack(0,t.a6),r.emplaceBack(t.a6,t.a6),this.debugBuffer=e.createVertexBuffer(r,Nt.members),this.debugSegments=t.aV.simpleSegment(0,0,4,5);const n=new t.ch;n.emplaceBack(0,0,0,0),n.emplaceBack(t.a6,0,t.a6,0),n.emplaceBack(0,t.a6,0,t.a6),n.emplaceBack(t.a6,t.a6,t.a6,t.a6),this.rasterBoundsBuffer=e.createVertexBuffer(n,zi.members),this.rasterBoundsSegments=t.aV.simpleSegment(0,0,4,2);const o=new t.aU;o.emplaceBack(0,0),o.emplaceBack(t.a6,0),o.emplaceBack(0,t.a6),o.emplaceBack(t.a6,t.a6),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,Nt.members),this.rasterBoundsSegmentsPosOnly=t.aV.simpleSegment(0,0,4,5);const s=new t.aU;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(s,Nt.members),this.viewportSegments=t.aV.simpleSegment(0,0,4,2);const a=new t.ci;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);const l=new t.aW;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new oi({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new zt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const r=t.O();t.c7(r,0,this.width,this.height,0,0,1),t.S(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const n={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,ri.disabled,this.stencilClearMode,ei.disabled,ii.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!(null==t?void 0:t.length))return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();const r=this.context;r.setColorMode(ei.disabled),r.setDepthMode(ri.disabled);const n={};for(const e of t)n[e.key]=this.nextStencilID++;this._renderTileMasks(n,t,i,!0),this._renderTileMasks(n,t,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,i,r){var n;const o=this.context,s=o.gl,a=this.style.projection,l=this.transform,c=this.useProgram("clippingMask");for(const u of t){const t=e[u.key],h=null===(n=this.style.map.terrain)||void 0===n?void 0:n.getTerrainData(u),d=a.getMeshFromTileID(this.context,u.canonical,r,!0,"stencil"),p=l.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!i,applyTerrainMatrix:!0});c.draw(o,s.TRIANGLES,ri.disabled,new oi({func:s.ALWAYS,mask:0},t,255,s.KEEP,s.KEEP,s.REPLACE),ei.disabled,i?ii.disabled:ii.backCCW,null,h,p,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}_renderTilesDepthBuffer(){var e;const t=this.context,i=t.gl,r=this.style.projection,n=this.transform,o=this.useProgram("depth"),s=this.getDepthModeFor3D(),a=Pe(n,{tileSize:n.tileSize});for(const l of a){const a=null===(e=this.style.map.terrain)||void 0===e?void 0:e.getTerrainData(l),c=r.getMeshFromTileID(this.context,l.canonical,!0,!0,"raster"),u=n.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(t,i.TRIANGLES,s,oi.disabled,ei.disabled,ii.backCCW,null,a,u,"$clipping",c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new oi({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){const t=this.context.gl;return new oi({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const t=this.context.gl,i=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const e={};for(let i=0;i<n;i++)e[i+r]=new oi({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[e,i]}return[{[r]:oi.disabled},i]}stencilConfigForOverlapTwoPass(e){const t=this.context.gl,i=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){const e={},o={};for(let i=0;i<n;i++)e[i+r]=new oi({func:t.GREATER,mask:255},n+1+i,255,t.KEEP,t.KEEP,t.REPLACE),o[i+r]=new oi({func:t.GREATER,mask:255},1+i,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*n+1,[e,o,i]}return this.nextStencilID=3,[{[r]:new oi({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new oi({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new ei([e.CONSTANT_COLOR,e.ONE],new t.bo(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?ei.unblended:ei.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return ri.disabled;const r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ri(i||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new ri(this.context.gl.LEQUAL,ri.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var r,n,o;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(c()),this.imageManager.beginFrame();const s=this.style._order,a=this.style.tileManagers,l={},u={},h={},d={isRenderingToTexture:!1,isRenderingGlobe:(null===(r=e.projection)||void 0===r?void 0:r.transitionState)>0};for(const e in a){const t=a[e];t.used&&t.prepare(this.context),l[e]=t.getVisibleCoordinates(!1),u[e]=l[e].slice().reverse(),h[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<s.length;e++)if(this.style._layers[s[e]].is3D()){this.opaquePassCutoff=e;break}this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const e of s){const t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;const i=u[t.source];("custom"===t.type||i.length)&&this.renderLayer(this,a[t.source],t,i,d)}if(null===(n=this.style.projection)||void 0===n||n.updateGPUdependent({context:this.context,useProgram:e=>this.useProgram(e)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.bo.black:t.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[s[this.currentLayer]],t=
2a[e.source],i=l[e.source];this._renderTileClippingMasks(e,i,!1),this.renderLayer(this,t,e,i,d)}this.renderPass="translucent";let p=!1;for(this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const e=this.style._layers[s[this.currentLayer]],t=a[e.source];if(null===(o=this.renderToTexture)||void 0===o?void 0:o.renderLayer(e,d))continue;this.opaquePassEnabledForLayer()||p||(p=!0,d.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const i=("symbol"===e.type?h:u)[e.source];this._renderTileClippingMasks(e,l[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,i,d)}if(d.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const e=function(e,t){let i=null;const r=Object.values(e._layers).flatMap((i=>i.source&&!i.isHidden(t)?[e.tileManagers[i.source]]:[])),n=r.filter((e=>"vector"===e.getSource().type)),o=r.filter((e=>"vector"!==e.getSource().type)),s=e=>{(!i||i.getSource().maxzoom<e.getSource().maxzoom)&&(i=e)};for(const e of n)s(e);if(!i)for(const e of o)s(e);return i}(this.style,this.transform.zoom);e&&this.drawFunctions.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(e){var i,r;if(!(null===(r=null===(i=this.style)||void 0===i?void 0:i.map)||void 0===r?void 0:r.terrain))return;const n=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let s=this.terrainFacilitator.depthDirty;s||(s=e?!t.cj(n,o):!t.ck(n,o)),s||(s=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),s&&(t.cl(n,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var e,t;(null===(t=null===(e=this.style)||void 0===e?void 0:e.map)||void 0===t?void 0:t.terrain)&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(e,i,r,n,o){if(r.isHidden(this.transform.zoom))return;if("background"!==r.type&&"custom"!==r.type&&!(n||[]).length)return;this.id=r.id;const s=this.drawFunctions;t.aQ(r)?s.symbol(e,i,r,n,this.style.placement.variableOffsets,o):t.cm(r)?s.circle(e,i,r,n,o):t.cn(r)?s.heatmap(e,i,r,n,o):t.co(r)?s.line(e,i,r,n,o):t.cp(r)?s.fill(e,i,r,n,o):t.cq(r)?s.fillExtrusion(e,i,r,n,o):t.cr(r)?s.hillshade(e,i,r,n,o):t.cs(r)?s.colorRelief(e,i,r,n,o):t.bU(r)?s.raster(e,i,r,n,o):t.ct(r)?s.background(e,i,r,n,o):t.cu(r)&&s.custom(e,i,r,o)}saveTileTexture(e){const t=this._tileTextures[e.size[0]];t?t.length<Xn.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?t.push(e):e.destroy():this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const 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;const t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1,r=[]){var n;this.cache||(this.cache={});const o=!!this.style.map.terrain,s=this.style.projection,a=i?Ot.projectionMercator:s.shaderPreludeCode,l=i?Bt:s.shaderDefine,c=e+(t?t.cacheKey:"")+`/${i?Vt:s.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(o?"/terrain":"")+(r?`/${r.join("/")}`:"");return(n=this.cache)[c]||(n[c]=new Ui(this.context,Ot[e],t,br[e],this._showOverdrawInspector,o,a,l,r)),this.cache[c]}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(){const 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(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var e,t;if(this._tileTextures){for(const e in this._tileTextures){const t=this._tileTextures[e];if(t)for(const e of t)e.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null===(e=this.tileExtentMesh.vertexBuffer)||void 0===e||e.destroy()),this.tileExtentMesh&&(null===(t=this.tileExtentMesh.indexBuffer)||void 0===t||t.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const e in this.cache){const t=this.cache[e];(null==t?void 0:t.program)&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function Yn(e,t){let i,r=!1,n=null;const o=()=>{n=null,r&&(e(...i),n=setTimeout(o,t),r=!1)};return(...e)=>(r=!0,i=e,n||o(),n)}
vendor: 16,290 bytes, line 2
2Xn.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class Jn{constructor(e){this._getCurrentHash=()=>{const e=window.location.hash.replace("#","");if(this._hashName){let t;const i=e.split("&").map((e=>e.split("=")));for(const e of i)e[0]===this._hashName&&(t=e);return(t&&t[1]||"").split("/")}return e.split("/")},this._onHashChange=()=>{const e=this._getCurrentHash();if(!this._isValidHash(e))return!1;const 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=()=>{const e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{const e=this._getCurrentHash();if(0===e.length)return;const t=e.join("/");let i=t;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${t}`);let r=window.location.hash.replace(i,"");r.startsWith("#&")?r=r.slice(0,1)+r.slice(2):"#"===r&&(r="");let n=window.location.href.replace(/(#.+)?$/,r);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=Yn(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const t=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),o=Math.round(t.lng*n)/n,s=Math.round(t.lat*n)/n,a=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=e?`/${o}/${s}/${i}`:`${i}/${s}/${o}`,(a||l)&&(c+="/"+Math.round(10*a)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const e=this._hashName;let t=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const r=i.split("=")[0];return r===e?(t=!0,`${r}=${c}`):i})).filter((e=>e));return t||i.push(`${e}=${c}`),`#${i.join("&")}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.W(+e[2],+e[1])}catch(e){return!1}const i=+e[0],r=+(e[3]||0),n=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&r>=-180&&r<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const Kn={linearity:.3,easing:t.cv(0,0,.3,1)},Qn=t.e({deceleration:2500,maxSpeed:1400},Kn),eo=t.e({deceleration:20,maxSpeed:1400},Kn),to=t.e({deceleration:1e3,maxSpeed:360},Kn),io=t.e({deceleration:1e3,maxSpeed:90},Kn),ro=t.e({deceleration:1e3,maxSpeed:360},Kn);class no{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,t=c();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,i.roll+=e.rollDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const o=so(i.pan.mag(),r,t.e({},Qn,e||{})),s=i.pan.mult(o.amount/i.pan.mag()),a=this._map.cameraHelper.handlePanInertia(s,this._map.transform);n.center=a.easingCenter,n.offset=a.easingOffset,oo(n,o)}if(i.zoom){const e=so(i.zoom,r,eo);n.zoom=t.cw(this._map.transform.zoom+e.amount,this._map.getZoomSnap(),e.amount),oo(n,e)}if(i.bearing){const e=so(i.bearing,r,to);n.bearing=this._map.transform.bearing+t.al(e.amount,-179,179),oo(n,e)}if(i.pitch){const e=so(i.pitch,r,io);n.pitch=this._map.transform.pitch+e.amount,oo(n,e)}if(i.roll){const e=so(i.roll,r,ro);n.roll=this._map.transform.roll+t.al(e.amount,-179,179),oo(n,e)}if(n.zoom||n.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),t.e(n,{noMoveStart:!0})}}function oo(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function so(e,i,r){const{maxSpeed:n,linearity:o,deceleration:s}=r,a=t.al(e*o/(i/1e3),-n,n),l=Math.abs(a)/(s*o);return{easing:r.easing,duration:1e3*l,amount:a*(l/2)}}class ao extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r,n={}){r=r instanceof MouseEvent?r:new MouseEvent(e,r);const o=d.mousePos(i.getCanvas(),r),s=i.unproject(o);super(e,t.e({point:o,lngLat:s,originalEvent:r},n)),this._defaultPrevented=!1,this.target=i}}class lo extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r){const n="touchend"===e?r.changedTouches:r.touches,o=d.touchPos(i.getCanvasContainer(),n),s=o.map((e=>i.unproject(e))),a=o.reduce(((e,t,i,r)=>e.add(t.div(r.length))),new t.P(0,0));super(e,{points:o,point:a,lngLats:s,lngLat:i.unproject(a),originalEvent:r}),this._defaultPrevented=!1}}class co extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class uo{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new co(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new ao(e.type,this._map,e))}mouseup(e){this._map.fire(new ao(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new ao(e.type,this._map,e))}dblclick(e){return this._firePreventable(new ao(e.type,this._map,e))}mouseover(e){this._map.fire(new ao(e.type,this._map,e))}mouseout(e){this._map.fire(new ao(e.type,this._map,e))}touchstart(e){return this._firePreventable(new lo(e.type,this._map,e))}touchmove(e){this._map.fire(new lo(e.type,this._map,e))}touchend(e){this._map.fire(new lo(e.type,this._map,e))}touchcancel(e){this._map.fire(new lo(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ho{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new ao(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ao("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new ao(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class po{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(t.P.convert(e),this._map.terrain)}}class fo{constructor(e,t){this._map=e,this._tr=new po(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&"object"==typeof t.boxZoom&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}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&&0===e.button&&(d.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;const r=this._startPos;this._lastPos=i,this._box||(this._box=d.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const n=Math.min(r.x,i.x),o=Math.max(r.x,i.x),s=Math.min(r.y,i.y),a=Math.max(r.y,i.y);this._box.style.transform=`translate(${n}px,${s}px)`,this._box.style.width=o-n+"px",this._box.style.height=a-s+"px"}mouseupWindow(e,i){if(!this._active)return;if(0!==e.button)return;const r=this._startPos,n=i;if(this.reset(),d.suppressClick(),r.x!==n.x||r.y!==n.y)return this._map.fire(new t.n("boxzoomend",{originalEvent:e})),this._boxZoomEnd?void this._boxZoomEnd(this._map,r,n,e):{cameraAnimation:e=>e.fitScreenCoordinates(r,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),d.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.n(e,{originalEvent:i}))}}function mo(e,t){if(e.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);const i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}class go{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){const i=new t.P(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=mo(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const r=mo(i,t);for(const e in this.touches){const t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class yo{constructor(e){this.singleTap=new go(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const r=this.singleTap.touchend(e,t,i);if(r){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class _o{constructor(e){this._tr=new po(e),this._zoomIn=new yo({numTouches:1,numTaps:2}),this._zoomOut=new yo({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,i,r){const n=this._zoomIn.touchend(e,i,r),o=this._zoomOut.touchend(e,i,r),s=this._tr;return n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:t.cw(s.zoom+1,i.getZoomSnap()),around:s.unproject(n)},{originalEvent:e})}):o?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:t.cw(s.zoom-1,i.getZoomSnap()),around:s.unproject(o)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class vo{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){const 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;const i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const r=Array.isArray(t)?t[0]:t;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&d.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}}const bo=0,xo=2,wo={[bo]:1,[xo]:2};class To{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){const i=wo[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}}class Eo{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}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)}}class So{constructor(e=new To({checkCorrectEvent:()=>!0}),t=new Eo){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,i){return e instanceof MouseEvent?t(e):"undefined"!=typeof TouchEvent&&e instanceof TouchEvent?i(e):void 0}startMove(e){this._executeRelevantHandler(e,(e=>{this.mouseMoveStateManager.startMove(e)}),(e=>{this.oneFingerTouchMoveStateManager.startMove(e)}))}endMove(e){this._executeRelevantHandler(e,(e=>{this.mouseMoveStateManager.endMove(e)}),(e=>{this.oneFingerTouchMoveStateManager.endMove(e)}))}isValidStartEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidStartEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e)))}isValidMoveEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidMoveEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e)))}isValidEndEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidEndEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e)))}}const Po=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class Io{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(!this._shouldBePrevented(i.length))return e.preventDefault(),this._calculateTransform(e,t,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,r){r.length>0&&(this._active=!0);const n=mo(r,i),o=new t.P(0,0),s=new t.P(0,0);let a=0;for(const e in n){const t=n[e],i=this._touches[e];i&&(o._add(t),s._add(t.sub(i)),a++,n[e]=t)}if(this._touches=n,this._shouldBePrevented(a)||!s.mag())return;
vendor: 4,677 bytes, line 2
2const l=s.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(a),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Co{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();const[r,n]=this._firstTwoTouches,o=Mo(i,t,r),s=Mo(i,t,n);if(!o||!s)return;const a=this._aroundCenter?null:o.add(s).div(2);return this._move([o,s],a,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[r,n]=this._firstTwoTouches,o=Mo(i,t,r),s=Mo(i,t,n);o&&s||(this._active&&d.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Mo(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function Ao(e,t){return Math.log(e/t)/Math.LN2}class Lo extends Co{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(e){this._zoomRate=null!=e?e:1}setZoomThreshold(e){this._zoomThreshold=null!=e?e:.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Ao(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:Ao(this._distance,i)*this._zoomRate,pinchAround:t}}}function Fo(e,t){return 180*e.angleWith(t)/Math.PI}class Do extends Co{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,i){const r=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Fo(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,i=Fo(e,this._startVector);return Math.abs(i)<t}}function ko(e){return Math.abs(e.y)>Math.abs(e.x)}class Oo extends Co{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,ko(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const r=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,n=t.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return ko(e)&&ko(t)&&o}}const Ro={panStep:100,bearingStep:15,pitchStep:10};class zo{constructor(e){this._tr=new po(e);const t=Ro;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 i=0,r=0,n=0,o=0,s=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),o=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),o=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),s=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(r=0,n=0),{cameraAnimation:a=>{const l=this._tr;a.easeTo({duration:300,easeId:"keyboardHandler",easing:No,zoom:i?t.cw(l.zoom+i*(e.shiftKey?2:1),a.getZoomSnap()):l.zoom,bearing:l.bearing+r*this._bearingStep,pitch:l.pitch+n*this._pitchStep,offset:[-o*this._panStep,-s*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 No(e){return e*(2-e)}const Bo=4.000244140625,Vo=1/450;class jo{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}
vendor: 10,341 bytes, line 2
2,this._map=e,this._tr=new po(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Vo}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const i=c(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==t&&t%Bo==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&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._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=d.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(t.W.convert(r.center)):i,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender)return;if(this._needsRerender=!1,!this.isActive())return;const e=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){const i="wheel"===this._type&&Math.abs(this._delta)>Bo?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);const n="number"!=typeof this._targetZoom?e.scale:t.ao(this._targetZoom),o=e.applyConstrain(e.getCameraLngLat(),t.ar(n*r)).zoom,s=this._map.getZoomSnap();if("wheel"===this._type&&s>0){const i=t.cw(e.zoom,s);this._targetZoom=t.cw(o,s,o-i)}else this._targetZoom=o;"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"!=typeof this._targetZoom?e.zoom:this._targetZoom,r=this._startZoom,n=this._easing;let o,s=!1;if("wheel"===this._type&&r&&n){const e=c()-this._lastWheelEventTime,a=Math.min((e+5)/200,1),l=n(a);o=t.H.number(r,i,l),a<1?this._needsRerender=!0:s=!0}else o=i,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!s,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.cy;if(this._prevEase){const e=this._prevEase,r=(c()-e.start)/e.duration,n=e.easing(r+.01)-e.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=t.cv(o,s,.25,1)}return this._prevEase={start:c(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Uo{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()}}class Go{constructor(e){this._tr=new po(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:t.cw(this._tr.zoom+(e.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $o{constructor(){this._tap=new yo({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=null!=e?e:1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(this._tapTime){const r=t[0],n=e.timeStamp-this._tapTime<500,o=this._tapPoint.dist(r)<30;n&&o?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(e,t,i)}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128*this._zoomRate}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const r=this._tap.touchend(e,t,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qo{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}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()}}class Zo{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=r}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()}}class Wo{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,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()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Ho{constructor(e,t){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=d.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);const n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),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,i){this._enabled&&(this._map.fire(new t.n("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Xo=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class Yo extends t.n{}function Jo(e){var t;return(null===(t=e.panDelta)||void 0===t?void 0:t.mag())||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class Ko{get _ownerDocument(){var e;return(null===(e=this._el)||void 0===e?void 0:e.ownerDocument)||document}get _ownerWindow(){var e,t;return(null===(t=null===(e=this._el)||void 0===e?void 0:e.ownerDocument)||void 0===t?void 0:t.defaultView)||window}constructor(e,i){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,i)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;const r="renderFrame"===e.type?void 0:e,n={needsRenderFrame:!1},o={},s={};for(const{handlerName:a,handler:l,allowed:c}of this._handlers){if(!l.isEnabled())continue;let u;if(this._blockedByActive(s,c,a))l.reset();else if(l[i||e.type]){if(t.cz(e,i||e.type)){const t=d.mousePos(this._map.getCanvas(),e);u=l[i||e.type](e,t)}else if(t.cA(e,i||e.type)){const t=this._getMapTouches(e.touches),r=d.touchPos(this._map.getCanvas(),t);u=l[i||e.type](e,r,t)}else t.cB(i||e.type)||(u=l[i||e.type](e));this.mergeHandlerResult(n,o,u,a,r),(null==u?void 0:u.needsRenderFrame)&&this._triggerRe
2nderFrame()}(u||l.isActive())&&(s[a]=l)}const a={};for(const e in this._previousActiveHandlers)s[e]||(a[e]=r);this._previousActiveHandlers=s,(Object.keys(a).length||Jo(n))&&(this._changes.push([n,o,a]),this._triggerRenderFrame()),(Object.keys(s).length||Jo(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:l}=n;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 no(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(const[e,t,i]of this._listeners)e.addEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[e,t,i]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){const i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new uo(i,e));const n=i.boxZoom=new fo(i,e);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();const o=i.cooperativeGestures=new Ho(i,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();const s=new _o(i),a=new Go(i);i.doubleClickZoom=new Uo(a,s),this._add("tapZoom",s),this._add("clickZoom",a),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const l=new $o;this._add("tapDragZoom",l);const c=i.touchPitch=new Oo(i);this._add("touchPitch",c),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const u=()=>i.project(i.getCenter()),h=function({enable:e,clickTolerance:i,aroundCenter:r=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:o=.8},s){const a=new To({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button&&!e.ctrlKey});return new vo({clickTolerance:i,move:(e,i)=>{const a=s();if(r&&Math.abs(a.y-e.y)>n)return{bearingDelta:t.cx(new t.P(e.x,i.y),i,a)};let l=(i.x-e.x)*o;return r&&i.y<a.y&&(l=-l),{bearingDelta:l}},moveStateManager:a,enable:e,assignEvents:Po})}(e,u),d=function({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:i=-.5}){const r=new To({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button});return new vo({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*i}),moveStateManager:r,enable:e,assignEvents:Po})}(e),p=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){const n=new To({checkCorrectEvent:e=>2===e.button&&e.ctrlKey});return new vo({clickTolerance:t,move:(e,t)=>{const n=r();let o=(t.x-e.x)*i;return t.y<n.y&&(o=-o),{rollDelta:o}},moveStateManager:n,enable:e,assignEvents:Po})}(e,u);i.dragRotate=new Zo(e,h,d,p),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",p,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const f=function({enable:e,clickTolerance:t}){const i=new To({checkCorrectEvent:e=>0===e.button&&!e.ctrlKey});return new vo({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:i,enable:e,assignEvents:Po})}(e),m=new Io(e,i);i.dragPan=new qo(r,f,m),this._add("mousePan",f),this._add("touchPan",m,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const g=new Do,y=new Lo;i.touchZoomRotate=new Wo(r,y,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new ho(i));const _=i.scrollZoom=new jo(i,(()=>
2this._triggerRenderFrame()));this._add("scrollZoom",_,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const v=i.keyboard=new zo(i);this._add("keyboard",v),e.interactive&&e.keyboard&&i.keyboard.enable()}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{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 Boolean(Xo(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,i){for(const r in e)if(r!==i&&!(null==t?void 0:t.includes(r)))return!0;return!1}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}mergeHandlerResult(e,i,r,n,o){if(!r)return;t.e(e,r);const s={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.rollDelta&&(i.roll=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){const e={},i={},r={};for(const[n,o,s]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(e.rollDelta=(e.rollDelta||0)+n.rollDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),t.e(i,o),t.e(r,s);this._updateMapTransform(e,i,r),this._changes=[]}_updateMapTransform(e,t,i){const r=this._map,n=r._getTransformForUpdate(),o=r.terrain;if(!(Jo(e)||o&&this._terrainMovement))return void this._fireEvents(t,i,!0);r._stop(!0);let{panDelta:s,zoomDelta:a,bearingDelta:l,pitchDelta:c,rollDelta:u,around:h,pinchAround:d}=e;void 0!==d&&(h=d),h||(h=r.transform.centerPoint),o&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const p={panDelta:s,zoomDelta:a,rollDelta:u,pitchDelta:c,bearingDelta:l,around:h};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const f=h.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(s?h.sub(s):h);this._handleMapControls({terrain:o,tr:n,deltasForHelper:p,preZoomAroundLoc:f,combinedEventsInProgress:t,panDelta:s}),r._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_handleMapControls({terrain:e,tr:t,deltasForHelper:i,preZoomAroundLoc:r,combinedEventsInProgress:n,panDelta:o}){const s=this._map.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(i,t),e)return s.useGlobeControls?(this._terrainMovement||!n.drag&&!n.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void s.handleMapControlsPan(i,t,r)):this._terrainMovement||!n.drag&&!n.zoom?void(n.drag&&this._terrainMovement&&o?t.setCenter(t.screenPointToLocation(t.centerPoint.sub(o))):s.handleMapControlsPan(i,t,r)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void s.handleMapControlsPan(i,t,r));s.handleMapControlsPan(i,t,r)}_fireEvents(e,i,r){const n=Xo(this._eventsInProgress),o=Xo(e),s={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(s[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in s)this._fireEvent(e,s[e]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const l={};let c;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],c=i[t]||r,l[`${e}end`]=c)}for(const e in l)this._fireEvent(e,l[e]);const u=Xo(this._eventsInProgress),h=(n||o)&&!u;if(h&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const e=this._map._getTransformForUpdate();
2this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(r&&h){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;!e||!e.essential&&a.prefersReducedMotion?(this._map.fire(new t.n("moveend",{originalEvent:c})),i(this._map.getBearing())&&this._map.resetNorth()):(i(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.n(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{delete this._frameId,this.handleEvent(new Yo("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class Qo extends t.E{constructor(e,t,i){super(),this._renderFrameCallback=()=>{const e=Math.min((c()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this._zoomSnap=i.zoomSnap,this.cameraHelper=t,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(e,t){e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t}getCenter(){return new t.W(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,r){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},i),r)}panTo(e,i,r){return this.easeTo(t.e({center:e},i),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,i,r){return this.easeTo(t.e({zoom:e},i),r)}zoomIn(e,i){return this.zoomTo(t.cw(this.getZoom()+1,this._zoomSnap),e,i),this}zoomOut(e,i){return this.zoomTo(t.cw(this.getZoom()-1,this._zoomSnap),e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.n("movestart",i)).fire(new t.n("move",i)).fire(new t.n("moveend",i))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,i,r){return this.easeTo(t.e({bearing:e},i),r)}resetNorth(e,i){return this.rotateTo(0,t.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=G.convert(e).adjustAntiMeridian();const i=(null==t?void 0:t.bearing)||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,i,r,n){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=t.e({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){const e=n.padding;n.padding={top:e,bottom:e,right:e,left:e}}const s=t.e(o,n.padding);n.padding=s;const a=this.transform,l=new G(e,i),c=this.cameraHelper.cameraForBoxAndBearing(n,s,l,r,a);return c&&this._zoomSnap&&(c.zoom=t.cw(c.zoom,this._zoomSnap,-1)),c}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,i,r,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(t.P.convert(e)),this.transform.screenPointToLocation(t.P.convert(i)),r,n),n,o)}_fitInternal(e,i,r){return e?(delete(i=t.e(e,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(e,i){this.stop(),"zoom"in e&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap));const r=this._getTransformForUpdate();let n=!1,o=!1,s=!1;const a=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLatZoom(e.center?t.W.convert(e.center):r.center,e.zoom||r.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(r,e);const l=r.zoom!==a;return"elevation"in e&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),"bearing"in e&&r.bearing!==+e.bearing&&(n=!0,r.setBearing(+e.bearing)),"pitch"in e&&r.pitch!==+e.pitch&&(o=!0,r.setPitch(+e.pitch)),"roll"in e&&r.roll!==+e.roll&&(s=!0,r.setRoll(+e.roll)),null==e.padding||r.isPaddingEqual(e.padding)||r.setPadding(e.padding),this._applyUpdatedTransform(r),this.fire(new t.n("movestart",i)).fire(new t.n("move",i)),l&&this.fire(new t.n("zoomstart",i)).fire(new t.n("zoom",i)).fire(new t.n("zoomend",i)),n&&this.fire(new t.n("rotatestart",i)).fire(new t.n("rotate",i)).fire(new t.n("rotateend",i)),o&&this.fire(new t.n("pitchstart",i)).fire(new t.n("pitch",i)).fire(new t.n("pitchend",
2i)),s&&this.fire(new t.n("rollstart",i)).fire(new t.n("roll",i)).fire(new t.n("rollend",i)),this.fire(new t.n("moveend",i))}calculateCameraOptionsFromTo(e,i,r,n=0){const o=t.a7.fromLngLat(e,i),s=t.a7.fromLngLat(r,n),a=s.x-o.x,l=s.y-o.y,c=s.z-o.z,u=Math.hypot(a,l,c);if(0===u)throw new Error("Can't calculate camera options with same From and To");const h=Math.hypot(a,l),d=t.ar(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=180*Math.atan2(a,-l)/Math.PI;let f=180*Math.acos(h/u)/Math.PI;return f=c<0?90-f:90+f,{center:s.toLngLat(),elevation:n,zoom:d,pitch:f,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,n){const o=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,r);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:i,pitch:r,roll:n}}easeTo(e,i){this._stop(!1,e.easeId),"zoom"in(e=t.e({offset:[0,0],duration:500,easing:t.cy},e))&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap)),(!1===e.animate||!e.essential&&a.prefersReducedMotion)&&(e.duration=0);const r=this._getTransformForUpdate(),n=this.getBearing(),o=r.pitch,s=r.roll,l="bearing"in e?this._normalizeBearing(e.bearing,n):n,c="pitch"in e?+e.pitch:o,u="roll"in e?this._normalizeBearing(e.roll,s):s,h="padding"in e?e.padding:r.padding,d=t.P.convert(e.offset);let p,f;e.around&&(p=t.W.convert(e.around),f=r.locationToScreenPoint(p));const m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(r,{bearing:l,pitch:c,roll:u,padding:h,around:p,aroundPoint:f,offsetAsPoint:d,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||(this._rotating=n!==l),this._pitching||(this._pitching=c!==o),this._rolling||(this._rolling=u!==s),this._padding=!r.isPaddingEqual(h),this._zooming||(this._zooming=g.isZooming),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,m),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease((t=>{g.easeFunc(t),this.terrain&&!e.freezeElevation&&this._updateElevation(t),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(t=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,t)}),e),this}_prepareEase(e,i,r={}){this._moving=!0,i||r.moving||this.fire(new t.n("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.n("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.n("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.n("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new t.n("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(i-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(t.H.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const t=e.getCameraLngLat(),i=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(i<r){const i=this.calculateCameraOptionsFromTo(t,r,e.center,e.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}_applyUpdatedTransform(e){const t=[];if(t.push((e=>this._elevateCameraIfInsideTerrain(e))),this.transformCameraUpdate&&t.push((e=>this.transformCameraUpdate(e))),!t.length)return;const i=e.clone();for(const e of t){const t=i.clone(),{center:r,zoom:n,roll:o,pitch:s,bearing:a,elevation:l}=e(t);r&&t.setCenter(r),void 0!==l&&t.setElevation(l),void 0!==n&&t.setZoom(n),void 0!==o&&t.setRoll(o),void 0!==s&&t.setPitch(s),void 0!==a&&t.setBearing(a),i.apply(t,!1)}this.transform.apply(i,!1)}_fireMoveEvents(e){this.fire(new t.n("move",e)),this._zooming&&this.fire(new t.n("zoom",e)),this._rotating&&this.fire(new t.n("rotate",e)),this._pitching&&this.fire(new t.n("pitch",e)),this._rolling&&this.fire(new t.n("roll",e))}
vendor: 22,842 bytes, line 2
2_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const r=this._zooming,n=this._rotating,o=this._pitching,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new t.n("zoomend",e)),n&&this.fire(new t.n("rotateend",e)),o&&this.fire(new t.n("pitchend",e)),s&&this.fire(new t.n("rollend",e)),this.fire(new t.n("moveend",e))}flyTo(e,i){if(!e.essential&&a.prefersReducedMotion){const r=t.V(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(r,i)}this.stop(),"zoom"in(e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.cy},e))&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap));const r=this._getTransformForUpdate(),n=r.bearing,o=r.pitch,s=r.roll,l=r.padding,c="bearing"in e?this._normalizeBearing(e.bearing,n):n,u="pitch"in e?+e.pitch:o,h="roll"in e?this._normalizeBearing(e.roll,s):s,d="padding"in e?e.padding:r.padding,p=t.P.convert(e.offset);let f=r.centerPoint.add(p);const m=r.screenPointToLocation(f),g=this.cameraHelper.handleFlyTo(r,{bearing:c,pitch:u,roll:h,padding:d,locationAtOffset:m,offsetAsPoint:p,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let y=e.curve;const _=Math.max(r.width,r.height),v=_/g.scaleOfZoom,b=g.pixelPathLength;"number"==typeof g.scaleOfMinZoom&&(y=Math.sqrt(_/g.scaleOfMinZoom/b*2));const x=y*y;function w(e){const t=(v*v-_*_+(e?-1:1)*x*x*b*b)/(2*(e?v:_)*x*b);return Math.log(Math.sqrt(t*t+1)-t)}function T(e){return(Math.exp(e)-Math.exp(-e))/2}function E(e){return(Math.exp(e)+Math.exp(-e))/2}const S=w(!1);let P=function(e){return E(S)/E(S+y*e)},I=function(e){return _*((E(S)*(T(t=S+y*e)/E(t))-T(S))/x)/b;var t},C=(w(!0)-S)/y;if(Math.abs(b)<2e-6||!isFinite(C)){if(Math.abs(_-v)<1e-6)return this.easeTo(e,i);const t=v<_?-1:1;C=Math.abs(Math.log(v/_))/y,I=()=>0,P=e=>Math.exp(t*y*e)}return e.duration="duration"in e?+e.duration:1e3*C/("screenSpeed"in e?+e.screenSpeed/y:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=n!==c,this._pitching=u!==o,this._rolling=h!==s,this._padding=!r.isPaddingEqual(d),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease((a=>{const m=a*C,y=1/P(m),_=I(m);this._rotating&&r.setBearing(t.H.number(n,c,a)),this._pitching&&r.setPitch(t.H.number(o,u,a)),this._rolling&&r.setRoll(t.H.number(s,h,a)),this._padding&&(r.interpolatePadding(l,d,a),f=r.centerPoint.add(p)),g.easeFunc(a,y,_,f),this.terrain&&!e.freezeElevation&&this._updateElevation(a),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(e,t,i){!1===i.animate||0===i.duration?(e(1),t()):(this._easeStart=c(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=t.X(e,-180,180);const r=Math.abs(e-i);return Math.abs(e-360-i)<r&&(e-=360),Math.abs(e+360-i)<r&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(t.W.convert(e),this.transform):null}}const es={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class ts{constructor(e=es){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||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType&&"terrain"!==e.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?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=d.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=d.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=d.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(){this._container.remove(),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){const i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((e=>"string"!=typeof e?"":e))):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style.tileManagers;for(const i in t){const r=t[i];if(r.used||r.usedForTerrain){const t=r.getSource();t.attribution&&!e.includes(t.attribution)&&e.push(t.attribution)}}e=e.filter((e=>String(e).trim())),e.sort(((e,t)=>e.length-t.length)),e=e.filter(((t,i)=>{for(let r=i+1;r<e.length;r++)if(e[r].includes(t))return!1;return!0}));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=d.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class is{constructor(e={}){this._updateCompact=()=>{const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){var t;this._map=e,this._compact=null===(t=this.options)||void 0===t?void 0:t.compact,this._container=d.create("div","maplibregl-ctrl");const i=d.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class rs{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ns=t.aS([{name:"a_pos3d",type:"Int16",components:3}]);class os extends t.E{constructor(e){super(),this._lastTilesetChange=c(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(e,i){this.tileManager.update(e,i),this._renderableTilesKeys=[];const r={};for(const n of Pe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.tileManager._source.calculateTileZoom}))r[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),t.c7(n.terrainRttPosMatrix32f,0,t.a6,t.a6,0,0,1),this._tiles[n.key]=new de(n,this.tileSize),this._lastTilesetChange=c());for(const e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(e){for(const t in this._tiles){const i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const r of this._renderableTilesKeys){const n=this._tiles[r].tileID,o=e.clone(),s=t.bj();if(n.canonical.equals(e.canonical))t.c7(s,0,t.a6,t.a6,0,0,1);else if(n.canonical.isChildOf(e.canonical)){const i=n.canonical.z-e.canonical.z,r=n.canonical.x-(n.canonical.x>>i<<i),o=n.canonical.y-(n.canonical.y>>i<<i),a=t.a6>>i;t.c7(s,0,a,a,0,0,1),t.Q(s,s,[-r*a,-o*a,0])}else{if(!e.canonical.isChildOf(n.canonical))continue;{const i=e.canonical.z-n.canonical.z,r=e.canonical.x-(e.canonical.x>>i<<i),o=e.canonical.y-(e.canonical.y>>i<<i),a=t.a6>>i;t.c7(s,0,t.a6,t.a6,0,0,1),t.Q(s,s,[r*a,o*a,0]),t.S(s,s,[1/2**i,1/2**i,0])}}o.terrainRttPosMatrix32f=new Float32Array(s),i[r]=o}return i}_getTerrainCoordsForTileRanges(e,i){const r={};for(const n of this._renderableTilesKeys){const o=this._tiles[n].tileID;if(!this._isWithinTileRanges(o,i))continue;const s=e.clone(),a=t.bj();if(o.canonical.z===e.canonical.z){const i=e.canonical.x-o.canonical.x+e.wrap*(1<<e.canonical.z),r=e.canonical.y-o.canonical.y;t.c7(a,0,t.a6,t.a6,0,0,1),t.Q(a,a,[i*t.a6,r*t.a6,0])}else if(o.canonical.z>e.canonical.z){const i=o.canonical.z-e.canonical.z,r=o.canonical.x-(o.canonical.x>>i<<i)+e.wrap*(1<<o.canonical.z),n=o.canonical.y-(o.canonical.y>>i<<i),s=e.canonical.x-(o.canonical.x>>i),l=e.canonical.y-(o.canonical.y>>i),c=t.a6>>i;t.c7(a,0,c,c,0,0,1),t.Q(a,a,[-r*c+s*t.a6,-n*c+l*t.a6,0])}else{const i=e.canonical.z-o.canonical.z,r=e.canonical.x-(e.canonical.x>>i<<i)+e.wrap*(1<<e.canonical.z),n=e.canonical.y-(e.canonical.y>>i<<i),s=(e.canonical.x>>i)-o.canonical.x,l=(e.canonical.y>>i)-o.canonical.y,c=t.a6<<i;t.c7(a,0,c,c,0,0,1),t.Q(a,a,[r*t.a6+s*c,n*t.a6+l*c,0])}s.terrainRttPosMatrix32f=new Float32Array(a),r[n]=s}return r}getSourceTile(e,t){var i,r;const n=this.tileManager._source;let o=e.overscaledZ-this.deltaZoom;if(o>n.maxzoom&&(o=n.maxzoom),o<n.minzoom)return;(i=this._sourceTileCache)[r=e.key]||(i[r]=e.scaledTo(o).key);let s=this.findTileInCaches(this._sourceTileCache[e.key]);if(!(null==s?void 0:s.dem)&&t)for(;o>=n.minzoom&&!(null==s?void 0:s.dem);)s=this.findTileInCaches(e.scaledTo(o--).key);return s}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){const i=t[e.canonical.z];return!!i&&(e.wrap>i.minWrap||e.wrap<i.maxWrap||e.canonical.x>=i.minTileXWrapped&&e.canonical.x<=i.maxTileXWrapped&&e.canonical.y>=i.minTileY&&e.canonical.y<=i.maxTileY)}}class ss{constructor(e,t,i){this._meshCache={},this.painter=e,this.tileManager=new os(t),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(const e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,i,r,n=t.a6){var o;const s=e.normalizeCoordinates(i,r,n);if(!s)return 0;const a=this.getTerrainData(s.tileID),l=null===(o=a.tile)||void 0===o?void 0:o.dem;if(!l)return 0;const c=t.cC([],[s.x/n*t.a6,s.y/n*t.a6],a.u_terrain_matrix),u=[c[0]*l.dim,c[1]*l.dim],h=Math.floor(u[0]),d=Math.floor(u[1]),p=u[0]-h,f=u[1]-d;return l.get(h,d)*(1-p)*(1-f)+l.get(h+1,d)*p*(1-f)+l.get(h,d+1)*(1-p)*f+l.get(h+1,d+1)*p*f}getElevationForLngLatZoom(e,i){if(!t.cD(i,e.wrap()))return 0;const{tileID:r,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(r,n%t.a6,o%t.a6,t.a6)}getElevationForLngLat(e,t){const i=Pe(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let r=0;for(const e of i)e.canonical.z>r&&(r=Math.min(e.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,r)}getElevation(e,i,r,n=t.a6){return this.getDEMElevation(e,i,r,n)*this.exaggeration}getTerrainData(e){var i,r;if(!this._emptyDemTexture){const e=this.painter.context,i=new t.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new t.T(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new t.T(e,new t.R({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.ap([])}const n=this.tileManager.getSourceTile(e,!0);if((null==n?void 0:n.dem)&&(!n.demTexture||n.needsTerrainPrepare)){const e=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new t.T(e,n.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),n.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const o=n&&n.toString()+n.tileID.key+e.key;if(o&&!this._demMatrixCache[o]){const i=this.tileManager.getSource().maxzoom;let r=e.canonical.z-n.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?r=e.canonical.z-i:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const s=e.canonical.x-(e.canonical.x>>r<<r),a=e.canonical.y-(e.canonical.y>>r<<r),l=t.cE(new Float64Array(16),[1/(t.a6<<r),1/(t.a6<<r),0]);t.Q(l,l,[s*t.a6,a*t.a6,0]),this._demMatrixCache[o]={matrix:l,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:(null===(i=null==n?void 0:n.dem)||void 0===i?void 0:i.dim)||1,u_terrain_matrix:o?this._demMatrixCache[o].matrix:this._emptyDemMatrix,u_terrain_unpack:(null===(r=null==n?void 0:n.dem)||void 0===r?void 0:r.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:((null==n?void 0:n.demTexture)||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(e){const i=this.painter,r=i.width/devicePixelRatio,n=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===r&&this._fbo.height===n||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new t.T(i.context,{width:r,height:n,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new t.T(i.context,{width:r,height:n,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(r,n,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,r,n))),this._fbo.colorAttachment.set("coords"===e?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,t=0;e<this._coordsTextureSize;e++)for(let r=0;r<this._coordsTextureSize;r++,t+=4)i[t+0]=255&r,i[t+1]=255&e,i[t+2]=r>>8<<4|e>>8,i[t+3]=0;const r=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),n=new t.T(e,r,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();const i=new Uint8Array(4),r=this.painter.context,n=r.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),s=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),a=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,a-s-1,1,1,n.RGBA,n.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),c=i[1]+((15&i[2])<<8),u=this.coordsIndex[255-i[3]],h=u&&this.tileManager.getTileByID(u);if(!h)return null;const d=this._coordsTextureSize,p=(1<<h.tileID.canonical.z)*d;return new t.a7((h.tileID.canonical.x*d+l)/p+h.tileID.wrap,(h.tileID.canonical.y*d+c)/p,this.getElevation(h.tileID,l,c,d))}depthAtPoint(e){const t=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){var i;const r=(null===(i=this.painter.style.projection)||void 0===i?void 0:i.transitionState)>0,n=r&&0===e.canonical.y,o=r&&e.canonical.y===(1<<e.canonical.z)-1,s=`m_${n?"n":""}_${o?"s":""}`;if(this._meshCache[s])return this._meshCache[s];const a=this.painter.context,l=new t.cF,c=new t.aW,u=this.meshSize,h=t.a6/u,d=u*u;for(let e=0;e<=u;e++)for(let t=0;t<=u;t++)l.emplaceBack(t*h,e*h,0);for(let e=0;e<d;e+=u+1)for(let t=0;t<u;t++)c.emplaceBack(t+e,u+t+e+1,u+t+e+2),c.emplaceBack(t+e,u+t+e+2,t+e+1);const p=l.length,f=p+(u+1),m=(u+1)*u,g=n?t.bq:0,y=n?0:1,_=o?t.br:t.a6,v=o?0:1;for(let e=0;e<=u;e++)l.emplaceBack(e*h,g,y);for(let e=0;e<=u;e++)l.emplaceBack(e*h,_,v);for(let e=0;e<u;e++)c.emplaceBack(m+e,f+e,f+e+1),c.emplaceBack(m+e,f+e+1,m+e+1),c.emplaceBack(0+e,p+e+1,p+e),c.emplaceBack(0+e,0+e+1,p+e+1);const b=l.length,x=b+2*(u+1);for(const e of[0,1])for(let i=0;i<=u;i++)for(const r of[0,1])l.emplaceBack(e*t.a6,i*h,r);for(let e=0;e<2*u;e+=2)c.emplaceBack(b+e,b+e+1,b+e+3),c.emplaceBack(b+e,b+e+3,b+e+2),c.emplaceBack(x+e,x+e+3,x+e+1),c.emplaceBack(x+e,x+e+2,x+e+3);const w=new zt(a.createVertexBuffer(l,ns.members),a.createIndexBuffer(c),t.aV.simpleSegment(0,0,l.length,c.length));return this._meshCache[s]=w,w}getMeshFrameDelta(e){return 2*Math.PI*t.bD/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var r;if(!t.cD(i,e.wrap()))return 0;const{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(e,i);return null!==(r=this.getMinMaxElevation(n).minElevation)&&void 0!==r?r:0}getMinMaxElevation(e){const t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return(null==t?void 0:t.dem)&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,i){const r=t.a7.fromLngLat(e.wrap()),n=(1<<i)*t.a6,o=r.x*n,s=r.y*n,a=Math.floor(o/t.a6),l=Math.floor(s/t.a6);return{tileID:new t.a3(i,0,i,a,l),mercatorX:o,mercatorY:s}}}class as{constructor(e,t,i){this._context=e,this._size=t,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),r=new t.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return r.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(r.texture),{id:e,fbo:i,texture:r,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((t=>e.id!==t)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((e=>!e.inUse))}}const ls={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class cs{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new as(e.context,30,t.tileManager.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}
2prepareForRender(e,t){var i,r,n;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter((i=>!e._layers[i].isHidden(t))),this._coordsAscending={};for(const t in e.tileManagers){this._coordsAscending[t]={};const i=e.tileManagers[t].getVisibleCoordinates(),r=e.tileManagers[t].getSource(),o=r instanceof te?r.terrainTileRanges:null;for(const e of i){const i=this.terrain.tileManager.getTerrainCoords(e,o);for(const e in i)(n=this._coordsAscending[t])[e]||(n[e]=[]),this._coordsAscending[t][e].push(i[e])}}this._rttFingerprints={};for(const t of e._order){const n=e._layers[t],o=n.source;if(ls[n.type]&&!this._rttFingerprints[o]){this._rttFingerprints[o]={};const t=null!==(r=null===(i=e.tileManagers[o])||void 0===i?void 0:i.getState().revision)&&void 0!==r?r:0;for(const e in this._coordsAscending[o])this._rttFingerprints[o][e]=`${this._coordsAscending[o][e].map((e=>e.key)).sort().join()}#${t}`}}for(const e of this._renderableTiles)for(const t in this._rttFingerprints){const i=this._rttFingerprints[t][e.tileID.key];i&&i!==e.rttFingerprint[t]&&(e.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const r=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),n=e.type,o=this.painter,s=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(ls[n]&&(this._prevType&&ls[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!s))return!0;if(ls[this._prevType]||ls[n]&&s){this._prevType=n;const e=this._stacks.length-1,i=this._stacks[e]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(Zn(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[e]){const t=this.pool.getObjectForId(n.rtt[e].id);if(t.stamp===n.rtt[e].stamp){this.pool.useObject(t);continue}}const s=this.pool.getOrCreateFreeObject();this.pool.useObject(s),this.pool.stampObject(s),n.rtt[e]={id:s.id,stamp:s.stamp},o.context.bindFramebuffer.set(s.fbo.framebuffer),o.context.clear({color:t.bo.transparent,stencil:0}),o.currentStencilSource=void 0;for(const e of i){const t=o.style._layers[e],i=t.source?this._coordsAscending[t.source][n.tileID.key]:[n.tileID];o.context.viewport.set([0,0,s.fbo.width,s.fbo.height]),o._renderTileClippingMasks(t,i,!0),o.renderLayer(o,o.style.tileManagers[t.source],t,i,r),t.source&&(n.rttFingerprint[t.source]=this._rttFingerprints[t.source][n.tileID.key])}}return Zn(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects(),ls[n]}return!1}}const us={"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":"Drag to rotate map, click to reset 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 ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},hs=i,ds={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:es,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,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,maxTileC
2acheSize:null,maxTileCacheZoomLevels:t.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20};let ps=class extends Qo{get _ownerWindow(){var e,t;return(null===(t=null===(e=this._container)||void 0===e?void 0:e.ownerDocument)||void 0===t?void 0:t.defaultView)||window}constructor(e){var i,r,n;const o=Object.assign(Object.assign(Object.assign({},ds),e),{canvasContextAttributes:Object.assign(Object.assign({},ds.canvasContextAttributes),e.canvasContextAttributes)});if(null!=o.minZoom&&null!=o.maxZoom&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=o.minPitch&&null!=o.maxPitch&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=o.minPitch&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=o.maxPitch&&o.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const s=new Xt,l=new Qt;void 0!==o.minZoom&&s.setMinZoom(o.minZoom),void 0!==o.maxZoom&&s.setMaxZoom(o.maxZoom),void 0!==o.minPitch&&s.setMinPitch(o.minPitch),void 0!==o.maxPitch&&s.setMaxPitch(o.maxPitch),void 0!==o.renderWorldCopies&&s.setRenderWorldCopies(o.renderWorldCopies),null!==o.transformConstrain&&s.setConstrainOverride(o.transformConstrain),super(s,l,{bearingSnap:o.bearingSnap,zoomSnap:o.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new rs,this._controls=[],this._mapId=t.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=e=>{if(e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(const e of Object.values(this.style._layers))if("custom"===e.type&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(const[t]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new t.n("webglcontextlost",{originalEvent:e}))}else this.fire(new t.n("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new t.n("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=o.interactive,this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},o.canvasContextAttributes),this._trackResize=!0===o.trackResize,this._bearingSnap=o.bearingSnap,this._zoomSnap=o.zoomSnap,this._centerClampedToGround=o.centerClampedToGround,this._refreshExpiredTiles=!0===o.refreshExpiredTiles,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=!0===o.crossSourceCollisions,this._collectResourceTiming=!0===o.collectResourceTiming,this._locale=Object.assign(Object.assign({},us),o.locale),this._clickTolerance=o.clickTolerance,this._overridePixelRatio=o.pixelRatio,this._maxCanvasSize=o.maxCanvasSize,this._zoomLevelsToOverscale=o.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=o.transformCameraUpdate,this.transformConstrain=o.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===o.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(o.anisotropicFilterPitch),void 0!==o.reduceMotion&&(a.prefersReducedMotion=o.reduceMotion),this._imageQueueHandle=h.addThrottleControl((()=>this.isMoving())),this._requestManager=new p(o.transformRequest),this._container=this._resolveContainer(o.container),o.maxBounds&&this.setMaxBounds(o.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.depthDirty=!0,this._update(!0)})),this.once("idle",(()=>this._idleTriggered=!0)),"undefined"!=typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Ko(this,o),this._hash=o.hash?new Jn("string"==typeof o.hash&&o.hash||void 0).addTo(this):void 0,(null===(i=this._hash)||void 0===i?void 0:i._onHashChange())||(this.jumpTo({center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,roll:o.roll}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,t.e({},o.fitBoundsOptions,{duration:0}))));const c="string"==typeof o.style||!("globe"===(null===(n=null===(r=o.style)||void 0===r?void 0:r.projection)||void 0===n?void 0:n.type));this.resize(null,c),this._localIdeographFontFamily=o.localIdeographFontFamily,this._val
2idateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new ts("boolean"==typeof o.attributionControl?void 0:o.attributionControl)),o.maplibreLogo&&this.addControl(new is,o.logoPosition),this.on("style.load",(()=>{if(c||this._resizeTransform(),this.transform.unmodified){const e=t.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.n(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.n(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.n("sourcedataabort",e))}))}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!(null==e?void 0:e.onAdd))return this.fire(new t.l(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=e.onAdd(this);this._controls.push(e);const n=this._controlPositions[i];return i.includes("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(e){if(!(null==e?void 0:e.onRemove))return this.fire(new t.l(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return Pe(this.transform,e)}calculateCameraOptionsFromTo(e,t,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLat(i,this.transform)),super.calculateCameraOptionsFromTo(e,t,i,r)}resize(e,i=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(i);const r=!this._moving;return r&&(this.stop(),this.fire(new t.n("movestart",e)).fire(new t.n("move",e))),this.fire(new t.n("resize",e)),r&&this.fire(new t.n("moveend",e)),this}_resizeInternal(e=!0){const[t,i]=this._containerDimensions(),r=this._getClampedPixelRatio(t,i);if(this._resizeCanvas(t,i,r),this.painter.resize(t,i,r),this.painter.overLimit()){const e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];const r=this._getClampedPixelRatio(t,i);this._resizeCanvas(t,i,r),this.painter.resize(t,i,r)}this._resizeTransform(e)}_resizeTransform(e=!0){var t;const[i,r]=this._containerDimensions();this.transform.resize(i,r,e),null===(t=this._requestedCameraState)||void 0===t||t.resize(i,r,e)}_getClampedPixelRatio(e,t){const{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),o=e*n,s=t*n;return Math.min(o>i?i/o:1,s>r?r/s:1)*n}getPixelRatio(){var e;return null!==(e=this._overridePixelRatio)&&void 0!==e?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(G.convert(e)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom){const i=this.transform.zoom,r=this._getTransformForUpdate();return r.setMinZoom(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.zoom&&this.fire(new t.n("zoomstart")).fire(new t.n("zoom")).fire(new t.n("zoomend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=null==e?22:e)>=this.transform.minZoom){const i=this.transform.zoom,r=this._getTransformForUpdate();return r.setMaxZoom(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.zoom&&this.fire(new t.n("zoomstart")).fire(new t.n("zoom")).fire(new t.n("zoomend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch){const i=this.transform.pitch,r=this._getTransformForUpdate();return r.setMinPitch(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.pitch&&this.fire(new t.n("pitchstart")).fire(new t.n("pitch")).fire(new t.n("pitchend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=null==e?60:e)>180)throw new Error("maxPitch must be less than or equal to 180");if(e>=this.transform.minPitch){const i=this.transform.pitch,r=this._getTransformForUpdate();return r.setMaxPitch(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.pitch&&this.fire(new t.n("pitchstart")).fire(new t.n("pitch")).fire(new t.n("pitchend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if((e=null==e?20:e)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this.transform.setConstrainOverride(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.W.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null===(e=this.handlers)||void 0===e?void 0:e.isMoving())}isZooming(){var e;return this._zooming||(null===(e=this.handlers)||void 0===e?void 0:e.isZooming())}isRotating(){var e;return this._rotating||(null===(e=this.handlers)||void 0===e?void 0:e.isRotating())}
2_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let r=!1;const n=n=>{const o=t.filter((e=>this.getLayer(e))),s=0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];s.length?r||(r=!0,i.call(this,new ao(e,this,n.originalEvent,{features:s}))):r=!1};return{layers:t,listener:i,delegates:{mousemove:n,mouseout:()=>{r=!1}}}}if("mouseleave"===e||"mouseout"===e){let r=!1;const n=n=>{const o=t.filter((e=>this.getLayer(e)));(0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?r=!0:r&&(r=!1,i.call(this,new ao(e,this,n.originalEvent)))},o=t=>{r&&(r=!1,i.call(this,new ao(e,this,t.originalEvent)))};return{layers:t,listener:i,delegates:{mousemove:n,mouseout:o}}}{const r=e=>{const r=t.filter((e=>this.getLayer(e))),n=0!==r.length?this.queryRenderedFeatures(e.point,{layers:r}):[];n.length&&(e.features=n,i.call(this,e),delete e.features)};return{layers:t,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){var i;this._delegatedListeners||(this._delegatedListeners={}),(i=this._delegatedListeners)[e]||(i[e]=[]),this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){var r;if(!(null===(r=this._delegatedListeners)||void 0===r?void 0:r[e]))return;const n=this._delegatedListeners[e];for(let e=0;e<n.length;e++){const r=n[e];if(r.listener===i&&r.layers.length===t.length&&r.layers.every((e=>t.includes(e)))){for(const e in r.delegates)this.off(e,r.delegates[e]);return void n.splice(e,1)}}}on(e,t,i){if(void 0===i)return super.on(e,t);const r="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,r,i);this._saveDelegatedListener(e,n);for(const e in n.delegates)this.on(e,n.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(void 0===i)return super.once(e,t);const r="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,r,i);for(const t in n.delegates){const o=n.delegates[t];n.delegates[t]=(...t)=>{this._removeDelegatedListener(e,r,i),o(...t)}}this._saveDelegatedListener(e,n);for(const e in n.delegates)this.once(e,n.delegates[e]);return this}off(e,t,i){return void 0===i?super.off(e,t):(this._removeDelegatedListener(e,"string"==typeof t?[t]:t,i),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let r;const n=e instanceof t.P||Array.isArray(e),o=n?e:[[0,0],[this.transform.width,this.transform.height]];if(i||(i=(n?{}:e)||{}),o instanceof t.P||"number"==typeof o[0])r=[t.P.convert(o)];else{const e=t.P.convert(o[0]),i=t.P.convert(o[1]);r=[e,new t.P(i.x,e.y),i,new t.P(e.x,i.y),e]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,i){return!1!==(i=t.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
2idateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var i,r,n;if(null===(i=this._diffStyleRequest)||void 0===i||i.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(e,t)));const o=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new Ri(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,o):this.style.loadJSON(e,t,o),this):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),null===(n=null===(r=this.style)||void 0===r?void 0:r.projection)||void 0===n||n.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ri(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){return t._(this,void 0,void 0,(function*(){var r;if(null===(r=this._diffStyleRequest)||void 0===r||r.abort(),"string"==typeof e){const r=e;this._diffStyleRequest=new AbortController;const n=this._diffStyleRequest;try{const e=yield this._requestManager.transformRequest(r,"Style");if(n.signal.aborted)return void(this._diffStyleRequest=null);const o=yield t.k(e,n);this._diffStyleRequest=null,this._updateDiff(o.data,i)}catch(e){this._diffStyleRequest=null,t.$(e)||this.fire(new t.l(t.d(e)))}}else"object"==typeof e&&(this._diffStyleRequest=null,this._updateDiff(e,i))}))}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(r){t.w(`Unable to perform style diff: ${t.d(r).message}.  Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();t.w("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){var i;const r=null===(i=this.style)||void 0===i?void 0:i.tileManagers[e];if(void 0!==r)return r.loaded();this.fire(new t.l(new Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){const i=this.style.tileManagers[e.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);null===this.terrain&&i.reload();for(const i in this.style._layers){const r=this.style._layers[i];"hillshade"===r.type&&r.source===e.source&&t.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===r.type&&r.source===e.source&&t.w("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 ss(this.painter,i,e),this.painter.renderToTexture=new cs(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=t=>{var i;"style"===t.dataType?this.terrain.tileManager.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.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))),"image"===(null===(i=t.source)||void 0===i?void 0:i.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGroun
2d&&this.transform.setElevation(0);return this.fire(new t.n("terrain",{terrain:e})),this}getTerrain(){var e,t;return null!==(t=null===(e=this.terrain)||void 0===e?void 0:e.options)&&void 0!==t?t:null}areTilesLoaded(){var e;const t=null===(e=this.style)||void 0===e?void 0:e.tileManagers;for(const e of Object.values(t))if(!e.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,i){if(i){const r=this.getSource(i);if(!r)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);r.calculateTileZoom=Te(Math.max(1,e),Math.max(1,t))}else for(const i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=Te(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,i){const r=this.style.tileManagers[e];if(!r)throw new Error(`There is no tile manager with ID "${e}", cannot refresh tile`);void 0===i?r.reload(!0):r.refreshTiles(i.map((e=>new t.aa(e.z,e.x,e.y))))}addImage(e,i,r={}){const{pixelRatio:n=1,sdf:o=!1,stretchX:s,stretchY:l,content:c,textFitWidth:u,textFitHeight:h}=r;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.l(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`")));{const{width:r,height:a,data:d}=i,p=i;return this.style.addImage(e,{data:new t.R({width:r,height:a},new Uint8Array(d)),pixelRatio:n,stretchX:s,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0,userImage:p}),p.onAdd&&p.onAdd(this,e),this}}{const{width:r,height:d,data:p}=a.getImageData(i);this.style.addImage(e,{data:new t.R({width:r,height:d},p),pixelRatio:n,stretchX:s,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0})}}updateImage(e,i){const r=this.style.getImage(e);if(!r)return this.fire(new t.l(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof HTMLImageElement||t.b(i)?a.getImageData(i):i,{width:o,height:s,data:l}=n;if(void 0===o||void 0===s)return this.fire(new t.l(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(o!==r.data.width||s!==r.data.height)return this.fire(new t.l(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(i instanceof HTMLImageElement||t.b(i));return r.data.replace(l,c),this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.l(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return t._(this,void 0,void 0,(function*(){return h.getImage(yield this._requestManager.transformRequest(e,"Image"),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,r={}){return this.style.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,(e=>{e||this._update(!0)})),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,(e=>{e||this._update(!0)})),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupResizeObserver(){var e;let t=!1;const i=Yn((e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())}),50),r=null!==(e=this._ownerWindow.ResizeObserver)&&void 0!==e?e:ResizeObserver;this._resizeObserver=new r((e=>{t?i(e):t=!0})),this._resizeObserver.observe(this._container)}
2_resolveContainer(e){if("string"==typeof e){const t=document.getElementById(e);if(!t)throw new Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement)return e;if(e&&"object"==typeof e&&1===e.nodeType)return e;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){const e=this._container;e.classList.add("maplibregl-map");const t=this._canvasContainer=d.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=d.create("canvas","maplibregl-canvas",t),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");const i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);const n=this._controlContainer=d.create("div","maplibregl-control-container",e),o=this._controlPositions={};for(const e of["top-left","top-right","bottom-left","bottom-right"])o[e]=d.create("div",`maplibregl-ctrl-${e} `,n);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const e=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{t={requestedAttributes:e},i&&(t.statusMessage=i.statusMessage,t.type=i.type)}),{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!i){const e="Failed to initialize WebGL";throw t?(t.message=e,new Error(JSON.stringify(t))):new Error(e)}this.painter=new Xn(i,this.transform)}migrateProjection(e,i){super.migrateProjection(e,i),this.painter.transform=e,this.fire(new t.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){var t;return(null===(t=this.style)||void 0===t?void 0:t._loaded)?(this._styleDirty||(this._styleDirty=e),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var i,r,n,o,s,a;const l=this._idleTriggered?this._fadeDuration:0,u=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let h=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=c();this.style.zoomHistory.update(e,i);const r=new t.J(e,{now:i,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=r.crossFadingFactor();1===n&&n===this._crossFadingFactor||(h=!0,this._crossFadingFactor=n),this.style.update(r)}const d=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0!==u;null===(n=this.style.projection)||void 0===n||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(o=this.style.projection)||void 0===o?void 0:o.transitionState,null===(s=this.style.projection)||void 0===s?void 0:s.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||d)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.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._centerClampedToGroun
2d&&this.transform.setElevation(0)),this._placementDirty=null===(a=this.style)||void 0===a?void 0:a._updatePlacement(this.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,d),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new t.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.n("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.n("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e,i;this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),null===(e=this._diffStyleRequest)||void 0===e||e.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),h.removeThrottleControl(this._imageQueueHandle),null===(i=this._resizeObserver)||void 0===i||i.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==r?void 0:r.loseContext)&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new t.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,a.frame(this._frameRequest,(e=>{this._frameRequest=null;try{this._render(e)}catch(e){if(!t.$(e)&&!function(e){return e.message===an}(e))throw e}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return hs}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};const fs={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class ms{constructor(e,i,r=!1){this.mousedown=e=>{this.startMove(e,d.mousePos(this.element,e)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,d.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=d.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=d.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))},this.touchend=e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const n=new So;this._rotatePitchHandler=new vo({clickTolerance:3,move:(e,n)=>{const o=i.getBoundingClientRect(),s=new t.P((o.bottom-o.top)/2,(o.right-o.left)/2);
2return{bearingDelta:t.cx(new t.P(e.x,n.y),n,s),pitchDelta:r?-.5*(n.y-e.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=e,i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchcancel",this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),d.disableDrag()}move(e,t){const i=this.map,{bearingDelta:r,pitchDelta:n}=this._rotatePitchHandler.dragMove(e,t)||{};r&&i.setBearing(i.getBearing()+r),n&&i.setPitch(i.getPitch()+n)}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){d.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}let gs;function ys(e,i,r,n=!1){if(n||!r.getCoveringTilesDetailsProvider().allowWorldCopies())return null==e?void 0:e.wrap();const o=new t.W(e.lng,e.lat);if(e=new t.W(e.lng,e.lat),i){const n=new t.W(e.lng-360,e.lat),o=new t.W(e.lng+360,e.lat),s=r.locationToScreenPoint(e).distSqr(i);r.locationToScreenPoint(n).distSqr(i)<s?e=n:r.locationToScreenPoint(o).distSqr(i)<s&&(e=o)}for(;Math.abs(e.lng-r.center.lng)>180;){const t=r.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e.lng!==o.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(e))?e:o}const _s={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 vs(e,t,i){const r=e.classList;for(const e in _s)r.remove(`maplibregl-${i}-anchor-${e}`);r.add(`maplibregl-${i}-anchor-${t}`)}class bs extends t.E{constructor(e){if(super(),this._onClick=e=>{this.fire(new t.n("click",{originalEvent:e}))},this._onKeyPress=e=>{"Space"!==e.code&&"Enter"!==e.code||this.togglePopup()},this._onMapClick=e=>{const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;const t=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==e?void 0:e.type)||"render"===(null==e?void 0:e.type)&&!t)&&this._map.once("render",this._update),this._lngLat=ys(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="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&"moveend"!==e.type||(this._pos=this._pos.round()),this._element.style.transform=`${_s[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${i}`,a.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity("moveend"===(null==e?void 0:e.type))})).catch((()=>{}))},this._onMove=e=>{if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.n("dragstart"))),this.fire(new t.n("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),"active"===this._state&&this.fire(new t.n("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=(null==e?void 0:e.anchor)||"center",this._color=(null==e?void 0:e.color)||"#3FB1CE",this._scale=(null==e?void 0:e.scale)||1,this._draggable=(null==e?void 0:e.draggable)||!1,this._clickTolerance=(null==e?void 0:e.clickTolerance)||0,this._subpixelPositioning=(null==e?void 0:e.subpixelPositioning)||!1,this._isDragging=!1,this._state="inactive",this._rotation=(null==e?void 0:e.rotation)||0,this._rotationAlignment=(null==e?void 0:e.rotationAlignment)||"auto",this._pitchAlignment=(null==e?void 0:e.pitchAlignment)&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(null==e?void 0:e.opacity,null==e?void 0:e.opacityWhenCovered),null==e?void 0:e.element)this._element=e.element,this._offset=t.P.convert((null==e?void 0:e.offset)||[0,0]);else{this._defaultMarker=!0,this._element=d.create("div");const i=d.createNS("http://www.w3.org/2000/svg","svg"),r=41,n=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${r}px`),i.setAttributeNS(null,"width",`${n}px`),i.setAttributeNS(null,"viewBox",`0 0 ${n} ${r}`);const o=d.createNS("http://www.w3.org/2000/svg","g");
2o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const s=d.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const a=d.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"transform","translate(3.0, 29.0)"),a.setAttributeNS(null,"fill","#000000");const l=[{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(const e of l){const t=d.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),a.appendChild(t)}const c=d.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);const u=d.createNS("http://www.w3.org/2000/svg","path");u.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),c.appendChild(u);const h=d.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"opacity","0.25"),h.setAttributeNS(null,"fill","#000000");const p=d.createNS("http://www.w3.org/2000/svg","path");p.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(p);const f=d.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=d.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=d.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");const y=d.createNS("http://www.w3.org/2000/svg","circle");y.setAttributeNS(null,"fill","#FFFFFF"),y.setAttributeNS(null,"cx","5.5"),y.setAttributeNS(null,"cy","5.5"),y.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(y),s.appendChild(a),s.appendChild(c),s.appendChild(h),s.appendChild(f),s.appendChild(m),i.appendChild(s),i.setAttributeNS(null,"height",r*this._scale+"px"),i.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(i),this._offset=t.P.convert((null==e?void 0:e.offset)||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()})),vs(this._element,this._anchor,"marker"),null==e?void 0:e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),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),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.W.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,r=Math.abs(i)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
20,-t],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,r;const n=null===(i=this._map)||void 0===i?void 0:i.terrain,o=this._map.transform.isLocationOccluded(this._lngLat);if(!n||o){const e=o?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e,this._element.classList.toggle("maplibregl-marker-covered",o)))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const s=this._map,a=s.terrain.depthAtPoint(this._pos),l=s.terrain.getElevationForLngLat(this._lngLat,s.transform);if(s.transform.lngLatToCameraDepth(this._lngLat,l)-a<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");const c=-this._offset.y/s.transform.pixelsPerMeter,u=Math.sin(s.getPitch()*Math.PI/180)*c,h=s.terrain.depthAtPoint(new t.P(this._pos.x,this._pos.y-this._offset.y)),d=s.transform.lngLatToCameraDepth(this._lngLat,l+u)-h>.006;(null===(r=this._popup)||void 0===r?void 0:r.isOpen())&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",d)}getOffset(){return this._offset}setOffset(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=String(e)),void 0!==t&&(this._opacityWhenCovered=String(t)),this._map&&this._updateOpacity(!0),this}}const xs={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ws=0,Ts=!1;const Es={maxWidth:100,unit:"metric"};function Ss(e,t,i){const r=(null==i?void 0:i.maxWidth)||100,n=e._container.clientHeight/2,o=e._container.clientWidth/2,s=e.unproject([o-r/2,n]),a=e.unproject([o+r/2,n]),l=Math.round(e.project(a).x-e.project(s).x),c=Math.min(r,l,e._container.clientWidth),u=s.distanceTo(a);if("imperial"===(null==i?void 0:i.unit)){const i=3.2808*u;i>5280?Ps(t,c,i/5280,e._getUIString("ScaleControl.Miles")):Ps(t,c,i,e._getUIString("ScaleControl.Feet"))}else"nautical"===(null==i?void 0:i.unit)?Ps(t,c,u/1852,e._getUIString("ScaleControl.NauticalMiles")):u>=1e3?Ps(t,c,u/1e3,e._getUIString("ScaleControl.Kilometers")):Ps(t,c,u,e._getUIString("ScaleControl.Meters"))}function Ps(e,t,i,r){const n=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(i);e.style.width=t*(n/i)+"px",e.innerHTML=`${n}&nbsp;${r}`}const Is={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0}
vendor: 4,988 bytes, line 2
2,Cs=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ms(e){if(e){if("number"==typeof e){const i=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,e),"top-left":new t.P(i,i),"top-right":new t.P(-i,i),bottom:new t.P(0,-e),"bottom-left":new t.P(i,-i),"bottom-right":new t.P(-i,-i),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){const i=t.P.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.P.convert(e.center||[0,0]),top:t.P.convert(e.top||[0,0]),"top-left":t.P.convert(e["top-left"]||[0,0]),"top-right":t.P.convert(e["top-right"]||[0,0]),bottom:t.P.convert(e.bottom||[0,0]),"bottom-left":t.P.convert(e["bottom-left"]||[0,0]),"bottom-right":t.P.convert(e["bottom-right"]||[0,0]),left:t.P.convert(e.left||[0,0]),right:t.P.convert(e.right||[0,0])}}return Ms(new t.P(0,0))}const As=i;e.AJAXError=t.cG,e.EXTENT=t.a6,e.Event=t.n,e.Evented=t.E,e.LngLat=t.W,e.MercatorCoordinate=t.a7,e.Point=t.P,e.addProtocol=t.cH,e.config=t.c,e.removeProtocol=t.cI,e.AttributionControl=ts,e.BoxZoomHandler=fo,e.CanvasSource=re,e.CooperativeGesturesHandler=Ho,e.DoubleClickZoomHandler=Uo,e.DragPanHandler=qo,e.DragRotateHandler=Zo,e.EdgeInsets=Ut,e.FullscreenControl=class extends t.E{constructor(e={}){var i;super(),this._onFullscreenChange=()=>{var e;let t=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;null===(e=null==t?void 0:t.shadowRoot)||void 0===e?void 0:e.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=null!==(i=e.pseudo)&&void 0!==i&&i,(null==e?void 0:e.container)&&(e.container instanceof HTMLElement?this._container=e.container:t.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const e=this._fullscreenButton=d.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);d.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new t.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new t.n("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},e.GeoJSONSource=ee,e.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.n("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
2RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.n("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new t.W(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=this._map.getBearing(),o=t.e({bearing:n},this.options.fitBoundsOptions),s=G.fromLngLat(i,r);this._map.fitBounds(s,o,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new t.W(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Ts)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.n("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=e=>{if(!this._map)return;const i=(null==e?void 0:e[0])instanceof ResizeObserverEntry;e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||i||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.n("trackuserlocationend")),this.fire(new t.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(e=>{e.preventDefault()})),this._geolocateButton=d.create("button","maplibregl-ctrl-geolocate",this._container),d.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){t.w("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=d.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new bs({element:this._dotElement}),this._circleElement=d.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new bs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=t.e({},xs,e)}onAdd(e){return this._map=e,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return t._(this,arguments,void 0,(function*(e=!1){if(void 0!==gs&&!e)return gs;if(void 0===window.navigator.permissions)return gs=!!window.navigator.geolocation,gs;try{const e=yield window.navigator.permissions.query({name:"geolocation"});gs="denied"!==e.state}catch(e){gs=!!window.navigator.geolocation}return gs}
vendor: 4,581 bytes, line 2
2))}().then((e=>this._finishSetupUI(e))),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,ws=0,Ts=!1}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const e=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&e))return;const t=this._map.project(e),i=this._map.unproject([t.x+100,t.y]),r=e.distanceTo(i)/100,n=2*this._accuracy/r;this._circleElement.style.width=`${n.toFixed(2)}px`,this._circleElement.style.height=`${n.toFixed(2)}px`}trigger(){if(!this._setup)return t.w("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 t.n("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ws--,Ts=!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 t.n("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 t.n("trackuserlocationstart")),this.fire(new t.n("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("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ws++,ws>1?(e={maximumAge:6e5,timeout:0},Ts=!0):(e=this.options.positionOptions,Ts=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
2se"),this.options.showUserLocation&&this._updateMarker(null)}},e.GlobeControl=class{constructor(){this._toggleProjection=()=>{var e;const t=null===(e=this._map.getProjection())||void 0===e?void 0:e.type;this._map.setProjection("mercator"!==t&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(e=this._map.getProjection())||void 0===e?void 0:e.type)?(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=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=d.create("button","maplibregl-ctrl-globe",this._container),d.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._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},e.Hash=Jn,e.ImageSource=te,e.KeyboardHandler=zo,e.LngLatBounds=G,e.LogoControl=is,e.Map=ps,e.MapLibreMap=ps,e.MapMouseEvent=ao,e.MapTouchEvent=lo,e.MapWheelEvent=co,e.Marker=bs,e.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`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)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,t)=>{const i=this._map._getUIString(`NavigationControl.${t}`);e.title=i,e.setAttribute("aria-label",i)},this.options=t.e({},fs,e),this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),d.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),d.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=d.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 ms(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),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){const i=d.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},e.Popup=class extends t.E{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),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("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new t.n("close"))),this),this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=d.create("div","maplibregl-popup",this._map.getContainer()),this._tip=d.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const e of this.options.className.split(" "))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}let t;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=ys(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),e&&"point"in e&&e.point&&(t=e.point),this._trackPointer&&!t)return;const 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 r=this.options.anchor;const n=Ms(this.options.offset);if(!r){const e=this._container.offsetWidth,t=this._container.offsetHeight,o=function(e){var t,i,r,n;return e?{top:null!==(t=e.top)&&void 0!==t?t:0,right:null!==(i=e.right)&&void 0!==i?i:0,bottom:null!==(r=e.bottom)&&void 0!==r?r:0,left:null!==(n=e.left)&&void 0!==n?n:0}:{top:0,right:0,bottom:0,left:0}}(this.options.padding);let s;s=i.y+n.bottom.y<t+o.top?["top"]:i.y>this._map.transform.height-t-o.bottom?["bottom"]:[],i.x<e/2+o.left?s.push("left"):i.x>this._map.transform.width-e/2-o.right&&s.push("right"),r=0===s.length?"bottom":s.join("-")}let o=i.add(n[r]);
vendor: 4,846 bytes, line 2
2this.options.subpixelPositioning||(o=o.round()),this._container.style.transform=`${_s[r]} translate(${o.x}px,${o.y}px)`,vs(this._container,r,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(Is),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),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 t.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.W.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),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._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){var e;return null===(e=this._container)||void 0===e?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=d.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=d.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;const e=this._container.querySelector(Cs);e&&e.focus()}},e.RasterDEMTileSource=W,e.RasterTileSource=Z,e.ScaleControl=class{constructor(e){this._onMove=()=>{Ss(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Ss(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Es),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},e.ScrollZoomHandler=jo,e.Style=Ri,e.TerrainControl=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=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=d.create("button","maplibregl-ctrl-terrain",this._container),d.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.t
2ype="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=Oo,e.TwoFingersTouchRotateHandler=Do,e.TwoFingersTouchZoomHandler=Lo,e.TwoFingersTouchZoomRotateHandler=Wo,e.VectorTileSource=q,e.VideoSource=ie,e.addSourceType=(e,i)=>t._(void 0,void 0,void 0,(function*(){if(oe(e))throw new Error(`A source type called "${e}" already exists.`);((e,t)=>{ne[e]=t})(e,i)})),e.clearPrewarmedResources=function(){const e=D;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(A),D=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()"))},e.createTileMesh=ci,e.getGlobalDispatcher=z,e.getMaxParallelImageRequests=function(){return t.c.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return ce().getRTLTextPluginStatus()},e.getVersion=function(){return As},e.getWorkerCount=function(){return L.workerCount},e.getWorkerUrl=function(){return t.c.WORKER_URL},e.importScriptInWorkers=function(e){return z().broadcast("IS",e)},e.isTimeFrozen=function(){return l.isFrozen()},e.now=c,e.prewarm=function(){O().acquire(A)},e.restoreNow=function(){l.restoreNow()},e.setMaxParallelImageRequests=function(e){t.c.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setNow=function(e){l.setNow(e)},e.setRTLTextPlugin=function(e,t){return ce().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){L.workerCount=e},e.setWorkerUrl=function(e){t.c.WORKER_URL=e}})),e}()}},t={};function i(r){var n=t[r];if(void 0!==n)return n.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};i.r(e),i.d(e,{LAT_MAX:()=>C,LAT_MIN:()=>P,LAT_RENDERED_MAX:()=>M,LAT_RENDERED_MIN:()=>I,LNG_MAX:()=>L,LNG_MIN:()=>A,activeStates:()=>E,classes:()=>m,cursors:()=>y,events:()=>x,geojsonTypes:()=>v,interactions:()=>S,meta:()=>T,modes:()=>b,sources:()=>g,types:()=>_,updateActions:()=>w});var t={};i.r(t),i.d(t,{isActiveFeature:()=>Pe,isEnterKey:()=>De,isEscapeKey:()=>Fe,isFeature:()=>Me,isInactiveFeature:()=>Ie,isOfMetaType:()=>Ee,isShiftDown:()=>Le,isShiftMousedown:()=>Se,isTrue:()=>ke,isVertex:()=>Ae,noTarget:()=>Ce});var r={};i.r(r),i.d(r,{CommonSelectors:()=>t,ModeHandler:()=>p,StringSet:()=>z,constrainFeatureMovement:()=>We,createMidPoint:()=>Ne,createSupplementaryPoints:()=>Be,createVertex:()=>ze,doubleClickZoom:()=>Ve,euclideanDistance:()=>U,featuresAt:()=>B,getFeatureAtAndSetCursors:()=>j,isClick:()=>Z,isEventAtCoordinates:()=>rt,isTap:()=>X,mapEventToBoundingBox:()=>O,moveFeatures:()=>He,sortFeatures:()=>k,stringSetsAreEqual:()=>ft,theme:()=>Te,toDenseArray:()=>fe});class n{static create(e,t){const i=document.createElement(e);return void 0!==t&&i.classList.add(...t.split(" ")),i}}const o={width:24,height:24},s={width:30,height:15},a={width:32,height:20},l={IMPASSE:{size:{width:20,height:20},editorSettings:{name:"IMPASSE",title:"Impasse"}},BYPASS:{size:o,editorSettings:{name:"BYPASS",title:"HC 4x4 Bypass"}},BRIDGE_IN:{size:o,editorSettings:{name:"BRIDGE_IN",title:"Bridge In"}},BRIDGE_OUT:{size:o,editorSettings:{name:"BRIDGE_OUT",title:"Bridge Out"}},BRIDGE_UNKNOWN:{size:o,editorSettings:{name:"BRIDGE_UNKNOWN",title:"Bridge in Unknown State"}},FOOT_BRIDGE:{size:o,editorSettings:{name:"FOOT_BRIDGE",title:"Foot Bridge Only"}},OPEN_GATE:{size:s,editorSettings:{name:"OPEN_GATE",title:"Open Gate"}},LOCKED_GATE:{size:s,editorSettings:{name:"LOCKED_GATE",title:"Locked Gate"}},POTENTIAL_GATE:{size:s,editorSettings:{name:"POTENTIAL_GATE",title:"Potential Gate"}},MANAGED_OPEN_GATE:{size:a,editorSettings:{name:"MANAGED_OPEN_GATE",title:"Open Gate (Automatic Update)"}},MANAGED_LOCKED_GATE:{size:a,editorSettings:{name:"MANAGED_LOCKED_GATE",title:"Locked Gate (Automatic Update)"}},HYDROPOWER_STATION:{size:o,editorSettings:{name:"HYDROPOWER_STATION",title:"Hydropower Station"}}};function c(e){return`/icons/${e}.svg`}function u(e,{size:t,title:i}={}){const r=l[e],{width:n,height:s}=t??r?.size??o,a=i??r?.editorSettings?.title??e;return`<img src="${c(e)}" width="${n}" height="${s}" alt="${a}">`}class h{activeFeatureId;draw;map;constructor(e,t){this.draw=e,this.options=t}
2setActiveFeature(e){this.activeFeatureId=e}getActiveFeature(){return this.activeFeatureId}onAdd(e){this.map=e;const t=n.create("div","maplibregl-ctrl-group maplibregl-ctrl"),i=n.create("button","mapbox-gl-draw_ctrl-draw-btn mapbox-gl-draw_line"),r=n.create("button","mapbox-gl-draw_ctrl-draw-btn"),o=n.create("button","mapbox-gl-draw_ctrl-draw-btn");r.appendChild(n.create("i","bi bi-arrow-down-up text-black")),o.appendChild(n.create("i","bi bi-scissors text-black")),i.addEventListener("click",(e=>{if(e.preventDefault(),void 0!==this.activeFeatureId){const e=this.draw.get(this.activeFeatureId),t=e.geometry.coordinates[e.geometry.coordinates.length-1];this.draw.changeMode("draw_line_string",{featureId:this.activeFeatureId,from:{type:"Point",coordinates:t}})}else this.draw.changeMode("draw_line_string")})),r.addEventListener("click",(e=>{if(e.preventDefault(),void 0!==this.activeFeatureId){const e=this.draw.get(this.activeFeatureId);e.geometry.coordinates.reverse(),this.draw.add(e)}})),o.addEventListener("click",(e=>{e.preventDefault(),void 0!==this.activeFeatureId&&this.draw.changeMode("cut_polygon")})),t.appendChild(i),t.appendChild(r),t.appendChild(o);for(const e in l){const i=l[e],r=n.create("button","mapbox-gl-draw_ctrl-draw-btn");r.innerHTML=u(e),r.addEventListener("click",(e=>{e.preventDefault(),this.draw.changeMode("draw_road_feature",{properties:{pathFeatureType:i.editorSettings.name}})})),t.appendChild(r)}return t}}const d=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2.5}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2.5}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2.5}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2.5}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"],["!has","user_pathFeatureType"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-road-feature-inactive",type:"symbol",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"],["has","user_pathFeatureType"]],layout:{"icon-image":["get","user_pathFeatureType"],"icon-allow-overlap":!0}},{id:"gl-draw-road-feature-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"],["has","user_pathFeatureType"]],paint:{"circle-radius":40,"circle-color":"#4446dbff","circle-opacity":.2}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"],["!has","user_pathFeatureType"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-road-feature-stroke-active-border",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"],["has","user_pathFeatureType"]],paint:{"circle-radius":40,"circle-stroke-color":"#4446dbff","circle-opacity":0,"cir
2cle-stroke-width":2}},{id:"gl-draw-road-feature-active",type:"symbol",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"],["has","user_pathFeatureType"]],layout:{"icon-image":["get","user_pathFeatureType"],"icon-allow-overlap":!0}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"],["!has","user_pathFeatureType"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}],p=function(e,t){const i={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on(e,t,r){if(void 0===i[e])throw new Error(`Invalid event type: ${e}`);i[e].push({selector:t,fn:r})},render(e){t.store.featureChanged(e)}},n=function(e,n){const o=i[e];let s=o.length;for(;s--;){const e=o[s];if(e.selector(n)){e.fn.call(r,n)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(e){n("drag",e)},click(e){n("click",e)},mousemove(e){n("mousemove",e)},mousedown(e){n("mousedown",e)},mouseup(e){n("mouseup",e)},mouseout(e){n("mouseout",e)},keydown(e){n("keydown",e)},keyup(e){n("keyup",e)},touchstart(e){n("touchstart",e)},touchmove(e){n("touchmove",e)},touchend(e){n("touchend",e)},tap(e){n("tap",e)}}};var f=i(778);const m={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},g={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},y={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},_={POLYGON:"polygon",LINE:"line_string",POINT:"point"},v={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},b={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},x={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},w={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},T={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},E={ACTIVE:"true",INACTIVE:"false"},S=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],P=-90,I=-85,C=90,M=85,A=-270,L=270,F={Point:0,LineString:1,MultiLineString:1,Polygon:2};function D(e,t){const i=F[e.geometry.type]-F[t.geometry.type];return 0===i&&e.geometry.type===v.POLYGON?e.area-t.area:i}const k=function(e){return e.map((e=>(e.geometry.type===v.POLYGON&&(e.area=f.geometry({type:v.FEATURE,property:{},geometry:e.geometry})),e))).sort(D).map((e=>(delete e.area,e)))},O=function(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]};function R(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(let t=0,i=e.length;t<i;t++)this.add(e[t]),void 0!==e[t]&&("string"==typeof e[t]?this._items[e[t]]=t:this._nums[e[t]]=t)}R.prototype.add=function(e){return this.has(e)||(this._length++,"string"==typeof e?this._items[e]=this._length:this._nums[e]=this._length),this},R.prototype.delete=function(e){return!1===this.has(e)||(this._length--,delete this._items[e],delete this._nums[e]),this},R.prototype.has=function(e){return!("string"!=typeof e&&"number"!=typeof e||void 0===this._items[e]&&void 0===this._nums[e])},R.prototype.values=function(){const e=[];
vendor: 17,758 bytes, line 2
2return Object.keys(this._items).forEach((t=>{e.push({k:t,v:this._items[t]})})),Object.keys(this._nums).forEach((t=>{e.push({k:JSON.parse(t),v:this._nums[t]})})),e.sort(((e,t)=>e.v-t.v)).map((e=>e.k))},R.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const z=R,N=[T.FEATURE,T.MIDPOINT,T.VERTEX],B={click:function(e,t,i){return V(e,t,i,i.options.clickBuffer)},touch:function(e,t,i){return V(e,t,i,i.options.touchBuffer)}};function V(e,t,i,r){if(null===i.map)return[];const n=e?O(e,r):t,o={};i.options.styles&&(o.layers=i.options.styles.map((e=>e.id)).filter((e=>null!=i.map.getLayer(e))));const s=i.map.queryRenderedFeatures(n,o).filter((e=>-1!==N.indexOf(e.properties.meta))),a=new z,l=[];return s.forEach((e=>{const t=e.properties.id;a.has(t)||(a.add(t),l.push(e))})),k(l)}function j(e,t){const i=B.click(e,null,t),r={mouse:y.NONE};return i[0]&&(r.mouse=i[0].properties.active===E.ACTIVE?y.MOVE:y.POINTER,r.feature=i[0].properties.meta),-1!==t.events.currentModeName().indexOf("draw")&&(r.mouse=y.ADD),t.ui.queueMapClasses(r),t.ui.updateMapClasses(),i[0]}function U(e,t){const i=e.x-t.x,r=e.y-t.y;return Math.sqrt(i*i+r*r)}const G=4,$=12,q=500;function Z(e,t,i={}){const r=null!=i.fineTolerance?i.fineTolerance:G,n=null!=i.grossTolerance?i.grossTolerance:$,o=null!=i.interval?i.interval:q;e.point=e.point||t.point,e.time=e.time||t.time;const s=U(e.point,t.point);return s<r||s<n&&t.time-e.time<o}const W=25,H=250;function X(e,t,i={}){const r=null!=i.tolerance?i.tolerance:W,n=null!=i.interval?i.interval:H;return e.point=e.point||t.point,e.time=e.time||t.time,U(e.point,t.point)<r&&t.time-e.time<n}const Y=((e,t=21)=>(i=t)=>{let r="",n=0|i;for(;n--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function J(){return Y()}const K=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||J(),this.type=t.geometry.type};K.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},K.prototype.incomingCoords=function(e){this.setCoordinates(e)},K.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},K.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},K.prototype.setProperty=function(e,t){this.properties[e]=t},K.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:v.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},K.prototype.internal=function(e){const t={id:this.id,meta:T.FEATURE,"meta:type":this.type,active:E.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const e in this.properties)t[`user_${e}`]=this.properties[e];return{type:v.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const Q=K,ee=function(e,t){Q.call(this,e,t)};(ee.prototype=Object.create(Q.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},ee.prototype.updateCoordinate=function(e,t,i){this.coordinates=3===arguments.length?[t,i]:[e,t],this.changed()},ee.prototype.getCoordinate=function(){return this.getCoordinates()};const te=ee,ie=function(e,t){Q.call(this,e,t)};(ie.prototype=Object.create(Q.prototype)).isValid=function(){return this.coordinates.length>1},ie.prototype.addCoordinate=function(e,t,i){this.changed();const r=parseInt(e,10);this.coordinates.splice(r,0,[t,i])},ie.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},ie.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},ie.prototype.updateCoordinate=function(e,t,i){const r=parseInt(e,10);this.coordinates[r]=[t,i],this.changed()};const re=ie,ne=function(e,t){Q.call(this,e,t),this.coordinates=this.coordinates.map((e=>e.slice(0,-1)))};(ne.prototype=Object.create(Q.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((e=>e.length>2))},ne.prototype.incomingCoords=function(e){this.coordinates=e.map((e=>e.slice(0,-1))),this.changed()},ne.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},ne.prototype.addCoordinate=function(e,t,i){this.changed();const r=e.split(".").map((e=>parseInt(e,10)));this.coordinates[r[0]].splice(r[1],0,[t,i])},ne.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map((e=>parseInt(e,10))),i=this.coordinates[t[0]];i&&(i.splice(t[1],1),i.length<3&&this.coordinates.splice(t[0],1))},ne.prototype.getCoordinate=function(e){const t=e.split(".").map((e=>parseInt(e,10))),i=this.coordinates[t[0]];return JSON.parse(JSON.stringify(i[t[1]]))},ne.prototype.getCoordinates=function(){return this.coordinates.map((e=>e.concat([e[0]])))},ne.prototype.updateCoordinate=function(e,t,i){this.changed();const r=e.split("."),n=parseInt(r[0],10),o=parseInt(r[1],10);void 0===this.coordinates[n]&&(this.coordinates[n]=[]),this.coordinates[n][o]=[t,i]};const oe=ne,se={MultiPoint:te,MultiLineString:re,MultiPolygon:oe},ae=(e,t,i,r,n)=>{const o=i.split("."),s=parseInt(o[0],10),a=o[1]?o.slice(1).join("."):null;return e[s][t](a,r,n)},le=function(e,t){if(Q.call(this,e,t),delete this.coordinates,this.model=se[t.geometry.type],void 0===this.model)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};(le.prototype=Object.create(Q.prototype))._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map((e=>new t(this.ctx,{id:J(),type:v.FEATURE,properties:{},geometry:{coordinates:e,type:this.type.replace("Multi","")}})))},le.prototype.isValid=function(){return this.features.every((e=>e.isValid()))},le.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},le.prototype.getCoordinate=function(e){return ae(this.features,"getCoordinate",e)},le.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((e=>e.type===v.POLYGON?e.getCoordinates():e.coordinates))))},le.prototype.updateCoordinate=function(e,t,i){ae(this.features,"updateCoordinate",e,t,i),this.changed()},le.prototype.addCoordinate=function(e,t,i){ae(this.features,"addCoordinate",e,t,i),this.changed()},le.prototype.removeCoordinate=function(e){ae(this.features,"removeCoordinate",e),this.changed()},le.prototype.getFeatures=function(){return this.features};const ce=le;function ue(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}ue.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},ue.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce(((e,t)=>(void 0===e[t.feature_id]&&(e[t.feature_id]=!0,this._ctx.store.get(t.feature_id).changed()),e)),{})},ue.prototype.getSelected=function(){return this._ctx.store.getSelected()},ue.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},ue.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},ue.prototype.getFeature=function(e){return this._ctx.store.get(e)},ue.prototype.select=function(e){return this._ctx.store.select(e)},ue.prototype.deselect=function(e){return this._ctx.store.deselect(e)},ue.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)},ue.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)},ue.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},ue.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},ue.prototype.setActionableState=function(e={}){const t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)},ue.prototype.changeMode=function(e,t={},i={}){return this._ctx.events.changeMode(e,t,i)},ue.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)},ue.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},ue.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},ue.prototype.featuresAt=function(e,t,i="click"){if("click"!==i&&"touch"!==i)throw new Error("invalid buffer type");return B[i](e,t,this._ctx)},ue.prototype.newFeature=function(e){const t=e.geometry.type;return t===v.POINT?new te(this._ctx,e):t===v.LINE_STRING?new re(this._ctx,e):t===v.POLYGON?new oe(this._ctx,e):new ce(this._ctx,e)},ue.prototype.isInstanceOf=function(e,t){if(e===v.POINT)return t instanceof te;if(e===v.LINE_STRING)return t instanceof re;if(e===v.POLYGON)return t instanceof oe;if("MultiFeature"===e)return t instanceof ce;throw new Error(`Unknown feature class: ${e}`)},ue.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)};const he=ue;ue.prototype.onSetup=function(){},ue.prototype.onDrag=function(){},ue.prototype.onClick=function(){},ue.prototype.onMouseMove=function(){},ue.prototype.onMouseDown=function(){},ue.prototype.onMouseUp=function(){},ue.prototype.onMouseOut=function(){},ue.prototype.onKeyUp=function(){},ue.prototype.onKeyDown=function(){},ue.prototype.onTouchStart=function(){},ue.prototype.onTouchMove=function(){},ue.prototype.onTouchEnd=function(){},ue.prototype.onTap=function(){},ue.prototype.onStop=function(){},ue.prototype.onTrash=function(){},ue.prototype.onCombineFeature=function(){},ue.prototype.onUncombineFeature=function(){},ue.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const de={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},pe=Object.keys(de);const fe=function(e){return[].concat(e).filter((e=>void 0!==e))};function me(){const e=this;if(!e.ctx.map||void 0===e.ctx.map.getSource(g.HOT))return a();const t=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:t});let i=[],r=[];e.isDirty?r=e.getAllIds():(i=e.getChangedIds().filter((t=>void 0!==e.get(t))),r=e.sources.hot.filter((t=>t.properties.id&&-1===i.indexOf(t.properties.id)&&void 0!==e.get(t.properties.id))).map((e=>e.properties.id))),e.sources.hot=[];const n=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter((e=>{const t=e.properties.id||e.properties.parent;return-1===i.indexOf(t)}));const o=n!==e.sources.cold.length||r.length>0;function s(i,r){const n=e.get(i).internal(t);e.ctx.events.currentModeRender(n,(i=>{i.properties.mode=t,e.sources[r].push(i)}))}function a(){e.isDirty=!1,e.clearChangedIds()}i.forEach((e=>s(e,"hot"))),r.forEach((e=>s(e,"cold"))),o&&e.ctx.map.getSource(g.COLD).setData({type:v.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(g.HOT).setData({type:v.FEATURE_COLLECTION,features:e.sources.hot}),a()}function ge(e){let t;this._features={},this._featureIds=new z,this._selectedFeatureIds=new z,this._selectedCoordinates=[],this._changedFeatureIds=new z,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=()=>{t||(t=requestAnimationFrame((()=>{t=null,me.call(this),this._emitSelectionChange&&(this.ctx.events.fire(x.SELECTION_CHANGE,{features:this.getSelected().map((e=>e.toGeoJSON())),points:this.getSelectedCoordinates().map((e=>({type:v.FEATURE,properties:{},geometry:{type:v.POINT,coordinates:e.coordinates}})))}),this._emitSelectionChange=!1),this.ctx.events.fire(x.RENDER,{})})))},this.isDirty=!1}function ye(e,t={}){const i=e._selectedCoordinates.filter((t=>e._selectedFeatureIds.has(t.feature_id)));e._selectedCoordinates.length===i.length||t.silent||(e._emitSelectionChange=!0),e._selectedCoordinates=i}ge.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}},ge.prototype.setDirty=function(){return this.isDirty=!0,this},ge.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)){const t=this.get(e);this.ctx.events.fire(x.CREATE,{features:[t.toGeoJSON()]})}return this},ge.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),!0!==(null!=t.silent?t.silent:this.ctx.options.suppressAPIEvents)&&this.ctx.events.fire(x.UPDATE,{action:t.action?t.action:w.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this},ge.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},ge.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},ge.prototype.getAllIds=function(){return this._featureIds.values()},ge.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this},ge.prototype.delete=function(e,t={}){const i=[];return fe(e).forEach((e=>{this._featureIds.has(e)&&(this._featureIds.delete(e),this._selectedFeatureIds.delete(e),t.silent||-1===i.indexOf(this._features[e])&&i.push(this._features[e].toGeoJSON()),delete this._features[e],this.isDirty=!0)})),i.length&&this.ctx.events.fire(x.DELETE,{features:i}),ye(this,t),this},ge.prototype.get=function(e){return this._features[e]},ge.prototype.getAll=function(){return Object.keys(this._features).map((e=>this._features[e]))},ge.prototype.select=function(e,t={}){return fe(e).forEach((e=>{this._selectedFeatureIds.has(e)||(this._selectedFeatureIds.add(e),this._changedFeatureIds.add(e),t.silent||(this._emitSelectionChange=!0))})),this},ge.prototype.deselect=function(e,t={}){return fe(e).forEach((e=>{this._selectedFeatureIds.has(e)&&(this._selectedFeatureIds.delete(e),this._changedFeatureIds.add(e),t.silent||(this._emitSelectionChange=!0))})),ye(this,t),this},ge.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},ge.prototype.setSelected=function(e,t={}){return e=fe(e),this.deselect(this._selectedFeatureIds.values().filter((t=>-1===e.indexOf(t))),{silent:t.silent}),this.select(e.filter((e=>!this._selectedFeatureIds.has(e))),{silent:t.silent}),this},ge.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},ge.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},ge.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},ge.prototype.getSelected=function(){return this.getSelectedIds().map((e=>this.get(e)))},ge.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map((e=>({coordinates:this.get(e.feature_id).getCoordinate(e.coord_path)})))},ge.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},ge.prototype.setFeatureProperty=function(e,t,i,r={}){this.get(e).setProperty(t,i),this.featureChanged(e,{silent:r.silent,action:w.CHANGE_PROPERTIES})},ge.prototype.storeMapConfig=function(){S.forEach((e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())}))},ge.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach((e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()}))},ge.prototype.getInitialConfigValue=function(e){return void 0===this._mapInitialConfig[e]||this._mapInitialConfig[e]};const _e=["mode","feature","mouse"];function ve(e){let t=null,i=null;const r={onRemove(){return e.map.off("load",r.connect),clearInterval(i),r.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",r.connect),clearInterval(i),r.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(n){if(e.map=n,e.events=function(e){const t=Object.keys(e.options.modes).reduce(((t,i)=>(t[i]=function(e){const t=Object.keys(e);return function(i,r={}){let n={};const o=t.reduce(((t,i)=>(t[i]=e[i],t)),new he(i));return{start(){n=o.onSetup(r),pe.forEach((t=>{const i=de[t];let r=()=>!1;var s;e[i]&&(r=()=>!0),this.on(t,r,(s=i,e=>o[s](n,e)))}))},stop(){o.onStop(n)},trash(){o.onTrash(n)},combineFeatures(){o.onCombineFeatures(n)},uncombineFeatures(){o.onUncombineFeatures(n)},render(e,t){o.toDisplayFeatures(n,e,t)}}}}(e.options.modes[i]),t)),{});let i={},r={};const n={};let o=null,s=null;n.drag=function(t,i){i({point:t.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:y.DRAG}),s.drag(t)):t.originalEvent.stopPropagation()},n.mousedrag=function(e){n.drag(e,(e=>!Z(i,e)))},n.touchdrag=function(e){n.drag(e,(e=>!X(r,e)))},n.mousemove=function(t){if(1===(void 0!==t.originalEvent.buttons?t.originalEvent.buttons:t.originalEvent.which))return n.mousedrag(t);const i=j(t,e);t.featureTarget=i,s.mousemove(t)},n.mousedown=function(t){i={time:(new Date).getTime(),point:t.point};const r=j(t,e);t.featureTarget=r,s.mousedown(t)},n.mouseup=function(t){const r=j(t,e);t.featureTarget=r,Z(i,{point:t.point,time:(new Date).getTime()})?s.click(t):s.mouseup(t)},n.mouseout=function(e){s.mouseout(e)},n.touchstart=function(t){if(!e.options.touchEnabled)return;r={time:(new Date).getTime(),point:t.point};const i=B.touch(t,null,e)[0];t.featureTarget=i,s.touchstart(t)},n.touchmove=function(t){if(e.options.touchEnabled)return s.touchmove(t),n.touchdrag(t)},n.touchend=function(t){if(t.originalEvent.preventDefault(),!e.options.touchEnabled)return;const i=B.touch(t,null,e)[0];t.featureTarget=i,X(r,{time:(new Date).getTime(),point:t.point})?s.tap(t):s.touchend(t)};const a=e=>!(8===e||46===e||e>=48&&e<=57);function l(i,r,n={}){s.stop();const a=t[i];if(void 0===a)throw new Error(`${i}
2 is not valid`);o=i;const l=a(e,r);s=p(l,e),n.silent||e.map.fire(x.MODE_CHANGE,{mode:i}),e.store.setDirty(),e.store.render()}n.keydown=function(t){(t.srcElement||t.target).classList.contains(m.CANVAS)&&(8!==t.keyCode&&46!==t.keyCode||!e.options.controls.trash?a(t.keyCode)?s.keydown(t):49===t.keyCode&&e.options.controls.point?l(b.DRAW_POINT):50===t.keyCode&&e.options.controls.line_string?l(b.DRAW_LINE_STRING):51===t.keyCode&&e.options.controls.polygon&&l(b.DRAW_POLYGON):(t.preventDefault(),s.trash()))},n.keyup=function(e){a(e.keyCode)&&s.keyup(e)},n.zoomend=function(){e.store.changeZoom()},n.data=function(t){if("style"===t.dataType){const{setup:t,map:i,options:r,store:n}=e;r.styles.some((e=>i.getLayer(e.id)))||(t.addLayers(),n.setDirty(),n.render())}};const c={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start(){o=e.options.defaultMode,s=p(t[o](e),e)},changeMode:l,actionable:function(t){let i=!1;Object.keys(t).forEach((e=>{if(void 0===c[e])throw new Error("Invalid action type");c[e]!==t[e]&&(i=!0),c[e]=t[e]})),i&&e.map.fire(x.ACTIONABLE,{actions:c})},currentModeName:()=>o,currentModeRender:(e,t)=>s.render(e,t),fire(t,i){e.map&&e.map.fire(t,i)},addEventListeners(){e.map.on("mousemove",n.mousemove),e.map.on("mousedown",n.mousedown),e.map.on("mouseup",n.mouseup),e.map.on("data",n.data),e.map.on("touchmove",n.touchmove),e.map.on("touchstart",n.touchstart),e.map.on("touchend",n.touchend),e.container.addEventListener("mouseout",n.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",n.keydown),e.container.addEventListener("keyup",n.keyup))},removeEventListeners(){e.map.off("mousemove",n.mousemove),e.map.off("mousedown",n.mousedown),e.map.off("mouseup",n.mouseup),e.map.off("data",n.data),e.map.off("touchmove",n.touchmove),e.map.off("touchstart",n.touchstart),e.map.off("touchend",n.touchend),e.container.removeEventListener("mouseout",n.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",n.keydown),e.container.removeEventListener("keyup",n.keyup))},trash(e){s.trash(e)},combineFeatures(){s.combineFeatures()},uncombineFeatures(){s.uncombineFeatures()},getMode:()=>o}}(e),e.ui=function(e){const t={};let i=null,r={mode:null,feature:null,mouse:null},n={mode:null,feature:null,mouse:null};function o(e){n=Object.assign(n,e)}function s(){if(!e.container)return;const t=[],i=[];_e.forEach((e=>{n[e]!==r[e]&&(t.push(`${e}-${r[e]}`),null!==n[e]&&i.push(`${e}-${n[e]}`))})),t.length>0&&e.container.classList.remove(...t),i.length>0&&e.container.classList.add(...i),r=Object.assign(r,n)}function a(e,t={}){const r=document.createElement("button");return r.className=`${m.CONTROL_BUTTON} ${t.className}`,r.setAttribute("title",t.title),t.container.appendChild(r),r.addEventListener("click",(r=>{if(r.preventDefault(),r.stopPropagation(),r.target===i)return l(),void t.onDeactivate();c(e),t.onActivate()}),!0),r}function l(){i&&(i.classList.remove(m.ACTIVE_BUTTON),i=null)}function c(e){l();const r=t[e];r&&r&&"trash"!==e&&(r.classList.add(m.ACTIVE_BUTTON),i=r)}return{setActiveButton:c,queueMapClasses:o,updateMapClasses:s,clearMapClasses:function(){o({mode:null,feature:null,mouse:null}),s()},addButtons:function(){const i=e.options.controls,r=document.createElement("div");return r.className=`${m.CONTROL_GROUP} ${m.CONTROL_BASE}`,i?(i[_.LINE]&&(t[_.LINE]=a(_.LINE,{container:r,className:m.CONTROL_BUTTON_LINE,title:"LineString tool "+(e.options.keybindings?"(l)":""),onActivate:()=>e.events.changeMode(b.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),i[_.POLYGON]&&(t[_.POLYGON]=a(_.POLYGON,{container:r,className:m.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(e.options.keybindings?"(p)":""),onActivate:()=>e.events.changeMode(b.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),i[_.POINT]&&(t[_.POINT]=a(_.POINT,{container:r,className:m.CONTROL_BUTTON_POINT,title:"Marker tool "+(e.options.keybindings?"(m)":""),onActivate:()=>e.events.changeMode(b.DRAW_POINT),onDeactivate:()=>e.events.trash()})),i.trash&&(t.trash=a("trash",{container:r,className:m.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),i.combine_features&&(t.combine_features=a("combineFeatures",{container:r,className:m.CONTROL_BUTTON_COMB
vendor: 29,081 bytes, line 2
2INE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),i.uncombine_features&&(t.uncombine_features=a("uncombineFeatures",{container:r,className:m.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}})),r):r},removeButtons:function(){Object.keys(t).forEach((e=>{const i=t[e];i.parentNode&&i.parentNode.removeChild(i),delete t[e]}))}}}(e),e.container=n.getContainer(),e.store=new ge(e),t=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=n.boxZoom.isEnabled(),n.boxZoom.disable();const t=n.dragPan.isEnabled();n.dragPan.disable(),n.dragPan.enable(),t||n.dragPan.disable()}return n.loaded()?r.connect():(n.on("load",r.connect),i=setInterval((()=>{n.loaded()&&r.connect()}),16)),e.events.start(),t},addLayers(){e.map.addSource(g.COLD,{data:{type:v.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(g.HOT,{data:{type:v.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach((t=>{e.map.addLayer(t)})),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach((t=>{e.map.getLayer(t.id)&&e.map.removeLayer(t.id)})),e.map.getSource(g.COLD)&&e.map.removeSource(g.COLD),e.map.getSource(g.HOT)&&e.map.removeSource(g.HOT)}};return e.setup=r,r}const be="#3bb2d0",xe="#fbb03b",we="#fff",Te=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],xe,be],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],xe,be],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":we}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],xe,be]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":we}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":xe}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":xe}}];function Ee(e){return function(t){const i=t.featureTarget;return!!i&&!!i.properties&&i.properties.meta===e}}function Se(e){return!!e.originalEvent&&!!e.originalEvent.shiftKey&&0===e.originalEvent.button}function Pe(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.active===E.ACTIVE&&e.featureTarget.properties.meta===T.FEATURE}function Ie(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.active===E.INACTIVE&&e.featureTarget.properties.meta===T.FEATURE}function Ce(e){return void 0===e.featureTarget}function Me(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.meta===T.FEATURE}function Ae(e){const t=e.featureTarget;return!!t&&!!t.properties&&t.properties.meta===T.VERTEX}function Le(e){return!!e.originalEvent&&!0===e.originalEvent.shiftKey}function Fe(e){return 27===e.keyCode}function De(e){return 13===e.keyCode}function ke(){return!0}function Oe(e,t){this.x=e,this.y=t}Oe.prototype={clone(){return new Oe(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),i=Math.sin(e),r=t*this.x-i*this.y,n=i*this.x+t*this.y;return this.x=r,this.y=n,this},_rotateAround(e,t){const i=Math.cos(e),r=Math.sin(e),n=t.x+i*(this.x-t.x)-r*(this.y-t.y),o=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=n,this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Oe},Oe.convert=function(e){if(e instanceof Oe)return e;if(Array.isArray(e))return new Oe(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new Oe(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};const Re=function(e,t){const i=t.getBoundingClientRect();return new Oe(e.clientX-i.left-(t.clientLeft||0),e.clientY-i.top-(t.clientTop||0))};function ze(e,t,i,r){return{type:v.FEATURE,properties:{meta:T.VERTEX,parent:e,coord_path:i,active:r?E.ACTIVE:E.INACTIVE},geometry:{type:v.POINT,coordinates:t}}}function Ne(e,t,i){const r=t.geometry.coordinates,n=i.geometry.coordinates;if(r[1]>M||r[1]<I||n[1]>M||n[1]<I)return null;const o={lng:(r[0]+n[0])/2,lat:(r[1]+n[1])/2};return{type:v.FEATURE,properties:{meta:T.MIDPOINT,parent:e,lng:o.lng,lat:o.lat,coord_path:i.properties.coord_path},geometry:{type:v.POINT,coordinates:[o.lng,o.lat]}}}const Be=function e(t,i={},r=null){const{type:n,coordinates:o}=t.geometry,s=t.properties&&t.properties.id;let a=[];function l(e,t){let r="",n=null;e.forEach(((e,o)=>{const l=null!=t?`${t}.${o}`:String(o),u=ze(s,e,l,c(l));if(i.midpoints&&n){const e=Ne(s,n,u);e&&a.push(e)}n=u;const h=JSON.stringify(e);r!==h&&a.push(u),0===o&&(r=h)}))}function c(e){return!!i.selectedPaths&&-1!==i.selectedPaths.indexOf(e)}return n===v.POINT?a.push(ze(s,o,r,c(r))):n===v.POLYGON?o.forEach(((e,t)=>{l(e,null!==r?`${r}.${t}`:String(t))})):n===v.LINE_STRING?l(o,r):0===n.indexOf(v.MULTI_PREFIX)&&function(){const r=n.replace(v.MULTI_PREFIX,"");o.forEach(((n,o)=>{const s={type:v.FEATURE,properties:t.properties,geometry:{type:r,coordinates:n}};a=a.concat(e(s,i,o))}))}(),a},Ve={enable(e){setTimeout((()=>{e.map&&e.map.doubleClickZoom&&e._ctx&&e._ctx.store&&e._ctx.store.getInitialConfigValue&&e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()}),0)},disable(e){setTimeout((()=>{e.map&&e.map.doubleClickZoom&&e.map.doubleClickZoom.disable()}),0)}},{LAT_MIN:je,LAT_MAX:Ue,LAT_RENDERED_MIN:Ge,LAT_RENDERED_MAX:$e,LNG_MIN:qe,LNG_MAX:Ze}=e;function We(e,t){let i=je,r=Ue,n=je,o=Ue,s=Ze,a=qe;e.forEach((e=>{const t=function(e){const t={Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type],i=[e.geometry.coordinates].flat(t),r=i.map((e=>e[0])),n=i.map((e=>e[1])),o=e=>Math.min.apply(null,e),s=e=>Math.max.apply(null,e);return[o(r),o(n),s(r),s(n)]}(e),l=t[1],c=t[3],u=t[0],h=t[2];l>i&&(i=l),c<r&&(r=c),c>n&&(n=c),l<o&&(o=l),u<s&&(s=u),h>a&&(a=h)}));const l=t;return i+l.lat>$e&&(l.lat=$e-i),n+l.lat>Ue&&(l.lat=Ue-n),r+l.lat<Ge&&(l.lat=Ge-r),o+l.lat<je&&(l.lat=je-o),s+l.lng<=qe&&(l.lng+=360*Math.ceil(Math.abs(l.lng)/360)),a+l.lng>=Ze&&(l.lng-=360*Math.ceil(Math.abs(l.lng)/360)),l}function He(e,t){const i=We(e.map((e=>e.toGeoJSON())),t);e.forEach((e=>{const t=e.getCoordinates(),r=e=>{const t={lng:e[0]+i.lng,lat:e[1]+i.lat};return[t.lng,t.lat]},n=e=>e.map((e=>r(e)));let o;e.type===v.POINT?o=r(t):e.type===v.LINE_STRING||e.type===v.MULTI_POINT?o=t.map(r):e.type===v.POLYGON||e.type===v.MULTI_LINE_STRING?o=t.map(n):e.type===v.MULTI_POLYGON&&(o=t.map((e=>e.map((e=>n(e)))))),e.incomingCoords(o)}))}const Xe={onSetup:function(e){const t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter((e=>void 0!==this.getFeature(e)))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t},fireUpdate:function(){this.fire(x.UPDATE,{action:w.MOVE,features:this.getSelected().map((e=>e.toGeoJSON()))})},fireActionable:function(){const e=this.getSelected(),t=e.filter((e=>this.isInstanceOf("MultiFeature",e)));let i=!1;if(e.length>1){i=!0;const t=e[0].type.replace("Multi","");e.forEach((e=>{e.type.replace("Multi","")!==t&&(i=!1)}))}const r=t.length>0,n=e.length>0;this.setActionableState({combineFeatures:i,uncombineFeatures:r,trash:n})},getUniqueIds:function(e){if(!e.length)return[];const t=e.map((e=>e.properties.id)).filter((e=>void 0!==e)).reduce(((e,t)=>(e.add(t),e)),new z);return t.values()},stopExtendedInteractions:function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},onStop:function(){Ve.enable(this)},onMouseMove:function(e,t){return Me(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0},onMouseOut:function(e){return!e.dragMoving||this.fireUpdate()}};Xe.onTap=Xe.onClick=function(e,t){return Ce(t)?this.clickAnywhere(e,t):Ee(T.VERTEX)(t)?this.clickOnVertex(e,t):Me(t)?this.clickOnFeature(e,t):void 0},Xe.clickAnywhere=function(e){const t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach((e=>this.doRender(e)))),Ve.enable(this),this.stopExtendedInteractions(e)},Xe.clickOnVertex=function(e,t){this.changeMode(b.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:y.MOVE})},Xe.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},Xe.clickOnFeature=function(e,t){Ve.disable(this),this.stopExtendedInteractions(e);const i=Le(t),r=this.getSelectedIds(),n=t.featureTarget.properties.id,o=this.isSelected(n);if(!i&&o&&this.getFeature(n).type!==v.POINT)return this.changeMode(b.DIRECT_SELECT,{featureId:n});o&&i?(this.deselect(n),this.updateUIClasses({mouse:y.POINTER}),1===r.length&&Ve.enable(this)):!o&&i?(this.select(n),this.updateUIClasses({mouse:y.MOVE})):o||i||(r.forEach((e=>this.doRender(e))),this.setSelected(n),this.updateUIClasses({mouse:y.MOVE})),this.doRender(n)},Xe.onMouseDown=function(e,t){return e.initialDragPanState=this.map.dragPan.isEnabled(),Pe(t)?this.startOnActiveFeature(e,t):this.drawConfig.boxSelect&&Se(t)?this.startBoxSelect(e,t):void 0},Xe.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=Re(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},Xe.onTouchStart=function(e,t){if(Pe(t))return this.startOnActiveFeature(e,t)},Xe.onDrag=function(e,t){return e.canDragMove?this.dragMove(e,t):this.drawConfig.boxSelect&&e.canBoxSelect?this.whileBoxSelect(e,t):void 0},Xe.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:y.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(m.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));const i=Re(t.originalEvent,this.map.getContainer()),r=Math.min(e.boxSelectStartLocation.x,i.x),n=Math.max(e.boxSelectStartLocation.x,i.x),o=Math.min(e.boxSelectStartLocation.y,i.y),s=Math.max(e.boxSelectStartLocation.y,i.y),a=`translate(${r}px, ${o}px)`;e.boxSelectElement.style.transform=a,e.boxSelectElement.style.WebkitTransform=a,e.boxSelectElement.style.width=n-r+"px",e.boxSelectElement.style.height=s-o+"px"},Xe.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const i={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};He(this.getSelected(),i),e.dragMoveLocation=t.lngLat},Xe.onTouchEnd=Xe.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){const i=[e.boxSelectStartLocation,Re(t.originalEvent,this.map.getContainer())],r=this.featuresAt(null,i,"click"),n=this.getUniqueIds(r).filter((e=>!this.isSelected(e)));n.length&&(this.select(n),n.forEach((e=>this.doRender(e))),this.updateUIClasses({mouse:y.MOVE}))}this.stopExtendedInteractions(e)},Xe.toDisplayFeatures=function(e,t,i){t.properties.active=this.isSelected(t.properties.id)?E.ACTIVE:E.INACTIVE,i(t),this.fireActionable(),t.properties.active===E.ACTIVE&&t.geometry.type!==v.POINT&&Be(t).forEach(i)},Xe.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},Xe.onCombineFeatures=function(){const e=this.getSelected();if(0===e.length||e.length<2)return;const t=[],i=[],r=e[0].type.replace("Multi","");for(let n=0;n<e.length;n++){const o=e[n];if(o.type.replace("Multi","")!==r)return;o.type.includes("Multi")?o.getCoordinates().forEach((e=>{t.push(e)})):t.push(o.getCoordinates()),i.push(o.toGeoJSON())}if(i.length>1){const e=this.newFeature({type:v.FEATURE,properties:i[0].properties,geometry:{type:`Multi${r}`,coordinates:t}});this.addFeature(e),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([e.id]),this.fire(x.COMBINE_FEATURES,{createdFeatures:[e.toGeoJSON()],deletedFeatures:i})}this.fireActionable()},Xe.onUncombineFeatures=function(){const e=this.getSelected();if(0===e.length)return;const t=[],i=[];for(let r=0;r<e.length;r++){const n=e[r];this.isInstanceOf("MultiFeature",n)&&(n.getFeatures().forEach((e=>{this.addFeature(e),e.properties=n.properties,t.push(e.toGeoJSON()),this.select([e.id])})),this.deleteFeature(n.id,{silent:!0}),i.push(n.toGeoJSON()))}t.length>1&&this.fire(x.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:i}),this.fireActionable()};const Ye=Xe,Je=Ee(T.VERTEX),Ke=Ee(T.MIDPOINT),Qe={fireUpdate:function(){this.fire(x.UPDATE,{action:w.CHANGE_COORDINATES,features:this.getSelected().map((e=>e.toGeoJSON()))})},fireActionable:function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},startDragging:function(e,t){e.initialDragPanState=this.map.dragPan.isEnabled(),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},stopDragging:function(e){e.canDragMove&&!0===e.initialDragPanState&&this.map.dragPan.enable(),e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},onVertex:function(e,t){this.startDragging(e,t);const i=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(i.coord_path);Le(t)||-1!==r?Le(t)&&-1===r&&e.selectedCoordPaths.push(i.coord_path):e.selectedCoordPaths=[i.coord_path];const n=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(n)},onMidpoint:function(e,t){this.startDragging(e,t);const i=t.featureTarget.properties;e.feature.addCoordinate(i.coord_path,i.lng,i.lat),this.fireUpdate(),e.selectedCoordPaths=[i.coord_path]},pathsToCoordinates:function(e,t){return t.map((t=>({feature_id:e,coord_path:t})))},onFeature:function(e,t){0===e.selectedCoordPaths.length?this.startDragging(e,t):this.stopDragging(e)},dragFeature:function(e,t,i){He(this.getSelected(),i),e.dragMoveLocation=t.lngLat},dragVertex:function(e,t,i){const r=e.selectedCoordPaths.map((t=>e.feature.getCoordinate(t))),n=We(r.map((e=>({type:v.FEATURE,properties:{},geometry:{type:v.POINT,coordinates:e}}))),i);for(let t=0;t<r.length;t++){const i=r[t];e.feature.updateCoordinate(e.selectedCoordPaths[t],i[0]+n.lng,i[1]+n.lat)}},clickNoTarget:function(){this.changeMode(b.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(b.SIMPLE_SELECT)},clickActiveFeature:function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},onSetup:function(e){const t=e.featureId,i=this.getFeature(t);if(!i)throw new Error("You must provide a featureId to enter direct_select mode");if(i.type===v.POINT)throw new TypeError("direct_select mode doesn't handle point features");const r={featureId:t,feature:i,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),Ve.disable(this),this.setActionableState({trash:!0}),r},onStop:function(){Ve.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(e,t,i){e.featureId===t.properties.id?(t.properties.active=E.ACTIVE,i(t),Be(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(i)):(t.properties.active=E.INACTIVE,i(t)),this.fireActionable(e)},onTrash:function(e){e.selectedCoordPaths.sort(((e,t)=>t.localeCompare(e,"en",{numeric:!0}))).forEach((t=>e.feature.removeCoordinate(t))),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),!1===e.feature.isValid()&&(this.deleteFeature([e.featureId]),this.changeMode(b.SIMPLE_SELECT,{}))},onMouseMove:function(e,t){const i=Pe(t),r=Je(t),n=Ke(t),o=0===e.selectedCoordPaths.length;return i&&o||r&&!o?this.updateUIClasses({mouse:y.MOVE}):this.updateUIClasses({mouse:y.NONE}),(r||i||n)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0},onMouseOut:function(e){return e.dragMoving&&this.fireUpdate(),!0}};Qe.onTouchStart=Qe.onMouseDown=function(e,t){return Je(t)?this.onVertex(e,t):Pe(t)?this.onFeature(e,t):Ke(t)?this.onMidpoint(e,t):void 0},Qe.onDrag=function(e,t){if(!0!==e.canDragMove)return;e.dragMoving=!0,t.originalEvent.stopPropagation();const i={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,i):this.dragFeature(e,t,i),e.dragMoveLocation=t.lngLat},Qe.onClick=function(e,t){return Ce(t)?this.clickNoTarget(e,t):Pe(t)?this.clickActiveFeature(e,t):Ie(t)?this.clickInactive(e,t):void this.stopDragging(e)},Qe.onTap=function(e,t){return Ce(t)?this.clickNoTarget(e,t):Pe(t)?this.clickActiveFeature(e,t):Ie(t)?this.clickInactive(e,t):void 0},Qe.onTouchEnd=Qe.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};const et=Qe,tt={onSetup:function(){const e=this.newFeature({type:v.FEATURE,properties:{},geometry:{type:v.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:y.ADD}),this.activateUIButton(_.POINT),this.setActionableState({trash:!0}),{point:e}},stopDrawingAndRemove:function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT)}};tt.onTap=tt.onClick=function(e,t){this.updateUIClasses({mouse:y.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(x.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(b.SIMPLE_SELECT,{featureIds:[e.point.id]})},tt.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},tt.toDisplayFeatures=function(e,t,i){const r=t.properties.id===e.point.id;if(t.properties.active=r?E.ACTIVE:E.INACTIVE,!r)return i(t)},tt.onTrash=tt.stopDrawingAndRemove,tt.onKeyUp=function(e,t){if(Fe(t)||De(t))return this.stopDrawingAndRemove(e,t)};const it=tt,rt=function(e,t){return!!e.lngLat&&e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]},nt={onSetup:function(){const e=this.newFeature({type:v.FEATURE,properties:{},geometry:{type:v.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),Ve.disable(this),this.updateUIClasses({mouse:y.ADD}),this.activateUIButton(_.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&rt(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(b.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:y.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(b.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},onMouseMove:function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),Ae(t)&&this.updateUIClasses({mouse:y.POINTER})}};nt.onTap=nt.onClick=function(e,t){return Ae(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},nt.onKeyUp=function(e,t){Fe(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT)):De(t)&&this.changeMode(b.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},nt.onStop=function(e){this.updateUIClasses({mouse:y.NONE}),Ve.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.polygon.id)&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(x.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT,{},{silent:!0})))},nt.toDisplayFeatures=function(e,t,i){const r=t.properties.id===e.polygon.id;if(t.properties.active=r?E.ACTIVE:E.INACTIVE,!r)return i(t);if(0===t.geometry.coordinates.length)return;const n=t.geometry.coordinates[0].length;if(!(n<3)){if(t.properties.meta=T.FEATURE,i(ze(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),n>3){const r=t.geometry.coordinates[0].length-3;i(ze(e.polygon.id,t.geometry.coordinates[0][r],`0.${r}`,!1))}if(n<=4){const e=[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]];if(i({type:v.FEATURE,properties:t.properties,geometry:{coordinates:e,type:v.LINE_STRING}}),3===n)return}return i(t)}},nt.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT)};const ot=nt,st={onSetup:function(e){const t=(e=e||{}).featureId;let i,r,n="forward";if(t){if(i=this.getFeature(t),!i)throw new Error("Could not find a feature with the provided featureId");let o=e.from;if(o&&"Feature"===o.type&&o.geometry&&"Point"===o.geometry.type&&(o=o.geometry),o&&"Point"===o.type&&o.coordinates&&2===o.coordinates.length&&(o=o.coordinates),!o||!Array.isArray(o))throw new Error("Please use the `from` property to indicate which point to continue the line from");const s=i.coordinates.length-1;if(i.coordinates[s][0]===o[0]&&i.coordinates[s][1]===o[1])r=s+1,i.addCoordinate(r,...i.coordinates[s]);else{if(i.coordinates[0][0]!==o[0]||i.coordinates[0][1]!==o[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");n="backwards",r=0,i.addCoordinate(r,...i.coordinates[0])}}else i=this.newFeature({type:v.FEATURE,properties:{},geometry:{type:v.LINE_STRING,coordinates:[]}}),r=0,this.addFeature(i);return this.clearSelectedFeatures(),Ve.disable(this),this.updateUIClasses({mouse:y.ADD}),this.activateUIButton(_.LINE),this.setActionableState({trash:!0}),{line:i,currentVertexPosition:r,direction:n}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&rt(t,e.line.coordinates[e.currentVertexPosition-1])||"backwards"===e.direction&&rt(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(b.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:y.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),"forward"===e.direction?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(b.SIMPLE_SELECT,{featureIds:[e.line.id]})},onMouseMove:function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),Ae(t)&&this.updateUIClasses({mouse:y.POINTER})}};st.onTap=st.onClick=function(e,t){if(Ae(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},st.onKeyUp=function(e,t){De(t)?this.changeMode(b.SIMPLE_SELECT,{featureIds:[e.line.id]}):Fe(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT))},st.onStop=function(e){Ve.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.line.id)&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(x.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT,{},{silent:!0})))},st.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(b.SIMPLE_SELECT)},st.toDisplayFeatures=function(e,t,i){const r=t.properties.id===e.line.id;if(t.properties.active=r?E.ACTIVE:E.INACTIVE,!r)return i(t);t.geometry.coordinates.length<2||(t.properties.meta=T.FEATURE,i(ze(e.line.id,t.geometry.coordinates["forward"===e.direction?t.geometry.coordinates.length-2:1],""+("forward"===e.direction?t.geometry.coordinates.length-2:1),!1)),i(t))};const at={simple_select:Ye,direct_select:et,draw_point:it,draw_polygon:ot,draw_line_string:st},lt={defaultMode:b.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:Te,modes:at,controls:{},userProperties:!1,suppressAPIEvents:!0},ct={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},ut={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function ht(e,t){return e.map((e=>e.source?e:Object.assign({},e,{id:`${e.id}.${t}`,source:"hot"===t?g.HOT:g.COLD})))}var dt=i(17),pt=i(186);function ft(e,t){return e.length===t.length&&JSON.stringify(e.map((e=>e)).sort())===JSON.stringify(t.map((e=>e)).sort())}const mt={Polygon:oe,LineString:re,Point:te,MultiPolygon:ce,MultiLineString:ce,MultiPoint:ce};function gt(e){!function(e,t){const i={options:e=function(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),!1===e.displayControlsDefault?t.controls=Object.assign({},ut,e.controls):t.controls=Object.assign({},ct,e.controls),t=Object.assign({},lt,t),t.styles=ht(t.styles,"cold").concat(ht(t.styles,"hot")),t}(e)};t=function(e,t){t.modes=b;const i=void 0===e.options.suppressAPIEvents||!!e.options.suppressAPIEvents;return t.getFeatureIdsAt=function(t){return B.click({point:t},null,e).map((e=>e.properties.id))},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:v.FEATURE_COLLECTION,features:e.store.getSelectedIds().map((t=>e.store.get(t))).map((e=>e.toGeoJSON()))}},t.getSelectedPoints=function(){return{type:v.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map((e=>({type:v.FEATURE,properties:{},geometry:{type:v.POINT,coordinates:e.coordinates}})))}},t.set=function(i){if(void 0===i.type||i.type!==v.FEATURE_COLLECTION||!Array.isArray(i.features))throw new Error("Invalid FeatureCollection");const r=e.store.createRenderBatch();let n=e.store.getAllIds().slice();const o=t.add(i),s=new z(o);return n=n.filter((e=>!s.has(e))),n.length&&t.delete(n),r(),o},t.add=function(t){const r=JSON.parse(JSON.stringify(pt(t))).features.map((t=>{if(t.id=t.id||J(),null===t.geometry)throw new Error("Invalid geometry: null");if(void 0===e.store.get(t.id)||e.store.get(t.id).type!==t.geometry.type){const r=mt[t.geometry.type];if(void 0===r)throw new Error(`Invalid geometry type: ${t.geometry.type}.`);const n=new r(e,t);e.store.add(n,{silent:i})}else{const r=e.store.get(t.id),n=r.properties;r.properties=t.properties,dt(n,t.properties)||e.store.featureChanged(r.id,{silent:i}),dt(r.getCoordinates(),t.geometry.coordinates)||r.incomingCoords(t.geometry.coordinates)}return t.id}));return e.store.render(),r},t.get=function(t){const i=e.store.get(t);if(i)return i.toGeoJSON()},t.getAll=function(){return{type:v.FEATURE_COLLECTION,features:e.store.getAll().map((e=>e.toGeoJSON()))}},t.delete=function(r){return e.store.delete(r,{silent:i}),t.getMode()!==b.DIRECT_SELECT||e.store.getSelectedIds().length?e.store.render():e.events.changeMode(b.SIMPLE_SELECT,void 0,{silent:i}),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:i}),t.getMode()===b.DIRECT_SELECT?e.events.changeMode(b.SIMPLE_SELECT,void 0,{silent:i}):e.store.render(),t},t.changeMode=function(r,n={}){return r===b.SIMPLE_SELECT&&t.getMode()===b.SIMPLE_SELECT?(ft(n.featureIds||[],e.store.getSelectedIds())||
2(e.store.setSelected(n.featureIds,{silent:i}),e.store.render()),t):(r===b.DIRECT_SELECT&&t.getMode()===b.DIRECT_SELECT&&n.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(r,n,{silent:i}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:i}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:i}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:i}),t},t.setFeatureProperty=function(r,n,o){return e.store.setFeatureProperty(r,n,o,{silent:i}),t},t}(i,t),i.api=t;const r=ve(i);t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=_,t.options=e}(e,this)}gt.modes=at,gt.constants=e,gt.lib=r;const yt=gt;var _t=i(443),vt=i.n(_t);const bt=11102230246251565e-32,xt=134217729,wt=(3+8*bt)*bt;function Tt(e,t,i,r,n){let o,s,a,l,c=t[0],u=r[0],h=0,d=0;u>c==u>-c?(o=c,c=t[++h]):(o=u,u=r[++d]);let p=0;if(h<e&&d<i)for(u>c==u>-c?(s=c+o,a=o-(s-c),c=t[++h]):(s=u+o,a=o-(s-u),u=r[++d]),o=s,0!==a&&(n[p++]=a);h<e&&d<i;)u>c==u>-c?(s=o+c,l=s-o,a=o-(s-l)+(c-l),c=t[++h]):(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=r[++d]),o=s,0!==a&&(n[p++]=a);for(;h<e;)s=o+c,l=s-o,a=o-(s-l)+(c-l),c=t[++h],o=s,0!==a&&(n[p++]=a);for(;d<i;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=r[++d],o=s,0!==a&&(n[p++]=a);return 0===o&&0!==p||(n[p++]=o),p}function Et(e){return new Float64Array(e)}const St=Et(4),Pt=Et(8),It=Et(12),Ct=Et(16),Mt=Et(4);function At(e,t,i,r,n,o){const s=(t-o)*(i-n),a=(e-n)*(r-o),l=s-a,c=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*c?l:-function(e,t,i,r,n,o,s){let a,l,c,u,h,d,p,f,m,g,y,_,v,b,x,w,T,E;const S=e-n,P=i-n,I=t-o,C=r-o;b=S*C,d=xt*S,p=d-(d-S),f=S-p,d=xt*C,m=d-(d-C),g=C-m,x=f*g-(b-p*m-f*m-p*g),w=I*P,d=xt*I,p=d-(d-I),f=I-p,d=xt*P,m=d-(d-P),g=P-m,T=f*g-(w-p*m-f*m-p*g),y=x-T,h=x-y,St[0]=x-(y+h)+(h-T),_=b+y,h=_-b,v=b-(_-h)+(y-h),y=v-w,h=v-y,St[1]=v-(y+h)+(h-w),E=_+y,h=E-_,St[2]=_-(E-h)+(y-h),St[3]=E;let M=function(e,t){let i=t[0];for(let e=1;e<4;e++)i+=t[e];return i}(0,St),A=22204460492503146e-32*s;if(M>=A||-M>=A)return M;if(h=e-S,a=e-(S+h)+(h-n),h=i-P,c=i-(P+h)+(h-n),h=t-I,l=t-(I+h)+(h-o),h=r-C,u=r-(C+h)+(h-o),0===a&&0===l&&0===c&&0===u)return M;if(A=11093356479670487e-47*s+wt*Math.abs(M),M+=S*u+C*a-(I*c+P*l),M>=A||-M>=A)return M;b=a*C,d=xt*a,p=d-(d-a),f=a-p,d=xt*C,m=d-(d-C),g=C-m,x=f*g-(b-p*m-f*m-p*g),w=l*P,d=xt*l,p=d-(d-l),f=l-p,d=xt*P,m=d-(d-P),g=P-m,T=f*g-(w-p*m-f*m-p*g),y=x-T,h=x-y,Mt[0]=x-(y+h)+(h-T),_=b+y,h=_-b,v=b-(_-h)+(y-h),y=v-w,h=v-y,Mt[1]=v-(y+h)+(h-w),E=_+y,h=E-_,Mt[2]=_-(E-h)+(y-h),Mt[3]=E;const L=Tt(4,St,4,Mt,Pt);b=S*u,d=xt*S,p=d-(d-S),f=S-p,d=xt*u,m=d-(d-u),g=u-m,x=f*g-(b-p*m-f*m-p*g),w=I*c,d=xt*I,p=d-(d-I),f=I-p,d=xt*c,m=d-(d-c),g=c-m,T=f*g-(w-p*m-f*m-p*g),y=x-T,h=x-y,Mt[0]=x-(y+h)+(h-T),_=b+y,h=_-b,v=b-(_-h)+(y-h),y=v-w,h=v-y,Mt[1]=v-(y+h)+(h-w),E=_+y,h=E-_,Mt[2]=_-(E-h)+(y-h),Mt[3]=E;const F=Tt(L,Pt,4,Mt,It);b=a*u,d=xt*a,p=d-(d-a),f=a-p,d=xt*u,m=d-(d-u),g=u-m,x=f*g-(b-p*m-f*m-p*g),w=l*c,d=xt*l,p=d-(d-l),f=l-p,d=xt*c,m=d-(d-c),g=c-m,T=f*g-(w-p*m-f*m-p*g),y=x-T,h=x-y,Mt[0]=x-(y+h)+(h-T),_=b+y,h=_-b,v=b-(_-h)+(y-h),y=v-w,h=v-y,Mt[1]=v-(y+h)+(h-w),E=_+y,h=E-_,Mt[2]=_-(E-h)+(y-h),Mt[3]=E;const D=Tt(F,It,4,Mt,Ct);return Ct[D-1]}(e,t,i,r,n,o,c)}function Lt(e,t){var i,r,n,o,s,a,l,c,u,h=0,d=e[0],p=e[1],f=t.length;for(i=0;i<f;i++){r=0;var m=t[i],g=m.length-1;if((c=m[0])[0]!==m[g][0]&&c[1]!==m[g][1])throw new Error("First and last coordinates in a ring must be the same");for(o=c[0]-d,s=c[1]-p;r<g;r++){if(a=(u=m[r+1])[0]-d,l=u[1]-p,0===s&&0===l){if(a<=0&&o>=0||o<=0&&a>=0)return 0}else if(l>=0&&s<=0||l<=0&&s>=0){if(0===(n=At(o,a,s,l,0,0)))return 0;(n>0&&l>0&&s<=0||n<0&&l<=0&&s>0)&&h++}c=u,s=l,o=a}}return h%2!=0}
2function Ft(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Dt(e){return"Feature"===e.type?e.geometry:e}function kt(e,t,i={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const r=Ft(e),n=Dt(t),o=n.type,s=t.bbox;let a=n.coordinates;if(s&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(r,s))return!1;"Polygon"===o&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){const e=Lt(r,a[c]);if(0===e)return!i.ignoreBoundary;e&&(l=!0)}return l}Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(8),Et(8),Et(8),Et(4),Et(8),Et(8),Et(8),Et(12),Et(192),Et(192),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(8),Et(8),Et(8),Et(8),Et(8),Et(8),Et(8),Et(8),Et(8),Et(4),Et(4),Et(4),Et(8),Et(16),Et(16),Et(16),Et(32),Et(32),Et(48),Et(64),Et(1152),Et(1152),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(4),Et(24),Et(24),Et(24),Et(24),Et(24),Et(24),Et(24),Et(24),Et(24),Et(24),Et(1152),Et(1152),Et(1152),Et(1152),Et(1152),Et(2304),Et(2304),Et(3456),Et(5760),Et(8),Et(8),Et(8),Et(16),Et(24),Et(48),Et(48),Et(96),Et(192),Et(384),Et(384),Et(384),Et(768),Et(96),Et(96),Et(96),Et(1152);var Ot={188:function(e,t,i){e.exports=function(){var e=function(e,t){var i={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on:function(e,t,r){if(void 0===i[e])throw new Error("Invalid event type: "+e);i[e].push({selector:t,fn:r})},render:function(e){t.store.featureChanged(e)}},n=function(e,n){for(var o=i[e],s=o.length;s--;){var a=o[s];if(a.selector(n)){a.fn.call(r,n)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop:function(){e.stop&&e.stop()},trash:function(){e.trash&&(e.trash(),t.store.render())},combineFeatures:function(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures:function(){e.uncombineFeatures&&e.uncombineFeatures()},drag:function(e){n("drag",e)},click:function(e){n("click",e)},mousemove:function(e){n("mousemove",e)},mousedown:function(e){n("mousedown",e)},mouseup:function(e){n("mouseup",e)},mouseout:function(e){n("mouseout",e)},keydown:function(e){n("keydown",e)},keyup:function(e){n("keyup",e)},touchstart:function(e){n("touchstart",e)},touchmove:function(e){n("touchmove",e)},touchend:function(e){n("touchend",e)},tap:function(e){n("tap",e)}}};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r={},n=6378137;function o(e){var t=0;if(e&&e.length>0){t+=Math.abs(s(e[0]));for(var i=1;i<e.length;i++)t-=Math.abs(s(e[i]))}return t}function s(e){var t,i,r,o,s,l,c=0,u=e.length;if(u>2){for(l=0;l<u;l++)l===u-2?(r=u-2,o=u-1,s=0):l===u-1?(r=u-1,o=0,s=1):(r=l,o=l+1,s=l+2),t=e[r],i=e[o],c+=(a(e[s][0])-a(t[0]))*Math.sin(a(i[1]));c=c*n*n/2}return c}function a(e){return e*Math.PI/180}r.geometry=function e(t){var i,r=0;switch(t.type){case"Polygon":return o(t.coordinates);case"MultiPolygon":for(i=0;i<t.coordinates.length;i++)r+=o(t.coordinates[i]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(i=0;i<t.geometries.length;i++)r+=e(t.geometries[i]);return r}},r.ring=s;var l={CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},c={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},u={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},h={POLYGON:"polygon",LINE:"line_string",POINT:"point"},d={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},p={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select",STATIC:"static"}
2,f={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},m={MOVE:"move",CHANGE_COORDINATES:"change_coordinates"},g={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},y={ACTIVE:"true",INACTIVE:"false"},_=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],v=Object.freeze({__proto__:null,classes:l,sources:c,cursors:u,types:h,geojsonTypes:d,modes:p,events:f,updateActions:m,meta:g,activeStates:y,interactions:_,LAT_MIN:-90,LAT_RENDERED_MIN:-85,LAT_MAX:90,LAT_RENDERED_MAX:85,LNG_MIN:-270,LNG_MAX:270}),b={Point:0,LineString:1,MultiLineString:1,Polygon:2};function x(e,t){var i=b[e.geometry.type]-b[t.geometry.type];return 0===i&&e.geometry.type===d.POLYGON?e.area-t.area:i}function w(e){return e.map((function(e){return e.geometry.type===d.POLYGON&&(e.area=r.geometry({type:d.FEATURE,property:{},geometry:e.geometry})),e})).sort(x).map((function(e){return delete e.area,e}))}function T(e,t){return void 0===t&&(t=0),[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]}function E(e){if(this._items={},this._nums={},this._length=e?e.length:0,e)for(var t=0,i=e.length;t<i;t++)this.add(e[t]),void 0!==e[t]&&("string"==typeof e[t]?this._items[e[t]]=t:this._nums[e[t]]=t)}E.prototype.add=function(e){return this.has(e)||(this._length++,"string"==typeof e?this._items[e]=this._length:this._nums[e]=this._length),this},E.prototype.delete=function(e){return!1===this.has(e)||(this._length--,delete this._items[e],delete this._nums[e]),this},E.prototype.has=function(e){return!("string"!=typeof e&&"number"!=typeof e||void 0===this._items[e]&&void 0===this._nums[e])},E.prototype.values=function(){var e=this,t=[];return Object.keys(this._items).forEach((function(i){t.push({k:i,v:e._items[i]})})),Object.keys(this._nums).forEach((function(i){t.push({k:JSON.parse(i),v:e._nums[i]})})),t.sort((function(e,t){return e.v-t.v})).map((function(e){return e.k}))},E.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};var S=[g.FEATURE,g.MIDPOINT,g.VERTEX],P={click:function(e,t,i){return I(e,t,i,i.options.clickBuffer)},touch:function(e,t,i){return I(e,t,i,i.options.touchBuffer)}};function I(e,t,i,r){if(null===i.map)return[];var n=e?T(e,r):t,o={};i.options.styles&&(o.layers=i.options.styles.map((function(e){return e.id})));var s=i.map.queryRenderedFeatures(n,o).filter((function(e){return-1!==S.indexOf(e.properties.meta)})),a=new E,l=[];return s.forEach((function(e){var t=e.properties.id;a.has(t)||(a.add(t),l.push(e))})),w(l)}function C(e,t){var i=P.click(e,null,t),r={mouse:u.NONE};return i[0]&&(r.mouse=i[0].properties.active===y.ACTIVE?u.MOVE:u.POINTER,r.feature=i[0].properties.meta),-1!==t.events.currentModeName().indexOf("draw")&&(r.mouse=u.ADD),t.ui.queueMapClasses(r),t.ui.updateMapClasses(),i[0]}function M(e,t){var i=e.x-t.x,r=e.y-t.y;return Math.sqrt(i*i+r*r)}function A(e,t,i){void 0===i&&(i={});var r=null!=i.fineTolerance?i.fineTolerance:4,n=null!=i.grossTolerance?i.grossTolerance:12,o=null!=i.interval?i.interval:500;e.point=e.point||t.point,e.time=e.time||t.time;var s=M(e.point,t.point);return s<r||s<n&&t.time-e.time<o}function L(e,t,i){void 0===i&&(i={});var r=null!=i.tolerance?i.tolerance:25,n=null!=i.interval?i.interval:250;return e.point=e.point||t.point,e.time=e.time||t.time,M(e.point,t.point)<r&&t.time-e.time<n}var F={exports:{}},D=F.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var i=Math.log(Math.pow(2,e))/Math.log(t),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(t)*r;var n=i-Math.floor(i),o="";for(r=0;r<Math.floor(i);r++)o=Math.floor(Math.random()*t).toString(t)+o;if(n){var s=Math.pow(t,n);o=Math.floor(Math.random()*s).toString(t)+o}var a=parseInt(o,t);return a!==1/0&&a>=Math.pow(2,e)?D(e,t):o};D.rack=function(e,t,i){var r=function(r){var o=0;do{if(o++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var s=D(e,t)}while(Object.hasOwnProperty.call(n,s));return n[s]=r,s},n=r.hats={};return r.get=function(e){return r.hats[e]},r.set=function(e,t){return r.hats[e]=t,r},r.bits=e||128,r.base=t||16,r};
2var k=t(F.exports),O=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||k(),this.type=t.geometry.type};O.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},O.prototype.incomingCoords=function(e){this.setCoordinates(e)},O.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},O.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},O.prototype.setProperty=function(e,t){this.properties[e]=t},O.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:d.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},O.prototype.internal=function(e){var t={id:this.id,meta:g.FEATURE,"meta:type":this.type,active:y.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(var i in this.properties)t["user_"+i]=this.properties[i];return{type:d.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var R=function(e,t){O.call(this,e,t)};(R.prototype=Object.create(O.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},R.prototype.updateCoordinate=function(e,t,i){this.coordinates=3===arguments.length?[t,i]:[e,t],this.changed()},R.prototype.getCoordinate=function(){return this.getCoordinates()};var z=function(e,t){O.call(this,e,t)};(z.prototype=Object.create(O.prototype)).isValid=function(){return this.coordinates.length>1},z.prototype.addCoordinate=function(e,t,i){this.changed();var r=parseInt(e,10);this.coordinates.splice(r,0,[t,i])},z.prototype.getCoordinate=function(e){var t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))},z.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)},z.prototype.updateCoordinate=function(e,t,i){var r=parseInt(e,10);this.coordinates[r]=[t,i],this.changed()};var N=function(e,t){O.call(this,e,t),this.coordinates=this.coordinates.map((function(e){return e.slice(0,-1)}))};(N.prototype=Object.create(O.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((function(e){return e.length>2}))},N.prototype.incomingCoords=function(e){this.coordinates=e.map((function(e){return e.slice(0,-1)})),this.changed()},N.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()},N.prototype.addCoordinate=function(e,t,i){this.changed();var r=e.split(".").map((function(e){return parseInt(e,10)}));this.coordinates[r[0]].splice(r[1],0,[t,i])},N.prototype.removeCoordinate=function(e){this.changed();var t=e.split(".").map((function(e){return parseInt(e,10)})),i=this.coordinates[t[0]];i&&(i.splice(t[1],1),i.length<3&&this.coordinates.splice(t[0],1))},N.prototype.getCoordinate=function(e){var t=e.split(".").map((function(e){return parseInt(e,10)})),i=this.coordinates[t[0]];return JSON.parse(JSON.stringify(i[t[1]]))},N.prototype.getCoordinates=function(){return this.coordinates.map((function(e){return e.concat([e[0]])}))},N.prototype.updateCoordinate=function(e,t,i){this.changed();var r=e.split("."),n=parseInt(r[0],10),o=parseInt(r[1],10);void 0===this.coordinates[n]&&(this.coordinates[n]=[]),this.coordinates[n][o]=[t,i]};var B={MultiPoint:R,MultiLineString:z,MultiPolygon:N},V=function(e,t,i,r,n){var o=i.split("."),s=parseInt(o[0],10),a=o[1]?o.slice(1).join("."):null;return e[s][t](a,r,n)},j=function(e,t){if(O.call(this,e,t),delete this.coordinates,this.model=B[t.geometry.type],void 0===this.model)throw new TypeError(t.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(t.geometry.coordinates)};function U(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}(j.prototype=Object.create(O.prototype))._coordinatesToFeatures=function(e){var t=this,i=this.model.bind(this);return e.map((function(e){return new i(t.ctx,{id:k(),type:d.FEATURE,properties:{},geometry:{coordinates:e,type:t.type.replace("Multi","")}})}))},j.prototype.isValid=function(){return this.features.every((function(e){return e.isValid()}))},j.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()},j.prototype.getCoordinate=function(e){return V(this.features,"getCoordinate",e)},j.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((function(e){return e.type===d.POLYGON?e.getCoordinates():e.coordinates}))))},j.prototype.updateCoordinate=function(e,t,i){V(this.features,"updateCoordinate",e,t,i),this.changed()},j.prototype.addCoordinate=function(e,t,i){V(this.features,"addCoordinate",e,t,i),this.changed()},j.prototype.removeCoordinate=function(e){V(this.features,"removeCoordinate",e),this.changed()},j.prototype.getFeatures=function(){return this.features},U.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)},U.prototype.setSelectedCoordinates=function(e){var t=this;this._ctx.store.setSelectedCoordinates(e),e.reduce((function(e,i){return void 0===e[i.feature_id]&&(e[i.feature_id]=!0,t._ctx.store.get(i.feature_id).changed()),e}),{})},U.prototype.getSelected=function(){return this._ctx.store.getSelected()},U.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},U.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)},U.prototype.getFeature=function(e){return this._ctx.store.get(e)},U.prototype.select=function(e){return this._ctx.store.select(e)},U.prototype.deselect=function(e){return this._ctx.store.deselect(e)},U.prototype.deleteFeature=function(e,t){return void 0===t&&(t={}),this._ctx.store.delete(e,t)},U.prototype.addFeature=function(e){return this._ctx.store.add(e)},U.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},U.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},U.prototype.setActionableState=function(e){void 0===e&&(e={});
2var t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)},U.prototype.changeMode=function(e,t,i){return void 0===t&&(t={}),void 0===i&&(i={}),this._ctx.events.changeMode(e,t,i)},U.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)},U.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)},U.prototype.featuresAt=function(e,t,i){if(void 0===i&&(i="click"),"click"!==i&&"touch"!==i)throw new Error("invalid buffer type");return P[i](e,t,this._ctx)},U.prototype.newFeature=function(e){var t=e.geometry.type;return t===d.POINT?new R(this._ctx,e):t===d.LINE_STRING?new z(this._ctx,e):t===d.POLYGON?new N(this._ctx,e):new j(this._ctx,e)},U.prototype.isInstanceOf=function(e,t){if(e===d.POINT)return t instanceof R;if(e===d.LINE_STRING)return t instanceof z;if(e===d.POLYGON)return t instanceof N;if("MultiFeature"===e)return t instanceof j;throw new Error("Unknown feature class: "+e)},U.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)},U.prototype.onSetup=function(){},U.prototype.onDrag=function(){},U.prototype.onClick=function(){},U.prototype.onMouseMove=function(){},U.prototype.onMouseDown=function(){},U.prototype.onMouseUp=function(){},U.prototype.onMouseOut=function(){},U.prototype.onKeyUp=function(){},U.prototype.onKeyDown=function(){},U.prototype.onTouchStart=function(){},U.prototype.onTouchMove=function(){},U.prototype.onTouchEnd=function(){},U.prototype.onTap=function(){},U.prototype.onStop=function(){},U.prototype.onTrash=function(){},U.prototype.onCombineFeature=function(){},U.prototype.onUncombineFeature=function(){},U.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var G={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},$=Object.keys(G);function q(e){return[].concat(e).filter((function(e){return void 0!==e}))}function Z(){var e=this;if(!e.ctx.map||void 0===e.ctx.map.getSource(c.HOT))return l();var t=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:t});var i=[],r=[];e.isDirty?r=e.getAllIds():(i=e.getChangedIds().filter((function(t){return void 0!==e.get(t)})),r=e.sources.hot.filter((function(t){return t.properties.id&&-1===i.indexOf(t.properties.id)&&void 0!==e.get(t.properties.id)})).map((function(e){return e.properties.id}))),e.sources.hot=[];var n=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter((function(e){var t=e.properties.id||e.properties.parent;return-1===i.indexOf(t)}));var o=n!==e.sources.cold.length||r.length>0;function s(i,r){var n=e.get(i).internal(t);e.ctx.events.currentModeRender(n,(function(t){e.sources[r].push(t)}))}if(i.forEach((function(e){return s(e,"hot")})),r.forEach((function(e){return s(e,"cold")})),o&&e.ctx.map.getSource(c.COLD).setData({type:d.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(c.HOT).setData({type:d.FEATURE_COLLECTION,features:e.sources.hot}),e._emitSelectionChange&&(e.ctx.map.fire(f.SELECTION_CHANGE,{features:e.getSelected().map((function(e){return e.toGeoJSON()})),points:e.getSelectedCoordinates().map((function(e){return{type:d.FEATURE,properties:{},geometry:{type:d.POINT,coordinates:e.coordinates}}}))}),e._emitSelectionChange=!1),e._deletedFeaturesToEmit.length){var a=e._deletedFeaturesToEmit.map((function(e){return e.toGeoJSON()}));e._deletedFeaturesToEmit=[],e.ctx.map.fire(f.DELETE,{features:a})}function l(){e.isDirty=!1,e.clearChangedIds()}l(),e.ctx.map.fire(f.RENDER,{})}function W(e){var t,i=this;this._features={},this._featureIds=new E,this._selectedFeatureIds=new E,this._selectedCoordinates=[],this._changedFeatureIds=new E,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]},this.render=function(){t||(t=requestAnimationFrame((function(){t=null,Z.call(i)})))},this.isDirty=!1}function H(e,t){var i=e._selectedCoordinates.filter((function(t){return e._selectedFeatureIds.has(t.feature_id)}));e._selectedCoordinates.length===i.length||t.silent||(e._emitSelectionChange=!0),e._selectedCoordinates=i}W.prototype.createRenderBatch=function(){var e=this,t=this.render,i=0;return this.render=function(){i++},function(){e.render=t,i>0&&e.render()}},W.prototype.setDirty=function(){return this.isDirty=!0,this},W.prototype.featureChanged=function(e){return this._changedFeatureIds.add(e),this},W.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},W.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},W.prototype.getAllIds=function(){return this._featureIds.values()},W.prototype.add=function(e){return this.featureChanged(e.id),this._features[e.id]=e,this._featureIds.add(e.id),this},W.prototype.delete=function(e,t){var i=this;return void 0===t&&(t={}),q(e).forEach((function(e){i._featureIds.has(e)&&(i._featureIds.delete(e),i._selectedFeatureIds.delete(e),t.silent||-1===i._deletedFeaturesToEmit.indexOf(i._features[e])&&i._deletedFeaturesToEmit.push(i._features[e]),delete i._features[e],i.isDirty=!0)})),H(this,t),this},W.prototype.get=function(e){return this._features[e]},W.prototype.getAll=function(){var e=this;return Object.keys(this._features).map((function(t){return e._features[t]}))},W.prototype.select=function(e,t){var i=this;return void 0===t&&(t={}),q(e).forEach((function(e){i._selectedFeatureIds.has(e)||(i._selectedFeatureIds.add(e),i._changedFeatureIds.add(e),t.silent||(i._emitSelectionChange=!0))})),this},W.prototype.deselect=function(e,t){var i=this;return void 0===t&&(t={}),q(e).forEach((function(e){i._selectedFeatureIds.has(e)&&(i._selectedFeatureIds.delete(e),i._changedFeatureIds.add(e),t.silent||(i._emitSelectionChange=!0))})),H(this,t),this},W.prototype.clearSelected=function(e){return void 0===e&&(e={}),this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this},W.prototype.setSelected=function(e,t){var i=this;return void 0===t&&(t={}),e=q(e),this.deselect(this._selectedFeatureIds.values().filter((function(t){return-1===e.indexOf(t)})),{silent:t.silent}),this.select(e.filter((function(e){return!i._selectedFeatureIds.has(e)})),{silent:t.silent}),this},W.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this},W.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},W.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},W.prototype.getSelected=function(){var e=this;return this._selectedFeatureIds.values().map((function(t){return e.get(t)}))},W.prototype.getSelectedCoordinates=function(){var e=this;return this._selectedCoordinates.map((function(t){return{coordinates:e.get(t.feature_id).getCoordinate(t.coord_path)}}))},W.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)},W.prototype.setFeatureProperty=function(e,t,i){this.get(e).setProperty(t,i),this.featureChanged(e)},W.prototype.storeMapConfig=function(){var e=this;_.forEach((function(t){e.ctx.map[t]&&(e._mapInitialConfig[t]=e.ctx.map[t].isEnabled())}))},W.prototype.restoreMapConfig=function(){var e=this;Object.keys(this._mapInitialConfig).forEach((function(t){e._mapInitialConfig[t]?e.ctx.map[t].enable():e.ctx.map[t].disable()}))},W.prototype.getInitialConfigValue=function(e){return void 0===this._mapInitialConfig[e]||this._mapInitialConfig[e]};var X=Object.prototype.hasOwnProperty,Y=t((function(){for(var e=arguments,t={},i=0;i<arguments.length;i++){var r=e[i];
2for(var n in r)X.call(r,n)&&(t[n]=r[n])}return t})),J=["mode","feature","mouse"];function K(t){var i=null,r=null,n={onRemove:function(){return t.map.off("load",n.connect),clearInterval(r),n.removeLayers(),t.store.restoreMapConfig(),t.ui.removeButtons(),t.events.removeEventListeners(),t.ui.clearMapClasses(),t.boxZoomInitial&&t.map.boxZoom.enable(),t.map=null,t.container=null,t.store=null,i&&i.parentNode&&i.parentNode.removeChild(i),i=null,this},connect:function(){t.map.off("load",n.connect),clearInterval(r),n.addLayers(),t.store.storeMapConfig(),t.events.addEventListeners()},onAdd:function(o){var s=o.fire;return o.fire=function(e,t){var i=arguments;return 1===s.length&&1!==arguments.length&&(i=[Y({},{type:e},t)]),s.apply(o,i)},t.map=o,t.events=function(t){var i=Object.keys(t.options.modes).reduce((function(e,i){return e[i]=function(e){var t=Object.keys(e);return function(i,r){void 0===r&&(r={});var n={},o=t.reduce((function(t,i){return t[i]=e[i],t}),new U(i));return{start:function(){var t=this;n=o.onSetup(r),$.forEach((function(i){var r,s=G[i],a=function(){return!1};e[s]&&(a=function(){return!0}),t.on(i,a,(r=s,function(e){return o[r](n,e)}))}))},stop:function(){o.onStop(n)},trash:function(){o.onTrash(n)},combineFeatures:function(){o.onCombineFeatures(n)},uncombineFeatures:function(){o.onUncombineFeatures(n)},render:function(e,t){o.toDisplayFeatures(n,e,t)}}}}(t.options.modes[i]),e}),{}),r={},n={},o={},s=null,a=null;o.drag=function(e,i){i({point:e.point,time:(new Date).getTime()})?(t.ui.queueMapClasses({mouse:u.DRAG}),a.drag(e)):e.originalEvent.stopPropagation()},o.mousedrag=function(e){o.drag(e,(function(e){return!A(r,e)}))},o.touchdrag=function(e){o.drag(e,(function(e){return!L(n,e)}))},o.mousemove=function(e){if(1===(void 0!==e.originalEvent.buttons?e.originalEvent.buttons:e.originalEvent.which))return o.mousedrag(e);var i=C(e,t);e.featureTarget=i,a.mousemove(e)},o.mousedown=function(e){r={time:(new Date).getTime(),point:e.point};var i=C(e,t);e.featureTarget=i,a.mousedown(e)},o.mouseup=function(e){var i=C(e,t);e.featureTarget=i,A(r,{point:e.point,time:(new Date).getTime()})?a.click(e):a.mouseup(e)},o.mouseout=function(e){a.mouseout(e)},o.touchstart=function(e){if(e.originalEvent.preventDefault(),t.options.touchEnabled){n={time:(new Date).getTime(),point:e.point};var i=P.touch(e,null,t)[0];e.featureTarget=i,a.touchstart(e)}},o.touchmove=function(e){if(e.originalEvent.preventDefault(),t.options.touchEnabled)return a.touchmove(e),o.touchdrag(e)},o.touchend=function(e){if(e.originalEvent.preventDefault(),t.options.touchEnabled){var i=P.touch(e,null,t)[0];e.featureTarget=i,L(n,{time:(new Date).getTime(),point:e.point})?a.tap(e):a.touchend(e)}};var l=function(e){return!(8===e||46===e||e>=48&&e<=57)};function c(r,n,o){void 0===o&&(o={}),a.stop();var l=i[r];if(void 0===l)throw new Error(r+" is not valid");s=r;var c=l(t,n);a=e(c,t),o.silent||t.map.fire(f.MODE_CHANGE,{mode:r}),t.store.setDirty(),t.store.render()}o.keydown=function(e){(e.srcElement||e.target).classList.contains("mapboxgl-canvas")&&(8!==e.keyCode&&46!==e.keyCode||!t.options.controls.trash?l(e.keyCode)?a.keydown(e):49===e.keyCode&&t.options.controls.point?c(p.DRAW_POINT):50===e.keyCode&&t.options.controls.line_string?c(p.DRAW_LINE_STRING):51===e.keyCode&&t.options.controls.polygon&&c(p.DRAW_POLYGON):(e.preventDefault(),a.trash()))},o.keyup=function(e){l(e.keyCode)&&a.keyup(e)},o.zoomend=function(){t.store.changeZoom()},o.data=function(e){if("style"===e.dataType){var i=t.setup,r=t.map,n=t.options,o=t.store;n.styles.some((function(e){return r.getLayer(e.id)}))||(i.addLayers(),o.setDirty(),o.render())}};var h={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){s=t.options.defaultMode,a=e(i[s](t),t)},changeMode:c,actionable:function(e){var i=!1;Object.keys(e).forEach((function(t){if(void 0===h[t])throw new Error("Invalid action type");h[t]!==e[t]&&(i=!0),h[t]=e[t]})),i&&t.map.fire(f.ACTIONABLE,{actions:h})},currentModeName:function(){return s},currentModeRender:function(e,t){return a.render(e,t)},fire:function(e,t){o[e]&&o[e](t)},addEventListeners:function(){t.map.on("mousemove",o.mousemove),t.map.on("mousedown",o.mousedown),t.map.on("mouseup",o.mouseup),t.map.on("data",o.data),t.map.on("touchmove",o.touchmove),t.map.on("touchstart",o.touchstart),t.map.on("touchend",o.touchend),t.container.addEventListener("mouseout",o.mou
2seout),t.options.keybindings&&(t.container.addEventListener("keydown",o.keydown),t.container.addEventListener("keyup",o.keyup))},removeEventListeners:function(){t.map.off("mousemove",o.mousemove),t.map.off("mousedown",o.mousedown),t.map.off("mouseup",o.mouseup),t.map.off("data",o.data),t.map.off("touchmove",o.touchmove),t.map.off("touchstart",o.touchstart),t.map.off("touchend",o.touchend),t.container.removeEventListener("mouseout",o.mouseout),t.options.keybindings&&(t.container.removeEventListener("keydown",o.keydown),t.container.removeEventListener("keyup",o.keyup))},trash:function(e){a.trash(e)},combineFeatures:function(){a.combineFeatures()},uncombineFeatures:function(){a.uncombineFeatures()},getMode:function(){return s}}}(t),t.ui=function(e){var t={},i=null,r={mode:null,feature:null,mouse:null},n={mode:null,feature:null,mouse:null};function o(e){n=Y(n,e)}function s(){var t,i;if(e.container){var o=[],s=[];J.forEach((function(e){n[e]!==r[e]&&(o.push(e+"-"+r[e]),null!==n[e]&&s.push(e+"-"+n[e]))})),o.length>0&&(t=e.container.classList).remove.apply(t,o),s.length>0&&(i=e.container.classList).add.apply(i,s),r=Y(r,n)}}function a(e,t){void 0===t&&(t={});var r=document.createElement("button");return r.className=l.CONTROL_BUTTON+" "+t.className,r.setAttribute("title",t.title),t.container.appendChild(r),r.addEventListener("click",(function(r){if(r.preventDefault(),r.stopPropagation(),r.target===i)return c(),void t.onDeactivate();u(e),t.onActivate()}),!0),r}function c(){i&&(i.classList.remove(l.ACTIVE_BUTTON),i=null)}function u(e){c();var r=t[e];r&&r&&"trash"!==e&&(r.classList.add(l.ACTIVE_BUTTON),i=r)}return{setActiveButton:u,queueMapClasses:o,updateMapClasses:s,clearMapClasses:function(){o({mode:null,feature:null,mouse:null}),s()},addButtons:function(){var i=e.options.controls,r=document.createElement("div");return r.className=l.CONTROL_GROUP+" "+l.CONTROL_BASE,i?(i[h.LINE]&&(t[h.LINE]=a(h.LINE,{container:r,className:l.CONTROL_BUTTON_LINE,title:"LineString tool "+(e.options.keybindings?"(l)":""),onActivate:function(){return e.events.changeMode(p.DRAW_LINE_STRING)},onDeactivate:function(){return e.events.trash()}})),i[h.POLYGON]&&(t[h.POLYGON]=a(h.POLYGON,{container:r,className:l.CONTROL_BUTTON_POLYGON,title:"Polygon tool "+(e.options.keybindings?"(p)":""),onActivate:function(){return e.events.changeMode(p.DRAW_POLYGON)},onDeactivate:function(){return e.events.trash()}})),i[h.POINT]&&(t[h.POINT]=a(h.POINT,{container:r,className:l.CONTROL_BUTTON_POINT,title:"Marker tool "+(e.options.keybindings?"(m)":""),onActivate:function(){return e.events.changeMode(p.DRAW_POINT)},onDeactivate:function(){return e.events.trash()}})),i.trash&&(t.trash=a("trash",{container:r,className:l.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:function(){e.events.trash()}})),i.combine_features&&(t.combine_features=a("combineFeatures",{container:r,className:l.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:function(){e.events.combineFeatures()}})),i.uncombine_features&&(t.uncombine_features=a("uncombineFeatures",{container:r,className:l.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:function(){e.events.uncombineFeatures()}})),r):r},removeButtons:function(){Object.keys(t).forEach((function(e){var i=t[e];i.parentNode&&i.parentNode.removeChild(i),delete t[e]}))}}}(t),t.container=o.getContainer(),t.store=new W(t),i=t.ui.addButtons(),t.options.boxSelect&&(t.boxZoomInitial=o.boxZoom.isEnabled(),o.boxZoom.disable(),o.dragPan.disable(),o.dragPan.enable()),o.loaded()?n.connect():(o.on("load",n.connect),r=setInterval((function(){o.loaded()&&n.connect()}),16)),t.events.start(),i},addLayers:function(){t.map.addSource(c.COLD,{data:{type:d.FEATURE_COLLECTION,features:[]},type:"geojson"}),t.map.addSource(c.HOT,{data:{type:d.FEATURE_COLLECTION,features:[]},type:"geojson"}),t.options.styles.forEach((function(e){t.map.addLayer(e)})),t.store.setDirty(!0),t.store.render()},removeLayers:function(){t.options.styles.forEach((function(e){t.map.getLayer(e.id)&&t.map.removeLayer(e.id)})),t.map.getSource(c.COLD)&&t.map.removeSource(c.COLD),t.map.getSource(c.HOT)&&t.map.removeSource(c.HOT)}};return t.setup=n,n}var Q=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"cir
2cle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}];function ee(e){return function(t){var i=t.featureTarget;return!!i&&!!i.properties&&i.properties.meta===e}}function te(e){return!!e.originalEvent&&!!e.originalEvent.shiftKey&&0===e.originalEvent.button}function ie(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.active===y.ACTIVE&&e.featureTarget.properties.meta===g.FEATURE}function re(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.active===y.INACTIVE&&e.featureTarget.properties.meta===g.FEATURE}function ne(e){return void 0===e.featureTarget}function oe(e){return!!e.featureTarget&&!!e.featureTarget.properties&&e.featureTarget.properties.meta===g.FEATURE}function se(e){var t=e.featureTarget;return!!t&&!!t.properties&&t.properties.meta===g.VERTEX}function ae(e){return!!e.originalEvent&&!0===e.originalEvent.shiftKey}function le(e){return 27===e.keyCode}function ce(e){return 13===e.keyCode}var ue=Object.freeze({__proto__:null,isOfMetaType:ee,isShiftMousedown:te,isActiveFeature:ie,isInactiveFeature:re,noTarget:ne,isFeature:oe,isVertex:se,isShiftDown:ae,isEscapeKey:le,isEnterKey:ce,isTrue:function(){return!0}}),he=de;function de(e,t){this.x=e,this.y=t}de.prototype={clone:function(){return new de(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=t*this.x-i*this.y,n=i*this.x+t*this.y;return this.x=r,this.y=n,this}
2,_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.x+i*(this.x-t.x)-r*(this.y-t.y),o=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=n,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},de.convert=function(e){return e instanceof de?e:Array.isArray(e)?new de(e[0],e[1]):e};var pe=t(he);function fe(e,t){var i=t.getBoundingClientRect();return new pe(e.clientX-i.left-(t.clientLeft||0),e.clientY-i.top-(t.clientTop||0))}function me(e,t,i,r){return{type:d.FEATURE,properties:{meta:g.VERTEX,parent:e,coord_path:i,active:r?y.ACTIVE:y.INACTIVE},geometry:{type:d.POINT,coordinates:t}}}function ge(e,t,i){var r=t.geometry.coordinates,n=i.geometry.coordinates;if(r[1]>85||r[1]<-85||n[1]>85||n[1]<-85)return null;var o={lng:(r[0]+n[0])/2,lat:(r[1]+n[1])/2};return{type:d.FEATURE,properties:{meta:g.MIDPOINT,parent:e,lng:o.lng,lat:o.lat,coord_path:i.properties.coord_path},geometry:{type:d.POINT,coordinates:[o.lng,o.lat]}}}function ye(e,t,i){void 0===t&&(t={}),void 0===i&&(i=null);var r,n=e.geometry,o=n.type,s=n.coordinates,a=e.properties&&e.properties.id,l=[];function c(e,i){var r="",n=null;e.forEach((function(e,o){var s=null!=i?i+"."+o:String(o),c=me(a,e,s,u(s));if(t.midpoints&&n){var h=ge(a,n,c);h&&l.push(h)}n=c;var d=JSON.stringify(e);r!==d&&l.push(c),0===o&&(r=d)}))}function u(e){return!!t.selectedPaths&&-1!==t.selectedPaths.indexOf(e)}return o===d.POINT?l.push(me(a,s,i,u(i))):o===d.POLYGON?s.forEach((function(e,t){c(e,null!==i?i+"."+t:String(t))})):o===d.LINE_STRING?c(s,i):0===o.indexOf(d.MULTI_PREFIX)&&(r=o.replace(d.MULTI_PREFIX,""),s.forEach((function(i,n){var o={type:d.FEATURE,properties:e.properties,geometry:{type:r,coordinates:i}};l=l.concat(ye(o,t,n))}))),l}var _e={enable:function(e){setTimeout((function(){e.map&&e.map.doubleClickZoom&&e._ctx&&e._ctx.store&&e._ctx.store.getInitialConfigValue&&e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()}),0)},disable:function(e){setTimeout((function(){e.map&&e.map.doubleClickZoom&&e.map.doubleClickZoom.disable()}),0)}},ve={exports:{}},be=function(e){if(!e||!e.type)return null;var t=xe[e.type];return t?"geometry"===t?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:e}]}:"feature"===t?{type:"FeatureCollection",features:[e]}:"featurecollection"===t?e:void 0:null},xe={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"},we=t(be),Te=Object.freeze({__proto__:null,default:function e(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce((function(t,i){return t.concat(e(i))}),[]),t;case"Feature":return t.geometry?e(t.geometry).map((function(e){var i={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(i.id=t.id),i})):[t];case"MultiPoint":return t.coordinates.map((function(e){return{type:"Point",coordinates:e}}));case"MultiPolygon":return t.coordinates.map((function(e){return{type:"Polygon",coordinates:e}}));case"MultiLineString":return t.coordinates.map((function(e){return{type:"LineString",coordinates:e}}));case"GeometryCollection":return t.geometries.map(e).reduce((function(e,t){return e.concat(t)}),[]);case"Point":case"Polygon":case"LineString":return[t]}}}),Ee=be,Se=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var i=function e(){if(this instanceof e){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(t,i))}return t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),i}(Te);Se instanceof Function||(Se=Se.default);var Pe={exports:{}},Ie=Pe.exports=function(e){return new Ce(e)};function Ce(e){this.value=e}function Me(e,t,i){var r=[],n=[],o=!0;return function e(s){var a=i?Ae(s):s,l={},c=!0,u={node:a,node_:s,path:[].concat(r),parent:n[n.length-1],parents:n,key:r.slice(-1)[0],isRoot:0===r.length,level:r.length,circular:null,update:function(e,t){u.isRoot||(u.parent.node[u.key]=e),u.node=e,t&&(c=!1)},delete:function(e){delete u.parent.node[u.key],e&&(c=!1)},remove:function(e){De(u.parent.node)?u.parent.node.splice(u.key,1):delete u.parent.node[u.key],e&&(c=!1)},keys:null,before:function(e){l.before=e},after:function(e){l.after=e},pre:function(e){l.pre=e},post:function(e){l.post=e},stop:function(){o=!1}
2,block:function(){c=!1}};if(!o)return u;function h(){if("object"==typeof u.node&&null!==u.node){u.keys&&u.node_===u.node||(u.keys=Le(u.node)),u.isLeaf=0==u.keys.length;for(var e=0;e<n.length;e++)if(n[e].node_===s){u.circular=n[e];break}}else u.isLeaf=!0,u.keys=null;u.notLeaf=!u.isLeaf,u.notRoot=!u.isRoot}h();var d=t.call(u,u.node);return void 0!==d&&u.update&&u.update(d),l.before&&l.before.call(u,u.node),c?("object"!=typeof u.node||null===u.node||u.circular||(n.push(u),h(),ke(u.keys,(function(t,n){r.push(t),l.pre&&l.pre.call(u,u.node[t],t);var o=e(u.node[t]);i&&Oe.call(u.node,t)&&(u.node[t]=o.node),o.isLast=n==u.keys.length-1,o.isFirst=0==n,l.post&&l.post.call(u,o),r.pop()})),n.pop()),l.after&&l.after.call(u,u.node),u):u}(e).node}function Ae(e){if("object"==typeof e&&null!==e){var t;if(De(e))t=[];else if("[object Date]"===Fe(e))t=new Date(e.getTime?e.getTime():e);else if(function(e){return"[object RegExp]"===Fe(e)}(e))t=new RegExp(e);else if(function(e){return"[object Error]"===Fe(e)}(e))t={message:e.message};else if(function(e){return"[object Boolean]"===Fe(e)}(e))t=new Boolean(e);else if(function(e){return"[object Number]"===Fe(e)}(e))t=new Number(e);else if(function(e){return"[object String]"===Fe(e)}(e))t=new String(e);else if(Object.create&&Object.getPrototypeOf)t=Object.create(Object.getPrototypeOf(e));else if(e.constructor===Object)t={};else{var i=e.constructor&&e.constructor.prototype||e.__proto__||{},r=function(){};r.prototype=i,t=new r}return ke(Le(e),(function(i){t[i]=e[i]})),t}return e}Ce.prototype.get=function(e){for(var t=this.value,i=0;i<e.length;i++){var r=e[i];if(!t||!Oe.call(t,r)){t=void 0;break}t=t[r]}return t},Ce.prototype.has=function(e){for(var t=this.value,i=0;i<e.length;i++){var r=e[i];if(!t||!Oe.call(t,r))return!1;t=t[r]}return!0},Ce.prototype.set=function(e,t){for(var i=this.value,r=0;r<e.length-1;r++){var n=e[r];Oe.call(i,n)||(i[n]={}),i=i[n]}return i[e[r]]=t,t},Ce.prototype.map=function(e){return Me(this.value,e,!0)},Ce.prototype.forEach=function(e){return this.value=Me(this.value,e,!1),this.value},Ce.prototype.reduce=function(e,t){var i=1===arguments.length,r=i?this.value:t;return this.forEach((function(t){this.isRoot&&i||(r=e.call(this,r,t))})),r},Ce.prototype.paths=function(){var e=[];return this.forEach((function(t){e.push(this.path)})),e},Ce.prototype.nodes=function(){var e=[];return this.forEach((function(t){e.push(this.node)})),e},Ce.prototype.clone=function(){var e=[],t=[];return function i(r){for(var n=0;n<e.length;n++)if(e[n]===r)return t[n];if("object"==typeof r&&null!==r){var o=Ae(r);return e.push(r),t.push(o),ke(Le(r),(function(e){o[e]=i(r[e])})),e.pop(),t.pop(),o}return r}(this.value)};var Le=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};function Fe(e){return Object.prototype.toString.call(e)}var De=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ke=function(e,t){if(e.forEach)return e.forEach(t);for(var i=0;i<e.length;i++)t(e[i],i,e)};ke(Le(Ce.prototype),(function(e){Ie[e]=function(t){var i=[].slice.call(arguments,1),r=new Ce(t);return r[e].apply(r,i)}}));var Oe=Object.hasOwnProperty||function(e,t){return t in e},Re=Pe.exports,ze=Ne;function Ne(e){if(!(this instanceof Ne))return new Ne(e);this._bbox=e||[1/0,1/0,-1/0,-1/0],this._valid=!!e}Ne.prototype.include=function(e){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],e[0]),this._bbox[1]=Math.min(this._bbox[1],e[1]),this._bbox[2]=Math.max(this._bbox[2],e[0]),this._bbox[3]=Math.max(this._bbox[3],e[1]),this},Ne.prototype.equals=function(e){var t;return t=e instanceof Ne?e.bbox():e,this._bbox[0]==t[0]&&this._bbox[1]==t[1]&&this._bbox[2]==t[2]&&this._bbox[3]==t[3]},Ne.prototype.center=function(e){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},Ne.prototype.union=function(e){var t;return this._valid=!0,t=e instanceof Ne?e.bbox():e,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[2]),this._bbox[3]=Math.max(this._bbox[3],t[3]),this}
2,Ne.prototype.bbox=function(){return this._valid?this._bbox:null},Ne.prototype.contains=function(e){if(!e)return this._fastContains();if(!this._valid)return null;var t=e[0],i=e[1];return this._bbox[0]<=t&&this._bbox[1]<=i&&this._bbox[2]>=t&&this._bbox[3]>=i},Ne.prototype.intersect=function(e){return this._valid?(t=e instanceof Ne?e.bbox():e,!(this._bbox[0]>t[2]||this._bbox[2]<t[0]||this._bbox[3]<t[1]||this._bbox[1]>t[3])):null;var t},Ne.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var e="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",e)},Ne.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var Be=Re,Ve=ze,je={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},Ue=Object.keys(je);function Ge(e){for(var t=Ve(),i=function(e){if(!e)return[];var t=Se(Ee(e)),i=[];return t.features.forEach((function(e){e.geometry&&(i=i.concat(function(e){return function e(t){return Array.isArray(t)&&t.length&&"number"==typeof t[0]?[t]:t.reduce((function(t,i){return Array.isArray(i)&&Array.isArray(i[0])?t.concat(e(i)):(t.push(i),t)}),[])}(e)}(e.geometry.coordinates)))})),i}(e),r=0;r<i.length;r++)t.include(i[r]);return t}ve.exports=function(e){return Ge(e).bbox()},ve.exports.polygon=function(e){return Ge(e).polygon()},ve.exports.bboxify=function(e){return Be(e).map((function(e){e&&Ue.some((function(t){return!!e[t]&&-1!==je[t].indexOf(e.type)}))&&(e.bbox=Ge(e).bbox(),this.update(e))}))};var $e=t(ve.exports),qe=-90;function Ze(e,t){var i=qe,r=90,n=qe,o=90,s=270,a=-270;e.forEach((function(e){var t=$e(e),l=t[1],c=t[3],u=t[0],h=t[2];l>i&&(i=l),c<r&&(r=c),c>n&&(n=c),l<o&&(o=l),u<s&&(s=u),h>a&&(a=h)}));var l=t;return i+l.lat>85&&(l.lat=85-i),n+l.lat>90&&(l.lat=90-n),r+l.lat<-85&&(l.lat=-85-r),o+l.lat<qe&&(l.lat=qe-o),s+l.lng<=-270&&(l.lng+=360*Math.ceil(Math.abs(l.lng)/360)),a+l.lng>=270&&(l.lng-=360*Math.ceil(Math.abs(l.lng)/360)),l}function We(e,t){var i=Ze(e.map((function(e){return e.toGeoJSON()})),t);e.forEach((function(e){var t,r=e.getCoordinates(),n=function(e){var t={lng:e[0]+i.lng,lat:e[1]+i.lat};return[t.lng,t.lat]},o=function(e){return e.map((function(e){return n(e)}))};e.type===d.POINT?t=n(r):e.type===d.LINE_STRING||e.type===d.MULTI_POINT?t=r.map(n):e.type===d.POLYGON||e.type===d.MULTI_LINE_STRING?t=r.map(o):e.type===d.MULTI_POLYGON&&(t=r.map((function(e){return e.map((function(e){return o(e)}))}))),e.incomingCoords(t)}))}var He={onSetup:function(e){var t=this,i={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(i.initiallySelectedFeatureIds.filter((function(e){return void 0!==t.getFeature(e)}))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),i},fireUpdate:function(){this.map.fire(f.UPDATE,{action:m.MOVE,features:this.getSelected().map((function(e){return e.toGeoJSON()}))})},fireActionable:function(){var e=this,t=this.getSelected(),i=t.filter((function(t){return e.isInstanceOf("MultiFeature",t)})),r=!1;if(t.length>1){r=!0;var n=t[0].type.replace("Multi","");t.forEach((function(e){e.type.replace("Multi","")!==n&&(r=!1)}))}var o=i.length>0,s=t.length>0;this.setActionableState({combineFeatures:r,uncombineFeatures:o,trash:s})},getUniqueIds:function(e){return e.length?e.map((function(e){return e.properties.id})).filter((function(e){return void 0!==e})).reduce((function(e,t){return e.add(t),e}),new E).values():[]},stopExtendedInteractions:function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1},onStop:function(){_e.enable(this)},onMouseMove:function(e,t){return oe(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0},onMouseOut:function(e){return!e.dragMoving||this.fireUpdate()}};He.onTap=He.onClick=function(e,t){return ne(t)?this.clickAnywhere(e,t):ee(g.VERTEX)(t)?this.clickOnVertex(e,t):oe(t)?this.clickOnFeature(e,t):void 0},He.clickAnywhere=function(e){var t=this,i=this.getSelectedIds();
2i.length&&(this.clearSelectedFeatures(),i.forEach((function(e){return t.doRender(e)}))),_e.enable(this),this.stopExtendedInteractions(e)},He.clickOnVertex=function(e,t){this.changeMode(p.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:u.MOVE})},He.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},He.clickOnFeature=function(e,t){var i=this;_e.disable(this),this.stopExtendedInteractions(e);var r=ae(t),n=this.getSelectedIds(),o=t.featureTarget.properties.id,s=this.isSelected(o);if(!r&&s&&this.getFeature(o).type!==d.POINT)return this.changeMode(p.DIRECT_SELECT,{featureId:o});s&&r?(this.deselect(o),this.updateUIClasses({mouse:u.POINTER}),1===n.length&&_e.enable(this)):!s&&r?(this.select(o),this.updateUIClasses({mouse:u.MOVE})):s||r||(n.forEach((function(e){return i.doRender(e)})),this.setSelected(o),this.updateUIClasses({mouse:u.MOVE})),this.doRender(o)},He.onMouseDown=function(e,t){return ie(t)?this.startOnActiveFeature
2(e,t):this.drawConfig.boxSelect&&te(t)?this.startBoxSelect(e,t):void 0},He.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=fe(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0},He.onTouchStart=function(e,t){if(ie(t))return this.startOnActiveFeature(e,t)},He.onDrag=function(e,t){return e.canDragMove?this.dragMove(e,t):this.drawConfig.boxSelect&&e.canBoxSelect?this.whileBoxSelect(e,t):void 0},He.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:u.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(l.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));var i=fe(t.originalEvent,this.map.getContainer()),r=Math.min(e.boxSelectStartLocation.x,i.x),n=Math.max(e.boxSelectStartLocation.x,i.x),o=Math.min(e.boxSelectStartLocation.y,i.y),s=Math.max(e.boxSelectStartLocation.y,i.y),a="translate("+r+"px, "+o+"px)";e.boxSelectElement.style.transform=a,e.boxSelectElement.style.WebkitTransform=a,e.boxSelectElement.style.width=n-r+"px",e.boxSelectElement.style.height=s-o+"px"},He.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();var i={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};We(this.getSelected(),i),e.dragMoveLocation=t.lngLat},He.onTouchEnd=He.onMouseUp=function(e,t){var i=this;if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){var r=[e.boxSelectStartLocation,fe(t.originalEvent,this.map.getContainer())],n=this.featuresAt(null,r,"click"),o=this.getUniqueIds(n).filter((function(e){return!i.isSelected(e)}));o.length&&(this.select(o),o.forEach((function(e){return i.doRender(e)})),this.updateUIClasses({mouse:u.MOVE}))}this.stopExtendedInteractions(e)},He.toDisplayFeatures=function(e,t,i){t.properties.active=this.isSelected(t.properties.id)?y.ACTIVE:y.INACTIVE,i(t),this.fireActionable(),t.properties.active===y.ACTIVE&&t.geometry.type!==d.POINT&&ye(t).forEach(i)},He.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},He.onCombineFeatures=function(){var e=this.getSelected();if(!(0===e.length||e.length<2)){for(var t=[],i=[],r=e[0].type.replace("Multi",""),n=0;n<e.length;n++){var o=e[n];if(o.type.replace("Multi","")!==r)return;
2o.type.includes("Multi")?o.getCoordinates().forEach((function(e){t.push(e)})):t.push(o.getCoordinates()),i.push(o.toGeoJSON())}if(i.length>1){var s=this.newFeature({type:d.FEATURE,properties:i[0].properties,geometry:{type:"Multi"+r,coordinates:t}});this.addFeature(s),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([s.id]),this.map.fire(f.COMBINE_FEATURES,{createdFeatures:[s.toGeoJSON()],deletedFeatures:i})}this.fireActionable()}},He.onUncombineFeatures=function(){var e=this,t=this.getSelected();if(0!==t.length){for(var i=[],r=[],n=function(n){var o=t[n];e.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach((function(t){e.addFeature(t),t.properties=o.properties,i.push(t.toGeoJSON()),e.select([t.id])})),e.deleteFeature(o.id,{silent:!0}),r.push(o.toGeoJSON()))},o=0;o<t.length;o++)n(o);i.length>1&&this.map.fire(f.UNCOMBINE_FEATURES,{createdFeatures:i,deletedFeatures:r}),this.fireActionable()}};var Xe=ee(g.VERTEX),Ye=ee(g.MIDPOINT),Je={fireUpdate:function(){this.map.fire(f.UPDATE,{action:m.CHANGE_COORDINATES,features:this.getSelected().map((function(e){return e.toGeoJSON()}))})},fireActionable:function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})},startDragging:function(e,t){this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat},stopDragging:function(e){this.map.dragPan.enable(),e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null},onVertex:function(e,t){this.startDragging(e,t);var i=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(i.coord_path);ae(t)||-1!==r?ae(t)&&-1===r&&e.selectedCoordPaths.push(i.coord_path):e.selectedCoordPaths=[i.coord_path];var n=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(n)},onMidpoint:function(e,t){this.startDragging(e,t);var i=t.featureTarget.properties;e.feature.addCoordinate(i.coord_path,i.lng,i.lat),this.fireUpdate(),e.selectedCoordPaths=[i.coord_path]},pathsToCoordinates:function(e,t){return t.map((function(t){return{feature_id:e,coord_path:t}}))},onFeature:function(e,t){0===e.selectedCoordPaths.length?this.startDragging(e,t):this.stopDragging(e)},dragFeature:function(e,t,i){We(this.getSelected(),i),e.dragMoveLocation=t.lngLat},dragVertex:function(e,t,i){for(var r=e.selectedCoordPaths.map((function(t){return e.feature.getCoordinate(t)})),n=Ze(r.map((function(e){return{type:d.FEATURE,properties:{},geometry:{type:d.POINT,coordinates:e}}})),i),o=0;o<r.length;o++){var s=r[o];e.feature.updateCoordinate(e.selectedCoordPaths[o],s[0]+n.lng,s[1]+n.lat)}},clickNoTarget:function(){this.changeMode(p.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(p.SIMPLE_SELECT)},clickActiveFeature:function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()},onSetup:function(e){var t=e.featureId,i=this.getFeature(t);if(!i)throw new Error("You must provide a featureId to enter direct_select mode");if(i.type===d.POINT)throw new TypeError("direct_select mode doesn't handle point features");var r={featureId:t,feature:i,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),_e.disable(this),this.setActionableState({trash:!0}),r},onStop:function(){_e.enable(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(e,t,i){e.featureId===t.properties.id?(t.properties.active=y.ACTIVE,i(t),ye(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(i)):(t.properties.active=y.INACTIVE,i(t)),this.fireActionable(e)},onTrash:function(e){e.selectedCoordPaths.sort((function(e,t){return t.localeCompare(e,"en",{numeric:!0})})).forEach((function(t){return e.feature.removeCoordinate(t)})),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),!1===e.feature.isValid()&&(this.deleteFeature([e.featureId]),this.changeMode(p.SIMPLE_SELECT,{}))},onMouseMove:function(e,t){var i=ie(t),r=Xe(t),n=Ye(t),o=0===e.selectedCoordPaths.length;return i&&o||r&&!o?this.updateUIClasses({mouse:u.MOVE}):this.updateUIClasses({mouse:u.NONE}),(r||i||n)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0},onMouseOut:function(e){return e.dragMoving&&this.fireUpdate(),!0}};Je.onTouchStart=Je.onMouseDown=function(e,t){return Xe(t)?this.onVertex(e,t):ie(t)?this.onFeature(e,t):Ye(t)?this.onMidpoint(e,t):void 0},Je.onDrag=function(e,t){if(!0===e.canDragMove){e.dragMoving=!0,t.originalEvent.stopPropagation();var i={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>
20?this.dragVertex(e,t,i):this.dragFeature(e,t,i),e.dragMoveLocation=t.lngLat}},Je.onClick=function(e,t){return ne(t)?this.clickNoTarget(e,t):ie(t)?this.clickActiveFeature(e,t):re(t)?this.clickInactive(e,t):void this.stopDragging(e)},Je.onTap=function(e,t){return ne(t)?this.clickNoTarget(e,t):ie(t)?this.clickActiveFeature(e,t):re(t)?this.clickInactive(e,t):void 0},Je.onTouchEnd=Je.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};var Ke={};function Qe(e,t){return!!e.lngLat&&e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]}Ke.onSetup=function(){var e=this.newFeature({type:d.FEATURE,properties:{},geometry:{type:d.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:u.ADD}),this.activateUIButton(h.POINT),this.setActionableState({trash:!0}),{point:e}},Ke.stopDrawingAndRemove=function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)},Ke.onTap=Ke.onClick=function(e,t){this.updateUIClasses({mouse:u.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.map.fire(f.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.point.id]})},Ke.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})},Ke.toDisplayFeatures=function(e,t,i){var r=t.properties.id===e.point.id;if(t.properties.active=r?y.ACTIVE:y.INACTIVE,!r)return i(t)},Ke.onTrash=Ke.stopDrawingAndRemove,Ke.onKeyUp=function(e,t){if(le(t)||ce(t))return this.stopDrawingAndRemove(e,t)};var et={onSetup:function(){var e=this.newFeature({type:d.FEATURE,properties:{},geometry:{type:d.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),_e.disable(this),this.updateUIClasses({mouse:u.ADD}),this.activateUIButton(h.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&Qe(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:u.ADD}),e.polygon.updateCoordinate("0."+e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate("0."+e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},onMouseMove:function(e,t){e.polygon.updateCoordinate("0."+e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),se(t)&&this.updateUIClasses({mouse:u.POINTER})}};et.onTap=et.onClick=function(e,t){return se(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)},et.onKeyUp=function(e,t){le(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)):ce(t)&&this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.polygon.id]})},et.onStop=function(e){this.updateUIClasses({mouse:u.NONE}),_e.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.polygon.id)&&(e.polygon.removeCoordinate("0."+e.currentVertexPosition),e.polygon.isValid()?this.map.fire(f.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT,{},{silent:!0})))},et.toDisplayFeatures=function(e,t,i){var r=t.properties.id===e.polygon.id;if(t.properties.active=r?y.ACTIVE:y.INACTIVE,!r)return i(t);if(0!==t.geometry.coordinates.length){var n=t.geometry.coordinates[0].length;if(!(n<3)){if(t.properties.meta=g.FEATURE,i(me(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),n>3){var o=t.geometry.coordinates[0].length-3;i(me(e.polygon.id,t.geometry.coordinates[0][o],"0."+o,!1))}if(n<=4){var s=[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]];if(i({type:d.FEATURE,properties:t.properties,geometry:{coordinates:s,type:d.LINE_STRING}}),3===n)return}return i(t)}}},et.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)};var tt={onSetup:function(e){var t,i,r=(e=e||{}).featureId,n="forward";if(r){if(!(t=this.getFeature(r)))throw new Error("Could not find a feature with the provided featureId");var o=e.from;if(o&&"Feature"===o.type&&o.geometry&&"Point"===o.geometry.type&&(o=o.geometry),o&&"Point"===o.type&&o.coordinates&&2===o.coordinates.length&&(o=o.c
2oordinates),!o||!Array.isArray(o))throw new Error("Please use the `from` property to indicate which point to continue the line from");var s=t.coordinates.length-1;if(t.coordinates[s][0]===o[0]&&t.coordinates[s][1]===o[1])i=s+1,t.addCoordinate.apply(t,[i].concat(t.coordinates[s]));else{if(t.coordinates[0][0]!==o[0]||t.coordinates[0][1]!==o[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");n="backwards",i=0,t.addCoordinate.apply(t,[i].concat(t.coordinates[0]))}}else t=this.newFeature({type:d.FEATURE,properties:{},geometry:{type:d.LINE_STRING,coordinates:[]}}),i=0,this.addFeature(t);return this.clearSelectedFeatures(),_e.disable(this),this.updateUIClasses({mouse:u.ADD}),this.activateUIButton(h.LINE),this.setActionableState({trash:!0}),{line:t,currentVertexPosition:i,direction:n}},clickAnywhere:function(e,t){if(e.currentVertexPosition>0&&Qe(t,e.line.coordinates[e.currentVertexPosition-1])||"backwards"===e.direction&&Qe(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:u.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),"forward"===e.direction?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)},clickOnVertex:function(e){return this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.line.id]})},onMouseMove:function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),se(t)&&this.updateUIClasses({mouse:u.POINTER})}};tt.onTap=tt.onClick=function(e,t){if(se(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)},tt.onKeyUp=function(e,t){ce(t)?this.changeMode(p.SIMPLE_SELECT,{featureIds:[e.line.id]}):le(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT))},tt.onStop=function(e){_e.enable(this),this.activateUIButton(),void 0!==this.getFeature(e.line.id)&&(e.line.removeCoordinate(""+e.currentVertexPosition),e.line.isValid()?this.map.fire(f.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT,{},{silent:!0})))},tt.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(p.SIMPLE_SELECT)},tt.toDisplayFeatures=function(e,t,i){var r=t.properties.id===e.line.id;if(t.properties.active=r?y.ACTIVE:y.INACTIVE,!r)return i(t);t.geometry.coordinates.length<2||(t.properties.meta=g.FEATURE,i(me(e.line.id,t.geometry.coordinates["forward"===e.direction?t.geometry.coordinates.length-2:1],""+("forward"===e.direction?t.geometry.coordinates.length-2:1),!1)),i(t))};var it={simple_select:He,direct_select:Je,draw_point:Ke,draw_polygon:et,draw_line_string:tt},rt={defaultMode:p.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:Q,modes:it,controls:{},userProperties:!1},nt={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},ot={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function st(e,t){return e.map((function(e){return e.source?e:Y(e,{id:e.id+"."+t,source:"hot"===t?c.HOT:c.COLD})}))}var at={exports:{}};!function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",s="[object Array]",a="[object Boolean]",l="[object Date]",c="[object Error]",u="[object Function]",h="[object Map]",d="[object Number]",p="[object Object]",f="[object Promise]",m="[object RegExp]",g="[object Set]",y="[object String]",_="[object WeakMap]",v="[object ArrayBuffer]",b="[object DataView]",x=/^\[object .+?Constructor\]$/,w=/^(?:0|[1-9]\d*)$/,T={};T["[object Float32Array]"]=T["[object Float64Array]"]=T["[object Int8Array]"]=T["[object Int16Array]"]=T["[object Int32Array]"]=T["[object Uint8Array]"]=T["[object Uint8ClampedArray]"]=T["[object Uint16Array]"]=T["[object Uint32Array]"]=!0,T[o]=T[s]=T[v]=T[a]=T[b]=T[l]=T[c]=T[u]=T[h]=T[d]=T[p]=T[m]=T[g]=T[y]=T[_]=!1;var E="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g,S="object"==typeof self&&self&&self.Object===Object&&self,P=E||S||Function("return this")(),I=t&&!t.nodeType&&t,C=I&&e&&!e.nodeType&&e,M=C&&C.exports===I,A=
vendor: 2,902 bytes, line 2
2M&&E.process,L=function(){try{return A&&A.binding&&A.binding("util")}catch(e){}}(),F=L&&L.isTypedArray;function D(e,t){for(var i=-1,r=null==e?0:e.length;++i<r;)if(t(e[i],i,e))return!0;return!1}function k(e){var t=-1,i=Array(e.size);return e.forEach((function(e,r){i[++t]=[r,e]})),i}function O(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var R,z,N,B=Array.prototype,V=Function.prototype,j=Object.prototype,U=P["__core-js_shared__"],G=V.toString,$=j.hasOwnProperty,q=(R=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||""))?"Symbol(src)_1."+R:"",Z=j.toString,W=RegExp("^"+G.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),H=M?P.Buffer:void 0,X=P.Symbol,Y=P.Uint8Array,J=j.propertyIsEnumerable,K=B.splice,Q=X?X.toStringTag:void 0,ee=Object.getOwnPropertySymbols,te=H?H.isBuffer:void 0,ie=(z=Object.keys,N=Object,function(e){return z(N(e))}),re=Ce(P,"DataView"),ne=Ce(P,"Map"),oe=Ce(P,"Promise"),se=Ce(P,"Set"),ae=Ce(P,"WeakMap"),le=Ce(Object,"create"),ce=Fe(re),ue=Fe(ne),he=Fe(oe),de=Fe(se),pe=Fe(ae),fe=X?X.prototype:void 0,me=fe?fe.valueOf:void 0;function ge(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function ye(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function _e(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function ve(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new _e;++t<i;)this.add(e[t])}function be(e){var t=this.__data__=new ye(e);this.size=t.size}function xe(e,t){for(var i=e.length;i--;)if(De(e[i][0],t))return i;return-1}function we(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Q&&Q in Object(e)?function(e){var t=$.call(e,Q),i=e[Q];try{e[Q]=void 0;var r=!0}catch(e){}var n=Z.call(e);return r&&(t?e[Q]=i:delete e[Q]),n}(e):function(e){return Z.call(e)}(e)}function Te(e){return Ve(e)&&we(e)==o}function Ee(e,t,i,r,n){return e===t||(null==e||null==t||!Ve(e)&&!Ve(t)?e!=e&&t!=t:function(e,t,i,r,n,u){var f=Oe(e),_=Oe(t),x=f?s:Ae(e),w=_?s:Ae(t),T=(x=x==o?p:x)==p,E=(w=w==o?p:w)==p,S=x==w;if(S&&Re(e)){if(!Re(t))return!1;f=!0,T=!1}if(S&&!T)return u||(u=new be),f||je(e)?Se(e,t,i,r,n,u):function(e,t,i,r,n,o,s){switch(i){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case v:return!(e.byteLength!=t.byteLength||!o(new Y(e),new Y(t)));case a:case l:case d:return De(+e,+t);case c:return e.name==t.name&&e.message==t.message;case m:case y:return e==t+"";case h:var u=k;case g:var p=1&r;if(u||(u=O),e.size!=t.size&&!p)return!1;var f=s.get(e);if(f)return f==t;r|=2,s.set(e,t);var _=Se(u(e),u(t),r,n,o,s);return s.delete(e),_;case"[object Symbol]":if(me)return me.call(e)==me.call(t)}return!1}(e,t,x,i,r,n,u);if(!(1&i)){var P=T&&$.call(e,"__wrapped__"),I=E&&$.call(t,"__wrapped__");
vendor: 5,547 bytes, line 2
2if(P||I){var C=P?e.value():e,M=I?t.value():t;return u||(u=new be),n(C,M,i,r,u)}}return!!S&&(u||(u=new be),function(e,t,i,r,n,o){var s=1&i,a=Pe(e),l=a.length;if(l!=Pe(t).length&&!s)return!1;for(var c=l;c--;){var u=a[c];if(!(s?u in t:$.call(t,u)))return!1}var h=o.get(e);if(h&&o.get(t))return h==t;var d=!0;o.set(e,t),o.set(t,e);for(var p=s;++c<l;){var f=e[u=a[c]],m=t[u];if(r)var g=s?r(m,f,u,t,e,o):r(f,m,u,e,t,o);if(!(void 0===g?f===m||n(f,m,i,r,o):g)){d=!1;break}p||(p="constructor"==u)}if(d&&!p){var y=e.constructor,_=t.constructor;y==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof _&&_ instanceof _||(d=!1)}return o.delete(e),o.delete(t),d}(e,t,i,r,n,u))}(e,t,i,r,Ee,n))}function Se(e,t,i,r,n,o){var s=1&i,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e);if(c&&o.get(t))return c==t;var u=-1,h=!0,d=2&i?new ve:void 0;for(o.set(e,t),o.set(t,e);++u<a;){var p=e[u],f=t[u];if(r)var m=s?r(f,p,u,t,e,o):r(p,f,u,e,t,o);if(void 0!==m){if(m)continue;h=!1;break}if(d){if(!D(t,(function(e,t){if(s=t,!d.has(s)&&(p===e||n(p,e,i,r,o)))return d.push(t);var s}))){h=!1;break}}else if(p!==f&&!n(p,f,i,r,o)){h=!1;break}}return o.delete(e),o.delete(t),h}function Pe(e){return function(e,t,i){var r=t(e);return Oe(e)?r:function(e,t){for(var i=-1,r=t.length,n=e.length;++i<r;)e[n+i]=t[i];return e}(r,i(e))}(e,Ue,Me)}function Ie(e,t){var i,r,n=e.__data__;return("string"==(r=typeof(i=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==i:null===i)?n["string"==typeof t?"string":"hash"]:n.map}function Ce(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!Be(e)||function(e){return!!q&&q in e}(e))&&(ze(e)?W:x).test(Fe(e))}(i)?i:void 0}ge.prototype.clear=function(){this.__data__=le?le(null):{},this.size=0},ge.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ge.prototype.get=function(e){var t=this.__data__;if(le){var i=t[e];return i===r?void 0:i}return $.call(t,e)?t[e]:void 0},ge.prototype.has=function(e){var t=this.__data__;return le?void 0!==t[e]:$.call(t,e)},ge.prototype.set=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=le&&void 0===t?r:t,this},ye.prototype.clear=function(){this.__data__=[],this.size=0},ye.prototype.delete=function(e){var t=this.__data__,i=xe(t,e);return!(i<0||(i==t.length-1?t.pop():K.call(t,i,1),--this.size,0))},ye.prototype.get=function(e){var t=this.__data__,i=xe(t,e);return i<0?void 0:t[i][1]},ye.prototype.has=function(e){return xe(this.__data__,e)>-1},ye.prototype.set=function(e,t){var i=this.__data__,r=xe(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this},_e.prototype.clear=function(){this.size=0,this.__data__={hash:new ge,map:new(ne||ye),string:new ge}},_e.prototype.delete=function(e){var t=Ie(this,e).delete(e);return this.size-=t?1:0,t},_e.prototype.get=function(e){return Ie(this,e).get(e)},_e.prototype.has=function(e){return Ie(this,e).has(e)},_e.prototype.set=function(e,t){var i=Ie(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this},ve.prototype.add=ve.prototype.push=function(e){return this.__data__.set(e,r),this},ve.prototype.has=function(e){return this.__data__.has(e)},be.prototype.clear=function(){this.__data__=new ye,this.size=0},be.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},be.prototype.get=function(e){return this.__data__.get(e)},be.prototype.has=function(e){return this.__data__.has(e)},be.prototype.set=function(e,t){var i=this.__data__;if(i instanceof ye){var r=i.__data__;if(!ne||r.length<199)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new _e(r)}return i.set(e,t),this.size=i.size,this};var Me=ee?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var i=-1,r=null==e?0:e.length,n=0,o=[];++i<r;){var s=e[i];t(s)&&(o[n++]=s)}return o}(ee(e),(function(t){return J.call(e,t)})))}:function(){return[]},Ae=we;function Le(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||w.test(e))&&e>-1&&e%1==0&&e<t}function Fe(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function De(e,t){return e===t||e!=e&&t!=t}(re&&Ae(new re(new ArrayBuffer(1)))!=b||ne&&Ae(new ne)!=h||oe&&Ae(oe.resolve())!=f||se&&Ae(new se)!=g||ae&&Ae(new ae)!=_)&&(Ae=function(e){var t=we(e),i=t==p?e.constructor:void 0,r=i?Fe(i):"";if(r)switch(r){case ce:return b;case ue:return h;case he:return f;case de:return g;case pe:return _}return t});var ke=Te(function(){return arguments}())?Te:function(e){return Ve(e)&&$.call(e,"callee")&&!J.call(e,"callee")},Oe=Array.isArray,Re=te||function(){return!1};function ze(e){if(!Be(e))return!1;var t=we(e);return t==u||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ne(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}function Be(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ve(e){return null!=e&&"object"==typeof e}var je=F?function(e){return function(t){return e(t)}}(F):function(e){return Ve(e)&&Ne(e.length)&&!!T[we(e)]};function Ue(e){return null!=(t=e)&&Ne(t.length)&&!ze(t)?function(e){var t=Oe(e),i=!t&&ke(e),r=!t&&!i&&Re(e),n=!t&&!i&&!r&&je(e),o=t||i||r||n,s=o?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],a=s.length;for(var l in e)!$.call(e,l)||o&&("length"==l||r&&("offset"==l||"parent"==l)||n&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Le(l,a))||s.push(l);return s}(e):function(e){if(i=(t=e)&&t.constructor,t!==("function"==typeof i&&i.prototype||j)
2)return ie(e);var t,i,r=[];for(var n in Object(e))$.call(e,n)&&"constructor"!=n&&r.push(n);return r}(e);var t}e.exports=function(e,t){return Ee(e,t)}}(at,at.exports);var lt=t(at.exports);function ct(e,t){return e.length===t.length&&JSON.stringify(e.map((function(e){return e})).sort())===JSON.stringify(t.map((function(e){return e})).sort())}var ut={Polygon:N,LineString:z,Point:R,MultiPolygon:j,MultiLineString:j,MultiPoint:j},ht=Object.freeze({__proto__:null,CommonSelectors:ue,constrainFeatureMovement:Ze,createMidPoint:ge,createSupplementaryPoints:ye,createVertex:me,doubleClickZoom:_e,euclideanDistance:M,featuresAt:P,getFeatureAtAndSetCursors:C,isClick:A,isEventAtCoordinates:Qe,isTap:L,mapEventToBoundingBox:T,ModeHandler:e,moveFeatures:We,sortFeatures:w,stringSetsAreEqual:ct,StringSet:E,theme:Q,toDenseArray:q});function dt(e){!function(e,t){var i={options:e=function(e){void 0===e&&(e={});var t=Y(e);return e.controls||(t.controls={}),!1===e.displayControlsDefault?t.controls=Y(ot,e.controls):t.controls=Y(nt,e.controls),(t=Y(rt,t)).styles=st(t.styles,"cold").concat(st(t.styles,"hot")),t}(e)};t=function(e,t){return t.modes=p,t.getFeatureIdsAt=function(t){return P.click({point:t},null,e).map((function(e){return e.properties.id}))},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:d.FEATURE_COLLECTION,features:e.store.getSelectedIds().map((function(t){return e.store.get(t)})).map((function(e){return e.toGeoJSON()}))}},t.getSelectedPoints=function(){return{type:d.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map((function(e){return{type:d.FEATURE,properties:{},geometry:{type:d.POINT,coordinates:e.coordinates}}}))}},t.set=function(i){if(void 0===i.type||i.type!==d.FEATURE_COLLECTION||!Array.isArray(i.features))throw new Error("Invalid FeatureCollection");var r=e.store.createRenderBatch(),n=e.store.getAllIds().slice(),o=t.add(i),s=new E(o);return(n=n.filter((function(e){return!s.has(e)}))).length&&t.delete(n),r(),o},t.add=function(t){var i=JSON.parse(JSON.stringify(we(t))).features.map((function(t){if(t.id=t.id||k(),null===t.geometry)throw new Error("Invalid geometry: null");if(void 0===e.store.get(t.id)||e.store.get(t.id).type!==t.geometry.type){var i=ut[t.geometry.type];if(void 0===i)throw new Error("Invalid geometry type: "+t.geometry.type+".");var r=new i(e,t);e.store.add(r)}else{var n=e.store.get(t.id);n.properties=t.properties,lt(n.getCoordinates(),t.geometry.coordinates)||n.incomingCoords(t.geometry.coordinates)}return t.id}));return e.store.render(),i},t.get=function(t){var i=e.store.get(t);if(i)return i.toGeoJSON()},t.getAll=function(){return{type:d.FEATURE_COLLECTION,features:e.store.getAll().map((function(e){return e.toGeoJSON()}))}},t.delete=function(i){return e.store.delete(i,{silent:!0}),t.getMode()!==p.DIRECT_SELECT||e.store.getSelectedIds().length?e.store.render():e.events.changeMode(p.SIMPLE_SELECT,void 0,{silent:!0}),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:!0}),t.getMode()===p.DIRECT_SELECT?e.events.changeMode(p.SIMPLE_SELECT,void 0,{silent:!0}):e.store.render(),t},t.changeMode=function(i,r){return void 0===r&&(r={}),i===p.SIMPLE_SELECT&&t.getMode()===p.SIMPLE_SELECT?(ct(r.featureIds||[],e.store.getSelectedIds())||
2(e.store.setSelected(r.featureIds,{silent:!0}),e.store.render()),t):(i===p.DIRECT_SELECT&&t.getMode()===p.DIRECT_SELECT&&r.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(i,r,{silent:!0}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:!0}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:!0}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:!0}),t},t.setFeatureProperty=function(i,r,n){return e.store.setFeatureProperty(i,r,n),t},t}(i,t),i.api=t;var r=K(i);t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=h,t.options=e}(e,this)}return dt.modes=it,dt.constants=v,dt.lib=ht,dt}()}},Rt={};function zt(e){var t=Rt[e];if(void 0!==t)return t.exports;var i=Rt[e]={exports:{}};return Ot[e].call(i.exports,i,i.exports,zt),i.exports}zt.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return zt.d(t,{a:t}),t},zt.d=(e,t)=>{for(var i in t)zt.o(t,i)&&!zt.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},zt.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),zt.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),zt.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var Nt={};zt.d(Nt,{AV:()=>ln,WK:()=>jr,wU:()=>mn,K9:()=>Mr,aV:()=>Qr,Aq:()=>Bt});var Bt={};zt.r(Bt),zt.d(Bt,{IDS:()=>hr,addPointToVertices:()=>dr,createSnapList:()=>pr,getGuideFeature:()=>yr,shouldHideGuide:()=>_r,snap:()=>gr});var Vt=zt(188),jt=zt.n(Vt),Ut=6371008.8,Gt={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*Ut,kilometers:6371.0088,kilometres:6371.0088,meters:Ut,metres:Ut,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:Ut/1852,radians:1,yards:6967335.223679999};function $t(e,t,i={}){const r={type:"Feature"};return(0===i.id||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=t||{},r.geometry=e,r}function qt(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Yt(e[0])||!Yt(e[1]))throw new Error("coordinates must contain numbers");return $t({type:"Point",coordinates:e},t,i)}function Zt(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return $t({type:"LineString",coordinates:e},t,i)}function Wt(e,t={}){const i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function Ht(e){return e%(2*Math.PI)*180/Math.PI}function Xt(e){return e%360*Math.PI/180}function Yt(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}var Jt=function(e,t={}){const i=Number(e[0]),r=Number(e[1]),n=Number(e[2]),o=Number(e[3]);if(6===e.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");const s=[i,r];return function(e,t,i={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return $t({type:"Polygon",coordinates:e},t,i)}([[s,[n,r],[n,o],[i,o],s]],t.properties,{bbox:e,id:t.id})};const Kt=11102230246251565e-32,Qt=134217729,ei=(3+8*Kt)*Kt;function ti(e,t,i,r,n){let o,s,a,l,c=t[0],u=r[0],h=0,d=0;u>c==u>-c?(o=c,c=t[++h]):(o=u,u=r[++d]);let p=0;if(h<e&&d<i)for(u>c==u>-c?(s=c+o,a=o-(s-c),c=t[++h]):(s=u+o,a=o-(s-u),u=r[++d]),o=s,0!==a&&(n[p++]=a);h<e&&d<i;)u>c==u>-c?(s=o+c,l=s-o,a=o-(s-l)+(c-l),c=t[++h]):(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=r[++d]),o=s,0!==a&&(n[p++]=a);for(;h<e;)s=o+c,l=s-o,a=o-(s-l)+(c-l),c=t[++h],o=s,0!==a&&(n[p++]=a);for(;d<i;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=r[++d],o=s,0!==a&&(n[p++]=a);return 0===o&&0!==p||(n[p++]=o),p}function ii(e){return new Float64Array(e)}const ri=ii(4),ni=ii(8),oi=ii(12),si=ii(16),ai=ii(4);function li(e,t,i,r,n,o){const s=(t-o)*(i-n),a=(e-n)*(r-o),l=s-a,c=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*c?l:-function(e,t,i,r,n,o,s){let a,l,c,u,h,d,p,f,m,g,y,_,v,b,x,w,T,E;const S=e-n,P=i-n,I=t-o,C=r-o;b=S*C,d=Qt*S,p=d-(d-S),f=S-p,d=Qt*C,m=d-(d-C),g=C-m,x=f*g-(b-p*m-f*m-p*g),w=I*P,d=Qt*I,p=d-(d-I),f=I-p,d=Qt*P,m=d-(d-P),g=P-m,T=f*g-(w-p*m-f*m-p*g),y=x-T,h=x-y,ri[0]=x-(y+h)+(h-T),_=b+y,h=_-b,v=b-(_-h)+(y-h),y=v-w,h=v-y,ri[1]=v-(y+h)+(h-w),E=_+y,h=E-_,ri[2]=_-(E-h)+(y-h),ri[3]=E;let M=function(e,t){let i=t[0];for(let e=1;e<4;e++)i+=t[e];return i}(0,ri),A=22204460492503146e-32*s;if(M>=A||-M>=A)return M;if(h=e-S,a=e-(S+h)+(h-n),h=i-P,c=i-(P+h)+(h-n),h=t-I,l=t-(I+h)+(h-o),h=r-C,u=r-(C+h)+(h-o),0===a&&0===l&&0===c&&0===u)return M;if(A=11093356479670487e-47*s+ei*Math.abs(M),M+=S*u+C*a-(I*c+P*l),M>=A||-M>=A)return M;b=a*C,d=Qt*a,p=d-(d-a),f=a-p,d=Qt*C,m=d-(d-C),g=C-m,x=f*g-(b-p*m-f*m-p*g),w=l*P,d=Qt*l,p=d-(d-l),f=l-p,d=Qt*P,m=d-(d-P),g=P-m,T=f*g-(w-p*m-f*m-p*g),y=x-T,h=x-y,ai[0]=x-(y+h)+(h-T),_=b+y,h=_-b,v=b-(_-h)+(y-h),y=v-w,h=v-y,ai[1]=v-(y+h)+(h-w),E=_+y,h=E-_,ai[2]=_-(E-h)+(y-h),ai[3]=E;const L=ti(4,ri,4,ai,ni);b=S*u,d=Qt*S,p=d-(d-S),f=S-p,d=Qt*u,m=d-(d-u),g=u-m,x=f*g-(b-p*m-f*m-p*g),w=I*c,d=Qt*I,p=d-(d-I),f=I-p,d=Qt*c,m=d-(d-c),g=c-m,T=f*g-(w-p*m-f*m-p*g),y=x-T,h=x-y,ai[0]=x-(y+h)+(h-T),_=b+y,h=_-b,v=b-(_-h)+(y-h),y=v-w,h=v-y,ai[1]=v-(y+h)+(h-w),E=_+y,h=E-_,ai[2]=_-(E-h)+(y-h),ai[3]=E;const F=ti(L,ni,4,ai,oi);b=a*u,d=Qt*a,p=d-(d-a),f=a-p,d=Qt*u,m=d-(d-u),g=u-m,x=f*g-(b-p*m-f*m-p*g),w=l*c,d=Qt*l,p=d-(d-l),f=l-p,d=Qt*c,m=d-(d-c),g=c-m,T=f*g-(w-p*m-f*m-p*g),y=x-T,h=x-y,ai[0]=x-(y+h)+(h-T),_=b+y,h=_-b,v=b-(_-h)+(y-h),y=v-w,h=v-y,ai[1]=v-(y+h)+(h-w),E=_+y,h=E-_,ai[2]=_-(E-h)+(y-h),ai[3]=E;const D=ti(F,oi,4,ai,si);return si[D-1]}(e,t,i,r,n,o,c)}function ci(e,t){var i,r,n,o,s,a,l,c,u,h=0,d=e[0],p=e[1],f=t.length;for(i=0;i<f;i++){r=0;var m=t[i],g=m.length-1;if((c=m[0])[0]!==m[g][0]&&c[1]!==m[g][1])throw new Error("First and last coordinates in a ring must be the same");for(o=c[0]-d,s=c[1]-p;r<g;r++){if(a=(u=m[r+1])[0]-d,l=u[1]-p,0===s&&0===l){if(a<=0&&o>=0||o<=0&&a>=0)return 0}else if(l>=0&&s<0||l<0&&s>
2=0){if(0===(n=li(o,a,s,l,0,0)))return 0;(n>0&&l>0&&s<=0||n<0&&l<=0&&s>0)&&h++}c=u,s=l,o=a}}return h%2!=0}function ui(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function hi(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function di(e){return"Feature"===e.type?e.geometry:e}function pi(e,t,i={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const r=ui(e),n=di(t),o=n.type,s=t.bbox;let a=n.coordinates;if(s&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(r,s))return!1;"Polygon"===o&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){const e=ci(r,a[c]);if(0===e)return!i.ignoreBoundary;e&&(l=!0)}return l}ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(8),ii(8),ii(8),ii(4),ii(8),ii(8),ii(8),ii(12),ii(192),ii(192),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(8),ii(8),ii(8),ii(8),ii(8),ii(8),ii(8),ii(8),ii(8),ii(4),ii(4),ii(4),ii(8),ii(16),ii(16),ii(16),ii(32),ii(32),ii(48),ii(64),ii(1152),ii(1152),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(4),ii(24),ii(24),ii(24),ii(24),ii(24),ii(24),ii(24),ii(24),ii(24),ii(24),ii(1152),ii(1152),ii(1152),ii(1152),ii(1152),ii(2304),ii(2304),ii(3456),ii(5760),ii(8),ii(8),ii(8),ii(16),ii(24),ii(48),ii(48),ii(96),ii(192),ii(384),ii(384),ii(384),ii(768),ii(96),ii(96),ii(96),ii(1152);class fi{constructor(e=[],t=mi){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let r=1+(e<<1),o=t[r];const s=r+1;if(s<this.length&&i(t[s],o)<0&&(r=s,o=t[s]),i(o,n)>=0)break;t[e]=o,e=r}t[e]=n}}function mi(e,t){return e<t?-1:e>t?1:0}function gi(e,t){return e.p.x>t.p.x?1:e.p.x<t.p.x?-1:e.p.y!==t.p.y?e.p.y>t.p.y?1:-1:1}function yi(e,t){return e.rightSweepEvent.p.x>t.rightSweepEvent.p.x?1:e.rightSweepEvent.p.x<t.rightSweepEvent.p.x?-1:e.rightSweepEvent.p.y!==t.rightSweepEvent.p.y?e.rightSweepEvent.p.y<t.rightSweepEvent.p.y?1:-1:1}class _i{constructor(e,t,i,r){this.p={x:e[0],y:e[1]},this.featureId=t,this.ringId=i,this.eventId=r,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}}let vi=0,bi=0,xi=0;function wi(e,t){const i="Feature"===e.type?e.geometry:e;let r=i.coordinates;"Polygon"!==i.type&&"MultiLineString"!==i.type||(r=[r]),"LineString"===i.type&&(r=[[r]]);for(let e=0;e<r.length;e++)for(let i=0;i<r[e].length;i++){let n=r[e][i][0],o=null;bi+=1;for(let s=0;s<r[e][i].length-1;s++){o=r[e][i][s+1];const a=new _i(n,vi,bi,xi),l=new _i(o,vi,bi,xi+1);a.otherEvent=l,l.otherEvent=a,gi(a,l)>0?(l.isLeftEndpoint=!0,a.isLeftEndpoint=!1):(a.isLeftEndpoint=!0,l.isLeftEndpoint=!1),t.push(a),t.push(l),n=o,xi+=1}}vi+=1}class Ti{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}}function Ei(e,t){if(null===e||null===t)return!1;if(e.leftSweepEvent.ringId===t.leftSweepEvent.ringId&&(e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.rightSweepEvent)||e.leftSweepEvent.isSamePoint(t.leftSweepEvent)||e.leftSweepEvent.isSamePoint(t.rightSweepEvent)))return!1;const i=e.leftSweepEvent.p.x,r=e.leftSweepEvent.p.y,n=e.rightSweepEvent.p.x,o=e.rightSweepEvent.p.y,s=t.leftSweepEvent.p.x,a=t.leftSweepEvent.p.y,l=t.rightSweepEvent.p.x,c=t.rightSweepEvent.p.y,u=(c-a)*(n-i)-(l-s)*(o-r);if(0===u)return!1;const h=((l-s)*(r-a)-(c-a)*(i-s))/u,d=((n-i)*(r-a)-(o-r)*(i-s))/u;return h>=0&&h<=1&&d>=0&&d<=1&&[i+h*(n-i),r+h*(o-r)]}function Si(e,t,i={}){const{removeDuplicates:r=!0,ignoreSelfIntersections:n=!1}
2=i;let o=[];"FeatureCollection"===e.type?o=o.concat(e.features):"Feature"===e.type?o.push(e):"LineString"!==e.type&&"Polygon"!==e.type&&"MultiLineString"!==e.type&&"MultiPolygon"!==e.type||o.push($t(e)),"FeatureCollection"===t.type?o=o.concat(t.features):"Feature"===t.type?o.push(t):"LineString"!==t.type&&"Polygon"!==t.type&&"MultiLineString"!==t.type&&"MultiPolygon"!==t.type||o.push($t(t));const s=function(e,t){const i=new fi([],gi);return function(e,t){if("FeatureCollection"===e.type){const i=e.features;for(let e=0;e<i.length;e++)wi(i[e],t)}else wi(e,t)}(e,i),function(e,t){t=t||!1;const i=[],r=new fi([],yi);for(;e.length;){const n=e.pop();if(n.isLeftEndpoint){const e=new Ti(n);for(let o=0;o<r.data.length;o++){const s=r.data[o];if(t&&s.leftSweepEvent.featureId===n.featureId)continue;const a=Ei(e,s);!1!==a&&i.push(a)}r.push(e)}else!1===n.isLeftEndpoint&&r.pop()}return i}(i,t)}(Wt(o),n);let a=[];if(r){const e={};s.forEach((t=>{const i=t.join(",");e[i]||(e[i]=!0,a.push(t))}))}else a=s;return Wt(a.map((e=>qt(e))))}function Pi(e,t){!function(e,t){var i,r,n,o,s,a,l,c,u,h,d=0,p="FeatureCollection"===e.type,f="Feature"===e.type,m=p?e.features.length:1;for(i=0;i<m;i++){for(a=p?e.features[i].geometry:f?e.geometry:e,c=p?e.features[i].properties:f?e.properties:{},u=p?e.features[i].bbox:f?e.bbox:void 0,h=p?e.features[i].id:f?e.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,n=0;n<s;n++)if(null!==(o=l?a.geometries[n]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,d,c,u,h))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],d,c,u,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,d,c,u,h))return!1;d++}}(e,(function(e,i,r,n,o){var s,a=null===e?null:e.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==t($t(e,r,{bbox:n,id:o}),i,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<e.coordinates.length;l++){var c=e.coordinates[l];if(!1===t($t({type:s,coordinates:c},r),i,l))return!1}}))}function Ii(e,t={}){const i=di(e);switch(t.properties||"Feature"!==e.type||(t.properties=e.properties),i.type){case"Polygon":return function(e,t={}){return Ci(di(e).coordinates,t.properties?t.properties:"Feature"===e.type?e.properties:{})}(i,t);case"MultiPolygon":return function(e,t={}){const i=di(e).coordinates,r=t.properties?t.properties:"Feature"===e.type?e.properties:{},n=[];return i.forEach((e=>{n.push(Ci(e,r))})),Wt(n)}(i,t);default:throw new Error("invalid poly")}}function Ci(e,t){return e.length>1?function(e,t,i={}){return $t({type:"MultiLineString",coordinates:e},t,i)}(e,t):Zt(e[0],t)}var Mi=Ii;function Ai(e,t,i={}){var r;const n=null!=(r=i.ignoreSelfIntersections)&&r;let o=!0;return Pi(e,(e=>{Pi(t,(t=>{if(!1===o)return!1;o=function(e,t,i){switch(e.type){case"Point":switch(t.type){case"Point":return r=e.coordinates,n=t.coordinates,!(r[0]===n[0]&&r[1]===n[1]);case"LineString":return!Li(t,e);case"Polygon":return!pi(e,t)}break;case"LineString":switch(t.type){case"Point":return!Li(e,t);case"LineString":return!function(e,t,i){return Si(e,t,{ignoreSelfIntersections:i}).features.length>0}(e,t,i);case"Polygon":return!Fi(t,e,i)}break;case"Polygon":switch(t.type){case"Point":return!pi(t,e);case"LineString":return!Fi(e,t,i);case"Polygon":return!function(e,t,i){for(const i of e.coordinates[0])if(pi(i,t))return!0;for(const i of t.coordinates[0])if(pi(i,e))return!0;return Si(Ii(e),Ii(t),{ignoreSelfIntersections:i}).features.length>0}(t,e,i)}}var r,n;return!1}(e.geometry,t.geometry,n)}))})),o}function Li(e,t){for(let i=0;i<e.coordinates.length-1;i++)if(Di(e.coordinates[i],e.coordinates[i+1],t.coordinates))return!0;return!1}function Fi(e,t,i){for(const i of t.coordinates)if(pi(i,e))return!0;return Si(t,Ii(e),{ignoreSelfIntersections:i}).features.length>0}function Di(e,t,i){const r=i[0]-e[0],n=i[1]-e[1],o=t[0]-e[0],s=t[1]-e[1];return 0==r*s-n*o&&(Math.abs(o)>=Math.abs(s)?o>0?e[0]<=i[0]&&i[0]<=t[0]:t[0]<=i[0]&&i[0]<=e[0]:s>0?e[1]<=i[1]&&i[1]<=t[1]:t[1]<=i[1]&&i[1]<=e[1])}var ki=Ai;function Oi(e,t,i={}){var r=ui(e),n=ui(t),o=Xt(n[1]-r[1]),s=Xt(n[0]-r[0]),a=Xt(r[1]),l=Xt(n[1]),c=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return function(e,t="kilometers"){const i=Gt[t];
2if(!i)throw new Error(t+" units is invalid");return e*i}(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i.units)}var Ri=Oi;function zi(e,t,i={}){if(!0===i.final)return function(e,t){let i=zi(t,e);return i=(i+180)%360,i}(e,t);const r=ui(e),n=ui(t),o=Xt(r[0]),s=Xt(n[0]),a=Xt(r[1]),l=Xt(n[1]),c=Math.sin(s-o)*Math.cos(l),u=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return Ht(Math.atan2(c,u))}function Ni(e,t,i,r={}){const n=ui(e),o=Xt(n[0]),s=Xt(n[1]),a=Xt(i),l=function(e,t="kilometers"){const i=Gt[t];if(!i)throw new Error(t+" units is invalid");return e/i}(t,r.units),c=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a));return qt([Ht(o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(c))),Ht(c)],r.properties)}var Bi=Object.defineProperty,Vi=Object.defineProperties,ji=Object.getOwnPropertyDescriptors,Ui=Object.getOwnPropertySymbols,Gi=Object.prototype.hasOwnProperty,$i=Object.prototype.propertyIsEnumerable,qi=(e,t,i)=>t in e?Bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Zi=(e,t)=>{for(var i in t||(t={}))Gi.call(t,i)&&qi(e,i,t[i]);if(Ui)for(var i of Ui(t))$i.call(t,i)&&qi(e,i,t[i]);return e},Wi=(e,t)=>Vi(e,ji(t)),Hi=function(e,t,i={}){if(!e||!t)throw new Error("lines and pt are required arguments");let r=qt([1/0,1/0],{dist:1/0,index:-1,multiFeatureIndex:-1,location:-1}),n=0;return Pi(e,(function(e,o,s){const a=hi(e);for(let e=0;e<a.length-1;e++){const o=qt(a[e]);o.properties.dist=Oi(t,o,i);const l=qt(a[e+1]);l.properties.dist=Oi(t,l,i);const c=Oi(o,l,i),u=Math.max(o.properties.dist,l.properties.dist),h=zi(o,l),d=Ni(t,u,h+90,i),p=Ni(t,u,h-90,i),f=Si(Zt([d.geometry.coordinates,p.geometry.coordinates]),Zt([o.geometry.coordinates,l.geometry.coordinates]));let m;f.features.length>0&&f.features[0]&&(m=Wi(Zi({},f.features[0]),{properties:{dist:Oi(t,f.features[0],i),multiFeatureIndex:s,location:n+Oi(o,f.features[0],i)}})),o.properties.dist<r.properties.dist&&(r=Wi(Zi({},o),{properties:Wi(Zi({},o.properties),{index:e,multiFeatureIndex:s,location:n})})),l.properties.dist<r.properties.dist&&(r=Wi(Zi({},l),{properties:Wi(Zi({},l.properties),{index:e+1,multiFeatureIndex:s,location:n+c})})),m&&m.properties.dist<r.properties.dist&&(r=Wi(Zi({},m),{properties:Wi(Zi({},m.properties),{index:e})})),n+=c}})),r};function Xi(e){const t={type:"Feature"};return Object.keys(e).forEach((i=>{switch(i){case"type":case"properties":case"geometry":return;default:t[i]=e[i]}})),t.properties=Yi(e.properties),null==e.geometry?t.geometry=null:t.geometry=Ji(e.geometry),t}function Yi(e){const t={};return e?(Object.keys(e).forEach((i=>{const r=e[i];"object"==typeof r?null===r?t[i]=null:Array.isArray(r)?t[i]=r.map((e=>e)):t[i]=Yi(r):t[i]=r})),t):t}function Ji(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map((e=>Ji(e))),t):(t.coordinates=Ki(e.coordinates),t)}function Ki(e){const t=e;return"object"!=typeof t[0]?t.slice():t.map((e=>Ki(e)))}var Qi=Object.defineProperty,er=Object.defineProperties,tr=Object.getOwnPropertyDescriptors,ir=Object.getOwnPropertySymbols,rr=Object.prototype.hasOwnProperty,nr=Object.prototype.propertyIsEnumerable,or=(e,t,i)=>t in e?Qi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,sr=(e,t)=>{for(var i in t||(t={}))rr.call(t,i)&&or(e,i,t[i]);if(ir)for(var i of ir(t))nr.call(t,i)&&or(e,i,t[i]);return e},ar=(e,t)=>er(e,tr(t));function lr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,n,o=[],s=!0,a=!1;try{for(i=i.call(e);!(s=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,n=e}finally{try{s||null==i.return||i.return()}finally{if(a)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cr(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?cr(e,t):void 0}}
2(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}var ur=jt().constants.geojsonTypes,hr={VERTICAL_GUIDE:"VERTICAL_GUIDE",HORIZONTAL_GUIDE:"HORIZONTAL_GUIDE"},dr=function(e,t,i,r){var n=e.getCanvas(),o=n.width,s=n.height,a=e.project(i),l=a.x,c=a.y;(l>0&&l<o&&c>0&&c<s||r)&&t.push(i)},pr=function(e,t,i,r){var n=[];"function"==typeof r&&(n=r(e,t)),Array.isArray(n)&&0!==n.length||(n=t.getAll().features);var o,s,a,l,c,u=[],h=(s=(o=e.getCanvas()).width,a=o.height,e.unproject([0,0]).toArray(),l=e.unproject([s,0]).toArray(),e.unproject([s,a]).toArray(),c=e.unproject([0,a]).toArray(),Jt([c,l].flat())),d=[],p=function t(i){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!Array.isArray(i))throw Error("Your array is not an array");Array.isArray(i[0])?i.forEach((function(e){t(e)})):2===i.length&&dr(e,d,i,r)};return n.forEach((function(e){e.id!==i.id?e.id!==hr.HORIZONTAL_GUIDE&&e.id!==hr.VERTICAL_GUIDE&&(p(e.geometry.coordinates),ki(h,e)||u.push(e)):i.type===ur.POLYGON&&p(e.geometry.coordinates[0].slice(0,-2),!0)})),[u,d]};function fr(e,t){var i=e.map((function(e){return{feature:e,point:Hi(e,t)}}));return i.sort((function(e,t){return e.point.properties.dist-t.point.properties.dist})),{feature:i[0].feature,point:i[0].point}}var mr=function(e,t){var i={};return t.forEach((function(t,r){var n=function(e,t){var i,r=[e.lng,e.lat],n="Point"===t.geometry.type,o="Polygon"===t.geometry.type,s="MultiPolygon"===t.geometry.type,a="MultiPoint"===t.geometry.type,l=void 0,c=hi(t);if(n){var u=lr(c,2);return{latlng:{lng:u[0],lat:u[1]},distance:Ri(c,r)}}if(a){var h=function(e,t,i={}){if(!e)throw new Error("targetPoint is required");if(!t)throw new Error("points is required");let r=1/0,n=0;!function(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var i=0;i<e.features.length&&!1!==t(e.features[i],i);i++);}(t,((t,o)=>{const s=Oi(e,t,i);s<r&&(n=o,r=s)}));const o=function(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return Xi(e);case"FeatureCollection":return function(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach((i=>{switch(i){case"type":case"features":return;default:t[i]=e[i]}})),t.features=e.features.map((e=>Xi(e))),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ji(e);default:throw new Error("unknown GeoJSON type")}}(t.features[n]);return ar(sr({},o),{properties:ar(sr({},o.properties),{featureIndex:n,distanceToPoint:r})})}(r,Wt(c.map((function(e){return qt(e)})))),d=h.geometry.coordinates;return{latlng:{lng:d[0],lat:d[1]},distance:h.properties.distanceToPoint}}if(l=o||s?Mi(t):t,o){var p=fr("LineString"===l.geometry.type?[Zt(l.geometry.coordinates)]:l.geometry.coordinates.map((function(e){return Zt(e)})),r);l=p.feature,i=p.point}else if(s){var f=fr(l.features.map((function(e){return"LineString"===e.geometry.type?[e.geometry.coordinates]:e.geometry.coordinates})).flatMap((function(e){return e})).map((function(e){return Zt(e)})),r);l=f.feature,i=f.point}else i=Hi(l,r);var m=lr(i.geometry.coordinates,2),g=m[0],y=m[1],_=i.properties.index,v=l.geometry.coordinates;return"MultiLineString"===l.geometry.type&&(v=l.geometry.coordinates[i.properties.multiFeatureIndex]),_+1===v.length&&_--,{latlng:{lng:g,lat:y},segment:v.slice(_,_+2),distance:i.properties.dist,isMarker:n}}(e,t);(void 0===i.distance||n.distance<i.distance)&&((i=n).layer=t)})),i},gr=function(e,t){var i,r,n,o,s,a,l,c,u,h,d,p,f=t.lngLat.lng,m=t.lngLat.lat;if(t.originalEvent.altKey)return e.showVerticalSnapLine=!1,e.showHorizontalSnapLine=!1,{lng:f,lat:m};if(e.snapList.length<=0)return{lng:f,lat:m};if(e.options.snap){if(i=mr({lng:f,lat:m},e.snapList),0===Object.keys(i).length)return!1;var g=i.isMarker,y=e.options.snapOptions?e.options.snapOptions.snapVertexPriorityDistance:void 0;n=g?i.latlng:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1.25;return Array.isArray(e.segment)?function(e,t,i){var r=e.segment[0],n=e.segment[1],o=[e.latlng.lng,e.latlng.lat],s=Ri(r,o),a=Ri(n,o),l=s<a?r:n,c=s<a?s:a;if(t&&t.snapToMidPoints){var u=function(e,t){return Ni(e,Oi(e,t)/2,zi(e,t))}(r,n).geometry.coordinates,h=Ri(u,o);h<s&&h<a&&(l=u,c=h)}var d=lr(c<i?l:o,2);return{lng:d[0],lat:d[1]}}(e,t,i):function(e){return e.latlng}(e)}(i,e.options.snapOptions,y),r=(e.options.snapOptions&&e.options.snapOptions.snapPx||15)*(o=n.lat,s=e.map.getZoom(),a=o*(Math.PI/180),40075017*Math.cos(a)/Math.pow(2,s+8))}if(e.options.guides){var _=(u=e.vertices,h=t.lngLat,d=[],p=[],u.forEach((function(e){d.push(e[0]),p.push(e[1])})),{verticalPx:d.find((function(e){return Math.abs(e-h.lng)<.009})),horizontalPx:p.find((function(e){return Math.abs(e-h.lat)<.009}))});if(c=_.horizontalPx,l=_.verticalPx){var v={lng:l,lat:t.lngLat.lat+10},b={lng:l,lat:t.lngLat.lat-10};e.verticalGuide.updateCoordinate(0,v.lng,v.lat),e.verticalGuide.updateCoordinate(1,b.lng,b.lat)}if(c){var x={lng:t.lngLat.lng+10,lat:c},w={lng:t.lngLat.lng-10,lat:c};e.horizontalGuide.updateCoordinate(0,x.lng,x.lat),e.horizontalGuide.updateCoordinate(1,w.lng,w.lat)}
2e.showVerticalSnapLine=!!l,e.showHorizontalSnapLine=!!c}return i&&1e3*i.distance<r?n:l||c?(l&&(f=l),c&&(m=c),{lng:f,lat:m}):{lng:f,lat:m}},yr=function(e){return{id:e,type:ur.FEATURE,properties:{isSnapGuide:"true"},geometry:{type:ur.LINE_STRING,coordinates:[]}}},_r=function(e,t){return!(t.properties.id!==hr.VERTICAL_GUIDE||e.options.guides&&e.showVerticalSnapLine)||!(t.properties.id!==hr.HORIZONTAL_GUIDE||e.options.guides&&e.showHorizontalSnapLine)};function vr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,n,o=[],s=!0,a=!1;try{for(i=i.call(e);!(s=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,n=e}finally{try{s||null==i.return||i.return()}finally{if(a)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return br(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?br(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function br(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function xr(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function wr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Tr=jt().lib.doubleClickZoom,Er=jt().constants,Sr=Er.geojsonTypes,Pr=Er.cursors,Ir=jt().modes.draw_point,Cr=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?xr(Object(i),!0).forEach((function(t){wr(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):xr(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},Ir);Cr.onSetup=function(e){var t,i=this,r=this.newFeature({type:Sr.FEATURE,properties:{},geometry:{type:Sr.POINT,coordinates:[[]]}}),n=this.newFeature(yr(hr.VERTICAL_GUIDE)),o=this.newFeature(yr(hr.HORIZONTAL_GUIDE));this.addFeature(r),this.addFeature(n),this.addFeature(o);var s=this.getSelected();this.clearSelectedFeatures(),Tr.disable(this);var a=vr(pr(this.map,this._ctx.api,r,null===(t=this._ctx.options.snapOptions)||void 0===t?void 0:t.snapGetFeatures),2),l=a[0],c=a[1],u={map:this.map,point:r,vertices:c,snapList:l,selectedFeatures:s,verticalGuide:n,horizontalGuide:o};u.options=this._ctx.options;var h=function(){var e,t=vr(pr(i.map,i._ctx.api,r,null===(e=i._ctx.options.snapOptions)||void 0===e?void 0:e.snapGetFeatures),2),n=t[0],o=t[1];u.vertices=o,u.snapList=n};u.moveendCallback=h;var d=function(e){u.options=e};return u.optionsChangedCallback=d,this.map.on("moveend",h),this.map.on("draw.snap.options_changed",d),u},Cr.onClick=function(e){Ir.onClick.call(this,e,{lngLat:{lng:e.snappedLng,lat:e.snappedLat}})},Cr.onMouseMove=function(e,t){var i=gr(e,t),r=i.lng,n=i.lat;e.snappedLng=r,e.snappedLat=n,e.lastVertex&&e.lastVertex[0]===r&&e.lastVertex[1]===n?this.updateUIClasses({mouse:Pr.POINTER}):this.updateUIClasses({mouse:Pr.ADD})},Cr.toDisplayFeatures=function(e,t,i){_r(e,t)||Ir.toDisplayFeatures(e,t,i)},Cr.onStop=function(e){this.deleteFeature(hr.VERTICAL_GUIDE,{silent:!0}),this.deleteFeature(hr.HORIZONTAL_GUIDE,{silent:!0}),this.map.off("moveend",e.moveendCallback),Ir.onStop.call(this,e)};const Mr=Cr;function Ar(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,n,o=[],s=!0,a=!1;try{for(i=i.call(e);!(s=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,n=e}finally{try{s||null==i.return||i.return()}finally{if(a)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Lr(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Lr(e,t):void 0}}
2(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function Fr(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function Dr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var kr=jt().lib.doubleClickZoom,Or=jt().constants,Rr=Or.geojsonTypes,zr=Or.modes,Nr=Or.cursors,Br=jt().modes.draw_line_string,Vr=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Fr(Object(i),!0).forEach((function(t){Dr(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Fr(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},Br);Vr.onSetup=function(e){var t,i=this,r=this.newFeature({type:Rr.FEATURE,properties:{},geometry:{type:Rr.LINE_STRING,coordinates:[[]]}}),n=this.newFeature(yr(hr.VERTICAL_GUIDE)),o=this.newFeature(yr(hr.HORIZONTAL_GUIDE));this.addFeature(r),this.addFeature(n),this.addFeature(o);var s=this.getSelected();this.clearSelectedFeatures(),kr.disable(this);var a=Ar(pr(this.map,this._ctx.api,r,null===(t=this._ctx.options.snapOptions)||void 0===t?void 0:t.snapGetFeatures),2),l=a[0],c=a[1],u={map:this.map,line:r,currentVertexPosition:0,vertices:c,snapList:l,selectedFeatures:s,verticalGuide:n,horizontalGuide:o,direction:"forward"};u.options=this._ctx.options;var h=function(){var e,t=Ar(pr(i.map,i._ctx.api,r,null===(e=i._ctx.options.snapOptions)||void 0===e?void 0:e.snapGetFeatures),2),n=t[0],o=t[1];u.vertices=o,u.snapList=n};u.moveendCallback=h;var d=function(e){u.options=e};return u.optionsChangedCallback=d,this.map.on("moveend",h),this.map.on("draw.snap.options_changed",d),u},Vr.onClick=function(e){var t=e.snappedLng,i=e.snappedLat;if(e.currentVertexPosition>0){var r=e.line.coordinates[e.currentVertexPosition-1];if(e.lastVertex=r,r[0]===t&&r[1]===i)return this.changeMode(zr.SIMPLE_SELECT,{featureIds:[e.line.id]})}dr(e.map,e.vertices,{lng:t,lat:i}),e.line.updateCoordinate(e.currentVertexPosition,t,i),e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t,i)},Vr.onMouseMove=function(e,t){var i=gr(e,t),r=i.lng,n=i.lat;e.line.updateCoordinate(e.currentVertexPosition,r,n),e.snappedLng=r,e.snappedLat=n,e.lastVertex&&e.lastVertex[0]===r&&e.lastVertex[1]===n?this.updateUIClasses({mouse:Nr.POINTER}):this.updateUIClasses({mouse:Nr.ADD})},Vr.toDisplayFeatures=function(e,t,i){_r(e,t)||Br.toDisplayFeatures(e,t,i)},Vr.onStop=function(e){this.deleteFeature(hr.VERTICAL_GUIDE,{silent:!0}),this.deleteFeature(hr.HORIZONTAL_GUIDE,{silent:!0}),this.map.off("moveend",e.moveendCallback),Br.onStop.call(this,e)};const jr=Vr;function Ur(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,n,o=[],s=!0,a=!1;try{for(i=i.call(e);!(s=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,n=e}finally{try{s||null==i.return||i.return()}finally{if(a)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gr(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Gr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function $r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function qr(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var Zr=jt().lib.doubleClickZoom,Wr=jt().constants,Hr=Wr.geojsonTypes,Xr=Wr.modes,Yr=Wr.cursors,Jr=jt().modes.draw_polygon,Kr=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};
2t%2?$r(Object(i),!0).forEach((function(t){qr(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):$r(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},Jr);Kr.onSetup=function(e){var t,i=this,r=this.newFeature({type:Hr.FEATURE,properties:{},geometry:{type:Hr.POLYGON,coordinates:[[]]}}),n=this.newFeature(yr(hr.VERTICAL_GUIDE)),o=this.newFeature(yr(hr.HORIZONTAL_GUIDE));this.addFeature(r),this.addFeature(n),this.addFeature(o);var s=this.getSelected();this.clearSelectedFeatures(),Zr.disable(this);var a=Ur(pr(this.map,this._ctx.api,r,null===(t=this._ctx.options.snapOptions)||void 0===t?void 0:t.snapGetFeatures),2),l=a[0],c=a[1],u={map:this.map,polygon:r,currentVertexPosition:0,vertices:c,snapList:l,selectedFeatures:s,verticalGuide:n,horizontalGuide:o};u.options=Object.assign(this._ctx.options,{overlap:!0});var h=function(){var e,t=Ur(pr(i.map,i._ctx.api,r,null===(e=i._ctx.options.snapOptions)||void 0===e?void 0:e.snapGetFeatures),2),n=t[0],o=t[1];u.vertices=o,u.snapList=n};u.moveendCallback=h;var d=function(e){u.options=e};return u.optionsChangedCallback=d,this.map.on("moveend",h),this.map.on("draw.snap.options_changed",d),u},Kr.onClick=function(e){var t=e.snappedLng,i=e.snappedLat;if(e.currentVertexPosition>0){var r=e.polygon.coordinates[0][e.currentVertexPosition-1];if(e.lastVertex=r,r[0]===t&&r[1]===i)return this.changeMode(Xr.SIMPLE_SELECT,{featureIds:[e.polygon.id]})}dr(e.map,e.vertices,{lng:t,lat:i}),e.polygon.updateCoordinate("0.".concat(e.currentVertexPosition),t,i),e.currentVertexPosition++,e.polygon.updateCoordinate("0.".concat(e.currentVertexPosition),t,i)},Kr.onMouseMove=function(e,t){var i=gr(e,t),r=i.lng,n=i.lat;e.polygon.updateCoordinate("0.".concat(e.currentVertexPosition),r,n),e.snappedLng=r,e.snappedLat=n,e.lastVertex&&e.lastVertex[0]===r&&e.lastVertex[1]===n?this.updateUIClasses({mouse:Yr.POINTER}):this.updateUIClasses({mouse:Yr.ADD})},Kr.toDisplayFeatures=function(e,t,i){_r(e,t)||Jr.toDisplayFeatures(e,t,i)},Kr.onStop=function(e){this.deleteFeature(hr.VERTICAL_GUIDE,{silent:!0}),this.deleteFeature(hr.HORIZONTAL_GUIDE,{silent:!0}),this.map.off("moveend",e.moveendCallback),this.map.off("draw.snap.options_changed",e.optionsChangedCallback);var t=e.polygon;if(e.options.overlap)Jr.onStop.call(this,e);else{var i=this._ctx.store.getAll();try{var r=t;i.forEach((function(e){if(t.id===e.id)return!1;(function(e,t,i={}){var r;const n=null!=(r=i.ignoreSelfIntersections)&&r;let o=!1;return Pi(e,(e=>{Pi(t,(t=>{if(!0===o)return!0;o=!Ai(e.geometry,t.geometry,{ignoreSelfIntersections:n})}))})),o})(e,r)&&(r=turf.difference(r,e))})),e.polygon.coordinates=r.coordinates||r.geometry.coordinates}catch(t){return Jr.onStop.call(this,e),void this.deleteFeature([e.polygon.id],{silent:!0})}var n=e.polygon.removeCoordinate;e.polygon.removeCoordinate=function(){},Jr.onStop.call(this,e),e.polygon.removeCoordinate=n.bind(e.polygon)}};const Qr=Kr;function en(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function tn(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function rn(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var nn=jt().lib.doubleClickZoom,on=jt().constants,sn=jt().modes.direct_select,an=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?tn(Object(i),!0).forEach((function(t){rn(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):tn(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},sn);an.onSetup=function(e){var t,i=e.featureId,r=this.getFeature(i);if(!r)throw new Error("You must provide a featureId to enter direct_select mode");if(r.type===on.geojsonTypes.POINT)throw new TypeError("direct_select mode doesn't handle point features");var n=function(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var i,r,n=[],o=!0,s=!1;try{for(t=t.call(e);!(o=(i=t.next()).done)&&(n.push(i.value),2!==n.length);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==t.return||t.return()}finally{if(s)throw r}}return n}}(e)||function(e){if(e){if("string"==typeof e)return en(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?en(e,2):void 0}}
2(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(pr(this.map,this._ctx.api,r,null===(t=this._ctx.options.snapOptions)||void 0===t?void 0:t.snapGetFeatures)),o=n[0],s=n[1],a=this.newFeature(yr(hr.VERTICAL_GUIDE)),l=this.newFeature(yr(hr.HORIZONTAL_GUIDE));this.addFeature(a),this.addFeature(l);var c={map:this.map,featureId:i,feature:r,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[],vertices:s,snapList:o,verticalGuide:a,horizontalGuide:l};c.options=this._ctx.options,this.setSelectedCoordinates(this.pathsToCoordinates(i,c.selectedCoordPaths)),this.setSelected(i),nn.disable(this),this.setActionableState({trash:!0});var u=function(e){c.options=e};return c.optionsChangedCallback=u,this.map.on("draw.snap.options_changed",u),c},an.dragVertex=function(e,t,i){var r=gr(e,t),n=r.lng,o=r.lat;e.feature.updateCoordinate(e.selectedCoordPaths[0],n,o)},an.onStop=function(e){this.deleteFeature(hr.VERTICAL_GUIDE,{silent:!0}),this.deleteFeature(hr.HORIZONTAL_GUIDE,{silent:!0}),this.map.off("draw.snap.options_changed",e.optionsChangedCallback),sn.onStop.call(this,e)};const ln=an;function cn(e){return function(e){if(Array.isArray(e))return un(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return un(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?un(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function un(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function hn(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function dn(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?hn(Object(i),!0).forEach((function(t){pn(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):hn(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function pn(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var fn=jt().lib.theme.map((function(e){return"gl-draw-line-inactive"===e.id?dn(dn({},e),{},{filter:[].concat(cn(e.filter),[["!=","user_isSnapGuide","true"]])}):e}));const mn=[].concat(cn(fn),[{id:"guide",type:"line",filter:["all",["==","$type","LineString"],["==","user_isSnapGuide","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#c00c00","line-width":1,"line-dasharray":[5,5]}}]);var gn=Nt.AV,yn=Nt.WK,_n=Nt.K9,vn=Nt.Aq;const{doubleClickZoom:bn}=yt.lib,xn={...yn},wn={...yt.modes.draw_point},Tn={...yt.modes.simple_select},En={...gn},Sn={...yt.modes.draw_polygon};xn.onSetup=function(e){const t=(e=e||{}).featureId;var i=0,r="forwards";let n;if(t){if(n=this.getFeature(t),!n)throw new Error("Could not find a feature with the provided featureId");let o=e.from;if(o&&"Feature"===o.type&&o.geometry&&"Point"===o.geometry.type&&(o=o.geometry),o&&"Point"===o.type&&o.coordinates&&2===o.coordinates.length&&(o=o.coordinates),!o||!Array.isArray(o))throw new Error("Please use the `from` property to indicate which point to continue the line from");const s=n.coordinates.length-1;if(n.coordinates[s][0]===o[0]&&n.coordinates[s][1]===o[1])i=s+1,n.addCoordinate(i,...n.coordinates[s]);else{if(n.coordinates[0][0]!==o[0]||n.coordinates[0][1]!==o[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");r="backwards",i=0,n.addCoordinate(i,...n.coordinates[0])}}else n=this.newFeature({type:yt.constants.geojsonTypes.FEATURE,properties:{},geometry:{type:yt.constants.geojsonTypes.LINE_STRING,coordinates:[]}});
2const o=this.newFeature(vn.getGuideFeature(vn.IDS.VERTICAL_GUIDE)),s=this.newFeature(vn.getGuideFeature(vn.IDS.HORIZONTAL_GUIDE));this.addFeature(n),this.addFeature(o),this.addFeature(s);const a=this.getSelected();this.clearSelectedFeatures(),bn.disable(this);const[l,c]=vn.createSnapList(this.map,this._ctx.api,n,this._ctx.options.snapOptions?.snapGetFeatures),u={map:this.map,line:n,currentVertexPosition:i,vertices:c,snapList:l,selectedFeatures:a,verticalGuide:o,horizontalGuide:s,direction:r};u.options=this._ctx.options;const h=()=>{const[e,t]=vn.createSnapList(this.map,this._ctx.api,n,this._ctx.options.snapOptions?.snapGetFeatures);u.vertices=t,u.snapList=e};u.moveendCallback=h;const d=e=>{u.options=e};return u.optionsChangedCallback=d,this.map.on("moveend",h),this.map.on("draw.snap.options_changed",d),u},wn.onSetup=function(e){const t=this.newFeature({type:yt.constants.geojsonTypes.FEATURE,properties:e.properties||{},geometry:{type:yt.constants.geojsonTypes.POINT,coordinates:[]}});return this.addFeature(t),this.clearSelectedFeatures(),this.updateUIClasses({mouse:yt.constants.cursors.ADD}),this.activateUIButton(yt.constants.types.POINT),this.setActionableState({trash:!0}),{point:t}},Tn.onSetup=function(e){if(void 0!==e.featureIds&&1==e.featureIds.length){const t=e.featureIds[0],i=this.getFeature(t);if(void 0!==i&&"Point"===i.type){const e=void 0!==i.properties.description?i.properties.description:"",t=document.createElement("div"),r=n.create("button","btn btn-success btn-sm");r.textContent="Save",t.innerHTML=`\n          <label class="form-label fs-6">Feature Description</label>\n          <textarea name="description" class="form-control" row="3" maxLength="200">${e}</textarea>\n          <div class="form-text">Maximum 200 characters</div>\n      `,t.appendChild(r);const o=new(vt().Popup)({closeOnClick:!1,offset:20}).setLngLat(i.coordinates).setDOMContent(t).setMaxWidth("300px").addTo(this.map);i.popup=o,r.addEventListener("click",(e=>{e.preventDefault(),i.properties.description=t.querySelector("textarea").value,o.remove()})),this.map.on("draw.selectionchange",(e=>{0==e.features.length&&o.remove()}))}if(void 0!==i&&void 0!==this._ctx.options.snapOptions.snapOnSimpleSelectFilter&&this._ctx.options.snapOptions.snapOnSimpleSelectFilter(i)){const[r,n]=vn.createSnapList(this.map,this._ctx.api,i,this._ctx.options.snapOptions?.snapGetFeatures),o={map:this.map,featureId:t,feature:i,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[],vertices:n,snapList:r};return o.options=this._ctx.options,this.setSelected(t),this.setActionableState({trash:!0}),o}}return yt.modes.simple_select.onSetup.call(this,e)},Tn.onDrag=function(e,t){if(this.hasPopup(e)&&(e.feature.popup.isOpen()&&e.feature.popup.remove(),e.feature.popup.setLngLat(e.feature.coordinates)),void 0!==e.snapList){const i=vn.snap(e,t);return e.feature.updateCoordinate(i.lng,i.lat),void(this.hasPopup(e)&&e.feature.popup.setLngLat([i.lng,i.lat]))}return yt.modes.simple_select.onDrag.call(this,e,t)},Tn.clickOnFeature=function(e,t){if(t.featureTarget.geometry.type!==yt.constants.geojsonTypes.POINT)return this.changeMode(yt.constants.modes.DIRECT_SELECT,{featureId:t.featureTarget.properties.id});if(2==t.originalEvent.button)return this.hasPopup(e)&&e.feature.popup.remove(),this.onTrash(e,t);if(void 0===e.featureId){let i=this.onSetup({featureIds:[t.featureTarget.properties.id]});
2Object.keys(i).forEach((t=>{e[t]=i[t]}))}return this.hasPopup(e)&&e.feature.popup.addTo(this.map),yt.modes.simple_select.clickOnFeature.call(this,e,t)},Tn.hasPopup=function(e){return void 0!==e.feature&&void 0!==e.feature.popup},En.onDrag=function(e,t){if(e.feature.type===yt.constants.geojsonTypes.POINT||0!=e.selectedCoordPaths.length)return gn.onDrag.call(this,e,t)},En.onClick=function(e,t){if(!yt.lib.CommonSelectors.isVertex(t)||2!=t.originalEvent.button)return gn.onClick.call(this,e,t);e.feature.removeCoordinate(e.selectedCoordPaths[0])},Sn.onStop=function(e){yt.modes.draw_polygon.onStop.call(this,e),void 0!==this.getFeature(e.polygon.id)&&(this.deleteFeature([e.polygon.id],{silent:!0}),e.polygon.coordinates[0].push(e.polygon.coordinates[0][0]),this._ctx.api.getAll().features.forEach((t=>{switch(t.geometry.type){case"LineString":const i=this.getFeature(t.id),r=i.coordinates.filter((t=>!kt(t,e.polygon)));i.coordinates=r;break;case"Point":kt(t.geometry.coordinates,e.polygon)&&this.deleteFeature([t.id],{silent:!0})}})),this.changeMode(yt.constants.modes.SIMPLE_SELECT,{},{silent:!0}))};var Pn=6371008.8,In={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*Pn,kilometers:6371.0088,kilometres:6371.0088,meters:Pn,metres:Pn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:Pn/1852,radians:1,yards:6967335.223679999};function Cn(e,t,i={}){const r={type:"Feature"};return(0===i.id||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=t||{},r.geometry=e,r}function Mn(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Fn(e[0])||!Fn(e[1]))throw new Error("coordinates must contain numbers");return Cn({type:"Point",coordinates:e},t,i)}function An(e){return e%(2*Math.PI)*180/Math.PI}function Ln(e){return e%360*Math.PI/180}function Fn(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function Dn(e,t,i={}){var r=Ft(e),n=Ft(t),o=Ln(n[1]-r[1]),s=Ln(n[0]-r[0]),a=Ln(r[1]),l=Ln(n[1]),c=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return function(e,t="kilometers"){const i=In[t];
2if(!i)throw new Error(t+" units is invalid");return e*i}(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i.units)}var kn=Dn;function On(e,t,i){if(null!==e)for(var r,n,o,s,a,l,c,u,h=0,d=0,p=e.type,f="FeatureCollection"===p,m="Feature"===p,g=f?e.features.length:1,y=0;y<g;y++){a=(u=!!(c=f?e.features[y].geometry:m?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var _=0;_<a;_++){var v=0,b=0;if(null!==(s=u?c.geometries[_]:c)){l=s.coordinates;var x=s.type;switch(h=!i||"Polygon"!==x&&"MultiPolygon"!==x?0:1,x){case null:break;case"Point":if(!1===t(l,d,y,v,b))return!1;d++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===t(l[r],d,y,v,b))return!1;d++,"MultiPoint"===x&&v++}"LineString"===x&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(n=0;n<l[r].length-h;n++){if(!1===t(l[r][n],d,y,v,b))return!1;d++}"MultiLineString"===x&&v++,"Polygon"===x&&b++}"Polygon"===x&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(b=0,n=0;n<l[r].length;n++){for(o=0;o<l[r][n].length-h;o++){if(!1===t(l[r][n][o],d,y,v,b))return!1;d++}b++}v++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===On(s.geometries[r],t,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Rn(e,t){!function(e,t){var i,r,n,o,s,a,l,c,u,h,d=0,p="FeatureCollection"===e.type,f="Feature"===e.type,m=p?e.features.length:1;for(i=0;i<m;i++){for(a=p?e.features[i].geometry:f?e.geometry:e,c=p?e.features[i].properties:f?e.properties:{},u=p?e.features[i].bbox:f?e.bbox:void 0,h=p?e.features[i].id:f?e.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,n=0;n<s;n++)if(null!==(o=l?a.geometries[n]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,d,c,u,h))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],d,c,u,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,d,c,u,h))return!1;d++}}(e,(function(e,i,r,n,o){var s,a=null===e?null:e.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==t(Cn(e,r,{bbox:n,id:o}),i,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<e.coordinates.length;l++){var c=e.coordinates[l];if(!1===t(Cn({type:s,coordinates:c},r),i,l))return!1}}))}function zn(e,t,i){var r=i,n=!1;return function(e,t){Rn(e,(function(e,i,r){var n=0;if(e.geometry){var o=e.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,l=0,c=0;return!1!==On(e,(function(o,u,h,d,p){if(void 0===s||i>a||d>l||p>c)return s=o,a=i,l=d,c=p,void(n=0);var f=function(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return Cn({type:"LineString",coordinates:e},t,i)}([s,o],e.properties);if(!1===t(f,i,r,p,n))return!1;n++,s=o}))&&void 0}}}))}(e,(function(e,o,s,a,l){r=!1===n&&void 0===i?e:t(r,e,o,s,a,l),n=!0})),r}function Nn(e,t,i={}){if(!0===i.final)return function(e,t){let i=Nn(t,e);return i=(i+180)%360,i}(e,t);const r=Ft(e),n=Ft(t),o=Ln(r[0]),s=Ln(n[0]),a=Ln(r[1]),l=Ln(n[1]),c=Math.sin(s-o)*Math.cos(l),u=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return An(Math.atan2(c,u))}function Bn(e,t,i,r={}){const n=Ft(e),o=Ln(n[0]),s=Ln(n[1]),a=Ln(i),l=function(e,t="kilometers"){const i=In[t];
2if(!i)throw new Error(t+" units is invalid");return e/i}(t,r.units),c=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a));return Mn([An(o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(c))),An(c)],r.properties)}var Vn=function(e,t,i={}){const r=Dt(e).coordinates;let n=0;for(let e=0;e<r.length&&!(t>=n&&e===r.length-1);e++){if(n>=t){const o=t-n;if(o){const t=Nn(r[e],r[e-1])-180;return Bn(r[e],o,t,i)}return Mn(r[e])}n+=Dn(r[e],r[e+1],i)}return Mn(r[r.length-1])};class jn{static buildFromLine(e){const t=[];var i=e;"MultiLineString"===e.geometry.type&&(i={type:"Feature",geometry:{type:"LineString",coordinates:e.geometry.coordinates.flat()}});const r=function(e,t={}){return zn(e,((e,i)=>{const r=i.geometry.coordinates;return e+Dn(r[0],r[1],t)}),0)}(i,{units:"meters"});for(var n=500;n<r;n+=500){const e=Vn(i,n,{units:"meters"});e.properties.label=n/1e3+"km",t.push(e)}return{type:"FeatureCollection",features:t}}}var Un=i(181),Gn=i.n(Un);function $n(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var qn,Zn,Wn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Hn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Xn(){if(Zn)return qn;Zn=1,qn=function(){for(var t={},i=0;i<arguments.length;i++){var r=arguments[i];for(var n in r)e.call(r,n)&&(t[n]=r[n])}return t};var e=Object.prototype.hasOwnProperty;return qn}var Yn,Jn,Kn,Qn,eo,to,io,ro={exports:{}};function no(){return Yn||(Yn=1,e=ro,function(){var t={};e.exports=t,t.simpleFilter=function(e,i){return i.filter((function(i){return t.test(e,i)}))},t.test=function(e,i){return null!==t.match(e,i)},t.match=function(e,t,i){i=i||{};var r,n=0,o=[],s=t.length,a=0,l=0,c=i.pre||"",u=i.post||"",h=i.caseSensitive&&t||t.toLowerCase();e=i.caseSensitive&&e||e.toLowerCase();for(var d=0;d<s;d++)r=t[d],h[d]===e[n]?(r=c+r+u,n+=1,l+=1+l):l=0,a+=l,o[o.length]=r;return n===e.length?(a=h===e?1/0:a,{rendered:o.join(""),score:a}):null},t.filter=function(e,i,r){return i&&0!==i.length?"string"!=typeof e?i:(r=r||{},i.reduce((function(i,n,o,s){var a=n;r.extract&&(a=r.extract(n));var l=t.match(e,a,r);return null!=l&&(i[i.length]={string:l.rendered,score:l.score,index:o,original:n}),i}),[]).sort((function(e,t){return t.score-e.score||e.index-t.index}))):[]}}()),ro.exports;var e}var oo,so,ao,lo,co,uo,ho,po=Hn(function(){if(io)return to;io=1;var e=function(){if(eo)return Qn;eo=1;var e=Xn(),t=no(),i=function(){if(Kn)return Jn;Kn=1;var e=function(e){return this.component=e,this.items=[],this.active=e.options.noInitialSelection?-1:0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,e.el.parentNode.insertBefore(this.wrapper,e.el.nextSibling),this};return e.prototype.show=function(){this.element.style.display="block"},e.prototype.hide=function(){this.element.style.display="none"},e.prototype.add=function(e){this.items.push(e)},e.prototype.clear=function(){this.items=[],this.active=this.component.options.noInitialSelection?-1:0},e.prototype.isEmpty=function(){return!this.items.length},e.prototype.isVisible=function(){return"block"===this.element.style.display},e.prototype.draw=function(){if(this.element.innerHTML="",0!==this.items.length){for(var e=0;e<this.items.length;e++)this.drawItem(this.items[e],this.active===e);this.show()}else this.hide()},e.prototype.drawItem=function(e,t){var i=document.createElement("li"),r=document.createElement("a");t&&(i.className+=" active"),r.innerHTML=e.string,i.appendChild(r),this.element.appendChild(i),i.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),i.addEventListener("mouseup",function(){this.handleMouseUp.call(this,e)}.bind(this))},e.prototype.handleMouseUp=function(e){this.selectingListItem=!1,this.component.value(e.original),this.clear(),this.draw()},e.prototype.move=function(e){this.active=e,this.draw()},e.prototype.previous=function(){this.move(this.active<=0?this.items.length-1:this.active-1)},e.prototype.next=function(){this.move(this.active>=this.items.length-1?0:this.active+1)},e.prototype.drawError=function(e){var t=document.createElement("li");t.innerHTML=e,this.element.appendChild(t),this.show()},Jn=e}(),r=function(t,r,n){return n=n||{},this.options=e({minLength:2,limit:5,filter:!0,hideOnBlur:!0,noInitialSelection:!0}
2,n),this.el=t,this.data=r||[],this.list=new i(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(e){this.handleKeyUp(e.keyCode,e)}.bind(this),!1),this.el.addEventListener("keydown",function(e){this.handleKeyDown(e)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(e){this.handlePaste(e)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemValue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};return r.prototype.handleKeyUp=function(e,t){40!==e&&38!==e&&27!==e&&9!==e&&(13!==e?this.handleInputChange(this.el.value):this.list.items[this.list.active]&&(this.list.handleMouseUp(this.list.items[this.list.active]),t.stopPropagation()))},r.prototype.handleKeyDown=function(e){switch(e.keyCode){case 13:this.list.active>=0&&(this.list.selectingListItem=!0);break;case 9:this.list.isEmpty()||(this.list.isVisible()&&e.preventDefault(),this.value(this.list.active>=0?this.list.items[this.list.active].original:null),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},r.prototype.handleBlur=function(){!this.list.selectingListItem&&this.options.hideOnBlur&&this.list.hide()},r.prototype.handlePaste=function(e){if(e.clipboardData)this.handleInputChange(e.clipboardData.getData("Text"));else{var t=this;setTimeout((function(){t.handleInputChange(e.target.value)}),100)}},r.prototype.handleInputChange=function(e){this.query=this.normalize(e),this.list.clear(),this.query.length<this.options.minLength?this.list.draw():this.getCandidates(function(e){for(var t=0;t<e.length&&(this.list.add(e[t]),t!==this.options.limit-1);t++);this.list.draw()}.bind(this))},r.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},r.prototype.update=function(e){this.data=e,this.handleKeyUp()},r.prototype.clear=function(){this.data=[],this.list.clear()},r.prototype.normalize=function(e){return e.toLowerCase()},r.prototype.match=function(e,t){return e.indexOf(t)>-1},r.prototype.value=function(e){if(this.selected=e,this.el.value=this.getItemValue(e||{place_name:this.query}),document.createEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),this.el.dispatchEvent(t)}else this.el.fireEvent("onchange")},r.prototype.getCandidates=function(e){var i,r={pre:"<strong>",post:"</strong>",extract:function(e){return this.getItemValue(e)}.bind(this)};i=this.options.filter?(i=t.filter(this.query,this.data,r)).map(function(e){return{original:e.original,string:this.render(e.original,e.string)}}.bind(this)):this.data.map(function(e){return{original:e,string:this.render(e)}}.bind(this)),e(i)}
2,r.prototype.getItemValue=function(e){return e},r.prototype.render=function(e,t){if(t)return t;for(var i=e.original?this.getItemValue(e.original):this.getItemValue(e),r=this.normalize(i),n=r.lastIndexOf(this.query);n>-1;){var o=n+this.query.length;i=i.slice(0,n)+"<strong>"+i.slice(n,o)+"</strong>"+i.slice(o),n=r.slice(0,n).lastIndexOf(this.query)}return i},r.prototype.renderError=function(e){this.list.drawError(e)},Qn=r}();return to=e,"undefined"!=typeof window&&(window.Suggestions=e),to}()),fo={exports:{}},mo=(oo||(oo=1,ao=fo.exports,lo=function(){var e=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;function t(t){return t.match(e)||[]}function i(e){return{language:(e=t(e))[1]||"",extlang:e[2]||"",script:e[3]||"",region:e[4]||""}}function r(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:!0})}function n(e,n,o){function s(i){return t(i)[e]||""}r(s,"pattern",n),r(i,o,s)}return n(1,/^[a-zA-Z]{2,3}$/,"language"),n(2,/^[a-zA-Z]{3}$/,"extlang"),n(3,/^[a-zA-Z]{4}$/,"script"),n(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),r(i,"split",(function(e){return t(e).filter((function(e,t){return e&&t}))})),i},(so=fo).exports?so.exports=lo():ao.subtag=lo()),fo.exports),go=Hn(mo),yo=function(){if(uo)return co;uo=1;var e=/^\s+|\s+$/g,t=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,r=/^0o[0-7]+$/i,n=parseInt,o="object"==typeof Wn&&Wn&&Wn.Object===Object&&Wn,s="object"==typeof self&&self&&self.Object===Object&&self,a=o||s||Function("return this")(),l=Object.prototype.toString,c=Math.max,u=Math.min,h=function(){return a.Date.now()};function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function p(o){if("number"==typeof o)return o;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==l.call(e)}(o))return NaN;if(d(o)){var s="function"==typeof o.valueOf?o.valueOf():o;o=d(s)?s+"":s}if("string"!=typeof o)return 0===o?o:+o;o=o.replace(e,"");var a=i.test(o);return a||r.test(o)?n(o.slice(2),a?2:8):t.test(o)?NaN:+o}return co=function(e,t,i){var r,n,o,s,a,l,f=0,m=!1,g=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function _(t){var i=r,o=n;return r=n=void 0,f=t,s=e.apply(o,i)}function v(e){var i=e-l;return void 0===l||i>=t||i<0||g&&e-f>=o}function b(){var e=h();if(v(e))return x(e);a=setTimeout(b,function(e){var i=t-(e-l);return g?u(i,o-(e-f)):i}(e))}function x(e){return a=void 0,y&&r?_(e):(r=n=void 0,s)}function w(){var e=h(),i=v(e);if(r=arguments,n=this,l=e,i){if(void 0===a)return function(e){return f=e,a=setTimeout(b,t),m?_(e):s}(l);if(g)return a=setTimeout(b,t),_(l)}return void 0===a&&(a=setTimeout(b,t)),s}return t=p(t)||0,d(i)&&(m=!!i.leading,o=(g="maxWait"in i)?c(p(i.maxWait)||0,t):o,y="trailing"in i?!!i.trailing:y),w.cancel=function(){void 0!==a&&clearTimeout(a),f=0,r=l=n=a=void 0},w.flush=function(){return void 0===a?s:x(h())},w}}(),_o=Hn(yo),vo=Hn(Xn()),bo={exports:{}},xo=function(){if(ho)return bo.exports;ho=1;var e,t="object"==typeof Reflect?Reflect:null,i=t&&"function"==typeof t.apply?t.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function n(){n.init.call(this)}bo.exports=n,bo.exports.once=function(e,t){return new Promise((function(i,r){function n(i){e.removeListener(t,o),r(i)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}f(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&f(e,"error",t,{once:!0})}(e,n)}))},n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function a(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function l(e,t,i,r){var n,o,l,c;if(s(i),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),o=e._events),l=o[t]),void 0===l)l=o[t]=i,++e._eventsCount;else if("function"==typeof l?l=o[t]=r?[i,l]:[l,i]:r?l.unshift(i):l.push(i),(n=a(e))>0&&l.length>n&&!l.warned){l.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=l.length,c=u,console&&console.warn&&console.warn(c)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=c.bind(r);return n.listener=i,r.wrapFn=n,n}function h(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):p(n,n.length)}function d(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function p(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}function f(e,t,i,r){if("function"==typeof e.on)r.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(o){r.once&&e.removeEventListener(t,n),i(o)}))}}return Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return o}
2,set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),n.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},n.prototype.getMaxListeners=function(){return a(this)},n.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var c=l.length,u=p(l,c);for(r=0;r<c;++r)i(u[r],this,t)}return!0},n.prototype.addListener=function(e,t){return l(this,e,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(e,t){return l(this,e,t,!0)},n.prototype.once=function(e,t){return s(t),this.on(e,u(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,u(this,e,t)),this},n.prototype.removeListener=function(e,t){var i,r,n,o,a;if(s(t),void 0===(r=this._events))return this;if(void 0===(i=r[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(n=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,n=o;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,n),1===i.length&&(r[e]=i[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(e){var t,i,r;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var n,o=Object.keys(i);for(r=0;r<o.length;++r)"removeListener"!==(n=o[r])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},n.prototype.listeners=function(e){return h(this,e,!0)},n.prototype.rawListeners=function(e){return h(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},n.prototype.listenerCount=d,n.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},bo.exports}();const wo={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}};var To={placeholder:{de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"לחפש",ja:"サーチ",lv:"Meklēt",pt:"Procurar",sr:"Претрага",zh:"搜索",cs:"Vyhledávání",hu:"Keresés",ka:"ძიება",nb:"Søke",sk:"Vyhľadávanie",th:"ค้นหา",fi:"Hae",is:"Leita",ko:"수색",pl:"Szukaj",sl:"Iskanje",fa:"جستجو",ru:"Поиск",es:"Buscar"},errorNoResults:{en:"No results found",de:"Keine Ergebnisse gefunden",es:"No hay resultados"},errorConnectionFailed:{en:"There was an error reaching the server",de:"Verbindung fehlgeschlagen",es:"Error al conectarse al servidor"}};const Eo=/(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/;class So{constructor(e,t){this.options={zoom:16,flyTo:!0,trackProximity:!0,showResultsWhileTyping:!1,minLength:2,reverseGeocode:!1,limit:5,enableEventLogging:!0,marker:!0,popup:!1,maplibregl:void 0,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,proximityMinZoom:9,getItemV
2alue:e=>void 0!==e.text?e.text:e.place_name,render:function(e){if(!e.geometry){const t=e.text,i=t.toLowerCase().indexOf(this.query.toLowerCase()),r=this.query.length;return'<div class="maplibregl-ctrl-geocoder--suggestion"><svg class="maplibregl-ctrl-geocoder--suggestion-icon" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M22.8702 20.1258H21.4248L20.9125 19.6318C22.7055 17.546 23.785 14.8382 23.785 11.8925C23.785 5.32419 18.4608 0 11.8925 0C5.32419 0 0 5.32419 0 11.8925C0 18.4608 5.32419 23.785 11.8925 23.785C14.8382 23.785 17.546 22.7055 19.6318 20.9125L20.1258 21.4248V22.8702L29.2739 32L32 29.2739L22.8702 20.1258ZM11.8925 20.1258C7.33676 20.1258 3.65923 16.4483 3.65923 11.8925C3.65923 7.33676 7.33676 3.65923 11.8925 3.65923C16.4483 3.65923 20.1258 7.33676 20.1258 11.8925C20.1258 16.4483 16.4483 20.1258 11.8925 20.1258Z" fill="#687078"/></svg><div class="maplibregl-ctrl-geocoder--suggestion-info"><div class="maplibregl-ctrl-geocoder--suggestion-title">'+t.substring(0,i)+'<span class="maplibregl-ctrl-geocoder--suggestion-match">'+t.substring(i,i+r)+"</span>"+t.substring(i+r)+"</div></div></div>"}const t=e.place_name.split(",");return'<div class="maplibregl-ctrl-geocoder--result"><svg class="maplibregl-ctrl-geocoder--result-icon" viewBox="0 0 24 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 0C5.36571 0 0 5.38676 0 12.0471C0 21.0824 12 32 12 32C12 32 24 21.0824 24 12.0471C24 5.38676 18.6343 0 12 0ZM12 16.3496C9.63428 16.3496 7.71429 14.4221 7.71429 12.0471C7.71429 9.67207 9.63428 7.74454 12 7.74454C14.3657 7.74454 16.2857 9.67207 16.2857 12.0471C16.2857 14.4221 14.3657 16.3496 12 16.3496Z" fill="#687078"/></svg><div><div class="maplibregl-ctrl-geocoder--result-title">'+t[0]+'</div><div class="maplibregl-ctrl-geocoder--result-address">'+t.splice(1,t.length).join(",")+"</div></div></div>"},popupRender:e=>{const t=e.place_name.split(",");return'<div class="maplibregl-ctrl-geocoder--suggestion popup-suggestion"><div class="maplibregl-ctrl-geocoder--suggestion-title popup-suggestion-title">'+t[0]+'</div><div class="maplibregl-ctrl-geocoder--suggestion-address popup-suggestion-address">'+t.splice(1,t.length).join(",")+"</div></div>"},showResultMarkers:!0,debounceSearch:200},this._eventEmitter=new xo.EventEmitter,this.options=vo({},this.options,t),this.fresh=!0,this.lastSelected=null,this.geocoderApi=e}addTo(e){function t(e,t){if(!document.body.contains(t))throw new Error("Element provided to #addTo() exists, but is not in the DOM");const i=e.onAdd();t.appendChild(i)}if(e instanceof HTMLElement)t(this,e);else if("string"==typeof e){const i=document.querySelectorAll(e);if(0===i.length)throw new Error("Element "+e+"not found.");if(i.length>1)throw new Error("Geocoder can only be added to a single html element");t(this,i[0])}else{if(!("addControl"in e))throw new Error("Error: addTo must be a maplibre-gl-js map, an html element, or a CSS selector query for a single html element");e.addControl(this)}}onAdd(e){if(e&&"string"!=typeof e&&(this._map=e),this.setLanguage(),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this);const t=this.container=document.createElement("div");t.className="maplibregl-ctrl-geocoder maplibregl-ctrl maplibregl-ctrl-geocoder maplibregl-ctrl";const i=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="maplibregl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",_o(this._onKeyDown,this.options.debounceSearch)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton);const r=document.createElement("div");r.classList.add("maplibregl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("type","button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="maplibregl-ctrl-geocoder--button";const n=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');return this._clearEl.appendChild(n),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.
26 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),r.appendChild(this._clearEl),r.appendChild(this._loadingEl),t.appendChild(i),t.appendChild(this._inputEl),t.appendChild(r),this._typeahead=new po(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit,noInitialSelection:!0}),this.container.addEventListener("click",(()=>{this._typeahead.update(this._typeahead.data)})),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,this.mapMarker=null,this.resultMarkers=[],this._handleMarker=this._handleMarker.bind(this),this._handleResultMarkers=this._handleResultMarkers.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._maplibregl=this.options.maplibregl,!this._maplibregl&&this.options.marker&&(console.error("No maplibregl detected in options. Map markers are disabled. Please set options.maplibregl."),this.options.marker=!1)),t}createIcon(e,t){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i.setAttribute("class","maplibregl-ctrl-geocoder--icon maplibregl-ctrl-geocoder--icon-"+e),i.setAttribute("viewBox","0 0 18 18"),i.setAttribute("xml:space","preserve"),i.setAttribute("width","18"),i.setAttribute("height","18"),"innerHTML"in i)i.innerHTML=t;else{const e=document.createElement("div");e.innerHTML="<svg>"+t.valueOf().toString()+"</svg>";const r=e.firstChild.firstChild;i.appendChild(r)}return i}onRemove(){return this.container.remove(),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this}_onPaste(e){const t=(e.clipboardData||window.clipboardData).getData("text");t.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(t)}_onKeyDown(e){const t=27,i=9;if(e.keyCode===t&&this.options.clearAndBlurOnEsc)return this._clear(e),this._inputEl.blur();const r=this._inputEl.value;if(!r)return this.fresh=!0,e.keyCode!==i&&this.clear(e),this._clearEl.style.display="none";if(!e.metaKey&&-1===[i,t,37,39,38,40].indexOf(e.keyCode)){if(13===e.keyCode){if(this.options.showResultsWhileTyping)return void(null==this._typeahead.selected&&this.geocoderApi.getSuggestions?this._geocode(r,!0):null==this._typeahead.selected&&this.options.showResultMarkers&&this._fitBoundsForMarkers());this._typeahead.selected||this._geocode(r)}r.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(r)}}_showButton(){this._inputEl.value.length>0&&(this._clearEl.style.display="block")}_hideButton(){this._typeahead.selected&&(this._clearEl.style.display="none")}_onBlur(e){this.options.clearOnBlur&&this._clearOnBlur(e),this.options.collapsed&&this._collapse()}_onChange(){const e=this._typeahead.selected;if(e&&!e.geometry)e.placeId?this._geocode(e.placeId,!0,!0):this._geocode(e.text,!0);else if(e&&JSON.stringify(e)!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){let t;if(this._removeResultMarkers(),e.properties&&wo[e.properties.short_code])t=vo({},this.options.flyTo),this._map&&this._map.fitBounds(wo[e.properties.short_code].bbox,t);else if(e.bbox){const i=e.bbox;t=vo({},this.options.flyTo),this._map&&this._map.fitBounds([[i[0],i[1]],[i[2],i[3]]],t)}else{const i={zoom:this.options.zoom};t=vo({},i,this.options.flyTo),e.center?t.center=e.center:e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&(t.center=e.geometry.coordinates),this._map&&this._map.flyTo(t)}}this.options.marker&&this._maplibregl&&this._handleMarker(e),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(e),this._typeahead.selected=null,this._eventEmitter.emit("result",{result:e})}}_getConfigForRequest(){return["bbox","limit","proximity","countries","types","language","reverseMode"].reduce(((e,t)=>(this.options[t]&&(["countries","types","language"].indexOf(t)>-1?e[t]=this.options[t].split(/[\s,]+/):e[t]=this.options[t],"proximity"===t&&this.options[t]&&"number"==typeof this.options[t].longitude&&"number"==typeof this.options[t].latitude&&(e[t]=[this.options[t].longitude,this.options[t].latitude])),e)),{})}_geocode(e){return $n(this,arguments,void 0,(function*(e,t=!1,i=!1){this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:e});const r=this._getConfigForRequest(),n=this._createGeocodeRequest
2(r,e,t,i),o=this.options.localGeocoder&&this.options.localGeocoder(e)||[];try{const i=yield n;yield this._handleGeocodeResponse(i,r,e,t,o)}catch(e){this._handleGeocodeErrorResponse(e,o)}return n}))}_createGeocodeRequest(e,t,i,r){return this.options.localGeocoderOnly?Promise.resolve({}):this.options.reverseGeocode&&Eo.test(t)?this._createReverseGeocodeRequest(t,e):(e.query=t,this.geocoderApi.getSuggestions?i?this.geocoderApi.searchByPlaceId&&r?this.geocoderApi.searchByPlaceId(e):this.geocoderApi.forwardGeocode(e):this.geocoderApi.getSuggestions(e):this.geocoderApi.forwardGeocode(e))}_createReverseGeocodeRequest(e,t){const i=e.split(/[\s(,)?]+/).map((e=>parseFloat(e))).reverse();return t.query=i,t.limit=1,"proximity"in t&&delete t.proximity,this.geocoderApi.reverseGeocode(t)}_handleGeocodeResponse(e,t,i,r,n){return $n(this,void 0,void 0,(function*(){this._loadingEl.style.display="none";let o={};o=e||{type:"FeatureCollection",features:[]},o.config=t,this.fresh&&(this.fresh=!1),o.features=o.features?n.concat(o.features):n;const s=this.options.externalGeocoder&&this.options.externalGeocoder(i,o.features,t)||Promise.resolve([]);try{const e=yield s;o.features=o.features?e.concat(o.features):e}catch(e){}this.options.filter&&o.features.length&&(o.features=o.features.filter(this.options.filter));let a=[];a="suggestions"in o?o.suggestions:"place"in o?[o.place]:o.features,a.length?(this._clearEl.style.display="block",this._typeahead.update(a),(!this.options.showResultsWhileTyping||r)&&this.options.showResultMarkers&&(o.features.length>0||"place"in o)&&this._fitBoundsForMarkers(),this._eventEmitter.emit("results",o)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",o))}))}_handleGeocodeErrorResponse(e,t){this._loadingEl.style.display="none",t.length&&this.options.localGeocoder?(this._clearEl.style.display="block",this._typeahead.update(t)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:t}),this._eventEmitter.emit("error",{error:e})}_clear(e){e&&e.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._clearEl.style.display="none",this._removeMarker(),this._removeResultMarkers(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0}clear(e){this._clear(e),this._inputEl.focus()}_clearOnBlur(e){e.relatedTarget&&this._clear(e)}_onQueryResult(e){if(!("features"in e))return;if(!e.features.length)return;const t=e.features[0];this._typeahead.selected=t,this._inputEl.value=t.place_name,this._onChange()}_updateProximity(){if(this._map)if(this._map.getZoom()>this.options.proximityMinZoom){const e=this._map.getCenter().wrap();this.setProximity({longitude:e.lng,latitude:e.lat})}else this.setProximity(null)}_collapse(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("maplibregl-ctrl-geocoder--collapsed")}_unCollapse(){this.container.classList.remove("maplibregl-ctrl-geocoder--collapsed")}query(e){return $n(this,void 0,void 0,(function*(){const t=yield this._geocode(e);this._onQueryResult(t)}))}_renderError(){const e=`<div class='maplibre-gl-geocoder--error'>${this._localize("errorConnectionFailed")}</div>`;this._renderMessage(e)}_renderNoResults(){const e=`<div class='maplibre-gl-geocoder--error maplibre-gl-geocoder--no-results'>\n        ${this._localize("errorNoResults")}</div>`;this._renderMessage(e)}_renderMessage(e){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(e)}_localize(e){const t=go.language(this.options.language.split(",")[0]);return this.options.language&&(null==To?void 0:To[e][t])?To[e][t]:To[e].en}_fitBoundsForMarkers(){if(this._typeahead.data.length<1)return;const e=this._typeahead.data.filter((e=>"string"!=typeof e)).slice(0,this.options.limit);if(this._clearEl.style.display="none",this.options.flyTo&&this._maplibregl&&this._map){const t=vo({},{padding:100},this.options.flyTo),i=new this._maplibregl.LngLatBounds;for(const t of e)i.extend(t.geometry.coordinates);this._map.fitBounds(i,t)}return e.length>0&&this._maplibregl&&this._handleResultMarkers(e),this}setInput(e){return this._inputEl.value=e,this._typeahead.selected=null,this._typeahead.clear(),e.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(e),this}setProximity(e){return this.options.proximity=e,this}getProximity(){return this.options.proximity}setRenderFunction(e){return e&&"function"==typeof e&&(this._typeahead.render=e),this}getRenderFunction(){return this._typeahead.render}setLanguage(e){return this.options.language=e||this.options.language||navigator.language,this}getLanguage(){return this.options.language}getZoom(){return this.options.zoom}setZoom(e){return this.options.zoom=e,this}getFlyTo(){return this.options.flyTo}setFlyTo(e){return this.options.flyTo=e,this}getPlaceholder(){return this.options.placeholder}setPlaceholder(e){return this.placeholder=e||this.options.placeholder||this._localize("placeholder"),this._inputEl.placeholder=this.placeholder,this._inputEl.setAttribute("aria-label",this.placeholder),this}getBbox(){return this.options.bbox}setBbox(e){return this.options.bbox=e,this}getCountries(){return this.options.countries}setCountries(e){return this.options.countries=e,this}getTypes(){return this.options.types}setTypes(e){return this.options.types=e,this}getMinLength(){return this.options.minLength}setMinLength(e){return this.options.minLength=e,this._typeahead&&(this._typeahead.options.minLength=e),this}getLimit(){return this.options.limit}setLimit(e){return this.options.limit=e,this._typeahead&&(this._typeahead.options.limit=e),this}getFilter(){return this.options.filter}setFilter(e){return this.options.filter=e,this}setGeocoderApi(e){return this.geocoderApi=e,this}getGeocoderApi(){return this.geocoderApi}_handleMarker(e){if(!this._map)return;this._removeMarker();const t=vo({},{color:"#4668F2"},this.options.marker);let i;if(this.mapMarker=new this._maplibregl.Marker(t),this.options.popup){const t=vo({},{},this.options.popup);i=new this._maplibregl.Popup(t).setHTML(this.options.popupRender(e))}return e.center?(this.mapMarker.setLngLat(e.center).addTo(this._map),this.options.popup&&this.mapMarker.setPopup(i)):e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&(this.mapMarker.setLngLat(e.geometry.coordinates).addTo(this._map),this.options.popup&&this.mapMarker.setPopup(i)),this}_removeMarker(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)}_handleResultMarkers(e){if(!this._map)return;this._removeResultMarkers();let t=vo({},{color:"#4668F2"},this.options.showResultMarkers);for(const i of e){let e;if(this.options.showResultMarkers){this.options.showResultMarkers&&this.options.showResultMarkers.element&&(e=this.options.showResultMarkers.element.cloneNode(!0),t=vo(t,{element:e}));const r=new this._maplibregl.Marker(vo({},t,{element:e}));let n;if(this.options.popup){const e=vo({},{},this.options.popup);n=new this._maplibregl.Popup(e).setHTML(this.options.popupRender(i))}i.center?(r.setLngLat(i.center).addTo(this._map),this.options.popup&&r.setPopup(n)):i.geometry&&i.geometry.type&&"Point"===i.geometry.type&&i.geometry.coordinates&&(r.setLngLat(i.geometry.coordinates).addTo(this._map),this.options.popup&&r.setPopup(n)),this.resultMarkers.push(r)}}return this}_removeResultMarkers(){this.resultMarkers&&this.resultMarkers.length>
20&&(this.resultMarkers.forEach((function(e){e.remove()})),this.resultMarkers=[])}on(e,t){return this._eventEmitter.on(e,t),this}once(e){return new Promise((t=>{this._eventEmitter.once(e,t)}))}off(e,t){return this._eventEmitter.removeListener(e,t),this}}var Po,Io,Co,Mo=i(254),Ao=i.n(Mo);function Lo(e){const t=new(vt().LngLatBounds);return e.features.forEach((e=>{if(!e.geometry)return;let i=[];switch(e.geometry.type){case"Point":i=[e.geometry.coordinates];break;case"MultiPoint":case"LineString":i=e.geometry.coordinates;break;case"MultiLineString":case"Polygon":i=e.geometry.coordinates.flat();break;case"MultiPolygon":i=e.geometry.coordinates.flat(2);break;default:console.warn("Unsupported geometry type:",e.geometry.type)}i.forEach((e=>t.extend(e)))})),t}function Fo(e,t){if(Po)if(Io){var i="var sharedChunk = {}; ("+Po+")(sharedChunk); ("+Io+")(sharedChunk);",r={};Po(r),Co=t(r),"undefined"!=typeof window&&(Co.workerUrl=window.URL.createObjectURL(new Blob([i],{type:"text/javascript"})))}else Io=t;else Po=t}Fo(0,(function(e){class t{constructor(e,t){this.start=e,this.end=t,this.points=[],this.append=this.append.bind(this),this.prepend=this.prepend.bind(this)}append(e,t){this.points.push(Math.round(e),Math.round(t))}prepend(e,t){this.points.splice(0,0,Math.round(e),Math.round(t))}lineString(){return this.toArray()}isEmpty(){return this.points.length<2}appendFragment(e){this.points.push(...e.points),this.end=e.end}toArray(){return this.points}}const i=[[],[[[1,2],[0,1]]],[[[2,1],[1,2]]],[[[2,1],[0,1]]],[[[1,0],[2,1]]],[[[1,2],[0,1]],[[1,0],[2,1]]],[[[1,0],[1,2]]],[[[1,0],[0,1]]],[[[0,1],[1,0]]],[[[1,2],[1,0]]],[[[0,1],[1,0]],[[2,1],[1,2]]],[[[2,1],[1,0]]],[[[0,1],[2,1]]],[[[1,2],[2,1]]],[[[0,1],[1,2]]],[]];function r(e,t,i,r){return(t=2*t+r[0])+(i=2*i+r[1])*(e+1)*2}function n(e,t,i){return(t-e)/(i-e)}function o(e,o,s=4096,a=1){if(!e)return{};const l=s/(o.width-1);let c,u,h,d,p,f;const m={},g=new Map,y=new Map;function _(e,t,i){0===e[0]?i(l*(f-1),l*(p-n(h,t,c))):2===e[0]?i(l*f,l*(p-n(d,t,u))):0===e[1]?i(l*(f-n(u,t,c)),l*(p-1)):i(l*(f-n(d,t,h)),l*p)}for(p=1-a;p<o.height+a;p++){u=o.get(0,p-1),d=o.get(0,p);let n=Math.min(u,d),s=Math.max(u,d);for(f=1-a;f<o.width+a;f++){c=u,h=d,u=o.get(f,p-1),d=o.get(f,p);const a=n,l=s;if(n=Math.min(u,d),s=Math.max(u,d),isNaN(c)||isNaN(u)||isNaN(d)||isNaN(h))continue;const v=Math.min(a,n),b=Math.max(l,s),x=Math.ceil(v/e)*e,w=Math.floor(b/e)*e;for(let n=x;n<=w;n+=e){const e=c>n,s=u>n,a=h>n,l=d>n;for(const c of i[(e?8:0)|(s?4:0)|(l?2:0)|(a?1:0)]){let e=g.get(n);e||g.set(n,e=new Map);let i=y.get(n);i||y.set(n,i=new Map);const s=c[0],a=c[1],l=r(o.width,f,p,s),u=r(o.width,f,p,a);let h,d;if(h=i.get(l))if(i.delete(l),d=e.get(u))if(e.delete(u),h===d){if(_(a,n,h.append),!h.isEmpty()){let e=m[n];e||(m[n]=e=[]),e.push(h.lineString())}}else h.appendFragment(d),i.set(h.end=d.end,h);else _(a,n,h.append),i.set(h.end=u,h);else if(h=e.get(u))e.delete(u),_(s,n,h.prepend),e.set(h.start=l,h);else{const r=new t(l,u);_(s,n,r.append),_(a,n,r.append),e.set(l,r),i.set(u,r)}}}}}for(const[e,t]of g.entries()){let i=null;for(const r of t.values())r.isEmpty()||(null==i&&(i=m[e]||(m[e]=[])),i.push(r.lineString()))}return m}function s(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i}function a(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}function l(e){const t=Object.entries(e);return t.sort((([e],[t])=>e<t?-1:e>t?1:0)),t}function c(e){return l(e).map((([e,t])=>[e,..."number"==typeof t?[t]:t].join("*"))).join("~")}function u(e){return l(e).map((([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join(",")}let h=null;function d(){return null==h&&(h="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),h||!1}let p=null;function f(e,t,i){let r=()=>{};const n=setTimeout((()=>{r(new Error("timed out")),null==i||i.abort()}),e);m(i,(()=>{r(new Error("aborted")),clearTimeout(n)}));const o=new Promise(((e,t)=>{r=t}));return Promise.race([o,t.finally((()=>clearTimeout(n)))])}function m(e,t){t&&(null==e||e.signal.addEventListener("abort",t))}function g(e){var t;return Boolean(null===(t=null==e?void 0:e.signal)||void 0===t?void 0:t.aborted)}let y,_,v,b,x=0;class w{constructor(e=100){this.size=()=>this.items.size,this.get=(e,t,i)=>{let r=this.items.get(e);if(r)r.lastUsed=++x,r.waiting++;else{const i=new AbortController,n=t(e,i);r={abortController:i,item:n,lastUsed:++x,waiting:1},this.items.set(e,r),this.prune()}const n=this.items,o=r.item.then((e=>e),(t=>(n.delete(e),Promise.reject(t))));let s=!1;return m(i,(()=>{var t;r&&r.abortController&&!s&&(s=!0,--r.waiting<=0&&(null===(t=r.abortController)||void 0===t||t.abort(),n.delete(e)))})),o},this.clear=()=>this.items.clear(),this.maxSize=e,this.items=new Map}
2prune(){if(this.items.size>this.maxSize){let e,t=1/0;this.items.forEach(((i,r)=>{i.lastUsed<t&&(t=i.lastUsed,e=r)})),void 0!==e&&this.items.delete(e)}}}function T(e,t){return y||(y=new OffscreenCanvas(e.width,e.height),_=y.getContext("2d",{willReadFrequently:!0})),S(e,t,y,_)}const E=function(){if(null==p&&(p=!1,d()&&"undefined"!=typeof VideoFrame)){const e=5,t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let i=0;i<e*e;i++){const r=4*i;t.fillStyle=`rgb(${r},${r+1},${r+2})`,t.fillRect(i%e,Math.floor(i/e),1,1)}const i=t.getImageData(0,0,e,e).data;for(let t=0;t<e*e*4;t++)if(t%4!=3&&i[t]!==t){p=!0;break}}}return p||!1}()?function(e,t,i){return a(this,void 0,void 0,(function*(){var r,n,o;const s=yield createImageBitmap(e);if(g(i))return null;const a=new VideoFrame(s,{timestamp:0});try{if(!(null===(r=null==a?void 0:a.format)||void 0===r?void 0:r.startsWith("BGR"))&&!(null===(n=null==a?void 0:a.format)||void 0===n?void 0:n.startsWith("RGB")))throw new Error(`Unrecognized format: ${null==a?void 0:a.format}`);const e=null===(o=null==a?void 0:a.format)||void 0===o?void 0:o.startsWith("BGR"),i=a.allocationSize(),l=new Uint8ClampedArray(i);if(yield a.copyTo(l),e)for(let e=0;e<l.length;e+=4){const t=l[e];l[e]=l[e+2],l[e+2]=t}return P(s.width,s.height,t,l)}catch(e){return g(i)?null:T(s,t)}finally{a.close()}}))}:d()?function(e,t,i){return a(this,void 0,void 0,(function*(){const r=yield createImageBitmap(e);return g(i)?null:T(r,t)}))}:"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope?function(e,t,i){return self.actor.send("decodeImage",[],i,void 0,e,t)}:function(e,t,i){return a(this,void 0,void 0,(function*(){v||(v=document.createElement("canvas"),b=v.getContext("2d",{willReadFrequently:!0}));const r=new Image;return m(i,(()=>r.src="")),S(yield new Promise(((t,n)=>{r.onload=()=>{g(i)||t(r),URL.revokeObjectURL(r.src),r.onload=null},r.onerror=()=>n(new Error("Could not load image.")),r.src=e.size?URL.createObjectURL(e):""})),t,v,b)}))};function S(e,t,i,r){if(i.width=e.width,i.height=e.height,!r)throw new Error("failed to get context");r.drawImage(e,0,0,e.width,e.height);const n=r.getImageData(0,0,e.width,e.height).data;return P(e.width,e.height,t,n)}function P(e,t,i,r){const n="mapbox"===i?(e,t,i)=>.1*(256*e*256+256*t+i)-1e4:(e,t,i)=>256*e+t+i/256-32768,o=new Float32Array(e*t);for(let e=0;e<r.length;e+=4)o[e/4]=n(r[e],r[e+1],r[e+2]);return{width:e,height:t,data:o}}class I{constructor(e,t,i){this.split=(e,t,i)=>{if(0===e)return this;const r=1<<e,n=t*this.width/r,o=i*this.height/r;return new I(this.width/r,this.height/r,((e,t)=>this.get(e+n,t+o)))},this.subsamplePixelCenters=e=>{const t=(e,t,i)=>isNaN(e)?t:isNaN(t)?e:e+(t-e)*i;if(e<=1)return this;const i=.5-1/(2*e);return new I(this.width*e,this.height*e,((r,n)=>{const o=r/e-i,s=n/e-i,a=Math.floor(o),l=Math.floor(s),c=this.get(a,l),u=this.get(a+1,l),h=this.get(a,l+1),d=this.get(a+1,l+1),p=o-a,f=s-l,m=t(c,u,p),g=t(h,d,p);return t(m,g,f)}))},this.averagePixelCentersToGrid=(e=1)=>new I(this.width+1,this.height+1,((t,i)=>{let r=0,n=0,o=0;for(let s=t-e;s<t+e;s++)for(let t=i-e;t<i+e;t++)isNaN(o=this.get(s,t))||(n++,r+=o);return 0===n?NaN:r/n})),this.scaleElevation=e=>1===e?this:new I(this.width,this.height,((t,i)=>this.get(t,i)*e)),this.materialize=(e=2)=>{const t=this.width+2*e,i=new Float32Array(t*(this.height+2*e));let r=0;for(let t=-e;t<this.height+e;t++)for(let n=-e;n<this.width+e;n++)i[r++]=this.get(n,t);return new I(this.width,this.height,((r,n)=>i[(n+e)*t+r+e]))},this.get=i,this.width=e,this.height=t}static fromRawDem(e){return new I(e.width,e.height,((t,i)=>{const r=e.data[i*e.width+t];return n=r,!isNaN(n)&&n>=-12e3&&n<=9e3?r:NaN;var n}))}
2static combineNeighbors(e){if(9!==e.length)throw new Error("Must include a tile plus 8 neighbors");const t=e[4];if(!t)return;const i=t.width,r=t.height;return new I(i,r,((t,n)=>{let o=0;n<0?n+=r:n<r?o+=3:(n-=r,o+=6),t<0?t+=i:t<i?o+=1:(t-=i,o+=2);const s=e[o];return s?s.get(t,n):NaN}))}}const C=4294967296,M=1/C,A="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class L{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){const i=this.readVarint(),r=i>>3,n=this.pos;this.type=7&i,e(r,t,this),this.pos===n&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*C;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*C;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,r;return r=t[this.pos++],i=127&r,r<128?i:(r=t[this.pos++],i|=(127&r)<<7,r<128?i:(r=t[this.pos++],i|=(127&r)<<14,r<128?i:(r=t[this.pos++],i|=(127&r)<<21,r<128?i:(r=t[this.pos],i|=(15&r)<<28,function(e,t,i){const r=i.buf;let n,o;if(o=r[i.pos++],n=(112&o)>>4,o<128)return F(e,n,t);if(o=r[i.pos++],n|=(127&o)<<3,o<128)return F(e,n,t);if(o=r[i.pos++],n|=(127&o)<<10,o<128)return F(e,n,t);if(o=r[i.pos++],n|=(127&o)<<17,o<128)return F(e,n,t);if(o=r[i.pos++],n|=(127&o)<<24,o<128)return F(e,n,t);if(o=r[i.pos++],n|=(1&o)<<31,o<128)return F(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(i,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&A?A.decode(this.buf.subarray(t,e)):function(e,t,i){let r="",n=t;for(;n<i;){const t=e[n];let o,s,a,l=null,c=t>239?4:t>223?3:t>191?2:1;if(n+c>i)break;1===c?t<128&&(l=t):2===c?(o=e[n+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&(l=(15&t)<<12|(63&o)<<6|63&s,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[n+1],s=e[n+2],a=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&t)<<18|(63&o)<<12|(63&s)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=c}return r}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}
vendor: 4,393 bytes, line 2
2writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*M),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*M),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(i=~(-e%4294967296),r=~(-e/4294967296),4294967295^i?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos]=127&e}(i,0,t),function(e,t){const i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,i){for(let r,n,o=0;o<t.length;o++){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);const i=this.pos-t;i>=128&&D(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const r=this.pos-i;r>=128&&D(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,k,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,O,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,N,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,R,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,z,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,B,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,V,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,j,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,U,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function F(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function D(e,t,i){const r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(let t=i.pos-1;t>=e;t--)i.buf[t+r]=i.buf[t]}function k(e,t){for(let i=0;i<e.length;i++)t.writeVarint(e[i])}function O(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function R(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function z(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function N(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function B(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function V(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function j(e,t){for(let i=0;i<e.length;
2i++)t.writeFixed64(e[i])}function U(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}var G;function $(e,t){if(!t)throw new Error("pbf undefined");t.writeVarintField(15,2),t.writeStringField(1,e.id||""),t.writeVarintField(5,e.extent||4096);const i={keys:[],values:[],keycache:{},valuecache:{}};for(const r of e.features)i.feature=r,t.writeMessage(2,q,i);for(const e of i.keys)t.writeStringField(3,e);for(const e of i.values)t.writeMessage(4,Y,e)}function q(e,t){const i=e.feature;if(!i||!t)throw new Error;t.writeMessage(2,Z,e),t.writeVarintField(3,i.type),t.writeMessage(4,X,i)}function Z(e,t){const i=e.feature;if(!i||!t)throw new Error;const r=e.keys,n=e.values,o=e.keycache,s=e.valuecache;for(const e in i.properties){let a=i.properties[e],l=o[e];if(null===a)continue;void 0===l&&(r.push(e),l=r.length-1,o[e]=l),t.writeVarint(l);const c=typeof a;"string"!==c&&"boolean"!==c&&"number"!==c&&(a=JSON.stringify(a));const u=`${c}:${a}`;let h=s[u];void 0===h&&(n.push(a),h=n.length-1,s[u]=h),t.writeVarint(h)}}function W(e,t){return(t<<3)+(7&e)}function H(e){return e<<1^e>>31}function X(e,t){if(!t)throw new Error;const i=e.geometry,r=e.type;let n=0,o=0;for(const e of i){let i=1;r===G.POINT&&(i=e.length/2),t.writeVarint(W(1,i));const s=e.length/2,a=r===G.POLYGON?s-1:s;for(let i=0;i<a;i++){1===i&&1!==r&&t.writeVarint(W(2,a-1));const s=e[2*i]-n,l=e[2*i+1]-o;t.writeVarint(H(s)),t.writeVarint(H(l)),n+=s,o+=l}r===G.POLYGON&&t.writeVarint(W(7,1))}}function Y(e,t){if(!t)throw new Error;"string"==typeof e?t.writeStringField(1,e):"boolean"==typeof e?t.writeBooleanField(7,e):"number"==typeof e&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.POINT=1]="POINT",e[e.LINESTRING=2]="LINESTRING",e[e.POLYGON=3]="POLYGON"}(G||(G={}));const J="undefined"!=typeof performance?performance:void 0,K=J?J.timeOrigin||(new Date).getTime()-J.now():(new Date).getTime();function Q(e){var t;return JSON.parse(JSON.stringify((null===(t=null==J?void 0:J.getEntriesByName)||void 0===t?void 0:t.call(J,e))||[]))}function ee(){return J?J.now():(new Date).getTime()}function te(e){const t=[];for(const i of e)t.push(...i);return t}class ie{constructor(e){this.marks={},this.urls=[],this.fetched=[],this.resources=[],this.tilesFetched=0,this.timeOrigin=K,this.finish=e=>{this.markFinish();const t=e=>{const t=this.marks[e]||[],i=Math.max(...t.map((e=>Math.max(...e)))),r=Math.min(...t.map((e=>Math.min(...e))));return Number.isFinite(i)?i-r:void 0},i=t("main")||0,r=t("fetch"),n=t("decode"),o=t("isoline");return{url:e,tilesUsed:this.tilesFetched,origin:this.timeOrigin,marks:this.marks,resources:[...this.resources,...te(this.fetched.map(Q))],duration:i,fetch:r,decode:n,process:o,wait:i-(r||0)-(n||0)-(o||0)}},this.error=e=>Object.assign(Object.assign({},this.finish(e)),{error:!0}),this.marker=e=>{var t;this.marks[e]||(this.marks[e]=[]);const i=[ee()];return null===(t=this.marks[e])||void 0===t||t.push(i),()=>i.push(ee())},this.useTile=e=>{this.urls.indexOf(e)<0&&(this.urls.push(e),this.tilesFetched++)},this.fetchTile=e=>{this.fetched.indexOf(e)<0&&this.fetched.push(e)},this.addAll=e=>{var t;this.tilesFetched+=e.tilesUsed;const i=e.origin-this.timeOrigin;for(const r in e.marks){const n=r;(this.marks[n]||(this.marks[n]=[])).push(...(null===(t=e.marks[n])||void 0===t?void 0:t.map((e=>e.map((e=>e+i)))))||[])}this.resources.push(...e.resources.map((e=>function(e,t){const i={};for(const r in e)0!==e[r]&&re.test(r)?i[r]=Number(e[r])+t:i[r]=e[r];return i}(e,i))))},this.markFinish=this.marker(e)}}const re=/(Start$|End$|^start|^end)/,ne=(e,t)=>a(void 0,void 0,void 0,(function*(){const i={signal:t.signal},r=yield fetch(e,i);if(!r.ok)throw new Error(`Bad response: ${r.status} for ${e}`);return{data:yield r.blob(),expires:r.headers.get("expires")||void 0,cacheControl:r.headers.get("cache-control")||void 0}}));let oe=0;e.A=class{constructor(e,t,i=2e4){this.callbacks={},this.cancels={},this.dest=e,this.timeoutMs=i,this.dest.onmessage=e=>a(this,[e],void 0,(function*({data:e}){const i=e;if("cancel"===i.type){const e=this.cancels[i.id];delete this.cancels[i.id],null==e||e.abort()}else if("response"===i.type){const e=this.callbacks[i.id];delete this.callbacks[i.id],e&&e(i.error?new Error(i.error):void 0,i.response,i.timings)}else if("request"===i.type){const e=new ie("worker"),r=t[i.name],n=new AbortController,o=r.apply(r,[...i.args,n,e]),s=`${i.name}_${i.id}`;if(i.id&&o){this.cancels[i.id]=n;try{const t=yield o,r=null==t?void 0:t.transferrables;this.postMessage({id:i.id,type:"response",response:t,timings:e.finish(s)},r)}catch(t){this.postMessage({id:i.id,type:"response",error:(null==t?void 0:t.toString())||"error",timings:e.finish(s)})}delete this.cancels[i.id]}}}))}postMessage(e,t){this.dest.postMessage(e,t||[])}send(e,t,i,r,...n){const o=++oe,s=new Promise(((i,s)=>{this.postMessage({id:o,type:"request",name:e,args:n},t),this.callbacks[o]=(e,t,n)=>{null==r||r.addAll(n),e?s(e):i(t)}}
2));return m(i,(()=>{delete this.callbacks[o],this.postMessage({id:o,type:"cancel"})})),f(this.timeoutMs,s,i)}},e.H=I,e.L=class{constructor(e){this.loaded=Promise.resolve(),this.fetchAndParseTile=(e,t,i,r,n)=>{const o=this,s=this.demUrlPattern.replace("{z}",e.toString()).replace("{x}",t.toString()).replace("{y}",i.toString());return null==n||n.useTile(s),this.parsedCache.get(s,((r,s)=>a(this,void 0,void 0,(function*(){const r=yield o.fetchTile(e,t,i,s,n);if(g(s))throw new Error("canceled");const a=o.decodeImage(r.data,o.encoding,s),l=null==n?void 0:n.marker("decode"),c=yield a;return null==l||l(),c}))),r)},this.tileCache=new w(e.cacheSize),this.parsedCache=new w(e.cacheSize),this.contourCache=new w(e.cacheSize),this.timeoutMs=e.timeoutMs,this.demUrlPattern=e.demUrlPattern,this.encoding=e.encoding,this.maxzoom=e.maxzoom,this.decodeImage=e.decodeImage||E,this.getTile=e.getTile||ne}fetchTile(e,t,i,r,n){const o=this.demUrlPattern.replace("{z}",e.toString()).replace("{x}",t.toString()).replace("{y}",i.toString());return null==n||n.useTile(o),this.tileCache.get(o,((e,t)=>{null==n||n.fetchTile(o);const i=null==n?void 0:n.marker("fetch");return f(this.timeoutMs,this.getTile(o,t).finally((()=>null==i?void 0:i())),t)}),r)}fetchDem(e,t,i,r,n,o){return a(this,void 0,void 0,(function*(){const s=Math.min(e-(r.overzoom||0),this.maxzoom),a=e-s,l=1<<a,c=Math.floor(t/l),u=Math.floor(i/l),h=yield this.fetchAndParseTile(s,c,u,n,o);return I.fromRawDem(h).split(a,t%l,i%l)}))}fetchContourTile(e,t,i,r,n,s){const{levels:l,multiplier:c=1,buffer:h=1,extent:d=4096,contourLayer:p="contours",elevationKey:f="ele",levelKey:m="level",subsampleBelow:y=100}=r;if(!l||0===l.length)return Promise.resolve({arrayBuffer:new ArrayBuffer(0)});const _=[e,t,i,u(r)].join("/");return this.contourCache.get(_,((n,u)=>a(this,void 0,void 0,(function*(){const n=1<<e,a=[];for(let o=i-1;o<=i+1;o++)for(let i=t-1;i<=t+1;i++)a.push(o<0||o>=n?void 0:this.fetchDem(e,(i+n)%n,o,r,u,s));const _=yield Promise.all(a);let v=I.combineNeighbors(_);if(!v||g(u))return{arrayBuffer:(new Uint8Array).buffer};const b=null==s?void 0:s.marker("isoline");if(v.width>=y)v=v.materialize(2);else for(;v.width<y;)v=v.subsamplePixelCenters(2).materialize(2);v=v.averagePixelCentersToGrid().scaleElevation(c).materialize(1);const x=o(l[0],v,d,h);null==b||b();const w=function(e){const t=new L;for(const i in e.layers){const r=e.layers[i];r.extent||(r.extent=e.extent),t.writeMessage(3,$,Object.assign(Object.assign({},r),{id:i}))}return t.finish()}({extent:d,layers:{[p]:{features:Object.entries(x).map((([e,t])=>{const i=Number(e);return{type:G.LINESTRING,geometry:t,properties:{[f]:i,[m]:Math.max(...l.map(((e,t)=>i%e==0?t:0)))}}}))}}});return null==b||b(),{arrayBuffer:w.buffer}}))),n)}},e.T=ie,e._=a,e.a=function(e){return Object.fromEntries(e.replace(/^.*\?/,"").split("&").map((e=>{const t=e.split("=").map(decodeURIComponent),i=t[0];let r=t[1];switch(i){case"thresholds":n=r,r=Object.fromEntries(n.split("~").map((e=>e.split("*").map(Number))).map((([e,...t])=>[e,t])));break;case"extent":case"multiplier":case"overzoom":case"buffer":r=Number(r)}var n;return[i,r]})))},e.b=o,e.c=P,e.d=E,e.e=function(e){var{thresholds:t}=e,i=s(e,["thresholds"]);return l(Object.assign({thresholds:c(t)},i)).map((([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`)).join("&")},e.f=function(e){return e.then((({arrayBuffer:e})=>{const t=function(e){const t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}(e);return{arrayBuffer:t,transferrables:[t]}}))},e.g=function(e,t){const{thresholds:i}=e,r=s(e,["thresholds"]);let n=[],o=-1/0;return Object.entries(i).forEach((([e,i])=>{const r=Number(e);r<=t&&r>o&&(o=r,n="number"==typeof i?[i]:i)})),Object.assign({levels:n},r)},e.p=function(e,t){return e.then((e=>{var{data:i}=e,r=s(e,["data"]);let n=i;return t&&(n=new Float32Array(i.length),n.set(i)),Object.assign(Object.assign({},r),{data:n,transferrables:[n.buffer]})}))}})),Fo(0,(function(e){const t=e=>Promise.reject(new Error(`No manager registered for ${e}`)),i="undefined"!=typeof self?self:"undefined"!=typeof window?window:global;i.actor=new e.A(i,new class{constructor(){this.managers={},this.init=(t,i)=>(this.managers[t.managerId]=new e.L(t),Promise.resolve()),this.fetchTile=(e,i,r,n,o,s)=>{var a;return(null===(a=this.managers[e])||void 0===a?void 0:a.fetchTile(i,r,n,o,s))||t(e)},this.fetchAndParseTile=(i,r,n,o,s,a)=>{var l;return e.p((null===(l=this.managers[i])||void 0===l?void 0:l.fetchAndParseTile(r,n,o,s,a))||t(i),!0)},this.fetchContourTile=(i,r,n,o,s,a,l)=>{var c;return e.f((null===(c=this.managers[i])||void 0===c?void 0:c.fetchContourTile(r,n,o,s,a,l))||t(i))}}})})),Fo(0,(function(e){const t={workerUrl:""};let i,r=0;class n{constructor(){this.decodeImage=(t,i,r)=>e.p(e.d(t,i,r),!1)}}class o{constructor(o){this.fetchTile=(e,t,i,r,n)=>this.actor.send("fetchTile",[],r,n,this.managerId,e,t,i),this.fetchAndParseTile=(e,t,i,r,n)=>this.actor.send("fetchAndParseTile",[],r,n,this.managerId,e,t,i),this.fetchContourTile=(e,t,i,r,n,o)=>this.actor.send("fetchContourTile",[],n,o,this.managerId,e,t,i,r);const s=this.managerId=++r;this.actor=o.actor||function(){if(!i){const r=new Worker(t.workerUrl),o=new n;i=new e.A(r,o)}return i}(),this.loaded=this.actor.send("init",[],new AbortController,void 0,Object.assign(Object.assign({},o),{managerId:s}))}}Blob.prototype.arrayBuffer||(Blob.prototype.arrayBuffer=function(){return new Promise(((e,t)=>{const i=new FileReader;i.onload=t=>{var i;return e(null===(i=t.target)||void 0===i?void 0:i.result)},i.onerror=t,i.readAsArrayBuffer(this)}))});const s=e=>(t,i)=>{if(i instanceof AbortController)return e(t,i);{const r=new AbortController;return e(t,r).then((e=>i(void 0,e.data,e.cacheControl,e.expires)),(e=>i(e))).catch((e=>i(e))),{cancel:()=>r.abort()}}},a=new Set,l={generateIsolines:e.b,DemSource:class{constructor({url:t,cacheSize:i=100,id:r="dem",encoding:n="terrarium",maxzoom:l=12,worker:c=!0,timeoutMs:u=1e4,actor:h}){this.timingCallbacks=[],this.onTiming=e=>{this.timingCallbacks.push(e)},this.setupMaplibre=e=>{e.addProtocol(this.sharedDemProtocolId,this.sharedDemProtocol),e.addProtocol(this.contourProtocolId,this.contourProtocol)},this.sharedDemProtocolV4=(t,i)=>e._(this,void 0,void 0,(function*(){const[r,n,o]=this.parseUrl(t.url),s=new e.T("main");let a;try{const e=yield this.manager.fetchTile(r,n,o,i,s);return a=s.finish(t.url),{data:yield e.data.arrayBuffer(),cacheControl:e.cac
2heControl,expires:e.expires}}catch(e){throw a=s.error(t.url),e}finally{this.timingCallbacks.forEach((e=>e(a)))}})),this.contourProtocolV4=(t,i)=>e._(this,void 0,void 0,(function*(){const r=new e.T("main");let n;try{const[o,s,a]=this.parseUrl(t.url),l=e.a(t.url),c=yield this.manager.fetchContourTile(o,s,a,e.g(l,o),i,r);return n=r.finish(t.url),{data:c.arrayBuffer}}catch(e){throw n=r.error(t.url),e}finally{this.timingCallbacks.forEach((e=>e(n)))}})),this.contourProtocol=s(this.contourProtocolV4),this.sharedDemProtocol=s(this.sharedDemProtocolV4),this.contourProtocolUrl=t=>`${this.contourProtocolUrlBase}?${e.e(t)}`;let d=r,p=1;for(;a.has(d);)d=r+p++;a.add(d),this.sharedDemProtocolId=`${d}-shared`,this.contourProtocolId=`${d}-contour`,this.sharedDemProtocolUrl=`${this.sharedDemProtocolId}://{z}/{x}/{y}`,this.contourProtocolUrlBase=`${this.contourProtocolId}://{z}/{x}/{y}`;const f=c?o:e.L;this.manager=new f({demUrlPattern:t,cacheSize:i,encoding:n,maxzoom:l,timeoutMs:u,actor:h})}getDemTile(e,t,i,r){return this.manager.fetchAndParseTile(e,t,i,r||new AbortController)}parseUrl(e){const[,t,i,r]=/\/\/(\d+)\/(\d+)\/(\d+)/.exec(e)||[];return[Number(t),Number(i),Number(r)]}},HeightTile:e.H,LocalDemManager:e.L,decodeParsedImage:e.c,set workerUrl(e){t.workerUrl=e},get workerUrl(){return t.workerUrl}};return l}));const Do="#4e9d70",ko="#edc438",Oo="#d56265",Ro="#252525ff",zo="#919191",No="#0e683eff",Bo="#c29409ff",Vo="#94222dff",jo="#000000",Uo="#6d6d6dff",Go="#ab65c1ff",$o="#6a3a27ff",qo="#0d7e4aff",Zo="#fc0384",Wo="#dc3545",Ho="#919191",Xo="#0b5bd2",Yo="#0046afff",Jo="#e7ebd8ff",Ko={type:"geojson",data:{type:"FeatureCollection",features:[]},promoteId:"id"},Qo={"fill-color":["case",["boolean",["feature-state","focus"],!1],Xo,["match",["get","status"],"ACTIVE",Wo,Ho]],"fill-opacity":.3},es={"line-color":["case",["boolean",["feature-state","focus"],!1],Xo,["match",["get","status"],"ACTIVE",Wo,Ho]]},ts=new Co.DemSource({url:"https://tiles.backroadstatus.com/canada-terrain/{z}/{x}/{y}",encoding:"terrarium",maxzoom:12,worker:!0,cacheSize:256,timeoutMs:3e4});ts.setupMaplibre(vt());const is=(()=>{const e=new Date;return e.setFullYear(e.getFullYear()-2),e.toISOString().split("T")[0]})(),rs=encodeURIComponent(`LIFECYCLE_STATUS='Proposed' AND PLANNED_DEVELOPMENT_DATE >= ${is}`),ns=["data:application/x-protobuf;base64,"],os={fomPathData:[`https://openmaps.gov.bc.ca/geo/pub/WHSE_FOREST_TENURE.FOM_ROAD_SECTION_SP/ows?service=WMS&version=1.1.1&request=GetMap&layers=pub:WHSE_FOREST_TENURE.FOM_ROAD_SECTION_SP&styles=&format=application/vnd.mapbox-vector-tile&height=256&width=256&srs=EPSG:3857&bbox={bbox-epsg-3857}&CQL_FILTER=${rs}`],fomCutblockData:[`https://openmaps.gov.bc.ca/geo/pub/WHSE_FOREST_TENURE.FOM_CUTBLOCK_SP/ows?service=WMS&version=1.1.1&request=GetMap&layers=pub:WHSE_FOREST_TENURE.FOM_CUTBLOCK_SP&styles=&format=application/vnd.mapbox-vector-tile&height=256&width=256&srs=EPSG:3857&bbox={bbox-epsg-3857}&CQL_FILTER=${rs}`],indianReserveData:["https://openmaps.gov.bc.ca/geo/pub/WHSE_ADMIN_BOUNDARIES.CLAB_INDIAN_RESERVES/ows?service=WMS&version=1.1.1&request=GetMap&layers=pub:WHSE_ADMIN_BOUNDARIES.CLAB_INDIAN_RESERVES&styles=&format=application/vnd.mapbox-vector-tile&height=256&width=256&srs=EPSG:3857&bbox={bbox-epsg-3857}"]},ss={version:8,sprite:`${window.location.origin}/sprite/backroadstatus`,glyphs:"/fonts/{fontstack}/{range}.pbf",backgroundColor:"#333333",sources:{openmaptiles:{type:"vector",url:"https://tiles.backroadstatus.com/canada-osm"},esriTopo:{type:"raster",tiles:["https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}.png"],attribution:"AG:Basemap &copy; ESRI ArcGIS",tileSize:256},esriSatellite:{type:"raster",tiles:["https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}.png"],attribution:"AG:Basemap &copy; ESRI ArcGIS",tileSize:256,maxzoom:19,minzoom:1},caltopo:{type:"raster",tiles:["https://caltopo.s3.amazonaws.com/topo/{z}/{x}/{y}.png?v=1"],attribution:'CT:Basemap &copy; <a href="https://caltopo.com" target="_blank>CalTopo</a>',tileSize:256,maxzoom:18,minzoom:8},bcBasemap:{type:"raster",tiles:["https://maps.gov.bc.ca/arcserver/services/province/web_mercator_cache/MapServer/WMSServer?service=WMS&version=1.1.1&request=GetMap&layers=0&styles=&format=image/jpeg&transparent=false&height=256&width=256&srs=EPSG:3857&bbox={bbox-epsg-3857}"],attribution:"BC:Basemap &copy; B.C. Basemap Services",tileSize:256,maxzoom:17,minzoom:8},toporama:{type:"raster",tiles:["https://maps.geogratis.gc.ca/wms/toporama_en?service=WMS&version=1.1.1&request=GetMap&layers=WMS-Toporama&styles=&format=image/png&transparent=true&height=256&width=256&srs=EPSG:3857&bbox={bbox-epsg-3857}"],attribution:"CA:Basemap © Toporama GeoGratis",tileSize:256,minzoom:8,maxzoom:17},copernicus:{type:"raster",tiles:["https://sh.dataspace.copernicus.eu/ogc
2/wms/eca71d35-af06-420b-a253-fa665e955f8b?service=WMS&version=1.3.0&request=GetMap&layers=NATURAL-COLOR&styles=&format=image/png&transparent=true&height=256&width=256&crs=EPSG:3857&bbox={bbox-epsg-3857}"],attribution:"Copernicus",tileSize:256,minzoom:14,maxzoom:16},canadaDem:{type:"raster-dem",tiles:[ts.sharedDemProtocolUrl],encoding:"terrarium",attribution:"Mapterhorn",maxzoom:12},contours:{type:"vector",tiles:[ts.contourProtocolUrl({thresholds:{9:[100,1e3],10:[100,1e3],11:[50,500],12:[20,500],14:[10,200],15:[10,100]},contourLayer:"contour",elevationKey:"height",levelKey:"level",extent:4096,buffer:1})],maxzoom:15},hillshading:{type:"raster-dem",tiles:[ts.sharedDemProtocolUrl],maxzoom:12},pathData:{type:"vector",tiles:[`${window.location.origin}/api/paths/tiles/{z}/{x}/{y}.mvt`],minzoom:8,promoteId:"id"},focusedPathData:{...Ko},distanceMarkerData:{...Ko},zoneData:{type:"vector",tiles:[`${window.location.origin}/api/zones/tiles/{z}/{x}/{y}.mvt`],minzoom:9,promoteId:"id"},indianReserveData:{type:"vector",tiles:ns,promoteId:"OBJECTID",minzoom:9},recsites:{type:"vector",url:"https://tiles.backroadstatus.com/recsites",minzoom:11},cutblockData:{type:"vector",url:"https://tiles.backroadstatus.com/cutblocks",promoteId:"OBJECTID",minzoom:12},fomCutblockData:{type:"vector",tiles:ns,promoteId:"FOM_C_SYSID",minzoom:12},fomPathData:{type:"vector",tiles:ns,promoteId:"FOM_RS_SYSID",minzoom:12}},layers:[{id:"esriSatellite",type:"raster",source:"esriSatellite",layout:{visibility:"none"}},{id:"bcBasemap",type:"raster",source:"bcBasemap",layout:{visibility:"none"}},{id:"caltopo",type:"raster",source:"caltopo",layout:{visibility:"none"}},{id:"toporama",type:"raster",source:"toporama",layout:{visibility:"none"}},{id:"esriTopoFallback",type:"raster",source:"esriTopo",layout:{visibility:"none"},maxzoom:14},{id:"copernicus",type:"raster",source:"copernicus",layout:{visibility:"none"},minzoom:14,maxzoom:16},{id:"background",type:"background",paint:{"background-color":"#eee9cd"}},{id:"landuse-residential",type:"fill",source:"openmaptiles","source-layer":"landuse",filter:["all",["==","$type","Polygon"],["==","class","residential"]],layout:{visibility:"visible"},paint:{"fill-color":"hsl(47, 13%, 86%)","fill-opacity":.7}},{id:"landcover_grass",type:"fill",source:"openmaptiles","source-layer":"landcover",filter:["==","class","grass"],paint:{"fill-color":"#d1d2b4","fill-opacity":.45}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",filter:["==","class","wood"],paint:{"fill-color":"#c6d2a8ff","fill-opacity":{base:1,stops:[[8,.6],[22,1]]}}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",paint:{"fill-color":"rgba(192, 216, 151, 0.53)","fill-opacity":1}},{id:"landcover-ice-shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",filter:["==","subclass","ice_shelf"],layout:{visibility:"visible"},paint:{"fill-color":"hsl(47, 26%, 88%)","fill-opacity":.8}},{id:"landcover-glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",filter:["==","subclass","glacier"],layout:{visibility:"visible"},paint:{"fill-color":"#ecf0e3","fill-opacity":{base:1,stops:[[0,1],[8,.8]]}}},{id:"landcover-glacier-border",type:"line",source:"openmaptiles","source-layer":"landcover",filter:["==","subclass","glacier"],layout:{visibility:"visible"},paint:{"line-color":"#9acfcf","line-dasharray":[3,1],"line-opacity":{base:1,stops:[[0,1],[8,.8]]}}},{id:"landcover_sand",type:"fill",metadata:{},source:"openmaptiles","source-layer":"landcover",filter:["all",["in","class","sand"]],paint:{"fill-antialias":!1,"fill-color":"rgba(232, 214, 38, 1)","fill-opacity":.3}},{id:"hillshading",type:"hillshade",source:"hillshading",layout:{visibility:"none"},paint:{"hillshade-exaggeration":["interpolate",["linear"],["zoom"],1,0,10,.2,11,.4,12,.5],"hillshade-highlight-color":"rgba(255, 255, 255, 0.25)","hillshade-shadow-color":"rgba(0, 0, 0, 0.10)","hillshade-accent-color":"rgba(0, 0, 0, 0.05)","hillshade-illumination-direction":335,"hillshade-method":"combined"}},{id:"landuse",type:"fill",source:"openmaptiles","source-layer":"landuse",filter:["==","class","agriculture"],layout:{visibility:"visible"},paint:{"fill-color":"#eae0d0"}}
2,{id:"landuse_overlay_national_park",type:"fill",source:"openmaptiles","source-layer":"landcover",filter:["==","class","national_park"],paint:{"fill-color":"#E1EBB0","fill-opacity":{base:1,stops:[[5,0],[9,.75]]}}},{id:"park_outline",type:"line",source:"openmaptiles","source-layer":"park",layout:{},paint:{"line-color":"rgba(159, 183, 118, 0.69)","line-dasharray":[.5,1]}},{id:"contour",type:"line",source:"contours","source-layer":"contour",layout:{visibility:"none"},paint:{"line-color":"#a0a195ff","line-opacity":["interpolate",["linear"],["zoom"],10,.2,11,.4,12,.6,13,.7,14,.8],"line-width":.6}},{id:"contour-index",type:"line",source:"contours","source-layer":"contour",filter:["all",[">","level",0]],layout:{visibility:"none"},paint:{"line-color":"#a0a195ff","line-opacity":["interpolate",["linear"],["zoom"],10,.2,11,.4,12,.6,13,.7,14,.8],"line-width":1.1}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",minzoom:11,filter:["all",["==","$type","LineString"],["!in","brunnel","tunnel","bridge"]],paint:{"line-color":"#96bec2","line-opacity":1,"line-width":{base:1.4,stops:[[8,1],[20,8]]}}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["==","$type","Polygon"],["!=","brunnel","tunnel"]],paint:{"fill-color":"#85def0","fill-outline-color":"rgba(14, 198, 231, 1)"}},{id:"water-border",type:"line",source:"openmaptiles","source-layer":"water",filter:["all",["==","$type","Polygon"],["!=","brunnel","tunnel"]],paint:{"line-color":"rgba(14, 198, 231, 1)","line-width":1}},{id:"waterway-labels",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:12,filter:["all",["==","$type","LineString"],["!in","brunnel","tunnel","bridge"]],layout:{"symbol-placement":"line","text-field":"{name}","text-font":["Noto Sans Regular"],"text-size":10},paint:{"text-color":"#1c87d6","text-halo-blur":1,"text-halo-color":"rgba(194, 221, 226, 1)","text-halo-width":1}},{id:"water-labels",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:12,filter:["all",["==","$type","LineString"],["!=","class","ocean"]],layout:{"text-rotation-alignment":"viewport","text-field":"{name}","text-font":["Noto Sans Regular"],"text-size":12,"symbol-spacing":400,"symbol-placement":"line"},paint:{"text-color":"#1c87d6","text-halo-blur":1,"text-halo-color":"rgba(194, 221, 226, 1)","text-halo-width":1}},{id:"water-label-points",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:12,filter:["all",["==","$type","Point"],["!=","class","ocean"]],layout:{"text-field":"{name}","text-font":["Noto Sans Regular"],"text-size":12},paint:{"text-color":"#1c87d6","text-halo-blur":1,"text-halo-color":"rgba(194, 221, 226, 1)","text-halo-width":1}},{id:"waterway-tunnel",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["all",["==","$type","LineString"],["==","brunnel","tunnel"]],paint:{"line-color":"hsl(205, 56%, 73%)","line-dasharray":[3,3],"line-gap-width":{stops:[[12,0],[20,6]]},"line-opacity":1,"line-width":{base:1.4,stops:[[8,1],[20,2]]}}},{id:"wildlifeActZones",type:"fill",source:"zoneData","source-layer":"zones",filter:["==",["get","reason"],"WILDLIFE_ACT"],paint:Qo,minzoom:9},{id:"wildlifeActZoneBorders",type:"line",source:"zoneData","source-layer":"zones",filter:["==",["get","reason"],"WILDLIFE_ACT"],paint:es,minzoom:9},{id:"landActZones",type:"fill",source:"zoneData","source-layer":"zones",filter:["==",["get","reason"],"LAND_ACT"],paint:Qo,minzoom:9},{id:"landActZoneBorders",type:"line",source:"zoneData","source-layer":"zones",filter:["==",["get","reason"],"LAND_ACT"],paint:es,minzoom:9},{id:"cutblocks",type:"fill",source:"cutblockData","source-layer":"cutblocks",filter:["all",["<=",["get","FEATURE_AREA"],5e5],["!=",["get","PLANNED_HARVEST_DATE"],"undefined"]],paint:{"fill-color":["case",["boolean",["feature-state","focus"],!1],Xo,["match",["get","LIFE_CYCLE_STATUS_CODE"],"PENDING",Go,"ACTIVE",$o,qo]],"fill-opacity":.2},minzoom:12},{id:"cutblockBorders",type:"line",source:"cutblockData",filter:["all",["<=",["get","FEATURE_AREA"],5e5],["!=",["get","PLANNED_HARVEST_DATE"],"null"]],"source-layer":"cutblocks",paint:{"line-color":["case",["boolean",["feature-state","focus"],!1],Xo,["match",["get","LIFE_CYCLE_STATUS_CODE"],"PENDING",Go,"ACTIVE",$o,qo]],"line-opacity":.7,"line-dasharray":[5,2]},minzoom:12}
2,{id:"fomCutblocks",type:"fill",source:"fomCutblockData","source-layer":"WHSE_FOREST_TENURE.FOM_CUTBLOCK_SP",paint:{"fill-color":["case",["boolean",["feature-state","focus"],!1],Xo,Zo],"fill-opacity":.2},minzoom:12},{id:"fomCutblockBorders",type:"line",source:"fomCutblockData","source-layer":"WHSE_FOREST_TENURE.FOM_CUTBLOCK_SP",paint:{"line-color":["case",["boolean",["feature-state","focus"],!1],Xo,Zo],"line-opacity":.7},minzoom:12},{id:"contour_label",type:"symbol",metadata:{},source:"contours","source-layer":"contour",filter:["all",[">","height",0]],layout:{visibility:"none","symbol-avoid-edges":!0,"symbol-placement":"line","text-allow-overlap":!1,"text-field":"{height} m","text-font":["Noto Sans Regular"],"text-ignore-placement":!1,"text-padding":10,"text-rotation-alignment":"map","text-size":{base:1,stops:[[15,9.5],[20,12]]}},paint:{"text-color":"#898b70"}},{id:"tunnel_railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:0,filter:["all",["==","$type","LineString"],["==","brunnel","tunnel"],["==","class","transit"]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"hsl(34, 12%, 66%)","line-dasharray":[3,3],"line-opacity":{base:1,stops:[[11,0],[16,1]]}}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",paint:{"fill-color":"hsl(39, 41%, 86%)","fill-opacity":{base:1,stops:[[13,.6],[14,1]]},"fill-outline-color":"hsl(36, 45%, 80%)"}},{id:"housenumber",type:"symbol",source:"openmaptiles","source-layer":"housenumber",minzoom:17,filter:["==","$type","Point"],layout:{"text-field":"{housenumber}","text-font":["Noto Sans Regular"],"text-size":10},paint:{"text-color":"hsla(0, 14%, 57%, 0.51)","text-halo-color":"hsl(39, 41%, 86%)","text-halo-width":.5}},{id:"road_area_pier",type:"fill",metadata:{},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","Polygon"],["==","class","pier"]],layout:{visibility:"visible"},paint:{"fill-antialias":!0,"fill-color":"hsl(47, 26%, 88%)"}},{id:"road_pier",type:"line",metadata:{},source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["in","class","pier"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"hsl(47, 26%, 88%)","line-width":{base:1.2,stops:[[15,1],[17,4]]}}},{id:"road_bridge_area",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","Polygon"],["in","brunnel","bridge"]],layout:{},paint:{"fill-color":"hsl(47, 26%, 88%)","fill-opacity":.5}},{id:"road_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["in","class","path","track"]],layout:{"line-cap":"square","line-join":"bevel"},paint:{"line-color":"hsla(0, 5%, 36%, 1.00)","line-dasharray":[1,1],"line-width":{base:1.55,stops:[[4,.25],[20,10]]}}},{id:"road_minor",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["in","class","minor","service"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"hsl(0, 0%, 97%)","line-width":{base:1.55,stops:[[4,.25],[20,30]]}}},{id:"tunnel_minor",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","brunnel","tunnel"],["==","class","minor_road"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"#efefef","line-dasharray":[.36,.18],"line-width":{base:1.55,stops:[[4,.25],[20,30]]}}},{id:"tunnel_major",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","brunnel","tunnel"],["in","class","primary","secondary","tertiary","trunk"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"#fff","line-dasharray":[.28,.14],"line-width":{base:1.4,stops:[[6,.5],[20,30]]}}},{id:"road_trunk_primary",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["in","class","trunk","primary"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fff","line-width":{base:1.4,stops:[[6,.5],[20,30]]}}},{id:"road_secondary_tertiary",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["in","class","secondary","tertiary"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fff","line-width":{base:1.4,stops:[[6,.5],[20,20]]}}},{id:"road_major_motorway",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["==","class","motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"hsl(0, 0%, 100%)","line-offset":0,"line-width":{base:1.4,stops:[[8,1],[16,10]]}}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","class","transit"],["!=","brunnel","tunnel"]],layout:{visibility:"visible"}
2,paint:{"line-color":"hsl(34, 12%, 66%)","line-opacity":{base:1,stops:[[11,0],[16,1]]}}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["==","class","rail"],layout:{visibility:"visible"},paint:{"line-color":"hsl(34, 12%, 66%)","line-opacity":{base:1,stops:[[11,0],[16,1]]}}},{id:"waterway-bridge-case",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["all",["==","$type","LineString"],["==","brunnel","bridge"]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"#bbbbbb","line-gap-width":{base:1.55,stops:[[4,.25],[20,30]]},"line-width":{base:1.6,stops:[[12,.5],[20,10]]}}},{id:"waterway-bridge",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["all",["==","$type","LineString"],["==","brunnel","bridge"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"hsl(205, 56%, 73%)","line-width":{base:1.55,stops:[[4,.25],[20,30]]}}},{id:"bridge_minor case",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","minor_road"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"#dedede","line-gap-width":{base:1.55,stops:[[4,.25],[20,30]]},"line-width":{base:1.6,stops:[[12,.5],[20,10]]}}},{id:"bridge_major case",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["in","class","primary","secondary","tertiary","trunk"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"#dedede","line-gap-width":{base:1.55,stops:[[4,.25],[20,30]]},"line-width":{base:1.6,stops:[[12,.5],[20,10]]}}},{id:"bridge_minor",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["==","class","minor_road"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#efefef","line-width":{base:1.55,stops:[[4,.25],[20,30]]}}},{id:"bridge_major",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==","$type","LineString"],["all",["==","brunnel","bridge"],["in","class","primary","secondary","tertiary","trunk"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fff","line-width":{base:1.4,stops:[[6,.5],[20,30]]}}},{id:"admin_sub",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["in","admin_level",4,6,8],layout:{visibility:"visible"},paint:{"line-color":"hsl(0, 0%, 76%)","line-dasharray":[2,1]}},{id:"admin_country_z0-4",type:"line",source:"openmaptiles","source-layer":"boundary",maxzoom:5,filter:["all",["<=","admin_level",2],["==","$type","LineString"],["!has","claimed_by"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"hsla(0, 8%, 22%, 0.51)","line-width":{base:1.3,stops:[[3,.5],[22,15]]}}},{id:"admin_country_z5-",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:5,filter:["all",["<=","admin_level",2],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"hsla(0, 8%, 22%, 0.51)","line-width":{base:1.3,stops:[[3,.5],[22,15]]}}},{id:"indianReserves",type:"fill",source:"indianReserveData","source-layer":"WHSE_ADMIN_BOUNDARIES.CLAB_INDIAN_RESERVES",paint:{"fill-color":"#8B4513","fill-opacity":.1},minzoom:9},{id:"indianReserveBorders",type:"line",source:"indianReserveData","source-layer":"WHSE_ADMIN_BOUNDARIES.CLAB_INDIAN_RESERVES",paint:{"line-color":"#8B4513","line-width":1},minzoom:9},{id:"indianReserveLabels",type:"symbol",source:"indianReserveData","source-layer":"WHSE_ADMIN_BOUNDARIES.CLAB_INDIAN_RESERVES",layout:{"text-field":["get","ENGLISH_NAME"],"text-font":["Noto Sans Regular"],"text-size":11,"text-anchor":"center","text-allow-overlap":!1},paint:{"text-color":"#8B4513","text-halo-color":"#ffffff","text-halo-width":1.5},minzoom:11},{id:"poi_label",type:"symbol",source:"openmaptiles","source-layer":"poi",minzoom:14,filter:["all",["==","$type","Point"],["==","rank",1]],layout:{"icon-size":1,"text-anchor":"top","text-field":"{name:latin}\n{name:nonlatin}","text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,.5],"text-size":11,visibility:"visible"},paint:{"text-color":"#666","text-halo-blur":1,"text-halo-color":Jo,"text-halo-width":1}},{id:"airport-label",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:10,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":"{name:latin}\n{name:nonlatin}","text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,.5],"text-size":11,visibility:"visible"},paint:{"text-color":"#666","text-halo-blur":1,"text-halo-color":"rgba(255,255,255,0.75)","text-halo-width":1}},{id:"road_major_label",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",filter:["==","$type","LineString"],layout:{"symbol-placement":"line","text-field":"{name:latin} {name:nonlatin}","text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-rotation-alignment":"map","text-size":{base:1.4,stops:[[10,8],[20,14]]},"text-transform":"uppercase"},paint:{"text-color":"#000","text-halo-color":Jo,"text-halo-width":2}}
2,{id:"paths",type:"line",source:"pathData","source-layer":"paths",filter:["in",["get","condition"],["literal",["NOMINAL","DEGRADED","HEAVILY_DEGRADED"]]],paint:{"line-color":["case",["boolean",["feature-state","focus"],!1],Xo,["match",["get","condition"],"NOMINAL",Do,"DEGRADED",ko,"HEAVILY_DEGRADED",Oo,"IMPASSABLE",Ro,zo]],"line-width":["interpolate",["linear"],["zoom"],8,["case",[">",["get","length"],15e3],1.75,1.25],11,["case",[">",["get","length"],15e3],3.25,2.25]]}},{id:"fomPaths",type:"line",source:"fomPathData","source-layer":"WHSE_FOREST_TENURE.FOM_ROAD_SECTION_SP",minzoom:12,paint:{"line-color":["case",["boolean",["feature-state","focus"],!1],Xo,Zo],"line-width":["interpolate",["linear"],["zoom"],8,["case",[">",["to-number",["get","PLANNED_LENGTH"]],15],1.75,1.25],11,["case",[">",["to-number",["get","PLANNED_LENGTH"]],15],3.25,2.25]],"line-dasharray":[2,1]}},{id:"pathsBorder",type:"line",source:"pathData","source-layer":"paths",filter:["in",["get","condition"],["literal",["NOMINAL","DEGRADED","HEAVILY_DEGRADED"]]],paint:{"line-color":["case",["boolean",["feature-state","focus"],!1],Yo,["match",["get","condition"],"NOMINAL",No,"DEGRADED",Bo,"HEAVILY_DEGRADED",Vo,"IMPASSABLE",jo,Uo]],"line-gap-width":["interpolate",["linear"],["zoom"],8,["case",[">",["get","length"],15e3],1.75,1.25],11,["case",[">",["get","length"],15e3],3.25,2.25]],"line-width":.5}},{id:"pathsDashed",type:"line",source:"pathData","source-layer":"paths",filter:["in",["get","condition"],["literal",["IMPASSABLE","UNKNOWN"]]],paint:{"line-color":["case",["boolean",["feature-state","focus"],!1],Xo,["match",["get","condition"],"NOMINAL",Do,"DEGRADED",ko,"HEAVILY_DEGRADED",Oo,"IMPASSABLE",Ro,zo]],"line-width":["interpolate",["linear"],["zoom"],8,["case",[">",["get","length"],15e3],1.75,1.25],11,["case",[">",["get","length"],15e3],3.25,2.25]],"line-dasharray":[2,1]}},{id:"pathsClickBuffer",type:"line",source:"pathData","source-layer":"paths",paint:{"line-opacity":0,"line-width":20}},{id:"fomPathsClickBuffer","source-layer":"WHSE_FOREST_TENURE.FOM_ROAD_SECTION_SP",type:"line",source:"fomPathData",filter:["==","$type","LineString"],paint:{"line-opacity":0,"line-width":20}},{id:"focusedPathHighlight",type:"line",source:"focusedPathData",paint:{"line-color":["match",["get","condition"],"NOMINAL",Do,"DEGRADED",ko,"HEAVILY_DEGRADED",Oo,"IMPASSABLE",Ro,zo],"line-opacity":["case",["==",["get","condition"],"HEAVILY_DEGRADED"],.4,["==",["get","condition"],"DEGRADED"],.5,.4],"line-blur":2,"line-width":["interpolate",["linear"],["zoom"],8,8,11,14]}},{id:"focusedPath",type:"line",source:"focusedPathData",filter:["in",["get","condition"],["literal",["NOMINAL","DEGRADED","HEAVILY_DEGRADED"]]],paint:{"line-color":["match",["get","condition"],"NOMINAL",Do,"DEGRADED",ko,"HEAVILY_DEGRADED",Oo,"IMPASSABLE",Ro,zo],"line-width":["interpolate",["linear"],["zoom"],8,["case",[">",["get","length"],15e3],1.75,1.25],11,["case",[">",["get","length"],15e3],3.25,2.25]]}},{id:"focusedPathBorder",type:"line",source:"pathData","source-layer":"paths",filter:["in",["get","condition"],["literal",["NOMINAL","DEGRADED","HEAVILY_DEGRADED"]]],minzoom:11,paint:{"line-color":["case",["boolean",["feature-state","focus"],!1],Yo,["match",["get","condition"],"NOMINAL",No,"DEGRADED",Bo,"HEAVILY_DEGRADED",Vo,"IMPASSABLE",jo,Uo]],"line-gap-width":["interpolate",["linear"],["zoom"],8,["case",[">",["get","length"],15e3],1.75,1.25],11,["case",[">",["get","length"],15e3],3.25,2.25]],"line-width":.5}},{id:"focusedPathDash",type:"line",source:"focusedPathData",filter:["in",["get","condition"],["literal",["IMPASSABLE","UNKNOWN"]]],paint:{"line-color":["match",["get","condition"],"NOMINAL",Do,"DEGRADED",ko,"HEAVILY_DEGRADED",Oo,"IMPASSABLE",Ro,zo],"line-width":["interpolate",["linear"],["zoom"],8,["case",[">",["get","length"],15e3],1.75,1.25],11,["case",[">",["get","length"],15e3],3.25,2.25]],"line-dasharray":[2,1]}},{id:"pathLabels",type:"symbol",source:"pathData","source-layer":"paths",layout:{"symbol-placement":"line","text-field":["get","name"],"text-font":["Noto Sans Regular"],"text-size":12,"text-transform":"uppercase"},paint:{"text-color":"#333","text-halo-color":"#e7ebd8ff","text-halo-width":1.5}},{id:"distanceMarkers",type:"symbol",source:"distanceMarkerData",layout:{"symbol-placement":"point","text-field":["get","label"],"text-font":["Noto Sans Regular"],"text-size":12,"text-anchor":"right","text-offset":[0,1.5],"text-justify":"center","icon-allow-overlap":!0,"icon-ignore-placement":!0},paint:{"text-color":"#6f6f6f","text-halo-color":"#fbfbfbc5","text-halo-width":1.5}}
2,{id:"mountain_peak",type:"symbol",source:"openmaptiles","source-layer":"mountain_peak",minzoom:7,filter:["all",["==","$type","Point"],["==","rank",1]],layout:{"icon-size":1,"text-anchor":"bottom","text-field":"{name:latin} {name:nonlatin}\n{ele} m\n▲","text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,.5],"text-size":11,visibility:"visible"},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-blur":1,"text-halo-color":Jo,"text-halo-width":1}},{id:"mountain_peak_satellite",type:"symbol",source:"openmaptiles","source-layer":"mountain_peak",minzoom:7,filter:["all",["==","$type","Point"],["==","rank",1]],layout:{"icon-size":1,"text-anchor":"bottom","text-field":"{name:latin} {name:nonlatin}\n{ele} m\n▲","text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,.5],"text-size":11,visibility:"none"},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-blur":1,"text-halo-color":Jo,"text-halo-width":1.5}},{id:"park-label",type:"symbol",metadata:{"mapbox:group":"1444849242106.713"},source:"openmaptiles","source-layer":"park",minzoom:0,filter:["all",["==","rank",1],["==","$type","Point"]],layout:{"text-allow-overlap":!1,"text-field":"{name:latin}\n{name:nonlatin}","text-font":["Noto Sans Regular"],"text-ignore-placement":!1,"text-letter-spacing":.1,"text-max-width":9,"text-size":{base:1.2,stops:[[12,10],[15,14]]},"text-transform":"none",visibility:"visible"},paint:{"text-color":"rgba(38, 92, 46, 1)","text-halo-color":Jo,"text-halo-width":1.2}},{id:"place_label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["all",["==","$type","Point"],["all",["!in","class","city","state","country","continent"]]],layout:{"text-anchor":"center","text-field":"{name:latin}\n{name:nonlatin}","text-font":["Noto Sans Regular"],"text-max-width":6,"text-size":{stops:[[6,10],[12,12]]},visibility:"visible"},paint:{"text-color":"hsl(0, 10%, 25%)","text-halo-blur":0,"text-halo-color":Jo,"text-halo-width":1.5}},{id:"recreation-site-icon",type:"symbol",source:"recsites","source-layer":"recsites",minzoom:11,layout:{"icon-image":["case",["==",["get","OPERATOR_CLIENT_NAME"],"FOUR WHEEL DRIVE ASSOCIATION OF BRITISH COLUMBIA"],"4WDABC_RECREATION_SITE","RECREATION_SITE"],"icon-allow-overlap":!0}},{id:"pathFeatures",type:"symbol",source:"pathData","source-layer":"pathFeatures",minzoom:11,layout:{"icon-image":["get","pathFeatureType"],"icon-allow-overlap":!0}},{id:"pathPhotos",type:"symbol",source:"focusedPathData",filter:["all",["==","$type","Point"],["==","pathFeatureType","PHOTO"]],layout:{"icon-image":"PHOTO","icon-allow-overlap":!0}},{id:"place_label_city",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:16,filter:["all",["==","$type","Point"],["==","class","city"]],layout:{"text-field":"{name:latin}\n{name:nonlatin}","text-font":["Noto Sans Regular"],"text-max-width":10,"text-size":{stops:[[3,10],[8,14]]}},paint:{"text-color":"hsl(0, 0%, 0%)","text-halo-blur":0,"text-halo-color":Jo,"text-halo-width":2}},{id:"country_label-other",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:12,filter:["all",["==","$type","Point"],["==","class","country"],["!has","iso_a2"]],layout:{"text-field":"{name:latin}","text-font":["Noto Sans Regular"],"text-max-width":10,"text-size":{stops:[[3,12],[8,22]]},visibility:"visible"},paint:{"text-color":"hsl(0, 0%, 13%)","text-halo-blur":0,"text-halo-color":Jo,"text-halo-width":2}},{id:"country_label",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:12,filter:["all",["==","$type","Point"],["==","class","country"],["has","iso_a2"]],layout:{"text-field":"{name:latin}","text-font":["Noto Sans Bold"],"text-max-width":10,"text-size":{stops:[[3,12],[8,22]]}},paint:{"text-color":"hsl(0, 0%, 13%)","text-halo-blur":0,"text-halo-color":Jo,"text-halo-width":2}}]},as={ACTIVE:{displayName:"Area Closed to Motor Vehicles",color:"#dc3545",weight:1},INACTIVE:{displayName:"Area Open to Motor Vehicles",color:"#919191",weight:1}},ls={PENDING:{displayName:"Pending Logging Activities",color:"#c678dd",weight:1,fillOpacity:.4,dashArray:[4]},ACTIVE:{displayName:"Active or Recently Logged Area",color:"#78412c",weight:1,dashArray:[4]}
2,RETIRED:{displayName:"Retired Logging Area",color:"#198754",fillOpacity:.1,weight:1,dashArray:[4]}},cs={NOMINAL:{color:"#198754",displayName:"Good Condition",weight:2.25},DEGRADED:{color:"#ffc107",displayName:"Degraded",weight:2.25},HEAVILY_DEGRADED:{color:"#dc3545",displayName:"Heavily Degraded",weight:1.75},IMPASSABLE:{color:"black",dashArray:[4],displayName:"Impassible",weight:1.75},UNKNOWN:{color:"#919191",dashArray:[4],displayName:"Unknown",weight:1.75}};class us{options={modalParent:null};constructor(e){this.options=e}onAdd(e){var t=document.createElement("div");t.innerHTML=this._generateModal(),this.options.modalParent.appendChild(t);var i=n.create("div","maplibregl-ctrl maplibregl-ctrl-group fs-6 text-black");return i.innerHTML="<button title='Map Legend' data-bs-toggle='modal' data-bs-target='#mapLegend' class=\"text-black\" style=\"font-size: 18px;\"><i class='bi bi-list-ul'></i></button>",i}onRemove(){}_generateModal(){return`<div class="modal fade" id="mapLegend">\n            <div class="modal-dialog modal-dialog-centered modal-lg">\n                <div class="modal-content">\n                    <div class="modal-header">\n                        <h4 class="modal-title">Map Legend</h4>\n                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>\n                    </div>\n                    <div class="modal-body">\n                        <div class="container-fluid">\n                            <div class="row">\n                                <div class="col-md-6">\n                                    <div class="mb-4">\n                                        <h5 class="mb-3">Features</h5>\n                                        <div class="d-flex flex-column">\n                                            ${Object.keys(l).map((e=>{let t=l[e];return`\n                                                    <div class="flex-row d-flex pt-1 pb-1 flex-fill">\n                                                        <div>${u(e)}</div><div class="ps-4">${t.editorSettings.title}</div>\n                                                    </div>\n                                                `})).join("")}\n                                            <div class="flex-row d-flex pt-1 pb-1 flex-fill">\n                                                <div>${u("RECREATION_SITE",{size:{width:24,height:24},title:"Recreation Site"})}</div><div class="ps-4">Recreation Site</div>\n                                            </div>\n                                            <div class="flex-row d-flex pt-1 pb-1 flex-fill">\n                                                <div>${u("4WDABC_RECREATION_SITE",{size:{width:24,height:24},title:"4WDABC Managed Recreation Site"})}</div><div class="ps-4">4WDABC Managed Recreation Site</div>\n                                            </div>\n                                        </div>\n                                    </div>\n                                    <div class="mb-4">\n                                    <h5 class="mb-3">Fire Zones</h5>\n                                        <div class="d-flex flex-column">\n                                            <div class="flex-row d-flex pb-1 flex-fill">\n                                                <div class="align-self-center" style="width: 24px;color:#FF1600;"><i class="bi bi-fire fs-4"></i></div><div class="ps-4 align-self-center">Active Fire</div>\n                                            </div>\n                                            <div class="flex-row d-flex pt-1 pb-1 flex-fill">\n                                                <div class="align-self-center" style="width: 24px; height: 24px; border: 2px solid #ff8000"><div class="w-100 h-100 d-block" style="background-color: #ff8000;opacity: 0.2;"></div></div><div class="ps-4">Fire Perimeter</div>\n                                            </div>\n                                        </div>\n                                    </div>\n                                </div>\n                                <div class="col-md-6">\n                                    <div class="mb-4">\n                                        <h5 class="mb-3">Roads</h5>\n                                        <div class="d-flex flex-column">\n                                            ${Object.keys(cs).map((e=>{let t=cs[e];return`\n                                                    <div class="flex-row d-flex pt-1 pb-1 flex-fill">\n                                                        <div class="align-self-center" style="width: 24px; height: 2px; border-bottom: 2px ${void 0===t.dashArray?"solid":"dashed"} ${t.color};"></div><div class="ps-4">${t.displayName}</div>\n                                                    </div>\n                                                `})).join("")}\n                                            <div class="flex-row d-flex pt-1 pb-1 flex-fill">\n                                                <div class="align-self-center" style="width: 24px; height: 2px; border-bottom: 2px dashed ${Zo}"></div><div class="ps-4">Proposed</div>\n                                            </div>\n                                        </div>\n                                    </div>\n                                    <div class="mb-4">\n                                        <h5 class="mb-3">Cut Blocks</h5>\n                                        <div class="d-flex flex-column">\n                                            ${Object.keys(ls).map((e=>{let t=ls[e],i=`border: 1px dashed ${t.color}`,r=void 0===t.fillOpacity?.2:.4;return`\n                                                    <div class="flex-row d-flex pt-1 pb-1 flex-fill">\n                                                        <div style="width: 24px; height: 24px; ${i};"><div class="d-block w-100 h-100" style="background-color: ${t.color}; opacity: ${r}"></div></div><div class="ps-4">${t.displayName}</div>\n                                                    </div>\n                                                `})).join("")}\n                                            <div class="flex-row d-flex pt-1 pb-1 flex-fill">\n                                                <div style="width: 24px; height: 24px; border: 1px solid ${Zo};"><div class="d-block w-100 h-100" style="background-color: ${Zo}; opacity: 0.2"></div></div><div class="ps-4">
2Proposed Logging Area</div>\n                                            </div>\n                                        </div>\n                                    </div>\n                                    <div class="mb-4">\n                                        <h5 class="mb-3">Closure Zones</h5>\n                                        <div class="d-flex flex-column">\n                                            ${Object.keys(as).map((e=>{let t=as[e];return`\n                                                    <div class="flex-row d-flex pt-1 pb-1 flex-fill">\n                                                        <div style="width: 24px; height: 24px; border: 1px solid ${t.color};"><div class="d-block w-100 h-100" style="background-color: ${t.color}; opacity: 0.2;"></div></div><div class="ps-4">${t.displayName}</div>\n                                                    </div>\n                                                `})).join("")}\n                                        </div>\n                                    </div>\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>`}}class hs{map=null;baseLayers={};overlays={};activeBaseLayer=null;
2constructor(e){if(this.baseLayers=e.baseLayers,this.overlays=e.overlays,void 0!==e.savedState&&null!==e.savedState)try{["baseLayers","overlays"].forEach((t=>{void 0!==e.savedState[t]&&null!==e.savedState[t]&&e.savedState[t].forEach((e=>{void 0!==this[t][e.key]&&(this[t][e.key].enabled=e.enabled)}))}))}catch(e){console.log("Failed to load layer states")}Object.keys(this.baseLayers).every((e=>!this.baseLayers[e].enabled))&&(this.baseLayers[e.default].enabled=!0)}onAdd(e){this.map=e;const t=n.create("div","maplibregl-ctrl maplibregl-ctrl-group w-auto"),i=n.create("button","text-black");i.innerHTML='<i class="bi bi-stack"></i>',i.style="font-size: 20px;",t.appendChild(i);const r=n.create("section","visually-hidden p-2 text-black");return Object.keys(this.baseLayers).forEach((e=>{const t=n.create("div","d-flex form-check align-items-center"),i=n.create("input","form-check-input mt-0 me-1 cursor-pointer border-dark-subtle"),o=n.create("label","form-check-label cursor-pointer w-100"),s=this.baseLayers[e],a=`${this.map.getContainer().id}-${e}`;i.type="radio",i.id=a,i.name=`${this.map.getContainer().id}-baseLayer`,o.textContent=s.name,o.setAttribute("for",a),s.enabled&&(this.activeBaseLayer=e,i.checked=!0),t.appendChild(i),t.appendChild(o),r.appendChild(t),i.addEventListener("change",(()=>{this.baseLayers[this.activeBaseLayer].layers.forEach((e=>{this.map.setLayoutProperty(e,"visibility","none")})),this.baseLayers[e].layers.forEach((e=>{this.map.setLayoutProperty(e,"visibility","visible")})),this.baseLayers[this.activeBaseLayer].enabled=!1,this.baseLayers[e].enabled=!0,this.activeBaseLayer=e}))})),Object.values(this.baseLayers).forEach((e=>{e.enabled||e.layers.forEach((e=>{this.map.setLayoutProperty(e,"visibility","none")}))})),Object.values(this.baseLayers).forEach((e=>{e.enabled&&e.layers.forEach((e=>{this.map.setLayoutProperty(e,"visibility","visible")}))})),r.appendChild(n.create("div","d-block w-100 my-1 border-bottom")),Object.keys(this.overlays).forEach((e=>{const t=n.create("div","form-check d-flex align-items-center"),i=n.create("input","form-check-input mt-0 me-1 cursor-pointer border-dark-subtle"),o=n.create("label","form-check-label cursor-pointer w-100"),s=this.overlays[e],a=`${this.map.getContainer().id}-${e}`;i.type="checkbox",i.id=a,i.name=a,o.textContent=s.name,o.setAttribute("for",a),s.enabled&&(i.checked=!0),s.layers.forEach((e=>{this.map.setLayoutProperty(e,"visibility",s.enabled?"visible":"none")})),t.appendChild(i),t.appendChild(o),r.appendChild(t),i.addEventListener("change",(t=>{this.overlays[e].enabled=t.target.checked,this.overlays[e].layers.forEach((e=>{this.map.setLayoutProperty(e,"visibility",t.target.checked?"visible":"none")}))}))})),t.appendChild(r),i.addEventListener("click",(e=>{e.preventDefault(),i.classList.toggle("visually-hidden"),r.classList.toggle("visually-hidden")})),document.addEventListener("mouseup",(e=>{e.target===t||t.contains(e.target)||(i.classList.remove("visually-hidden"),r.classList.add("visually-hidden"))})),t}onRemove(){}getLayerStates(){return{baseLayers:Object.keys(this.baseLayers).map((e=>({key:e,enabled:this.baseLayers[e].enabled}))),overlays:Object.keys(this.overlays).map((e=>({key:e,enabled:this.overlays[e].enabled})))}}}var ds=i(356),ps=i.n(ds);class fs extends(ps()){onAdd(e){return this._map=e,this._drawActive=!1,this._initControl(),this._registerEvents(),this._container}_initControl(){this._container=document.createElement("div"),this._container.className="maplibregl-ctrl mapboxgl-ctrl maplibregl-measures maplibregl-ctrl-group mapboxgl-ctrl-group",this.initDrawBtn(this._drawCtrl.modes.DRAW_LINE_STRING),this.initClearBtn()}_activateDraw(){this._drawActive||(this._map.addControl(this._drawCtrl,"top-left"),this._drawActive=!0)}_deactivateDraw(){this._drawActive&&(this._map.removeControl(this._drawCtrl),this._drawActive=!1)}initDrawBtn(e){const t=document.createElement("button");t.type="button",t.title=this.options?.lang?.lengthMeasurementButtonTitle??"Measure distance";const i=document.createElement("i");i.className="bi bi-rulers text-dark",t.appendChild(i),t.addEventListener("click",(()=>{this._activateDraw(),this._drawCtrl.changeMode(e)})),this._container.appendChild(t)}initClearBtn(){const e=document.createElement("button");e.type="button",e.title=this.options?.lang?.clearMeasurementsButtonTitle??"Clear measurements";const t=document.createElement("i");t.className="bi bi-trash text-dark",e.appendChild(t),e.addEventListener("click",(()=>{this._drawActive&&(this._drawCtrl.deleteAll(),this._updateLabels(),this._deactivateDraw())})),this._container.appendChild(e)}}class ms{terrainOptions={};constructor(e){this.terrainOptions=e}onAdd(e){const t=n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),i=n.create("button","text-black");return i.textContent="3D",i.style="font-size: 16px; font-weight: bold;",i.addEventListener("click",(t=>{t.preventDefault(),e.getTerrain()?(i.textContent="3D",e.setTerrain(null),e.easeTo({pitch:0,bearing:0})):(i.textContent="2D",e.setTerrain(this.terrainOptions),e.easeTo({pitch:45}))})),t.appendChild(i),t}onRemove(){}}class gs{options={limit:5};constructor(e){this.options={...this.options,...e}}forwardGeocode(e){}async getSuggestions(e){const t=await fetch(`/api/paths/search/suggestions?query=${e.query}&limit=${this.options.limit}`);return{suggestions:(await t.json()).matches.map((e=>({text:`${e.name}
2 - ${e.region.replace("Natural Resource District","")}`,placeId:e.id})))}}async searchByPlaceId(e){const t=await fetch(`/api/paths/search?id=${e.query}`),i=(await t.json()).features[0];return{place:{type:"Feature",geometry:{type:"Point",coordinates:i.geometry.coordinates[0]},id:i.properties.id,text:i.properties.name,place_name:i.properties.name,place_type:["road"]}}}}function ys(e){return Object.keys(e).some((t=>{let i=e[t];if(!i)return!1;switch(i&&i.toParam&&(i=i.toParam()),i.constructor.name){case"Array":case"Object":case"Date":case"Function":case"Boolean":case"String":case"Number":return!1;default:return!0}}))}function _s(e){const t={};return Object.keys(e).forEach((i=>{var r,n;let o,s=e[i];if(s&&s.toParam&&(s=s.toParam()),s||0===s||"boolean"==typeof s||"string"==typeof s){switch(s.constructor.name){case"Array":const e=null===(n=null===(r=s[0])||void 0===r?void 0:r.constructor)||void 0===n?void 0:n.name;o="Array"===e?s:"Object"===e?JSON.stringify(s):s.join(",");break;case"Object":o=JSON.stringify(s);break;case"Date":o=s.valueOf();break;case"Function":o=null;break;case"Boolean":o=s+"";break;default:o=s}(o||0===o||"string"==typeof o||Array.isArray(o))&&(t[i]=o)}})),t}function vs(e,t){return Array.isArray(t)&&t[0]&&Array.isArray(t[0])?t.map((t=>vs(e,t))).join("&"):encodeURIComponent(e)+"="+encodeURIComponent(t)}function bs(e){const t=_s(e);return Object.keys(t).map((e=>vs(e,t[e]))).join("&")}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const xs=globalThis.FormData;globalThis.File,globalThis.Blob;
2class ws extends Error{constructor(e,t,i,r,n){super(e);const o=new.target.prototype;Object.setPrototypeOf(this,o),e=e||"UNKNOWN_ERROR",t=t||"UNKNOWN_ERROR_CODE",this.name="ArcGISRequestError",this.message="UNKNOWN_ERROR_CODE"===t?e:`${t}: ${e}`,this.originalMessage=e,this.code=t,this.response=i,this.url=r,this.options=n}}const Ts="ARCGIS_REST_JS_NO_CORS";globalThis[Ts]||(globalThis[Ts]=Object.assign({},{noCorsDomains:[],crossOriginNoCorsDomains:{},pendingNoCorsRequests:{}}));const Es=globalThis[Ts];function Ss(e){const t=new URL(e).origin;-1===Es.noCorsDomains.indexOf(t)&&Es.noCorsDomains.push(t)}function Ps(e){let t=!1;if(Es.noCorsDomains.length){const i=new URL(e).origin.toLowerCase();t=Es.noCorsDomains.some((e=>i.includes(e)))}return t}function Is(e){console&&console.warn&&console.warn.apply(console,[e])}const Cs="@esri/arcgis-rest-js";class Ms extends ws{constructor(e="AUTHENTICATION_ERROR",t="AUTHENTICATION_ERROR_CODE",i,r,n){super(e,t,i,r,n),this.name="ArcGISAuthError",this.message="AUTHENTICATION_ERROR_CODE"===t?e:`${t}: ${e}`;const o=new.target.prototype;Object.setPrototypeOf(this,o)}retry(e,t=1){let i=0;const r=(n,o)=>{i+=1,e(this.url,this.options).then((e=>{const t=Object.assign(Object.assign({},this.options),{authentication:e});return As(this.url,t)})).then((e=>{n(e)})).catch((e=>{"ArcGISAuthError"===e.name&&i<t?r(n,o):e.name===this.name&&e.message===this.message&&i>=t?o(this):o(e)}))};return new Promise(((e,t)=>{r(e,t)}))}}function As(e,t){const i=globalThis.DEFAULT_ARCGIS_REQUEST_OPTIONS||{httpMethod:"POST",params:{f:"json"}},r=Object.assign(Object.assign(Object.assign({httpMethod:"POST"},i),t),{params:Object.assign(Object.assign({},i.params),t.params),headers:Object.assign(Object.assign({},i.headers),t.headers)}),{httpMethod:n,rawResponse:o}=r,s=Object.assign({f:"json"},r.params);let a=null;const l={method:n,signal:r.signal,credentials:r.credentials||"same-origin"};let c;if(Ps(e)&&(l.credentials="include"),r.headers&&r.headers["X-Esri-Auth-Client-Id"]&&e.indexOf("/oauth2/platformSelf")>-1&&(l.credentials="include"),"string"==typeof r.authentication){const e=r.authentication;c={portal:"https://www.arcgis.com/sharing/rest",getToken:()=>Promise.resolve(e)},r.authentication.startsWith("AAPK")||r.authentication.startsWith("AATK")||r.suppressWarnings||globalThis.ARCGIS_REST_JS_SUPPRESS_TOKEN_WARNING||(Is("Using an oAuth 2.0 access token directly in the token option is discouraged. Consider using ArcGISIdentityManager or Application session. See https://esriurl.com/arcgis-rest-js-direct-token-warning for more information."),globalThis.ARCGIS_REST_JS_SUPPRESS_TOKEN_WARNING=!0)}else c=r.authentication;const u=e;let h=!1;"undefined"!=typeof window&&(h=function(e,t){var i;if((t||window)&&e){const r=null===(i=(t=t||window).location)||void 0===i?void 0:i.origin;return e.startsWith(r)}return!1}(e));const d=!h&&function(e){let t=!1;if(Ps(e)){const i=new URL(e).origin.toLowerCase(),r=Es.crossOriginNoCorsDomains[i]||0;Date.now()-36e5>r&&(t=!0)}return t}(e);r.headers&&r.headers["X-Esri-Auth-Client-Id"]&&e.indexOf("/oauth2/platformSelf")>-1&&(l.credentials="include");let p=Promise.resolve();return d&&(l.credentials="include",p=function(e){const t=new URL(e);e=t.origin+t.pathname,t.search.includes("f=json")&&(e+="?f=json");const i=t.origin;return Es.pendingNoCorsRequests[i]||(Es.pendingNoCorsRequests[i]=fetch(e,{mode:"no-cors",credentials:"include",cache:"no-store"}).then((e=>{-1===Es.noCorsDomains.indexOf(i)&&Es.noCorsDomains.push(i),Es.crossOriginNoCorsDomains[i.toLowerCase()]=Date.now(),delete Es.pendingNoCorsRequests[i]})).catch((e=>(delete Es.pendingNoCorsRequests[i],Promise.reject(new Error(`no-cors request to ${i} failed`)))))),Es.pendingNoCorsRequests[i]}(e)),p.then((()=>c?c.getToken(e).catch((t=>(t.url=e,t.options=r,a=t,Promise.resolve("")))):Promise.resolve(""))).then((t=>{t.length&&(s.token=t),c&&c.getDomainCredentials&&(l.credentials=c.getDomainCredentials(e));const i={};if("GET"===l.method){s.token&&r.hideToken&&"undefined"==typeof window&&(i["X-Esri-Authorization"]=`Bearer ${s.token}`,delete s.token);const n=""===bs(s)?e:e+"?"+bs(s);r.maxUrlLength&&n.length>r.maxUrlLength||!r.maxUrlLength&&n.length>2e3||s.token&&r.hideToken?(l.method="POST",t.length&&r.hideToken&&(s.token=t,delete i["X-Esri-Authorization"])):e=n}const n=new RegExp("/items/.+/updateResources").test(e);return"POST"===l.method&&(l.body=function(e,t){const i=ys(e)||t,r=_s(e);if(i){const e=new xs;return Object.keys(r).forEach((t=>{if("undefined"!=typeof Blob&&r[t]instanceof Blob){const i=r.fileName||r[t].name||t;e.append(t,r[t],i)}
2else e.append(t,r[t])})),e}return bs(e)}(s,n)),l.headers=Object.assign(Object.assign({},i),r.headers),("undefined"==typeof window||window&&void 0===window.document)&&!l.headers.referer&&(l.headers.referer=Cs),ys(s)||n||(l.headers["Content-Type"]="application/x-www-form-urlencoded"),globalThis.fetch?globalThis.fetch(e,l):Promise.resolve({fetch:globalThis.fetch,Headers:globalThis.Headers,Response:globalThis.Response,Request:globalThis.Request}).then((({fetch:t})=>t(e,l)))})).then((t=>{if(!t.ok)return t.json().then((i=>{const{status:n,statusText:o}=t,{message:s,details:a}=i.error,l=`${s}. ${a?a.join(" "):""}`.trim();throw new ws(l,`HTTP ${n} ${o}`,i,e,r)})).catch((i=>{if("ArcGISRequestError"===i.name)throw i;const{status:n,statusText:o}=t;throw new ws(o,`HTTP ${n}`,t,e,r)}));if(o)return t;switch(s.f){case"json":case"geojson":return t.json();case"html":case"text":return t.text();default:return t.blob()}})).then((t=>{if("json"!==s.f&&"geojson"!==s.f||o)return t;{const i=function(e,t,i,r,n){if(e.code>=400){const{message:i,code:n}=e;throw new ws(i,n,e,t,r)}if(e.error){const{message:i,code:o,messageCode:s}=e.error,a=s||o||"UNKNOWN_ERROR_CODE";if(498===o||499===o)throw n||new Ms(i,a,e,t,r);throw new ws(i,a,e,t,r)}if("failed"===e.status||"failure"===e.status){let i,n="UNKNOWN_ERROR_CODE";try{i=JSON.parse(e.statusMessage).message,n=JSON.parse(e.statusMessage).code}catch(t){i=e.statusMessage||e.message}throw new ws(i,n,e,t,r)}return e}(t,u,0,r,a);if(t&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(e)&&Array.isArray(t.authorizedCrossOriginNoCorsDomains)&&t.authorizedCrossOriginNoCorsDomains.forEach((e=>{e=e.toLowerCase(),/^https?:\/\//.test(e)?Ss(e):(Ss("http://"+e),Ss("https://"+e))})),a){const t=e.toLowerCase().split(/\/rest(\/admin)?\/services\//)[0];r.authentication.federatedServers[t]={token:[],expires:new Date(Date.now()+864e5)},a=null}return i}}))}function Ls(e,t={params:{f:"json"}}){const{request:i}=t,r=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i}(t,["request"]);return i?i(e,r):As(e,r).catch((e=>e instanceof Ms&&t.authentication&&"string"!=typeof t.authentication&&t.authentication.canRefresh&&t.authentication.refreshCredentials?e.retry((()=>t.authentication.refreshCredentials()),1):Promise.reject(e)))}var Fs,Ds;!function(e){e.TOKEN_REFRESH_FAILED="TOKEN_REFRESH_FAILED",e.GENERATE_TOKEN_FOR_SERVER_FAILED="GENERATE_TOKEN_FOR_SERVER_FAILED",e.REFRESH_TOKEN_EXCHANGE_FAILED="REFRESH_TOKEN_EXCHANGE_FAILED",e.NOT_FEDERATED="NOT_FEDERATED",e.UNKNOWN_ERROR_CODE="UNKNOWN_ERROR_CODE"}(Fs||(Fs={}));class ks extends Error{constructor(e="UNKNOWN_ERROR",t=Fs.UNKNOWN_ERROR_CODE,i,r,n){super(e);const o=new.target.prototype;Object.setPrototypeOf(this,o),this.name="ArcGISTokenRequestError",this.message=`${t}: ${e}`,this.originalMessage=e,this.code=t,this.response=i,this.url=r,this.options=n}}class Os extends Error{constructor(){super("The user has denied your authorization request.");const e=new.target.prototype;Object.setPrototypeOf(this,e),this.name="ArcGISAccessDeniedError"}}function Rs(e){return"string"!=typeof e||"/"===(e=e.trim())[e.length-1]&&(e=e.slice(0,-1)),e}Error,function(e){e.ArcGISRequestError="ArcGISRequestError",e.ArcGISAuthError="ArcGISAuthError",e.ArcGISAccessDeniedError="ArcGISAccessDeniedError",e.ArcGISTokenRequestError="ArcGISTokenRequestError"}(Ds||(Ds={}));const zs=3e5;function Ns(e,t){const i=t;return i.rawResponse=!1,Ls(e,i).then((e=>{if("token"in e&&"expires"in e)return{token:e.token,username:t.params.username,expires:new Date(e.expires)};const i={token:e.access_token,username:e.username,expires:new Date(Date.now()+1e3*e.expires_in-zs),ssl:!0===e.ssl};return e.refresh_token&&(i.refreshToken=e.refresh_token),e.refresh_token_expires_in&&(i.refreshTokenExpires=new Date(Date.now()+1e3*e.refresh_token_expires_in-zs)),i}))}class Bs{constructor(e){this.portal=e.portal?Rs(e.portal):"https://www.arcgis.com/sharing/rest",this._username=e.username}get username(){return this._username?this._username:this._user&&this._user.username?this._user.username:void 0}getUsername(){return this.username?Promise.resolve(this.username):this.getUser().then((e=>e.username))}
2getUser(e){if(this._pendingUserRequest)return this._pendingUserRequest;if(this._user)return Promise.resolve(this._user);{const t=`${this.portal}/community/self`,i=Object.assign(Object.assign({httpMethod:"GET",authentication:this},e),{rawResponse:!1});return this._pendingUserRequest=Ls(t,i).then((e=>(this._user=e,this._pendingUserRequest=null,e))),this._pendingUserRequest}}clearCachedUserInfo(){this._user=null}}const Vs=/^https?:\/\/(\S+)\.arcgis\.com.+/;function js(e){return Vs.test(e)}function Us(e){if(!Vs.test(e))return null;const t=e.match(Vs)[1].split(".").pop();return t.includes("dev")?"dev":t.includes("qa")?"qa":"production"}function Gs(e,t=window){return!t&&window&&(t=window),t.btoa(String.fromCharCode.apply(null,e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function $s(e){return!e&&window&&(e=window),Gs(e.crypto.getRandomValues(new Uint8Array(32)))}class qs extends Bs{constructor(e){if(super(e),this.clientId=e.clientId,this._refreshToken=e.refreshToken,this._refreshTokenExpires=e.refreshTokenExpires,this.password=e.password,this._token=e.token,this._tokenExpires=e.tokenExpires,this.portal=e.portal?Rs(e.portal):"https://www.arcgis.com/sharing/rest",this.ssl=e.ssl,this.provider=e.provider||"arcgis",this.tokenDuration=e.tokenDuration||20160,this.redirectUri=e.redirectUri,this.server=e.server,this.referer=e.referer,this.federatedServers={},this.trustedDomains=[],e.server){const t=this.getServerRootUrl(e.server);this.federatedServers[t]={token:e.token,expires:e.tokenExpires}}this._pendingTokenRequests={}}get token(){return this._token}get tokenExpires(){return this._tokenExpires}get refreshToken(){return this._refreshToken}get refreshTokenExpires(){return this._refreshTokenExpires}get canRefresh(){return!(!this.username||!this.password)||!!(this.clientId&&this.refreshToken&&this.redirectUri)}static beginOAuth2(e,t){!t&&window&&(t=window);const{portal:i,provider:r,clientId:n,expiration:o,redirectUri:s,popup:a,popupWindowFeatures:l,locale:c,params:u,style:h,pkce:d,state:p}=Object.assign({portal:"https://www.arcgis.com/sharing/rest",provider:"arcgis",expiration:20160,popup:!0,popupWindowFeatures:"height=400,width=600,menubar=no,location=yes,resizable=yes,scrollbars=yes,status=yes",locale:"",style:"",pkce:!0},e),f=p||$s(t),m=`ARCGIS_REST_JS_AUTH_STATE_${n}`;t.localStorage.setItem(m,f);let g=`${Rs(i)}/oauth2/authorize`;const y={client_id:n,response_type:d?"code":"token",expiration:o,redirect_uri:s,state:JSON.stringify({id:f,originalUrl:t.location.href}),locale:c,style:h};let _;if("arcgis"!==r&&(g=`${Rs(i)}/oauth2/social/authorize`,y.socialLoginProviderName=r,y.autoAccountCreateForSocial=!0),d){const e=$s(t),i=`ARCGIS_REST_JS_CODE_VERIFIER_${n}`;t.localStorage.setItem(i,e),_=function(e,t=window){if(!t&&window&&(t=window),e&&t.isSecureContext&&t.crypto&&t.crypto.subtle){const i=(new t.TextEncoder).encode(e);return t.crypto.subtle.digest("SHA-256",i).then((e=>Gs(new Uint8Array(e),t)))}return Promise.resolve(null)}(e,t).then((function(t){y.code_challenge_method=t?"S256":"plain",y.code_challenge=t||e}))}else _=Promise.resolve();return _.then((()=>(g=`${g}?${bs(y)}`,u&&(g=`${g}&${bs(u)}`),a?new Promise(((e,r)=>{t.addEventListener(`arcgis-rest-js-popup-auth-${n}`,(t=>{if("access_denied"===t.detail.error){const e=new Os;return r(e),e}if(t.detail.errorMessage){const e=new Ms(t.detail.errorMessage,t.detail.error);return r(e),e}e(new qs({clientId:n,portal:i,ssl:t.detail.ssl,token:t.detail.token,tokenExpires:t.detail.expires,username:t.detail.username,refreshToken:t.detail.refreshToken,refreshTokenExpires:t.detail.refreshTokenExpires,redirectUri:s}))}),{once:!0}),t.open(g,"oauth-window",l),t.dispatchEvent(new CustomEvent("arcgis-rest-js-popup-auth-start"))})):void(t.location.href=g))))}static completeOAuth2(e,t){!t&&window&&(t=window);const{portal:i,clientId:r,popup:n,pkce:o,redirectUri:s}=Object.assign({portal:"https://www.arcgis.com/sharing/rest",popup:!0,pkce:!0},e),a=`ARCGIS_REST_JS_AUTH_STATE_${r}`,l=t.localStorage.getItem(a),c=!(h=o?t.location.search.replace(/^\?/,""):t.location.hash.replace(/^#/,""))||h.length<=0?{}:h.replace(/^#/,"").replace(/^\?/,"").split("&").reduce(((e,t)=>{const{key:i,value:r}=function(e){const[t,i]=e.split("=");return{key:decodeURIComponent(t),value:decodeURIComponent(i)}}(t);return e[i]=r,e}),{}),u=c&&c.state?JSON.parse(c.state):void 0;var h;function d(e,i,o){return t.localStorage.removeItem(a),n&&t.opener?(t.opener.dispatchEvent(new CustomEvent(`arcgis-rest-js-popup-auth-${r}`,{detail:{error:i,errorMessage:e}})),void t.close()):(o&&t.history.replaceState(t.history.state,"",o),"access_de
2nied"===i?Promise.reject(new Os):Promise.reject(new Ms(e,i)))}function p(e,o){return t.localStorage.removeItem(a),n&&t.opener?(t.opener.dispatchEvent(new CustomEvent(`arcgis-rest-js-popup-auth-${r}`,{detail:Object.assign({},e)})),void t.close()):(t.history.replaceState(t.history.state,"",o),new qs({clientId:r,portal:i,ssl:e.ssl,token:e.token,tokenExpires:e.expires,username:e.username,refreshToken:e.refreshToken,refreshTokenExpires:e.refreshTokenExpires,redirectUri:s||location.href.replace(location.search,"")}))}if(!l||!u)return d("No authentication state was found, call `ArcGISIdentityManager.beginOAuth2(...)` to start the authentication process.","no-auth-state");if(u.id!==l)return d("Saved client state did not match server sent state.","mismatched-auth-state");if(c.error){const e=c.error;return d(c.error_description||"Unknown error",e,u.originalUrl)}if(o&&c.code){const e=Rs(`${i}/oauth2/token/`),n=`ARCGIS_REST_JS_CODE_VERIFIER_${r}`,o=t.localStorage.getItem(n);return t.localStorage.removeItem(n),Ns(e,{httpMethod:"POST",params:{client_id:r,code_verifier:o,grant_type:"authorization_code",redirect_uri:s||location.href.replace(location.search,""),code:c.code}}).then((e=>p(Object.assign(Object.assign({},e),u),u.originalUrl))).catch((e=>d(e.originalMessage,e.code,u.originalUrl)))}return!o&&c.access_token?Promise.resolve(p(Object.assign({token:c.access_token,expires:new Date(Date.now()+1e3*parseInt(c.expires_in,10)),ssl:"true"===c.ssl,username:c.username},u),u.originalUrl)):d("Unknown error","oauth-error",u.originalUrl)}static fromParent(e,t){let i;return!t&&window&&(t=window),new Promise(((r,n)=>{i=e=>{if(e.source===t.parent&&e.data)try{return r(qs.parentMessageHandler(e))}catch(e){return n(e)}},t.addEventListener("message",i,!1),t.parent.postMessage({type:"arcgis:auth:requestCredential"},e)})).then((e=>(t.removeEventListener("message",i,!1),e)))}static authorize(e,t){const{portal:i,clientId:r,expiration:n,redirectUri:o,state:s}=Object.assign({portal:"https://arcgis.com/sharing/rest",expiration:20160},e),a={client_id:r,expiration:n,response_type:"code",redirect_uri:o};s&&(a.state=s);const l=`${i}/oauth2/authorize?${bs(a)}`;t.writeHead(301,{Location:l}),t.end()}static exchangeAuthorizationCode(e,t){const{portal:i,clientId:r,redirectUri:n}=Object.assign({portal:"https://www.arcgis.com/sharing/rest"},e);return Ns(`${i}/oauth2/token`,{params:{grant_type:"authorization_code",client_id:r,redirect_uri:n,code:t}}).then((e=>new qs({clientId:r,portal:i,ssl:e.ssl,redirectUri:n,refreshToken:e.refreshToken,refreshTokenExpires:e.refreshTokenExpires,token:e.token,tokenExpires:e.expires,username:e.username}))).catch((e=>{throw new ks(e.message,Fs.REFRESH_TOKEN_EXCHANGE_FAILED,e.response,e.url,e.options)}))}static deserialize(e){const t=JSON.parse(e);return new qs({clientId:t.clientId,refreshToken:t.refreshToken,refreshTokenExpires:t.refreshTokenExpires?new Date(t.refreshTokenExpires):void 0,username:t.username,password:t.password,token:t.token,tokenExpires:t.tokenExpires?new Date(t.tokenExpires):void 0,portal:t.portal,ssl:t.ssl,tokenDuration:t.tokenDuration,redirectUri:t.redirectUri,server:t.server})}static fromCredential(e,t){const i=void 0===e.ssl||e.ssl,r=e.expires||Date.now()+72e5;return t.hasServer?new qs({server:e.server,ssl:i,token:e.token,username:e.userId,tokenExpires:new Date(r)}):new qs({portal:Rs(e.server.includes("sharing/rest")?e.server:e.server+"/sharing/rest"),ssl:i,token:e.token,username:e.userId,tokenExpires:new Date(r)})}static parentMessageHandler(e){if("arcgis:auth:credential"===e.data.type){const t=e.data.credential;return function(e){return"string"==typeof e.userId||"number"==typeof e.expires}(t)?qs.fromCredential(t,{hasPortal:!0,hasServer:!1,server:t.server}):new qs(t)}if("arcgis:auth:error"===e.data.type){const t=new Error(e.data.error.message);throw t.name=e.data.error.name,t}throw new Error("Unknown message type.")}static destroy(e){return function(e){const t=`${Rs(e.portal||"https://www.arcgis.com/sharing/rest")}/oauth2/revokeToken/`,i=e.token,r=e.clientId;delete e.portal,delete e.clientId,delete e.token;const n=Object.assign(Object.assign({},e),{httpMethod:"POST",params:{client_id:r,auth_token:i}});return Ls(t,n).then((e=>{if(!e.success)throw new ws("Unable to revoke token",500,e,t,n);return e}))}({clientId:e.clientId,portal:e.portal,token:e.refreshToken||e.token})}static fromToken(e){const t=new qs(e);return t.getUser().then((()=>t))}static signIn(e){const t=new qs(e);return t.getUser().then((()=>t))}toCredential(){return{expires:this.tokenExpires.getTime(),server:this.server||this.portal,ssl:this.ssl,token:this.token,userId:this.username}}
2getPortal(e){if(this._pendingPortalRequest)return this._pendingPortalRequest;if(this._portalInfo)return Promise.resolve(this._portalInfo);{const t=`${this.portal}/portals/self`,i=Object.assign(Object.assign({httpMethod:"GET",authentication:this},e),{rawResponse:!1});return this._pendingPortalRequest=Ls(t,i).then((e=>(this._portalInfo=e,this._pendingPortalRequest=null,e))),this._pendingPortalRequest}}getToken(e,t){return function(e,t){const i=js(e),r=js(t),n=Us(e),o=Us(t);return!(!i||!r||n!==o)}(this.portal,e)||new RegExp(this.portal,"i").test(e)?this.getFreshToken(t):this.getTokenForServer(e,t)}validateAppAccess(e){return this.getToken(this.portal).then((t=>function(e,t,i="https://www.arcgis.com/sharing/rest"){return Ls(`${i}/oauth2/validateAppAccess`,{method:"POST",params:{f:"json",client_id:t,token:e}})}(t,e)))}toJSON(){return{type:"ArcGISIdentityManager",clientId:this.clientId,refreshToken:this.refreshToken,refreshTokenExpires:this.refreshTokenExpires||void 0,username:this.username,password:this.password,token:this.token,tokenExpires:this.tokenExpires||void 0,portal:this.portal,ssl:this.ssl,tokenDuration:this.tokenDuration,redirectUri:this.redirectUri,server:this.server}}serialize(){return JSON.stringify(this)}enablePostMessageAuth(e,t){!t&&window&&(t=window),this._hostHandler=this.createPostMessageHandler(e),t.addEventListener("message",this._hostHandler,!1)}disablePostMessageAuth(e){!e&&window&&(e=window),e.removeEventListener("message",this._hostHandler,!1)}refreshCredentials(e){return this.clearCachedUserInfo(),this.username&&this.password?this.refreshWithUsernameAndPassword(e):this.clientId&&this.refreshToken?this.refreshWithRefreshToken():Promise.reject(new ks("Unable to refresh token. No refresh token or password present.",Fs.TOKEN_REFRESH_FAILED))}getServerRootUrl(e){const[t]=Rs(e).split(/\/rest(\/admin)?\/services(?:\/|#|\?|$)/),[i,r,n]=t.match(/(https?:\/\/)(.+)/),[o,...s]=n.split("/");return`${r}${o.toLowerCase()}/${s.join("/")}`}getDomainCredentials(e){return this.trustedDomains&&this.trustedDomains.length?(e=e.toLowerCase(),this.trustedDomains.some((t=>e.startsWith(t.toLowerCase())))?"include":"same-origin"):"same-origin"}signOut(){return qs.destroy(this)}createPostMessageHandler(e){return t=>{const i=e.indexOf(t.origin)>-1,r="arcgis:auth:requestCredential"===t.data.type,n=this.tokenExpires.getTime()>Date.now();if(i&&r){let e={};if(n){const t=this.toCredential();t.server=t.server.replace("/sharing/rest",""),e={type:"arcgis:auth:credential",credential:t}}else e={type:"arcgis:auth:error",error:{name:"tokenExpiredError",message:"Token was expired, and not returned to the child application"}};t.source.postMessage(e,t.origin)}}}getTokenForServer(e,t){const i=this.getServerRootUrl(e),r=this.federatedServers[i];return r&&r.expires&&r.expires.getTime()>Date.now()?Promise.resolve(r.token):(this._pendingTokenRequests[i]||(this._pendingTokenRequests[i]=this.fetchAuthorizedDomains().then((()=>Ls(`${i}/rest/info`,{credentials:this.getDomainCredentials(e)}).then((r=>{if(r.owningSystemUrl){if(function(e,t){const i=Rs(function(e){if(!Vs.test(e))return e;switch(Us(e)){case"dev":return"https://devext.arcgis.com/sharing/rest";case"qa":return"https://qaext.arcgis.com/sharing/rest";default:return"https://www.arcgis.com/sharing/rest"}}(t)).replace(/https?:\/\//,""),r=Rs(e).replace(/https?:\/\//,"");return new RegExp(r,"i").test(i)}(r.owningSystemUrl,this.portal))return Ls(`${r.owningSystemUrl}/sharing/rest/info`,t);throw new ks(`${e} is not federated with ${this.portal}.`,Fs.NOT_FEDERATED)}if(r.authInfo&&void 0!==this.federatedServers[i])return Promise.resolve({authInfo:r.authInfo});throw new ks(`${e} is not federated with any portal and is not explicitly trusted.`,Fs.NOT_FEDERATED)})).then((e=>this.token&&this.tokenExpires.getTime()<Date.now()?this.server?this.refreshCredentials().then((()=>({token:this.token,expires:this.tokenExpires}))):this.refreshCredentials().then((()=>this.generateTokenForServer(e.authInfo.tokenServicesUrl,i))):this.generateTokenForServer(e.authInfo.tokenServicesUrl,i))).then((e=>(this.federatedServers[i]=e,delete this._pendingTokenRequests[i],e.token)))))),this._pendingTokenRequests[i])}generateTokenForServer(e,t){return Ls(e,{params:{token:this.token,serverUrl:t,expiration:this.tokenDuration}}).then((e=>({token:e.token,expires:new Date(e.expires-3e5)}))).catch((e=>{throw new ks(e.message,Fs.GENERATE_TOKEN_FOR_SERVER_FAILED,e.response,e.url,e.options)}))}getFreshToken(e){return this.token&&!this.tokenExpires||this.token&&this.tokenExpires&&this.tokenExpires.getTime()>
2Date.now()?Promise.resolve(this.token):(this._pendingTokenRequests[this.portal]||(this._pendingTokenRequests[this.portal]=this.refreshCredentials(e).then((()=>(this._pendingTokenRequests[this.portal]=null,this.token)))),this._pendingTokenRequests[this.portal])}refreshWithUsernameAndPassword(e){const t={username:this.username,password:this.password,expiration:this.tokenDuration,client:"referer",referer:this.referer?this.referer:"undefined"!=typeof window&&void 0!==window.document&&window.location&&window.location.origin?window.location.origin:Cs};return(this.server?Ls(`${this.getServerRootUrl(this.server)}/rest/info`).then((i=>Ls(i.authInfo.tokenServicesUrl,Object.assign({params:t},e)))):Ls(`${this.portal}/generateToken`,Object.assign({params:t},e))).then((e=>(this.updateToken(e.token,new Date(e.expires)),this))).catch((e=>{throw new ks(e.message,Fs.TOKEN_REFRESH_FAILED,e.response,e.url,e.options)}))}refreshWithRefreshToken(e){if(this.refreshToken&&this.refreshTokenExpires&&this.refreshTokenExpires.getTime()-864e5<Date.now())return this.exchangeRefreshToken(e);const t=Object.assign({params:{client_id:this.clientId,refresh_token:this.refreshToken,grant_type:"refresh_token"}},e);return Ns(`${this.portal}/oauth2/token`,t).then((e=>this.updateToken(e.token,e.expires))).catch((e=>{throw new ks(e.message,Fs.TOKEN_REFRESH_FAILED,e.response,e.url,e.options)}))}updateToken(e,t){return this._token=e,this._tokenExpires=t,this}exchangeRefreshToken(e){const t=Object.assign({params:{client_id:this.clientId,refresh_token:this.refreshToken,redirect_uri:this.redirectUri,grant_type:"exchange_refresh_token"}},e);return Ns(`${this.portal}/oauth2/token`,t).then((e=>(this._token=e.token,this._tokenExpires=e.expires,this._refreshToken=e.refreshToken,this._refreshTokenExpires=e.refreshTokenExpires,this))).catch((e=>{throw new ks(e.message,Fs.REFRESH_TOKEN_EXCHANGE_FAILED,e.response,e.url,e.options)}))}fetchAuthorizedDomains(){return this.server||!this.portal?Promise.resolve(this):this.getPortal().then((e=>(e.authorizedCrossOriginDomains&&e.authorizedCrossOriginDomains.length&&(this.trustedDomains=e.authorizedCrossOriginDomains.filter((e=>!e.startsWith("http://"))).map((e=>e.startsWith("https://")?e:`https://${e}`))),this)))}}function Zs(e){return console.log("DEPRECATED:, 'UserSession' is deprecated. Use 'ArcGISIdentityManager' instead."),new qs(e)}var Ws,Hs;Zs.beginOAuth2=function(...e){return console.warn("DEPRECATED:, 'UserSession.beginOAuth2' is deprecated. Use 'ArcGISIdentityManager.beginOAuth2' instead."),qs.beginOAuth2(...e)},Zs.completeOAuth2=function(...e){return console.warn("DEPRECATED:, 'UserSession.completeOAuth2()' is deprecated. Use 'ArcGISIdentityManager.completeOAuth2()' instead."),e.length<=1&&console.warn("WARNING:, 'UserSession.completeOAuth2()' is now async and returns a promise the resolves to an instance of `ArcGISIdentityManager`."),qs.completeOAuth2(...e)},Zs.fromParent=function(...e){return console.warn("DEPRECATED:, 'UserSession.fromParent' is deprecated. Use 'ArcGISIdentityManager.fromParent' instead."),qs.fromParent(...e)},Zs.authorize=function(...e){return console.warn("DEPRECATED:, 'UserSession.authorize' is deprecated. Use 'ArcGISIdentityManager.authorize' instead."),qs.authorize(...e)},Zs.exchangeAuthorizationCode=function(...e){return console.warn("DEPRECATED:, 'UserSession.exchangeAuthorizationCode' is deprecated. Use 'ArcGISIdentityManager.exchangeAuthorizationCode' instead."),qs.exchangeAuthorizationCode(...e)},Zs.fromCredential=function(...e){return console.log("DEPRECATED:, 'UserSession.fromCredential' is deprecated. Use 'ArcGISIdentityManager.fromCredential' instead."),console.warn("WARNING:, 'UserSession.fromCredential' now requires a `ServerInfo` object from the JS API as a second parameter."),qs.fromCredential(...e)},Zs.deserialize=function(...e){return console.log("DEPRECATED:, 'UserSession.deserialize' is deprecated. Use 'ArcGISIdentityManager.deserialize' instead."),qs.deserialize(...e)},(Hs=Ws||(Ws={})).Success="Succeeded",Hs.Failed="Failed",Hs.Waiting="Waiting",Hs.Cancelled="Cancelled",Hs.Cancelling="Cancelling",Hs.New="New",Hs.Executing="Executing",Hs.Submitted="Submitted",Hs.Failure="Failure",Hs.TimedOut="TimedOut",Hs.Error="Error",Hs.Status="Etatus",Hs.Unknown="Unknown";
2const Xs="https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/";var Ys=function(e,t,i,r){var n=(r[0]-i[0])*(e[1]-i[1])-(r[1]-i[1])*(e[0]-i[0]),o=(t[0]-e[0])*(e[1]-i[1])-(t[1]-e[1])*(e[0]-i[0]),s=(r[1]-i[1])*(t[0]-e[0])-(r[0]-i[0])*(t[1]-e[1]);if(0!==s){var a=n/s,l=o/s;if(a>=0&&a<=1&&l>=0&&l<=1)return!0}return!1},Js=function(e,t){for(var i=0;i<e.length-1;i++)for(var r=0;r<t.length-1;r++)if(Ys(e[i],e[i+1],t[r],t[r+1]))return!0;return!1},Ks=function(e){for(var t,i=0,r=0,n=e.length,o=e[r];r<n-1;r++)i+=((t=e[r+1])[0]-o[0])*(t[1]+o[1]),o=t;return i>=0},Qs=function(e,t){var i=Js(e,t),r=function(e,t){for(var i=!1,r=-1,n=e.length,o=n-1;++r<n;o=r)(e[r][1]<=t[1]&&t[1]<e[o][1]||e[o][1]<=t[1]&&t[1]<e[r][1])&&t[0]<(e[o][0]-e[r][0])*(t[1]-e[r][1])/(e[o][1]-e[r][1])+e[r][0]&&(i=!i);return i}(e,t[0]);return!(i||!r)},ea=function e(t,i){var r={};if(t.features){r.type="FeatureCollection",r.features=[];for(var n=0;n<t.features.length;n++)r.features.push(e(t.features[n],i))}if("number"==typeof t.x&&"number"==typeof t.y&&(r.type="Point",r.coordinates=[t.x,t.y],"number"==typeof t.z&&r.coordinates.push(t.z)),t.points&&(r.type="MultiPoint",r.coordinates=t.points.slice(0)),t.paths&&(1===t.paths.length?(r.type="LineString",r.coordinates=t.paths[0].slice(0)):(r.type="MultiLineString",r.coordinates=t.paths.slice(0))),t.rings&&(r=function(e){for(var t,i,r,n=[],o=[],s=0;s<e.length;s++){var a=(function(e,t){for(var i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}((c=e[s].slice(0))[0],c[c.length-1])||c.push(c[0]),c);if(!(a.length<4))if(Ks(a)){var l=[a.slice().reverse()];n.push(l)}else o.push(a.slice().reverse())}for(var c,u=[];o.length;){r=o.pop();var h=!1;for(t=n.length-1;t>=0;t--)if(i=n[t][0],Qs(i,r)){n[t].push(r),h=!0;break}h||u.push(r)}for(;u.length;){r=u.pop();var d=!1;for(t=n.length-1;t>=0;t--)if(i=n[t][0],Js(i,r)){n[t].push(r),d=!0;break}d||n.push([r.reverse()])}return 1===n.length?{type:"Polygon",coordinates:n[0]}:{type:"MultiPolygon",coordinates:n}}(t.rings.slice(0))),"number"==typeof t.xmin&&"number"==typeof t.ymin&&"number"==typeof t.xmax&&"number"==typeof t.ymax&&(r.type="Polygon",r.coordinates=[[[t.xmax,t.ymax],[t.xmin,t.ymax],[t.xmin,t.ymin],[t.xmax,t.ymin],[t.xmax,t.ymax]]]),(t.geometry||t.attributes)&&(r.type="Feature",r.geometry=t.geometry?e(t.geometry):null,r.properties=t.attributes?function(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}(t.attributes):null,t.attributes))try{r.id=function(e,t){for(var i=t?[t,"OBJECTID","FID"]:["OBJECTID","FID"],r=0;r<i.length;r++){var n=i[r];if(n in e&&("string"==typeof e[n]||"number"==typeof e[n]))return e[n]}throw Error("No valid id attribute found")}(t.attributes,i)}catch(e){}return JSON.stringify(r.geometry)===JSON.stringify({})&&(r.geometry=null),t.spatialReference&&t.spatialReference.wkid&&4326!==t.spatialReference.wkid&&console.warn("Object converted in non-standard crs - "+JSON.stringify(t.spatialReference)),r};function ta(e,t){const i=Object.assign({endpoint:Xs,params:{}},t);return i.params.text=e,Ls(`${Rs(i.endpoint)}/suggest`,i)}class ia{options={apiKey:"",limit:5};constructor(e){this.options=e}forwardGeocode(e){}async getSuggestions(e){return{suggestions:(await ta(e.query,{authentication:this.options.apiKey,params:{maxSuggestions:this.options.limit,categories:["Land Features","Water Features"],countryCode:"CA"}})).suggestions.map((e=>({text:e.text,placeId:`esri-${e.magicKey}`})))}}async searchByPlaceId(e){const t=e.query.replace("esri-",""),i=(await function(e){let t,i={};return"string"==typeof e?(i.params={singleLine:e},t=Xs):(t=e.endpoint||Xs,i=function(e,t,i){const r=Object.assign(Object.assign({params:{}},i),e);return r.params=["singleLine","address","address2","address3","neighborhood","city","subregion","region","postal","postalExt","countryCode","outFields","magicKey"].reduce(((t,i)=>((e[i]||"boolean"==typeof e[i]||"number"==typeof e[i]&&0===e[i])&&(t[i]=e[i]),t)),r.params),["params","httpMethod","rawResponse","authentication","hideToken","portal","credentials","maxUrlLength","headers","signal","suppressWarnings","request"].reduce(((e,t)=>(r[t]&&(e[t]=r[t]),e)),{})}(e,0,{params:Object.assign({},e.params)}),i.params.postal&&"number"==typeof i.params.postal&&Is("The postal code should be a string. Issues can arise when using it as a number, especially if they start with zero.")),Ls(`${Rs(t)}/findAddressCandidates`,i).then((t=>{if("string"!=typeof e&&e.rawResponse)return t;const i=t.spatialReference;
2if(t.candidates.forEach((function(e){e.location.spatialReference=i,e.extent&&(e.extent.spatialReference=i)})),4326===i.wkid){const e=t.candidates.map((e=>({type:"Feature",geometry:ea(e.location),properties:Object.assign({address:e.address,score:e.score},e.attributes)})));t.geoJson={type:"FeatureCollection",features:e}}return t}))}({magicKey:t,authentication:this.options.apiKey})).geoJson.features[0];return{place:{type:"Feature",geometry:{type:"Point",coordinates:i.geometry.coordinates},id:e.query,text:i.properties.address,place_name:i.properties.address,place_type:["place"]}}}}class ra{backroadGeocoder;esriGeocoder;constructor(e,t){this.backroadGeocoder=e,this.esriGeocoder=t}async forwardGeocode(e){}async getSuggestions(e){const t=this.backroadGeocoder.getSuggestions(e),i=this.esriGeocoder.getSuggestions(e),r=await t,n=await i;return{suggestions:r.suggestions.concat(n.suggestions)}}async searchByPlaceId(e){return e.query.startsWith("esri-")?await this.esriGeocoder.searchByPlaceId(e):await this.backroadGeocoder.searchByPlaceId(e)}}class na{persistedViewState={zoom:11,coordinates:[-123.159484,49.7156]};options={defaultCoordinates:[-123.159484,49.7156],defaultZoom:11,maxFeatureZoomOnLoad:14,addSearchBar:!1,addMeasureControl:!0,addLegendControl:!0,addTerrainControl:!0,addAttributionControl:!0,loadFromLastView:!1,privilegedUser:!1,mapContainer:".map-container",focusedPathGeometry:null,focusedZoneGeometry:null,bounds:null};focusedFeatureStack=[];mapContainer;layerControl;map;focusedFeatureIds=new Set;constructor(e,t){if(this.options={...this.options,...t},this.mapContainer=this.options.mapContainer?document.querySelector(this.options.mapContainer):null,this.options.loadFromLastView){this.persistedViewState=this.getPersistedViewState();let e=this.tryParseViewParameter();null!==e?(this.options.defaultCoordinates=[e.lng,e.lat],this.options.defaultZoom=e.zoom):(this.options.defaultCoordinates=this.persistedViewState.coordinates,this.options.defaultZoom=this.persistedViewState.zoom)}if(null!=this.options.focusedPathGeometry){var i=this.options.focusedPathGeometry.features.filter((e=>void 0===e.properties.pathFeatureType)).map((e=>e.properties.id));this.focusedFeatureIds=new Set(i)}var r=null;null!=this.options.focusedPathGeometry&&(r=Lo(this.options.focusedPathGeometry)),null!=this.options.focusedZoneGeometry&&(r=Lo(this.options.focusedZoneGeometry)),this.map=new(vt().Map)({container:e,center:this.options.defaultCoordinates,zoom:this.options.defaultZoom,bounds:r,fitBoundsOptions:{padding:40},minZoom:6,dragPan:!0,clickTolerance:4,attributionControl:!!this.options.addAttributionControl&&{compact:!0,customAttribution:["BCWFS","OSM","GovCan"]},style:ss}),this.mapContainer||(this.mapContainer=this.map.getContainer()),this.map.on("load",(()=>{this.map.once("idle",(()=>{for(const[e,t]of Object.entries(os)){const i=this.map.getSource(e);i&&"function"==typeof i.setTiles&&i.setTiles(t)}})),null!=this.options.focusedPathGeometry&&(this.map.getSource("focusedPathData").setData(na.runFeatureCollectionThroughCentrifuge(this.options.focusedPathGeometry)),["paths","pathsBorder","pathsDashed"].forEach((e=>{const t=this.map.getFilter(e),i=["!",["in",["get","id"],["literal",[...this.focusedFeatureIds]]]];void 0!==t?this.map.setFilter(e,["all",t,i]):this.map.setFilter(e,i)})),this.map.getSource("distanceMarkerData").setData(jn.buildFromLine(this.options.focusedPathGeometry.features[0]))),new(Ao())("bcFirePerimeterData",this.map,{url:"https://services6.arcgis.com/ubm4tcTYICKBpist/arcgis/rest/services/BCWS_FirePerimeters_PublicView/FeatureServer/0",where:"FIRE_STATUS NOT IN ('Out', 'Under Control')",setAttributionFromService:!1}),new(Ao())("bcFirePointData",this.map,{url:"https://services6.arcgis.com/ubm4tcTYICKBpist/arcgis/rest/services/BCWS_ActiveFires_PublicView/FeatureServer/0",where:"FIRE_STATUS NOT IN ('Out', 'Under Control')",setAttributionFromService:!1}),new(Ao())("bcFireAreaRestrictionData",this.map,{url:"https://services6.arcgis.com/ubm4tcTYICKBpist/arcgis/rest/services/British_Columbia_Area_Restrictions_-_View/FeatureServer/13",setAttributionFromService:!1}
2),this.map.addLayer({id:"bcFirePerimeters",type:"fill",source:"bcFirePerimeterData",minzoom:10,paint:{"fill-color":"#ed870aff","fill-opacity":.3}}),this.map.addLayer({id:"bcFirePerimeterBorders",type:"line",source:"bcFirePerimeterData",paint:{"line-color":"#ff8000","line-width":1},minzoom:10}),this.map.addLayer({id:"bcFireAreaRestriction",type:"fill",source:"bcFireAreaRestrictionData",minzoom:10,paint:{"fill-color":Wo,"fill-opacity":.3}}),this.map.addLayer({id:"bcFireAreaRestrictionBorders",type:"line",source:"bcFireAreaRestrictionData",paint:{"line-color":Wo},minzoom:10}),this.map.addLayer({id:"bcFirePoints",type:"symbol",source:"bcFirePointData",layout:{"icon-image":"FIRE"},minzoom:10});const e={topo:{name:"Topo",layers:["background","landuse-residential","landcover_grass","landcover_wood","park","landcover-ice-shelf","landcover-glacier","landcover-glacier-border","landcover_sand","hillshading","landuse","landuse_overlay_national_park","park_outline","contour_label","contour","contour-index","waterway","water","water-border","waterway-labels","water-labels","water-label-points","waterway-tunnel","tunnel_railway_transit","building","housenumber","road_area_pier","road_pier","road_bridge_area","road_path","road_minor","tunnel_minor","tunnel_major","road_trunk_primary","road_secondary_tertiary","road_major_motorway","railway_transit","railway","waterway-bridge-case","waterway-bridge","bridge_minor case","bridge_major case","bridge_minor","bridge_major","admin_sub","admin_country_z0-4","admin_country_z5-","poi_label","airport-label","road_major_label","mountain_peak","mountain_peak_satellite","park-label","place_label_other","recreation-site-icon","place_label_city","country_label-other","country_label"]},satellite:{name:"Satellite",layers:["esriSatellite","mountain_peak_satellite","recreation-site-icon"]},bcBasemap:{name:"BC Basemap",layers:["bcBasemap"]},caltopo:{name:"Caltopo",layers:["caltopo"]},toporama:{name:"Toporama",layers:["toporama"]}};this.options.privilegedUser&&(e.copernicus={name:"Topo / Weekly Satellite",layers:["esriTopoFallback","copernicus"]}),this.layerControl=new hs({default:"topo",baseLayers:e,overlays:{cutblocks:{name:"Cut Blocks",layers:["cutblocks","cutblockBorders"],enabled:!0},fomCutblocks:{name:"Proposed Logging (FOM)",layers:["fomCutblocks","fomCutblockBorders","fomPaths","fomPathsClickBuffer"],enabled:!0},wildlifeActZones:{name:"Closure Zones - Wildlife Act",layers:["wildlifeActZones","wildlifeActZoneBorders"],enabled:!0},landActZones:{name:"Closure Zones - Land Act",layers:["landActZones","landActZoneBorders"],enabled:!0},wildfires:{name:"BC Wildfires",layers:["bcFirePerimeters","bcFirePerimeterBorders","bcFirePoints","bcFireAreaRestriction","bcFireAreaRestrictionBorders"]},indianReserves:{name:"First Nation Reserves",layers:["indianReserves","indianReserveBorders","indianReserveLabels"]}},savedState:this.options.loadFromLastView?this.persistedViewState.layers:null}),this.map.addControl(this.layerControl,"top-right"),this.map.addControl(new(vt().NavigationControl)({visualizePitch:!0,visualizeRoll:!0,showZoom:!0,showCompass:!0}));const t=new gs({}),i=new ia({apiKey:"AAPTaEspbUnLMqLkQRXyZIt8_tA..EUybpW7ln8kaCIGvMQKXXuiYQ5BEx53aU9noyrx24Kni0mV3cnK2bU8wNrvmVyHwv1o5fc_LNJuLUJ5dZqM6kI5pTDuwsdUTrjqchAQYqDExZSohNzD_xPvu8URgRkYhlFrK3NYQHHkXYEobbhNugcDL47GlrjXJb0JptWXQbS3xtI-QtLC0tkUZ8Aczj32L9xjz0tZv4-Wdq9-pIO_NX3dP1yRsQwdoXhkY9fXsbSrFlXBN2vcPbrcWiRKxWg..AT1_mOfpseeU"}),r=new ra(t,i);this.map.addControl(new(vt().FullscreenControl)({container:this.mapContainer})),this.options.addTerrainControl&&this.map.addControl(new ms({source:"canadaDem",exaggeration:1})),this.options.addLegendControl&&this.map.addControl(new us({modalParent:this.mapContainer}),"top-right"),this.map.addControl(new(vt().ScaleControl)({unit:"metric"}),"bottom-left"),this.options.addMeasureControl&&this.map.addControl(new fs({units:"metric",showOnlyTotalLineLength:!1,lang:{clearMeasurementsButtonTitle:"Clear Measurements"},style:{text:{font:"Noto Sans Regular",color:"#333",haloColor:"#e7ebd8ff",haloWidth:1.5}}})),this.options.addSearchBar&&this.map.addControl(new So(r,{showResultsWhileTyping:!0,limit:10,maplibregl:vt(),map:this.map,clearOnBlur:!0,clearAndBlurOnEsc:!0,flyTo:{zoom:14}}),"top-left"),this.map.on("moveend",(()=>{if(this.options.loadFromLastView){const e=this.map.getCenter(),t=this.map.getZoom(),i=`${e.lat.toFixed(6)}/${e.lng.toFixed(6)}/${t.toFixed(0)}`,r=`${window.location.pathname}?view=${i}`;window.history.replaceState({},"",r),this.persistedViewState.coordinates=e,this.persistedViewState.zoom=t,this.savePersistedViewState()}}));
2const n={label:"Road",icon:"bi-sign-merge-right",theme:"success",name:e=>e.properties.name,build:this.buildPathPopup,link:e=>({href:`/road/${e.properties.id}`})},o={label:"Closure Zone",icon:"bi-shield-exclamation",theme:"warning",name:e=>e.properties.name,build:this.buildZonePopup,link:e=>({href:`/zone/${e.properties.id}`})};var s={paths:n,pathsDashed:n,pathsClickBuffer:n,pathFeatures:{label:"Feature",icon:"bi-pin-map-fill",theme:"warning",name:e=>e.properties.displayName,build:this.buildPathFeaturePopup},pathPhotos:{label:"Photo",icon:"bi-camera-fill",theme:"secondary",name:e=>e.properties.label||"Photo",build:this.buildPathPhotoPopup},cutblocks:{label:"Cut Block",icon:"bi-tree-fill",theme:"success",name:e=>e.properties.CLIENT_NAME,build:this.buildCutBlockPopup},fomCutblocks:{label:"Proposed Cut Block",icon:"bi-tree-fill",theme:"success",name:e=>e.properties.NAME,build:this.buildFomCutBlockPopup,link:e=>({href:"https://fom.nrs.gov.bc.ca/public/projects",external:!0})},fomPaths:{label:"Proposed Road",icon:"bi-sign-merge-right",theme:"success",name:e=>e.properties.NAME,build:this.buildFomPathPopup,link:e=>({href:"https://fom.nrs.gov.bc.ca/public/projects",external:!0})},fomPathsClickBuffer:{label:"FOM Road",icon:"bi-sign-merge-right",theme:"success",name:e=>e.properties.NAME,build:this.buildFomPathPopup,link:e=>({href:"https://fom.nrs.gov.bc.ca/public/projects",external:!0})},wildlifeActZones:o,landActZones:o,bcFirePoints:{label:"Wildfire",icon:"bi-fire",theme:"danger",name:e=>e.properties.INCIDENT_NAME??e.properties.FIRE_NUMBER,build:this.buildFirePopup,link:e=>e.properties.FIRE_URL?{href:e.properties.FIRE_URL,external:!0}:null},indianReserves:{label:"Indian Reserve",icon:"bi bi-map",theme:"secondary",name:e=>e.properties.ENGLISH_NAME,build:this.buildIndianReservePopup},"recreation-site-icon":{label:"Recreation Site",icon:"bi-pin-map-fill",theme:"warning",name:e=>e.properties.PROJECT_NAME,build:this.buildRecsitePopup,link:e=>e.properties.FOREST_FILE_ID?{href:`https://www.sitesandtrailsbc.ca/resource/${e.properties.FOREST_FILE_ID}`,external:!0}:null},bcFireAreaRestriction:{label:"Wildfire Restriction Zone",icon:"bi-shield-exclamation",theme:"warning",name:e=>e.properties.NAME,build:this.buildWildfireClosureZonePopup,link:e=>({href:e.properties.BULLETIN_URL})}};const a=Object.keys(s);this.map.on("mousemove",a,(e=>{this.map.getCanvas().style.cursor="pointer",this.focusedFeatureStack.forEach((e=>{void 0!==e.id&&this.map.setFeatureState({source:e.source,sourceLayer:e.sourceLayer,id:e.id},{focus:!1})})),this.focusedFeatureStack=[],e.features.forEach((e=>{this.focusedFeatureStack.push(e)}));const t=e.features[0];void 0!==t.id&&this.map.setFeatureState({source:t.source,sourceLayer:t.sourceLayer,id:t.id},{focus:!0})})),this.map.on("mouseout",a,(e=>{this.map.getCanvas().style.cursor="",this.focusedFeatureStack.forEach((e=>{void 0!==e.id&&this.map.setFeatureState({source:e.source,sourceLayer:e.sourceLayer,id:e.id},{focus:!1})})),this.focusedFeatureStack=[]})),this.map.on("click",a,(e=>{if(e.features&&e.features.length>0){const t=na.dedupeClickFeatures(e.features).filter((e=>!this.focusedFeatureIds.has(e.id)));t.length>1?this.bindMultiPopup(e,t,s):t.length>0&&this.bindPopup(e,s[t[0].layer.id])}})),this.map.on("styledata",(()=>{this.options.loadFromLastView&&(this.persistedViewState.layers=this.layerControl.getLayerStates(),this.savePersistedViewState())}))}))}static dedupeClickFeatures(e){return[...new Map(e.map((e=>[e.id,e]))).values()]}bindMultiPopup(e,t,i){const r=document.createElement("div");r.className="multi-popup";const n=document.createElement("h6");n.className="fw-bold mb-1",n.textContent="Select map item",r.appendChild(n);const o=document.createElement("p");o.className="text-muted mb-1",o.textContent="Click to view more details.",r.appendChild(o);const s=document.createElement("div");s.className="d-flex flex-column gap-2 border-top pt-2",r.appendChild(s);const a=(new(vt().Popup)).setLngLat(e.lngLat).setMaxWidth("360px");t.forEach((t=>{const r=i[t.layer.id];if(!r)return;const n=document.createElement("a");n.href="#",n.className="d-flex align-items-center text-decoration-none text-body p-2 rounded bg-body-tertiary";const o=document.createElement("div");o.className=`d-flex align-items-center justify-content-center rounded me-3 bg-${r.theme}-subtle text-${r.theme}`,o.style.width="40px",o.style.height="40px",o.style.flex="0 0 40px";const l=document.createElement("i");l.className=`bi ${r.icon} fs-4`,o.appendChild(l);const c=document.createElement("div");c.className="lh-sm";const u=document.createElement("div");u.className="fw-bold",u.textContent=r.name(t)??"Unknown";const h=document.createElement("div");h.className="text-uppercase text-muted small",h.textContent=r.label,c.append(u,h),n.append(o,c),n.addEventListener("click",(i=>{i.preventDefault(),a.remove(),this.bindPopup({lngLat:e.lngLat,features:[t]},r)})),s.appendChild(n)})),a.setDOMContent(r).addTo(this.map)}
2bindPopup(e,t){const i=e.features[0],r=(new(vt().Popup)).setLngLat(e.lngLat).setHTML(t.build(i,t)).setMaxWidth("300px").addTo(this.map).getElement();r&&"undefined"!=typeof Lightbox&&Lightbox.initialize&&r.querySelectorAll('a[data-toggle="lightbox"]').forEach((e=>{e.addEventListener("click",(function(e){Lightbox.initialize.call(this,e);const t=document.fullscreenElement||document.webkitFullscreenElement||document.querySelector(".maplibregl-pseudo-fullscreen");t&&setTimeout((()=>{document.querySelectorAll(".modal.lightbox, .modal-backdrop").forEach((e=>{e.parentElement!==t&&t.appendChild(e)}))}),0)}))}))}buildPathPopup(e,t){return na.buildPopupTemplate(t,e,`\n           <tr><th class='text-end' scope='row'>Length:</th><td>${(e.properties.length/1e3).toFixed(2)}km</td></tr>\n           <tr><th class='text-end' scope='row'>Last Report:</th><td>${0!==e.properties.lastConditionUpdate?new Date(e.properties.lastConditionUpdate).toLocaleDateString():"No Reports"}</td></tr>\n           <tr class='${e.properties.noticeCount<1?"visually-hidden":""}'><th class='text-end' scope='row'>Notices:</th><td><i class='bi bi-exclamation-triangle-fill text-warning fw-bold'></i> ${e.properties.noticeCount}</td></tr>\n       `)}buildPathFeaturePopup(e,t){return na.buildPopupTemplate(t,e,`\n            <tr><th class='text-end' scope='row'>Location:</th><td>${e.geometry.coordinates[1].toFixed(6)}, ${e.geometry.coordinates[0].toFixed(6)}</td></tr>\n            ${e.properties.description?'<tr><th class="text-end" scope="row">Description:</th><td>'+e.properties.description+"</td></tr>":""}\n            <tr><th class='text-end' scope='row'>Last Update:</th><td>${e.properties.lastUpdatedAt?new Date(e.properties.lastUpdatedAt).toLocaleDateString():"Unspecified"}</td></tr>\n            ${e.properties.source?'<tr><th class="text-end" scope="row">Source:</th><td>Managed by '+e.properties.source+"</td></tr>":""}\n         `)}buildPathPhotoPopup(e,t){const i=e.properties,r=i.caption||"",n=i.bulletinId||i.reference;return`\n            <div class="d-flex align-items-center pb-2 mb-2 border-bottom">\n                <div class="d-flex align-items-center justify-content-center rounded me-3 bg-${t.theme}-subtle text-${t.theme}"\n                     style="width:40px;height:40px;flex:0 0 40px">\n                    <i class="bi ${t.icon} fs-4"></i>\n                </div>\n                <div class="lh-sm">\n                    <div class="fw-bold">${t.name(e)}</div>\n                    <div class="text-uppercase text-muted small">${t.label}</div>\n                </div>\n            </div>\n            <a href="${i.reference}"\n               data-toggle="lightbox"\n               data-gallery="${n}"\n               data-caption="${r}"\n               data-constrain="true"\n               data-size="xl">\n                <img src="${i.reference}" style="width: 100%; max-width: 300px; height: auto; display: block; border-radius: 4px;" />\n            </a>\n            ${r?`<div class="text-center small mt-1 opacity-75">${r}</div>`:""}\n        `}buildCutBlockPopup(e,t){const i=e=>void 0===e||"null"===e?"Not Known Yet":new Date(e.substring(0,4),e.substring(4,6),e.substring(7,9)).toLocaleDateString();return na.buildPopupTemplate(t,e,`\n           <tr><th class='text-end' scope='row'>Logging Phase:</th><td>${e.properties.LIFE_CYCLE_STATUS_CODE}</td></tr>\n           <tr><th class='text-end' scope='row'>Planned Date:</th><td>${i(e.properties.PLANNED_HARVEST_DATE)}</td></tr>\n           <tr><th class='text-end' scope='row'>Start Date:</th><td>${i(e.properties.DISTURBANCE_START_DATE)}</td></tr>\n           <tr><th class='text-end' scope='row'>Completion Date:</th><td>${i(e.properties.DISTURBANCE_END_DATE)}</td></tr>\n       `)}buildFomCutBlockPopup(e,t){const i=e.properties,r=null!=i.PLANNED_AREA?`${Number(i.PLANNED_AREA).toFixed(2)} ha`:"Unknown";return na.buildPopupTemplate(t,e,`\n           <tr><th class='text-end' scope='row'>Holder:</th><td>${i.FSP_HOLDER_NAME??"Unknown"}</td></tr>\n           <tr><th class='text-end' scope='row'>Status:</th><td>${i.LIFECYCLE_STATUS??"Unknown"}</td></tr>\n           <tr><th class='text-end' scope='row'>Planned Start:</th><td>${i.PLANNED_DEVELOPMENT_DATE??"Unknown"}</td></tr>\n           <tr><th class='text-end' scope='row'>Area:</th><td>${r}</td></tr>\n       `)}buildFomPathPopup(e,t){const i=e.properties,r=null!=i.PLANNED_LENGTH?`${Number(i.PLANNED_LENGTH).toFixed(2)} km`:"Unknown";return na.buildPopupTemplate(t,e,`\n           <tr><th class='text-end' scope='row'>Holder:</th><td>${i.FSP_HOLDER_NAME??"Unknown"}</td></tr>\n           <tr><th class='text-end' scope='row'>Status:</th><td>${i.LIFECYCLE_STATUS??"Unknown"}</td></tr>\n           <tr><th class='text-end' scope='row'>Planned Start:</th><td>${i.PLANNED_DEVELOPMENT_DATE??"Unknown"}</td></tr>\n           <tr><th class='text-end' scope='row'>Length:</th><td>${r}</td></tr>\n       `)}buildZonePopup(e,t){return na.buildPopupTemplate(t,e,`\n           <tr><th class='text-end' scope='row'>Period:</th><td>${e.properties.closurePeriod}</td></tr>\n           <tr><th class='text-end' scope='row'>Status:</th><td>${e.properties.status}</td></tr>\n       `)}buildWildfireClosureZonePopup(e,t){return console.log(e),na.buildPopupTemplate(t,e,`\n            <tr><th class='text-end' scope='row'>Effective Date:</th><td>${new Date(e.properties.ACCESS_STATUS_EFFECTIVE_DATE).toLocaleDateString()}</td></tr>\n            <tr><th class='text-end' scope='row'>Fire Center:</th><td>${e.properties.FIRE_CENTRE_NAME}</td></tr>\n\n       `)}buildFirePopup(e,t){return na.buildPopupTemplate(t,e,`\n            <tr><th class='text-end' scope='row'>Fire Number:</th><td>${e.properties.FIRE_NUMBER}</td></tr>\n            <tr><th class='text-end' scope='row'>Status:</th><td>${e.properties.FIRE_STATUS}</td></tr>\n        `)}buildIndianReservePopup(e,t){const i=(e.properties.FEATURE_AREA_SQM/1e6).toFixed(2),r=(e.properties.FEATURE_AREA_SQM/1e4).toFixed(1);return na.buildPopupTemplate(t,e,`\n            <tr><th class='text-end' scope='row'>French Name:</th><td>${e.properties.FRENCH_NAME}</td></tr>\n            <tr><th class='text-end' scope='row'>Area:</th><td>${r} ha (${i} km²)</td></tr>\n        `)}buildRecsitePopup(e,t){return na.buildPopupTemplate(t,e,`\n            <tr><th class='text-end' scope='row'>Operator:</th><td>${void 0!==e.properties.OPERATOR_CLIENT_NAME?e.properties.OPERATOR_CLIENT_NAME:"Recsites BC"}</td></tr>\n            <tr><th class='text-end' scope='row'>Access Description:</th><td>${e.properties.ACCESS_DESC1}</td></tr>\n        `)}static buildPopupTemplate(e,t,i){const r=e.name(t)??"Unknown",n=e.link?.(t),o=n?`<div class="text-center mt-1"><a class="link-success text-decoration-none" href="${n.href}"${n.external?' target="_blank" rel="noopener"':""}>View Details <i class="bi bi-arrow-right"></i></a></div>`:"";return`\n            <div class="d-flex align-items-center pb-2 mb-2 border-bottom">\n                <div class="d-flex align-items-center justify-content-center rounded me-3 bg-${e.theme}-subtle text-${e.theme}"\n                     style="width:40px;height:40px;flex:0 0 40px">\n                    <i class="bi ${e.icon} fs-4"></i>\n                </div>\n                <div class="lh-sm">\n                    <div class="fw-bold">${r}</div>\n                    <div class="text-uppercase text-muted small">${e.label}</div>\n                </div>\n            </div>\n            <table class='table table-borderless table-sm mb-0'>\n                <tbody>\n                    ${i}\n                </tbody>\n            </table>\n            ${o}\n        `}static runFeatureCollectionThroughCentrifuge(e){var t=[];
2return e.features.forEach((e=>{"MultiLineString"===e.geometry.type?e.geometry.coordinates.forEach(((i,r)=>{var n=e.properties.conditions[r];t.push({type:"Feature",geometry:{type:"LineString",coordinates:i},properties:{...e.properties,condition:n}})})):t.push(e)})),{type:"FeatureCollection",features:t}}getPersistedViewState(){const e=localStorage.getItem("lastViewedLocation");return null!=e?{...this.persistedViewState,...JSON.parse(e)}:this.persistedViewState}savePersistedViewState(){try{localStorage.setItem("lastViewedLocation",JSON.stringify(this.persistedViewState))}catch(e){console.log("Local storage could not be set")}}tryParseViewParameter(){const e=new URLSearchParams(window.location.search).get("view");if(!e)return null;const[t,i,r]=e.split("/").map((e=>e.trim())),n=parseFloat(t),o=parseFloat(i),s=parseInt(r);if(isNaN(n)||n<-90||n>90)return null;if(isNaN(o)||o<-180||o>180)return null;let a=10;return isNaN(s)||s>=8&&s<=16&&(a=s),{lat:n,lng:o,zoom:a}}addMarkerOnPath(e,t,i={}){this.tryRemoveSliderMarker(e);const r=this.getPointAtIndex(t);return new(vt().Marker)(i).setLngLat(r).addTo(this.map)}setSliderMarker(e,t,i){return this.addMarkerOnPath(e,t,{color:cs[i].color,scale:.6})}tryRemoveSliderMarker(e){null!==e&&e.remove()}getPointAtIndex(e){return this.options.focusedPathGeometry.features[0].geometry.coordinates.flat()[e]}getIndexOfPoint(e){return this.options.focusedPathGeometry.features[0].geometry.coordinates.flat().findIndex((t=>t[0]===e[0]&&t[1]===e[1]))}getNearestPointIndex(e){const t=this.getFocusedPathCoordinates();let i=1/0,r=-1;for(let n=0;n<t.length;n++){const o=kn(t[n],e);o<i&&(i=o,r=n)}return{index:r,distanceMeters:1e3*i}}getDistanceAtPoint(e){var t=0;let i=this.getFocusedPathCoordinates();for(var r=1;r<i.length;r++)if(t+=kn(i[r-1],i[r]),i[r]===e)return t;return t}getFocusedPathId(){return this.options.focusedPathGeometry.features[0].properties.id}getFocusedPathCoordinates(){return this.options.focusedPathGeometry.features[0].geometry.coordinates.flat()}getConditionScheme(e){return cs[e]}displayMessage(e,t){var i=n.create("div","position-absolute py-1 top-0 start-50 translate-middle mt-4 shadow alert alert-warning rounded");i.innerHTML=e,i.style="z-index: 1000",this.mapContainer.appendChild(i),setTimeout((()=>{this.mapContainer.removeChild(i)}),t)}renderConditionPreview(e,t){const i=t.map((e=>{const t=this.getPointAtIndex(e.step);return{condition:e.condition,point:t}}));fetch(`/api/path/${e}/preview`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({conditionUpdates:i})}).then((e=>{e.ok&&e.json().then((e=>{this.map.getSource("focusedPathData").setData(na.runFeatureCollectionThroughCentrifuge(e))}))}))}}function oa(e,t){!function(e,t){var i,r,n,o,s,a,l,c,u,h,d=0,p="FeatureCollection"===e.type,f="Feature"===e.type,m=p?e.features.length:1;for(i=0;i<m;i++){for(a=p?e.features[i].geometry:f?e.geometry:e,c=p?e.features[i].properties:f?e.properties:{},u=p?e.features[i].bbox:f?e.bbox:void 0,h=p?e.features[i].id:f?e.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,n=0;n<s;n++)if(null!==(o=l?a.geometries[n]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,d,c,u,h))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],d,c,u,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,d,c,u,h))return!1;d++}}(e,(function(e,i,r,n,o){var s,a=null===e?null:e.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==t(Cn(e,r,{bbox:n,id:o}),i,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<e.coordinates.length;l++){var c=e.coordinates[l];if(!1===t(Cn({type:s,coordinates:c},r),i,l))return!1}}))}var sa=Object.defineProperty,aa=Object.defineProperties,la=Object.getOwnPropertyDescriptors,ca=Object.getOwnPropertySymbols,ua=Object.prototype.hasOwnProperty,ha=Object.prototype.propertyIsEnumerable,da=(e,t,i)=>t in e?sa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,pa=(e,t)=>{for(var i in t||(t={}))ua.call(t,i)&&da(e,i,t[i]);if(ca)for(var i of ca(t))ha.call(t,i)&&da(e,i,t[i]);return e},fa=(e,t)=>aa(e,la(t));function ma(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2))}function ga(e,t){const i=function(e,t){const[i,r,n]=e,[o,s,a]=t;return i*o+r*s+n*a}(e,t)/(ma(e)*ma(t));return Math.acos(Math.min(Math.max(i,-1),1))}function ya(e){const t=Ln(e[1]),i=Ln(e[0]);return[Math.cos(t)*Math.cos(i),Math.cos(t)*Math.sin(i),Math.sin(t)]}function _a(e){const[t,i,r]=e,n=An(Math.asin(r));return[An(Math.atan2(i,t)),n]}function va(e,t,i){const r=ya(e),n=ya(t),o=ya(i),[s,a,l]=o,[c,u,h]=function(e,t){const[i,r,n]=e,[o,s,a]=t;return[r*a-n*s,n*o-i*a,i*s-r*o]}(r,n),d=u*l-h*a,p=h*s-c*l,f=c*a-u*s,m=f*u-p*h,g=d*h-f*c,y=p*c-d*u,_=1/Math.sqrt(Math.pow(m,2)+Math.pow(g,2)+Math.pow(y,2)),v=[m*_,g*_,y*_],b=[-1*m*_,-1*g*_,-1*y*_],x=ga(r,n),w=ga(r,v),T=ga(n,v),E=ga(r,b),S=ga(n,b);let P;return P=w<E&&w<S||T<E&&T<S?v:b,ga(r,P)>x||ga(n,P)>x?Dn(_a(P),_a(r))<=Dn(_a(P),_a(n))?[_a(r),!0,!1]:[_a(n),!1,!0]:[_a(P),!1,!1]}class ba{map=null;editor=null;activeDate=null;originalMarkerState=null;onAdd(e){this.map=e;var t=n.create("div","maplibregl-ctrl fs-6");t.style="width: 34px;";var i=n.create("div","px-1 d-flex feature-button-container flex-column visually-hidden rounded border bg-body mb-2"),r=n.create("i","bi bi-plus-circle-fill"),o=n.create("a","icon-link map-feature-control-button link-success"),s=(e,t="")=>{var i=n.create("img",`feature-icon ${t}`.trim());return i.src=c(e),i.alt=l[e].editorSettings.title,i},a=s("OPEN_GATE","border-bottom"),u=s("LOCKED_GATE","border-bottom"),h=s("BRIDGE_IN","border-bottom"),d=s("BRIDGE_OUT","border-bottom"),p=s("IMPASSE"),f=s("BYPASS");r.style="font-size: 36px;",i.appendChild(u),i.appendChild(a),i.appendChild(d),i.appendChild(h),i.appendChild(p),i.appendChild(f),t.appendChild(i),t.appendChild(o),o.appendChild(r);var m=()=>{r.classList.toggle("icon-rotate-135"),i.classList.toggle("visually-hidden")};return o.addEventListener("click",(e=>{m()})),a.addEventListener("click",(e=>{m(),this.openFeatureEditorForm(this.createInitialFeatureMarker("OPEN_GATE"),!1)})),u.addEventListener("click",(e=>{m(),this.openFeatureEditorForm(this.createInitialFeatureMarker("LOCKED_GATE"),!1)})),h.addEventListener("click",(e=>{m(),this.openFeatureEditorForm(this.createInitialFeatureMarker("BRIDGE_IN"),!1)})),d.addEventListener("click",(e=>{m(),this.openFeatureEditorForm(this.createInitialFeatureMarker("BRIDGE_OUT"),!1)})),p.addEventListener("click",(e=>{m(),this.openFeatureEditorForm(this.createInitialFeatureMarker("IMPASSE"),!1)})),f.addEventListener("click",(e=>{m(),this.openFeatureEditorForm(this.createInitialFeatureMarker("BYPASS"),!1)})),t}bindFeaturePanel(e){var t=n.create("div"),i=n.create("div","text-center"),r=n.create("button","btn btn-sm btn-success"),o=l[e.properties.pathFeatureType].editorSettings.title,s=e.properties.description,a=e.properties.lastUpdatedAt,c=e.properties.source,u=e.getLngLat(),h=null!=c&&""!==c;r.innerHTML='<i class="bi bi-check2-circle"></i> Check-In',t.style="min-width: 300px",t.innerHTML=`\n            <div class="text-center pb-2 border-bottom"><strong>${o}</strong></div>\n            <table class="table table-borderless table-sm mt-2">\n                <tbody>\n                    <tr><th class="text-end" scope="row">Location:</th><td>${u.lat.toFixed(6)}, ${u.lng.toFixed(6)}</td></tr>\n                    ${s?'<tr><th class="text-end" scope="row">Description:</><td>'+s+"</td></tr>":""}\n                    <tr><th class="text-end" scope="row">Last Update:</><td>${a?new Date(a).toLocaleDateString():"Unspecified"}</td></tr>\n                    ${h?'<tr><th class="text-end" scope="row">Source:</><td>Automatically updated from '+c+" </td></tr>":""}\n                </tbody>\n            </table>\n        `,h||(i.appendChild(r),t.appendChild(i),r.addEventListener("click",(t=>{this.openFeatureEditorForm(e,!0)})));const d=new(vt().Popup)({maxWidth:"360px",anchor:"bottom",offset:10,focusAfterOpen:!0}).setDOMContent(t);e.setPopup(d)}openFeatureEditorForm(e,t){var i=n.create("div"),r="",o="Report on ",s="";switch(e.properties.pathFeatureType){case"IMPASSE":s="Impasse",r=`<option value="${e.properties.pathFeatureType}">Impasse</option>`;break;case"BYPASS":s="Bypass",r=`<option value="${e.properties.pathFeatureType}">HC 4x4 Bypass</option>`;break;case"FOOT_BRIDGE":case"BRIDGE_UNKNOWN":case"BRIDGE_OUT":case"BRIDGE_IN":s="Bridge",r='<option value="BRIDGE_OUT">Removed/Not-Driveable</option>\n                                  <option value="BRIDGE_IN">Driveable</option>\n                                  <option value="FOOT_BRIDGE">Foot Access Only</option>\n                                  <option value="BRIDGE_UNKNOWN">Unknown</option>';break;default:s="Gate",r='<option value="OPEN_GATE">Open</option>\n                                  <option value="LOCKED_GATE">Locked</option>'}o+=s;var a=n.create("a","btn btn-link btn-sm link-success ms-2"),c=n.
2create("button","btn btn-success btn-sm"),h=n.create("button","btn btn-success btn-sm");a.textContent="Cancel",c.innerHTML='<i class="bi bi-check2-circle"></i> Complete Check-In',h.textContent="Add",i.style="min-width: 300px;",i.innerHTML=`\n            <form class="w-100 p-0" name="feature-editor">\n                <h5>${o}</h5>\n                ${t?`<div class="form-check mb-3">\n                   <input class="form-check-input" type="checkbox" name="feature-not-present">\n                   <label class="form-check-label">\n                   ${s} no longer exists<br/><span class="opacity-75 fst-italic">(Check to remove the ${s.toLowerCase()} from the map)</span>\n                   </label>\n                </div>`:""}\n                <fieldset>\n                    <div class="alert alert-danger visually-hidden" role="alert"></div>\n                    <div class="mb-3">\n                        <label class="form-label">Status</label>\n                        <select class="form-select" name="pathFeatureType">\n                            ${r}\n                        </select>\n                    </div>\n                    <div class="mb-3">\n                        <label class="form-label">Report Date</label>\n                        <input type="date" name="lastUpdatedAt" class="form-control" required value="${this.activeDate}">\n                    </div>\n                    <div class="mb-3">\n                        <label class="form-label">Comment <span class="opacity-75">(Optional)</span></label>\n                        <textarea name="description" class="form-control" rows="1" maxLength="200"></textarea>\n                        <div class="form-text">Maximum 200 characters</div>\n                    </div>\n                </fieldset>\n            </form>\n        `;var d=i.querySelector("select"),p=i.querySelector("input[name='feature-not-present']"),f=i.querySelector("form"),m=i.querySelector(".alert");d.querySelector(`option[value="${e.properties.pathFeatureType}"]`).selected=!0,d.length<2&&d.parentElement.classList.add("visually-hidden"),d.addEventListener("change",(t=>{e.getElement().innerHTML=u(t.target.value),e.properties.pathFeatureType=l[t.target.value].editorSettings.name})),t?(this.checkpointFeatureState(e),f.appendChild(c),p.addEventListener("change",(e=>{var t=f.querySelector("fieldset");e.target.checked?t.disabled=!0:t.disabled=!1}))):f.appendChild(h),f.appendChild(a);var g=e=>{e.json().then((e=>{e.message,m.textContent=e.message,m.classList.remove("visually-hidden")}))};a.addEventListener("click",(i=>{e.togglePopup(),e.remove(),t&&this.restoreFeatureStateCheckpoint()})),h.addEventListener("click",(t=>{t.preventDefault();var i={type:"Feature",geometry:{type:"Point",coordinates:e.getLngLat().toArray()}},r=new FormData(f);i.properties=Object.fromEntries(r),fetch(`/api/path/${this.editor.getFocusedPathId()}/feature`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(i)}).then((t=>{t.ok?(e.properties=i.properties,e.togglePopup(),e.setDraggable(!1),e.toggleClassName("maplibregl-marker-edit-state"),this.activeDate=r.get("lastUpdatedAt"),this.bindFeaturePanel(e),this.editor.displayMessage("<strong>Added Successfully</strong>",5e3)):g(t)}))})),c.addEventListener("click",(t=>{t.preventDefault();var i={type:"Feature",geometry:{type:"Point",coordinates:e.getLngLat().toArray()}},r=new FormData(f);i.properties=Object.fromEntries(r),"on"!=r.get("feature-not-present")?fetch(`/api/path/${this.editor.getFocusedPathId()}/feature/${e.properties.id}`,{headers:{"Content-Type":"application/json"},method:"PUT",body:JSON.stringify(i)}).then((t=>{t.ok?(e.properties={...e.properties,...i.properties},e.togglePopup(),e.toggleClassName("maplibregl-marker-edit-state"),this.activeDate=r.get("lastUpdatedAt"),this.bindFeaturePanel(e),this.editor.displayMessage("<strong>Check-In Successful</strong>",5e3)):g(t)})):fetch(`/api/path/${this.editor.getFocusedPathId()}/feature/${e.properties.id}`,{headers:{"Content-Type":"application/json"},method:"DELETE"}).then((t=>{t.ok&&(e.togglePopup(),e.remove(),this.editor.displayMessage("<strong>Removed Successfully</strong>",5e3))}))})),this.enableEditOnFeature(e);const y=new(vt().Popup)({closeOnClick:!1,closeOnMove:!1,closeButton:!1,focusAfterOpen:!0,maxWidth:"360px",anchor:"bottom",offset:10}).setDOMContent(i);e.setPopup(y),e.togglePopup(),e.on("dragstart",(t=>{e.togglePopup()})),e.on("drag",(t=>{const i=this.findClosestPoint(e);null!==i&&e.setLngLat(i)})),e.on("dragend",(t=>{e.togglePopup()}))}findClosestPoint(e){let t=this.map.project(e.getLngLat()),i=this.map.queryRenderedFeatures([[t.x-20,t.y-20],[t.x+20,t.y+20]],{layers:["focusedPath","focusedPathDash"]});if(i.length>0){const t=function(e,t,i={}){if(!e||!t)throw new Error("lines and pt are required arguments");const r=Ft(t);let n=Mn([1/0,1/0],{dist:1/0,index:-1,multiFeatureIndex:-1,location:-1}),o=0;return oa(e,(function(e,s,a){const l=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(e);for(let e=0;e<l.length-1;e++){const s=Mn(l[e]);s.properties.dist=Dn(t,s,i);const c=Ft(s),u=Mn(l[e+1]);u.properties.dist=Dn(t,u,i);const h=Ft(u),d=Dn(s,u,i);let p,f,m;c[0]===r[0]&&c[1]===r[1]?[p,,f]=[c,void 0,!1]:h[0]===r[0]&&h[1]===r[1]?[p,,f]=[h,void 0,!0]:[p,,f]=va(s.geometry.coordinates,u.geometry.coordinates,Ft(t)),p&&(m=Mn(p,{dist:Dn(t,p,i),multiFeatureIndex:a,location:o+Dn(s,p,i)})),m&&m.properties.dist<n.properties.dist&&(n=fa(pa({},m),{properties:fa(pa({},m.properties),{index:f?e+1:e})})),o+=d}})),n}(i[0],e.getLngLat().toArray());return i[0].geometry.coordinates[t.properties.index]}return null}onRemove(){}enableEditOnFeature(e){e.toggleClassName("maplibregl-marker-edit-state"),e.setDraggable(!0)}checkpointFeatureState(e){this.originalMarkerState={lngLat:e.getLngLat(),properties:{...e.properties}}}restoreFeatureStateCheckpoint(){if(null!=this.originalMarkerState){const e=this.createRoadFeatureMarker(this.originalMarkerState.lngLat,this.originalMarkerState.properties);this.bindFeaturePanel(e),this.originalMarkerState=null}}createInitialFeatureMarker(e){return this.createRoadFeatureMarker(this.map.getCenter(),{pathFeatureType:e})}createRoadFeatureMarker(e,t){const i=n.create("div","d-flex align-items-center justify-content-center");i.innerHTML=u(t.pathFeatureType);const r=new(vt().Marker)({element:i}).setLngLat(e).addTo(this.map);return r.properties=t,r}}function xa(e){const t=e.querySelector(".vehicle-chips"),i=e.querySelector(".vehicle-picker"),r=e.querySelector(".vehicle-hidden-inputs");function n(e){return"profile"===e?"vehicleProfileIds":"vehicleCategories"}function o(){return r.querySelectorAll("input").length}function s(){const e=new Set([...r.querySelectorAll("input")].map((e=>`${e.dataset.kind}:${e.dataset.id}`))),t=o()>=3;i.querySelectorAll("option").forEach((i=>{if(!i.value)return;const r=`${i.dataset.kind}:${i.dataset.id}`,n=e.has(r);i.hidden=n,i.disabled=n||t})),i.disabled=t}function a(e,i,o){const a=document.createElement("span");a.className="badge text-body border d-inline-flex align-items-center gap-2 py-2 ps-3 pe-2 mb-2",a.dataset.kind=e,a.dataset.id=i;const l=document.createElement("span");l.textContent=o,a.appendChild(l);const c=document.createElement("button");c.type="button",c.className="btn-close",c.style.fontSize="0.65em",c.setAttribute("aria-label","Remove"),c.addEventListener("click",(()=>function(e,i){const o=n(e),a=r.querySelector(`input[name="${o}"][value="${CSS.escape(i)}"]`);a&&a.remove();const l=t.querySelector(`span[data-kind="${e}"][data-id="${CSS.escape(i)}"]`);l&&l.remove(),s()}(e,i))),a.appendChild(c),t.appendChild(a)}
2[...r.querySelectorAll("input")].forEach((e=>{a(e.dataset.kind,e.dataset.id,function(e,t){const r=i.querySelector(`option[data-kind="${e}"][data-id="${CSS.escape(t)}"]`);return r?r.dataset.label:t}(e.dataset.kind,e.dataset.id))})),s(),i.addEventListener("change",(()=>{if(!i.value)return;const e=i.options[i.selectedIndex];!function(e,t,i){if(o()>=3)return;const l=n(e);if(r.querySelector(`input[name="${l}"][value="${CSS.escape(t)}"]`))return;const c=document.createElement("input");c.type="hidden",c.name=l,c.value=t,c.dataset.kind=e,c.dataset.id=t,r.appendChild(c),a(e,t,i),s()}(e.dataset.kind,e.dataset.id,e.dataset.label),i.value=""}))}window.EditorMap=class extends na{draw;constructor(e,t){super(e,{...t}),yt.constants.classes.CANVAS="maplibregl-canvas",yt.constants.classes.CONTROL_BASE="maplibregl-ctrl",yt.constants.classes.CONTROL_PREFIX="maplibregl-ctrl-",yt.constants.classes.CONTROL_GROUP="maplibregl-ctrl-group",yt.constants.classes.ATTRIBUTION="maplibregl-ctrl-attrib",this.draw=new yt({modes:{...yt.modes,draw_point:_n,draw_line_string:xn,draw_road_feature:wn,simple_select:Tn,direct_select:En,cut_polygon:Sn},userProperties:!0,styles:d,displayControlsDefault:!1,snap:!0,snapOptions:{snapPx:20,snapGetFeatures:(e,t)=>[...e.queryRenderedFeatures({layers:["paths","pathsDashed"]}),...this.draw.getAll().features],snapOnSimpleSelectFilter:e=>void 0!==e.properties.pathFeatureType}});const i=new h(this.draw,{});this.map.addControl(i,"top-left"),this.map.addControl(this.draw,"top-left");var r=Gn()((e=>
2{let t=i.getActiveFeature();void 0!==t&&this.map.getSource("distanceMarkerData").setData(jn.buildFromLine(this.draw.get(t)))}),200);this.map.on("load",(()=>{if(this.options.focusedPathGeometry){var e=this.options.focusedPathGeometry.features.map((e=>e.properties.id)),t=[...new Set(e)];["focusedPath","focusedPathDash","focusedPathBorder","focusedPathHighlight","pathLabels","pathFeatures","pathsClickBuffer"].forEach((e=>{this.map.setFilter(e,["!",["in",["get","id"],["literal",t]]])}));var n=this.draw.add(this.options.focusedPathGeometry)[0];i.setActiveFeature(n)}this.map.on("draw.create",(e=>{"LineString"===e.features[0].geometry.type&&i.setActiveFeature(e.features[0].id)})),this.map.on("draw.render",(e=>{r(e)}))})),this.map.setMaxZoom(20)}getFeatureEdits(){return this.draw.getAll()}},window.BulletinMap=class extends na{featureControl;constructor(e,t){super(e,{...t});var i=this.options.focusedPathGeometry.features.map((e=>e.properties.id)),r=[...new Set(i)];this.map.on("load",(()=>{this.map.setFilter("pathFeatures",["!",["in",["get","id"],["literal",r]]]),this.map.on("sourcedata","pathFeatures",(()=>{this.map.setFilter("pathFeatures",["!",["in",["get","id"],["literal",r]]])})),this.renderEditor()}))}renderEditor(){this.featureControl=new ba,this.featureControl.editor=this,this.map.addControl(this.featureControl,"bottom-left"),this.map.setMaxZoom(20),this.enableEditMode()}enableEditMode(){this.options.focusedPathGeometry.features.filter((e=>"Point"===e.geometry.type)).forEach((e=>{const t=this.featureControl.createRoadFeatureMarker(e.geometry.coordinates,e.properties);this.featureControl.bindFeaturePanel(t)}))}},window.VectorMap=na,window.bindClientSideFormValidation=function(e){e.addEventListener("submit",(t=>{e.checkValidity()||(t.preventDefault(),t.stopPropagation()),e.classList.add("was-validated")}),!1)},document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll('[data-bs-toggle="popover"]').forEach((e=>new bootstrap.Popover(e))),document.querySelectorAll(".vehicle-tag-input").forEach(xa),function(){const e=document.getElementById("vehicleDetailsModal");if(!e)return;const t=e.querySelector("#vehicleDetailsModalTitle"),i=e.querySelector("#vehicleDetailsModalDescription"),r=e.querySelector("#vehicleDetailsModalPhoto");e.addEventListener("show.bs.modal",(e=>{const n=e.relatedTarget;if(!n)return;const o=n.dataset.vehicleName,s=n.dataset.vehicleCategory,a=n.dataset.vehicleDescription||"",l=n.dataset.vehiclePhoto;t.textContent=o?`${o} · ${s}`:s,i.textContent=a,l?(r.src=l,r.classList.remove("d-none")):(r.removeAttribute("src"),r.classList.add("d-none"))}))}()}))})()})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.