@mapxus/mapxus-map-jp 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14,4 +14,4 @@
14
14
  * @author Feross Aboukhadijeh <https://feross.org>
15
15
  * @license MIT
16
16
  */
17
- t.exports=function(t){return null!=t&&null!=t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}},function(t,e,i){"use strict";var n=i(15),r=i(3),o=i(55),a=i(56);function s(t){this.defaults=t,this.interceptors={request:new o,response:new o}}s.prototype.request=function(t){"string"==typeof t&&(t=r.merge({url:arguments[0]},arguments[1])),(t=r.merge(n,{method:"get"},this.defaults,t)).method=t.method.toLowerCase();var e=[a,void 0],i=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)i=i.then(e.shift(),e.shift());return i},r.forEach(["delete","get","head","options"],(function(t){s.prototype[t]=function(e,i){return this.request(r.merge(i||{},{method:t,url:e}))}})),r.forEach(["post","put","patch"],(function(t){s.prototype[t]=function(e,i,n){return this.request(r.merge(n||{},{method:t,url:e,data:i}))}})),t.exports=s},function(t,e){var i,n;t=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return(i=setTimeout)(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}var s,l=[],u=!1,c=-1;function h(){u&&s&&(u=!1,s.length?l=s.concat(l):c=-1,l.length&&p())}function p(){if(!u){for(var t=a(h),e=(u=!0,l.length);e;){for(s=l,l=[];++c<e;)s&&s[c].run();c=-1,e=l.length}s=null,u=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return(n=clearTimeout)(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function f(){}t.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];l.push(new d(t,e)),1!==l.length||u||a(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=f,t.addListener=f,t.once=f,t.off=f,t.removeListener=f,t.removeAllListeners=f,t.emit=f,t.prependListener=f,t.prependOnceListener=f,t.listeners=function(t){return[]},t.binding=function(t){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(t){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}},function(t,e,i){"use strict";var n=i(3);t.exports=function(t,e){n.forEach(t,(function(i,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=i,delete t[n])}))}},function(t,e,i){"use strict";var n=i(23);t.exports=function(t,e,i){var r=i.config.validateStatus;i.status&&r&&!r(i.status)?e(n("Request failed with status code "+i.status,i.config,null,i.request,i)):t(i)}},function(t,e,i){"use strict";t.exports=function(t,e,i,n,r){return t.config=e,i&&(t.code=i),t.request=n,t.response=r,t}},function(t,e,i){"use strict";var n=i(3);function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,i){return e?((i=i?i(e):n.isURLSearchParams(e)?e.toString():(o=[],n.forEach(e,(function(t,e){null!=t&&(n.isArray(t)?e+="[]":t=[t],n.forEach(t,(function(t){n.isDate(t)?t=t.toISOString():n.isObject(t)&&(t=JSON.stringify(t)),o.push(r(e)+"="+r(t))})))})),o.join("&")))&&(t+=(-1===t.indexOf("?")?"?":"&")+i),t):t;var o}},function(t,e,i){"use strict";var n=i(3),r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,i,o={};return t&&n.forEach(t.split("\n"),(function(t){i=t.indexOf(":"),e=n.trim(t.substr(0,i)).toLowerCase(),i=n.trim(t.substr(i+1)),!e||o[e]&&0<=r.indexOf(e)||(o[e]="set-cookie"===e?(o[e]||[]).concat([i]):o[e]?o[e]+", "+i:i)})),o}},function(t,e,i){"use strict";var n,r,o,a=i(3);function s(t){return r&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}t.exports=a.isStandardBrowserEnv()?(r=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a"),n=s(window.location.href),function(t){return(t=a.isString(t)?s(t):t).protocol===n.protocol&&t.host===n.host}):function(){return!0}},function(t,e,i){"use strict";var n=i(3);t.exports=n.isStandardBrowserEnv()?{write:function(t,e,i,r,o,a){var s=[];s.push(t+"="+encodeURIComponent(e)),n.isNumber(i)&&s.push("expires="+new Date(i).toGMTString()),n.isString(r)&&s.push("path="+r),n.isString(o)&&s.push("domain="+o),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read:function(t){return(t=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)")))?decodeURIComponent(t[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(t,e,i){"use strict";var n=i(3);function r(){this.handlers=[]}r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){n.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=r},function(t,e,i){"use strict";var n=i(3),r=i(57),o=i(24),a=i(15),s=i(58),l=i(59);function u(t){t.cancelToken&&t.cancelToken.throwIfRequested()}t.exports=function(t){return u(t),t.baseURL&&!s(t.url)&&(t.url=l(t.baseURL,t.url)),t.headers=t.headers||{},t.data=r(t.data,t.headers,t.transformRequest),t.headers=n.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||a.adapter)(t).then((function(e){return u(t),e.data=r(e.data,e.headers,t.transformResponse),e}),(function(e){return o(e)||(u(t),e&&e.response&&(e.response.data=r(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))}},function(t,e,i){"use strict";var n=i(3);t.exports=function(t,e,i){return n.forEach(i,(function(i){t=i(t,e)})),t}},function(t,e,i){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e,i){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,i){"use strict";var n=i(25);function r(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");this.promise=new Promise((function(t){e=t}));var e,i=this;t((function(t){i.reason||(i.reason=new n(t),e(i.reason))}))}r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var t;return{token:new r((function(e){t=e})),cancel:t}},t.exports=r},function(t,e,i){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,i){t.exports=function(){"use strict";var t,e,i;function n(n,r){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a),i=r(a),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=r;else t=r}return n(0,(function(t){var e=i;function i(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}function n(t,i,n,r){const o=new e(t,i,n,r);return function(t){return o.solve(t)}}i.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=r/o}var a=0,s=1;for(i=t,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-t)<e));n++)t>r?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};const r=n(.25,.1,.25,1);function o(t,e,i){return Math.min(i,Math.max(e,t))}function a(t,e,i){const n=i-e,r=((t-e)%n+n)%n+e;return r===e?i:r}function s(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let l=1;function u(t,e){t.forEach(t=>{e[t]&&(e[t]=e[t].bind(e))})}function c(t,e,i){const n={};for(const r in t)n[r]=e.call(i||this,t[r],r,t);return n}function h(t,e,i){const n={};for(const r in t)e.call(i||this,t[r],r,t)&&(n[r]=t[r]);return n}function p(t){return Array.isArray(t)?t.map(p):"object"==typeof t&&t?c(t,p):t}const d={};function f(t){d[t]||("undefined"!=typeof console&&console.warn(t),d[t]=!0)}function m(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function g(t){let e=0;for(let i,n,r=0,o=t.length,a=o-1;r<o;a=r++)i=t[r],n=t[a],e+=(n.x-i.x)*(i.y+n.y);return e}function _(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function y(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,i,n,r)=>{const o=n||r;return e[i]=!o||o.toLowerCase(),""}),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}let x,v,b=null;function w(t){if(null==b){const e=t.navigator?t.navigator.userAgent:null;b=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return b}function S(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const T={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const i=window.document.createElement("canvas"),n=i.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return i.width=t.width,i.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:t=>(x||(x=document.createElement("a")),x.href=t,x.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==v&&(v=matchMedia("(prefers-reduced-motion: reduce)")),v.matches)}};var E=A;function A(t,e){this.x=t,this.y=e}A.prototype={clone:function(){return new A(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),r=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},A.convert=function(t){return t instanceof A?t:Array.isArray(t)?new A(t[0],t[1]):t};const I={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},C="mapbox-tiles";let P,M=500,k=50;function z(){"undefined"==typeof caches||P||(P=caches.open(C))}let L=1/0;const B={supported:!1,testSupport:function(t){!O&&R&&(F?U(t):D=t)}};let D,R,O=!1,F=!1;function U(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,R),t.isContextLost())return;B.supported=!0}catch(t){}t.deleteTexture(e),O=!0}"undefined"!=typeof document&&(R=document.createElement("img"),R.onload=function(){D&&U(D),D=null,F=!0},R.onerror=function(){O=!0,D=null},R.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const j={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(j);class N extends Error{constructor(t,e,i,n){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=n}}const V=_()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function G(t,e){const i=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:V(),signal:i.signal});let r=!1,o=!1;return"json"===t.type&&n.headers.set("Accept","application/json"),((i,a,s)=>{if(o)return;Date.now();fetch(n).then(i=>i.ok?((i,n,a)=>{("arrayBuffer"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then(t=>{o||(r=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))}).catch(t=>{o||e(new Error(t.message))})})(i):i.blob().then(n=>e(new N(i.status,i.statusText,t.url,n)))).catch(t=>{20!==t.code&&e(new Error(t.message))})})(),{cancel:()=>{o=!0,r||i.abort()}}}const q=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(_()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!_()){const i=t.url.substring(0,t.url.indexOf("://"));return(I.REGISTERED_PROTOCOLS[i]||G)(t,e)}}if(!(/^file:/.test(i=t.url)||/^file:/.test(V())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return G(t,e);if(_()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(t,e){const i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(i.responseType="arraybuffer");for(const e in t.headers)i.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===t.credentials,i.onerror=()=>{e(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let n=i.response;if("json"===t.type)try{n=JSON.parse(i.response)}catch(t){return e(t)}e(null,n,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else{const n=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});e(new N(i.status,i.statusText,t.url,n))}},i.send(t.body),{cancel:()=>i.abort()}}(t,e)},W=function(t,e){return q(s(t,{type:"arrayBuffer"}),e)};function Z(t){const e=window.document.createElement("a");return e.href=t,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const H="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let $,X;$=[],X=0;const K=function(t,e){if(B.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),X>=I.MAX_PARALLEL_IMAGE_REQUESTS){const i={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return $.push(i),i}X++;let i=!1;const n=()=>{if(!i)for(i=!0,X--;$.length&&X<I.MAX_PARALLEL_IMAGE_REQUESTS;){const t=$.shift(),{requestParameters:e,callback:i,cancelled:n}=t;n||(t.cancel=K(e,i).cancel)}},r=W(t,(t,i,r,o)=>{n(),t?e(t):i&&function(t,e){"function"==typeof createImageBitmap?function(t,e){const i=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(i).then(t=>{e(null,t)}).catch(t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(t,e):function(t,e){const i=new Image;i.onload=()=>{e(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>{i.src=H})},i.onerror=()=>e(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(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(n):H}(t,e)}(i,(t,i)=>{null!=t?e(t):null!=i&&e(null,i,{cacheControl:r,expires:o})})});return{cancel:()=>{r.cancel(),n()}}};function J(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function Y(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);-1!==n&&i[t].splice(n,1)}}class Q{constructor(t,e={}){s(this,e),this.type=t}}class tt extends Q{constructor(t,e={}){super("error",s({error:t},e))}}class et{on(t,e){return this._listeners=this._listeners||{},J(t,e,this._listeners),this}off(t,e){return Y(t,e,this._listeners),Y(t,e,this._oneTimeListeners),this}once(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},J(t,e,this._oneTimeListeners),this}fire(t,e){"string"==typeof t&&(t=new Q(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of n)Y(i,e,this._oneTimeListeners),e.call(this,t);const r=this._eventedParent;r&&(s(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(t))}else t instanceof tt&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var it={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},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},"*":{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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},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:{},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"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","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},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:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},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:"*",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}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},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"},"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:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},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"}}};class nt{constructor(t,e,i,n){this.message=(t?t+": ":"")+i,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function rt(t){const e=t.value;return e?[new nt(t.key,e,"constants have been deprecated as of v8")]:[]}function ot(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}function at(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function st(t){if(Array.isArray(t))return t.map(st);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=st(t[i]);return e}return at(t)}class lt extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class ut{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new ut(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const ct={kind:"null"},ht={kind:"number"},pt={kind:"string"},dt={kind:"boolean"},ft={kind:"color"},mt={kind:"object"},gt={kind:"value"},_t={kind:"collator"},yt={kind:"formatted"},xt={kind:"resolvedImage"};function vt(t,e){return{kind:"array",itemType:t,N:e}}function bt(t){if("array"===t.kind){const e=bt(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const wt=[ct,ht,pt,dt,ft,yt,mt,vt(gt),xt];function St(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!St(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of wt)if(!St(t,e))return null}return`Expected ${bt(t)} but found ${bt(e)} instead.`}function Tt(t,e){return e.some(e=>e.kind===t.kind)}function Et(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}var At,It={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Ct(t){return(t=Math.round(t))<0?0:t>255?255:t}function Pt(t){return Ct("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function Mt(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function kt(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{At={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in It)return It[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),r=i.indexOf(")");if(-1!==n&&r+1===i.length){var o=i.substr(0,n),a=i.substr(n+1,r-(n+1)).split(","),s=1;switch(o){case"rgba":if(4!==a.length)return null;s=Mt(a.pop());case"rgb":return 3!==a.length?null:[Pt(a[0]),Pt(a[1]),Pt(a[2]),s];case"hsla":if(4!==a.length)return null;s=Mt(a.pop());case"hsl":if(3!==a.length)return null;var l=(parseFloat(a[0])%360+360)%360/360,u=Mt(a[1]),c=Mt(a[2]),h=c<=.5?c*(u+1):c+u-c*u,p=2*c-h;return[Ct(255*kt(p,h,l+1/3)),Ct(255*kt(p,h,l)),Ct(255*kt(p,h,l-1/3)),s];default:return null}}return null}}catch(t){}class zt{constructor(t,e,i,n=1){this.r=t,this.g=e,this.b=i,this.a=n}static parse(t){if(!t)return;if(t instanceof zt)return t;if("string"!=typeof t)return;const e=At(t);return e?new zt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,i,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(i)},${n})`}toArray(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*i/n,n]}}zt.black=new zt(0,0,0,1),zt.white=new zt(1,1,1,1),zt.transparent=new zt(0,0,0,0),zt.red=new zt(1,0,0,1);class Lt{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Bt{constructor(t,e,i,n,r){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r}}class Dt{constructor(t){this.sections=t}static fromString(t){return new Dt([new Bt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof Dt?t:Dt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const i={};e.fontStack&&(i["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(i["font-scale"]=e.scale),e.textColor&&(i["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(i)}return t}}class Rt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Rt({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Ot(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ft(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof zt)return!0;if(t instanceof Lt)return!0;if(t instanceof Dt)return!0;if(t instanceof Rt)return!0;if(Array.isArray(t)){for(const e of t)if(!Ft(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Ft(t[e]))return!1;return!0}return!1}function Ut(t){if(null===t)return ct;if("string"==typeof t)return pt;if("boolean"==typeof t)return dt;if("number"==typeof t)return ht;if(t instanceof zt)return ft;if(t instanceof Lt)return _t;if(t instanceof Dt)return yt;if(t instanceof Rt)return xt;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Ut(e);if(i){if(i===t)continue;i=gt;break}i=t}return vt(i||gt,e)}return mt}function jt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof zt||t instanceof Dt||t instanceof Rt?t.toString():JSON.stringify(t)}class Nt{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ft(t[1]))return e.error("invalid value");const i=t[1];let n=Ut(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new Nt(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof zt?["rgba"].concat(this.value.toArray()):this.value instanceof Dt?this.value.serialize():this.value}}class Vt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Gt={string:pt,number:ht,boolean:dt,object:mt};class qt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,o;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in Gt)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=Gt[i],n++}else r=gt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],n++}i=vt(r,o)}else i=Gt[r];const o=[];for(;n<t.length;n++){const i=e.parse(t[n],n,gt);if(!i)return null;o.push(i)}return new qt(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!St(this.type,Ut(i)))return i;if(e===this.args.length-1)throw new Vt(`Expected value to be of type ${bt(this.type)}, but found ${bt(Ut(i))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const i=t.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){e.push(i.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map(t=>t.serialize()))}}class Wt{constructor(t){this.type=yt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const o=t[i];if(r&&"object"==typeof o&&!Array.isArray(o)){r=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,ht),!t))return null;let i=null;if(o["text-font"]&&(i=e.parse(o["text-font"],1,vt(pt)),!i))return null;let a=null;if(o["text-color"]&&(a=e.parse(o["text-color"],1,ft),!a))return null;const s=n[n.length-1];s.scale=t,s.font=i,s.textColor=a}else{const o=e.parse(t[i],1,gt);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:o,scale:null,font:null,textColor:null})}}return new Wt(n)}evaluate(t){return new Dt(this.sections.map(e=>{const i=e.content.evaluate(t);return Ut(i)===xt?new Bt("",i,null,null,null):new Bt(jt(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const i={};e.scale&&(i["font-scale"]=e.scale.serialize()),e.font&&(i["text-font"]=e.font.serialize()),e.textColor&&(i["text-color"]=e.textColor.serialize()),t.push(i)}return t}}class Zt{constructor(t){this.type=xt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,pt);return i?new Zt(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Rt.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Ht={"to-boolean":dt,"to-color":ft,"to-number":ht,"to-string":pt};class $t{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=Ht[i],r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,gt);if(!n)return null;r.push(n)}return new $t(n,r)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof zt)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Ot(e[0],e[1],e[2],e[3]),!i))return new zt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Vt(i||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new Vt(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Dt.fromString(jt(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?Rt.fromString(jt(this.args[0].evaluate(t))):jt(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){if("formatted"===this.type.kind)return new Wt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Zt(this.args[0]).serialize();const t=["to-"+this.type.kind];return this.eachChild(e=>{t.push(e.serialize())}),t}}const Xt=["Unknown","Point","LineString","Polygon"];class Kt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Xt[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(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=zt.parse(t)),e}}class Jt{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(t=>t.serialize()))}static parse(t,e){const i=t[0],n=Jt.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=o.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let s=null;for(const[n,o]of a){s=new ve(e.registry,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],r=Array.isArray(n)?n[e-1]:n.type,o=s.parse(i,1+a.length,r);if(!o){l=!0;break}a.push(o)}if(!l)if(Array.isArray(n)&&n.length!==a.length)s.error(`Expected ${n.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=a[t];s.concat(t+1).checkSubtype(e,i.type)}if(0===s.errors.length)return new Jt(i,r,o,a)}}if(1===a.length)e.errors.push(...s.errors);else{const i=(a.length?a:o).map(([t])=>{return e=t,Array.isArray(e)?`(${e.map(bt).join(", ")})`:`(${bt(e.type)}...)`;var e}).join(" | "),n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],1+n.length);if(!r)return null;n.push(bt(r.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){Jt.definitions=e;for(const i in e)t[i]=Jt}}class Yt{constructor(t,e,i){this.type=_t,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,dt);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,dt);if(!r)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,pt),!o)?null:new Yt(n,r,o)}evaluate(t){return new Lt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const Qt=8192;function te(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function ee(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ie(t,e){const i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,r=Math.pow(2,e.z);return[Math.round(i*r*Qt),Math.round(n*r*Qt)]}function ne(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],o=t[0]-i[0],a=t[1]-i[1];return n*a-o*r==0&&n*o<=0&&r*a<=0}function re(t,e){let i=!1;for(let a=0,s=e.length;a<s;a++){const s=e[a];for(let e=0,a=s.length;e<a-1;e++){if(ne(t,s[e],s[e+1]))return!1;(r=s[e])[1]>(n=t)[1]!=(o=s[e+1])[1]>n[1]&&n[0]<(o[0]-r[0])*(n[1]-r[1])/(o[1]-r[1])+r[0]&&(i=!i)}}var n,r,o;return i}function oe(t,e){for(let i=0;i<e.length;i++)if(re(t,e[i]))return!0;return!1}function ae(t,e,i,n){const r=n[0]-i[0],o=n[1]-i[1],a=(t[0]-i[0])*o-r*(t[1]-i[1]),s=(e[0]-i[0])*o-r*(e[1]-i[1]);return a>0&&s<0||a<0&&s>0}function se(t,e,i){for(const u of i)for(let i=0;i<u.length-1;++i)if(0!=(s=[(a=u[i+1])[0]-(o=u[i])[0],a[1]-o[1]])[0]*(l=[(r=e)[0]-(n=t)[0],r[1]-n[1]])[1]-s[1]*l[0]&&ae(n,r,o,a)&&ae(o,a,n,r))return!0;var n,r,o,a,s,l;return!1}function le(t,e){for(let i=0;i<t.length;++i)if(!re(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(se(t[i],t[i+1],e))return!1;return!0}function ue(t,e){for(let i=0;i<e.length;i++)if(le(t,e[i]))return!0;return!1}function ce(t,e,i){const n=[];for(let r=0;r<t.length;r++){const o=[];for(let n=0;n<t[r].length;n++){const a=ie(t[r][n],i);te(e,a),o.push(a)}n.push(o)}return n}function he(t,e,i){const n=[];for(let r=0;r<t.length;r++){const o=ce(t[r],e,i);n.push(o)}return n}function pe(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}te(e,t)}function de(t,e,i,n){const r=Math.pow(2,n.z)*Qt,o=[n.x*Qt,n.y*Qt],a=[];for(const n of t)for(const t of n){const n=[t.x+o[0],t.y+o[1]];pe(n,e,i,r),a.push(n)}return a}function fe(t,e,i,n){const r=Math.pow(2,n.z)*Qt,o=[n.x*Qt,n.y*Qt],a=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+o[0],n.y+o[1]];te(e,i),t.push(i)}a.push(t)}if(e[2]-e[0]<=r/2){(s=e)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const t of a)for(const n of t)pe(n,e,i,r)}var s;return a}class me{constructor(t,e){this.type=dt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ft(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const i=e.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new me(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new me(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new me(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const o=ce(e.coordinates,n,r),a=de(t.geometry(),i,n,r);if(!ee(i,n))return!1;for(const t of a)if(!re(t,o))return!1}if("MultiPolygon"===e.type){const o=he(e.coordinates,n,r),a=de(t.geometry(),i,n,r);if(!ee(i,n))return!1;for(const t of a)if(!oe(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const o=ce(e.coordinates,n,r),a=fe(t.geometry(),i,n,r);if(!ee(i,n))return!1;for(const t of a)if(!le(t,o))return!1}if("MultiPolygon"===e.type){const o=he(e.coordinates,n,r),a=fe(t.geometry(),i,n,r);if(!ee(i,n))return!1;for(const t of a)if(!ue(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function ge(t){if(t instanceof Jt){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof me)return!1;let e=!0;return t.eachChild(t=>{e&&!ge(t)&&(e=!1)}),e}function _e(t){if(t instanceof Jt&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!_e(t)&&(e=!1)}),e}function ye(t,e){if(t instanceof Jt&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(t=>{i&&!ye(t,e)&&(i=!1)}),i}class xe{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new xe(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class ve{constructor(t,e=[],i,n=new ut,r=[]){this.registry=t,this.path=e,this.key=e.map(t=>`[${t}]`).join(""),this.scope=n,this.errors=r,this.expectedType=i}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new qt(e,[t]):"coerce"===i?new $t(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof Nt)&&"resolvedImage"!==n.type.kind&&function t(e){if(e instanceof xe)return t(e.boundExpression);if(e instanceof Jt&&"error"===e.name)return!1;if(e instanceof Yt)return!1;if(e instanceof me)return!1;const i=e instanceof $t||e instanceof qt;let n=!0;return e.eachChild(e=>{n=i?n&&t(e):n&&e instanceof Nt}),!!n&&ge(e)&&ye(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(n)){const e=new Kt;try{n=new Nt(n.type,n.evaluate(e))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new ve(this.registry,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new lt(i,t))}checkSubtype(t,e){const i=St(t,e);return i&&this.error(i),i}}function be(t,e){const i=t.length-1;let n,r,o=0,a=i,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),n=t[s],r=t[s+1],n<=e){if(s===i||e<r)return s;o=s+1}else{if(!(n>e))throw new Vt("Input is not a number.");a=s-1}return 0}class we{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,ht);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i<t.length;i+=2){const o=1===i?-1/0:t[i],a=t[i+1],s=i,l=i+1;if("number"!=typeof o)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(n.length&&n[n.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const u=e.parse(a,l,r);if(!u)return null;r=r||u.type,n.push([o,u])}return new we(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;return n>=e[r-1]?i[r-1].evaluate(t):i[be(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){const t=["step",this.input.serialize()];for(let e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}function Se(t,e,i){return t*(1-i)+e*i}var Te=Object.freeze({__proto__:null,number:Se,color:function(t,e,i){return new zt(Se(t.r,e.r,i),Se(t.g,e.g,i),Se(t.b,e.b,i),Se(t.a,e.a,i))},array:function(t,e,i){return t.map((t,n)=>Se(t,e[n],i))}});const Ee=6/29*3*(6/29),Ae=Math.PI/180,Ie=180/Math.PI;function Ce(t){return t>.008856451679035631?Math.pow(t,1/3):t/Ee+4/29}function Pe(t){return t>6/29?t*t*t:Ee*(t-4/29)}function Me(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ke(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ze(t){const e=ke(t.r),i=ke(t.g),n=ke(t.b),r=Ce((.4124564*e+.3575761*i+.1804375*n)/.95047),o=Ce((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*o-16,a:500*(r-o),b:200*(o-Ce((.0193339*e+.119192*i+.9503041*n)/1.08883)),alpha:t.a}}function Le(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Pe(e),i=.95047*Pe(i),n=1.08883*Pe(n),new zt(Me(3.2404542*i-1.5371385*e-.4985314*n),Me(-.969266*i+1.8760108*e+.041556*n),Me(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function Be(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const De={forward:ze,reverse:Le,interpolate:function(t,e,i){return{l:Se(t.l,e.l,i),a:Se(t.a,e.a,i),b:Se(t.b,e.b,i),alpha:Se(t.alpha,e.alpha,i)}}},Re={forward:function(t){const{l:e,a:i,b:n}=ze(t),r=Math.atan2(n,i)*Ie;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Ae,i=t.c;return Le({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:Be(t.h,e.h,i),c:Se(t.c,e.c,i),l:Se(t.l,e.l,i),alpha:Se(t.alpha,e.alpha,i)}}};var Oe=Object.freeze({__proto__:null,lab:De,hcl:Re});class Fe{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,i,n,r){let o=0;if("exponential"===t.name)o=Ue(i,t.base,n,r);else if("linear"===t.name)o=Ue(i,1,n,r);else if("cubic-bezier"===t.name){const a=t.controlPoints;o=new e(a[0],a[1],a[2],a[3]).solve(Ue(i,1,n,r))}return o}static parse(t,e){let[i,n,r,...o]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error("Unknown interpolation type "+String(n[0]),1,0);{const t=n.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,ht),!r)return null;const a=[];let s=null;"interpolate-hcl"===i||"interpolate-lab"===i?s=ft:e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);for(let t=0;t<o.length;t+=2){const i=o[t],n=o[t+1],r=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(a.length&&a[a.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const u=e.parse(n,l,s);if(!u)return null;s=s||u.type,a.push([i,u])}return"number"===s.kind||"color"===s.kind||"array"===s.kind&&"number"===s.itemType.kind&&"number"==typeof s.N?new Fe(s,i,n,r,a):e.error(`Type ${bt(s)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const o=be(e,n),a=Fe.interpolationFactor(this.interpolation,n,e[o],e[o+1]),s=i[o].evaluate(t),l=i[o+1].evaluate(t);return"interpolate"===this.operator?Te[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?Re.reverse(Re.interpolate(Re.forward(s),Re.forward(l),a)):De.reverse(De.interpolate(De.forward(s),De.forward(l),a))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)e.push(this.labels[t],this.outputs[t].serialize());return e}}function Ue(t,e,i,n){const r=n-i,o=t-i;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}class je{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const n=e.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}const o=n&&r.some(t=>St(n,t.type));return new je(o?gt:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(t),i&&i instanceof Rt&&!i.available&&(e||(e=i.name),i=null,n===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){const t=["coalesce"];return this.eachChild(e=>{t.push(e.serialize())}),t}}class Ne{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=e.parse(t[n+1],n+1);if(!o)return null;i.push([r,o])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new Ne(i,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[e,i]of this.bindings)t.push(e,i.serialize());return t.push(this.result.serialize()),t}}class Ve{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ht),n=e.parse(t[2],2,vt(e.expectedType||gt));return i&&n?new Ve(n.type.itemType,i,n):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Vt(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new Vt(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Vt(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Ge{constructor(t,e){this.type=dt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,gt),n=e.parse(t[2],2,gt);return i&&n?Tt(i.type,[dt,pt,ht,ct,gt])?new Ge(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Et(e,["boolean","string","number","null"]))throw new Vt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Ut(e))} instead.`);if(!Et(i,["string","array"]))throw new Vt(`Expected second argument to be of type array or string, but found ${bt(Ut(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class qe{constructor(t,e,i){this.type=ht,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,gt),n=e.parse(t[2],2,gt);if(!i||!n)return null;if(!Tt(i.type,[dt,pt,ht,ct,gt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,ht);return r?new qe(i,n,r):null}return new qe(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Et(e,["boolean","string","number","null"]))throw new Vt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Ut(e))} instead.`);if(!Et(i,["string","array"]))throw new Vt(`Expected second argument to be of type array or string, but found ${bt(Ut(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class We{constructor(t,e,i,n,r,o){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},o=[];for(let a=2;a<t.length-1;a+=2){let s=t[a];const l=t[a+1];Array.isArray(s)||(s=[s]);const u=e.concat(a);if(0===s.length)return u.error("Expected at least one branch label.");for(const t of s){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(i){if(u.checkSubtype(i,Ut(t)))return null}else i=Ut(t);if(void 0!==r[String(t)])return u.error("Branch labels must be unique.");r[String(t)]=o.length}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,o.push(c)}const a=e.parse(t[1],1,gt);if(!a)return null;const s=e.parse(t[t.length-1],t.length-1,n);return s?"value"!==a.type.kind&&e.concat(1).checkSubtype(i,a.type)?null:new We(i,n,a,r,o,s):null}evaluate(t){const e=this.input.evaluate(t);return(Ut(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),i=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=i.length,i.push([this.cases[t],[t]])):i[e][1].push(t)}const r=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of i)t.push(1===n.length?r(n[0]):n.map(r)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class Ze{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;r<t.length-1;r+=2){const o=e.parse(t[r],r,dt);if(!o)return null;const a=e.parse(t[r+1],r+1,i);if(!a)return null;n.push([o,a]),i=i||a.type}const r=e.parse(t[t.length-1],t.length-1,i);return r?new Ze(i,n,r):null}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild(e=>{t.push(e.serialize())}),t}}class He{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,gt),n=e.parse(t[2],2,ht);if(!i||!n)return null;if(!Tt(i.type,[vt(gt),pt,gt]))return e.error(`Expected first argument to be of type array or string, but found ${bt(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,ht);return r?new He(i.type,i,n,r):null}return new He(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!Et(e,["string","array"]))throw new Vt(`Expected first argument to be of type array or string, but found ${bt(Ut(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function $e(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Xe(t,e,i,n){return 0===n.compare(e,i)}function Ke(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=dt,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let o=e.parse(t[1],1,gt);if(!o)return null;if(!$e(i,o.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${bt(o.type)}'.`);let a=e.parse(t[2],2,gt);if(!a)return null;if(!$e(i,a.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${bt(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${bt(o.type)}' and '${bt(a.type)}'.`);n&&("value"===o.type.kind&&"value"!==a.type.kind?o=new qt(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new qt(o.type,[a])));let s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(s=e.parse(t[3],3,_t),!s)return null}return new r(o,a,s)}evaluate(r){const o=this.lhs.evaluate(r),a=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=Ut(o),i=Ut(a);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Vt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=Ut(o),i=Ut(a);if("string"!==t.kind||"string"!==i.kind)return e(r,o,a)}return this.collator?i(r,o,a,this.collator.evaluate(r)):e(r,o,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild(t=>{e.push(t.serialize())}),e}}}const Je=Ke("==",(function(t,e,i){return e===i}),Xe),Ye=Ke("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!Xe(0,e,i,n)})),Qe=Ke("<",(function(t,e,i){return e<i}),(function(t,e,i,n){return n.compare(e,i)<0})),ti=Ke(">",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),ei=Ke("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),ii=Ke(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class ni{constructor(t,e,i,n,r){this.type=pt,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=r}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,ht);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,pt),!r))return null;let o=null;if(n.currency&&(o=e.parse(n.currency,1,pt),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,ht),!a))return null;let s=null;return n["max-fraction-digits"]&&(s=e.parse(n["max-fraction-digits"],1,ht),!s)?null:new ni(i,r,o,a,s)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class ri{constructor(t){this.type=ht,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${bt(i.type)} instead.`):new ri(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Vt(`Expected value to be of type string or array, but found ${bt(Ut(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild(e=>{t.push(e.serialize())}),t}}const oi={"==":Je,"!=":Ye,">":ti,"<":Qe,">=":ii,"<=":ei,array:qt,at:Ve,boolean:qt,case:Ze,coalesce:je,collator:Yt,format:Wt,image:Zt,in:Ge,"index-of":qe,interpolate:Fe,"interpolate-hcl":Fe,"interpolate-lab":Fe,length:ri,let:Ne,literal:Nt,match:We,number:qt,"number-format":ni,object:qt,slice:He,step:we,string:qt,"to-boolean":$t,"to-color":$t,"to-number":$t,"to-string":$t,var:xe,within:me};function ai(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const o=r?r.evaluate(t):1,a=Ot(e,i,n,o);if(a)throw new Vt(a);return new zt(e/255*o,i/255*o,n/255*o,o)}function si(t,e){return t in e}function li(t,e){const i=e[t];return void 0===i?null:i}function ui(t){return{type:t}}function ci(t){return{result:"success",value:t}}function hi(t){return{result:"error",value:t}}function pi(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function di(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function fi(t){return!!t.expression&&t.expression.interpolated}function mi(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function gi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function _i(t){return t}function yi(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function xi(t,e,i,n,r){return yi(typeof i===r?n[i]:void 0,t.default,e.default)}function vi(t,e,i){if("number"!==mi(i))return yi(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const r=be(t.stops.map(t=>t[0]),i);return t.stops[r][1]}function bi(t,e,i){const n=void 0!==t.base?t.base:1;if("number"!==mi(i))return yi(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];const o=be(t.stops.map(t=>t[0]),i),a=function(t,e,i,n){const r=n-i,o=t-i;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}(i,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1];let u=Te[e.type]||_i;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=Oe[t.colorSpace];u=(t,i)=>e.reverse(e.interpolate(e.forward(t),e.forward(i),a))}return"function"==typeof s.evaluate?{evaluate(...t){const e=s.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==i)return u(e,i,a)}}:u(s,l,a)}function wi(t,e,i){return"color"===e.type?i=zt.parse(i):"formatted"===e.type?i=Dt.fromString(i.toString()):"resolvedImage"===e.type?i=Rt.fromString(i.toString()):mi(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0),yi(i,t.default,e.default)}Jt.register(oi,{error:[{kind:"error"},[pt],(t,[e])=>{throw new Vt(e.evaluate(t))}],typeof:[pt,[gt],(t,[e])=>bt(Ut(e.evaluate(t)))],"to-rgba":[vt(ht,4),[ft],(t,[e])=>e.evaluate(t).toArray()],rgb:[ft,[ht,ht,ht],ai],rgba:[ft,[ht,ht,ht,ht],ai],has:{type:dt,overloads:[[[pt],(t,[e])=>si(e.evaluate(t),t.properties())],[[pt,mt],(t,[e,i])=>si(e.evaluate(t),i.evaluate(t))]]},get:{type:gt,overloads:[[[pt],(t,[e])=>li(e.evaluate(t),t.properties())],[[pt,mt],(t,[e,i])=>li(e.evaluate(t),i.evaluate(t))]]},"feature-state":[gt,[pt],(t,[e])=>li(e.evaluate(t),t.featureState||{})],properties:[mt,[],t=>t.properties()],"geometry-type":[pt,[],t=>t.geometryType()],id:[gt,[],t=>t.id()],zoom:[ht,[],t=>t.globals.zoom],"heatmap-density":[ht,[],t=>t.globals.heatmapDensity||0],"line-progress":[ht,[],t=>t.globals.lineProgress||0],accumulated:[gt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[ht,ui(ht),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[ht,ui(ht),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:ht,overloads:[[[ht,ht],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[ht],(t,[e])=>-e.evaluate(t)]]},"/":[ht,[ht,ht],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[ht,[ht,ht],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[ht,[],()=>Math.LN2],pi:[ht,[],()=>Math.PI],e:[ht,[],()=>Math.E],"^":[ht,[ht,ht],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[ht,[ht],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[ht,[ht],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[ht,[ht],(t,[e])=>Math.log(e.evaluate(t))],log2:[ht,[ht],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[ht,[ht],(t,[e])=>Math.sin(e.evaluate(t))],cos:[ht,[ht],(t,[e])=>Math.cos(e.evaluate(t))],tan:[ht,[ht],(t,[e])=>Math.tan(e.evaluate(t))],asin:[ht,[ht],(t,[e])=>Math.asin(e.evaluate(t))],acos:[ht,[ht],(t,[e])=>Math.acos(e.evaluate(t))],atan:[ht,[ht],(t,[e])=>Math.atan(e.evaluate(t))],min:[ht,ui(ht),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[ht,ui(ht),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[ht,[ht],(t,[e])=>Math.abs(e.evaluate(t))],round:[ht,[ht],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[ht,[ht],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[ht,[ht],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[dt,[pt,gt],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[dt,[gt],(t,[e])=>t.id()===e.value],"filter-type-==":[dt,[pt],(t,[e])=>t.geometryType()===e.value],"filter-<":[dt,[pt,gt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[dt,[gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[dt,[pt,gt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[dt,[gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[dt,[pt,gt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[dt,[gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[dt,[pt,gt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[dt,[gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[dt,[gt],(t,[e])=>e.value in t.properties()],"filter-has-id":[dt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[dt,[vt(pt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[dt,[vt(gt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[dt,[pt,vt(gt)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[dt,[pt,vt(gt)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:dt,overloads:[[[dt,dt],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[ui(dt),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:dt,overloads:[[[dt,dt],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[ui(dt),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[dt,[dt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[dt,[pt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[pt,[pt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[pt,[pt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[pt,ui(gt),(t,e)=>e.map(e=>jt(e.evaluate(t))).join("")],"resolved-locale":[pt,[_t],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Si{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Kt,this._defaultValue=e?function(t){return"color"===t.type&&gi(t.default)?new zt(0,0,0,0):"color"===t.type?zt.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Vt(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Ti(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in oi}function Ei(t,e){const i=new ve(oi,[],e?function(t){const e={color:ft,string:pt,number:ht,enum:pt,boolean:dt,formatted:yt,resolvedImage:xt};return"array"===t.type?vt(e[t.value]||gt,t.length):e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?ci(new Si(n,e)):hi(i.errors)}class Ai{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!_e(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,o)}evaluate(t,e,i,n,r,o){return this._styleExpression.evaluate(t,e,i,n,r,o)}}class Ii{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!_e(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,o)}evaluate(t,e,i,n,r,o){return this._styleExpression.evaluate(t,e,i,n,r,o)}interpolationFactor(t,e,i){return this.interpolationType?Fe.interpolationFactor(this.interpolationType,t,e,i):0}}function Ci(t,e){const i=Ei(t,e);if("error"===i.result)return i;const n=i.value.expression,r=ge(n);if(!r&&!pi(e))return hi([new lt("","data expressions not supported")]);const o=ye(n,["zoom"]);if(!o&&!di(e))return hi([new lt("","zoom expressions not supported")]);const a=function t(e){let i=null;if(e instanceof Ne)i=t(e.result);else if(e instanceof je){for(const n of e.args)if(i=t(n),i)break}else(e instanceof we||e instanceof Fe)&&e.input instanceof Jt&&"zoom"===e.input.name&&(i=e);return i instanceof lt||e.eachChild(e=>{const n=t(e);n instanceof lt?i=n:!i&&n?i=new lt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&n&&i!==n&&(i=new lt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}(n);return a||o?a instanceof lt?hi([a]):a instanceof Fe&&!fi(e)?hi([new lt("",'"interpolate" expressions cannot be used with this property')]):ci(a?new Ii(r?"camera":"composite",i.value,a.labels,a instanceof Fe?a.interpolation:void 0):new Ai(r?"constant":"source",i.value)):hi([new lt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Pi{constructor(t,e){this._parameters=t,this._specification=e,ot(this,function t(e,i){const n="color"===i.type,r=e.stops&&"object"==typeof e.stops[0][0],o=r||!(r||void 0!==e.property),a=e.type||(fi(i)?"exponential":"interval");if(n&&((e=ot({},e)).stops&&(e.stops=e.stops.map(t=>[t[0],zt.parse(t[1])])),e.default=zt.parse(e.default?e.default:i.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Oe[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);let s,l,u;if("exponential"===a)s=bi;else if("interval"===a)s=vi;else if("categorical"===a){s=xi,l=Object.create(null);for(const t of e.stops)l[t[0]]=t[1];u=typeof e.stops[0][0]}else{if("identity"!==a)throw new Error(`Unknown function type "${a}"`);s=wi}if(r){const n={},r=[];for(let t=0;t<e.stops.length;t++){const i=e.stops[t],o=i[0].zoom;void 0===n[o]&&(n[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},r.push(o)),n[o].stops.push([i[0].value,i[1]])}const o=[];for(const e of r)o.push([n[e].zoom,t(n[e],i)]);const a={name:"linear"};return{kind:"composite",interpolationType:a,interpolationFactor:Fe.interpolationFactor.bind(void 0,a),zoomStops:o.map(t=>t[0]),evaluate:({zoom:t},n)=>bi({stops:o,base:e.base},i,t).evaluate(t,n)}}if(o){const t="exponential"===a?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:t,interpolationFactor:Fe.interpolationFactor.bind(void 0,t),zoomStops:e.stops.map(t=>t[0]),evaluate:({zoom:t})=>s(e,i,t,l,u)}}return{kind:"source",evaluate(t,n){const r=n&&n.properties?n.properties[e.property]:void 0;return void 0===r?yi(e.default,i.default):s(e,i,r,l,u)}}}(this._parameters,this._specification))}static deserialize(t){return new Pi(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Mi(t){const e=t.key,i=t.value,n=t.valueSpec||{},r=t.objectElementValidators||{},o=t.style,a=t.styleSpec;let s=[];const l=mi(i);if("object"!==l)return[new nt(e,i,`object expected, ${l} found`)];for(const t in i){const l=t.split(".")[0],u=n[l]||n["*"];let c;if(r[l])c=r[l];else if(n[l])c=nn;else if(r["*"])c=r["*"];else{if(!n["*"]){s.push(new nt(e,i[t],`unknown property "${t}"`));continue}c=nn}s=s.concat(c({key:(e?e+".":e)+t,value:i[t],valueSpec:u,style:o,styleSpec:a,object:i,objectKey:t},i))}for(const t in n)r[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&s.push(new nt(e,i,`missing required property "${t}"`));return s}function ki(t){const e=t.value,i=t.valueSpec,n=t.style,r=t.styleSpec,o=t.key,a=t.arrayElementValidator||nn;if("array"!==mi(e))return[new nt(o,e,`array expected, ${mi(e)} found`)];if(i.length&&e.length!==i.length)return[new nt(o,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new nt(o,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let s={type:i.value,values:i.values};r.$version<7&&(s.function=i.function),"object"===mi(i.value)&&(s=i.value);let l=[];for(let t=0;t<e.length;t++)l=l.concat(a({array:e,arrayIndex:t,value:e[t],valueSpec:s,style:n,styleSpec:r,key:`${o}[${t}]`}));return l}function zi(t){const e=t.key,i=t.value,n=t.valueSpec;let r=mi(i);return"number"===r&&i!=i&&(r="NaN"),"number"!==r?[new nt(e,i,`number expected, ${r} found`)]:"minimum"in n&&i<n.minimum?[new nt(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new nt(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Li(t){const e=t.valueSpec,i=at(t.value.type);let n,r,o,a={};const s="categorical"!==i&&void 0===t.value.property,l=!s,u="array"===mi(t.value.stops)&&"array"===mi(t.value.stops[0])&&"object"===mi(t.value.stops[0][0]),c=Mi({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new nt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(ki({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===mi(n)&&0===n.length&&e.push(new nt(t.key,n,"array must have at least one stop")),e},default:function(t){return nn({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&s&&c.push(new nt(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||c.push(new nt(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!fi(t.valueSpec)&&c.push(new nt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!pi(t.valueSpec)?c.push(new nt(t.key,t.value,"property functions not supported")):s&&!di(t.valueSpec)&&c.push(new nt(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!u||void 0!==t.value.property||c.push(new nt(t.key,t.value,'"property" property is required')),c;function h(t){let i=[];const n=t.value,s=t.key;if("array"!==mi(n))return[new nt(s,n,`array expected, ${mi(n)} found`)];if(2!==n.length)return[new nt(s,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==mi(n[0]))return[new nt(s,n,`object expected, ${mi(n[0])} found`)];if(void 0===n[0].zoom)return[new nt(s,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new nt(s,n,"object stop key must have value")];if(o&&o>at(n[0].zoom))return[new nt(s,n[0].zoom,"stop zoom values must appear in ascending order")];at(n[0].zoom)!==o&&(o=at(n[0].zoom),r=void 0,a={}),i=i.concat(Mi({key:s+"[0]",value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:zi,value:p}}))}else i=i.concat(p({key:s+"[0]",value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return Ti(st(n[1]))?i.concat([new nt(s+"[1]",n[1],"expressions are not allowed in function stops.")]):i.concat(nn({key:s+"[1]",value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,o){const s=mi(t.value),l=at(t.value),u=null!==t.value?t.value:o;if(n){if(s!==n)return[new nt(t.key,u,`${s} stop domain type must match previous stop domain type ${n}`)]}else n=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new nt(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){let n=`number expected, ${s} found`;return pi(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new nt(t.key,u,n)]}return"categorical"!==i||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&void 0!==r&&l<r?[new nt(t.key,u,"stop domain values must appear in ascending order")]:(r=l,"categorical"===i&&l in a?[new nt(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new nt(t.key,u,"integer expected, found "+l)]}}function Bi(t){const e=("property"===t.expressionContext?Ci:Ei)(st(t.value),t.valueSpec);if("error"===e.result)return e.value.map(e=>new nt(`${t.key}${e.key}`,t.value,e.message));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new nt(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!_e(i))return[new nt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!_e(i))return[new nt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!ye(i,["zoom","feature-state"]))return[new nt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!ge(i))return[new nt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Di(t){const e=t.key,i=t.value,n=t.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(at(i))&&r.push(new nt(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(at(i))&&r.push(new nt(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function Ri(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Ri(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Oi={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Fi(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Ri(t)||(t=Ni(t));const e=Ei(t,Oi);if("error"===e.result)throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,i,n)=>e.value.evaluate(t,i,{},n),needGeometry:ji(t)}}function Ui(t,e){return t<e?-1:t>e?1:0}function ji(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(ji(t[e]))return!0;return!1}function Ni(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Vi(t[1],t[2],"=="):"!="===e?Wi(Vi(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Vi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Ni))):"all"===e?["all"].concat(t.slice(1).map(Ni)):"none"===e?["all"].concat(t.slice(1).map(Ni).map(Wi)):"in"===e?Gi(t[1],t.slice(2)):"!in"===e?Wi(Gi(t[1],t.slice(2))):"has"===e?qi(t[1]):"!has"===e?Wi(qi(t[1])):"within"!==e||t;var i}function Vi(t,e,i){switch(t){case"$type":return["filter-type-"+i,e];case"$id":return["filter-id-"+i,e];default:return["filter-"+i,t,e]}}function Gi(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Ui)]]:["filter-in-small",t,["literal",e]]}}function qi(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Wi(t){return["!",t]}function Zi(t){return Ri(st(t.value))?Bi(ot({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){const i=e.value,n=e.key;if("array"!==mi(i))return[new nt(n,i,`array expected, ${mi(i)} found`)];const r=e.styleSpec;let o,a=[];if(i.length<1)return[new nt(n,i,"filter array must have at least 1 element")];switch(a=a.concat(Di({key:n+"[0]",value:i[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),at(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===at(i[1])&&a.push(new nt(n,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":3!==i.length&&a.push(new nt(n,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(o=mi(i[1]),"string"!==o&&a.push(new nt(n+"[1]",i[1],`string expected, ${o} found`)));for(let t=2;t<i.length;t++)o=mi(i[t]),"$type"===at(i[1])?a=a.concat(Di({key:`${n}[${t}]`,value:i[t],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==o&&"number"!==o&&"boolean"!==o&&a.push(new nt(`${n}[${t}]`,i[t],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let r=1;r<i.length;r++)a=a.concat(t({key:`${n}[${r}]`,value:i[r],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":o=mi(i[1]),2!==i.length?a.push(new nt(n,i,`filter array for "${i[0]}" operator must have 2 elements`)):"string"!==o&&a.push(new nt(n+"[1]",i[1],`string expected, ${o} found`));break;case"within":o=mi(i[1]),2!==i.length?a.push(new nt(n,i,`filter array for "${i[0]}" operator must have 2 elements`)):"object"!==o&&a.push(new nt(n+"[1]",i[1],`object expected, ${o} found`))}return a}(t)}function Hi(t,e){const i=t.key,n=t.style,r=t.styleSpec,o=t.value,a=t.objectKey,s=r[`${e}_${t.layerType}`];if(!s)return[];const l=a.match(/^(.*)-transition$/);if("paint"===e&&l&&s[l[1]]&&s[l[1]].transition)return nn({key:i,value:o,valueSpec:r.transition,style:n,styleSpec:r});const u=t.valueSpec||s[a];if(!u)return[new nt(i,o,`unknown property "${a}"`)];let c;if("string"===mi(o)&&pi(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new nt(i,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];const h=[];return"symbol"===t.layerType&&("text-field"===a&&n&&!n.glyphs&&h.push(new nt(i,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&gi(st(o))&&"identity"===at(o.type)&&h.push(new nt(i,o,'"text-font" does not support identity functions'))),h.concat(nn({key:t.key,value:o,valueSpec:u,style:n,styleSpec:r,expressionContext:"property",propertyType:e,propertyKey:a}))}function $i(t){return Hi(t,"paint")}function Xi(t){return Hi(t,"layout")}function Ki(t){let e=[];const i=t.value,n=t.key,r=t.style,o=t.styleSpec;i.type||i.ref||e.push(new nt(n,i,'either "type" or "ref" is required'));let a=at(i.type);const s=at(i.ref);if(i.id){const o=at(i.id);for(let a=0;a<t.arrayIndex;a++){const t=r.layers[a];at(t.id)===o&&e.push(new nt(n,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in i&&e.push(new nt(n,i[t],`"${t}" is prohibited for ref layers`))}),r.layers.forEach(e=>{at(e.id)===s&&(t=e)}),t?t.ref?e.push(new nt(n,i.ref,"ref cannot reference another ref layer")):a=at(t.type):e.push(new nt(n,i.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(i.source){const t=r.sources&&r.sources[i.source],o=t&&at(t.type);t?"vector"===o&&"raster"===a?e.push(new nt(n,i.source,`layer "${i.id}" requires a raster source`)):"raster"===o&&"raster"!==a?e.push(new nt(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==a?e.push(new nt(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new nt(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new nt(n,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new nt(n,i.source,`source "${i.source}" not found`))}else e.push(new nt(n,i,'missing required property "source"'));return e=e.concat(Mi({key:n,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>nn({key:n+".type",value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:i,objectKey:"type"}),filter:Zi,layout:t=>Mi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>Xi(ot({layerType:a},t))}}),paint:t=>Mi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>$i(ot({layerType:a},t))}})}})),e}function Ji(t){const e=t.value,i=t.key,n=mi(e);return"string"!==n?[new nt(i,e,`string expected, ${n} found`)]:[]}const Yi={promoteId:function({key:t,value:e}){if("string"===mi(e))return Ji({key:t,value:e});{const i=[];for(const n in e)i.push(...Ji({key:`${t}.${n}`,value:e[n]}));return i}}};function Qi(t){const e=t.value,i=t.key,n=t.styleSpec,r=t.style;if(!e.type)return[new nt(i,e,'"type" is required')];const o=at(e.type);let a;switch(o){case"vector":case"raster":case"raster-dem":return a=Mi({key:i,value:e,valueSpec:n["source_"+o.replace("-","_")],style:t.style,styleSpec:n,objectElementValidators:Yi}),a;case"geojson":if(a=Mi({key:i,value:e,valueSpec:n.source_geojson,style:r,styleSpec:n,objectElementValidators:Yi}),e.cluster)for(const t in e.clusterProperties){const[n,r]=e.clusterProperties[t],o="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...Bi({key:`${i}.${t}.map`,value:r,expressionContext:"cluster-map"})),a.push(...Bi({key:`${i}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return Mi({key:i,value:e,valueSpec:n.source_video,style:r,styleSpec:n});case"image":return Mi({key:i,value:e,valueSpec:n.source_image,style:r,styleSpec:n});case"canvas":return[new nt(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Di({key:i+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,styleSpec:n})}}function tn(t){const e=t.value,i=t.styleSpec,n=i.light,r=t.style;let o=[];const a=mi(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new nt("light",e,`object expected, ${a} found`)]),o;for(const t in e){const a=t.match(/^(.*)-transition$/);o=o.concat(a&&n[a[1]]&&n[a[1]].transition?nn({key:t,value:e[t],valueSpec:i.transition,style:r,styleSpec:i}):n[t]?nn({key:t,value:e[t],valueSpec:n[t],style:r,styleSpec:i}):[new nt(t,e[t],`unknown property "${t}"`)])}return o}const en={"*":()=>[],array:ki,boolean:function(t){const e=t.value,i=t.key,n=mi(e);return"boolean"!==n?[new nt(i,e,`boolean expected, ${n} found`)]:[]},number:zi,color:function(t){const e=t.key,i=t.value,n=mi(i);return"string"!==n?[new nt(e,i,`color expected, ${n} found`)]:null===At(i)?[new nt(e,i,`color expected, "${i}" found`)]:[]},constants:rt,enum:Di,filter:Zi,function:Li,layer:Ki,object:Mi,source:Qi,light:tn,string:Ji,formatted:function(t){return 0===Ji(t).length?[]:Bi(t)},resolvedImage:function(t){return 0===Ji(t).length?[]:Bi(t)}};function nn(t){const e=t.value,i=t.valueSpec,n=t.styleSpec;return i.expression&&gi(at(e))?Li(t):i.expression&&Ti(st(e))?Bi(t):i.type&&en[i.type]?en[i.type](t):Mi(ot({},t,{valueSpec:i.type?n[i.type]:i}))}function rn(t){const e=t.value,i=t.key,n=Ji(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new nt(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new nt(i,e,'"glyphs" url must include a "{range}" token'))),n}function on(t,e=it){let i=[];return i=i.concat(nn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:rn,"*":()=>[]}})),t.constants&&(i=i.concat(rt({key:"constants",value:t.constants,style:t,styleSpec:e}))),an(i)}function an(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function sn(t){return function(...e){return an(t.apply(this,e))}}on.source=sn(Qi),on.light=sn(tn),on.layer=sn(Ki),on.filter=sn(Zi),on.paintProperty=sn($i),on.layoutProperty=sn(Xi);const ln=on,un=ln.light,cn=ln.paintProperty,hn=ln.layoutProperty;function pn(t,e){let i=!1;if(e&&e.length)for(const n of e)t.fire(new tt(new Error(n.message))),i=!0;return i}class dn{constructor(t,e,i){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const r=new Int32Array(this.arrayBuffer);t=r[0],this.d=(e=r[1])+2*(i=r[2]);for(let t=0;t<this.d*this.d;t++){const e=r[3+t],i=r[3+t+1];n.push(e===i?null:r.subarray(e,i))}const o=r[3+n.length+1];this.keys=r.subarray(r[3+n.length],o),this.bboxes=r.subarray(o),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;const r=i/e*t;this.min=-r,this.max=t+r}insert(t,e,i,n,r){this._forEachCell(e,i,n,r,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(r)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,n,r,o){this.cells[r].push(o)}query(t,e,i,n,r){const o=this.min,a=this.max;if(t<=o&&e<=o&&a<=i&&a<=n&&!r)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(t,e,i,n,this._queryCell,o,{},r),o}}_queryCell(t,e,i,n,r,o,a,s){const l=this.cells[r];if(null!==l){const r=this.keys,u=this.bboxes;for(let c=0;c<l.length;c++){const h=l[c];if(void 0===a[h]){const l=4*h;(s?s(u[l+0],u[l+1],u[l+2],u[l+3]):t<=u[l+2]&&e<=u[l+3]&&i>=u[l+0]&&n>=u[l+1])?(a[h]=!0,o.push(r[h])):a[h]=!1}}}}_forEachCell(t,e,i,n,r,o,a,s){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(i),h=this._convertToCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&r.call(this,t,e,i,n,u,o,a,s))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let t=0;t<this.cells.length;t++)i+=this.cells[t].length;const n=new Int32Array(e+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let r=e;for(let e=0;e<t.length;e++){const i=t[e];n[3+e]=r,n.set(i,r),r+=i.length}return n[3+t.length]=r,n.set(this.keys,r),r+=this.keys.length,n[3+t.length+1]=r,n.set(this.bboxes,r),r+=this.bboxes.length,n.buffer}static serialize(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new dn(t.buffer)}}const fn={};function mn(t,e,i={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),fn[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}mn("Object",Object),mn("TransferableGridIndex",dn),mn("Color",zt),mn("Error",Error),mn("AJAXError",N),mn("ResolvedImage",Rt),mn("StylePropertyFunction",Pi),mn("StyleExpression",Si,{omit:["_evaluator"]}),mn("ZoomDependentExpression",Ii),mn("ZoomConstantExpression",Ai),mn("CompoundExpression",Jt,{omit:["_evaluate"]});for(const t in oi)oi[t]._classRegistryKey||mn("Expression_"+t,oi[t]);function gn(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function _n(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(gn(t))return e&&e.push(t),t;if(S(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const i=t;return e&&e.push(i.buffer),i}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const n of t)i.push(_n(n,e));return i}if("object"==typeof t){const i=t.constructor,n=i._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");const r=i.serialize?i.serialize(t,e):{};if(!i.serialize){for(const i in t){if(!t.hasOwnProperty(i))continue;if(fn[n].omit.indexOf(i)>=0)continue;const o=t[i];r[i]=fn[n].shallow.indexOf(i)>=0?o:_n(o,e)}t instanceof Error&&(r.message=t.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(r.$name=n),r}throw new Error("can't serialize object of type "+typeof t)}function yn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||gn(t)||S(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(yn);if("object"==typeof t){const e=t.$name||"Object";if(!fn[e])throw new Error("can't deserialize unregistered class "+e);const{klass:i}=fn[e];if(!i)throw new Error("can't deserialize unregistered class "+e);if(i.deserialize)return i.deserialize(t);const n=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const r=t[i];n[i]=fn[e].shallow.indexOf(i)>=0?r:yn(r)}return n}throw new Error("can't deserialize object of type "+typeof t)}class xn{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}const vn={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function bn(t){for(const e of t)if(Tn(e.charCodeAt(0)))return!0;return!1}function wn(t){for(const e of t)if(!Sn(e.charCodeAt(0)))return!1;return!0}function Sn(t){return!(vn.Arabic(t)||vn["Arabic Supplement"](t)||vn["Arabic Extended-A"](t)||vn["Arabic Presentation Forms-A"](t)||vn["Arabic Presentation Forms-B"](t))}function Tn(t){return!(746!==t&&747!==t&&(t<4352||!(vn["Bopomofo Extended"](t)||vn.Bopomofo(t)||vn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||vn["CJK Compatibility Ideographs"](t)||vn["CJK Compatibility"](t)||vn["CJK Radicals Supplement"](t)||vn["CJK Strokes"](t)||!(!vn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||vn["CJK Unified Ideographs Extension A"](t)||vn["CJK Unified Ideographs"](t)||vn["Enclosed CJK Letters and Months"](t)||vn["Hangul Compatibility Jamo"](t)||vn["Hangul Jamo Extended-A"](t)||vn["Hangul Jamo Extended-B"](t)||vn["Hangul Jamo"](t)||vn["Hangul Syllables"](t)||vn.Hiragana(t)||vn["Ideographic Description Characters"](t)||vn.Kanbun(t)||vn["Kangxi Radicals"](t)||vn["Katakana Phonetic Extensions"](t)||vn.Katakana(t)&&12540!==t||!(!vn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!vn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||vn["Unified Canadian Aboriginal Syllabics"](t)||vn["Unified Canadian Aboriginal Syllabics Extended"](t)||vn["Vertical Forms"](t)||vn["Yijing Hexagram Symbols"](t)||vn["Yi Syllables"](t)||vn["Yi Radicals"](t))))}function En(t){return!(Tn(t)||function(t){return!!(vn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||vn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||vn["Letterlike Symbols"](t)||vn["Number Forms"](t)||vn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||vn["Control Pictures"](t)&&9251!==t||vn["Optical Character Recognition"](t)||vn["Enclosed Alphanumerics"](t)||vn["Geometric Shapes"](t)||vn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||vn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||vn["CJK Symbols and Punctuation"](t)||vn.Katakana(t)||vn["Private Use Area"](t)||vn["CJK Compatibility Forms"](t)||vn["Small Form Variants"](t)||vn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function An(t){return t>=1424&&t<=2303||vn["Arabic Presentation Forms-A"](t)||vn["Arabic Presentation Forms-B"](t)}function In(t,e){return!(!e&&An(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||vn.Khmer(t))}function Cn(t){for(const e of t)if(An(e.charCodeAt(0)))return!0;return!1}const Pn="deferred",Mn="loading",kn="loaded";let zn=null,Ln="unavailable",Bn=null;const Dn=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Ln="error"),zn&&zn(t)};function Rn(){On.fire(new Q("pluginStateChange",{pluginStatus:Ln,pluginURL:Bn}))}const On=new et,Fn=function(){return Ln},Un=function(){if(Ln!==Pn||!Bn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ln=Mn,Rn(),Bn&&W({url:Bn},t=>{t?Dn(t):(Ln=kn,Rn())})},jn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ln===kn||null!=jn.applyArabicShaping,isLoading:()=>Ln===Mn,setState(t){Ln=t.pluginStatus,Bn=t.pluginURL},isParsed:()=>null!=jn.applyArabicShaping&&null!=jn.processBidirectionalText&&null!=jn.processStyledBidirectionalText,getPluginURL:()=>Bn};class Nn{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new xn,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!In(i.charCodeAt(0),e))return!1;return!0}(t,jn.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class Vn{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(gi(t))return new Pi(t,e);if(Ti(t)){const i=Ci(t,e);if("error"===i.result)throw new Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));return i.value}{let i=t;return"string"==typeof t&&"color"===e.type&&(i=zt.parse(t)),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class Gn{constructor(t){this.property=t,this.value=new Vn(t,void 0)}transitioned(t,e){return new Wn(this.property,this.value,e,s({},t.transition,this.transition),t.now)}untransitioned(){return new Wn(this.property,this.value,null,{},0)}}class qn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return p(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Gn(this._values[t].property)),this._values[t].value=new Vn(this._values[t].property,null===e?void 0:p(e))}getTransition(t){return p(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Gn(this._values[t].property)),this._values[t].transition=p(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const n=this.getTransition(e);void 0!==n&&(t[e+"-transition"]=n)}return t}transitioned(t,e){const i=new Zn(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(t,e._values[n]);return i}untransitioned(){const t=new Zn(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class Wn{constructor(t,e,i,n,r){this.property=t,this.value=e,this.begin=r+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const n=t.now||0,r=this.value.possiblyEvaluate(t,e,i),o=this.prior;if(o){if(n>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(n<this.begin)return o.possiblyEvaluate(t,e,i);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,i),r,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(a))}}return r}}class Zn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const n=new Xn(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].possiblyEvaluate(t,e,i);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Hn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return p(this._values[t].value)}setValue(t,e){this._values[t]=new Vn(this._values[t].property,null===e?void 0:p(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const n=new Xn(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].possiblyEvaluate(t,e,i);return n}}class $n{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,n){return this.property.evaluate(this.value,this.parameters,t,e,i,n)}}class Xn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Kn{constructor(t){this.specification=t}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,i){const n=Te[this.specification.type];return n?n(t,e,i):t}}class Jn{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,n){return new $n(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,n)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new $n(this,{kind:"constant",value:void 0},t.parameters);const n=Te[this.specification.type];return n?new $n(this,{kind:"constant",value:n(t.value.value,e.value.value,i)},t.parameters):t}evaluate(t,e,i,n,r,o){return"constant"===t.kind?t.value:t.evaluate(e,i,n,r,o)}}class Yn extends Jn{possiblyEvaluate(t,e,i,n){if(void 0===t.value)return new $n(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const r=t.expression.evaluate(e,null,{},i,n),o="resolvedImage"===t.property.specification.type&&"string"!=typeof r?r.name:r,a=this._calculate(o,o,o,e);return new $n(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new $n(this,{kind:"constant",value:i},e)}return new $n(this,t.expression,e)}evaluate(t,e,i,n,r,o){if("source"===t.kind){const a=t.evaluate(e,i,n,r,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,n),t.evaluate({zoom:Math.floor(e.zoom)},i,n),t.evaluate({zoom:Math.floor(e.zoom)+1},i,n),e):t.value}_calculate(t,e,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Qn{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){if(void 0!==t.value){if("constant"===t.expression.kind){const r=t.expression.evaluate(e,null,{},i,n);return this._calculate(r,r,r,e)}return this._calculate(t.expression.evaluate(new Nn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Nn(Math.floor(e.zoom),e)),t.expression.evaluate(new Nn(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class tr{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){return!!t.expression.evaluate(e,null,{},i,n)}interpolate(){return!1}}class er{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new Vn(i,void 0),r=this.defaultTransitionablePropertyValues[e]=new Gn(i);this.defaultTransitioningPropertyValues[e]=r.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}mn("DataDrivenProperty",Jn),mn("DataConstantProperty",Kn),mn("CrossFadedDataDrivenProperty",Yn),mn("CrossFadedProperty",Qn),mn("ColorRampProperty",tr);const ir="-transition";class nr extends et{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Hn(e.layout)),e.paint)){this._transitionablePaint=new qn(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Xn(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}){null!=e&&this._validate(hn,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(ir)?this._transitionablePaint.getTransition(t.slice(0,-ir.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(cn,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(ir))return this._transitionablePaint.setTransition(t.slice(0,-ir.length),e||void 0),!1;{const i=this._transitionablePaint._values[t],n="cross-faded-data-driven"===i.property.specification["property-type"],r=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||r||n||this._handleOverridablePaintPropertyUpdate(t,o,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),h(t,(t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length))}_validate(t,e,i,n,r={}){return(!r||!1!==r.validate)&&pn(this,t.call(ln,{key:e,layerType:this.type,objectKey:i,value:n,styleSpec:it,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof $n&&pi(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const rr={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class or{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ar{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function sr(t,e=1){let i=0,n=0;return{members:t.map(t=>{const r=rr[t.type].BYTES_PER_ELEMENT,o=i=lr(i,Math.max(e,r)),a=t.components||1;return n=Math.max(n,r),i+=r*a,{name:t.name,type:t.type,components:a,offset:o}}),size:lr(i,Math.max(n,e)),alignment:e}}function lr(t,e){return Math.ceil(t/e)*e}class ur extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=i,t}}ur.prototype.bytesPerElement=4,mn("StructArrayLayout2i4",ur);class cr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=n,this.int16[o+3]=r,t}}cr.prototype.bytesPerElement=8,mn("StructArrayLayout4i8",cr);class hr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=n,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,t}}hr.prototype.bytesPerElement=12,mn("StructArrayLayout2i4i12",hr);class pr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,a){const s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.uint8[l+4]=n,this.uint8[l+5]=r,this.uint8[l+6]=o,this.uint8[l+7]=a,t}}pr.prototype.bytesPerElement=8,mn("StructArrayLayout2i4ub8",pr);class dr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=i,t}}dr.prototype.bytesPerElement=8,mn("StructArrayLayout2f8",dr);class fr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o,a,s,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,n,r,o,a,s,l,u)}emplace(t,e,i,n,r,o,a,s,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=i,this.uint16[h+2]=n,this.uint16[h+3]=r,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}fr.prototype.bytesPerElement=20,mn("StructArrayLayout10ui20",fr);class mr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o,a,s,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,n,r,o,a,s,l,u,c,h)}emplace(t,e,i,n,r,o,a,s,l,u,c,h,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=n,this.int16[d+3]=r,this.uint16[d+4]=o,this.uint16[d+5]=a,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,t}}mr.prototype.bytesPerElement=24,mn("StructArrayLayout4i4ui4i24",mr);class gr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=3*t;return this.float32[r+0]=e,this.float32[r+1]=i,this.float32[r+2]=n,t}}gr.prototype.bytesPerElement=12,mn("StructArrayLayout3f12",gr);class _r extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}_r.prototype.bytesPerElement=4,mn("StructArrayLayout1ul4",_r);class yr extends ar{_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(t,e,i,n,r,o,a,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,i,n,r,o,a,s,l)}emplace(t,e,i,n,r,o,a,s,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=i,this.int16[c+2]=n,this.int16[c+3]=r,this.int16[c+4]=o,this.int16[c+5]=a,this.uint32[h+3]=s,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}yr.prototype.bytesPerElement=20,mn("StructArrayLayout6i1ul2ui20",yr);class xr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=n,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,t}}xr.prototype.bytesPerElement=12,mn("StructArrayLayout2i2i2i12",xr);class vr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n,r)}emplace(t,e,i,n,r,o){const a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=i,this.float32[a+2]=n,this.int16[s+6]=r,this.int16[s+7]=o,t}}vr.prototype.bytesPerElement=16,mn("StructArrayLayout2f1f2i16",vr);class br extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=i,this.float32[a+1]=n,this.float32[a+2]=r,t}}br.prototype.bytesPerElement=12,mn("StructArrayLayout2ub2f12",br);class wr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=3*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,this.uint16[r+2]=n,t}}wr.prototype.bytesPerElement=6,mn("StructArrayLayout3ui6",wr);class Sr extends ar{_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(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g)}emplace(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g,_){const y=24*t,x=12*t,v=48*t;return this.int16[y+0]=e,this.int16[y+1]=i,this.uint16[y+2]=n,this.uint16[y+3]=r,this.uint32[x+2]=o,this.uint32[x+3]=a,this.uint32[x+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=u,this.uint16[y+12]=c,this.float32[x+7]=h,this.float32[x+8]=p,this.uint8[v+36]=d,this.uint8[v+37]=f,this.uint8[v+38]=m,this.uint32[x+10]=g,this.int16[y+22]=_,t}}Sr.prototype.bytesPerElement=48,mn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Sr);class Tr extends ar{_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(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g,_,y,x,v,b,w,S,T,E,A,I){const C=this.length;return this.resize(C+1),this.emplace(C,t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g,_,y,x,v,b,w,S,T,E,A,I)}emplace(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g,_,y,x,v,b,w,S,T,E,A,I,C){const P=34*t,M=17*t;return this.int16[P+0]=e,this.int16[P+1]=i,this.int16[P+2]=n,this.int16[P+3]=r,this.int16[P+4]=o,this.int16[P+5]=a,this.int16[P+6]=s,this.int16[P+7]=l,this.uint16[P+8]=u,this.uint16[P+9]=c,this.uint16[P+10]=h,this.uint16[P+11]=p,this.uint16[P+12]=d,this.uint16[P+13]=f,this.uint16[P+14]=m,this.uint16[P+15]=g,this.uint16[P+16]=_,this.uint16[P+17]=y,this.uint16[P+18]=x,this.uint16[P+19]=v,this.uint16[P+20]=b,this.uint16[P+21]=w,this.uint16[P+22]=S,this.uint32[M+12]=T,this.float32[M+13]=E,this.float32[M+14]=A,this.float32[M+15]=I,this.float32[M+16]=C,t}}Tr.prototype.bytesPerElement=68,mn("StructArrayLayout8i15ui1ul4f68",Tr);class Er extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Er.prototype.bytesPerElement=4,mn("StructArrayLayout1f4",Er);class Ar extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=3*t;return this.int16[r+0]=e,this.int16[r+1]=i,this.int16[r+2]=n,t}}Ar.prototype.bytesPerElement=6,mn("StructArrayLayout3i6",Ar);class Ir extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=4*t;return this.uint32[2*t+0]=e,this.uint16[r+2]=i,this.uint16[r+3]=n,t}}Ir.prototype.bytesPerElement=8,mn("StructArrayLayout1ul2ui8",Ir);class Cr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,t}}Cr.prototype.bytesPerElement=4,mn("StructArrayLayout2ui4",Cr);class Pr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Pr.prototype.bytesPerElement=2,mn("StructArrayLayout1ui2",Pr);class Mr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=n,this.float32[o+3]=r,t}}Mr.prototype.bytesPerElement=16,mn("StructArrayLayout4f16",Mr);class kr extends or{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 E(this.anchorPointX,this.anchorPointY)}}kr.prototype.size=20;class zr extends yr{get(t){return new kr(this,t)}}mn("CollisionBoxArray",zr);class Lr extends or{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Lr.prototype.size=48;class Br extends Sr{get(t){return new Lr(this,t)}}mn("PlacedSymbolArray",Br);class Dr extends or{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(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Dr.prototype.size=68;class Rr extends Tr{get(t){return new Dr(this,t)}}mn("SymbolInstanceArray",Rr);class Or extends Er{getoffsetX(t){return this.float32[1*t+0]}}mn("GlyphOffsetArray",Or);class Fr extends Ar{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}mn("SymbolLineVertexArray",Fr);class Ur extends or{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]}}Ur.prototype.size=8;class jr extends Ir{get(t){return new Ur(this,t)}}mn("FeatureIndexArray",jr);class Nr extends ur{}class Vr extends ur{}class Gr extends hr{}class qr extends pr{}class Wr extends dr{}class Zr extends fr{}class Hr extends mr{}class $r extends gr{}class Xr extends _r{}class Kr extends xr{}class Jr extends br{}class Yr extends wr{}class Qr extends Cr{}const to=sr([{name:"a_pos",components:2,type:"Int16"}],4),{members:eo}=to;class io{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,n){let r=this.segments[this.segments.length-1];return t>io.MAX_VERTEX_ARRAY_LENGTH&&f(`Max vertices per segment is ${io.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!r||r.vertexLength+t>io.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==n)&&(r={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==n&&(r.sortKey=n),this.segments.push(r)),r}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,n){return new io([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}function no(t,e){return 256*(t=o(Math.floor(t),0,255))+o(Math.floor(e),0,255)}io.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,mn("SegmentVector",io);const ro=sr([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var oo={exports:{}},ao={exports:{}};ao.exports=function(t,e){var i,n,r,o,a,s,l,u;for(n=t.length-(i=3&t.length),r=e,a=3432918353,s=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,r=27492+(65535&(o=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return r^=t.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0};var so={exports:{}};so.exports=function(t,e){for(var i,n=t.length,r=e^n,o=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:r^=(255&t.charCodeAt(o+2))<<16;case 2:r^=(255&t.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0};var lo=ao.exports,uo=so.exports;oo.exports=lo,oo.exports.murmur3=lo,oo.exports.murmur2=uo;var co=oo.exports;class ho{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,n){this.ids.push(po(t)),this.positions.push(e,i,n)}getPositions(t){const e=po(t);let i=0,n=this.ids.length-1;for(;i<n;){const t=i+n>>1;this.ids[t]>=e?n=t:i=t+1}const r=[];for(;this.ids[i]===e;)r.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return r}static serialize(t,e){const i=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,i,n,r){for(;n<r;){const o=e[n+r>>1];let a=n-1,s=r+1;for(;;){do{a++}while(e[a]<o);do{s--}while(e[s]>o);if(a>=s)break;fo(e,a,s),fo(i,3*a,3*s),fo(i,3*a+1,3*s+1),fo(i,3*a+2,3*s+2)}s-n<r-s?(t(e,i,n,s),n=s+1):(t(e,i,s+1,r),r=s)}}(i,n,0,i.length-1),e&&e.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(t){const e=new ho;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function po(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:co(String(t))}function fo(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}mn("FeaturePositionMap",ho);class mo{constructor(t,e){this.gl=t.gl,this.location=e}}class go extends mo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class _o extends mo{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class yo extends mo{constructor(t,e){super(t,e),this.current=zt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const xo=new Float32Array(16);function vo(t){return[no(255*t.r,255*t.g),no(255*t.b,255*t.a)]}class bo{constructor(t,e,i){this.value=t,this.uniformNames=e.map(t=>"u_"+t),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new yo(t,e):new go(t,e)}}class wo{constructor(t,e){this.uniformNames=e.map(t=>"u_"+t),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,n){const r="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;r&&t.set(r)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new _o(t,e):new go(t,e)}}class So{constructor(t,e,i,n){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:"a_"+t,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(t,e,i,n,r){const o=this.paintVertexArray.length,a=this.expression.evaluate(new Nn(0),e,{},n,[],r);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)}updatePaintArray(t,e,i,n){const r=this.expression.evaluate({zoom:0},i,n);this._setPaintValue(t,e,r)}_setPaintValue(t,e,i){if("color"===this.type){const n=vo(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class To{constructor(t,e,i,n,r,o){this.expression=t,this.uniformNames=e.map(t=>`u_${t}_t`),this.type=i,this.useIntegerZoom=n,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:"a_"+t,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(t,e,i,n,r){const o=this.expression.evaluate(new Nn(this.zoom),e,{},n,[],r),a=this.expression.evaluate(new Nn(this.zoom+1),e,{},n,[],r),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)}updatePaintArray(t,e,i,n){const r=this.expression.evaluate({zoom:this.zoom},i,n),o=this.expression.evaluate({zoom:this.zoom+1},i,n);this._setPaintValue(t,e,r,o)}_setPaintValue(t,e,i,n){if("color"===this.type){const r=vo(i),o=vo(n);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1],o[0],o[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i,n);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=o(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,e,i){return new go(t,e)}}class Eo{constructor(t,e,i,n,r,o){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=n,this.layerId=o,this.zoomInPaintVertexArray=new r,this.zoomOutPaintVertexArray=new r}populatePaintArray(t,e,i){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,n,r){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],r)}_setPaintValues(t,e,i,n){if(!n||!i)return;const{min:r,mid:o,max:a}=i,s=n[r],l=n[o],u=n[a];if(s&&l&&u)for(let i=t;i<e;i++)this.zoomInPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,ro.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ro.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ao{constructor(t,e,i){this.binders={},this._buffers=[];const n=[];for(const r in t.paint._values){if(!i(r))continue;const o=t.paint.get(r);if(!(o instanceof $n&&pi(o.property.specification)))continue;const a=Co(r,t.type),s=o.value,l=o.property.specification.type,u=o.property.useIntegerZoom,c=o.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===s.kind)this.binders[r]=h?new wo(s.value,a):new bo(s.value,a,l),n.push("/u_"+r);else if("source"===s.kind||h){const i=Po(r,l,"source");this.binders[r]=h?new Eo(s,l,u,e,i,t.id):new So(s,a,l,i),n.push("/a_"+r)}else{const t=Po(r,l,"composite");this.binders[r]=new To(s,a,l,u,e,t),n.push("/z_"+r)}}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof So||e instanceof To?e.maxValue:0}populatePaintArrays(t,e,i,n,r){for(const o in this.binders){const a=this.binders[o];(a instanceof So||a instanceof To||a instanceof Eo)&&a.populatePaintArray(t,e,i,n,r)}}setConstantPatternPositions(t,e){for(const i in this.binders){const n=this.binders[i];n instanceof wo&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,n,r){let o=!1;for(const a in t){const s=e.getPositions(a);for(const e of s){const s=i.feature(e.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof So||l instanceof To||l instanceof Eo)&&!0===l.expression.isStateDependent){const u=n.paint.get(i);l.expression=u.value,l.updatePaintArray(e.start,e.end,s,t[a],r),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof bo||i instanceof wo)&&t.push(...i.uniformNames.map(t=>"#define HAS_UNIFORM_"+t))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof So||i instanceof To)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name);else if(i instanceof Eo)for(let e=0;e<ro.members.length;e++)t.push(ro.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof bo||i instanceof wo||i instanceof To)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const i=[];for(const n in this.binders){const r=this.binders[n];if(r instanceof bo||r instanceof wo||r instanceof To)for(const o of r.uniformNames)if(e[o]){const a=r.getBinding(t,e[o],o);i.push({name:o,property:n,binding:a})}}return i}setUniforms(t,e,i,n){for(const{name:t,property:r,binding:o}of e)this.binders[r].setUniform(o,n,i.get(r),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof Eo){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof So||i instanceof To)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof So||i instanceof To||i instanceof Eo)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof So||e instanceof To||e instanceof Eo)&&e.destroy()}}}class Io{constructor(t,e,i=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Ao(n,e,i);this.needsUpload=!1,this._featureMap=new ho,this._bufferOffset=0}populatePaintArrays(t,e,i,n,r,o){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,n,r,o);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,n){for(const r of i)this.needsUpload=this.programConfigurations[r.id].updatePaintArrays(t,this._featureMap,e,r,n)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Co(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(e+"-","").replace(/-/g,"_")]}function Po(t,e,i){const n={color:{source:dr,composite:Mr},number:{source:Er,composite:dr}},r=function(t){return{"line-pattern":{source:Zr,composite:Zr},"fill-pattern":{source:Zr,composite:Zr},"fill-extrusion-pattern":{source:Zr,composite:Zr}}[t]}(t);return r&&r[i]||n[e][i]}mn("ConstantBinder",bo),mn("CrossFadedConstantBinder",wo),mn("SourceExpressionBinder",So),mn("CrossFadedCompositeBinder",Eo),mn("CompositeExpressionBinder",To),mn("ProgramConfiguration",Ao,{omit:["_buffers"]}),mn("ProgramConfigurationSet",Io);var Mo=8192;const ko=Math.pow(2,14)-1,zo=-ko-1;function Lo(t){const e=Mo/t.extent,i=t.loadGeometry();for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++){const i=n[t],r=Math.round(i.x*e),a=Math.round(i.y*e);i.x=o(r,zo,ko),i.y=o(a,zo,ko),(r<i.x||r>i.x+1||a<i.y||a>i.y+1)&&f("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Bo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Lo(t):[]}}function Do(t,e,i,n,r){t.emplaceBack(2*e+(n+1)/2,2*i+(r+1)/2)}class Ro{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Nr,this.indexArray=new Yr,this.segments=new io,this.programConfigurations=new Io(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){const n=this.layers[0],r=[];let o=null,a=!1;"circle"===n.type&&(o=n.layout.get("circle-sort-key"),a=!o.isConstant());for(const{feature:e,id:n,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Bo(e,t);if(!this.layers[0]._featureFilter.filter(new Nn(this.zoom),u,i))continue;const c=a?o.evaluate(u,{},i):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?u.geometry:Lo(e),patterns:{},sortKey:c};r.push(h)}a&&r.sort((t,e)=>t.sortKey-e.sortKey);for(const n of r){const{geometry:r,index:o,sourceLayerIndex:a}=n,s=t[o].feature;this.addFeature(n,r,o,i),e.featureIndex.insert(s,r,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,eo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,n){for(const i of e)for(const e of i){const i=e.x,n=e.y;if(i<0||i>=Mo||n<0||n>=Mo)continue;const r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=r.vertexLength;Do(this.layoutVertexArray,i,n,-1,-1),Do(this.layoutVertexArray,i,n,1,-1),Do(this.layoutVertexArray,i,n,1,1),Do(this.layoutVertexArray,i,n,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+3,o+2),r.vertexLength+=4,r.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},n)}}function Oo(t,e){for(let i=0;i<t.length;i++)if(Zo(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(Zo(t,e[i]))return!0;return!!No(t,e)}function Fo(t,e,i){return!!Zo(t,e)||!!Go(e,t,i)}function Uo(t,e){if(1===t.length)return Wo(e,t[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let e=0;e<n.length;e++)if(Zo(t,n[e]))return!0}for(let i=0;i<t.length;i++)if(Wo(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(No(t,e[i]))return!0;return!1}function jo(t,e,i){if(t.length>1){if(No(t,e))return!0;for(let n=0;n<e.length;n++)if(Go(e[n],t,i))return!0}for(let n=0;n<t.length;n++)if(Go(t[n],e,i))return!0;return!1}function No(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1];for(let t=0;t<e.length-1;t++)if(Vo(n,r,e[t],e[t+1]))return!0}return!1}function Vo(t,e,i,n){return m(t,i,n)!==m(e,i,n)&&m(t,e,i)!==m(t,e,n)}function Go(t,e,i){const n=i*i;if(1===e.length)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++)if(qo(t,e[i-1],e[i])<n)return!0;return!1}function qo(t,e,i){const n=e.distSqr(i);if(0===n)return t.distSqr(e);const r=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/n;return t.distSqr(r<0?e:r>1?i:i.sub(e)._mult(r)._add(e))}function Wo(t,e){let i,n,r,o=!1;for(let a=0;a<t.length;a++){i=t[a];for(let t=0,a=i.length-1;t<i.length;a=t++)n=i[t],r=i[a],n.y>e.y!=r.y>e.y&&e.x<(r.x-n.x)*(e.y-n.y)/(r.y-n.y)+n.x&&(o=!o)}return o}function Zo(t,e){let i=!1;for(let n=0,r=t.length-1;n<t.length;r=n++){const o=t[n],a=t[r];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)}return i}function Ho(t,e,i){const n=i[0],r=i[2];if(t.x<n.x&&e.x<n.x||t.x>r.x&&e.x>r.x||t.y<n.y&&e.y<n.y||t.y>r.y&&e.y>r.y)return!1;const o=m(t,e,i[0]);return o!==m(t,e,i[1])||o!==m(t,e,i[2])||o!==m(t,e,i[3])}function $o(t,e,i){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function Xo(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ko(t,e,i,n,r){if(!e[0]&&!e[1])return t;const o=E.convert(e)._mult(r);"viewport"===i&&o._rotate(-n);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(o));return a}mn("CircleBucket",Ro,{omit:["layers"]});const Jo=new er({"circle-sort-key":new Jn(it.layout_circle["circle-sort-key"])});var Yo={paint:new er({"circle-radius":new Jn(it.paint_circle["circle-radius"]),"circle-color":new Jn(it.paint_circle["circle-color"]),"circle-blur":new Jn(it.paint_circle["circle-blur"]),"circle-opacity":new Jn(it.paint_circle["circle-opacity"]),"circle-translate":new Kn(it.paint_circle["circle-translate"]),"circle-translate-anchor":new Kn(it.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Kn(it.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Kn(it.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Jn(it.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Jn(it.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Jn(it.paint_circle["circle-stroke-opacity"])}),layout:Jo},Qo="undefined"!=typeof Float32Array?Float32Array:Array;function ta(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ea(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],m=e[12],g=e[13],_=e[14],y=e[15],x=i[0],v=i[1],b=i[2],w=i[3];return t[0]=x*n+v*s+b*h+w*m,t[1]=x*r+v*l+b*p+w*g,t[2]=x*o+v*u+b*d+w*_,t[3]=x*a+v*c+b*f+w*y,t[4]=(x=i[4])*n+(v=i[5])*s+(b=i[6])*h+(w=i[7])*m,t[5]=x*r+v*l+b*p+w*g,t[6]=x*o+v*u+b*d+w*_,t[7]=x*a+v*c+b*f+w*y,t[8]=(x=i[8])*n+(v=i[9])*s+(b=i[10])*h+(w=i[11])*m,t[9]=x*r+v*l+b*p+w*g,t[10]=x*o+v*u+b*d+w*_,t[11]=x*a+v*c+b*f+w*y,t[12]=(x=i[12])*n+(v=i[13])*s+(b=i[14])*h+(w=i[15])*m,t[13]=x*r+v*l+b*p+w*g,t[14]=x*o+v*u+b*d+w*_,t[15]=x*a+v*c+b*f+w*y,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var ia,na=ea;function ra(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3];return t[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*a,t[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*a,t[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*a,t[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*a,t}function oa(t,e){const i=ra([],[t.x,t.y,0,1],e);return new E(i[0]/i[3],i[1]/i[3])}ia=new Qo(4),Qo!=Float32Array&&(ia[0]=0,ia[1]=0,ia[2]=0,ia[3]=0);class aa extends Ro{}mn("HeatmapBucket",aa,{omit:["layers"]});var sa={paint:new er({"heatmap-radius":new Jn(it.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Jn(it.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Kn(it.paint_heatmap["heatmap-intensity"]),"heatmap-color":new tr(it.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Kn(it.paint_heatmap["heatmap-opacity"])})};function la(t,{width:e,height:i},n,r){if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==e*i*n)throw new RangeError(`mismatched image size. expected: ${r.length} but got: ${e*i*n}`)}else r=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=r,t}function ua(t,{width:e,height:i},n){if(e===t.width&&i===t.height)return;const r=la({},{width:e,height:i},n);ca(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},n),t.width=e,t.height=i,t.data=r.data}function ca(t,e,i,n,r,o){if(0===r.width||0===r.height)return e;if(r.width>t.width||r.height>t.height||i.x>t.width-r.width||i.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>e.width||r.height>e.height||n.x>e.width-r.width||n.y>e.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,s=e.data;for(let l=0;l<r.height;l++){const u=((i.y+l)*t.width+i.x)*o,c=((n.y+l)*e.width+n.x)*o;for(let t=0;t<r.width*o;t++)s[c+t]=a[u+t]}return e}class ha{constructor(t,e){la(this,t,1,e)}resize(t){ua(this,t,1)}clone(){return new ha({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,n,r){ca(t,e,i,n,r,1)}}class pa{constructor(t,e){la(this,t,4,e)}resize(t){ua(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new pa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,n,r){ca(t,e,i,n,r,4)}}function da(t){const e={},i=t.resolution||256,n=t.clips?t.clips.length:1,r=t.image||new pa({width:i,height:n}),o=(i,n,o)=>{e[t.evaluationKey]=o;const a=t.expression.evaluate(e);r.data[i+n+0]=Math.floor(255*a.r/a.a),r.data[i+n+1]=Math.floor(255*a.g/a.a),r.data[i+n+2]=Math.floor(255*a.b/a.a),r.data[i+n+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,r=0;e<n;++e,r+=4*i)for(let n=0,a=0;n<i;n++,a+=4){const s=n/(i-1),{start:l,end:u}=t.clips[e];o(r,a,l*(1-s)+u*s)}else for(let t=0,e=0;t<i;t++,e+=4)o(0,e,t/(i-1));return r}mn("AlphaImage",ha),mn("RGBAImage",pa);var fa={paint:new er({"hillshade-illumination-direction":new Kn(it.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Kn(it.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Kn(it.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Kn(it.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Kn(it.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Kn(it.paint_hillshade["hillshade-accent-color"])})};const ma=sr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ga}=ma;var _a={exports:{}};function ya(t,e,i){i=i||2;var n,r,o,a,s,l,u,c=e&&e.length,h=c?e[0]*i:t.length,p=xa(t,0,h,i,!0),d=[];if(!p||p.next===p.prev)return d;if(c&&(p=function(t,e,i,n){var r,o,a,s=[];for(r=0,o=e.length;r<o;r++)(a=xa(t,e[r]*n,r<o-1?e[r+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),s.push(Ma(a));for(s.sort(Aa),r=0;r<s.length;r++)i=va(i=Ia(s[r],i),i.next);return i}(t,e,p,i)),t.length>80*i){n=o=t[0],r=a=t[1];for(var f=i;f<h;f+=i)(s=t[f])<n&&(n=s),(l=t[f+1])<r&&(r=l),s>o&&(o=s),l>a&&(a=l);u=0!==(u=Math.max(o-n,a-r))?1/u:0}return ba(p,d,i,n,r,u),d}function xa(t,e,i,n,r){var o,a;if(r===Ga(t,e,i,n)>0)for(o=e;o<i;o+=n)a=ja(o,t[o],t[o+1],a);else for(o=i-n;o>=e;o-=n)a=ja(o,t[o],t[o+1],a);return a&&Ba(a,a.next)&&(Na(a),a=a.next),a}function va(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!Ba(n,n.next)&&0!==La(n.prev,n,n.next))n=n.next;else{if(Na(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function ba(t,e,i,n,r,o,a){if(t){!a&&o&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=Pa(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,o,a,s,l,u=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,n=i,s=0,e=0;e<u&&(s++,n=n.nextZ);e++);for(l=u;s>0||l>0&&n;)0!==s&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=n}o.nextZ=null,u*=2}while(a>1)}(r)}(t,n,r,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?Sa(t,n,r,o):wa(t))e.push(s.i/i),e.push(t.i/i),e.push(l.i/i),Na(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?ba(t=Ta(va(t),e,i),e,i,n,r,o,2):2===a&&Ea(t,e,i,n,r,o):ba(va(t),e,i,n,r,o,1);break}}}function wa(t){var e=t.prev,i=t,n=t.next;if(La(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(ka(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&La(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Sa(t,e,i,n){var r=t.prev,o=t,a=t.next;if(La(r,o,a)>=0)return!1;for(var s=r.x>o.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,l=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,u=Pa(r.x<o.x?r.x<a.x?r.x:a.x:o.x<a.x?o.x:a.x,r.y<o.y?r.y<a.y?r.y:a.y:o.y<a.y?o.y:a.y,e,i,n),c=Pa(s,l,e,i,n),h=t.prevZ,p=t.nextZ;h&&h.z>=u&&p&&p.z<=c;){if(h!==t.prev&&h!==t.next&&ka(r.x,r.y,o.x,o.y,a.x,a.y,h.x,h.y)&&La(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,p!==t.prev&&p!==t.next&&ka(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&La(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;h&&h.z>=u;){if(h!==t.prev&&h!==t.next&&ka(r.x,r.y,o.x,o.y,a.x,a.y,h.x,h.y)&&La(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;p&&p.z<=c;){if(p!==t.prev&&p!==t.next&&ka(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&La(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Ta(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!Ba(r,o)&&Da(r,n,n.next,o)&&Fa(r,o)&&Fa(o,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(o.i/i),Na(n),Na(n.next),n=t=o),n=n.next}while(n!==t);return va(n)}function Ea(t,e,i,n,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&za(a,s)){var l=Ua(a,s);return a=va(a,a.next),l=va(l,l.next),ba(a,e,i,n,r,o),void ba(l,e,i,n,r,o)}s=s.next}a=a.next}while(a!==t)}function Aa(t,e){return t.x-e.x}function Ia(t,e){var i=function(t,e){var i,n=e,r=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(o===n.y)return n;if(o===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!i)return null;if(r===a)return i;var l,u=i,c=i.x,h=i.y,p=1/0;n=i;do{r>=n.x&&n.x>=c&&r!==n.x&&ka(o<h?r:a,o,c,h,o<h?a:r,o,n.x,n.y)&&(l=Math.abs(o-n.y)/(r-n.x),Fa(n,t)&&(l<p||l===p&&(n.x>i.x||n.x===i.x&&Ca(i,n)))&&(i=n,p=l)),n=n.next}while(n!==u);return i}(t,e);if(!i)return e;var n=Ua(i,t),r=va(i,i.next);return va(n,n.next),e===i?r:e}function Ca(t,e){return La(t.prev,t,e.prev)<0&&La(e.next,t,t.next)<0}function Pa(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ma(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function ka(t,e,i,n,r,o,a,s){return(r-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(i-a)*(e-s)>=0&&(i-a)*(o-s)-(r-a)*(n-s)>=0}function za(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Da(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Fa(t,e)&&Fa(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(La(t.prev,t,e.prev)||La(t,e.prev,e))||Ba(t,e)&&La(t.prev,t,t.next)>0&&La(e.prev,e,e.next)>0)}function La(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Ba(t,e){return t.x===e.x&&t.y===e.y}function Da(t,e,i,n){var r=Oa(La(t,e,i)),o=Oa(La(t,e,n)),a=Oa(La(i,n,t)),s=Oa(La(i,n,e));return r!==o&&a!==s||!(0!==r||!Ra(t,i,e))||!(0!==o||!Ra(t,n,e))||!(0!==a||!Ra(i,t,n))||!(0!==s||!Ra(i,e,n))}function Ra(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Oa(t){return t>0?1:t<0?-1:0}function Fa(t,e){return La(t.prev,t,t.next)<0?La(t,e,t.next)>=0&&La(t,t.prev,e)>=0:La(t,e,t.prev)<0||La(t,t.next,e)<0}function Ua(t,e){var i=new Va(t.i,t.x,t.y),n=new Va(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function ja(t,e,i,n){var r=new Va(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Na(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Va(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ga(t,e,i,n){for(var r=0,o=e,a=i-n;o<i;o+=n)r+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return r}_a.exports=ya,_a.exports.default=ya,ya.deviation=function(t,e,i,n){var r=e&&e.length,o=Math.abs(Ga(t,0,r?e[0]*i:t.length,i));if(r)for(var a=0,s=e.length;a<s;a++)o-=Math.abs(Ga(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i));var l=0;for(a=0;a<n.length;a+=3){var u=n[a]*i,c=n[a+1]*i,h=n[a+2]*i;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},ya.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var a=0;a<e;a++)i.vertices.push(t[r][o][a]);r>0&&i.holes.push(n+=t[r-1].length)}return i};var qa=_a.exports;function Wa(t,e,i,n,r){!function t(e,i,n,r,o){for(;r>n;){if(r-n>600){var a=r-n+1,s=i-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);t(e,i,Math.max(n,Math.floor(i-s*u/a+c)),Math.min(r,Math.floor(i+(a-s)*u/a+c)),o)}var h=e[i],p=n,d=r;for(Za(e,n,i),o(e[r],h)>0&&Za(e,n,r);p<d;){for(Za(e,p,d),p++,d--;o(e[p],h)<0;)p++;for(;o(e[d],h)>0;)d--}0===o(e[n],h)?Za(e,n,d):Za(e,++d,r),d<=i&&(n=d+1),i<=d&&(r=d-1)}}(t,e,i||0,n||t.length-1,r||Ha)}function Za(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Ha(t,e){return t<e?-1:t>e?1:0}function $a(t,e){const i=t.length;if(i<=1)return[t];const n=[];let r,o;for(let e=0;e<i;e++){const i=g(t[e]);0!==i&&(t[e].area=Math.abs(i),void 0===o&&(o=i<0),o===i<0?(r&&n.push(r),r=[t[e]]):r.push(t[e]))}if(r&&n.push(r),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(Wa(n[t],e,1,n[t].length-1,Xa),n[t]=n[t].slice(0,e));return n}function Xa(t,e){return e.area-t.area}function Ka(t,e,i){const n=i.patternDependencies;let r=!1;for(const i of e){const e=i.paint.get(t+"-pattern");e.isConstant()||(r=!0);const o=e.constantOr(null);o&&(r=!0,n[o.to]=!0,n[o.from]=!0)}return r}function Ja(t,e,i,n,r){const o=r.patternDependencies;for(const a of e){const e=a.paint.get(t+"-pattern").value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},i,{},r.availableImages),s=e.evaluate({zoom:n},i,{},r.availableImages),l=e.evaluate({zoom:n+1},i,{},r.availableImages);t=t&&t.name?t.name:t,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,o[t]=!0,o[s]=!0,o[l]=!0,i.patterns[a.id]={min:t,mid:s,max:l}}}return i}class Ya{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Vr,this.indexArray=new Yr,this.indexArray2=new Qr,this.programConfigurations=new Io(t.layers,t.zoom),this.segments=new io,this.segments2=new io,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){this.hasPattern=Ka("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),r=!n.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Bo(a,t);if(!this.layers[0]._featureFilter.filter(new Nn(this.zoom),c,i))continue;const h=r?n.evaluate(c,{},i,e.availableImages):void 0,p={id:s,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Lo(a),patterns:{},sortKey:h};o.push(p)}r&&o.sort((t,e)=>t.sortKey-e.sortKey);for(const n of o){const{geometry:r,index:o,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Ja("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,r,o,i,{});e.featureIndex.insert(t[o].feature,r,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ga),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,e,i,n,r){for(const t of $a(e,500)){let e=0;for(const i of t)e+=i.length;const i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=i.vertexLength,r=[],o=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&o.push(r.length/2);const i=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=i.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),r.push(e[0].x),r.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),r.push(e[t].x),r.push(e[t].y);i.vertexLength+=e.length,i.primitiveLength+=e.length}const a=qa(r,o);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(n+a[t],n+a[t+1],n+a[t+2]);i.vertexLength+=e,i.primitiveLength+=a.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}}mn("FillBucket",Ya,{omit:["layers","patternFeatures"]});const Qa=new er({"fill-sort-key":new Jn(it.layout_fill["fill-sort-key"])});var ts={paint:new er({"fill-antialias":new Kn(it.paint_fill["fill-antialias"]),"fill-opacity":new Jn(it.paint_fill["fill-opacity"]),"fill-color":new Jn(it.paint_fill["fill-color"]),"fill-outline-color":new Jn(it.paint_fill["fill-outline-color"]),"fill-translate":new Kn(it.paint_fill["fill-translate"]),"fill-translate-anchor":new Kn(it.paint_fill["fill-translate-anchor"]),"fill-pattern":new Yn(it.paint_fill["fill-pattern"])}),layout:Qa};const es=sr([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:is}=es;var ns={},rs=E,os=as;function as(t,e,i,n,r){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=r,t.readFields(ss,this,e)}function ss(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var n=e._keys[t.readVarint()],r=e._values[t.readVarint()];e.properties[n]=r}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function ls(t){for(var e,i,n=0,r=0,o=t.length,a=o-1;r<o;a=r++)n+=((i=t[a]).x-(e=t[r]).x)*(e.y+i.y);return n}as.types=["Unknown","Point","LineString","Polygon"],as.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,n=1,r=0,o=0,a=0,s=[];t.pos<i;){if(r<=0){var l=t.readVarint();n=7&l,r=l>>3}if(r--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new rs(o,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},as.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,r=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();i=7&c,n=c>>3}if(n--,1===i||2===i)(r+=t.readSVarint())<a&&(a=r),r>s&&(s=r),(o+=t.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,u]},as.prototype.toGeoJSON=function(t,e,i){var n,r,o=this.extent*Math.pow(2,i),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=as.types[this.type];function c(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+a)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+s)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,n,r=[],o=0;o<e;o++){var a=ls(t[o]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(i&&r.push(i),i=[t[o]]):i.push(t[o]))}return i&&r.push(i),r}(l),n=0;n<l.length;n++)for(r=0;r<l[n].length;r++)c(l[n][r])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var us=os,cs=hs;function hs(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ps,this,e),this.length=this._features.length}function ps(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(i))}hs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new us(this._pbf,e,this.extent,this._keys,this._values)};var ds=cs;function fs(t,e,i){if(3===t){var n=new ds(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}ns.VectorTile=function(t,e){this.layers=t.readFields(fs,{},e)},ns.VectorTileFeature=os,ns.VectorTileLayer=cs;const ms=ns.VectorTileFeature.types,gs=Math.pow(2,13);function _s(t,e,i,n,r,o,a,s){t.emplaceBack(e,i,2*Math.floor(n*gs)+a,r*gs*2,o*gs*2,Math.round(s))}class ys{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Gr,this.indexArray=new Yr,this.programConfigurations=new Io(t.layers,t.zoom),this.segments=new io,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){this.features=[],this.hasPattern=Ka("fill-extrusion",this.layers,e);for(const{feature:n,id:r,index:o,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,s=Bo(n,t);if(!this.layers[0]._featureFilter.filter(new Nn(this.zoom),s,i))continue;const l={id:r,sourceLayerIndex:a,index:o,geometry:t?s.geometry:Lo(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(Ja("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,o,i,{}),e.featureIndex.insert(n,l.geometry,o,a,this.index,!0)}}addFeatures(t,e,i){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,i)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,is),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,n,r){for(const i of $a(e,500)){let e=0;for(const t of i)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(vs(t))continue;let e=0;for(let i=0;i<t.length;i++){const r=t[i];if(i>=1){const o=t[i-1];if(!xs(r,o)){n.vertexLength+4>io.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=r.sub(o)._perp()._unit(),i=o.dist(r);e+i>32768&&(e=0),_s(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,0,e),_s(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,1,e),e+=i,_s(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,0,e),_s(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,1,e);const a=n.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>io.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==ms[t.type])continue;const r=[],o=[],a=n.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&o.push(r.length/2);for(let e=0;e<t.length;e++){const i=t[e];_s(this.layoutVertexArray,i.x,i.y,0,0,1,1,0),r.push(i.x),r.push(i.y)}}const s=qa(r,o);for(let t=0;t<s.length;t+=3)this.indexArray.emplaceBack(a+s[t],a+s[t+2],a+s[t+1]);n.primitiveLength+=s.length/3,n.vertexLength+=e}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}}function xs(t,e){return t.x===e.x&&(t.x<0||t.x>Mo)||t.y===e.y&&(t.y<0||t.y>Mo)}function vs(t){return t.every(t=>t.x<0)||t.every(t=>t.x>Mo)||t.every(t=>t.y<0)||t.every(t=>t.y>Mo)}mn("FillExtrusionBucket",ys,{omit:["layers","features"]});var bs={paint:new er({"fill-extrusion-opacity":new Kn(it["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Jn(it["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Kn(it["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Kn(it["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Yn(it["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Jn(it["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Jn(it["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Kn(it["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function ws(t,e){return t.x*e.x+t.y*e.y}function Ss(t,e){if(1===t.length){let i=0;const n=e[i++];let r;for(;!r||n.equals(r);)if(r=e[i++],!r)return 1/0;for(;i<e.length;i++){const o=e[i],a=t[0],s=r.sub(n),l=o.sub(n),u=a.sub(n),c=ws(s,s),h=ws(s,l),p=ws(l,l),d=ws(u,s),f=ws(u,l),m=c*p-h*h,g=(p*d-h*f)/m,_=(c*f-h*d)/m,y=n.z*(1-g-_)+r.z*g+o.z*_;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}const Ts=sr([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Es}=Ts,As=sr([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Is}=As,Cs=ns.VectorTileFeature.types,Ps=Math.cos(Math.PI/180*37.5),Ms=Math.pow(2,14)/.5;class ks{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new qr,this.layoutVertexArray2=new Wr,this.indexArray=new Yr,this.programConfigurations=new Io(t.layers,t.zoom),this.segments=new io,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){this.hasPattern=Ka("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),r=!n.isConstant(),o=[];for(const{feature:e,id:a,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Bo(e,t);if(!this.layers[0]._featureFilter.filter(new Nn(this.zoom),u,i))continue;const c=r?n.evaluate(u,{},i):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?u.geometry:Lo(e),patterns:{},sortKey:c};o.push(h)}r&&o.sort((t,e)=>t.sortKey-e.sortKey);for(const n of o){const{geometry:r,index:o,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Ja("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,r,o,i,{});e.featureIndex.insert(t[o].feature,r,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Is)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Es),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,i,n,r){const o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),s=o.get("line-cap"),l=o.get("line-miter-limit"),u=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,a,s,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}addLine(t,e,i,n,r,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const a="Polygon"===Cs[e.type];let s=t.length;for(;s>=2&&t[s-1].equals(t[s-2]);)s--;let l=0;for(;l<s-1&&t[l].equals(t[l+1]);)l++;if(s<(a?3:2))return;"bevel"===i&&(r=1.05);const u=this.overscaling<=16?122880/(512*this.overscaling):0,c=this.segments.prepareSegment(10*s,this.layoutVertexArray,this.indexArray);let h,p,d,f,m;this.e1=this.e2=-1,a&&(h=t[s-2],m=t[l].sub(h)._unit()._perp());for(let e=l;e<s;e++){if(d=e===s-1?a?t[l+1]:void 0:t[e+1],d&&t[e].equals(d))continue;m&&(f=m),h&&(p=h),h=t[e],m=d?d.sub(h)._unit()._perp():f,f=f||m;let g=f.add(m);0===g.x&&0===g.y||g._unit();const _=f.x*m.x+f.y*m.y,y=g.x*m.x+g.y*m.y,x=0!==y?1/y:1/0,v=2*Math.sqrt(2-2*y),b=y<Ps&&p&&d,w=f.x*m.y-f.y*m.x>0;if(b&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,f,0,0,c),p=e}}const S=p&&d;let T=S?i:a?"butt":n;if(S&&"round"===T&&(x<o?T="miter":x<=2&&(T="fakeround")),"miter"===T&&x>r&&(T="bevel"),"bevel"===T&&(x>2&&(T="flipbevel"),x<r&&(T="miter")),p&&this.updateDistance(p,h),"miter"===T)g._mult(x),this.addCurrentVertex(h,g,0,0,c);else if("flipbevel"===T){if(x>100)g=m.mult(-1);else{const t=x*f.add(m).mag()/f.sub(m).mag();g._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(h,g,0,0,c),this.addCurrentVertex(h,g.mult(-1),0,0,c)}else if("bevel"===T||"fakeround"===T){const t=-Math.sqrt(x*x-1),e=w?t:0,i=w?0:t;if(p&&this.addCurrentVertex(h,f,e,i,c),"fakeround"===T){const t=Math.round(180*v/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+_*(_*(3.55645-1.43519*_)-3.2452))*t*t+(.848013+_*(.215638*_-1.06021)))}const n=m.sub(f)._mult(i)._add(f)._unit()._mult(w?-1:1);this.addHalfVertex(h,n.x,n.y,!1,w,0,c)}}d&&this.addCurrentVertex(h,m,-e,-i,c)}else if("butt"===T)this.addCurrentVertex(h,g,0,0,c);else if("square"===T){const t=p?1:-1;this.addCurrentVertex(h,g,t,t,c)}else"round"===T&&(p&&(this.addCurrentVertex(h,f,0,0,c),this.addCurrentVertex(h,f,1,1,c,!0)),d&&(this.addCurrentVertex(h,m,-1,-1,c,!0),this.addCurrentVertex(h,m,0,0,c)));if(b&&e<s-1){const t=h.dist(d);if(t>2*u){const e=h.add(d.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,m,0,0,c),h=e}}}}addCurrentVertex(t,e,i,n,r,o=!1){const a=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,r),this.addHalfVertex(t,a,s,o,!0,-n,r),this.distance>Ms/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,i,n,r,o))}addHalfVertex({x:t,y:e},i,n,r,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(Ms-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(r?1:0),(e<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*n)+128,1+(0===a?0:a<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 u=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),s.primitiveLength++),o?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}mn("LineBucket",ks,{omit:["layers","patternFeatures"]});const zs=new er({"line-cap":new Kn(it.layout_line["line-cap"]),"line-join":new Jn(it.layout_line["line-join"]),"line-miter-limit":new Kn(it.layout_line["line-miter-limit"]),"line-round-limit":new Kn(it.layout_line["line-round-limit"]),"line-sort-key":new Jn(it.layout_line["line-sort-key"])});var Ls={paint:new er({"line-opacity":new Jn(it.paint_line["line-opacity"]),"line-color":new Jn(it.paint_line["line-color"]),"line-translate":new Kn(it.paint_line["line-translate"]),"line-translate-anchor":new Kn(it.paint_line["line-translate-anchor"]),"line-width":new Jn(it.paint_line["line-width"]),"line-gap-width":new Jn(it.paint_line["line-gap-width"]),"line-offset":new Jn(it.paint_line["line-offset"]),"line-blur":new Jn(it.paint_line["line-blur"]),"line-dasharray":new Qn(it.paint_line["line-dasharray"]),"line-pattern":new Yn(it.paint_line["line-pattern"]),"line-gradient":new tr(it.paint_line["line-gradient"])}),layout:zs};const Bs=new class extends Jn{possiblyEvaluate(t,e){return e=new Nn(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,n){return e=s({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,n)}}(Ls.paint.properties["line-width"].specification);function Ds(t,e){return e>0?e+2*t:t}Bs.useIntegerZoom=!0;const Rs=sr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Os=sr([{name:"a_projected_pos",components:3,type:"Float32"}],4);sr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Fs=sr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);sr([{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 Us=sr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),js=sr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ns(t,e,i){return t.sections.forEach(t=>{t.text=function(t,e,i){const n=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),jn.applyArabicShaping&&(t=jn.applyArabicShaping(t)),t}(t.text,e,i)}),t}sr([{name:"triangle",components:3,type:"Uint16"}]),sr([{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"}]),sr([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),sr([{type:"Float32",name:"offsetX"}]),sr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Vs={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Gs=Zs,qs=function(t,e,i,n,r){var o,a,s=8*r-n-1,l=(1<<s)-1,u=l>>1,c=-7,h=i?r-1:0,p=i?-1:1,d=t[e+h];for(h+=p,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=u}return(d?-1:1)*a*Math.pow(2,o-n)},Ws=function(t,e,i,n,r,o){var a,s,l,u=8*o-r-1,c=(1<<u)-1,h=c>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,f=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,r),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,r),a=0));r>=8;t[i+d]=255&s,d+=f,s/=256,r-=8);for(a=a<<r|s,u+=r;u>0;t[i+d]=255&a,d+=f,a/=256,u-=8);t[i+d-f]|=128*m};function Zs(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Zs.Varint=0,Zs.Fixed64=1,Zs.Bytes=2,Zs.Fixed32=5;var Hs,$s=4294967296,Xs=1/$s,Ks="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Js(t){return t.type===Zs.Bytes?t.readVarint()+t.pos:t.pos+1}function Ys(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Qs(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function tl(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function el(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function il(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function nl(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function rl(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function ol(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function al(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function sl(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function ll(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function ul(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function cl(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function hl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function pl(t,e,i){1===t&&i.readMessage(dl,e)}function dl(t,e,i){if(3===t){const{id:t,bitmap:n,width:r,height:o,left:a,top:s,advance:l}=i.readMessage(fl,{});e.push({id:t,bitmap:new ha({width:r+6,height:o+6},n),metrics:{width:r,height:o,left:a,top:s,advance:l}})}}function fl(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}function ml(t){let e=0,i=0;for(const n of t)e+=n.w*n.h,i=Math.max(i,n.w);t.sort((t,e)=>e.h-t.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let r=0,o=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const i=n[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,o=Math.max(o,e.y+e.h),r=Math.max(r,e.x+e.w),e.w===i.w&&e.h===i.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(n.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:r,h:o,fill:e/(r*o)||0}}Zs.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),r=n>>3,o=this.pos;this.type=7&n,t(r,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=ul(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=hl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=ul(this.buf,this.pos)+ul(this.buf,this.pos+4)*$s;return this.pos+=8,t},readSFixed64:function(){var t=ul(this.buf,this.pos)+hl(this.buf,this.pos+4)*$s;return this.pos+=8,t},readFloat:function(){var t=qs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=qs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,o=i.buf;if(n=(112&(r=o[i.pos++]))>>4,r<128)return Ys(t,n,e);if(n|=(127&(r=o[i.pos++]))<<3,r<128)return Ys(t,n,e);if(n|=(127&(r=o[i.pos++]))<<10,r<128)return Ys(t,n,e);if(n|=(127&(r=o[i.pos++]))<<17,r<128)return Ys(t,n,e);if(n|=(127&(r=o[i.pos++]))<<24,r<128)return Ys(t,n,e);if(n|=(1&(r=o[i.pos++]))<<31,r<128)return Ys(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ks?function(t,e,i){return Ks.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var n="",r=e;r<i;){var o,a,s,l=t[r],u=null,c=l>239?4:l>223?3:l>191?2:1;if(r+c>i)break;1===c?l<128&&(u=l):2===c?128==(192&(o=t[r+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(a=t[r+2],128==(192&(o=t[r+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&o)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[r+2],s=t[r+3],128==(192&(o=t[r+1]))&&128==(192&a)&&128==(192&s)&&((u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),r+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Zs.Bytes)return t.push(this.readVarint(e));var i=Js(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Zs.Bytes)return t.push(this.readSVarint());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Zs.Bytes)return t.push(this.readBoolean());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Zs.Bytes)return t.push(this.readFloat());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Zs.Bytes)return t.push(this.readDouble());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Zs.Bytes)return t.push(this.readFixed32());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Zs.Bytes)return t.push(this.readSFixed32());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Zs.Bytes)return t.push(this.readFixed64());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Zs.Bytes)return t.push(this.readSFixed64());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Zs.Varint)for(;this.buf[this.pos++]>127;);else if(e===Zs.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Zs.Fixed32)this.pos+=4;else{if(e!==Zs.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),cl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),cl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),cl(this.buf,-1&t,this.pos),cl(this.buf,Math.floor(t*Xs),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),cl(this.buf,-1&t,this.pos),cl(this.buf,Math.floor(t*Xs),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,r,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!r){n>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Qs(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),Ws(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Ws(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&Qs(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,Zs.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,il,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ol,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,al,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,sl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,ll,e)},writeBytesField:function(t,e){this.writeTag(t,Zs.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Zs.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Zs.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Zs.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class gl{constructor(t,{pixelRatio:e,version:i,stretchX:n,stretchY:r,content:o}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=r,this.content=o,this.version=i}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 _l{constructor(t,e){const i={},n={};this.haveRenderCallbacks=[];const r=[];this.addImages(t,i,r),this.addImages(e,n,r);const{w:o,h:a}=ml(r),s=new pa({width:o||1,height:a||1});for(const e in t){const n=t[e],r=i[e].paddedRect;pa.copy(n.data,s,{x:0,y:0},{x:r.x+1,y:r.y+1},n.data)}for(const t in e){const i=e[t],r=n[t].paddedRect,o=r.x+1,a=r.y+1,l=i.data.width,u=i.data.height;pa.copy(i.data,s,{x:0,y:0},{x:o,y:a},i.data),pa.copy(i.data,s,{x:0,y:u-1},{x:o,y:a-1},{width:l,height:1}),pa.copy(i.data,s,{x:0,y:0},{x:o,y:a+u},{width:l,height:1}),pa.copy(i.data,s,{x:l-1,y:0},{x:o-1,y:a},{width:1,height:u}),pa.copy(i.data,s,{x:0,y:0},{x:o+l,y:a},{width:1,height:u})}this.image=s,this.iconPositions=i,this.patternPositions=n}addImages(t,e,i){for(const n in t){const r=t[n],o={x:0,y:0,w:r.data.width+2,h:r.data.height+2};i.push(o),e[n]=new gl(o,r),r.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,r]=t.tl;i.update(e.data,void 0,{x:n,y:r})}}mn("ImagePosition",gl),mn("ImageAtlas",_l),t.WritingMode=void 0,(Hs=t.WritingMode||(t.WritingMode={}))[Hs.none=0]="none",Hs[Hs.horizontal=1]="horizontal",Hs[Hs.vertical=2]="vertical",Hs[Hs.horizontalOnly=3]="horizontalOnly";class yl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const i=new yl;return i.scale=t||1,i.fontStack=e,i}static forImage(t){const e=new yl;return e.imageName=t,e}}class xl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new xl;for(let n=0;n<t.sections.length;n++){const r=t.sections[n];r.image?i.addImageSection(r):i.addTextSection(r,e)}return i}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let i=0;i<t.length;i++){const n=t.charCodeAt(i+1)||null,r=t.charCodeAt(i-1)||null;e+=n&&En(n)&&!Vs[t[i+1]]||r&&En(r)&&!Vs[t[i-1]]||!Vs[t[i]]?t[i]:Vs[t[i]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&bl[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=0&&i>=t&&bl[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new xl;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,e)=>Math.max(t,this.sections[e].scale),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(yl.forText(t.scale,t.fontStack||e));const i=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(i)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void f("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(yl.forImage(e)),this.sectionIndex.push(this.sections.length-1)):f("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function vl(e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g){const _=xl.fromFeature(e,o);let y;p===t.WritingMode.vertical&&_.verticalizePunctuation();const{processBidirectionalText:x,processStyledBidirectionalText:v}=jn;if(x&&1===_.sections.length){y=[];const t=x(_.toString(),Il(_,c,a,i,r,f,m));for(const e of t){const t=new xl;t.text=e,t.sections=_.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);y.push(t)}}else if(v){y=[];const t=v(_.text,_.sectionIndex,Il(_,c,a,i,r,f,m));for(const e of t){const t=new xl;t.text=e[0],t.sectionIndex=e[1],t.sections=_.sections,y.push(t)}}else y=function(t,e){const i=[],n=t.text;let r=0;for(const n of e)i.push(t.substring(r,n)),r=n;return r<n.length&&i.push(t.substring(r,n.length)),i}(_,Il(_,c,a,i,r,f,m));const b=[],w={positionedLines:b,text:_.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(e,i,n,r,o,a,s,l,u,c,h,p){let d=0,f=-17,m=0,g=0;const _="right"===l?1:"left"===l?0:.5;let y=0;for(const s of o){s.trim();const o=s.getMaxScale(),l=24*(o-1),v={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=v;const b=v.positionedGlyphs;let w=0;if(!s.length()){f+=a,++y;continue}for(let a=0;a<s.length();a++){const m=s.getSection(a),g=s.getSectionIndex(a),_=s.getCharCode(a);let y=0,v=null,S=null,T=null,E=24;const A=!(u===t.WritingMode.horizontal||!h&&!Tn(_)||h&&(bl[_]||(x=_,vn.Arabic(x)||vn["Arabic Supplement"](x)||vn["Arabic Extended-A"](x)||vn["Arabic Presentation Forms-A"](x)||vn["Arabic Presentation Forms-B"](x))));if(m.imageName){const t=r[m.imageName];if(!t)continue;T=m.imageName,e.iconsInText=e.iconsInText||!0,S=t.paddedRect;const i=t.displaySize;m.scale=24*m.scale/p,v={width:i[0],height:i[1],left:1,top:-3,advance:A?i[1]:i[0]},y=l+(24-i[1]*m.scale),E=v.advance;const n=A?i[0]*m.scale-24*o:i[1]*m.scale-24*o;n>0&&n>w&&(w=n)}else{const t=n[m.fontStack],e=t&&t[_];if(e&&e.rect)S=e.rect,v=e.metrics;else{const t=i[m.fontStack],e=t&&t[_];if(!e)continue;v=e.metrics}y=24*(o-m.scale)}A?(e.verticalizable=!0,b.push({glyph:_,imageName:T,x:d,y:f+y,vertical:A,scale:m.scale,fontStack:m.fontStack,sectionIndex:g,metrics:v,rect:S}),d+=E*m.scale+c):(b.push({glyph:_,imageName:T,x:d,y:f+y,vertical:A,scale:m.scale,fontStack:m.fontStack,sectionIndex:g,metrics:v,rect:S}),d+=v.advance*m.scale+c)}0!==b.length&&(m=Math.max(d-c,m),Pl(b,0,b.length-1,_,w)),d=0;const S=a*o+w;v.lineOffset=Math.max(w,l),f+=S,g=Math.max(S,g),++y}var x;const v=f- -17,{horizontalAlign:b,verticalAlign:w}=Cl(s);(function(t,e,i,n,r,o,a,s,l){const u=(e-i)*r;let c=0;c=o!==a?-s*n- -17:(-n*l+.5)*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c})(e.positionedLines,_,b,w,m,g,a,v,o.length),e.top+=-w*v,e.bottom=e.top+v,e.left+=-b*m,e.right=e.left+m}(w,i,n,r,y,s,l,u,p,c,d,g),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const bl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},wl={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Sl(t,e,i,n,r,o){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*24/o+r:0}{const n=i[e.fontStack],o=n&&n[t];return o?o.metrics.advance*e.scale+r:0}}function Tl(t,e,i,n){const r=Math.pow(t-e,2);return n?t<e?r/2:2*r:r+Math.abs(i)*i}function El(t,e,i){let n=0;return 10===t&&(n-=1e4),i&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Al(t,e,i,n,r,o){let a=null,s=Tl(e,i,r,o);for(const t of n){const n=Tl(e-t.x,i,r,o)+t.badness;n<=s&&(a=t,s=n)}return{index:t,x:e,priorBreak:a,badness:s}}function Il(t,e,i,n,r,o,a){if("point"!==o)return[];if(!t)return[];const s=[],l=function(t,e,i,n,r,o){let a=0;for(let i=0;i<t.length();i++){const s=t.getSection(i);a+=Sl(t.getCharCode(i),s,n,r,e,o)}return a/Math.max(1,Math.ceil(a/i))}(t,e,i,n,r,a),u=t.text.indexOf("​")>=0;let c=0;for(let i=0;i<t.length();i++){const o=t.getSection(i),p=t.getCharCode(i);if(bl[p]||(c+=Sl(p,o,n,r,e,a)),i<t.length()-1){const e=!((h=p)<11904||!(vn["Bopomofo Extended"](h)||vn.Bopomofo(h)||vn["CJK Compatibility Forms"](h)||vn["CJK Compatibility Ideographs"](h)||vn["CJK Compatibility"](h)||vn["CJK Radicals Supplement"](h)||vn["CJK Strokes"](h)||vn["CJK Symbols and Punctuation"](h)||vn["CJK Unified Ideographs Extension A"](h)||vn["CJK Unified Ideographs"](h)||vn["Enclosed CJK Letters and Months"](h)||vn["Halfwidth and Fullwidth Forms"](h)||vn.Hiragana(h)||vn["Ideographic Description Characters"](h)||vn["Kangxi Radicals"](h)||vn["Katakana Phonetic Extensions"](h)||vn.Katakana(h)||vn["Vertical Forms"](h)||vn["Yi Radicals"](h)||vn["Yi Syllables"](h)));(wl[p]||e||o.imageName)&&s.push(Al(i+1,c,l,s,El(p,t.getCharCode(i+1),e&&u),!1))}}var h;return function t(e){return e?t(e.priorBreak).concat(e.index):[]}(Al(t.length(),c,l,s,0,!0))}function Cl(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Pl(t,e,i,n,r){if(!n&&!r)return;const o=t[i],a=(t[i].x+o.metrics.advance*o.scale)*n;for(let n=e;n<=i;n++)t[n].x-=a,t[n].y+=r}function Ml(t,e,i){const{horizontalAlign:n,verticalAlign:r}=Cl(i),o=e[0]-t.displaySize[0]*n,a=e[1]-t.displaySize[1]*r;return{image:t,top:a,bottom:a+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function kl(t,e,i,n,r,o){const a=t.image;let s;if(a.content){const t=a.content,e=a.pixelRatio||1;s=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*o,u=e.right*o;let c,h,p,d;"width"===i||"both"===i?(d=r[0]+l-n[3],h=r[0]+u+n[1]):(d=r[0]+(l+u-a.displaySize[0])/2,h=d+a.displaySize[0]);const f=e.top*o,m=e.bottom*o;return"height"===i||"both"===i?(c=r[1]+f-n[0],p=r[1]+m+n[2]):(c=r[1]+(f+m-a.displaySize[1])/2,p=c+a.displaySize[1]),{image:a,top:c,right:h,bottom:p,left:d,collisionPadding:s}}const zl=128;function Ll(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Nn(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=i;let r=0;for(;r<e.length&&e[r]<=t;)r++;r=Math.max(0,r-1);let o=r;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const a=e[r],s=e[o];return"composite"===i.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:s,minSize:i.evaluate(new Nn(a)),maxSize:i.evaluate(new Nn(s)),interpolationType:n}}}class Bl extends E{constructor(t,e,i,n){super(t,e),this.angle=i,void 0!==n&&(this.segment=n)}clone(){return new Bl(this.x,this.y,this.angle,this.segment)}}function Dl(t,e,i,n,r){if(void 0===e.segment)return!0;let o=e,a=e.segment+1,s=0;for(;s>-i/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;s<i/2;){const e=t[a],i=t[a+1];if(!i)return!1;let o=t[a-1].angleTo(e)-e.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:o}),u+=o;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>r)return!1;a++,s+=e.dist(i)}return!0}function Rl(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function Ol(t,e,i){return t?.6*e*i:0}function Fl(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Ul(t,e,i,n,r,o){const a=Ol(i,r,o),s=Fl(i,n)*o;let l=0;const u=Rl(t)/2;for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1],o=n.dist(r);if(l+o>u){const c=(u-l)/o,h=Se(n.x,r.x,c),p=Se(n.y,r.y,c),d=new Bl(h,p,r.angleTo(n),i);return d._round(),!a||Dl(t,d,s,a,e)?d:void 0}l+=o}}function jl(t,e,i,n,r,o,a,s,l){const u=Ol(n,o,a),c=Fl(n,r),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),function t(e,i,n,r,o,a,s,l,u){const c=a/2,h=Rl(e);let p=0,d=i-n,f=[];for(let t=0;t<e.length-1;t++){const i=e[t],s=e[t+1],l=i.dist(s),m=s.angleTo(i);for(;d+n<p+l;){d+=n;const g=(d-p)/l,_=Se(i.x,s.x,g),y=Se(i.y,s.y,g);if(_>=0&&_<u&&y>=0&&y<u&&d-c>=0&&d+c<=h){const i=new Bl(_,y,m,t);i._round(),r&&!Dl(e,i,a,r,o)||f.push(i)}}p+=l}return l||f.length||s||(f=t(e,p/2,n,r,o,a,s,!0,u)),f}(t,p?e/2*s%e:(c/2+2*o)*a*s%e,e,u,i,h,p,!1,l)}function Nl(t,e,i,n,r){const o=[];for(let a=0;a<t.length;a++){const s=t[a];let l;for(let t=0;t<s.length-1;t++){let a=s[t],u=s[t+1];a.x<e&&u.x<e||(a.x<e?a=new E(e,a.y+(e-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x<e&&(u=new E(e,a.y+(e-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y<i&&u.y<i||(a.y<i?a=new E(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round():u.y<i&&(u=new E(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round()),a.x>=n&&u.x>=n||(a.x>=n?a=new E(n,a.y+(n-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x>=n&&(u=new E(n,a.y+(n-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y>=r&&u.y>=r||(a.y>=r?a=new E(a.x+(r-a.y)/(u.y-a.y)*(u.x-a.x),r)._round():u.y>=r&&(u=new E(a.x+(r-a.y)/(u.y-a.y)*(u.x-a.x),r)._round()),l&&a.equals(l[l.length-1])||(l=[a],o.push(l)),l.push(u)))))}}return o}function Vl(t,e,i,n){const r=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2,l=o.paddedRect.h-2,u=t.right-t.left,c=t.bottom-t.top,h=o.stretchX||[[0,s]],p=o.stretchY||[[0,l]],d=(t,e)=>t+e[1]-e[0],f=h.reduce(d,0),m=p.reduce(d,0),g=s-f,_=l-m;let y=0,x=f,v=0,b=m,w=0,S=g,T=0,A=_;if(o.content&&n){const t=o.content;y=Gl(h,0,t[0]),v=Gl(p,0,t[1]),x=Gl(h,t[0],t[2]),b=Gl(p,t[1],t[3]),w=t[0]-y,T=t[1]-v,S=t[2]-t[0]-x,A=t[3]-t[1]-b}const I=(n,r,s,l)=>{const h=Wl(n.stretch-y,x,u,t.left),p=Zl(n.fixed-w,S,n.stretch,f),d=Wl(r.stretch-v,b,c,t.top),g=Zl(r.fixed-T,A,r.stretch,m),_=Wl(s.stretch-y,x,u,t.left),I=Zl(s.fixed-w,S,s.stretch,f),C=Wl(l.stretch-v,b,c,t.top),P=Zl(l.fixed-T,A,l.stretch,m),M=new E(h,d),k=new E(_,d),z=new E(_,C),L=new E(h,C),B=new E(p/a,g/a),D=new E(I/a,P/a),R=e*Math.PI/180;if(R){const t=Math.sin(R),e=Math.cos(R),i=[e,-t,t,e];M._matMult(i),k._matMult(i),L._matMult(i),z._matMult(i)}const O=n.stretch+n.fixed,F=r.stretch+r.fixed;return{tl:M,tr:k,bl:L,br:z,tex:{x:o.paddedRect.x+1+O,y:o.paddedRect.y+1+F,w:s.stretch+s.fixed-O,h:l.stretch+l.fixed-F},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:B,pixelOffsetBR:D,minFontScaleX:S/a/u,minFontScaleY:A/a/c,isSDF:i}};if(n&&(o.stretchX||o.stretchY)){const t=ql(h,g,f),e=ql(p,_,m);for(let i=0;i<t.length-1;i++){const n=t[i],o=t[i+1];for(let t=0;t<e.length-1;t++)r.push(I(n,e[t],o,e[t+1]))}}else r.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));return r}function Gl(t,e,i){let n=0;for(const r of t)n+=Math.max(e,Math.min(i,r[1]))-Math.max(e,Math.min(i,r[0]));return n}function ql(t,e,i){const n=[{fixed:-1,stretch:0}];for(const[e,i]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(i-e)})}return n.push({fixed:e+1,stretch:i}),n}function Wl(t,e,i,n){return t/e*i+n}function Zl(t,e,i,n){return t-e*i/n}mn("Anchor",Bl);class Hl{constructor(t,e,i,n,r,o,a,s,l,u){if(this.boxStartIndex=t.length,l){let t=o.top,e=o.bottom;const i=o.collisionPadding;i&&(t-=i[1],e+=i[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let l=o.top*a-s,c=o.bottom*a+s,h=o.left*a-s,p=o.right*a+s;const d=o.collisionPadding;if(d&&(h-=d[0]*a,l-=d[1]*a,p+=d[2]*a,c+=d[3]*a),u){const t=new E(h,l),e=new E(p,l),i=new E(h,c),n=new E(p,c),r=u*Math.PI/180;t._rotate(r),e._rotate(r),i._rotate(r),n._rotate(r),h=Math.min(t.x,e.x,i.x,n.x),p=Math.max(t.x,e.x,i.x,n.x),l=Math.min(t.y,e.y,i.y,n.y),c=Math.max(t.y,e.y,i.y,n.y)}t.emplaceBack(e.x,e.y,h,l,p,c,i,n,r)}this.boxEndIndex=t.length}}class $l{constructor(t=[],e=Xl){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,n=e[t];for(;t>0;){const r=t-1>>1,o=e[r];if(i(n,o)>=0)break;e[t]=o,t=r}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let n=1+(t<<1),o=e[n];const a=n+1;if(a<this.length&&i(e[a],o)<0&&(n=a,o=e[a]),i(o,r)>=0)break;e[t]=o,t=n}e[t]=r}}function Xl(t,e){return t<e?-1:t>e?1:0}function Kl(t,e=1,i=!1){let n=1/0,r=1/0,o=-1/0,a=-1/0;const s=t[0];for(let t=0;t<s.length;t++){const e=s[t];(!t||e.x<n)&&(n=e.x),(!t||e.y<r)&&(r=e.y),(!t||e.x>o)&&(o=e.x),(!t||e.y>a)&&(a=e.y)}const l=Math.min(o-n,a-r);let u=l/2;const c=new $l([],Jl);if(0===l)return new E(n,r);for(let e=n;e<o;e+=l)for(let i=r;i<a;i+=l)c.push(new Yl(e+u,i+u,u,t));let h=function(t){let e=0,i=0,n=0;const r=t[0];for(let t=0,o=r.length,a=o-1;t<o;a=t++){const o=r[t],s=r[a],l=o.x*s.y-s.x*o.y;i+=(o.x+s.x)*l,n+=(o.y+s.y)*l,e+=3*l}return new Yl(i/e,n/e,0,t)}(t),p=c.length;for(;c.length;){const n=c.pop();(n.d>h.d||!h.d)&&(h=n,i&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,p)),n.max-h.d<=e||(u=n.h/2,c.push(new Yl(n.p.x-u,n.p.y-u,u,t)),c.push(new Yl(n.p.x+u,n.p.y-u,u,t)),c.push(new Yl(n.p.x-u,n.p.y+u,u,t)),c.push(new Yl(n.p.x+u,n.p.y+u,u,t)),p+=4)}return i&&(console.log("num probes: "+p),console.log("best distance: "+h.d)),h.p}function Jl(t,e){return e.max-t.max}function Yl(t,e,i,n){this.p=new E(t,e),this.h=i,this.d=function(t,e){let i=!1,n=1/0;for(let r=0;r<e.length;r++){const o=e[r];for(let e=0,r=o.length,a=r-1;e<r;a=e++){const r=o[e],s=o[a];r.y>t.y!=s.y>t.y&&t.x<(s.x-r.x)*(t.y-r.y)/(s.y-r.y)+r.x&&(i=!i),n=Math.min(n,qo(t,r,s))}}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}const Ql=Number.POSITIVE_INFINITY;function tu(t,e){return e[1]!==Ql?function(t,e,i){let n=0,r=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":r=i-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-i}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,r]}(t,e[0],e[1]):function(t,e){let i=0,n=0;e<0&&(e=0);const r=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":i=-r;break;case"top-left":case"bottom-left":i=r;break;case"left":i=e;break;case"right":i=-e}return[i,n]}(t,e[0])}function eu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function iu(e,i,n,r,o,a,s,l,u,c,h){let p=a.textMaxSize.evaluate(i,{});void 0===p&&(p=s);const d=e.layers[0].layout,m=d.get("icon-offset").evaluate(i,{},h),g=ou(n.horizontal),_=s/24,y=e.tilePixelRatio*_,x=e.tilePixelRatio*p/24,v=e.tilePixelRatio*l,b=e.tilePixelRatio*d.get("symbol-spacing"),w=d.get("text-padding")*e.tilePixelRatio,S=d.get("icon-padding")*e.tilePixelRatio,T=d.get("text-max-angle")/180*Math.PI,E="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),A="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),I=d.get("symbol-placement"),C=b/2,P=d.get("icon-text-fit");let M;r&&"none"!==P&&(e.allowVerticalPlacement&&n.vertical&&(M=kl(r,n.vertical,P,d.get("icon-text-fit-padding"),m,_)),g&&(r=kl(r,g,P,d.get("icon-text-fit-padding"),m,_)));const k=(l,p)=>{p.x<0||p.x>=Mo||p.y<0||p.y>=Mo||function(e,i,n,r,o,a,s,l,u,c,h,p,d,m,g,_,y,x,v,b,w,S,T,E,A){const I=e.addToLineVertexArray(i,n);let C,P,M,k,z=0,L=0,B=0,D=0,R=-1,O=-1;const F={};let U=co(""),j=0,N=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[j,N]=l.layout.get("text-offset").evaluate(w,{},E).map(t=>24*t):(j=24*l.layout.get("text-radial-offset").evaluate(w,{},E),N=Ql),e.allowVerticalPlacement&&r.vertical){const t=l.layout.get("text-rotate").evaluate(w,{},E)+90;M=new Hl(u,i,c,h,p,r.vertical,d,m,g,t),s&&(k=new Hl(u,i,c,h,p,s,y,x,g,t))}if(o){const n=l.layout.get("icon-rotate").evaluate(w,{}),r="none"!==l.layout.get("icon-text-fit"),a=Vl(o,n,T,r),d=s?Vl(s,n,T,r):void 0;P=new Hl(u,i,c,h,p,o,y,x,!1,n),z=4*a.length;const m=e.iconSizeData;let g=null;"source"===m.kind?(g=[zl*l.layout.get("icon-size").evaluate(w,{})],g[0]>nu&&f(e.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".')):"composite"===m.kind&&(g=[zl*S.compositeIconSizes[0].evaluate(w,{},E),zl*S.compositeIconSizes[1].evaluate(w,{},E)],(g[0]>nu||g[1]>nu)&&f(e.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".')),e.addSymbols(e.icon,a,g,b,v,w,t.WritingMode.none,i,I.lineStartIndex,I.lineLength,-1,E),R=e.icon.placedSymbolArray.length-1,d&&(L=4*d.length,e.addSymbols(e.icon,d,g,b,v,w,t.WritingMode.vertical,i,I.lineStartIndex,I.lineLength,-1,E),O=e.icon.placedSymbolArray.length-1)}const V=Object.keys(r.horizontal);for(const n of V){const o=r.horizontal[n];if(!C){U=co(o.text);const t=l.layout.get("text-rotate").evaluate(w,{},E);C=new Hl(u,i,c,h,p,o,d,m,g,t)}const s=1===o.positionedLines.length;if(B+=ru(e,i,o,a,l,g,w,_,I,r.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,s?V:[n],F,R,S,E),s)break}r.vertical&&(D+=ru(e,i,r.vertical,a,l,g,w,_,I,t.WritingMode.vertical,["vertical"],F,O,S,E));const G=C?C.boxStartIndex:e.collisionBoxArray.length,q=C?C.boxEndIndex:e.collisionBoxArray.length,W=M?M.boxStartIndex:e.collisionBoxArray.length,Z=M?M.boxEndIndex:e.collisionBoxArray.length,H=P?P.boxStartIndex:e.collisionBoxArray.length,$=P?P.boxEndIndex:e.collisionBoxArray.length,X=k?k.boxStartIndex:e.collisionBoxArray.length,K=k?k.boxEndIndex:e.collisionBoxArray.length;let J=-1;const Y=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;J=Y(C,J),J=Y(M,J),J=Y(P,J),J=Y(k,J);const Q=J>-1?1:0;Q&&(J*=A/24),e.glyphOffsetArray.length>=fu.MAX_GLYPHS&&f("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,w.sortKey),e.symbolInstances.emplaceBack(i.x,i.y,F.right>=0?F.right:-1,F.center>=0?F.center:-1,F.left>=0?F.left:-1,F.vertical||-1,R,O,U,G,q,W,Z,H,$,X,K,c,B,D,z,L,Q,0,d,j,N,J)}(e,p,l,n,r,o,M,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,y,w,E,u,v,S,A,m,i,a,c,h,s)};if("line"===I)for(const t of Nl(i.geometry,0,0,Mo,Mo)){const i=jl(t,b,T,n.vertical||g,r,24,x,e.overscaling,Mo);for(const n of i){const i=g;i&&au(e,i.text,C,n)||k(t,n)}}else if("line-center"===I){for(const t of i.geometry)if(t.length>1){const e=Ul(t,T,n.vertical||g,r,24,x);e&&k(t,e)}}else if("Polygon"===i.type)for(const t of $a(i.geometry,0)){const e=Kl(t,16);k(t[0],new Bl(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry)k(t,new Bl(t[0].x,t[0].y,0));else if("Point"===i.type)for(const t of i.geometry)for(const e of t)k([e],new Bl(e.x,e.y,0))}const nu=32640;function ru(t,e,i,n,r,o,a,s,l,u,c,h,p,d,m){const g=function(t,e,i,n,r,o,a,s){const l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const o=n.rect||{};let c=4,h=!0,p=1,d=0;const f=(r||s)&&n.vertical,m=n.metrics.advance*n.scale/2;if(s&&e.verticalizable){const e=24*(n.scale-1),i=(24-n.metrics.width*n.scale)/2;d=t.lineOffset/2-(n.imageName?-i:e)}if(n.imageName){const t=a[n.imageName];h=t.sdf,p=t.pixelRatio,c=1/p}const g=r?[n.x+m,n.y]:[0,0];let _=r?[0,0]:[n.x+m+i[0],n.y+i[1]-d],y=[0,0];f&&(y=_,_=[0,0]);const x=(n.metrics.left-c)*n.scale-m+_[0],v=(-n.metrics.top-c)*n.scale+_[1],b=x+o.w*n.scale/p,w=v+o.h*n.scale/p,S=new E(x,v),T=new E(b,v),A=new E(x,w),I=new E(b,w);if(f){const t=new E(-m,m- -17),e=-Math.PI/2,i=12-m,r=new E(22-i,-(n.imageName?i:0)),o=new E(...y);S._rotateAround(e,t)._add(r)._add(o),T._rotateAround(e,t)._add(r)._add(o),A._rotateAround(e,t)._add(r)._add(o),I._rotateAround(e,t)._add(r)._add(o)}if(l){const t=Math.sin(l),e=Math.cos(l),i=[e,-t,t,e];S._matMult(i),T._matMult(i),A._matMult(i),I._matMult(i)}const C=new E(0,0),P=new E(0,0);u.push({tl:S,tr:T,bl:A,br:I,tex:o,writingMode:e.writingMode,glyphOffset:g,sectionIndex:n.sectionIndex,isSDF:h,pixelOffsetTL:C,pixelOffsetBR:P,minFontScaleX:0,minFontScaleY:0})}return u}(0,i,s,r,o,a,n,t.allowVerticalPlacement),_=t.textSizeData;let y=null;"source"===_.kind?(y=[zl*r.layout.get("text-size").evaluate(a,{})],y[0]>nu&&f(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".')):"composite"===_.kind&&(y=[zl*d.compositeTextSizes[0].evaluate(a,{},m),zl*d.compositeTextSizes[1].evaluate(a,{},m)],(y[0]>nu||y[1]>nu)&&f(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".')),t.addSymbols(t.text,g,y,s,o,a,u,e,l.lineStartIndex,l.lineLength,p,m);for(const e of c)h[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function ou(t){for(const e in t)return t[e];return null}function au(t,e,i,n){const r=t.compareText;if(e in r){const t=r[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<i)return!0}else r[e]=[];return r[e].push(n),!1}const su=ns.VectorTileFeature.types,lu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function uu(t,e,i,n,r,o,a,s,l,u,c,h,p){const d=s?Math.min(nu,Math.round(s[0])):0,f=s?Math.min(nu,Math.round(s[1])):0;t.emplaceBack(e,i,Math.round(32*n),Math.round(32*r),o,a,(d<<1)+(l?1:0),f,16*u,16*c,256*h,256*p)}function cu(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function hu(t){for(const e of t.sections)if(Cn(e.text))return!0;return!1}class pu{constructor(t){this.layoutVertexArray=new Hr,this.indexArray=new Yr,this.programConfigurations=t,this.segments=new io,this.dynamicLayoutVertexArray=new $r,this.opacityVertexArray=new Xr,this.placedSymbolArray=new Br}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Rs.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Os.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,lu,!0),this.opacityVertexBuffer.itemSize=1),(i||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}mn("SymbolBuffers",pu);class du{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new io,this.collisionVertexArray=new Jr}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Fs.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}mn("CollisionBuffers",du);class fu{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ta([]),this.placementViewportMatrix=ta([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ll(this.zoom,i["text-size"]),this.iconSizeData=Ll(this.zoom,i["icon-size"]);const n=this.layers[0].layout,r=n.get("symbol-sort-key"),o=n.get("symbol-z-order");this.canOverlap="never"!==xu(n,"text-overlap","text-allow-overlap")||"never"!==xu(n,"icon-overlap","icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!r.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map(e=>t.WritingMode[e])),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.sourceID=e.sourceID}createArrays(){this.text=new pu(new Io(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new pu(new Io(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Or,this.lineVertexArray=new Fr,this.symbolInstances=new Rr}calculateGlyphDependencies(t,e,i,n,r){for(let o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(i||n)&&r){const i=Vs[t.charAt(o)];i&&(e[i.charCodeAt(0)]=!0)}}populate(e,i,n){const r=this.layers[0],o=r.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=("constant"!==s.value.kind||s.value.value instanceof Dt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;const p=i.iconDependencies,d=i.glyphDependencies,f=i.availableImages,m=new Nn(this.zoom);for(const{feature:i,id:s,index:l,sourceLayerIndex:g}of e){const e=r._featureFilter.needGeometry,_=Bo(i,e);if(!r._featureFilter.filter(m,_,n))continue;let y,x;if(e||(_.geometry=Lo(i)),u){const t=r.getValueAndResolveTokens("text-field",_,n,f),e=Dt.factory(t);hu(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Fn()||this.hasRTLText&&jn.isParsed())&&(y=Ns(e,r,_))}if(c){const t=r.getValueAndResolveTokens("icon-image",_,n,f);x=t instanceof Rt?t:Rt.fromString(t)}if(!y&&!x)continue;const v=this.sortFeaturesByKey?h.evaluate(_,{},n):void 0;if(this.features.push({id:s,text:y,icon:x,index:l,sourceLayerIndex:g,geometry:_.geometry,properties:i.properties,type:su[i.type],sortKey:v}),x&&(p[x.name]=!0),y){const e=a.evaluate(_,{},n).join(","),i="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.WritingMode.vertical)>=0;for(const t of y.sections)if(t.image)p[t.image.name]=!0;else{const n=bn(y.toString()),r=t.fontStack||e,o=d[r]=d[r]||{};this.calculateGlyphDependencies(t.text,o,i,this.allowVerticalPlacement,n)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},i={},n=[];let r=0;function o(e){n.push(t[e]),r++}function a(t,e,r){const o=i[t];return delete i[t],i[e]=o,n[o].geometry[0].pop(),n[o].geometry[0]=n[o].geometry[0].concat(r[0]),o}function s(t,i,r){const o=e[i];return delete e[i],e[t]=o,n[o].geometry[0].shift(),n[o].geometry[0]=r[0].concat(n[o].geometry[0]),o}function l(t,e,i){const n=i?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){o(u);continue}const d=l(p,h),f=l(p,h,!0);if(d in i&&f in e&&i[d]!==e[f]){const t=s(d,f,h),r=a(d,f,n[t].geometry);delete e[d],delete i[f],i[l(p,n[r].geometry,!0)]=r,n[t].geometry=null}else d in i?a(d,f,h):f in e?s(d,f,h):(o(u),e[d]=r-1,i[f]=r-1)}return n.filter(t=>t.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((t,e)=>t.sortKey-e.sortKey)}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const r={};for(let n=t.segment+1;n<e.length;n++)r[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:i},n<e.length-1&&(i+=e[n+1].dist(e[n]));for(let i=t.segment||0;i>=0;i--)r[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:n},i>0&&(n+=e[i-1].dist(e[i]));for(let t=0;t<e.length;t++){const e=r[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,i,n,r,o,a,s,l,u,c,h,p){const d=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*i.length,f,d,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&s===t.WritingMode.vertical?Math.PI/2:0,x=a.text&&a.text.sections;for(let t=0;t<i.length;t++){const{tl:r,tr:o,bl:s,br:u,tex:c,pixelOffsetTL:h,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:v,glyphOffset:b,isSDF:w,sectionIndex:S}=i[t],T=m.vertexLength,E=b[1];uu(f,l.x,l.y,r.x,E+r.y,c.x,c.y,n,w,h.x,h.y,_,v),uu(f,l.x,l.y,o.x,E+o.y,c.x+c.w,c.y,n,w,g.x,h.y,_,v),uu(f,l.x,l.y,s.x,E+s.y,c.x,c.y+c.h,n,w,h.x,g.y,_,v),uu(f,l.x,l.y,u.x,E+u.y,c.x+c.w,c.y+c.h,n,w,g.x,g.y,_,v),cu(e.dynamicLayoutVertexArray,l,y),d.emplaceBack(T,T+1,T+2),d.emplaceBack(T+1,T+2,T+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),t!==i.length-1&&S===i[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(f.length,a,a.index,{},p,x&&x[S])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,u,c,l.segment,n?n[0]:0,n?n[1]:0,r[0],r[1],s,0,!1,0,h)}_addCollisionDebugVertex(t,e,i,n,r,o){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,n,r,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,i,n,r,o,a){const s=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),l=s.vertexLength,u=r.layoutVertexArray,c=r.collisionVertexArray,h=a.anchorX,p=a.anchorY;this._addCollisionDebugVertex(u,c,o,h,p,new E(t,e)),this._addCollisionDebugVertex(u,c,o,h,p,new E(i,e)),this._addCollisionDebugVertex(u,c,o,h,p,new E(i,n)),this._addCollisionDebugVertex(u,c,o,h,p,new E(t,n)),s.vertexLength+=4;const d=r.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),s.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,n){for(let r=t;r<e;r++){const t=this.collisionBoxArray.get(r);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new du(Kr,Us.members,Qr),this.iconCollisionBox=new du(Kr,Us.members,Qr);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,n,r,o,a,s,l){const u={};for(let n=e;n<i;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},u.textFeatureIndex=e.featureIndex;break}for(let e=n;e<r;e++){const i=t.get(e);u.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},u.verticalTextFeatureIndex=i.featureIndex;break}for(let e=o;e<a;e++){const i=t.get(e);u.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},u.iconFeatureIndex=i.featureIndex;break}for(let e=s;e<l;e++){const i=t.get(e);u.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},u.verticalIconFeatureIndex=i.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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(t,e){const i=t.placedSymbolArray.get(e),n=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),i=Math.cos(t),n=[],r=[],o=[];for(let t=0;t<this.symbolInstances.length;++t){o.push(t);const a=this.symbolInstances.get(t);n.push(0|Math.round(e*a.anchorX+i*a.anchorY)),r.push(a.featureIndex)}return o.sort((t,e)=>n[t]-n[e]||r[e]-r[t]),o}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}mn("SymbolBucket",fu,{omit:["layers","collisionBoxArray","features","compareText"]}),fu.MAX_GLYPHS=65535,fu.addDynamicAttributes=cu;const mu=new er({"symbol-placement":new Kn(it.layout_symbol["symbol-placement"]),"symbol-spacing":new Kn(it.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Kn(it.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Jn(it.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Kn(it.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Kn(it.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Kn(it.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Kn(it.layout_symbol["icon-ignore-placement"]),"icon-optional":new Kn(it.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Kn(it.layout_symbol["icon-rotation-alignment"]),"icon-size":new Jn(it.layout_symbol["icon-size"]),"icon-text-fit":new Kn(it.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Kn(it.layout_symbol["icon-text-fit-padding"]),"icon-image":new Jn(it.layout_symbol["icon-image"]),"icon-rotate":new Jn(it.layout_symbol["icon-rotate"]),"icon-padding":new Kn(it.layout_symbol["icon-padding"]),"icon-keep-upright":new Kn(it.layout_symbol["icon-keep-upright"]),"icon-offset":new Jn(it.layout_symbol["icon-offset"]),"icon-anchor":new Jn(it.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Kn(it.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Kn(it.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Kn(it.layout_symbol["text-rotation-alignment"]),"text-field":new Jn(it.layout_symbol["text-field"]),"text-font":new Jn(it.layout_symbol["text-font"]),"text-size":new Jn(it.layout_symbol["text-size"]),"text-max-width":new Jn(it.layout_symbol["text-max-width"]),"text-line-height":new Kn(it.layout_symbol["text-line-height"]),"text-letter-spacing":new Jn(it.layout_symbol["text-letter-spacing"]),"text-justify":new Jn(it.layout_symbol["text-justify"]),"text-radial-offset":new Jn(it.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Kn(it.layout_symbol["text-variable-anchor"]),"text-anchor":new Jn(it.layout_symbol["text-anchor"]),"text-max-angle":new Kn(it.layout_symbol["text-max-angle"]),"text-writing-mode":new Kn(it.layout_symbol["text-writing-mode"]),"text-rotate":new Jn(it.layout_symbol["text-rotate"]),"text-padding":new Kn(it.layout_symbol["text-padding"]),"text-keep-upright":new Kn(it.layout_symbol["text-keep-upright"]),"text-transform":new Jn(it.layout_symbol["text-transform"]),"text-offset":new Jn(it.layout_symbol["text-offset"]),"text-allow-overlap":new Kn(it.layout_symbol["text-allow-overlap"]),"text-overlap":new Kn(it.layout_symbol["text-overlap"]),"text-ignore-placement":new Kn(it.layout_symbol["text-ignore-placement"]),"text-optional":new Kn(it.layout_symbol["text-optional"])});var gu={paint:new er({"icon-opacity":new Jn(it.paint_symbol["icon-opacity"]),"icon-color":new Jn(it.paint_symbol["icon-color"]),"icon-halo-color":new Jn(it.paint_symbol["icon-halo-color"]),"icon-halo-width":new Jn(it.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Jn(it.paint_symbol["icon-halo-blur"]),"icon-translate":new Kn(it.paint_symbol["icon-translate"]),"icon-translate-anchor":new Kn(it.paint_symbol["icon-translate-anchor"]),"text-opacity":new Jn(it.paint_symbol["text-opacity"]),"text-color":new Jn(it.paint_symbol["text-color"],{runtimeType:ft,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Jn(it.paint_symbol["text-halo-color"]),"text-halo-width":new Jn(it.paint_symbol["text-halo-width"]),"text-halo-blur":new Jn(it.paint_symbol["text-halo-blur"]),"text-translate":new Kn(it.paint_symbol["text-translate"]),"text-translate-anchor":new Kn(it.paint_symbol["text-translate-anchor"])}),layout:mu};class _u{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:ct,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}mn("FormatSectionOverride",_u,{omit:["defaultValue"]});class yu extends nr{constructor(t){super(t,gu)}recalculate(t,e){if(super.recalculate(t,e),"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 t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,n){const r=this.layout.get(t).evaluate(e,{},i,n),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Ti(o.value)||!r?r:function(t,e){return e.replace(/{([^{}]+)}/g,(e,i)=>i in t?String(t[i]):"")}(e.properties,r)}createBucket(t){return new fu(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of gu.paint.overridableProperties){if(!yu.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new _u(e),n=new Si(i,e.property.specification);let r=null;r="constant"===e.value.kind||"source"===e.value.kind?new Ai("source",n):new Ii("composite",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new $n(e.property,r,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&yu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),n=gu.paint.properties[e];let r=!1;const o=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(r=!0)};if("constant"===i.value.kind&&i.value.value instanceof Dt)o(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{r||(e instanceof Nt&&Ut(e.value)===yt?o(e.value.sections):e instanceof Wt?o(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return r}}function xu(t,e,i){let n="never";const r=t.get(e);return r?n=r:t.get(i)&&(n="always"),n}var vu={paint:new er({"background-color":new Kn(it.paint_background["background-color"]),"background-pattern":new Qn(it.paint_background["background-pattern"]),"background-opacity":new Kn(it.paint_background["background-opacity"])})},bu={paint:new er({"raster-opacity":new Kn(it.paint_raster["raster-opacity"]),"raster-hue-rotate":new Kn(it.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Kn(it.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Kn(it.paint_raster["raster-brightness-max"]),"raster-saturation":new Kn(it.paint_raster["raster-saturation"]),"raster-contrast":new Kn(it.paint_raster["raster-contrast"]),"raster-resampling":new Kn(it.paint_raster["raster-resampling"]),"raster-fade-duration":new Kn(it.paint_raster["raster-fade-duration"])})};class wu extends nr{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}}const Su={circle:class extends nr{constructor(t){super(t,Yo)}createBucket(t){return new Ro(t)}queryRadius(t){const e=t;return $o("circle-radius",this,e)+$o("circle-stroke-width",this,e)+Xo(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,n,r,o,a,s){const l=Ko(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),u=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:function(t,e){return t.map(t=>oa(t,e))}(l,s),p=c?u*a:u;for(const t of n)for(const e of t){const t=c?e:oa(e,s);let i=p;const n=ra([],[e.x,e.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=n[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=o.cameraToCenterDistance/n[3]),Fo(h,t,i))return!0}return!1}},heatmap:class extends nr{constructor(t){super(t,sa),this._updateColorRamp()}createBucket(t){return new aa(t)}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=da({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},hillshade:class extends nr{constructor(t){super(t,fa)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends nr{constructor(t){super(t,ts)}recalculate(t,e){super.recalculate(t,e);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(t){return new Ya(t)}queryRadius(){return Xo(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,n,r,o,a){return Uo(Ko(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),n)}isTileClipped(){return!0}},"fill-extrusion":class extends nr{constructor(t){super(t,bs)}createBucket(t){return new ys(t)}queryRadius(){return Xo(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,n,r,o,a,s){const l=Ko(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,a),u=this.paint.get("fill-extrusion-height").evaluate(e,i),c=this.paint.get("fill-extrusion-base").evaluate(e,i),h=function(t,e,i,n){const r=[];for(const i of t){const t=[i.x,i.y,0,1];ra(t,t,e),r.push(new E(t[0]/t[3],t[1]/t[3]))}return r}(l,s),p=function(t,e,i,n){const r=[],o=[],a=n[8]*e,s=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*i,h=n[9]*i,p=n[10]*i,d=n[11]*i;for(const e of t){const t=[],i=[];for(const r of e){const e=r.x,o=r.y,f=n[0]*e+n[4]*o+n[12],m=n[1]*e+n[5]*o+n[13],g=n[2]*e+n[6]*o+n[14],_=n[3]*e+n[7]*o+n[15],y=g+l,x=_+u,v=f+c,b=m+h,w=g+p,S=_+d,T=new E((f+a)/x,(m+s)/x);T.z=y/x,t.push(T);const A=new E(v/S,b/S);A.z=w/S,i.push(A)}r.push(t),o.push(i)}return[r,o]}(n,c,u,s);return function(t,e,i){let n=1/0;Uo(i,e)&&(n=Ss(i,e[0]));for(let r=0;r<e.length;r++){const o=e[r],a=t[r];for(let t=0;t<o.length-1;t++){const e=o[t],r=[e,o[t+1],a[t+1],a[t],e];Oo(i,r)&&(n=Math.min(n,Ss(i,r)))}}return n!==1/0&&n}(p[0],p[1],h)}},line:class extends nr{constructor(t){super(t,Ls),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof we,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Bs.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new ks(t)}queryRadius(t){const e=t,i=Ds($o("line-width",this,e),$o("line-gap-width",this,e)),n=$o("line-offset",this,e);return i/2+Math.abs(n)+Xo(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,r,o,a){const s=Ko(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,a),l=a/2*Ds(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),u=this.paint.get("line-offset").evaluate(e,i);return u&&(n=function(t,e){const i=[];for(let n=0;n<t.length;n++){const r=t[n],o=[];for(let t=0;t<r.length;t++){const i=r[t-1],n=r[t],a=r[t+1],s=0===t?new E(0,0):n.sub(i)._unit()._perp(),l=t===r.length-1?new E(0,0):a.sub(n)._unit()._perp(),u=s._add(l)._unit(),c=u.x*l.x+u.y*l.y;0!==c&&u._mult(1/c),o.push(u._mult(e)._add(n))}i.push(o)}return i}(n,u*a)),function(t,e,i){for(let n=0;n<e.length;n++){const r=e[n];if(t.length>=3)for(let e=0;e<r.length;e++)if(Zo(t,r[e]))return!0;if(jo(t,r,i))return!0}return!1}(s,n,l)}isTileClipped(){return!0}},symbol:yu,background:class extends nr{constructor(t){super(t,vu)}},raster:class extends nr{constructor(t){super(t,bu)}}};class Tu{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const Eu=6371008.8;class Au{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Au(a(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,n=t.lat*e,r=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Eu*Math.acos(Math.min(r,1))}toBounds(t=0){const e=360*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return new Iu(new Au(this.lng-i,this.lat-e),new Au(this.lng+i,this.lat+e))}static convert(t){if(t instanceof Au)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Au(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Au(Number("lng"in t?t.lng:t.lon),Number(t.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>]")}}class Iu{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof Au?new Au(t.lng,t.lat):Au.convert(t),this}setSouthWest(t){return this._sw=t instanceof Au?new Au(t.lng,t.lat):Au.convert(t),this}extend(t){const e=this._sw,i=this._ne;let n,r;if(t instanceof Au)n=t,r=t;else{if(!(t instanceof Iu))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Iu.convert(t)):this.extend(Au.convert(t)):this;if(n=t._sw,r=t._ne,!n||!r)return this}return e||i?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Au(n.lng,n.lat),this._ne=new Au(r.lng,r.lat)),this}getCenter(){return new Au((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 Au(this.getWest(),this.getNorth())}getSouthEast(){return new Au(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(t){const{lng:e,lat:i}=Au.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}static convert(t){return t instanceof Iu?t:t?new Iu(t):t}}const Cu=2*Math.PI*Eu;function Pu(t){return Cu*Math.cos(t*Math.PI/180)}function Mu(t){return(180+t)/360}function ku(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function zu(t,e){return t/Pu(e)}function Lu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Bu{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Au.convert(t);return new Bu(Mu(i.lng),ku(i.lat),zu(e,i.lat))}toLngLat(){return new Au(360*this.x-180,Lu(this.y))}toAltitude(){return this.z*Pu(Lu(this.y))}meterInMercatorCoordinateUnits(){return 1/Cu*(t=Lu(this.y),1/Math.cos(t*Math.PI/180));var t}}function Du(t,e,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class Ru{constructor(t,e,i){this.z=t,this.x=e,this.y=i,this.key=Uu(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const n=(o=this.y,a=this.z,s=Du(256*(r=this.x),256*(o=Math.pow(2,a)-o-1),a),l=Du(256*(r+1),256*(o+1),a),s[0]+","+s[1]+","+l[0]+","+l[1]);var r,o,a,s,l;const u=function(t,e,i){let n,r="";for(let o=t;o>0;o--)n=1<<o-1,r+=(e&n?1:0)+(i&n?2:0);return r}(this.z,this.x,this.y);return t[(this.x+this.y)%t.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,e>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,n)}getTilePoint(t){const e=Math.pow(2,this.z);return new E((t.x*e-this.x)*Mo,(t.y*e-this.y)*Mo)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ou{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Uu(t,e.z,e.z,e.x,e.y)}}class Fu{constructor(t,e,i,n,r){this.overscaledZ=t,this.wrap=e,this.canonical=new Ru(i,+n,+r),this.key=Uu(e,t,i,n,r)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){const e=this.canonical.z-t;return t>this.canonical.z?new Fu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Fu(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){const i=this.canonical.z-t;return t>this.canonical.z?Uu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Uu(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Fu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,n=2*this.canonical.y;return[new Fu(e,this.wrap,e,i,n),new Fu(e,this.wrap,e,i+1,n),new Fu(e,this.wrap,e,i,n+1),new Fu(e,this.wrap,e,i+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Fu(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Fu(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Ou(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Bu(t.x-this.wrap,t.y))}}function Uu(t,e,i,n,r){(t*=2)<0&&(t=-1*t-1);const o=1<<i;return(o*o*t+o*r+n).toString(36)+i.toString(36)+e.toString(36)}mn("CanonicalTileID",Ru),mn("OverscaledTileID",Fu,{omit:["posMatrix"]});class ju{constructor(t,e,i){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return void f(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const n=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=i||"mapbox";for(let t=0;t<n;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(n,t)]=this.data[this._idx(n-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,n)]=this.data[this._idx(t,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)]}get(t,e){const i=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(i[n],i[n+1],i[n+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,i){return(256*t*256+256*e+i)/10-1e4}_unpackTerrarium(t,e,i){return 256*t+e+i/256-32768}getPixels(){return new pa({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,r=e*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(e){case-1:n=r-1;break;case 1:r=n+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}const s=-e*this.dim,l=-i*this.dim;for(let e=o;e<a;e++)for(let i=n;i<r;i++)this.data[this._idx(i,e)]=t.data[this._idx(i+s,e+l)]}}mn("DEMData",ju);class Nu{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class Vu{constructor(t,e,i,n,r){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=n,this.properties=t.properties,this.id=r}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class Gu{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new dn(Mo,16,0),this.grid3D=new dn(Mo,16,0),this.featureIndexArray=new jr,this.promoteId=e}insert(t,e,i,n,r,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,r);const s=o?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const i=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<i.length;t++){const e=i[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<Mo&&n[1]<Mo&&n[2]>=0&&n[3]>=0&&s.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new ns.VectorTile(new Gs(this.rawTileData)).layers,this.sourceLayerCoder=new Nu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,n){this.loadVTLayers();const r=t.params||{},o=Mo/t.tileSize/t.scale,a=Fi(r.filter),s=t.queryGeometry,l=t.queryPadding*o,u=Wu(s),c=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),h=Wu(t.cameraQueryGeometry),p=this.grid3D.query(h.minX-l,h.minY-l,h.maxX+l,h.maxY+l,(e,i,n,r)=>function(t,e,i,n,r){for(const o of t)if(e<=o.x&&i<=o.y&&n>=o.x&&r>=o.y)return!0;const o=[new E(e,i),new E(e,r),new E(n,r),new E(n,i)];if(t.length>2)for(const e of o)if(Zo(t,e))return!0;for(let e=0;e<t.length-1;e++)if(Ho(t[e],t[e+1],o))return!0;return!1}(t.cameraQueryGeometry,e-l,i-l,n+l,r+l));for(const t of p)c.push(t);c.sort(Zu);const d={};let f;for(let l=0;l<c.length;l++){const u=c[l];if(u===f)continue;f=u;const h=this.featureIndexArray.get(u);let p=null;this.loadMatchingFeature(d,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,a,r.layers,r.availableImages,e,i,n,(e,i,n)=>(p||(p=Lo(e)),i.queryIntersectsFeature(s,e,n,p,this.z,t.transform,o,t.pixelPosMatrix)))}return d}loadMatchingFeature(t,e,i,n,r,o,a,l,u,c,h){const p=this.bucketLayerIDs[e];if(o&&!function(t,e){for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(o,p))return;const d=this.sourceLayerCoder.decode(i),f=this.vtLayers[d].feature(n);if(r.needGeometry){const t=Bo(f,!0);if(!r.filter(new Nn(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!r.filter(new Nn(this.tileID.overscaledZ),f))return;const m=this.getId(f,d);for(let e=0;e<p.length;e++){const i=p[e];if(o&&o.indexOf(i)<0)continue;const r=l[i];if(!r)continue;let d={};m&&c&&(d=c.getState(r.sourceLayer||"_geojsonTileLayer",m));const g=s({},u[i]);g.paint=qu(g.paint,r.paint,f,d,a),g.layout=qu(g.layout,r.layout,f,d,a);const _=!h||h(f,r,d);if(!_)continue;const y=new Vu(f,this.z,this.x,this.y,m);y.layer=g;let x=t[i];void 0===x&&(x=t[i]=[]),x.push({featureIndex:n,feature:y,intersectionZ:_})}}lookupSymbolFeatures(t,e,i,n,r,o,a,s){const l={};this.loadVTLayers();const u=Fi(r);for(const r of t)this.loadMatchingFeature(l,i,n,r,u,o,a,s,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const i of e)if(t===i)return!0;return!1}getId(t,e){let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i))),i}}function qu(t,e,i,n,r){return c(t,(t,o)=>{const a=e instanceof Xn?e.get(o):null;return a&&a.evaluate?a.evaluate(i,n,r):a})}function Wu(t){let e=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),n=Math.max(n,o.x),r=Math.max(r,o.y);return{minX:e,minY:i,maxX:n,maxY:r}}function Zu(t,e){return e-t}var Hu;mn("FeatureIndex",Gu,{omit:["rawTileData","sourceLayerCoder"]}),t.PerformanceMarkers=void 0,(Hu=t.PerformanceMarkers||(t.PerformanceMarkers={})).create="create",Hu.load="load",Hu.fullLoad="fullLoad";let $u=null,Xu=[];const Ku=1e3/30,Ju={mark(t){performance.mark(t)},frame(t){const e=t;null!=$u&&Xu.push(e-$u),$u=e},clearMetrics(){$u=null,Xu=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const e in t.PerformanceMarkers)performance.clearMarks(t.PerformanceMarkers[e])},getPerformanceMetrics(){performance.measure("loadTime",t.PerformanceMarkers.create,t.PerformanceMarkers.load),performance.measure("fullLoadTime",t.PerformanceMarkers.create,t.PerformanceMarkers.fullLoad);const e=performance.getEntriesByName("loadTime")[0].duration,i=performance.getEntriesByName("fullLoadTime")[0].duration,n=Xu.length,r=1/(Xu.reduce((t,e)=>t+e,0)/n/1e3),o=Xu.filter(t=>t>Ku).reduce((t,e)=>t+(e-Ku)/Ku,0);return{loadTime:e,fullLoadTime:i,fps:r,percentDroppedFrames:o/(n+o)*100}}};t.AJAXError=N,t.ARRAY_TYPE=Qo,t.Actor=class{constructor(t,e,i){this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},u(["receive","process"],this),this.invoker=new Tu(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=_()?t:window}send(t,e,i,n,r=!1){const o=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(this.callbacks[o]=i);const a=w(this.globalScope)?void 0:[];return this.target.postMessage({id:o,type:t,hasCallback:!!i,targetMapId:n,mustQueue:r,sourceMapId:this.mapId,data:_n(e,a)},a),{cancel:()=>{i&&delete this.callbacks[o],this.target.postMessage({id:o,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(t){const e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[i];const t=this.cancelCallbacks[i];delete this.cancelCallbacks[i],t&&t()}else _()||e.mustQueue?(this.tasks[i]=e,this.taskQueue.push(i),this.invoker.trigger()):this.processTask(i,e)}process(){if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){if("<response>"===e.type){const i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i(yn(e.error)):i(null,yn(e.data)))}else{let i=!1;const n=w(this.globalScope)?void 0:[],r=e.hasCallback?(e,r)=>{i=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?_n(e):null,data:_n(r,n)},n)}:t=>{i=!0};let o=null;const a=yn(e.data);if(this.parent[e.type])o=this.parent[e.type](e.sourceMapId,a,r);else if(this.parent.getWorkerSource){const t=e.type.split(".");o=this.parent.getWorkerSource(e.sourceMapId,t[0],a.source)[t[1]](a,r)}else r(new Error("Could not find function "+e.type));!i&&o&&o.cancel&&(this.cancelCallbacks[t]=o.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.AlphaImage=ha,t.CanonicalTileID=Ru,t.CollisionBoxArray=zr,t.CollisionCircleLayoutArray=class extends vr{},t.Color=zt,t.DEMData=ju,t.DataConstantProperty=Kn,t.DictionaryCoder=Nu,t.EXTENT=Mo,t.ErrorEvent=tt,t.EvaluationParameters=Nn,t.Event=Q,t.Evented=et,t.FeatureIndex=Gu,t.FillBucket=Ya,t.FillExtrusionBucket=ys,t.GeoJSONFeature=Vu,t.ImageAtlas=_l,t.ImagePosition=gl,t.LineBucket=ks,t.LineStripIndexArray=class extends Pr{},t.LngLat=Au,t.LngLatBounds=Iu,t.MercatorCoordinate=Bu,t.ONE_EM=24,t.OverscaledTileID=Fu,t.PerformanceUtils=Ju,t.PosArray=class extends ur{},t.Properties=er,t.QuadTriangleArray=class extends wr{},t.RGBAImage=pa,t.RasterBoundsArray=class extends cr{},t.RequestPerformance=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.ResourceType=j,t.SegmentVector=io,t.SymbolBucket=fu,t.Transitionable=qn,t.TriangleIndexArray=Yr,t.Uniform1f=go,t.Uniform1i=class extends mo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.Uniform2f=class extends mo{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.Uniform3f=class extends mo{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.Uniform4f=_o,t.UniformColor=yo,t.UniformMatrix4f=class extends mo{constructor(t,e){super(t,e),this.current=xo}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.UnwrappedTileID=Ou,t.ValidationError=nt,t.ZoomHistory=xn,t.addDynamicAttributes=cu,t.asyncAll=function(t,e,i){if(!t.length)return i(null,[]);let n=t.length;const r=new Array(t.length);let o=null;t.forEach((t,a)=>{e(t,(t,e)=>{t&&(o=t),r[a]=e,0==--n&&i(o,r)})})},t.bezier=n,t.bindAll=u,t.cacheEntryPossiblyAdded=function(t){L++,L>k&&(t.getActor().send("enforceCacheSizeLimit",M),L=0)},t.clamp=o,t.clearTileCache=function(t){const e=caches.delete(C);t&&e.catch(t).then(()=>t())},t.clipLine=Nl,t.clone=function(t){var e=new Qo(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=p,t.collisionCircleLayout=js,t.config=I,t.create=function(){var t=new Qo(16);return Qo!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.createExpression=Ei,t.createFilter=Fi,t.createLayout=sr,t.createStyleLayer=function(t){return"custom"===t.type?new wu(t):new Su[t.type](t)},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.ease=r,t.emitValidationErrors=pn,t.enforceCacheSizeLimit=function(t){z(),P&&P.then(e=>{e.keys().then(i=>{for(let n=0;n<i.length-t;n++)e.delete(i[n])})})},t.evaluateSizeForFeature=function(t,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:r}){return"source"===t.kind?n/zl:"composite"===t.kind?Se(n/zl,r/zl,i):e},t.evaluateSizeForZoom=function(t,e){let i=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){const{interpolationType:r,minZoom:a,maxZoom:s}=t,l=r?o(Fe.interpolationFactor(r,e,a,s),0,1):0;"camera"===t.kind?n=Se(t.minSize,t.maxSize,l):i=l}return{uSizeT:i,uSize:n}},t.evaluateVariableOffset=tu,t.evented=On,t.exported=T,t.exported$1=B,t.extend=s,t.filterObject=h,t.getAnchorAlignment=Cl,t.getAnchorJustification=eu,t.getArrayBuffer=W,t.getImage=K,t.getJSON=function(t,e){return q(s(t,{type:"json"}),e)},t.getOverlapMode=xu,t.getRTLTextPluginStatus=Fn,t.getReferrer=V,t.getVideo=function(t,e){const i=window.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let e=0;e<t.length;e++){const n=window.document.createElement("source");Z(t[e])||(i.crossOrigin="Anonymous"),n.src=t[e],i.appendChild(n)}return{cancel:()=>{}}},t.identity=ta,t.invert=function(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=i*s-n*a,x=i*l-r*a,v=i*u-o*a,b=n*l-r*s,w=n*u-o*s,S=r*u-o*l,T=c*m-h*f,E=c*g-p*f,A=c*_-d*f,I=h*g-p*m,C=h*_-d*m,P=p*_-d*g,M=y*P-x*C+v*I+b*A-w*E+S*T;return M?(t[0]=(s*P-l*C+u*I)*(M=1/M),t[1]=(r*C-n*P-o*I)*M,t[2]=(m*S-g*w+_*b)*M,t[3]=(p*w-h*S-d*b)*M,t[4]=(l*A-a*P-u*E)*M,t[5]=(i*P-r*A+o*E)*M,t[6]=(g*v-f*S-_*x)*M,t[7]=(c*S-p*v+d*x)*M,t[8]=(a*C-s*A+u*T)*M,t[9]=(n*A-i*C-o*T)*M,t[10]=(f*w-m*v+_*y)*M,t[11]=(h*v-c*w-d*y)*M,t[12]=(s*E-a*I-l*T)*M,t[13]=(i*I-n*E+r*T)*M,t[14]=(m*x-f*b-g*y)*M,t[15]=(c*b-h*x+p*y)*M,t):null},t.isImageBitmap=S,t.isSafari=w,t.keysDifference=function(t,e){const i=[];for(const n in t)n in e||i.push(n);return i},t.lazyLoadRTLTextPlugin=function(){jn.isLoading()||jn.isLoaded()||"deferred"!==Fn()||Un()},t.makeRequest=q,t.mapObject=c,t.mercatorXfromLng=Mu,t.mercatorYfromLat=ku,t.mercatorZfromAltitude=zu,t.mul=na,t.multiply=ea,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.number=Se,t.ortho=function(t,e,i,n,r,o,a){var s=1/(e-i),l=1/(n-r),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+i)*s,t[13]=(r+n)*l,t[14]=(a+o)*u,t[15]=1,t},t.parseCacheControl=y,t.parseGlyphPBF=function(t){return new Gs(t).readFields(pl,[])},t.pbf=Gs,t.performSymbolLayout=function(e,i,n,r,o,a,s){e.createArrays(),e.tilePixelRatio=Mo/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const l=e.layers[0].layout,u=e.layers[0]._unevaluatedLayout._values,c={layoutIconSize:u["icon-size"].possiblyEvaluate(new Nn(e.zoom+1),s),layoutTextSize:u["text-size"].possiblyEvaluate(new Nn(e.zoom+1),s),textMaxSize:u["text-size"].possiblyEvaluate(new Nn(18))};if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.textSizeData;c.compositeTextSizes=[u["text-size"].possiblyEvaluate(new Nn(t),s),u["text-size"].possiblyEvaluate(new Nn(i),s)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.iconSizeData;c.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new Nn(t),s),u["icon-size"].possiblyEvaluate(new Nn(i),s)]}const h=24*l.get("text-line-height"),p="viewport"!==l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),d=l.get("text-keep-upright"),m=l.get("text-size");for(const a of e.features){const u=l.get("text-font").evaluate(a,{},s).join(","),g=m.evaluate(a,{},s),_=c.layoutTextSize.evaluate(a,{},s),y=c.layoutIconSize.evaluate(a,{},s),x={horizontal:{},vertical:void 0},v=a.text;let b,w=[0,0];if(v){const r=v.toString(),c=24*l.get("text-letter-spacing").evaluate(a,{},s),f=wn(r)?c:0,m=l.get("text-anchor").evaluate(a,{},s),y=l.get("text-variable-anchor");if(!y){const t=l.get("text-radial-offset").evaluate(a,{},s);w=t?tu(m,[24*t,Ql]):l.get("text-offset").evaluate(a,{},s).map(t=>24*t)}let b=p?"center":l.get("text-justify").evaluate(a,{},s);const S=l.get("symbol-placement"),T="point"===S?24*l.get("text-max-width").evaluate(a,{},s):0,E=()=>{e.allowVerticalPlacement&&bn(r)&&(x.vertical=vl(v,i,n,o,u,T,h,m,"left",f,w,t.WritingMode.vertical,!0,S,_,g))};if(!p&&y){const e="auto"===b?y.map(t=>eu(t)):[b];let r=!1;for(let a=0;a<e.length;a++){const s=e[a];if(!x.horizontal[s])if(r)x.horizontal[s]=x.horizontal[0];else{const e=vl(v,i,n,o,u,T,h,"center",s,f,w,t.WritingMode.horizontal,!1,S,_,g);e&&(x.horizontal[s]=e,r=1===e.positionedLines.length)}}E()}else{"auto"===b&&(b=eu(m));const e=vl(v,i,n,o,u,T,h,m,b,f,w,t.WritingMode.horizontal,!1,S,_,g);e&&(x.horizontal[b]=e),E(),bn(r)&&p&&d&&(x.vertical=vl(v,i,n,o,u,T,h,m,b,f,w,t.WritingMode.vertical,!1,S,_,g))}}let S=!1;if(a.icon&&a.icon.name){const t=r[a.icon.name];t&&(b=Ml(o[a.icon.name],l.get("icon-offset").evaluate(a,{},s),l.get("icon-anchor").evaluate(a,{},s)),S=!!t.sdf,void 0===e.sdfIcons?e.sdfIcons=S:e.sdfIcons!==S&&f("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.pixelRatio||0!==l.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}const T=ou(x.horizontal)||x.vertical;e.iconsInText=!!T&&T.iconsInText,(T||b)&&iu(e,a,x,b,r,c,_,y,w,S,s)}a&&e.generateCollisionDebugBuffers()},t.perspective=function(t,e,i,n,r){var o,a=1/Math.tan(e/2);return t[0]=a/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=r&&r!==1/0?(t[10]=(r+n)*(o=1/(n-r)),t[14]=2*r*n*o):(t[10]=-1,t[14]=-2*n),t},t.pick=function(t,e){const i={};for(let n=0;n<e.length;n++){const r=e[n];r in t&&(i[r]=t[r])}return i},t.plugin=jn,t.pointGeometry=E,t.polygonIntersectsPolygon=Oo,t.potpack=ml,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.register=mn,t.registerForPluginStateChange=function(t){return t({pluginStatus:Ln,pluginURL:Bn}),On.on("pluginStateChange",t),t},t.renderColorRamp=da,t.rotateX=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*r+u*n,t[5]=a*r+c*n,t[6]=s*r+h*n,t[7]=l*r+p*n,t[8]=u*r-o*n,t[9]=c*r-a*n,t[10]=h*r-s*n,t[11]=p*r-l*n,t},t.rotateZ=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*r+u*n,t[1]=a*r+c*n,t[2]=s*r+h*n,t[3]=l*r+p*n,t[4]=u*r-o*n,t[5]=c*r-a*n,t[6]=h*r-s*n,t[7]=p*r-l*n,t},t.scale=function(t,e,i){var n=i[0],r=i[1],o=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.scale$1=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},t.setCacheLimits=function(t,e){M=t,k=e},t.setRTLTextPlugin=function(t,e,i=!1){if(Ln===Pn||Ln===Mn||Ln===kn)throw new Error("setRTLTextPlugin cannot be called multiple times.");Bn=T.resolveURL(t),Ln=Pn,zn=e,Rn(),i||Un()},t.spec=it,t.sphericalToCartesian=function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(i),y:t*Math.sin(e)*Math.sin(i),z:t*Math.cos(i)}},t.toEvaluationFeature=Bo,t.transformMat4=ra,t.translate=function(t,e,i){var n,r,o,a,s,l,u,c,h,p,d,f,m=i[0],g=i[1],_=i[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*_+e[12],t[13]=e[1]*m+e[5]*g+e[9]*_+e[13],t[14]=e[2]*m+e[6]*g+e[10]*_+e[14],t[15]=e[3]*m+e[7]*g+e[11]*_+e[15]):(r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=n=e[0],t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=n*m+s*g+h*_+e[12],t[13]=r*m+l*g+p*_+e[13],t[14]=o*m+u*g+d*_+e[14],t[15]=a*m+c*g+f*_+e[15]),t},t.triggerPluginCompletionEvent=Dn,t.unicodeBlockLookup=vn,t.uniqueId=function(){return l++},t.validateCustomStyleLayer=function(t){const e=[],i=t.id;return void 0===i&&e.push({message:`layers.${i}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},t.validateLight=un,t.validateStyle=ln,t.vectorTile=ns,t.warnOnce=f,t.wrap=a})),n(0,(function(t){function e(t){const i=typeof t;if("number"===i||"boolean"===i||"string"===i||null==t)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(const n of t)i+=e(n)+",";return i+"]"}const n=Object.keys(t).sort();let r="{";for(let i=0;i<n.length;i++)r+=`${JSON.stringify(n[i])}:${e(t[n[i]])},`;return r+"}"}function i(i){let n="";for(const r of t.refProperties)n+="/"+e(i[r]);return n}class n{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,n){for(const i of e){this._layerConfigs[i.id]=i;const e=this._layers[i.id]=t.createStyleLayer(i);e._featureFilter=t.createFilter(e.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const t of n)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=function(t,e){const n={};for(let r=0;r<t.length;r++){const o=e&&e[t[r].id]||i(t[r]);e&&(e[t[r].id]=o);let a=n[o];a||(a=n[o]=[]),a.push(t[r])}const r=[];for(const t in n)r.push(n[t]);return r}(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map(t=>this._layers[t.id]),i=e[0];if("none"===i.visibility)continue;const n=i.source||"";let r=this.familiesBySource[n];r||(r=this.familiesBySource[n]={});const o=i.sourceLayer||"_geojsonTileLayer";let a=r[o];a||(a=r[o]=[]),a.push(e)}}}class r{constructor(e){const i={},n=[];for(const t in e){const r=e[t],o=i[t]={};for(const t in r){const e=r[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};n.push(i),o[t]={rect:i,metrics:e.metrics}}}const{w:r,h:o}=t.potpack(n),a=new t.AlphaImage({width:r||1,height:o||1});for(const n in e){const r=e[n];for(const e in r){const o=r[+e];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const s=i[n][e].rect;t.AlphaImage.copy(o.bitmap,a,{x:0,y:0},{x:s.x+1,y:s.y+1},o.bitmap)}}this.image=a,this.positions=i}}t.register("GlyphAtlas",r);class o{constructor(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId}parse(e,i,n,o,s){this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;const l=new t.DictionaryCoder(Object.keys(e.layers).sort()),u=new t.FeatureIndex(this.tileID,this.promoteId);u.bucketLayerIDs=[];const c={},h={featureIndex:u,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},p=i.familiesBySource[this.source];for(const i in p){const r=e.layers[i];if(!r)continue;1===r.version&&t.warnOnce(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const o=l.encode(i),s=[];for(let t=0;t<r.length;t++){const e=r.feature(t),n=u.getId(e,i);s.push({feature:e,id:n,index:t,sourceLayerIndex:o})}for(const t of p[i]){const e=t[0];e.minzoom&&this.zoom<Math.floor(e.minzoom)||e.maxzoom&&this.zoom>=e.maxzoom||"none"!==e.visibility&&(a(t,this.zoom,n),(c[e.id]=e.createBucket({index:u.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(s,h,this.tileID.canonical),u.bucketLayerIDs.push(t.map(t=>t.id)))}}let d,f,m,g;const _=t.mapObject(h.glyphDependencies,t=>Object.keys(t).map(Number));Object.keys(_).length?o.send("getGlyphs",{uid:this.uid,stacks:_},(t,e)=>{d||(d=t,f=e,v.call(this))}):f={};const y=Object.keys(h.iconDependencies);y.length?o.send("getImages",{icons:y,source:this.source,tileID:this.tileID,type:"icons"},(t,e)=>{d||(d=t,m=e,v.call(this))}):m={};const x=Object.keys(h.patternDependencies);function v(){if(d)return s(d);if(f&&m&&g){const e=new r(f),i=new t.ImageAtlas(m,g);for(const r in c){const o=c[r];o instanceof t.SymbolBucket?(a(o.layers,this.zoom,n),t.performSymbolLayout(o,f,e.positions,m,i.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):o.hasPattern&&(o instanceof t.LineBucket||o instanceof t.FillBucket||o instanceof t.FillExtrusionBucket)&&(a(o.layers,this.zoom,n),o.addFeatures(h,this.tileID.canonical,i.patternPositions))}this.status="done",s(null,{buckets:Object.values(c).filter(t=>!t.isEmpty()),featureIndex:u,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:i,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?m:null,glyphPositions:this.returnDependencies?e.positions:null})}}x.length?o.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},(t,e)=>{d||(d=t,g=e,v.call(this))}):g={},v.call(this)}}function a(e,i,n){const r=new t.EvaluationParameters(i);for(const t of e)t.recalculate(r,n)}function s(e,i){const n=t.getArrayBuffer(e.request,(e,n,r,o)=>{e?i(e):n&&i(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(n)),rawData:n,cacheControl:r,expires:o})});return()=>{n.cancel(),i()}}class l{constructor(t,e,i,n){this.actor=t,this.layerIndex=e,this.availableImages=i,this.loadVectorData=n||s,this.loading={},this.loaded={}}loadTile(e,i){const n=e.uid;this.loading||(this.loading={});const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),a=this.loading[n]=new o(e);a.abort=this.loadVectorData(e,(e,o)=>{if(delete this.loading[n],e||!o)return a.status="done",this.loaded[n]=a,i(e);const s=o.rawData,l={};o.expires&&(l.expires=o.expires),o.cacheControl&&(l.cacheControl=o.cacheControl);const u={};if(r){const t=r.finish();t&&(u.resourceTiming=JSON.parse(JSON.stringify(t)))}a.vectorTile=o.vectorTile,a.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,(e,n)=>{if(e||!n)return i(e);i(null,t.extend({rawTileData:s.slice(0)},n,l,u))}),this.loaded=this.loaded||{},this.loaded[n]=a})}reloadTile(t,e){const i=this.loaded,n=t.uid,r=this;if(i&&i[n]){const o=i[n];o.showCollisionBoxes=t.showCollisionBoxes;const a=(t,i)=>{const n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,r.layerIndex,this.availableImages,r.actor,n)),e(t,i)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}abortTile(t,e){const i=this.loading,n=t.uid;i&&i[n]&&i[n].abort&&(i[n].abort(),delete i[n]),e()}removeTile(t,e){const i=this.loaded,n=t.uid;i&&i[n]&&delete i[n],e()}}class u{constructor(){this.loaded={}}loadTile(e,i){const{uid:n,encoding:r,rawImageData:o}=e,a=t.isImageBitmap(o)?this.getImageData(o):o,s=new t.DEMData(n,a,r);this.loaded=this.loaded||{},this.loaded[n]=s,i(null,s)}getImageData(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:i.width,height:i.height},i.data)}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}var c=function t(e,i){var n,r=e&&e.type;if("FeatureCollection"===r)for(n=0;n<e.features.length;n++)t(e.features[n],i);else if("GeometryCollection"===r)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],i);else if("Feature"===r)t(e.geometry,i);else if("Polygon"===r)h(e.coordinates,i);else if("MultiPolygon"===r)for(n=0;n<e.coordinates.length;n++)h(e.coordinates[n],i);return e};function h(t,e){if(0!==t.length){p(t[0],e);for(var i=1;i<t.length;i++)p(t[i],!e)}}function p(t,e){for(var i=0,n=0,r=0,o=t.length,a=o-1;r<o;a=r++){var s=(t[r][0]-t[a][0])*(t[a][1]+t[r][1]),l=i+s;n+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+n>=0!=!!e&&t.reverse()}const d=t.vectorTile.VectorTileFeature.prototype.toGeoJSON;class f{constructor(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const i of this._feature.geometry)e.push([new t.pointGeometry(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const n=[];for(const e of i)n.push(new t.pointGeometry(e[0],e[1]));e.push(n)}return e}}toGeoJSON(t,e,i){return d.call(this,t,e,i)}}class m{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e}feature(t){return new f(this._features[t])}}var g={exports:{}},_=t.pointGeometry,y=t.vectorTile.VectorTileFeature,x=v;function v(t,e){this.options=e||{},this.features=t,this.length=t.length}function b(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}v.prototype.feature=function(t){return new b(this.features[t],this.options.extent)},b.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var i=t[e],n=[],r=0;r<i.length;r++)n.push(new _(i[r][0],i[r][1]));this.geometry.push(n)}return this.geometry},b.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,n=1/0,r=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),i=Math.max(i,l.x),n=Math.min(n,l.y),r=Math.max(r,l.y)}return[e,n,i,r]},b.prototype.toGeoJSON=y.prototype.toGeoJSON;var w=t.pbf,S=x;function T(t){var e=new w;return function(t,e){for(var i in t.layers)e.writeMessage(3,E,t.layers[i])}(t,e),e.finish()}function E(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)n.feature=t.feature(i),e.writeMessage(2,A,n);var r=n.keys;for(i=0;i<r.length;i++)e.writeStringField(3,r[i]);var o=n.values;for(i=0;i<o.length;i++)e.writeMessage(4,k,o[i])}function A(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,I,t),e.writeVarintField(3,i.type),e.writeMessage(4,M,i)}function I(t,e){var i=t.feature,n=t.keys,r=t.values,o=t.keycache,a=t.valuecache;for(var s in i.properties){var l=i.properties[s],u=o[s];if(null!==l){void 0===u&&(n.push(s),o[s]=u=n.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=a[h];void 0===p&&(r.push(l),a[h]=p=r.length-1),e.writeVarint(p)}}}function C(t,e){return(e<<3)+(7&t)}function P(t){return t<<1^t>>31}function M(t,e){for(var i=t.loadGeometry(),n=t.type,r=0,o=0,a=i.length,s=0;s<a;s++){var l=i[s],u=1;1===n&&(u=l.length),e.writeVarint(C(1,u));for(var c=3===n?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(C(2,c-1));var p=l[h].x-r,d=l[h].y-o;e.writeVarint(P(p)),e.writeVarint(P(d)),r+=p,o+=d}3===n&&e.writeVarint(C(7,1))}}function k(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}g.exports=T,g.exports.fromVectorTileJs=T,g.exports.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var n in t)i[n]=new S(t[n].features,e),i[n].name=n,i[n].version=e.version,i[n].extent=e.extent;return T({layers:i})},g.exports.GeoJSONWrapper=S;var z=g.exports;function L(t,e,i,n,r,o){if(r-n<=i)return;const a=n+r>>1;(function t(e,i,n,r,o,a){for(;o>r;){if(o-r>600){const s=o-r+1,l=n-r+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1);t(e,i,n,Math.max(r,Math.floor(n-l*c/s+h)),Math.min(o,Math.floor(n+(s-l)*c/s+h)),a)}const s=i[2*n+a];let l=r,u=o;for(B(e,i,r,n),i[2*o+a]>s&&B(e,i,r,o);l<u;){for(B(e,i,l,u),l++,u--;i[2*l+a]<s;)l++;for(;i[2*u+a]>s;)u--}i[2*r+a]===s?B(e,i,r,u):(u++,B(e,i,u,o)),u<=n&&(r=u+1),n<=u&&(o=u-1)}})(t,e,a,n,r,o%2),L(t,e,i,n,a-1,o+1),L(t,e,i,a+1,r,o+1)}function B(t,e,i,n){D(t,i,n),D(e,2*i,2*n),D(e,2*i+1,2*n+1)}function D(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function R(t,e,i,n){const r=t-i,o=e-n;return r*r+o*o}const O=t=>t[0],F=t=>t[1];class U{constructor(t,e=O,i=F,n=64,r=Float64Array){this.nodeSize=n,this.points=t;const o=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(t.length),s=this.coords=new r(2*t.length);for(let n=0;n<t.length;n++)a[n]=n,s[2*n]=e(t[n]),s[2*n+1]=i(t[n]);L(a,s,n,0,a.length-1,0)}range(t,e,i,n){return function(t,e,i,n,r,o,a){const s=[0,t.length-1,0],l=[];let u,c;for(;s.length;){const h=s.pop(),p=s.pop(),d=s.pop();if(p-d<=a){for(let a=d;a<=p;a++)u=e[2*a],c=e[2*a+1],u>=i&&u<=r&&c>=n&&c<=o&&l.push(t[a]);continue}const f=Math.floor((d+p)/2);u=e[2*f],c=e[2*f+1],u>=i&&u<=r&&c>=n&&c<=o&&l.push(t[f]);const m=(h+1)%2;(0===h?i<=u:n<=c)&&(s.push(d),s.push(f-1),s.push(m)),(0===h?r>=u:o>=c)&&(s.push(f+1),s.push(p),s.push(m))}return l}(this.ids,this.coords,t,e,i,n,this.nodeSize)}within(t,e,i){return function(t,e,i,n,r,o){const a=[0,t.length-1,0],s=[],l=r*r;for(;a.length;){const u=a.pop(),c=a.pop(),h=a.pop();if(c-h<=o){for(let r=h;r<=c;r++)R(e[2*r],e[2*r+1],i,n)<=l&&s.push(t[r]);continue}const p=Math.floor((h+c)/2),d=e[2*p],f=e[2*p+1];R(d,f,i,n)<=l&&s.push(t[p]);const m=(u+1)%2;(0===u?i-r<=d:n-r<=f)&&(a.push(h),a.push(p-1),a.push(m)),(0===u?i+r>=d:n+r>=f)&&(a.push(p+1),a.push(c),a.push(m))}return s}(this.ids,this.coords,t,e,i,this.nodeSize)}}const j={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},N=Math.fround||(V=new Float32Array(1),t=>(V[0]=+t,V[0]));var V;class G{constructor(t){this.options=J(Object.create(j),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:i,maxZoom:n,nodeSize:r}=this.options;e&&console.time("total time");const o=`prepare ${t.length} points`;e&&console.time(o),this.points=t;let a=[];for(let e=0;e<t.length;e++)t[e].geometry&&a.push(W(t[e],e));this.trees[n+1]=new U(a,Y,Q,r,Float32Array),e&&console.timeEnd(o);for(let t=n;t>=i;t--){const i=+Date.now();a=this._cluster(a,t),this.trees[t]=new U(a,Y,Q,r,Float32Array),e&&console.log("z%d: %d clusters in %dms",t,a.length,+Date.now()-i)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let r=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,r=180;else if(i>r){const t=this.getClusters([i,n,180,o],e),a=this.getClusters([-180,n,r,o],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],s=a.range($(i),X(o),$(r),X(n)),l=[];for(const t of s){const e=a.points[t];l.push(e.numPoints?Z(e):this.points[e.index])}return l}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),n="No cluster with the specified id.",r=this.trees[i];if(!r)throw new Error(n);const o=r.points[e];if(!o)throw new Error(n);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=r.within(o.x,o.y,a),l=[];for(const e of s){const i=r.points[e];i.parentId===t&&l.push(i.numPoints?Z(i):this.points[i.index])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,i){const n=[];return this._appendLeaves(n,t,e=e||10,i=i||0,0),n}getTile(t,e,i){const n=this.trees[this._limitZoom(t)],r=Math.pow(2,t),{extent:o,radius:a}=this.options,s=a/o,l=(i-s)/r,u=(i+1+s)/r,c={features:[]};return this._addTileFeatures(n.range((e-s)/r,l,(e+1+s)/r,u),n.points,e,i,r,c),0===e&&this._addTileFeatures(n.range(1-s/r,l,1,u),n.points,r,i,r,c),e===r-1&&this._addTileFeatures(n.range(0,l,s/r,u),n.points,-1,i,r,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,n,r){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?r+o.point_count<=n?r+=o.point_count:r=this._appendLeaves(t,o.cluster_id,i,n,r):r<n?r++:t.push(e),t.length===i)break}return r}_addTileFeatures(t,e,i,n,r,o){for(const a of t){const t=e[a],s=t.numPoints;let l,u,c;if(s)l=H(t),u=t.x,c=t.y;else{const e=this.points[t.index];l=e.properties,u=$(e.geometry.coordinates[0]),c=X(e.geometry.coordinates[1])}const h={type:1,geometry:[[Math.round(this.options.extent*(u*r-i)),Math.round(this.options.extent*(c*r-n))]],tags:l};let p;s?p=t.id:this.options.generateId?p=t.index:this.points[t.index].id&&(p=this.points[t.index].id),void 0!==p&&(h.id=p),o.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))}_cluster(t,e){const i=[],{radius:n,extent:r,reduce:o,minPoints:a}=this.options,s=n/(r*Math.pow(2,e));for(let n=0;n<t.length;n++){const r=t[n];if(r.zoom<=e)continue;r.zoom=e;const l=this.trees[e+1],u=l.within(r.x,r.y,s),c=r.numPoints||1;let h=c;for(const t of u){const i=l.points[t];i.zoom>e&&(h+=i.numPoints||1)}if(h>c&&h>=a){let t=r.x*c,a=r.y*c,s=o&&c>1?this._map(r,!0):null;const p=(n<<5)+(e+1)+this.points.length;for(const i of u){const n=l.points[i];if(n.zoom<=e)continue;n.zoom=e;const u=n.numPoints||1;t+=n.x*u,a+=n.y*u,n.parentId=p,o&&(s||(s=this._map(r,!0)),o(s,this._map(n)))}r.parentId=p,i.push(q(t/h,a/h,p,h,s))}else if(i.push(r),h>1)for(const t of u){const n=l.points[t];n.zoom<=e||(n.zoom=e,i.push(n))}}return i}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?J({},t.properties):t.properties;const i=this.points[t.index].properties,n=this.options.map(i);return e&&n===i?J({},n):n}}function q(t,e,i,n,r){return{x:N(t),y:N(e),zoom:1/0,id:i,parentId:-1,numPoints:n,properties:r}}function W(t,e){const[i,n]=t.geometry.coordinates;return{x:N($(i)),y:N(X(n)),zoom:1/0,index:e,parentId:-1}}function Z(t){return{type:"Feature",id:t.id,properties:H(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),K(t.y)]}};var e}function H(t){const e=t.numPoints,i=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return J(J({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:i})}function $(t){return t/360+.5}function X(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function K(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function J(t,e){for(const i in e)t[i]=e[i];return t}function Y(t){return t.x}function Q(t){return t.y}function tt(t,e,i,n,r,o){var a=r-i,s=o-n;if(0!==a||0!==s){var l=((t-i)*a+(e-n)*s)/(a*a+s*s);l>1?(i=r,n=o):l>0&&(i+=a*l,n+=s*l)}return(a=t-i)*a+(s=e-n)*s}function et(t,e,i,n){var r={id:void 0===t?null:t,type:e,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)it(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var n=0;n<e.length;n++)it(t,e[n]);else if("MultiPolygon"===i)for(n=0;n<e.length;n++)for(var r=0;r<e[n].length;r++)it(t,e[n][r])}(r),r}function it(t,e){for(var i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function nt(t,e,i,n){if(e.geometry){var r=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),s=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=n||0),"Point"===o)rt(r,s);else if("MultiPoint"===o)for(var u=0;u<r.length;u++)rt(r[u],s);else if("LineString"===o)ot(r,s,a,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(u=0;u<r.length;u++)ot(r[u],s=[],a,!1),t.push(et(l,"LineString",s,e.properties));return}at(r,s,a,!1)}else if("Polygon"===o)at(r,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(u=0;u<e.geometry.geometries.length;u++)nt(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},i,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<r.length;u++){var c=[];at(r[u],c,a,!0),s.push(c)}}t.push(et(l,o,s,e.properties))}}function rt(t,e){e.push(st(t[0])),e.push(lt(t[1])),e.push(0)}function ot(t,e,i,n){for(var r,o,a=0,s=0;s<t.length;s++){var l=st(t[s][0]),u=lt(t[s][1]);e.push(l),e.push(u),e.push(0),s>0&&(a+=n?(r*u-l*o)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(u-o,2))),r=l,o=u}var c=e.length-3;e[2]=1,function t(e,i,n,r){for(var o,a=r,s=n-i>>1,l=n-i,u=e[i],c=e[i+1],h=e[n],p=e[n+1],d=i+3;d<n;d+=3){var f=tt(e[d],e[d+1],u,c,h,p);if(f>a)o=d,a=f;else if(f===a){var m=Math.abs(d-s);m<l&&(o=d,l=m)}}a>r&&(o-i>3&&t(e,i,o,r),e[o+2]=a,n-o>3&&t(e,o,n,r))}(e,0,c,i),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function at(t,e,i,n){for(var r=0;r<t.length;r++){var o=[];ot(t[r],o,i,n),e.push(o)}}function st(t){return t/360+.5}function lt(t){var e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function ut(t,e,i,n,r,o,a,s){if(n/=e,o>=(i/=e)&&a<n)return t;if(a<i||o>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,d=0===r?c.minX:c.minY,f=0===r?c.maxX:c.maxY;if(d>=i&&f<n)l.push(c);else if(!(f<i||d>=n)){var m=[];if("Point"===p||"MultiPoint"===p)ct(h,m,i,n,r);else if("LineString"===p)ht(h,m,i,n,r,!1,s.lineMetrics);else if("MultiLineString"===p)dt(h,m,i,n,r,!1);else if("Polygon"===p)dt(h,m,i,n,r,!0);else if("MultiPolygon"===p)for(var g=0;g<h.length;g++){var _=[];dt(h[g],_,i,n,r,!0),_.length&&m.push(_)}if(m.length){if(s.lineMetrics&&"LineString"===p){for(g=0;g<m.length;g++)l.push(et(c.id,p,m[g],c.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===m.length?(p="LineString",m=m[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===m.length?"Point":"MultiPoint"),l.push(et(c.id,p,m,c.tags))}}}return l.length?l:null}function ct(t,e,i,n,r){for(var o=0;o<t.length;o+=3){var a=t[o+r];a>=i&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function ht(t,e,i,n,r,o,a){for(var s,l,u=pt(t),c=0===r?mt:gt,h=t.start,p=0;p<t.length-3;p+=3){var d=t[p],f=t[p+1],m=t[p+2],g=t[p+3],_=t[p+4],y=0===r?d:f,x=0===r?g:_,v=!1;a&&(s=Math.sqrt(Math.pow(d-g,2)+Math.pow(f-_,2))),y<i?x>i&&(l=c(u,d,f,g,_,i),a&&(u.start=h+s*l)):y>n?x<n&&(l=c(u,d,f,g,_,n),a&&(u.start=h+s*l)):ft(u,d,f,m),x<i&&y>=i&&(l=c(u,d,f,g,_,i),v=!0),x>n&&y<=n&&(l=c(u,d,f,g,_,n),v=!0),!o&&v&&(a&&(u.end=h+s*l),e.push(u),u=pt(t)),a&&(h+=s)}var b=t.length-3;d=t[b],f=t[b+1],m=t[b+2],(y=0===r?d:f)>=i&&y<=n&&ft(u,d,f,m),b=u.length-3,o&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&ft(u,u[0],u[1],u[2]),u.length&&e.push(u)}function pt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function dt(t,e,i,n,r,o){for(var a=0;a<t.length;a++)ht(t[a],e,i,n,r,o,!1)}function ft(t,e,i,n){t.push(e),t.push(i),t.push(n)}function mt(t,e,i,n,r,o){var a=(o-e)/(n-e);return t.push(o),t.push(i+(r-i)*a),t.push(1),a}function gt(t,e,i,n,r,o){var a=(o-i)/(r-i);return t.push(e+(n-e)*a),t.push(o),t.push(1),a}function _t(t,e){for(var i=[],n=0;n<t.length;n++){var r,o=t[n],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)r=yt(o.geometry,e);else if("MultiLineString"===a||"Polygon"===a){r=[];for(var s=0;s<o.geometry.length;s++)r.push(yt(o.geometry[s],e))}else if("MultiPolygon"===a)for(r=[],s=0;s<o.geometry.length;s++){for(var l=[],u=0;u<o.geometry[s].length;u++)l.push(yt(o.geometry[s][u],e));r.push(l)}i.push(et(o.id,a,r,o.tags))}return i}function yt(t,e){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var n=0;n<t.length;n+=3)i.push(t[n]+e,t[n+1],t[n+2]);return i}function xt(t,e){if(t.transformed)return t;var i,n,r,o=1<<t.z,a=t.x,s=t.y;for(i=0;i<t.features.length;i++){var l=t.features[i],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(vt(u[n],u[n+1],e,o,a,s));else for(n=0;n<u.length;n++){var h=[];for(r=0;r<u[n].length;r+=2)h.push(vt(u[n][r],u[n][r+1],e,o,a,s));l.geometry.push(h)}}return t.transformed=!0,t}function vt(t,e,i,n,r,o){return[Math.round(i*(t*n-r)),Math.round(i*(e*n-o))]}function bt(t,e,i,n,r){for(var o=e===r.maxZoom?0:r.tolerance/((1<<e)*r.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,wt(a,t[s],o,r);var l=t[s].minX,u=t[s].minY,c=t[s].maxX,h=t[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function wt(t,e,i,n){var r=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s<r.length;s+=3)a.push(r[s]),a.push(r[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)St(a,r,t,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<r.length;s++)St(a,r[s],t,i,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(var l=0;l<r.length;l++){var u=r[l];for(s=0;s<u.length;s++)St(a,u[s],t,i,!0,0===s)}if(a.length){var c=e.tags||null;if("LineString"===o&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=r.start/r.size,c.mapbox_clip_end=r.end/r.size}var p={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function St(t,e,i,n,r,o){var a=n*n;if(n>0&&e.size<(r?a:n))i.numPoints+=e.length/3;else{for(var s=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>a)&&(i.numSimplified++,s.push(e[l]),s.push(e[l+1])),i.numPoints++;r&&function(t,e){for(var i=0,n=0,r=t.length,o=r-2;n<r;o=n,n+=2)i+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(i>0===e)for(n=0,r=t.length;n<r/2;n+=2){var a=t[n],s=t[n+1];t[n]=t[r-2-n],t[n+1]=t[r-1-n],t[r-2-n]=a,t[r-1-n]=s}}(s,o),t.push(s)}}function Tt(t,e){var i=(e=this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(Object.create(this.options),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)nt(i,t.features[n],e,n);else nt(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=function(t,e){var i=e.buffer/e.extent,n=t,r=ut(t,1,-1-i,i,0,-1,2,e),o=ut(t,1,1-i,2+i,0,-1,2,e);return(r||o)&&(n=ut(t,1,-i,1+i,0,-1,2,e)||[],r&&(n=_t(r,1).concat(n)),o&&(n=n.concat(_t(o,-1)))),n}(n,e)).length&&this.splitTile(n,0,0,0),i&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Et(t,e,i){return 32*((1<<t)*i+e)+t}function At(t,e){const i=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);const n=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!n)return e(null,null);const r=new m(n.features);let o=z(r);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:r,rawData:o.buffer})}Tt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Tt.prototype.splitTile=function(t,e,i,n,r,o,a){for(var s=[t,e,i,n],l=this.options,u=l.debug;s.length;){n=s.pop(),i=s.pop(),e=s.pop(),t=s.pop();var c=1<<e,h=Et(e,i,n),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=bt(t,e,i,n,l),this.tileCoords.push({z:e,x:i,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(p.source=t,r){if(e===l.maxZoom||e===r)continue;var f=1<<r-e;if(i!==Math.floor(o/f)||n!==Math.floor(a/f))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){u>1&&console.time("clipping");var m,g,_,y,x,v,b=.5*l.buffer/l.extent,w=.5-b,S=.5+b,T=1+b;m=g=_=y=null,x=ut(t,c,i-b,i+S,0,p.minX,p.maxX,l),v=ut(t,c,i+w,i+T,0,p.minX,p.maxX,l),t=null,x&&(m=ut(x,c,n-b,n+S,1,p.minY,p.maxY,l),g=ut(x,c,n+w,n+T,1,p.minY,p.maxY,l),x=null),v&&(_=ut(v,c,n-b,n+S,1,p.minY,p.maxY,l),y=ut(v,c,n+w,n+T,1,p.minY,p.maxY,l),v=null),u>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*i,2*n),s.push(g||[],e+1,2*i,2*n+1),s.push(_||[],e+1,2*i+1,2*n),s.push(y||[],e+1,2*i+1,2*n+1)}}},Tt.prototype.getTile=function(t,e,i){var n=this.options,r=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<<t,s=Et(t,e=(e%a+a)%a,i);if(this.tiles[s])return xt(this.tiles[s],r);o>1&&console.log("drilling down to z%d-%d-%d",t,e,i);for(var l,u=t,c=e,h=i;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Et(u,c,h)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,h),o>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,i),o>1&&console.timeEnd("drilling down"),this.tiles[s]?xt(this.tiles[s],r):null):null};class It extends l{constructor(t,e,i,n){super(t,e,i,At),n&&(this.loadGeoJSON=n)}loadData(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;const e=this._pendingCallback,i=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;const n=!!(i&&i.request&&i.request.collectResourceTiming)&&new t.RequestPerformance(i.request);this.loadGeoJSON(i,(r,o)=>{if(r||!o)return e(r);if("object"!=typeof o)return e(new Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));{c(o,!0);try{if(i.filter){const e=t.createExpression(i.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===e.result)throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));const n=o.features.filter(t=>e.value.evaluate({zoom:0},t));o={type:"FeatureCollection",features:n}}this._geoJSONIndex=i.cluster?new G(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const n={},r={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(i);for(const e of s){const[o,a]=i[e],s=t.createExpression(a),l=t.createExpression("string"==typeof o?[o,["accumulated"],["get",e]]:o);n[e]=s.value,r[e]=l.value}return e.map=t=>{a.properties=t;const e={};for(const t of s)e[t]=n[t].evaluate(o,a);return e},e.reduce=(t,e)=>{a.properties=e;for(const e of s)o.accumulated=t[e],t[e]=r[e].evaluate(o,a)},e}(i)).load(o.features):function(t,e){return new Tt(t,e)}(o,i.geojsonVtOptions)}catch(r){return e(r)}this.loaded={};const a={};if(n){const t=n.finish();t&&(a.resourceTiming={},a.resourceTiming[i.source]=JSON.parse(JSON.stringify(t)))}e(null,a)}})}coalesce(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())}reloadTile(t,e){const i=this.loaded;return i&&i[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}loadGeoJSON(e,i){if(e.request)t.getJSON(e.request,i);else{if("string"!=typeof e.data)return i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));try{return i(null,JSON.parse(e.data))}catch(t){return i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}}}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class Ct{constructor(e){this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:l,geojson:It},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,i){this.availableImages[t]=e;for(const i in this.workerSources[t]){const n=this.workerSources[t][i];for(const t in n)n[t].availableImages=e}i()}setLayers(t,e,i){this.getLayerIndex(t).replace(e),i()}updateLayers(t,e,i){this.getLayerIndex(t).update(e.layers,e.removedIds),i()}loadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).loadTile(e,i)}loadDEMTile(t,e,i){this.getDEMWorkerSource(t,e.source).loadTile(e,i)}reloadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).reloadTile(e,i)}abortTile(t,e,i){this.getWorkerSource(t,e.type,e.source).abortTile(e,i)}removeTile(t,e,i){this.getWorkerSource(t,e.type,e.source).removeTile(e,i)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,i){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,i):i()}loadWorkerSource(t,e,i){try{this.self.importScripts(e.url),i()}catch(t){i(t.toString())}}syncRTLPluginState(e,i,n){try{t.plugin.setState(i);const e=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=e){this.self.importScripts(e);const i=t.plugin.isParsed();n(i?void 0:new Error("RTL Text Plugin failed to import scripts from "+e),i)}}catch(e){n(e.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new n),e}getWorkerSource(t,e,i){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){const n={send:(e,i,n)=>{this.actor.send(e,i,n,t)}};this.workerSources[t][e][i]=new this.workerSourceTypes[e](n,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][e][i]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new u),this.demWorkerSources[t][e]}enforceCacheSizeLimit(e,i){t.enforceCacheSizeLimit(i)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Ct(self)),Ct})),n(0,(function(t){var e=i;function i(t){return!function(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,i=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(i);try{e=new Worker(n),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(n),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var i=e.getImageData(0,0,1,1);return i&&i.width===t.width}()?(void 0===n[e=t&&t.failIfMajorPerformanceCaveat]&&(n[e]=function(t){var e,n=function(t){var e=document.createElement("canvas"),n=Object.create(i.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,e.getContext("webgl",n)||e.getContext("experimental-webgl",n)}(t);if(!n)return!1;try{e=n.createShader(n.VERTEX_SHADER)}catch(t){return!1}return!(!e||n.isContextLost())&&(n.shaderSource(e,"void main() {}"),n.compileShader(e),!0===n.getShaderParameter(e,n.COMPILE_STATUS))}(e)),n[e]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var e}(t)}var n={};function r(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!r(t[i],e[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(!r(t[i],e[i]))return!1;return!0}return t===e}i.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class o{static testProp(t){if(!o.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in o.docStyle)return t[e];return t[0]}static create(t,e,i){const n=window.document.createElement(t);return void 0!==e&&(n.className=e),i&&i.appendChild(n),n}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){o.docStyle&&o.selectProp&&(o.userSelect=o.docStyle[o.selectProp],o.docStyle[o.selectProp]="none")}static enableDrag(){o.docStyle&&o.selectProp&&(o.docStyle[o.selectProp]=o.userSelect)}static setTransform(t,e){t.style[o.transformProp]=e}static addEventListener(t,e,i,n={}){t.addEventListener(e,i,"passive"in n?n:n.capture)}static removeEventListener(t,e,i,n={}){t.removeEventListener(e,i,"passive"in n?n:n.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",o.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",o.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",o.suppressClickInternal,!0)},0)}static mousePos(e,i){const n=e.getBoundingClientRect();return new t.pointGeometry(i.clientX-n.left-e.clientLeft,i.clientY-n.top-e.clientTop)}static touchPos(e,i){const n=e.getBoundingClientRect(),r=[];for(let o=0;o<i.length;o++)r.push(new t.pointGeometry(i[o].clientX-n.left-e.clientLeft,i[o].clientY-n.top-e.clientTop));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}o.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,o.selectProp=o.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),o.transformProp=o.testProp(["transform","WebkitTransform"]);class a{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,i){const n=function(t){const e=t.match(s);if(!e)throw new Error(`Unable to parse URL "${t}"`);return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}(t);return n.path+=`${e}${i}`,function(t){const e=t.params.length?"?"+t.params.join("&"):"";return`${t.protocol}://${t.authority}${t.path}${e}`}(n)}setTransformRequest(t){this._transformRequestFn=t}}const s=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function l(e){var i=new t.ARRAY_TYPE(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}var u,c=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t};u=new t.ARRAY_TYPE(3),t.ARRAY_TYPE!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var h=function(t){var e=t[0],i=t[1];return e*e+i*i};!function(){var e=new t.ARRAY_TYPE(2);t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0)}();class p{constructor(t,e,i,n){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,n)}update(e,i,n){const{width:r,height:o}=e,a=!(this.size&&this.size[0]===r&&this.size[1]===o||n),{context:s}=this,{gl:l}=s;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),a)this.size=[r,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,r,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:a}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,a,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,a,r,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:n}=this,{gl:r}=n;r.bindTexture(r.TEXTURE_2D,this.texture),i!==r.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=r.LINEAR),t!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function d(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class f extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,e){this._validate(t,e)&&(this.images[t]=e)}_validate(e,i){let n=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),n=!1),n}_validateStretch(t,e){if(!t)return!0;let i=0;for(const n of t){if(n[0]<i||n[1]<n[0]||e<n[1])return!1;i=n[1]}return!0}_validateContent(t,e){return!(t&&(4!==t.length||t[0]<0||e.data.width<t[0]||t[1]<0||e.data.height<t[1]||t[2]<0||e.data.width<t[2]||t[3]<0||e.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,e){e.version=this.images[t].version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,e){let i=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e})}_notify(e,i){const n={};for(const i of e){this.images[i]||this.fire(new t.Event("styleimagemissing",{id:i}));const e=this.images[i];e?n[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.warnOnce(`Image "${i}" 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.`)}i(null,n)}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(e){const i=this.patterns[e],n=this.getImage(e);if(!n)return null;if(i&&i.position.version===n.version)return i.position;if(i)i.position.version=n.version;else{const i={w:n.data.width+2,h:n.data.height+2,x:0,y:0},r=new t.ImagePosition(i,n);this.patterns[e]={bin:i,position:r}}return this._updatePatternAtlas(),this.patterns[e].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new p(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:n}=t.potpack(e),r=this.atlasImage;r.resize({width:i||1,height:n||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],n=i.x+1,o=i.y+1,a=this.images[e].data,s=a.width,l=a.height;t.RGBAImage.copy(a,r,{x:0,y:0},{x:n,y:o},{width:s,height:l}),t.RGBAImage.copy(a,r,{x:0,y:l-1},{x:n,y:o-1},{width:s,height:1}),t.RGBAImage.copy(a,r,{x:0,y:0},{x:n,y:o+l},{width:s,height:1}),t.RGBAImage.copy(a,r,{x:s-1,y:0},{x:n-1,y:o},{width:1,height:l}),t.RGBAImage.copy(a,r,{x:0,y:0},{x:n+s,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const e of t){if(this.callbackDispatchedThisFrame[e])continue;this.callbackDispatchedThisFrame[e]=!0;const t=this.images[e];d(t)&&this.updateImage(e,t)}}}const m=1e20;function g(t,e,i,n,r,o,a,s,l){for(let u=e;u<e+n;u++)_(t,i*o+u,o,r,a,s,l);for(let u=i;u<i+r;u++)_(t,u*o+e,1,n,a,s,l)}function _(t,e,i,n,r,o,a){o[0]=0,a[0]=-m,a[1]=m,r[0]=t[e];for(let s=1,l=0,u=0;s<n;s++){r[s]=t[e+s*i];const n=s*s;do{const t=o[l];u=(r[s]-r[t]+n-t*t)/(s-t)/2}while(u<=a[l]&&--l>-1);l++,o[l]=s,a[l]=u,a[l+1]=m}for(let s=0,l=0;s<n;s++){for(;a[l+1]<s;)l++;const n=o[l],u=s-n;t[e+s*i]=r[n]+u*u}}class y{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(e,i){const n=[];for(const t in e)for(const i of e[t])n.push({stack:t,id:i});t.asyncAll(n,({stack:t,id:e},i)=>{let n=this.entries[t];n||(n=this.entries[t]={glyphs:{},requests:{},ranges:{}});let r=n.glyphs[e];if(void 0!==r)return void i(null,{stack:t,id:e,glyph:r});if(r=this._tinySDF(n,t,e),r)return n.glyphs[e]=r,void i(null,{stack:t,id:e,glyph:r});const o=Math.floor(e/256);if(256*o>65535)return void i(new Error("glyphs > 65535 not supported"));if(n.ranges[o])return void i(null,{stack:t,id:e,glyph:r});let a=n.requests[o];a||(a=n.requests[o]=[],y.loadGlyphRange(t,o,this.url,this.requestManager,(t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(n.glyphs[+t]=e[+t]);n.ranges[o]=!0}for(const i of a)i(t,e);delete n.requests[o]})),a.push((n,r)=>{n?i(n):r&&i(null,{stack:t,id:e,glyph:r[e]||null})})},(t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:n,glyph:r}of e)(t[i]||(t[i]={}))[n]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics};i(null,t)}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(t.unicodeBlockLookup["CJK Unified Ideographs"](e)||t.unicodeBlockLookup["Hangul Syllables"](e)||t.unicodeBlockLookup.Hiragana(e)||t.unicodeBlockLookup.Katakana(e))}_tinySDF(e,i,n){const r=this.localIdeographFontFamily;if(!r)return;if(!this._doesCharSupportLocalGlyph(n))return;let o=e.tinySDF;if(!o){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),o=e.tinySDF=new y.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:r,fontWeight:t})}const a=o.draw(String.fromCharCode(n));return{id:n,bitmap:new t.AlphaImage({width:a.width||30,height:a.height||30},a.data),metrics:{width:a.glyphWidth||24,height:a.glyphHeight||24,left:a.glyphLeft||0,top:a.glyphTop-27||-8,advance:a.glyphAdvance||24}}}}y.loadGlyphRange=function(e,i,n,r,o){const a=256*i,s=a+255,l=r.transformRequest(n.replace("{fontstack}",e).replace("{range}",`${a}-${s}`),t.ResourceType.Glyphs);t.getArrayBuffer(l,(e,i)=>{if(e)o(e);else if(i){const e={};for(const n of t.parseGlyphPBF(i))e[n.id]=n;o(null,e)}})},y.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:r="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const s=this.size=t+4*e,l=this._createCanvas(s),u=this.ctx=l.getContext("2d",{willReadFrequently:!0});u.font=`${a} ${o} ${t}px ${r}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:r,actualBoundingBoxRight:o}=this.ctx.measureText(t),a=Math.ceil(i),s=Math.min(this.size-this.buffer,Math.ceil(o-r)),l=Math.min(this.size-this.buffer,a+Math.ceil(n)),u=s+2*this.buffer,c=l+2*this.buffer,h=Math.max(u*c,0),p=new Uint8ClampedArray(h),d={data:p,width:u,height:c,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===s||0===l)return d;const{ctx:f,buffer:_,gridInner:y,gridOuter:x}=this;f.clearRect(_,_,s,l),f.fillText(t,_,_+a);const v=f.getImageData(_,_,s,l);x.fill(m,0,h),y.fill(0,0,h);for(let t=0;t<l;t++)for(let e=0;e<s;e++){const i=v.data[4*(t*s+e)+3]/255;if(0===i)continue;const n=(t+_)*u+e+_;if(1===i)x[n]=0,y[n]=m;else{const t=.5-i;x[n]=t>0?t*t:0,y[n]=t<0?t*t:0}}g(x,0,0,u,c,u,this.f,this.v,this.z),g(y,_,_,s,l,u,this.f,this.v,this.z);for(let t=0;t<h;t++){const e=Math.sqrt(x[t])-Math.sqrt(y[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return d}};const x=new t.Properties({anchor:new t.DataConstantProperty(t.spec.light.anchor),position:new class{constructor(){this.specification=t.spec.light.position}possiblyEvaluate(e,i){return t.sphericalToCartesian(e.expression.evaluate(i))}interpolate(e,i,n){return{x:t.number(e.x,i.x,n),y:t.number(e.y,i.y,n),z:t.number(e.z,i.z,n)}}},color:new t.DataConstantProperty(t.spec.light.color),intensity:new t.DataConstantProperty(t.spec.light.intensity)}),v="-transition";class b extends t.Evented{constructor(e){super(),this._transitionable=new t.Transitionable(x),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.validateLight,e,i))for(const t in e){const i=e[t];t.endsWith(v)?this._transitionable.setTransition(t.slice(0,-v.length),i):this._transitionable.setValue(t,i)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(e,i,n){return(!n||!1!==n.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.spec})))}}class w{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const i=t.join(",")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]}getDashRanges(t,e,i){const n=[];let r=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,a=!0;n.push({left:r,right:o,isDash:a,zeroLength:0===t[0]});let s=t[0];for(let e=1;e<t.length;e++){a=!a;const l=t[e];r=s*i,s+=l,o=s*i,n.push({left:r,right:o,isDash:a,zeroLength:0===l})}return n}addRoundDash(t,e,i){const n=e/2;for(let e=-i;e<=i;e++){const r=this.width*(this.nextRow+i+e);let o=0,a=t[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=t[++o]);const l=Math.abs(s-a.left),u=Math.abs(s-a.right),c=Math.min(l,u);let h;const p=e/i*(n+1);if(a.isDash){const t=n-Math.abs(p);h=Math.sqrt(c*c+t*t)}else h=n-Math.sqrt(c*c+p*p);this.data[r+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],n=t[e+1];i.zeroLength?t.splice(e,1):n&&n.isDash===i.isDash&&(n.left=i.left,t.splice(e,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const n=this.width*this.nextRow;let r=0,o=t[r];for(let e=0;e<this.width;e++){e/o.right>1&&(o=t[++r]);const i=Math.abs(e-o.left),a=Math.abs(e-o.right),s=Math.min(i,a);this.data[n+e]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(e,i){const n=i?7:0,r=2*n+1;if(this.nextRow+r>this.height)return t.warnOnce("LineAtlas out of space"),null;let o=0;for(let t=0;t<e.length;t++)o+=e[t];if(0!==o){const t=this.width/o,r=this.getDashRanges(e,this.width,t);i?this.addRoundDash(r,t,n):this.addRegularDash(r)}const a={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:o};return this.nextRow+=r,this.dirty=!0,a}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}class S{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t.uniqueId();const n=this.workerPool.acquire(this.id);for(let t=0;t<n.length;t++){const e=new S.Actor(n[t],i,this.id);e.name="Worker "+t,this.actors.push(e)}}broadcast(e,i,n){t.asyncAll(this.actors,(t,n)=>{t.send(e,i,n)},n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function T(e,i,n){const r=function(i,r){if(i)return n(i);if(r){const i=t.pick(t.extend(r,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);r.vector_layers&&(i.vectorLayers=r.vector_layers,i.vectorLayerIds=i.vectorLayers.map(t=>t.id)),n(null,i)}};return e.url?t.getJSON(i.transformRequest(e.url,t.ResourceType.Source),r):t.exported.frame(()=>r(null,e))}S.Actor=t.Actor;class E{constructor(e,i,n){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=n||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),n=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),r=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=n&&e.x<o&&e.y>=r&&e.y<a}}class A extends t.Evented{constructor(e,i,n,r){if(super(),this.id=e,this.dispatcher=n,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(i,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=T(this._options,this.map._requestManager,(e,i)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new E(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(n,t.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function o(n,r){return delete e.request,e.aborted?i(null):n&&404!==n.status?i(n):(r&&r.resourceTiming&&(e.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&e.setExpiryData(r),e.loadVectorData(r,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}r.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=i:e.request=e.actor.send("reloadTile",r,o.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",r,o.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class I extends t.Evented{constructor(e,i,n,r){super(),this.id=e,this.dispatcher=n,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=T(this._options,this.map._requestManager,(e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new E(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),(n,r,o)=>{if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(n)e.state="errored",i(n);else if(r){this.map._refreshExpiredTiles&&e.setExpiryData(o);const n=this.map.painter.context,a=n.gl;e.texture=this.map.painter.getTileTexture(r.width),e.texture?e.texture.update(r,{useMipmap:!0}):(e.texture=new p(n,r,a.RGBA,{useMipmap:!0}),e.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST),n.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(this.dispatcher),i(null)}})}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}let C;class P extends I{constructor(e,i,n,r){super(e,i,n,r),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function r(t,n){t&&(e.state="errored",i(t)),n&&(e.dem=n,e.needsHillshadePrepare=!0,e.state="loaded",i(null))}e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),function(n,o){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(n)e.state="errored",i(n);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;const i=t.isImageBitmap(o)&&(null==C&&(C="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),C)?o:t.exported.getImageData(o,1),n={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",n,r.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)}_getNeighboringTiles(e){const i=e.canonical,n=Math.pow(2,i.z),r=(i.x-1+n)%n,o=0===i.x?e.wrap-1:e.wrap,a=(i.x+1+n)%n,s=i.x+1===n?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1}),i.y+1<n&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y+1).key]={backfilled:!1}),l}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class M extends t.Evented{constructor(e,i,n,r){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=n.getActor(),this.setEventedParent(r),this._data=i.data,this._options=t.extend({},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;const o=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*o,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*o,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.EXTENT,radius:(i.clusterRadius||50)*o,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,i,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},n),this}_updateWorkerData(e){const i=t.extend({},this.workerOptions),n=this._data;"string"==typeof n?(i.request=this.map._requestManager.transformRequest(t.exported.resolveURL(n),t.ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(n),this._pendingLoads++,this.fire(new t.Event("dataloading",{dataType:"source"})),this.actor.send(this.type+".loadData",i,(n,r)=>{if(this._pendingLoads--,this._removed||r&&r.abandoned)return;let o=null;if(r&&r.resourceTiming&&r.resourceTiming[this.id]&&(o=r.resourceTiming[this.id].slice(0)),this.actor.send(this.type+".coalesce",{source:i.source},null),n)return void this.fire(new t.ErrorEvent(n));const a={dataType:"source",sourceDataType:e};this._collectResourceTiming&&o&&o.length>0&&t.extend(a,{resourceTiming:o}),this.fire(new t.Event("data",a))})}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const n={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(i,n,(n,r)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):n?e(n):(t.loadVectorData(r,this.map.painter,"reloadTile"===i),e(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return t.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var k=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class z extends t.Evented{constructor(t,e,i,n){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=e}load(e,i){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(n,r)=>{this._loaded=!0,n?this.fire(new t.ErrorEvent(n)):r&&(this.image=r,e&&(this.coordinates=e),i&&i(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(e){this.coordinates=e;const i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),n=Math.min(n,t.y),r=Math.max(r,t.x),o=Math.max(o,t.y);const a=Math.max(r-i,o-n),s=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,s);return new t.CanonicalTileID(s,Math.floor((i+r)/2*l),Math.floor((n+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const n=i.map(t=>this.tileID.getTilePoint(t)._round());return this._boundsArray=new t.RasterBoundsArray,this._boundsArray.emplaceBack(n[0].x,n[0].y,0,0),this._boundsArray.emplaceBack(n[1].x,n[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(n[3].x,n[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(n[2].x,n[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("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.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,k.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new p(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class L extends z{constructor(t,e,i,n){super(t,e,i,n),this.roundZoom=!0,this.type="video",this.options=e}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,t.ResourceType.Source).url);t.getVideo(this.urls,(e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}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.ErrorEvent(new t.ValidationError("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}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,k.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),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 p(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class B extends z{constructor(e,i,n,r){super(e,i,n,r),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+e,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+e,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("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.ErrorEvent(new t.ValidationError("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.ErrorEvent(new t.ValidationError("sources."+e,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){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.ErrorEvent(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(t){this.map=t,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,n=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,k.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new p(i,this.canvas,n.RGBA,{premultiply:!0});for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const D={vector:A,raster:I,"raster-dem":P,geojson:M,video:L,image:z,canvas:B};function R(e,i){const n=t.create();return t.translate(n,n,[1,1,0]),t.scale(n,n,[.5*e.width,.5*e.height,1]),t.multiply(n,n,e.calculatePosMatrix(i.toUnwrapped()))}function O(t,e,i,n,r,o){const a=function(t,e,i){if(t)for(const n of t){const t=e[n];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const n=e[t];if(n.source===i&&"fill-extrusion"===n.type)return!0}return!1}(r&&r.layers,e,t.id),s=o.maxPitchScaleFactor(),l=t.tilesIn(n,s,a);l.sort(F);const u=[];for(const n of l)u.push({wrappedTileID:n.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(e,i,t._state,n.queryGeometry,n.cameraQueryGeometry,n.scale,r,o,s,R(t.transform,n.tileID))});const c=function(t){const e={},i={};for(const n of t){const t=n.queryResults,r=n.wrappedTileID,o=i[r]=i[r]||{};for(const i in t){const n=t[i],r=o[i]=o[i]||{},a=e[i]=e[i]||[];for(const t of n)r[t.featureIndex]||(r[t.featureIndex]=!0,a.push(t))}}return e}(u);for(const e in c)c[e].forEach(e=>{const i=e.feature,n=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=n});return c}function F(t,e){const i=t.tileID,n=e.tileID;return i.overscaledZ-n.overscaledZ||i.canonical.y-n.canonical.y||i.wrap-n.wrap||i.canonical.x-n.canonical.x}class U{constructor(e,i){this.tileID=e,this.uid=t.uniqueId(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<t.exported.now()||this.fadeEndTime&&i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}loadVectorData(e,i,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const n of t){const t=n.layerIds.map(t=>e.getLayer(t)).filter(Boolean);if(0!==t.length){n.layers=t,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(e=>t.filter(t=>t.id===e)[0]));for(const e of t)i[e.id]=n}}return i}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket){if(this.hasSymbolBuckets=!0,!n)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.SymbolBucket&&i.hasRTLText){this.hasRTLText=!0,t.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new p(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new p(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,n,r,o,a,s,l,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:r,scale:o,tileSize:this.tileSize,pixelPosMatrix:u,transform:s,params:a,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const r=n.loadVTLayers(),o=i?i.sourceLayer:"",a=r._geojsonTileLayer||r[o];if(!a)return;const s=t.createFilter(i&&i.filter),{z:l,x:u,y:c}=this.tileID.canonical,h={z:l,x:u,y:c};for(let i=0;i<a.length;i++){const r=a.feature(i);if(s.needGeometry){const e=t.toEvaluationFeature(r,!0);if(!s.filter(new t.EvaluationParameters(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.EvaluationParameters(this.tileID.overscaledZ),r))continue;const p=n.getId(r,o),d=new t.GeoJSONFeature(r,l,u,c,p);d.tile=h,e.push(d)}}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.parseCacheControl(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 t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else{const n=this.expirationTime-i;n?this.expirationTime=t+Math.max(n,3e4):e=!0}else e=!0;e?(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(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const n in this.buckets){if(!e.style.hasLayer(n))continue;const r=this.buckets[n],o=r.layers[0].sourceLayer||"_geojsonTileLayer",a=i[o],s=t[o];if(!a||!s||0===Object.keys(s).length)continue;r.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(n);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(r)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<t.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=t.exported.now()+e}setDependencies(t,e){const i={};for(const t of e)i[t]=!0;this.dependencies[t]=i}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return!0}return!1}}class j{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const n=t.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);const r={value:e,timeout:void 0};if(void 0!==i&&(r.timeout=setTimeout(()=>{this.remove(t,r)},i)),this.data[n].push(r),this.order.push(n),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,n=void 0===e?0:this.data[i].indexOf(e),r=this.data[i][n];return this.data[i].splice(n,1),r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(r.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const n of this.data[i])t(n.value)||e.push(n);for(const t of e)this.remove(t.value.tileID,t)}}class N{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,n){const r=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},t.extend(this.stateChanges[e][r],n),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==r&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][r]){this.deletedStates[e][r]={};for(const t in this.state[e][r])n[t]||(this.deletedStates[e][r][t]=null)}else for(const t in n)this.deletedStates[e]&&this.deletedStates[e][r]&&null===this.deletedStates[e][r][t]&&delete this.deletedStates[e][r][t]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const n=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][n])for(i in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][i]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}getState(e,i){const n=String(i),r=t.extend({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);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 r[e]}return r}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(e,i){const n={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const n in this.stateChanges[e])this.state[e][n]||(this.state[e][n]={}),t.extend(this.state[e][n],this.stateChanges[e][n]),i[n]=this.state[e][n];n[e]=i}for(const e in this.deletedStates){this.state[e]=this.state[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]}n[e]=n[e]||{},t.extend(n[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(const t in e)e[t].setFeatureState(n,i)}}class V extends t.Evented{constructor(e,i,n){super(),this.id=e,this.dispatcher=n,this.on("data",t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(e,i,n,r){const o=new D[i.type](e,i,n,r);if(o.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${o.id}`);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o}(e,i,n,this),this._tiles={},this._cache=new j(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new N}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,()=>{}),this._source.fire(new t.Event("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(G).map(t=>t.key)}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort((e,i)=>{const n=e.tileID,r=i.tileID,o=new t.pointGeometry(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),a=new t.pointGeometry(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-r.overscaledZ||a.y-o.y||a.x-o.x}).map(t=>t.tileID.key):i.map(t=>t.tileID).sort(G).map(t=>t.key)}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}}_reloadTile(t,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))}_tileLoaded(e,i,n,r){if(r)return e.state="errored",void(404!==r.status?this._source.fire(new t.ErrorEvent(r,{tile:e})):this.update(this.transform));e.timeAdded=t.exported.now(),"expired"===n&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let n=0;n<e.length;n++){const r=e[n];if(t.neighboringTiles&&t.neighboringTiles[r]){const e=this.getTileByID(r);i(t,e),i(e,t)}}function i(t,e){t.needsHillshadePrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const n=e.tileID.canonical.y-t.tileID.canonical.y,r=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===i&&0===n||Math.abs(n)>1||(Math.abs(i)>1&&(1===Math.abs(i+r)?i+=r:1===Math.abs(i-r)&&(i-=r)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,n),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,n){for(const r in this._tiles){let o=this._tiles[r];if(n[r]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(a=t)}let s=a;for(;s.overscaledZ>e;)if(s=s.scaledTo(s.overscaledZ-1),t[s.key]){n[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),n=this._getLoadedTile(e);if(n)return n}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(e*i*5),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(r)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}update(e){if(this.transform=e,!this._sourceLoaded||this._paused)return;let i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter(t=>this._source.hasTile(t)))):i=[];const n=e.coveringZoomLevel(this._source),r=Math.max(n-V.maxOverzooming,this._source.minzoom),o=Math.max(n+V.maxUnderzooming,this._source.minzoom),a=this._updateRetainedTiles(i,n);if(q(this._source.type)){const e={},i={},s=Object.keys(a);for(const n of s){const o=a[n],s=this._tiles[n];if(!s||s.fadeEndTime&&s.fadeEndTime<=t.exported.now())continue;const l=this.findLoadedParent(o,r);l&&(this._addTile(l.tileID),e[l.tileID.key]=l.tileID),i[n]=o}this._retainLoadedChildren(i,n,o,a);for(const t in e)a[t]||(this._coveredTiles[t]=!0,a[t]=e[t])}for(const t in a)this._tiles[t].clearFadeHold();const s=t.keysDifference(this._tiles,a);for(const t of s){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){const i={},n={},r=Math.max(e-V.maxOverzooming,this._source.minzoom),o=Math.max(e+V.maxUnderzooming,this._source.minzoom),a={};for(const n of t){const t=this._addTile(n);i[n.key]=n,t.hasData()||e<this._source.maxzoom&&(a[n.key]=n)}this._retainLoadedChildren(a,e,o,i);for(const o of t){let t=this._tiles[o.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=o.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else{const t=o.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let a=t.wasRequested();for(let e=o.overscaledZ-1;e>=r;--e){const r=o.scaledTo(e);if(n[r.key])break;if(n[r.key]=!0,t=this.getTile(r),!t&&a&&(t=this._addTile(r)),t&&(i[r.key]=r,a=t.wasRequested(),t.hasData()))break}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}e.push(n.key);const t=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;n=t}for(const t of e)this._loadedParentTiles[t]=i}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const n=i;return i||(i=new U(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i.uses++,this._tiles[e.key]=i,n||this._source.fire(new t.Event("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(e,i,n){const r=[],o=this.transform;if(!o)return r;const a=n?o.getCameraQueryGeometry(e):e,s=e.map(t=>o.pointCoordinate(t)),l=a.map(t=>o.pointCoordinate(t)),u=this.getIds();let c=1/0,h=1/0,p=-1/0,d=-1/0;for(const t of l)c=Math.min(c,t.x),h=Math.min(h,t.y),p=Math.max(p,t.x),d=Math.max(d,t.y);for(let e=0;e<u.length;e++){const n=this._tiles[u[e]];if(n.holdingForFade())continue;const a=n.tileID,f=Math.pow(2,o.zoom-n.tileID.overscaledZ),m=i*n.queryPadding*t.EXTENT/n.tileSize/f,g=[a.getTilePoint(new t.MercatorCoordinate(c,h)),a.getTilePoint(new t.MercatorCoordinate(p,d))];if(g[0].x-m<t.EXTENT&&g[0].y-m<t.EXTENT&&g[1].x+m>=0&&g[1].y+m>=0){const t=s.map(t=>a.getTilePoint(t)),e=l.map(t=>a.getTilePoint(t));r.push({tile:n,tileID:a,queryGeometry:t,cameraQueryGeometry:e,scale:f})}}return r}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map(t=>this._tiles[t].tileID);for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(q(this._source.type))for(const e in this._tiles){const i=this._tiles[e];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=t.exported.now())return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const n=this._tiles[t];n&&n.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter(i=>!i.hasDependency(t,e))}}function G(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function q(t){return"raster"===t||"image"===t||"video"===t}V.maxOverzooming=10,V.maxUnderzooming=3;const W="mapboxgl_preloaded_worker_pool";class Z{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Z.workerCount;)this.workers.push(new Worker(_r.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[W]}numActive(){return Object.keys(this.active).length}}const H=Math.floor(t.exported.hardwareConcurrency/2);let $;function X(){return $||($=new Z),$}function K(e,i){const n={};for(const t in e)"ref"!==t&&(n[t]=e[t]);return t.refProperties.forEach(t=>{t in i&&(n[t]=i[t])}),n}function J(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=K(t[i],e[t[i].ref]));return t}Z.workerCount=Math.max(Math.min(H,6),1);const Y={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Q(t,e,i){i.push({command:Y.addSource,args:[t,e[t]]})}function tt(t,e,i){e.push({command:Y.removeSource,args:[t]}),i[t]=!0}function et(t,e,i,n){tt(t,i,n),Q(t,e,i)}function it(t,e,i){let n;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!r(t[i][n],e[i][n]))return!1;for(n in e[i])if(Object.prototype.hasOwnProperty.call(e[i],n)&&"data"!==n&&!r(t[i][n],e[i][n]))return!1;return!0}function nt(t,e,i,n,o,a){let s;for(s in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,s)&&(r(t[s],e[s])||i.push({command:a,args:[n,s,e[s],o]}));for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(r(t[s],e[s])||i.push({command:a,args:[n,s,e[s],o]}))}function rt(t){return t.id}function ot(t,e){return t[e.id]=e,t}class at{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);let i=1,n=this._distances[i];const r=e*this.paddedLength+this.padding;for(;n<r&&i<this._distances.length;)n=this._distances[++i];const o=i-1,a=this._distances[o],s=n-a,l=s>0?(r-a)/s:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function st(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class lt{constructor(t,e,i){const n=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)n.push([]),r.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,n,r){this._forEachCell(e,i,n,r,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(r)}insertCircle(t,e,i,n){this._forEachCell(e-n,i-n,e+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(n)}_insertBoxCell(t,e,i,n,r,o){this.boxCells[r].push(o)}_insertCircleCell(t,e,i,n,r,o){this.circleCells[r].push(o)}_query(t,e,i,n,r,o,a){if(i<0||t>this.width||n<0||e>this.height)return[];const s=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=n){if(r)return[{key:null,x1:t,y1:e,x2:i,y2:n}];for(let t=0;t<this.boxKeys.length;t++)s.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],i=this.circles[3*t+1],n=this.circles[3*t+2];s.push({key:this.circleKeys[t],x1:e-n,y1:i-n,x2:e+n,y2:i+n})}}else this._forEachCell(t,e,i,n,this._queryCell,s,{hitTest:r,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(t,e,i,n){return this._query(t,e,i,n,!1,null)}hitTest(t,e,i,n,r,o){return this._query(t,e,i,n,!0,r,o).length>0}hitTestCircle(t,e,i,n,r){const o=t-i,a=t+i,s=e-i,l=e+i;if(a<0||o>this.width||l<0||s>this.height)return!1;const u=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,u,{hitTest:!0,overlapMode:n,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},r),u.length>0}_queryCell(t,e,i,n,r,o,a,s){const{seenUids:l,hitTest:u,overlapMode:c}=a,h=this.boxCells[r];if(null!==h){const r=this.bboxes;for(const a of h)if(!l.box[a]){l.box[a]=!0;const h=4*a,p=this.boxKeys[a];if(t<=r[h+2]&&e<=r[h+3]&&i>=r[h+0]&&n>=r[h+1]&&(!s||s(p))&&(!u||!st(c,p.overlapMode))&&(o.push({key:p,x1:r[h],y1:r[h+1],x2:r[h+2],y2:r[h+3]}),u))return!0}}const p=this.circleCells[r];if(null!==p){const r=this.circles;for(const a of p)if(!l.circle[a]){l.circle[a]=!0;const h=3*a,p=this.circleKeys[a];if(this._circleAndRectCollide(r[h],r[h+1],r[h+2],t,e,i,n)&&(!s||s(p))&&(!u||!st(c,p.overlapMode))){const t=r[h],e=r[h+1],i=r[h+2];if(o.push({key:p,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),u)return!0}}}return!1}_queryCellCircle(t,e,i,n,r,o,a,s){const{circle:l,seenUids:u,overlapMode:c}=a,h=this.boxCells[r];if(null!==h){const t=this.bboxes;for(const e of h)if(!u.box[e]){u.box[e]=!0;const i=4*e,n=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!s||s(n))&&!st(c,n.overlapMode))return o.push(!0),!0}}const p=this.circleCells[r];if(null!==p){const t=this.circles;for(const e of p)if(!u.circle[e]){u.circle[e]=!0;const i=3*e,n=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!s||s(n))&&!st(c,n.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,n,r,o,a,s){const l=this._convertToXCellCoord(t),u=this._convertToYCellCoord(e),c=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++)if(r.call(this,t,e,i,n,this.xCellCount*l+p,o,a,s))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,n,r,o){const a=n-t,s=r-e,l=i+o;return l*l>a*a+s*s}_circleAndRectCollide(t,e,i,n,r,o,a){const s=(o-n)/2,l=Math.abs(t-(n+s));if(l>s+i)return!1;const u=(a-r)/2,c=Math.abs(e-(r+u));if(c>u+i)return!1;if(l<=s||c<=u)return!0;const h=l-s,p=c-u;return h*h+p*p<=i*i}}function ut(e,i,n,r,o){const a=t.create();return i?(t.scale(a,a,[1/o,1/o,1]),n||t.rotateZ(a,a,r.angle)):t.multiply(a,r.labelPlaneMatrix,e),a}function ct(e,i,n,r,o){if(i){const i=t.clone(e);return t.scale(i,i,[o,o,1]),n||t.rotateZ(i,i,-r.angle),i}return r.glCoordMatrix}function ht(e,i){const n=[e.x,e.y,0,1];wt(n,n,i);const r=n[3];return{point:new t.pointGeometry(n[0]/r,n[1]/r),signedDistanceFromCamera:r}}function pt(t,e){return.5+t/e*.5}function dt(t,e){const i=t[0]/t[3],n=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&n>=-e[1]&&n<=e[1]}function ft(e,i,n,r,o,a,s,l,u){const c=r?e.textSizeData:e.iconSizeData,h=t.evaluateSizeForZoom(c,n.transform.zoom),p=[256/n.width*2+1,256/n.height*2+1],d=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;d.clear();const f=e.lineVertexArray,m=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=n.transform.width/n.transform.height;let _=!1;for(let r=0;r<m.length;r++){const y=m.get(r);if(y.hidden||y.writingMode===t.WritingMode.vertical&&!_){bt(y.numGlyphs,d);continue}_=!1;const x=[y.anchorX,y.anchorY,0,1];if(t.transformMat4(x,x,i),!dt(x,p)){bt(y.numGlyphs,d);continue}const v=pt(n.transform.cameraToCenterDistance,x[3]),b=t.evaluateSizeForFeature(c,h,y),w=s?b/v:b*v,S=new t.pointGeometry(y.anchorX,y.anchorY),T=ht(S,o).point,E={},A=_t(y,w,!1,l,i,o,a,e.glyphOffsetArray,f,d,T,S,E,g,u);_=A.useVertical,(A.notEnoughRoom||_||A.needsFlipping&&_t(y,w,!0,l,i,o,a,e.glyphOffsetArray,f,d,T,S,E,g,u).notEnoughRoom)&&bt(y.numGlyphs,d)}r?e.text.dynamicLayoutVertexBuffer.updateData(d):e.icon.dynamicLayoutVertexBuffer.updateData(d)}function mt(t,e,i,n,r,o,a,s,l,u,c,h){const p=s.glyphStartIndex+s.numGlyphs,d=s.lineStartIndex,f=s.lineStartIndex+s.lineLength,m=e.getoffsetX(s.glyphStartIndex),g=e.getoffsetX(p-1),_=xt(t*m,i,n,r,o,a,s.segment,d,f,l,u,c,h);if(!_)return null;const y=xt(t*g,i,n,r,o,a,s.segment,d,f,l,u,c,h);return y?{first:_,last:y}:null}function gt(e,i,n,r){return e===t.WritingMode.horizontal&&Math.abs(n.y-i.y)>Math.abs(n.x-i.x)*r?{useVertical:!0}:(e===t.WritingMode.vertical?i.y<n.y:i.x>n.x)?{needsFlipping:!0}:null}function _t(e,i,n,r,o,a,s,l,u,c,h,p,d,f,m){const g=i/24,_=e.lineOffsetX*g,y=e.lineOffsetY*g;let x;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,o=e.lineStartIndex+e.lineLength,c=mt(g,l,_,y,n,h,p,e,u,a,d,m);if(!c)return{notEnoughRoom:!0};const v=ht(c.first.point,s).point,b=ht(c.last.point,s).point;if(r&&!n){const t=gt(e.writingMode,v,b,f);if(t)return t}x=[c.first];for(let r=e.glyphStartIndex+1;r<t-1;r++)x.push(xt(g*l.getoffsetX(r),_,y,n,h,p,e.segment,i,o,u,a,d,m));x.push(c.last)}else{if(r&&!n){const i=ht(p,o).point,n=e.lineStartIndex+e.segment+1,r=new t.pointGeometry(u.getx(n),u.gety(n)),a=ht(r,o),s=a.signedDistanceFromCamera>0?a.point:yt(p,r,i,1,o),l=gt(e.writingMode,i,s,f);if(l)return l}const i=xt(g*l.getoffsetX(e.glyphStartIndex),_,y,n,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,a,d,m);if(!i)return{notEnoughRoom:!0};x=[i]}for(const e of x)t.addDynamicAttributes(c,e.point,e.angle);return{}}function yt(t,e,i,n,r){const o=ht(t.add(t.sub(e)._unit()),r).point,a=i.sub(o);return i.add(a._mult(n/a.mag()))}function xt(e,i,n,r,o,a,s,l,u,c,h,p,d){const f=r?e-i:e+i;let m=f>0?1:-1,g=0;r&&(m*=-1,g=Math.PI),m<0&&(g+=Math.PI);let _=m>0?l+s:l+s+1,y=o,x=o,v=0,b=0;const w=Math.abs(f),S=[];for(;v+b<=w;){if(_+=m,_<l||_>=u)return null;if(x=y,S.push(y),y=p[_],void 0===y){const e=new t.pointGeometry(c.getx(_),c.gety(_)),i=ht(e,h);if(i.signedDistanceFromCamera>0)y=p[_]=i.point;else{const i=_-m;y=yt(0===v?a:new t.pointGeometry(c.getx(i),c.gety(i)),e,x,w-v+1,h)}}v+=b,b=x.dist(y)}const T=(w-v)/b,E=y.sub(x),A=E.mult(T)._add(x);A._add(E._unit()._perp()._mult(n*m));const I=g+Math.atan2(y.y-x.y,y.x-x.x);return S.push(A),{point:A,angle:d?I:0,path:S}}const vt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function bt(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(vt,3*t)}}function wt(t,e,i){const n=e[0],r=e[1];return t[0]=i[0]*n+i[4]*r+i[12],t[1]=i[1]*n+i[5]*r+i[13],t[3]=i[3]*n+i[7]*r+i[15],t}const St=100;class Tt{constructor(t,e=new lt(t.width+200,t.height+200,25),i=new lt(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+St,this.screenBottomBoundary=t.height+St,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200}placeCollisionBox(t,e,i,n,r){const o=this.projectAndGetPerspectiveRatio(n,t.anchorPointX,t.anchorPointY),a=i*o.perspectiveRatio,s=t.x1*a+o.point.x,l=t.y1*a+o.point.y,u=t.x2*a+o.point.x,c=t.y2*a+o.point.y;return!this.isInsideGrid(s,l,u,c)||"always"!==e&&this.grid.hitTest(s,l,u,c,e,r)?{box:[],offscreen:!1}:{box:[s,l,u,c],offscreen:this.isOffscreen(s,l,u,c)}}placeCollisionCircles(e,i,n,r,o,a,s,l,u,c,h,p,d){const f=[],m=new t.pointGeometry(i.anchorX,i.anchorY),g=ht(m,a),_=pt(this.transform.cameraToCenterDistance,g.signedDistanceFromCamera),y=(c?o/_:o*_)/t.ONE_EM,x=ht(m,s).point,v=mt(y,r,i.lineOffsetX*y,i.lineOffsetY*y,!1,x,m,i,n,s,{},!1);let b=!1,w=!1,S=!0;if(v){const i=.5*p*_+d,n=new t.pointGeometry(-100,-100),r=new t.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),o=new at,a=v.first,s=v.last;let c=[];for(let t=a.path.length-1;t>=1;t--)c.push(a.path[t]);for(let t=1;t<s.path.length;t++)c.push(s.path[t]);const m=2.5*i;if(l){const t=c.map(t=>ht(t,l));c=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let g=[];if(c.length>0){const e=c[0].clone(),i=c[0].clone();for(let t=1;t<c.length;t++)e.x=Math.min(e.x,c[t].x),e.y=Math.min(e.y,c[t].y),i.x=Math.max(i.x,c[t].x),i.y=Math.max(i.y,c[t].y);g=e.x>=n.x&&i.x<=r.x&&e.y>=n.y&&i.y<=r.y?[c]:i.x<n.x||e.x>r.x||i.y<n.y||e.y>r.y?[]:t.clipLine([c],n.x,n.y,r.x,r.y)}for(const t of g){o.reset(t,.25*i);let n=0;n=o.length<=.5*i?1:Math.ceil(o.paddedLength/m)+1;for(let t=0;t<n;t++){const r=t/Math.max(n-1,1),a=o.lerp(r),s=a.x+St,l=a.y+St;f.push(s,l,i,0);const c=s-i,p=l-i,d=s+i,m=l+i;if(S=S&&this.isOffscreen(c,p,d,m),w=w||this.isInsideGrid(c,p,d,m),"always"!==e&&this.grid.hitTestCircle(s,l,i,e,h)&&(b=!0,!u))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!u&&b||!w?[]:f,offscreen:S,collisionDetected:b}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let n=1/0,r=1/0,o=-1/0,a=-1/0;for(const s of e){const e=new t.pointGeometry(s.x+St,s.y+St);n=Math.min(n,e.x),r=Math.min(r,e.y),o=Math.max(o,e.x),a=Math.max(a,e.y),i.push(e)}const s=this.grid.query(n,r,o,a).concat(this.ignoredGrid.query(n,r,o,a)),l={},u={};for(const e of s){const n=e.key;if(void 0===l[n.bucketInstanceId]&&(l[n.bucketInstanceId]={}),l[n.bucketInstanceId][n.featureIndex])continue;const r=[new t.pointGeometry(e.x1,e.y1),new t.pointGeometry(e.x2,e.y1),new t.pointGeometry(e.x2,e.y2),new t.pointGeometry(e.x1,e.y2)];t.polygonIntersectsPolygon(i,r)&&(l[n.bucketInstanceId][n.featureIndex]=!0,void 0===u[n.bucketInstanceId]&&(u[n.bucketInstanceId]=[]),u[n.bucketInstanceId].push(n.featureIndex))}return u}insertCollisionBox(t,e,i,n,r,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:r,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,n,r,o){const a=i?this.ignoredGrid:this.grid,s={bucketInstanceId:n,featureIndex:r,collisionGroupID:o,overlapMode:e};for(let e=0;e<t.length;e+=4)a.insertCircle(s,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(e,i,n){const r=[i,n,0,1];return wt(r,r,e),{point:new t.pointGeometry((r[0]/r[3]+1)/2*this.transform.width+St,(-r[1]/r[3]+1)/2*this.transform.height+St),perspectiveRatio:.5+this.transform.cameraToCenterDistance/r[3]*.5}}isOffscreen(t,e,i,n){return i<St||t>=this.screenRightBoundary||n<St||e>this.screenBottomBoundary}isInsideGrid(t,e,i,n){return i>=0&&t<this.gridRightBoundary&&n>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e}}function Et(e,i,n){return i*(t.EXTENT/(e.tileSize*Math.pow(2,n-e.tileID.overscaledZ)))}class At{constructor(t,e,i,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):n&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class It{constructor(t,e,i,n,r){this.text=new At(t?t.text:null,e,i,r),this.icon=new At(t?t.icon:null,e,n,r)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ct{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class Pt{constructor(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]}}class Mt{constructor(t,e,i,n,r){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=r}}class kt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function zt(e,i,n,r,o){const{horizontalAlign:a,verticalAlign:s}=t.getAnchorAlignment(e),l=-(a-.5)*i,u=-(s-.5)*n,c=t.evaluateVariableOffset(e,r);return new t.pointGeometry(l+c[0]*o,u+c[1]*o)}function Lt(e,i,n,r,o,a){const{x1:s,x2:l,y1:u,y2:c,anchorPointX:h,anchorPointY:p}=e,d=new t.pointGeometry(i,n);return r&&d._rotate(o?a:-a),{x1:s+d.x,y1:u+d.y,x2:l+d.x,y2:c+d.y,anchorPointX:h,anchorPointY:p}}class Bt{constructor(t,e,i,n){this.transform=t.clone(),this.collisionIndex=new Tt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new kt(i),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,i,n,r){const o=n.getBucket(i),a=n.latestFeatureIndex;if(!o||!a||i.id!==o.layerIds[0])return;const s=n.collisionBoxArray,l=o.layers[0].layout,u=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),c=n.tileSize/t.EXTENT,h=this.transform.calculatePosMatrix(n.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),d="map"===l.get("text-rotation-alignment"),f=Et(n,1,this.transform.zoom),m=ut(h,p,d,this.transform,f);let g=null;if(p){const e=ct(h,p,d,this.transform,f);g=t.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[o.bucketInstanceId]=new Mt(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID);const _={bucket:o,layout:l,posMatrix:h,textLabelPlaneMatrix:m,labelToScreenMatrix:g,scale:u,textPixelRatio:c,holdingForFade:n.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(r)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r}=t;e.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f){const m=[h.textOffset0,h.textOffset1],g=zt(t,i,n,m,r),_=this.collisionIndex.placeCollisionBox(Lt(e,g.x,g.y,o,a,this.transform.angle),c,s,l,u.predicate);if((!f||0!==this.collisionIndex.placeCollisionBox(Lt(f,g.x,g.y,o,a,this.transform.angle),c,s,l,u.predicate).box.length)&&_.box.length>0){let e;return this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(e=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:m,width:i,height:n,anchor:t,textBoxScale:r,prevAnchor:e},this.markUsedJustification(p,t,h,d),p.allowVerticalPlacement&&(this.markUsedOrientation(p,d,h),this.placedOrientations[h.crossTileID]=d),{shift:g,placedGlyphBoxes:_}}}placeLayerBucketPart(e,i,n){const{bucket:r,layout:o,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:u,holdingForFade:c,collisionBoxArray:h,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,f=o.get("text-optional"),m=o.get("icon-optional"),g=t.getOverlapMode(o,"text-overlap","text-allow-overlap"),_="always"===g,y=t.getOverlapMode(o,"icon-overlap","icon-allow-overlap"),x="always"===y,v="map"===o.get("text-rotation-alignment"),b="map"===o.get("text-pitch-alignment"),w="none"!==o.get("icon-text-fit"),S="viewport-y"===o.get("symbol-z-order"),T=_&&(x||!r.hasIconData()||m),E=x&&(_||!r.hasTextData()||f);!r.collisionArrays&&h&&r.deserializeCollisionBoxes(h);const A=(e,h)=>{if(i[e.crossTileID])return;if(c)return void(this.placements[e.crossTileID]=new Ct(!1,!1,!1));let x=!1,S=!1,A=!0,I=null,C={box:null,offscreen:null},P={box:null,offscreen:null},M=null,k=null,z=null,L=0,B=0,D=0;h.textFeatureIndex?L=h.textFeatureIndex:e.useRuntimeCollisionCircles&&(L=e.featureIndex),h.verticalTextFeatureIndex&&(B=h.verticalTextFeatureIndex);const R=h.textBox;if(R){const i=i=>{let n=t.WritingMode.horizontal;if(r.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,n=t,this.markUsedOrientation(r,n,e))}return n},n=(i,n)=>{if(r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&h.verticalTextBox){for(const e of r.writingModes)if(e===t.WritingMode.vertical?(C=n(),P=C):C=i(),C&&C.box&&C.box.length)break}else C=i()};if(o.get("text-variable-anchor")){let s=o.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){const t=this.prevPlacement.variableOffsets[e.crossTileID];s.indexOf(t.anchor)>0&&(s=s.filter(e=>e!==t.anchor),s.unshift(t.anchor))}const l=(t,i,n)=>{const o=t.x2-t.x1,l=t.y2-t.y1,c=e.textBoxScale,h=w&&"never"===y?i:null;let p={box:[],offscreen:!1};const f="never"!==g?2*s.length:s.length;for(let i=0;i<f;++i){const f=this.attemptAnchorPlacement(s[i%s.length],t,o,l,c,v,b,u,a,d,i>=s.length?g:"never",e,r,n,h);if(f&&(p=f.placedGlyphBoxes,p&&p.box&&p.box.length)){x=!0,I=f.shift;break}}return p};n(()=>l(R,h.iconBox,t.WritingMode.horizontal),()=>{const i=h.verticalTextBox;return r.allowVerticalPlacement&&!(C&&C.box&&C.box.length)&&e.numVerticalGlyphVertices>0&&i?l(i,h.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}}),C&&(x=C.box,A=C.offscreen);const c=i(C&&C.box);if(!x&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(r,t.anchor,e,c))}}else{const o=(t,i)=>{const n=this.collisionIndex.placeCollisionBox(t,g,u,a,d.predicate);return n&&n.box&&n.box.length&&(this.markUsedOrientation(r,i,e),this.placedOrientations[e.crossTileID]=i),n};n(()=>o(R,t.WritingMode.horizontal),()=>{const i=h.verticalTextBox;return r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?o(i,t.WritingMode.vertical):{box:null,offscreen:null}}),i(C&&C.box&&C.box.length)}}if(M=C,x=M&&M.box&&M.box.length>0,A=M&&M.offscreen,e.useRuntimeCollisionCircles){const i=r.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),u=t.evaluateSizeForFeature(r.textSizeData,p,i),c=o.get("text-padding");k=this.collisionIndex.placeCollisionCircles(g,i,r.lineVertexArray,r.glyphOffsetArray,u,a,s,l,n,b,d.predicate,e.collisionCircleDiameter,c),x=_||k.circles.length>0&&!k.collisionDetected,A=A&&k.offscreen}if(h.iconFeatureIndex&&(D=h.iconFeatureIndex),h.iconBox){const t=t=>{const e=w&&I?Lt(t,I.x,I.y,v,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,y,u,a,d.predicate)};P&&P.box&&P.box.length&&h.verticalIconBox?(z=t(h.verticalIconBox),S=z.box.length>0):(z=t(h.iconBox),S=z.box.length>0),A=A&&z.offscreen}const O=f||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,F=m||0===e.numIconVertices;if(O||F?F?O||(S=S&&x):x=S&&x:S=x=S&&x,x&&M&&M.box&&this.collisionIndex.insertCollisionBox(M.box,g,o.get("text-ignore-placement"),r.bucketInstanceId,P&&P.box&&B?B:L,d.ID),S&&z&&this.collisionIndex.insertCollisionBox(z.box,y,o.get("icon-ignore-placement"),r.bucketInstanceId,D,d.ID),k&&(x&&this.collisionIndex.insertCollisionCircles(k.circles,g,o.get("text-ignore-placement"),r.bucketInstanceId,L,d.ID),n)){const t=r.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new Pt);for(let t=0;t<k.circles.length;t+=4)e.circles.push(k.circles[t+0]),e.circles.push(k.circles[t+1]),e.circles.push(k.circles[t+2]),e.circles.push(k.collisionDetected?1:0)}this.placements[e.crossTileID]=new Ct(x||T,S||E,A||r.justReloaded),i[e.crossTileID]=!0};if(S){const t=r.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];A(r.symbolInstances.get(i),r.collisionArrays[i])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(r.symbolInstances.get(t),r.collisionArrays[t]);if(n&&r.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[r.bucketInstanceId];t.invert(e.invProjMatrix,a),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}r.justReloaded=!1}markUsedJustification(e,i,n,r){let o;o=r===t.WritingMode.vertical?n.verticalPlacedTextSymbolIndex:{left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];const a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(const t of a)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:n.crossTileID)}markUsedOrientation(e,i,n){const r=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,o=i===t.WritingMode.vertical?i:0,a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(const t of a)e.text.placedSymbolArray.get(t).placedOrientation=r;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const n=e?e.symbolFadeChange(t):1,r=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=r[t];o?(this.opacities[t]=new It(o,n,e.text,e.icon),i=i||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new It(null,n,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in r){const e=r[t];if(!this.opacities[t]){const r=new It(e,n,!1,!1);r.isHidden()||(this.opacities[t]=r,i=i||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in a)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=a[t]);i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const n of e){const e=n.getBucket(t);e&&n.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,n.collisionBoxArray)}}updateBucketOpacities(e,i,n){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const r=e.layers[0].layout,o=new It(null,0,!1,!1,!0),a=r.get("text-allow-overlap"),s=r.get("icon-allow-overlap"),l=r.get("text-variable-anchor"),u="map"===r.get("text-rotation-alignment"),c="map"===r.get("text-pitch-alignment"),h="none"!==r.get("icon-text-fit"),p=new It(null,0,a&&(s||!e.hasIconData()||r.get("icon-optional")),s&&(a||!e.hasTextData()||r.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);const d=(t,e,i)=>{for(let n=0;n<e/4;n++)t.opacityVertexArray.emplaceBack(i)};for(let n=0;n<e.symbolInstances.length;n++){const r=e.symbolInstances.get(n),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:s,crossTileID:f}=r;let m=this.opacities[f];i[f]?m=o:m||(m=p,this.opacities[f]=m),i[f]=!0;const g=r.numIconVertices>0,_=this.placedOrientations[r.crossTileID],y=_===t.WritingMode.vertical,x=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(a>0||s>0){const t=Gt(m.text);d(e.text,a,y?qt:t),d(e.text,s,x?qt:t);const i=m.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach(t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||y?1:0)}),r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||x?1:0);const n=this.variableOffsets[r.crossTileID];n&&this.markUsedJustification(e,n.anchor,r,_);const o=this.placedOrientations[r.crossTileID];o&&(this.markUsedJustification(e,"left",r,o),this.markUsedOrientation(e,o,r))}if(g){const t=Gt(m.icon),i=!(h&&r.verticalPlacedIconSymbolIndex&&y);r.placedIconSymbolIndex>=0&&(d(e.icon,r.numIconVertices,i?t:qt),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=m.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,r.numVerticalIconVertices,i?qt:t),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[n];if(i){let n=new t.pointGeometry(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(l){const e=this.variableOffsets[f];e?(n=zt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),u&&n._rotate(c?this.transform.angle:-this.transform.angle)):t=!1}i.textBox&&Dt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||y,n.x,n.y),i.verticalTextBox&&Dt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||x,n.x,n.y)}const r=Boolean(!x&&i.verticalIconBox);i.iconBox&&Dt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,r,h?n.x:0,h?n.y:0),i.verticalIconBox&&Dt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!r,h?n.x:0,h?n.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function Dt(t,e,i,n,r){t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0)}const Rt=Math.pow(2,25),Ot=Math.pow(2,24),Ft=Math.pow(2,17),Ut=Math.pow(2,16),jt=Math.pow(2,9),Nt=Math.pow(2,8),Vt=Math.pow(2,1);function Gt(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Rt+e*Ot+i*Ft+e*Ut+i*jt+e*Nt+i*Vt+e}const qt=0;class Wt{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,n,r){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,n,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,r())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((t,e)=>t.sortKey-e.sortKey));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,r())return!0;return!1}}class Zt{constructor(t,e,i,n,r,o,a){this.placement=new Bt(t,r,o,a),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,i,n){const r=t.exported.now(),o=()=>{const e=t.exported.now()-r;return!this._forceFullPlacement&&e>2};for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=r)&&(!t.maxzoom||t.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new Wt(t)),this._inProgressLayer.continuePlacement(n[t.source],this.placement,this._showCollisionBoxes,t,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ht=512/t.EXTENT/2;class $t{constructor(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(let i=0;i<e.length;i++){const n=e.get(i),r=n.key;this.indexedSymbolInstances[r]||(this.indexedSymbolInstances[r]=[]),this.indexedSymbolInstances[r].push({crossTileID:n.crossTileID,coord:this.getScaledCoordinates(n,t)})}}getScaledCoordinates(e,i){const n=Ht/Math.pow(2,i.canonical.z-this.tileID.canonical.z);return{x:Math.floor((i.canonical.x*t.EXTENT+e.anchorX)*n),y:Math.floor((i.canonical.y*t.EXTENT+e.anchorY)*n)}}findMatches(t,e,i){const n=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let r=0;r<t.length;r++){const o=t.get(r);if(o.crossTileID)continue;const a=this.indexedSymbolInstances[o.key];if(!a)continue;const s=this.getScaledCoordinates(o,e);for(const t of a)if(Math.abs(t.coord.x-s.x)<=n&&Math.abs(t.coord.y-s.y)<=n&&!i[t.crossTileID]){i[t.crossTileID]=!0,o.crossTileID=t.crossTileID;break}}}}class Xt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Kt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],n={};for(const t in i){const r=i[t];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),n[r.tileID.key]=r}this.indexes[t]=n}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const n=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const r=this.indexes[i];if(Number(i)>t.overscaledZ)for(const i in r){const o=r[i];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,n)}else{const o=r[t.scaledTo(Number(i)).key];o&&o.findMatches(e.symbolInstances,t,n)}}for(let t=0;t<e.symbolInstances.length;t++){const r=e.symbolInstances.get(t);r.crossTileID||(r.crossTileID=i.generate(),n[r.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new $t(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i in e.indexedSymbolInstances)for(const n of e.indexedSymbolInstances[i])delete this.usedCrossTileIDs[t][n.crossTileID]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const n=this.indexes[i];for(const r in n)t[n[r].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[r]),delete n[r],e=!0)}return e}}class Jt{constructor(){this.layerIndexes={},this.crossTileIDs=new Xt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let n=this.layerIndexes[t.id];void 0===n&&(n=this.layerIndexes[t.id]=new Kt);let r=!1;const o={};n.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(i.tileID,e,this.crossTileIDs)&&(r=!0),o[e.bucketInstanceId]=!0)}return n.removeStaleBuckets(o)&&(r=!0),r}pruneUnusedLayers(t){const e={};t.forEach(t=>{e[t]=!0});for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const Yt=(e,i)=>t.emitValidationErrors(e,i&&i.filter(t=>"source.canvas"!==t.identifier)),Qt=t.pick(Y,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),te=t.pick(Y,["setCenter","setZoom","setBearing","setPitch"]),ee=function(){const e={},i=t.spec.$version;for(const n in t.spec.$root){const r=t.spec.$root[n];if(r.required){let t=null;t="version"===n?i:"array"===r.type?[]:{},null!=t&&(e[n]=t)}}return e}();class ie extends t.Evented{constructor(e,i={}){super(),this.map=e,this.dispatcher=new S(X(),this),this.imageManager=new f,this.imageManager.setEventedParent(this),this.glyphManager=new y(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new w(256,512),this.crossTileSymbolIndex=new Jt,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const n=this;this._rtlTextPluginCallback=ie.registerForPluginStateChange(e=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},(e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every(t=>t))for(const t in n.sourceCaches)n.sourceCaches[t].reload()})}),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e)}})}loadURL(e,i={}){this.fire(new t.Event("dataloading",{dataType:"style"}));const n="boolean"!=typeof i.validate||i.validate,r=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(r,(e,i)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):i&&this._load(i,n)})}loadJSON(e,i={}){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.exported.frame(()=>{this._request=null,this._load(e,!1!==i.validate)})}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(ee,!1)}_load(e,i){if(i&&Yt(this,t.validateStyle(e)))return;this._loaded=!0,this.stylesheet=e;for(const t in e.sources)this.addSource(t,e.sources[t],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);const n=J(this.stylesheet.layers);this._order=n.map(t=>t.id),this._layers={},this._serializedLayers={};for(let e of n)e=t.createStyleLayer(e),e.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=e,this._serializedLayers[e.id]=e.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new b(this.stylesheet.light),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}_loadSprite(e){this._spriteRequest=function(e,i,n,r){let o,a,s;const l=n>1?"@2x":"";let u=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,l,".json"),t.ResourceType.SpriteJSON),(t,e)=>{u=null,s||(s=t,o=e,h())}),c=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,l,".png"),t.ResourceType.SpriteImage),(t,e)=>{c=null,s||(s=t,a=e,h())});function h(){if(s)r(s);else if(o&&a){const e=t.exported.getImageData(a),i={};for(const n in o){const{width:r,height:a,x:s,y:l,sdf:u,pixelRatio:c,stretchX:h,stretchY:p,content:d}=o[n],f=new t.RGBAImage({width:r,height:a});t.RGBAImage.copy(e,f,{x:s,y:l},{x:0,y:0},{width:r,height:a}),i[n]={data:f,pixelRatio:c,sdf:u,stretchX:h,stretchY:p,content:d}}r(null,i)}}return{cancel(){u&&(u.cancel(),u=null),c&&(c.cancel(),c=null)}}}(e,this.map._requestManager,this.map.getPixelRatio(),(e,i)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(i)for(const t in i)this.imageManager.addImage(t,i[t]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))})}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const n=e.sourceLayer;if(!n)return;const r=i.getSource();("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${n}" does not exist on source "${r.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const e=[];for(const i of t){const t=this._layers[i];"custom"!==t.type&&e.push(t.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const t in this._updatedSources){const e=this._updatedSources[t];"reload"===e?this._reloadSource(t):"clear"===e&&this._clearSource(t)}this._updateTilesForChangedImages();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}const n={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];n[t]=e.used,e.used=!1}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const e in n){const i=this.sourceCaches[e];n[e]!==i.used&&i.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(e){if(this._checkLoaded(),Yt(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=J(e.layers);const i=function(t,e){if(!t)return[{command:Y.setStyle,args:[e]}];let i=[];try{if(!r(t.version,e.version))return[{command:Y.setStyle,args:[e]}];r(t.center,e.center)||i.push({command:Y.setCenter,args:[e.center]}),r(t.zoom,e.zoom)||i.push({command:Y.setZoom,args:[e.zoom]}),r(t.bearing,e.bearing)||i.push({command:Y.setBearing,args:[e.bearing]}),r(t.pitch,e.pitch)||i.push({command:Y.setPitch,args:[e.pitch]}),r(t.sprite,e.sprite)||i.push({command:Y.setSprite,args:[e.sprite]}),r(t.glyphs,e.glyphs)||i.push({command:Y.setGlyphs,args:[e.glyphs]}),r(t.transition,e.transition)||i.push({command:Y.setTransition,args:[e.transition]}),r(t.light,e.light)||i.push({command:Y.setLight,args:[e.light]});const n={},o=[];!function(t,e,i,n){let o;for(o in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,o)&&(Object.prototype.hasOwnProperty.call(e,o)||tt(o,i,n));for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Object.prototype.hasOwnProperty.call(t,o)?r(t[o],e[o])||("geojson"===t[o].type&&"geojson"===e[o].type&&it(t,e,o)?i.push({command:Y.setGeoJSONSourceData,args:[o,e[o].data]}):et(o,e,i,n)):Q(o,e,i))}(t.sources,e.sources,o,n);const a=[];t.layers&&t.layers.forEach(t=>{n[t.source]?i.push({command:Y.removeLayer,args:[t.id]}):a.push(t)}),i=i.concat(o),function(t,e,i){e=e||[];const n=(t=t||[]).map(rt),o=e.map(rt),a=t.reduce(ot,{}),s=e.reduce(ot,{}),l=n.slice(),u=Object.create(null);let c,h,p,d,f,m,g;for(c=0,h=0;c<n.length;c++)p=n[c],Object.prototype.hasOwnProperty.call(s,p)?h++:(i.push({command:Y.removeLayer,args:[p]}),l.splice(l.indexOf(p,h),1));for(c=0,h=0;c<o.length;c++)p=o[o.length-1-c],l[l.length-1-c]!==p&&(Object.prototype.hasOwnProperty.call(a,p)?(i.push({command:Y.removeLayer,args:[p]}),l.splice(l.lastIndexOf(p,l.length-h),1)):h++,m=l[l.length-c],i.push({command:Y.addLayer,args:[s[p],m]}),l.splice(l.length-c,0,p),u[p]=!0);for(c=0;c<o.length;c++)if(p=o[c],d=a[p],f=s[p],!u[p]&&!r(d,f))if(r(d.source,f.source)&&r(d["source-layer"],f["source-layer"])&&r(d.type,f.type)){for(g in nt(d.layout,f.layout,i,p,null,Y.setLayoutProperty),nt(d.paint,f.paint,i,p,null,Y.setPaintProperty),r(d.filter,f.filter)||i.push({command:Y.setFilter,args:[p,f.filter]}),r(d.minzoom,f.minzoom)&&r(d.maxzoom,f.maxzoom)||i.push({command:Y.setLayerZoomRange,args:[p,f.minzoom,f.maxzoom]}),d)Object.prototype.hasOwnProperty.call(d,g)&&"layout"!==g&&"paint"!==g&&"filter"!==g&&"metadata"!==g&&"minzoom"!==g&&"maxzoom"!==g&&(0===g.indexOf("paint.")?nt(d[g],f[g],i,p,g.slice(6),Y.setPaintProperty):r(d[g],f[g])||i.push({command:Y.setLayerProperty,args:[p,g,f[g]]}));for(g in f)Object.prototype.hasOwnProperty.call(f,g)&&!Object.prototype.hasOwnProperty.call(d,g)&&"layout"!==g&&"paint"!==g&&"filter"!==g&&"metadata"!==g&&"minzoom"!==g&&"maxzoom"!==g&&(0===g.indexOf("paint.")?nt(d[g],f[g],i,p,g.slice(6),Y.setPaintProperty):r(d[g],f[g])||i.push({command:Y.setLayerProperty,args:[p,g,f[g]]}))}else i.push({command:Y.removeLayer,args:[p]}),m=l[l.lastIndexOf(p)+1],i.push({command:Y.addLayer,args:[f,m]})}(a,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:Y.setStyle,args:[e]}]}return i}(this.serialize(),e).filter(t=>!(t.command in te));if(0===i.length)return!1;const n=i.filter(t=>!(t.command in Qt));if(n.length>0)throw new Error(`Unimplemented: ${n.map(t=>t.command).join(", ")}.`);return i.forEach(t=>{"setTransition"!==t.command&&this[t.command].apply(this,t.args)}),this.stylesheet=e,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,n={}){if(this._checkLoaded(),void 0!==this.sourceCaches[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"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const r=this.sourceCaches[e]=new V(e,i,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:r.serialize(),sourceId:e})),r.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(e,i,n={}){this._checkLoaded();const r=e.id;if(this.getLayer(r))return void this.fire(new t.ErrorEvent(new Error(`Layer "${r}" already exists on this map.`)));let o;if("custom"===e.type){if(Yt(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(r,e.source),e=t.clone$1(e),e=t.extend(e,{source:r})),this._validate(t.validateStyle.layer,"layers."+r,e,{arrayIndex:-1},n))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[o.id]=o.serialize()}const a=i?this._order.indexOf(i):this._order.length;if(i&&-1===a)this.fire(new t.ErrorEvent(new Error(`Cannot add layer "${r}" before non-existing layer "${i}".`)));else{if(this._order.splice(a,0,r),this._layerOrderChanged=!0,this._layers[r]=o,this._removedLayers[r]&&o.source&&"custom"!==o.type){const t=this._removedLayers[r];delete this._removedLayers[r],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[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.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const n=this._order.indexOf(e);this._order.splice(n,1);const r=i?this._order.indexOf(i):this._order.length;i&&-1===r?this.fire(new t.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(r,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,n){this._checkLoaded();const r=this.getLayer(e);r?r.minzoom===i&&r.maxzoom===n||(null!=i&&(r.minzoom=i),null!=n&&(r.maxzoom=n),this._updateLayer(r)):this.fire(new t.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,n={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!r(o.filter,i))return null==i?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(t.validateStyle.filter,`layers.${o.id}.filter`,i,null,n)||(o.filter=t.clone$1(i),this._updateLayer(o)))}else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,i,n,o={}){this._checkLoaded();const a=this.getLayer(e);a?r(a.getLayoutProperty(i),n)||(a.setLayoutProperty(i,n,o),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const n=this.getLayer(e);if(n)return n.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,n,o={}){this._checkLoaded();const a=this.getLayer(e);a?r(a.getPaintProperty(i),n)||(a.setPaintProperty(i,n,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const n=e.source,r=e.sourceLayer,o=this.sourceCaches[n];if(void 0===o)return void this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const a=o.getSource().type;"geojson"===a&&r?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||r?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.setFeatureState(r,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const n=e.source,r=this.sourceCaches[n];if(void 0===r)return void this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const o=r.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(a,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,n=e.sourceLayer,r=this.sourceCaches[i];if(void 0!==r)return"vector"!==r.getSource().type||n?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),r.getFeatureState(n,e.id)):void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},n=[];for(let r=this._order.length-1;r>=0;r--){const o=this._order[r];if(e(o)){i[o]=r;for(const e of t){const t=e[o];if(t)for(const e of t)n.push(e)}}}n.sort((t,e)=>e.intersectionZ-t.intersectionZ);const r=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(e(a))for(let t=n.length-1;t>=0;t--){const e=n[t].feature;if(i[e.layer.id]<o)break;r.push(e),n.pop()}else for(const e of t){const t=e[a];if(t)for(const e of t)r.push(e.feature)}}return r}queryRenderedFeatures(e,i,n){i&&i.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",i.filter,null,i);const r={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];r[i.source]=!0}}const o=[];i.availableImages=this._availableImages;for(const t in this.sourceCaches)i.layers&&!r[t]||o.push(O(this.sourceCaches[t],this._layers,this._serializedLayers,e,i,n));return this.placement&&o.push(function(t,e,i,n,r,o,a){const s={},l=o.queryRenderedSymbols(n),u=[];for(const t of Object.keys(l).map(Number))u.push(a[t]);u.sort(F);for(const i of u){const n=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,r.filter,r.layers,r.availableImages,t);for(const t in n){const e=s[t]=s[t]||[],r=n[t];r.sort((t,e)=>{const n=i.featureSortOrder;if(n){const i=n.indexOf(t.featureIndex);return n.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex});for(const t of r)e.push(t)}}for(const e in s)s[e].forEach(n=>{const r=n.feature,o=i[t[e].source].getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=o});return s}(this._layers,this._serializedLayers,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);const n=this.sourceCaches[e];return n?function(t,e){const i=t.getRenderableIds().map(e=>t.getTileByID(e)),n=[],r={};for(let t=0;t<i.length;t++){const o=i[t],a=o.tileID.canonical.key;r[a]||(r[a]=!0,o.querySourceFeatures(n,e))}return n}(n,i):[]}addSourceType(t,e,i){return ie.getSourceType(t)?i(new Error(`A source type called "${t}" already exists.`)):(ie.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const n=this.light.getLight();let o=!1;for(const t in e)if(!r(e[t],n[t])){o=!0;break}if(!o)return;const a={now:t.exported.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(a)}_validate(e,i,n,r,o={}){return(!o||!1!==o.validate)&&Yt(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:n,styleSpec:t.spec},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(e,i,n,r,o=!1){let a=!1,s=!1;const l={};for(const t of this._order){const i=this._layers[t];if("symbol"!==i.type)continue;if(!l[i.source]){const t=this.sourceCaches[i.source];l[i.source]=t.getRenderableIds(!0).map(e=>t.getTileByID(e)).sort((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1))}const n=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);a=a||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===n)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.exported.now(),e.zoom))&&(this.pauseablePlacement=new Zt(e,this._order,o,i,n,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.exported.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const n=this.sourceCaches[e.source];n&&n.setDependencies(e.tileID.key,e.type,e.icons)}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i)}getResource(e,i,n){return t.makeRequest(i,n)}}ie.getSourceType=function(t){return D[t]},ie.setSourceType=function(t,e){D[t]=e},ie.registerForPluginStateChange=t.registerForPluginStateChange;var ne=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),re={prelude:oe("#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","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}"),background:oe("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:oe("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:oe("varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:oe("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:oe("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:oe("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:oe("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:oe("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:oe("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),fill:oe("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:oe("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:oe("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:oe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:oe("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying 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;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:oe("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;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;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:oe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:oe("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:oe("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),lineGradient:oe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),linePattern:oe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:oe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:oe("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:oe("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),symbolSDF:oe("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:oe("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}")};function oe(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/attribute ([\w]+) ([\w]+)/g),r=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(r):r,s={};return{fragmentSource:t=t.replace(i,(t,e,i,n,r)=>(s[r]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nvarying ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = u_${r};\n#endif\n`)),vertexSource:e=e.replace(i,(t,e,i,n,r)=>{const o="float"===n?"vec2":"vec4",a=r.match(/color/)?"color":o;return s[r]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${i} ${o} a_${r};\nvarying ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${i} ${o} a_${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`}),staticAttributes:n,staticUniforms:a}}class ae{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,n,r,o,a,s){this.context=t;let l=this.boundPaintVertexBuffers.length!==n.length;for(let t=0;!l&&t<n.length;t++)this.boundPaintVertexBuffers[t]!==n[t]&&(l=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===e&&this.boundLayoutVertexBuffer===i&&!l&&this.boundIndexBuffer===r&&this.boundVertexOffset===o&&this.boundDynamicVertexBuffer===a&&this.boundDynamicVertexBuffer2===s?(t.bindVertexArrayOES.set(this.vao),a&&a.bind(),r&&r.dynamicDraw&&r.bind(),s&&s.bind()):this.freshBind(e,i,n,r,o,a,s)}freshBind(t,e,i,n,r,o,a){let s;const l=t.numAttributes,u=this.context,c=u.gl;if(u.extVertexArrayObject)this.vao&&this.destroy(),this.vao=u.extVertexArrayObject.createVertexArrayOES(),u.bindVertexArrayOES.set(this.vao),s=0,this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=r,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a;else{s=u.currentNumAttributes||0;for(let t=l;t<s;t++)c.disableVertexAttribArray(t)}e.enableAttributes(c,t);for(const e of i)e.enableAttributes(c,t);o&&o.enableAttributes(c,t),a&&a.enableAttributes(c,t),e.bind(),e.setVertexAttribPointers(c,t,r);for(const e of i)e.bind(),e.setVertexAttribPointers(c,t,r);o&&(o.bind(),o.setVertexAttribPointers(c,t,r)),n&&n.bind(),a&&(a.bind(),a.setVertexAttribPointers(c,t,r)),u.currentNumAttributes=l}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function se(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const n=t[i].split(" ");e.push(n.pop())}return e}class le{constructor(t,e,i,n,r,o){const a=t.gl;this.program=a.createProgram();const s=se(i.staticAttributes),l=n?n.getBinderAttributes():[],u=s.concat(l),c=i.staticUniforms?se(i.staticUniforms):[],h=n?n.getBinderUniforms():[],p=c.concat(h),d=[];for(const t of p)d.indexOf(t)<0&&d.push(t);const f=n?n.defines():[];o&&f.push("#define OVERDRAW_INSPECTOR;");const m=f.concat(re.prelude.fragmentSource,i.fragmentSource).join("\n"),g=f.concat(re.prelude.vertexSource,i.vertexSource).join("\n"),_=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(_,m),a.compileShader(_),a.attachShader(this.program,_);const y=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(y,g),a.compileShader(y),a.attachShader(this.program,y),this.attributes={};const x={};this.numAttributes=u.length;for(let t=0;t<this.numAttributes;t++)u[t]&&(a.bindAttribLocation(this.program,t,u[t]),this.attributes[u[t]]=t);a.linkProgram(this.program),a.deleteShader(y),a.deleteShader(_);for(let t=0;t<d.length;t++){const e=d[t];if(e&&!x[e]){const t=a.getUniformLocation(this.program,e);t&&(x[e]=t)}}this.fixedUniforms=r(t,x),this.binderUniforms=n?n.getUniforms(t,x):[]}draw(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m){const g=t.gl;if(this.failedToCreate)return;t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(n),t.setColorMode(r),t.setCullFace(o);for(const t in this.fixedUniforms)this.fixedUniforms[t].set(a[t]);d&&d.setUniforms(t,this.binderUniforms,h,{zoom:p});const _={[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[e];for(const i of c.get()){const n=i.vaos||(i.vaos={});(n[s]||(n[s]=new ae)).bind(t,this,l,d?d.getPaintVertexBuffers():[],u,i.vertexOffset,f,m),g.drawElements(e,i.primitiveLength*_,g.UNSIGNED_SHORT,i.primitiveOffset*_*2)}}}function ue(t,e,i){const n=1/Et(i,1,e.transform.tileZoom),r=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/r,a=o*(i.tileID.canonical.x+i.tileID.wrap*r),s=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}const ce=(e,i,n,r)=>{const o=i.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=function(){var e=new t.ARRAY_TYPE(9);return t.ARRAY_TYPE!=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}();"viewport"===o.properties.get("anchor")&&function(t,e){var i=Math.sin(e),n=Math.cos(e);t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(l,-i.transform.angle),function(t,e,i){var n=e[0],r=e[1],o=e[2];t[0]=n*i[0]+r*i[3]+o*i[6],t[1]=n*i[1]+r*i[4]+o*i[7],t[2]=n*i[2]+r*i[5]+o*i[8]}(s,s,l);const u=o.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+n,u_opacity:r}},he=(e,i,n,r,o,a,s)=>t.extend(ce(e,i,n,r),ue(a,i,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),pe=t=>({u_matrix:t}),de=(e,i,n,r)=>t.extend(pe(e),ue(n,i,r)),fe=(t,e)=>({u_matrix:t,u_world:e}),me=(e,i,n,r,o)=>t.extend(de(e,i,n,r),{u_world:o}),ge=(t,e,i,n)=>{const r=t.transform;let o,a;if("map"===n.paint.get("circle-pitch-alignment")){const t=Et(i,1,r.zoom);o=!0,a=[t,t]}else o=!1,a=r.pixelsToGLUnits;return{u_camera_to_center_distance:r.cameraToCenterDistance,u_scale_with_map:+("map"===n.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,n.paint.get("circle-translate"),n.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:a}},_e=(t,e,i)=>{const n=Et(i,1,e.zoom),r=Math.pow(2,e.zoom-i.tileID.overscaledZ),o=i.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[e.pixelsToGLUnits[0]/(n*r),e.pixelsToGLUnits[1]/(n*r)],u_overscale_factor:o}},ye=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),xe=t=>({u_matrix:t}),ve=(t,e,i,n)=>({u_matrix:t,u_extrude_scale:Et(e,1,i),u_intensity:n});function be(e,i){const n=Math.pow(2,i.canonical.z),r=i.canonical.y;return[new t.MercatorCoordinate(0,r/n).toLngLat().lat,new t.MercatorCoordinate(0,(r+1)/n).toLngLat().lat]}const we=(t,e,i)=>{const n=t.transform;return{u_matrix:Ie(t,e,i),u_ratio:1/Et(e,1,n.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},Se=(e,i,n,r)=>t.extend(we(e,i,n),{u_image:0,u_image_height:r}),Te=(t,e,i,n)=>{const r=t.transform,o=Ae(e,r);return{u_matrix:Ie(t,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Et(e,1,r.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[o,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]]}},Ee=(e,i,n,r,o)=>{const a=e.lineAtlas,s=Ae(i,e.transform),l="round"===n.layout.get("line-cap"),u=a.getDash(r.from,l),c=a.getDash(r.to,l),h=u.width*o.fromScale,p=c.width*o.toScale;return t.extend(we(e,i,n),{u_patternscale_a:[s/h,-u.height/2],u_patternscale_b:[s/p,-c.height/2],u_sdfgamma:a.width/(256*Math.min(h,p)*e.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:c.y,u_mix:o.t})};function Ae(t,e){return 1/Et(t,1,e.tileZoom)}function Ie(t,e,i){return t.translatePosMatrix(e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Ce=(t,e,i,n,r)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.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:(a=r.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Pe(r.paint.get("raster-hue-rotate"))};var o,a};function Pe(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Me=(t,e,i,n,r,o,a,s,l,u)=>{const c=r.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:c.width/c.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+n,u_texsize:u,u_texture:0}},ke=(e,i,n,r,o,a,s,l,u,c,h)=>{const p=o.transform;return t.extend(Me(e,i,n,r,o,a,s,l,u,c),{u_gamma_scale:r?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+h})},ze=(e,i,n,r,o,a,s,l,u,c)=>t.extend(ke(e,i,n,r,o,a,s,l,!0,u,!0),{u_texsize_icon:c,u_texture_icon:1}),Le=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Be=(e,i,n,r,o,a)=>t.extend(function(t,e,i,n){const r=i.imageManager.getPattern(t.from.toString()),o=i.imageManager.getPattern(t.to.toString()),{width:a,height:s}=i.imageManager.getPixelSize(),l=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,i.transform.tileZoom)/l,c=u*(n.tileID.canonical.x+n.tileID.wrap*l),h=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:e.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/Et(n,1,i.transform.tileZoom),u_pixel_coord_upper:[c>>16,h>>16],u_pixel_coord_lower:[65535&c,65535&h]}}(r,a,n,o),{u_matrix:e,u_opacity:i}),De={fillExtrusion:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)})};class Re{constructor(t,e,i){this.context=t;const n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Oe={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Fe{constructor(t,e,i,n){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;const r=t.gl;this.buffer=r.createBuffer(),t.bindVertexBuffer.set(this.buffer),r.bufferData(r.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i<this.attributes.length;i++){const n=e.attributes[this.attributes[i].name];void 0!==n&&t.enableVertexAttribArray(n)}}setVertexAttribPointers(t,e,i){for(let n=0;n<this.attributes.length;n++){const r=this.attributes[n],o=e.attributes[r.name];void 0!==o&&t.vertexAttribPointer(o,r.components,t[Oe[r.type]],!1,this.itemSize,r.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ue{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class je extends Ue{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ne extends Ue{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ve extends Ue{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Ge extends Ue{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class qe extends Ue{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class We extends Ue{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Ze extends Ue{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class He extends Ue{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class $e extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class Xe extends Ue{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ke extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class Je extends Ue{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Ye extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class Qe extends Ue{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class ti extends Ue{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ei extends Ue{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class ii extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class ni extends Ue{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class ri extends Ue{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class oi extends Ue{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class ai extends Ue{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class si extends Ue{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class li extends Ue{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class ui extends Ue{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ci extends Ue{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class hi extends Ue{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class pi extends Ue{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class di extends Ue{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class fi extends Ue{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class mi extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class gi extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class _i extends Ue{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class yi extends _i{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class xi extends _i{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class vi{constructor(t,e,i,n){this.context=t,this.width=e,this.height=i;const r=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new yi(t,r),n&&(this.depthAttachment=new xi(t,r))}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class bi{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}bi.Replace=[1,0],bi.disabled=new bi(bi.Replace,t.Color.transparent,[!1,!1,!1,!1]),bi.unblended=new bi(bi.Replace,t.Color.transparent,[!0,!0,!0,!0]),bi.alphaBlended=new bi([1,771],t.Color.transparent,[!0,!0,!0,!0]);class wi{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new je(this),this.clearDepth=new Ne(this),this.clearStencil=new Ve(this),this.colorMask=new Ge(this),this.depthMask=new qe(this),this.stencilMask=new We(this),this.stencilFunc=new Ze(this),this.stencilOp=new He(this),this.stencilTest=new $e(this),this.depthRange=new Xe(this),this.depthTest=new Ke(this),this.depthFunc=new Je(this),this.blend=new Ye(this),this.blendFunc=new Qe(this),this.blendColor=new ti(this),this.blendEquation=new ei(this),this.cullFace=new ii(this),this.cullFaceSide=new ni(this),this.frontFace=new ri(this),this.program=new oi(this),this.activeTexture=new ai(this),this.viewport=new si(this),this.bindFramebuffer=new li(this),this.bindRenderbuffer=new ui(this),this.bindTexture=new ci(this),this.bindVertexBuffer=new hi(this),this.bindElementBuffer=new pi(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new di(this),this.pixelStoreUnpack=new fi(this),this.pixelStoreUnpackPremultiplyAlpha=new mi(this),this.pixelStoreUnpackFlipY=new gi(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Re(this,t,e)}createVertexBuffer(t,e,i){return new Fe(this,t,e,i)}createRenderbuffer(t,e,i){const n=this.gl,r=n.createRenderbuffer();return this.bindRenderbuffer.set(r),n.renderbufferStorage(n.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),r}createFramebuffer(t,e,i){return new vi(this,t,e,i)}clear({color:t,depth:e}){const i=this.gl;let n=0;t&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),i.clear(n)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){r(t.blendFunction,bi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Si{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}Si.ReadOnly=!1,Si.ReadWrite=!0,Si.disabled=new Si(519,Si.ReadOnly,[0,1]);class Ti{constructor(t,e,i,n,r,o){this.test=t,this.ref=e,this.mask=i,this.fail=n,this.depthFail=r,this.pass=o}}Ti.disabled=new Ti({func:519,mask:0},0,0,7680,7680,7680);class Ei{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}let Ai;function Ii(e,i,n,r,o,a,s){const l=e.context,u=l.gl,c=e.useProgram("collisionBox"),h=[];let p=0,d=0;for(let f=0;f<r.length;f++){const m=r[f],g=i.getTile(m),_=g.getBucket(n);if(!_)continue;let y=m.posMatrix;0===o[0]&&0===o[1]||(y=e.translatePosMatrix(m.posMatrix,g,o,a));const x=s?_.textCollisionBox:_.iconCollisionBox,v=_.collisionCircleArray;if(v.length>0){const i=t.create(),n=y;t.mul(i,_.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(i,i,_.placementViewportMatrix),h.push({circleArray:v,circleOffset:d,transform:n,invTransform:i}),p+=v.length/4,d=p}x&&c.draw(l,u.LINES,Si.disabled,Ti.disabled,e.colorModeForRenderPass(),Ei.disabled,_e(y,e.transform,g),n.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,e.transform.zoom,null,null,x.collisionVertexBuffer)}if(!s||!h.length)return;const f=e.useProgram("collisionCircle"),m=new t.CollisionCircleLayoutArray;m.resize(4*p),m._trim();let g=0;for(const t of h)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,n=t.circleArray[i+0],r=t.circleArray[i+1],o=t.circleArray[i+2],a=t.circleArray[i+3];m.emplace(g++,n,r,o,a,0),m.emplace(g++,n,r,o,a,1),m.emplace(g++,n,r,o,a,2),m.emplace(g++,n,r,o,a,3)}(!Ai||Ai.length<2*p)&&(Ai=function(e){const i=2*e,n=new t.QuadTriangleArray;n.resize(i),n._trim();for(let t=0;t<i;t++){const e=6*t;n.uint16[e+0]=4*t+0,n.uint16[e+1]=4*t+1,n.uint16[e+2]=4*t+2,n.uint16[e+3]=4*t+2,n.uint16[e+4]=4*t+3,n.uint16[e+5]=4*t+0}return n}(p));const _=l.createIndexBuffer(Ai,!0),y=l.createVertexBuffer(m,t.collisionCircleLayout.members,!0);for(const i of h){const r={u_matrix:i.transform,u_inv_matrix:i.invTransform,u_camera_to_center_distance:(x=e.transform).cameraToCenterDistance,u_viewport_size:[x.width,x.height]};f.draw(l,u.TRIANGLES,Si.disabled,Ti.disabled,e.colorModeForRenderPass(),Ei.disabled,r,n.id,y,_,t.SegmentVector.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}var x;y.destroy(),_.destroy()}Ei.disabled=new Ei(!1,1029,2305),Ei.backCCW=new Ei(!0,1029,2305);const Ci=t.identity(new Float32Array(16));function Pi(e,i,n,r,o,a){const{horizontalAlign:s,verticalAlign:l}=t.getAnchorAlignment(e),u=-(s-.5)*i,c=-(l-.5)*n,h=t.evaluateVariableOffset(e,r);return new t.pointGeometry((u/o+h[0])*a,(c/o+h[1])*a)}function Mi(e,i,n,r,o,a,s,l,u,c){const h=e.text.placedSymbolArray,p=e.text.dynamicLayoutVertexArray,d=e.icon.dynamicLayoutVertexArray,f={};p.clear();for(let d=0;d<h.length;d++){const m=h.get(d),g=e.allowVerticalPlacement&&!m.placedOrientation,_=m.hidden||!m.crossTileID||g?null:r[m.crossTileID];if(_){const r=new t.pointGeometry(m.anchorX,m.anchorY),h=ht(r,n?s:a),d=pt(o.cameraToCenterDistance,h.signedDistanceFromCamera);let g=t.evaluateSizeForFeature(e.textSizeData,u,m)*d/t.ONE_EM;n&&(g*=e.tilePixelRatio/l);const{width:y,height:x,anchor:v,textOffset:b,textBoxScale:w}=_,S=Pi(v,y,x,b,w,g),T=n?ht(r.add(S),a).point:h.point.add(i?S.rotate(-o.angle):S),E=e.allowVerticalPlacement&&m.placedOrientation===t.WritingMode.vertical?Math.PI/2:0;for(let e=0;e<m.numGlyphs;e++)t.addDynamicAttributes(p,T,E);c&&m.associatedIconIndex>=0&&(f[m.associatedIconIndex]={shiftedAnchor:T,angle:E})}else bt(m.numGlyphs,p)}if(c){d.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const n=i.get(e);if(n.hidden)bt(n.numGlyphs,d);else{const i=f[e];if(i)for(let e=0;e<n.numGlyphs;e++)t.addDynamicAttributes(d,i.shiftedAnchor,i.angle);else bt(n.numGlyphs,d)}}e.icon.dynamicLayoutVertexBuffer.updateData(d)}e.text.dynamicLayoutVertexBuffer.updateData(p)}function ki(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function zi(e,i,n,r,o,a,s,l,u,c,h,p){const d=e.context,f=d.gl,m=e.transform,g="map"===l,_="map"===u,y="viewport"!==l&&"point"!==n.layout.get("symbol-placement"),x=g&&!_&&!y,v=!n.layout.get("symbol-sort-key").isConstant();let b=!1;const w=e.depthModeForSublayer(0,Si.ReadOnly),S=n.layout.get("text-variable-anchor"),T=[];for(const l of r){const r=i.getTile(l),u=r.getBucket(n);if(!u)continue;const h=o?u.text:u.icon;if(!h||!h.segments.get().length)continue;const p=h.programConfigurations.get(n.id),d=o||u.sdfIcons,w=o?u.textSizeData:u.iconSizeData,E=_||0!==m.pitch,A=e.useProgram(ki(d,o,u),p),I=t.evaluateSizeForZoom(w,m.zoom);let C,P,M,k,z=[0,0],L=null;if(o){if(P=r.glyphAtlasTexture,M=f.LINEAR,C=r.glyphAtlasTexture.size,u.iconsInText){z=r.imageAtlasTexture.size,L=r.imageAtlasTexture;const t="composite"===w.kind||"camera"===w.kind;k=E||e.options.rotating||e.options.zooming||t?f.LINEAR:f.NEAREST}}else{const t=1!==n.layout.get("icon-size").constantOr(0)||u.iconsNeedLinear;P=r.imageAtlasTexture,M=d||e.options.rotating||e.options.zooming||t||E?f.LINEAR:f.NEAREST,C=r.imageAtlasTexture.size}const B=Et(r,1,e.transform.zoom),D=ut(l.posMatrix,_,g,e.transform,B),R=ct(l.posMatrix,_,g,e.transform,B),O=S&&u.hasTextData(),F="none"!==n.layout.get("icon-text-fit")&&O&&u.hasIconData();if(y){const t="map"===n.layout.get("text-rotation-alignment");ft(u,l.posMatrix,e,o,D,R,_,c,t)}const U=e.translatePosMatrix(l.posMatrix,r,a,s),j=y||o&&S||F?Ci:D,N=e.translatePosMatrix(R,r,a,s,!0),V=d&&0!==n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let G;G=d?u.iconsInText?ze(w.kind,I,x,_,e,U,j,N,C,z):ke(w.kind,I,x,_,e,U,j,N,o,C,!0):Me(w.kind,I,x,_,e,U,j,N,o,C);const q={program:A,buffers:h,uniformValues:G,atlasTexture:P,atlasTextureIcon:L,atlasInterpolation:M,atlasInterpolationIcon:k,isSDF:d,hasHalo:V};if(v&&u.canOverlap){b=!0;const e=h.segments.get();for(const i of e)T.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:q})}else T.push({segments:h.segments,sortKey:0,state:q})}b&&T.sort((t,e)=>t.sortKey-e.sortKey);for(const t of T){const i=t.state;if(d.activeTexture.set(f.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,f.CLAMP_TO_EDGE),i.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),i.isSDF){const r=i.uniformValues;i.hasHalo&&(r.u_is_halo=1,Li(i.buffers,t.segments,n,e,i.program,w,h,p,r)),r.u_is_halo=0}Li(i.buffers,t.segments,n,e,i.program,w,h,p,i.uniformValues)}}function Li(t,e,i,n,r,o,a,s,l){const u=n.context;r.draw(u,u.gl.TRIANGLES,o,a,s,Ei.disabled,l,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,n.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Bi(t,e,i,n,r,o,a){const s=t.context.gl,l=i.paint.get("fill-pattern"),u=l&&l.constantOr(1),c=i.getCrossfadeParameters();let h,p,d,f,m;a?(p=u&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=s.LINES):(p=u?"fillPattern":"fill",h=s.TRIANGLES);for(const g of n){const n=e.getTile(g);if(u&&!n.patternsLoaded())continue;const _=n.getBucket(i);if(!_)continue;const y=_.programConfigurations.get(i.id),x=t.useProgram(p,y);u&&(t.context.activeTexture.set(s.TEXTURE0),n.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),y.updatePaintBuffers(c));const v=l.constantOr(null);if(v&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[v.to.toString()],i=t.patternPositions[v.from.toString()];e&&i&&y.setConstantPatternPositions(e,i)}const b=t.translatePosMatrix(g.posMatrix,n,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(a){f=_.indexBuffer2,m=_.segments2;const e=[s.drawingBufferWidth,s.drawingBufferHeight];d="fillOutlinePattern"===p&&u?me(b,t,c,n,e):fe(b,e)}else f=_.indexBuffer,m=_.segments,d=u?de(b,t,c,n):pe(b);x.draw(t.context,h,r,t.stencilModeForClipping(g),o,Ei.disabled,d,i.id,_.layoutVertexBuffer,f,m,i.paint,t.transform.zoom,y)}}function Di(t,e,i,n,r,o,a){const s=t.context,l=s.gl,u=i.paint.get("fill-extrusion-pattern"),c=u.constantOr(1),h=i.getCrossfadeParameters(),p=i.paint.get("fill-extrusion-opacity");for(const d of n){const n=e.getTile(d),f=n.getBucket(i);if(!f)continue;const m=f.programConfigurations.get(i.id),g=t.useProgram(c?"fillExtrusionPattern":"fillExtrusion",m);c&&(t.context.activeTexture.set(l.TEXTURE0),n.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),m.updatePaintBuffers(h));const _=u.constantOr(null);if(_&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[_.to.toString()],i=t.patternPositions[_.from.toString()];e&&i&&m.setConstantPatternPositions(e,i)}const y=t.translatePosMatrix(d.posMatrix,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),x=i.paint.get("fill-extrusion-vertical-gradient"),v=c?he(y,t,x,p,d,h,n):ce(y,t,x,p);g.draw(s,s.gl.TRIANGLES,r,o,a,Ei.backCCW,v,i.id,f.layoutVertexBuffer,f.indexBuffer,f.segments,i.paint,t.transform.zoom,m)}}function Ri(t,e,i,n,r,o){const a=t.context,s=a.gl,l=e.fbo;if(!l)return;const u=t.useProgram("hillshade");a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,l.colorAttachment.get());const c=((t,e,i)=>{const n=i.paint.get("hillshade-shadow-color"),r=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a-=t.transform.angle);const s=!t.options.moving;return{u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),s),u_image:0,u_latrange:be(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:n,u_highlight:r,u_accent:o}})(t,e,i);u.draw(a,s.TRIANGLES,n,r,o,Ei.disabled,c,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function Oi(e,i,n,r,o,a){const s=e.context,l=s.gl,u=i.dem;if(u&&u.data){const c=u.dim,h=u.stride,d=u.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(h),i.demTexture){const t=i.demTexture;t.update(d,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new p(s,d,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let f=i.fbo;if(!f){const t=new p(s,{width:c,height:c,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),f=i.fbo=s.createFramebuffer(c,c,!0),f.colorAttachment.set(t.texture)}s.bindFramebuffer.set(f.framebuffer),s.viewport.set([0,0,c,c]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,r,o,a,Ei.disabled,((e,i)=>{const n=i.stride,r=t.create();return t.ortho(r,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(r,r,[0,-t.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[n,n],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,u),n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Fi(e,i,n,r,o){const a=r.paint.get("raster-fade-duration");if(a>0){const r=t.exported.now(),s=(r-e.timeAdded)/a,l=i?(r-i.timeAdded)/a:-1,u=n.getSource(),c=o.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-c)>Math.abs(e.tileID.overscaledZ-c),p=h&&e.refreshedUponExpiration?1:t.clamp(h?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const Ui=new t.Color(1,0,0,1),ji=new t.Color(0,1,0,1),Ni=new t.Color(0,0,1,1),Vi=new t.Color(1,0,1,1),Gi=new t.Color(0,1,1,1);function qi(t,e,i,n){Zi(t,0,e+i/2,t.transform.width,i,n)}function Wi(t,e,i,n){Zi(t,e-i/2,0,i,t.transform.height,n)}function Zi(t,e,i,n,r,o){const a=t.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*t.pixelRatio,i*t.pixelRatio,n*t.pixelRatio,r*t.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function Hi(e,i,n){const r=e.context,o=r.gl,a=n.posMatrix,s=e.useProgram("debug"),l=Si.disabled,u=Ti.disabled,c=e.colorModeForRenderPass(),h="$debug";r.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.draw(r,o.LINE_STRIP,l,u,c,Ei.disabled,ye(a,t.Color.red),h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);const p=i.getTileByID(n.key).latestRawTileData,d=Math.floor((p&&p.byteLength||0)/1024),f=i.getTile(n).tileSize,m=512/Math.min(f,512)*(n.overscaledZ/e.transform.zoom)*.5;let g=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(g+=" => "+n.overscaledZ),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,n=t.context.gl,r=t.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,i.width,i.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(e,5,5),r.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,`${g} ${d}kb`),s.draw(r,o.TRIANGLES,l,u,bi.alphaBlended,Ei.disabled,ye(a,t.Color.transparent,m),h,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}const $i={symbol:function(e,i,n,r,o){if("translucent"!==e.renderPass)return;const a=Ti.disabled,s=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,i,n,r,o,a,s){const l=i.transform,u="map"===o,c="map"===a;for(const o of e){const e=r.getTile(o),a=e.getBucket(n);if(!a||!a.text||!a.text.segments.get().length)continue;const h=t.evaluateSizeForZoom(a.textSizeData,l.zoom),p=Et(e,1,i.transform.zoom),d=ut(o.posMatrix,c,u,i.transform,p),f="none"!==n.layout.get("icon-text-fit")&&a.hasIconData();if(h){const t=Math.pow(2,l.zoom-e.tileID.overscaledZ);Mi(a,u,c,s,l,d,o.posMatrix,t,h,f)}}}(r,e,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),o),0!==n.paint.get("icon-opacity").constantOr(1)&&zi(e,i,n,r,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),a,s),0!==n.paint.get("text-opacity").constantOr(1)&&zi(e,i,n,r,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),a,s),i.map.showCollisionBoxes&&(Ii(e,i,n,r,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Ii(e,i,n,r,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(e,i,n,r){if("translucent"!==e.renderPass)return;const o=n.paint.get("circle-opacity"),a=n.paint.get("circle-stroke-width"),s=n.paint.get("circle-stroke-opacity"),l=!n.layout.get("circle-sort-key").isConstant();if(0===o.constantOr(1)&&(0===a.constantOr(1)||0===s.constantOr(1)))return;const u=e.context,c=u.gl,h=e.depthModeForSublayer(0,Si.ReadOnly),p=Ti.disabled,d=e.colorModeForRenderPass(),f=[];for(let o=0;o<r.length;o++){const a=r[o],s=i.getTile(a),u=s.getBucket(n);if(!u)continue;const c=u.programConfigurations.get(n.id),h={programConfiguration:c,program:e.useProgram("circle",c),layoutVertexBuffer:u.layoutVertexBuffer,indexBuffer:u.indexBuffer,uniformValues:ge(e,a,s,n)};if(l){const e=u.segments.get();for(const i of e)f.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:h})}else f.push({segments:u.segments,sortKey:0,state:h})}l&&f.sort((t,e)=>t.sortKey-e.sortKey);for(const t of f){const{programConfiguration:i,program:r,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s}=t.state;r.draw(u,c.TRIANGLES,h,p,d,Ei.disabled,s,n.id,o,a,t.segments,n.paint,e.transform.zoom,i)}},heatmap:function(e,i,n,r){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const o=e.context,a=o.gl,s=Ti.disabled,l=new bi([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){const n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let r=i.heatmapFbo;if(r)n.bindTexture(n.TEXTURE_2D,r.colorAttachment.get()),t.bindFramebuffer.set(r.framebuffer);else{const o=n.createTexture();n.bindTexture(n.TEXTURE_2D,o),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),r=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,i,n){const r=t.gl;r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e.width/4,e.height/4,0,r.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:r.UNSIGNED_BYTE,null),n.colorAttachment.set(i)}(t,e,o,r)}}(o,e,n),o.clear({color:t.Color.transparent});for(let t=0;t<r.length;t++){const u=r[t];if(i.hasRenderableParent(u))continue;const c=i.getTile(u),h=c.getBucket(n);if(!h)continue;const p=h.programConfigurations.get(n.id),d=e.useProgram("heatmap",p),{zoom:f}=e.transform;d.draw(o,a.TRIANGLES,Si.disabled,s,l,Ei.disabled,ve(u.posMatrix,c,f,n.paint.get("heatmap-intensity")),n.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,n.paint,e.transform.zoom,p)}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){const n=e.context,r=n.gl,o=i.heatmapFbo;if(!o)return;n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,o.colorAttachment.get()),n.activeTexture.set(r.TEXTURE1);let a=i.colorRampTexture;a||(a=i.colorRampTexture=new p(n,i.colorRamp,r.RGBA)),a.bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(n,r.TRIANGLES,Si.disabled,Ti.disabled,e.colorModeForRenderPass(),Ei.disabled,((e,i,n,r)=>{const o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);const a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}})(e,i),i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom)}(e,n))},line:function(e,i,n,r){if("translucent"!==e.renderPass)return;const o=n.paint.get("line-opacity"),a=n.paint.get("line-width");if(0===o.constantOr(1)||0===a.constantOr(1))return;const s=e.depthModeForSublayer(0,Si.ReadOnly),l=e.colorModeForRenderPass(),u=n.paint.get("line-dasharray"),c=n.paint.get("line-pattern"),h=c.constantOr(1),d=n.paint.get("line-gradient"),f=n.getCrossfadeParameters(),m=h?"linePattern":u?"lineSDF":d?"lineGradient":"line",g=e.context,_=g.gl;let y=!0;for(const o of r){const r=i.getTile(o);if(h&&!r.patternsLoaded())continue;const a=r.getBucket(n);if(!a)continue;const x=a.programConfigurations.get(n.id),v=e.context.program.get(),b=e.useProgram(m,x),w=y||b.program!==v,S=c.constantOr(null);if(S&&r.imageAtlas){const t=r.imageAtlas,e=t.patternPositions[S.to.toString()],i=t.patternPositions[S.from.toString()];e&&i&&x.setConstantPatternPositions(e,i)}const T=h?Te(e,r,n,f):u?Ee(e,r,n,u,f):d?Se(e,r,n,a.lineClipsArray.length):we(e,r,n);if(h)g.activeTexture.set(_.TEXTURE0),r.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),x.updatePaintBuffers(f);else if(u&&(w||e.lineAtlas.dirty))g.activeTexture.set(_.TEXTURE0),e.lineAtlas.bind(g);else if(d){const r=a.gradients[n.id];let s=r.texture;if(n.gradientVersion!==r.version){let l=256;if(n.stepInterpolant){const n=i.getSource().maxzoom,r=o.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;l=t.clamp(t.nextPowerOfTwo(a.maxLineLength/t.EXTENT*1024*r),256,g.maxTextureSize)}r.gradient=t.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:r.gradient||void 0,clips:a.lineClipsArray}),r.texture?r.texture.update(r.gradient):r.texture=new p(g,r.gradient,_.RGBA),r.version=n.gradientVersion,s=r.texture}g.activeTexture.set(_.TEXTURE0),s.bind(n.stepInterpolant?_.NEAREST:_.LINEAR,_.CLAMP_TO_EDGE)}b.draw(g,_.TRIANGLES,s,e.stencilModeForClipping(o),l,Ei.disabled,T,n.id,a.layoutVertexBuffer,a.indexBuffer,a.segments,n.paint,e.transform.zoom,x,a.layoutVertexBuffer2),y=!1}},fill:function(e,i,n,r){const o=n.paint.get("fill-color"),a=n.paint.get("fill-opacity");if(0===a.constantOr(1))return;const s=e.colorModeForRenderPass(),l=n.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(e.renderPass===u){const t=e.depthModeForSublayer(1,"opaque"===e.renderPass?Si.ReadWrite:Si.ReadOnly);Bi(e,i,n,r,t,s,!1)}if("translucent"===e.renderPass&&n.paint.get("fill-antialias")){const t=e.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Si.ReadOnly);Bi(e,i,n,r,t,s,!0)}},"fill-extrusion":function(t,e,i,n){const r=i.paint.get("fill-extrusion-opacity");if(0!==r&&"translucent"===t.renderPass){const o=new Si(t.context.gl.LEQUAL,Si.ReadWrite,t.depthRangeFor3D);if(1!==r||i.paint.get("fill-extrusion-pattern").constantOr(1))Di(t,e,i,n,o,Ti.disabled,bi.disabled),Di(t,e,i,n,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{const r=t.colorModeForRenderPass();Di(t,e,i,n,o,Ti.disabled,r)}}},hillshade:function(t,e,i,n){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const r=t.context,o=t.depthModeForSublayer(0,Si.ReadOnly),a=t.colorModeForRenderPass(),[s,l]="translucent"===t.renderPass?t.stencilConfigForOverlap(n):[{},n];for(const n of l){const r=e.getTile(n);r.needsHillshadePrepare&&"offscreen"===t.renderPass?Oi(t,r,i,o,Ti.disabled,a):"translucent"===t.renderPass&&Ri(t,r,i,o,s[n.overscaledZ],a)}r.viewport.set([0,0,t.width,t.height])},raster:function(t,e,i,n){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!n.length)return;const r=t.context,o=r.gl,a=e.getSource(),s=t.useProgram("raster"),l=t.colorModeForRenderPass(),[u,c]=a instanceof z?[{},n]:t.stencilConfigForOverlap(n),h=c[c.length-1].overscaledZ,p=!t.options.moving;for(const n of c){const c=t.depthModeForSublayer(n.overscaledZ-h,1===i.paint.get("raster-opacity")?Si.ReadWrite:Si.ReadOnly,o.LESS),d=e.getTile(n),f=t.transform.calculatePosMatrix(n.toUnwrapped(),p);d.registerFadeDuration(i.paint.get("raster-fade-duration"));const m=e.findLoadedParent(n,0),g=Fi(d,m,e,i,t.transform);let _,y;const x="nearest"===i.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;r.activeTexture.set(o.TEXTURE0),d.texture.bind(x,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),r.activeTexture.set(o.TEXTURE1),m?(m.texture.bind(x,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),_=Math.pow(2,m.tileID.overscaledZ-d.tileID.overscaledZ),y=[d.tileID.canonical.x*_%1,d.tileID.canonical.y*_%1]):d.texture.bind(x,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);const v=Ce(f,y||[0,0],_||1,g,i);a instanceof z?s.draw(r,o.TRIANGLES,c,Ti.disabled,l,Ei.disabled,v,i.id,a.boundsBuffer,t.quadTriangleIndexBuffer,a.boundsSegments):s.draw(r,o.TRIANGLES,c,u[n.overscaledZ],l,Ei.disabled,v,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,i){const n=i.paint.get("background-color"),r=i.paint.get("background-opacity");if(0===r)return;const o=t.context,a=o.gl,s=t.transform,l=s.tileSize,u=i.paint.get("background-pattern");if(t.isPatternMissing(u))return;const c=!u&&1===n.a&&1===r&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==c)return;const h=Ti.disabled,p=t.depthModeForSublayer(0,"opaque"===c?Si.ReadWrite:Si.ReadOnly),d=t.colorModeForRenderPass(),f=t.useProgram(u?"backgroundPattern":"background"),m=s.coveringTiles({tileSize:l});u&&(o.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));const g=i.getCrossfadeParameters();for(const e of m){const s=t.transform.calculatePosMatrix(e.toUnwrapped()),c=u?Be(s,r,t,u,{tileID:e,tileSize:l},g):Le(s,r,n);f.draw(o,a.TRIANGLES,p,h,d,Ei.disabled,c,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}},debug:function(t,e,i){for(let n=0;n<i.length;n++)Hi(t,e,i[n])},custom:function(t,e,i){const n=t.context,r=i.implementation;if("offscreen"===t.renderPass){const e=r.prerender;e&&(t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),e.call(r,n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),n.setStencilMode(Ti.disabled);const e="3d"===r.renderingMode?new Si(t.context.gl.LEQUAL,Si.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Si.ReadOnly);n.setDepthMode(e),r.render(n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState(),n.bindFramebuffer.set(null)}}};class Xi{constructor(t,e){this.context=new wi(t),this.transform=e,this._tileTextures={},this.setup(),this.numSublayers=V.maxUnderzooming+V.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jt,this.gpuTimers={}}resize(t,e,i){if(this.width=t*i,this.height=e*i,this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const e=this.context,i=new t.PosArray;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,ne.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);const n=new t.PosArray;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(n,ne.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);const r=new t.RasterBoundsArray;r.emplaceBack(0,0,0,0),r.emplaceBack(t.EXTENT,0,t.EXTENT,0),r.emplaceBack(0,t.EXTENT,0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(r,k.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);const o=new t.PosArray;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,ne.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);const a=new t.LineStripIndexArray;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);const s=new t.TriangleIndexArray;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s),this.emptyTexture=new p(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);const l=this.context.gl;this.stencilClearMode=new Ti({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const n=t.create();t.ortho(n,0,this.width,this.height,0,0,1),t.scale(n,n,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,i.TRIANGLES,Si.disabled,this.stencilClearMode,bi.disabled,Ei.disabled,xe(n),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const i=this.context,n=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(bi.disabled),i.setDepthMode(Si.disabled);const r=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++;r.draw(i,n.TRIANGLES,Si.disabled,new Ti({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),bi.disabled,Ei.disabled,xe(t.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Ti({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ti({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort((t,e)=>e.overscaledZ-t.overscaledZ),n=i[i.length-1].overscaledZ,r=i[0].overscaledZ-n+1;if(r>1){this.currentStencilSource=void 0,this.nextStencilID+r>256&&this.clearStencil();const t={};for(let i=0;i<r;i++)t[i+n]=new Ti({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=r,[t,i]}return[{[n]:Ti.disabled},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new bi([e.CONSTANT_COLOR,e.ONE],new t.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?bi.unblended:bi.alphaBlended}depthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return Si.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Si(i||this.context.gl.LEQUAL,e,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.exported.now()),this.imageManager.beginFrame();const n=this.style._order,r=this.style.sourceCaches;for(const t in r){const e=r[t];e.used&&e.prepare(this.context)}const o={},a={},s={};for(const t in r){const e=r[t];o[t]=e.getVisibleCoordinates(),a[t]=o[t].slice().reverse(),s[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<n.length;t++)if(this.style._layers[n[t]].is3D()){this.opaquePassCutoff=t;break}this.renderPass="offscreen";for(const t of n){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=a[e.source];("custom"===e.type||i.length)&&this.renderLayer(this,r[e.source],e,i)}for(this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[n[this.currentLayer]],e=r[t.source],i=o[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){const t=this.style._layers[n[this.currentLayer]],e=r[t.source],i=("symbol"===t.type?s:a)[t.source];this._renderTileClippingMasks(t,o[t.source]),this.renderLayer(this,e,t,i)}if(this.options.showTileBoundaries){let t,e;Object.values(this.style._layers).forEach(i=>{i.source&&!i.isHidden(this.transform.zoom)&&(i.source!==(e&&e.id)&&(e=this.style.sourceCaches[i.source]),(!t||t.getSource().maxzoom<e.getSource().maxzoom)&&(t=e))}),t&&$i.debug(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;qi(t,t.transform.height-(e.top||0),3,Ui),qi(t,e.bottom||0,3,ji),Wi(t,e.left||0,3,Ni),Wi(t,t.transform.width-(e.right||0),3,Vi);const i=t.transform.centerPoint;!function(t,e,i,n){Zi(t,e-1,i-10,2,20,n),Zi(t,e-10,i-1,20,2,n)}(t,i.x,t.transform.height-i.y,Gi)}(this),this.context.setDefault()}renderLayer(t,e,i,n){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||n.length)&&(this.id=i.id,this.gpuTimingStart(i),$i[i.type](t,e,i,n,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const e=this.context.extTimerQuery;let i=this.gpuTimers[t.id];i||(i=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),i.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,i.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const e={};for(const i in t){const n=t[i],r=this.context.extTimerQuery,o=r.getQueryObjectEXT(n.query,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(n.query),e[i]=o}return e}translatePosMatrix(e,i,n,r,o){if(!n[0]&&!n[1])return e;const a=o?"map"===r?this.transform.angle:0:"viewport"===r?-this.transform.angle:0;if(a){const t=Math.sin(a),e=Math.cos(a);n=[n[0]*e-n[1]*t,n[0]*t+n[1]*e]}const s=[o?n[0]:Et(i,n[0],this.transform.zoom),o?n[1]:Et(i,n[1],this.transform.zoom),0],l=new Float32Array(16);return t.translate(l,e,s),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e){this.cache=this.cache||{};const i=`${t}${e?e.cacheKey:""}${this._showOverdrawInspector?"/overdraw":""}`;return this.cache[i]||(this.cache[i]=new le(this.context,t,re[t],e,De[t],this._showOverdrawInspector)),this.cache[i]}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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new p(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Ki{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(e,i,n){const r=Math.pow(2,n),o=[[-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(i=>t.transformMat4([],i,e)).map(e=>t.scale$1([],e,1/e[3]/i*r)),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(t=>{const e=function(t,e){var i=e[0],n=e[1],r=e[2],o=i*i+n*n+r*r;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}([],function(t,e,i){var n=e[0],r=e[1],o=e[2],a=i[0],s=i[1],l=i[2];return t[0]=r*l-o*s,t[1]=o*a-n*l,t[2]=n*s-r*a,t}([],c([],o[t[0]],o[t[1]]),c([],o[t[2]],o[t[1]]))),i=-((n=e)[0]*(r=o[t[1]])[0]+n[1]*r[1]+n[2]*r[2]);var n,r;return e.concat(i)});return new Ki(o,a)}}class Ji{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],i=l(this.min),n=l(this.max);for(let t=0;t<e.length;t++)i[t]=e[t]?this.min[t]:this.center[t],n[t]=e[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new Ji(i,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(e){const i=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]];let n=!0;for(let r=0;r<e.planes.length;r++){const o=e.planes[r];let a=0;for(let e=0;e<i.length;e++)t.dot(o,i[e])>=0&&a++;if(0===a)return 0;a!==i.length&&(n=!1)}if(n)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let r=0;r<e.points.length;r++){const o=e.points[r][t]-this.min[t];i=Math.min(i,o),n=Math.max(n,o)}if(n<0||i>this.max[t]-this.min[t])return 0}return 1}}class Yi{constructor(t=0,e=0,i=0,n=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=n}interpolate(e,i,n){return null!=i.top&&null!=e.top&&(this.top=t.number(e.top,i.top,n)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,i.bottom,n)),null!=i.left&&null!=e.left&&(this.left=t.number(e.left,i.left,n)),null!=i.right&&null!=e.right&&(this.right=t.number(e.right,i.right,n)),this}getCenter(e,i){const n=t.clamp((this.left+e-this.right)/2,0,e),r=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.pointGeometry(n,r)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Yi(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Qi{constructor(e,i,n,r,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||!!o,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==r?60:r,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Yi,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new Qi(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}(),function(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);t[0]=n*l+o*s,t[1]=r*l+a*s,t[2]=n*-s+o*l,t[3]=r*-s+a*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies){const n=this.pointCoordinate(new t.pointGeometry(0,0)),r=this.pointCoordinate(new t.pointGeometry(this.width,0)),o=this.pointCoordinate(new t.pointGeometry(this.width,this.height)),a=this.pointCoordinate(new t.pointGeometry(0,this.height)),s=Math.floor(Math.min(n.x,r.x,o.x,a.x)),l=Math.floor(Math.max(n.x,r.x,o.x,a.x)),u=1;for(let n=s-u;n<=l+u;n++)0!==n&&i.push(new t.UnwrappedTileID(n,e))}return i}coveringTiles(e){let i=this.coveringZoomLevel(e);const n=i;if(void 0!==e.minzoom&&i<e.minzoom)return[];void 0!==e.maxzoom&&i>e.maxzoom&&(i=e.maxzoom);const r=t.MercatorCoordinate.fromLngLat(this.center),o=Math.pow(2,i),a=[o*r.x,o*r.y,0],s=Ki.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i);let l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=i);const u=t=>({aabb:new Ji([t*o,0,0],[(t+1)*o,o,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),c=[],p=[],d=i,f=e.reparseOverscaled?n:i;if(this._renderWorldCopies)for(let t=1;t<=3;t++)c.push(u(-t)),c.push(u(t));for(c.push(u(0));c.length>0;){const e=c.pop(),i=e.x,n=e.y;let r=e.fullyVisible;if(!r){const t=e.aabb.intersects(s);if(0===t)continue;r=2===t}const o=e.aabb.distanceX(a),u=e.aabb.distanceY(a),m=Math.max(Math.abs(o),Math.abs(u)),g=3+(1<<d-e.zoom)-2;if(e.zoom===d||m>g&&e.zoom>=l)p.push({tileID:new t.OverscaledTileID(e.zoom===d?f:e.zoom,e.wrap,e.zoom,i,n),distanceSq:h([a[0]-.5-i,a[1]-.5-n])});else for(let t=0;t<4;t++){const o=(i<<1)+t%2,a=(n<<1)+(t>>1);c.push({aabb:e.aabb.quadrant(t),zoom:e.zoom+1,x:o,y:a,wrap:e.wrap,fullyVisible:r})}}return p.sort((t,e)=>t.distanceSq-e.distanceSq).map(t=>t.tileID)}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.pointGeometry(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}setLocationAtPoint(e,i){const n=this.pointCoordinate(i),r=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(n.x-r.x),o.y-(n.y-r.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t){return this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}locationCoordinate(e){return t.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t.toLngLat()}pointCoordinate(e){const i=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(i,i,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);const r=i[3],o=n[3],a=i[1]/r,s=n[1]/o,l=i[2]/r,u=n[2]/o,c=l===u?0:(0-l)/(u-l);return new t.MercatorCoordinate(t.number(i[0]/r,n[0]/o,c)/this.worldSize,t.number(a,s,c)/this.worldSize)}coordinatePoint(e){const i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix),new t.pointGeometry(i[0]/i[3],i[1]/i[3])}getBounds(){return(new t.LngLatBounds).extend(this.pointLocation(new t.pointGeometry(0,0))).extend(this.pointLocation(new t.pointGeometry(this.width,0))).extend(this.pointLocation(new t.pointGeometry(this.width,this.height))).extend(this.pointLocation(new t.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,i=!1){const n=e.key,r=i?this._alignedPosMatrixCache:this._posMatrixCache;if(r[n])return r[n];const o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*a,o.y*a,0]),t.scale(l,l,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),r[n]=new Float32Array(l),r[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,i,n,r,o=-90,a=90,s=-180,l=180;const u=this.size,c=this._unmodified;if(this.latRange){const i=this.latRange;o=t.mercatorYfromLat(i[1])*this.worldSize,a=t.mercatorYfromLat(i[0])*this.worldSize,e=a-o<u.y?u.y/(a-o):0}if(this.lngRange){const e=this.lngRange;s=t.mercatorXfromLng(e[0])*this.worldSize,l=t.mercatorXfromLng(e[1])*this.worldSize,i=l-s<u.x?u.x/(l-s):0}const h=this.point,p=Math.max(i||0,e||0);if(p)return this.center=this.unproject(new t.pointGeometry(i?(l+s)/2:h.x,e?(a+o)/2:h.y)),this.zoom+=this.scaleZoom(p),this._unmodified=c,void(this._constraining=!1);if(this.latRange){const t=h.y,e=u.y/2;t-e<o&&(r=o+e),t+e>a&&(r=a-e)}if(this.lngRange){const t=h.x,e=u.x/2;t-e<s&&(n=s+e),t+e>l&&(n=l-e)}void 0===n&&void 0===r||(this.center=this.unproject(new t.pointGeometry(void 0!==n?n:h.x,void 0!==r?r:h.y))),this._unmodified=c,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;const i=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),r=Math.sin(n)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-i-n,.01,Math.PI-.01)),o=this.point,a=o.x,s=o.y,l=1.01*(Math.cos(Math.PI/2-this._pitch)*r+this.cameraToCenterDistance),u=this.height/50;let c=new Float64Array(16);t.perspective(c,this._fov,this.width/this.height,u,l),c[8]=2*-e.x/this.width,c[9]=2*e.y/this.height,t.scale(c,c,[1,-1,1]),t.translate(c,c,[0,0,-this.cameraToCenterDistance]),t.rotateX(c,c,this._pitch),t.rotateZ(c,c,this.angle),t.translate(c,c,[-a,-s,0]),this.mercatorMatrix=t.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),t.scale(c,c,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize]),this.projMatrix=c,this.invProjMatrix=t.invert([],this.projMatrix);const h=this.width%2/2,p=this.height%2/2,d=Math.cos(this.angle),f=Math.sin(this.angle),m=a-Math.round(a)+d*h+f*p,g=s-Math.round(s)+d*p+f*h,_=new Float64Array(c);if(t.translate(_,_,[m>.5?m-1:m,g>.5?g-1:g,0]),this.alignedProjMatrix=_,c=t.create(),t.scale(c,c,[this.width/2,-this.height/2,1]),t.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=t.create(),t.scale(c,c,[1,-1,1]),t.translate(c,c,[-1,-1,0]),t.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),c=t.invert(new Float64Array(16),this.pixelMatrix),!c)throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.pointGeometry(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.pointGeometry(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return[e[0],i];{let n=i.x,r=i.y,o=i.x,a=i.y;for(const t of e)n=Math.min(n,t.x),r=Math.min(r,t.y),o=Math.max(o,t.x),a=Math.max(a,t.y);return[new t.pointGeometry(n,r),new t.pointGeometry(o,r),new t.pointGeometry(o,a),new t.pointGeometry(n,a),new t.pointGeometry(n,r)]}}}class tn{constructor(e){this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(t,e){let i=!1,n=null;const r=()=>{n=null,i&&(t(),n=setTimeout(r,300),i=!1)};return()=>(i=!0,n||r(),n)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,n),o=Math.round(e.lng*r)/r,a=Math.round(e.lat*r)/r,s=this._map.getBearing(),l=this._map.getPitch();let u="";if(u+=t?`/${o}/${a}/${i}`:`${i}/${a}/${o}`,(s||l)&&(u+="/"+Math.round(10*s)/10),l&&(u+="/"+Math.round(l)),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map(i=>{const n=i.split("=")[0];return n===t?(e=!0,`${n}=${u}`):i}).filter(t=>t);return e||i.push(`${t}=${u}`),"#"+i.join("&")}return"#"+u}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map(t=>t.split("=")).forEach(t=>{t[0]===this._hashName&&(e=t)}),(e&&e[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(t=>isNaN(t))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(t){}}}const en={linearity:.3,easing:t.bezier(0,0,.3,1)},nn=t.extend({deceleration:2500,maxSpeed:1400},en),rn=t.extend({deceleration:20,maxSpeed:1400},en),on=t.extend({deceleration:1e3,maxSpeed:360},en),an=t.extend({deceleration:1e3,maxSpeed:90},en);class sn{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.exported.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.exported.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(i.pan.mag()){const o=un(i.pan.mag(),n,t.extend({},nn,e||{}));r.offset=i.pan.mult(o.amount/i.pan.mag()),r.center=this._map.transform.center,ln(r,o)}if(i.zoom){const t=un(i.zoom,n,rn);r.zoom=this._map.transform.zoom+t.amount,ln(r,t)}if(i.bearing){const e=un(i.bearing,n,on);r.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),ln(r,e)}if(i.pitch){const t=un(i.pitch,n,an);r.pitch=this._map.transform.pitch+t.amount,ln(r,t)}if(r.zoom||r.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;r.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.extend(r,{noMoveStart:!0})}}function ln(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function un(e,i,n){const{maxSpeed:r,linearity:o,deceleration:a}=n,s=t.clamp(e*o/(i/1e3),-r,r),l=Math.abs(s)/(a*o);return{easing:n.easing,duration:1e3*l,amount:s*(l/2)}}class cn extends t.Event{constructor(e,i,n,r={}){const a=o.mousePos(i.getCanvasContainer(),n),s=i.unproject(a);super(e,t.extend({point:a,lngLat:s,originalEvent:n},r)),this._defaultPrevented=!1,this.target=i}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class hn extends t.Event{constructor(e,i,n){const r="touchend"===e?n.changedTouches:n.touches,a=o.touchPos(i.getCanvasContainer(),r),s=a.map(t=>i.unproject(t)),l=a.reduce((t,e,i,n)=>t.add(e.div(n.length)),new t.pointGeometry(0,0));super(e,{points:a,point:l,lngLats:s,lngLat:i.unproject(l),originalEvent:n}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class pn extends t.Event{constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class dn{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new pn(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new cn(t.type,this._map,t))}mouseup(t){this._map.fire(new cn(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new cn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new cn(t.type,this._map,t))}mouseover(t){this._map.fire(new cn(t.type,this._map,t))}mouseout(t){this._map.fire(new cn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new hn(t.type,this._map,t))}touchmove(t){this._map.fire(new hn(t.type,this._map,t))}touchend(t){this._map.fire(new hn(t.type,this._map,t))}touchcancel(t){this._map.fire(new hn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fn{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(t){this._map.fire(new cn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new cn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new cn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class mn{constructor(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(o.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;const n=this._startPos;this._lastPos=i,this._box||(this._box=o.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const r=Math.min(n.x,i.x),a=Math.max(n.x,i.x),s=Math.min(n.y,i.y),l=Math.max(n.y,i.y);o.setTransform(this._box,`translate(${r}px,${s}px)`),this._box.style.width=a-r+"px",this._box.style.height=l-s+"px"}mouseupWindow(e,i){if(!this._active)return;if(0!==e.button)return;const n=this._startPos,r=i;if(this.reset(),o.suppressClick(),n.x!==r.x||n.y!==r.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:t=>t.fitScreenCoordinates(n,r,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(o.remove(this._box),this._box=null),o.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function gn(t,e){const i={};for(let n=0;n<t.length;n++)i[t[n].identifier]=e[n];return i}class _n{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){const i=new t.pointGeometry(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=gn(n,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const n=gn(i,e);for(const t in this.touches){const e=this.touches[t],i=n[t];(!i||i.dist(e)>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class yn{constructor(t){this.singleTap=new _n(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const n=this.singleTap.touchend(t,e,i);if(n){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class xn{constructor(){this._zoomIn=new yn({numTouches:1,numTaps:2}),this._zoomOut=new yn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const n=this._zoomIn.touchend(t,e,i),r=this._zoomOut.touchend(t,e,i);return n?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(n)},{originalEvent:t})}):r?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(r)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const vn={0:1,2:2};class bn{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,e){return!1}_move(t,e){return{}}mousedown(t,e){if(this._lastPoint)return;const i=o.mouseButton(t);this._correctButton(t,i)&&(this._lastPoint=e,this._eventButton=i)}mousemoveWindow(t,e){const i=this._lastPoint;if(i)if(t.preventDefault(),function(t,e){const i=vn[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=e,this._move(i,e)}mouseupWindow(t){this._lastPoint&&o.mouseButton(t)===this._eventButton&&(this._moved&&o.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wn extends bn{mousedown(t,e){super.mousedown(t,e),this._lastPoint&&(this._active=!0)}_correctButton(t,e){return 0===e&&!t.ctrlKey}_move(t,e){return{around:e,panDelta:e.sub(t)}}}class Sn extends bn{_correctButton(t,e){return 0===e&&t.ctrlKey||2===e}_move(t,e){const i=.8*(e.x-t.x);if(i)return this._active=!0,{bearingDelta:i}}contextmenu(t){t.preventDefault()}}class Tn extends bn{_correctButton(t,e){return 0===e&&t.ctrlKey||2===e}_move(t,e){const i=-.5*(e.y-t.y);if(i)return this._active=!0,{pitchDelta:i}}contextmenu(t){t.preventDefault()}}class En{constructor(t){this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.pointGeometry(0,0)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._active&&!(i.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,i)}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,n){n.length>0&&(this._active=!0);const r=gn(n,i),o=new t.pointGeometry(0,0),a=new t.pointGeometry(0,0);let s=0;for(const t in r){const e=r[t],i=this._touches[t];i&&(o._add(e),a._add(e.sub(i)),s++,r[t]=e)}if(this._touches=r,s<this._minTouches||!a.mag())return;const l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class An{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,e,i){return{}}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[n,r]=this._firstTwoTouches,o=In(i,e,n),a=In(i,e,r);if(!o||!a)return;const s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}touchend(t,e,i){if(!this._firstTwoTouches)return;const[n,r]=this._firstTwoTouches,a=In(i,e,n),s=In(i,e,r);a&&s||(this._active&&o.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function In(t,e,i){for(let n=0;n<t.length;n++)if(t[n].identifier===i)return e[n]}function Cn(t,e){return Math.log(t/e)/Math.LN2}class Pn extends An{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Cn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cn(this._distance,i),pinchAround:e}}}function Mn(t,e){return 180*t.angleWith(e)/Math.PI}class kn extends An{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Mn(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=Mn(t,this._startVector);return Math.abs(i)<e}}function zn(t){return Math.abs(t.y)>Math.abs(t.x)}class Ln extends An{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(t){this._lastPoints=t,zn(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){const n=t[0].sub(this._lastPoints[0]),r=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(n,r,i.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+r.y)/2*-.5}}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const n=t.mag()>=2,r=e.mag()>=2;if(!n&&!r)return;if(!n||!r)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return zn(t)&&zn(e)&&o}}const Bn={panStep:100,bearingStep:15,pitchStep:10};class Dn{constructor(){const t=Bn;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,n=0,r=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),r=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),r=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:a=>{const s=a.getZoom();a.easeTo({duration:300,easeId:"keyboardHandler",easing:Rn,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:a.getBearing()+i*this._bearingStep,pitch:a.getPitch()+n*this._pitchStep,offset:[-r*this._panStep,-o*this._panStep],center:a.getCenter()},{originalEvent:t})}}}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 Rn(t){return t*(2-t)}const On=4.000244140625;class Fn{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const n=t.exported.now(),r=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%On==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=o.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(i)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._map.transform;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>On?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const n="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(n*i))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,n=this._startZoom,r=this._easing;let o,a=!1;if("wheel"===this._type&&n&&r){const e=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),s=r(e);o=t.number(n,i,s),e<1?this._frameId||(this._frameId=!0):a=!0}else o=i,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.ease;if(this._prevEase){const e=this._prevEase,n=(t.exported.now()-e.start)/e.duration,r=e.easing(n+.01)-e.easing(n),o=.27/Math.sqrt(r*r+1e-4)*.01,a=Math.sqrt(.0729-o*o);i=t.bezier(o,a,.25,1)}return this._prevEase={start:t.exported.now(),duration:e,easing:i},i}reset(){this._active=!1}}class Un{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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 jn{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(t.shiftKey?-1:1),around:i.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nn{constructor(){this._tap=new yn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i))}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const n=e[0],r=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vn{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Gn{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class qn{constructor(t,e,i,n){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Wn=t=>t.zoom||t.drag||t.pitch||t.rotate;class Zn extends t.Event{}function Hn(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class $n{constructor(e,i){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new sn(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i),t.bindAll(["handleEvent","handleWindowEvent"],this);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,i]of this._listeners)o.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[t,e,i]of this._listeners)o.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){const e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new dn(e,t));const n=e.boxZoom=new mn(e,t);this._add("boxZoom",n);const r=new xn,o=new jn;e.doubleClickZoom=new Un(o,r),this._add("tapZoom",r),this._add("clickZoom",o);const a=new Nn;this._add("tapDragZoom",a);const s=e.touchPitch=new Ln;this._add("touchPitch",s);const l=new Sn(t),u=new Tn(t);e.dragRotate=new Gn(t,l,u),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);const c=new wn(t),h=new En(t);e.dragPan=new Vn(i,c,h),this._add("mousePan",c),this._add("touchPan",h,["touchZoom","touchRotate"]);const p=new kn,d=new Pn;e.touchZoomRotate=new qn(i,d,p,a),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",d,["touchPan","touchRotate"]);const f=e.scrollZoom=new Fn(e,this);this._add("scrollZoom",f,["mousePan"]);const m=e.keyboard=new Dn;this._add("keyboard",m),this._add("blockableMapEvent",new fn(e));for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[i]&&e[i].enable(t[i])}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Wn(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const n in t)if(n!==i&&(!e||e.indexOf(n)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,t.type+"Window")}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}handleEvent(t,e){if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},r={},a={},s=t.touches,l=s?this._getMapTouches(s):void 0,u=l?o.touchPos(this._el,l):o.mousePos(this._el,t);for(const{handlerName:o,handler:s,allowed:c}of this._handlers){if(!s.isEnabled())continue;let h;this._blockedByActive(a,c,o)?s.reset():s[e||t.type]&&(h=s[e||t.type](t,u,l),this.mergeHandlerResult(n,r,h,o,i),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||s.isActive())&&(a[o]=s)}const c={};for(const t in this._previousActiveHandlers)a[t]||(c[t]=i);this._previousActiveHandlers=a,(Object.keys(c).length||Hn(n))&&(this._changes.push([n,r,c]),this._triggerRenderFrame()),(Object.keys(a).length||Hn(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=n;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))}mergeHandlerResult(e,i,n,r,o){if(!n)return;t.extend(e,n);const a={handlerName:r,originalEvent:n.originalEvent||o};void 0!==n.zoomDelta&&(i.zoom=a),void 0!==n.panDelta&&(i.drag=a),void 0!==n.pitchDelta&&(i.pitch=a),void 0!==n.bearingDelta&&(i.rotate=a)}_applyChanges(){const e={},i={},n={};for(const[r,o,a]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new t.pointGeometry(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(e.around=r.around),void 0!==r.pinchAround&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),t.extend(i,o),t.extend(n,a);this._updateMapTransform(e,i,n),this._changes=[]}_updateMapTransform(t,e,i){const n=this._map,r=n.transform;if(!Hn(t))return this._fireEvents(e,i,!0);let{panDelta:o,zoomDelta:a,bearingDelta:s,pitchDelta:l,around:u,pinchAround:c}=t;void 0!==c&&(u=c),n._stop(!0),u=u||n.transform.centerPoint;const h=r.pointLocation(o?u.sub(o):u);s&&(r.bearing+=s),l&&(r.pitch+=l),a&&(r.zoom+=a),r.setLocationAtPoint(h,u),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(e,i,n){const r=Wn(this._eventsInProgress),o=Wn(e),a={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(a[t+"start"]=i),this._eventsInProgress[t]=e[t]}!r&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const s={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:n}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||n,s[t+"end"]=l)}for(const t in s)this._fireEvent(t,s[t]);const u=Wn(this._eventsInProgress);if(n&&(r||o)&&!u){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;e?(i(e.bearing||this._map.getBearing())&&(e.bearing=0),this._map.easeTo(e,{originalEvent:l})):(this._map.fire(new t.Event("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Zn("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Xn={extend:(e,...i)=>t.extend(e,...i),run(t){t()},logToElement(t,e=!1,i="log"){const n=window.document.getElementById(i);n&&(e&&(n.innerHTML=""),n.innerHTML+="<br>"+t)}};class Kn extends t.Evented{constructor(e,i){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,n){return e=t.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),n)}panTo(e,i,n){return this.easeTo(t.extend({center:e},i),n)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,n){return this.easeTo(t.extend({zoom:e},i),n)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,i,n){return this.easeTo(t.extend({bearing:e},i),n)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}cameraForBounds(e,i){e=t.LngLatBounds.convert(e);const n=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),n,i)}_cameraForBoxAndBearing(e,i,n,r){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(r=t.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){const t=r.padding;r.padding={top:t,bottom:t,right:t,left:t}}r.padding=t.extend(o,r.padding);const a=this.transform,s=a.padding,l=a.project(t.LngLat.convert(e)),u=a.project(t.LngLat.convert(i)),c=l.rotate(-n*Math.PI/180),h=u.rotate(-n*Math.PI/180),p=new t.pointGeometry(Math.max(c.x,h.x),Math.max(c.y,h.y)),d=new t.pointGeometry(Math.min(c.x,h.x),Math.min(c.y,h.y)),f=p.sub(d),m=(a.width-(s.left+s.right+r.padding.left+r.padding.right))/f.x,g=(a.height-(s.top+s.bottom+r.padding.top+r.padding.bottom))/f.y;if(g<0||m<0)return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const _=Math.min(a.scaleZoom(a.scale*Math.min(m,g)),r.maxZoom),y=t.pointGeometry.convert(r.offset),x=new t.pointGeometry((r.padding.left-r.padding.right)/2,(r.padding.top-r.padding.bottom)/2).rotate(n*Math.PI/180),v=y.add(x).mult(a.scale/a.zoomScale(_));return{center:a.unproject(l.add(u).div(2).sub(v)),zoom:_,bearing:n}}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(e,i,n,r,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.pointGeometry.convert(e)),this.transform.pointLocation(t.pointGeometry.convert(i)),n,r),r,o)}_fitInternal(e,i,n){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(e,i){this.stop();const n=this.transform;let r=!1,o=!1,a=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(r=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=t.LngLat.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(o=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(a=!0,n.pitch=+e.pitch),null==e.padding||n.isPaddingEqual(e.padding)||(n.padding=e.padding),this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),r&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),o&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),a&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i))}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.exported.prefersReducedMotion)&&(e.duration=0);const n=this.transform,r=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in e?+e.zoom:r,u="bearing"in e?this._normalizeBearing(e.bearing,o):o,c="pitch"in e?+e.pitch:a,h="padding"in e?e.padding:n.padding,p=t.pointGeometry.convert(e.offset);let d=n.centerPoint.add(p);const f=n.pointLocation(d),m=t.LngLat.convert(e.center||f);this._normalizeCenter(m);const g=n.project(f),_=n.project(m).sub(g),y=n.zoomScale(l-r);let x,v;e.around&&(x=t.LngLat.convert(e.around),v=n.locationPoint(x));const b={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==r,this._rotating=this._rotating||o!==u,this._pitching=this._pitching||c!==a,this._padding=!n.isPaddingEqual(h),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,b),this._ease(e=>{if(this._zooming&&(n.zoom=t.number(r,l,e)),this._rotating&&(n.bearing=t.number(o,u,e)),this._pitching&&(n.pitch=t.number(a,c,e)),this._padding&&(n.interpolatePadding(s,h,e),d=n.centerPoint.add(p)),x)n.setLocationAtPoint(x,v);else{const t=n.zoomScale(n.zoom-r),i=l>r?Math.min(2,y):Math.max(.5,y),o=Math.pow(i,1-e),a=n.unproject(g.add(_.mult(e*o)).mult(t));n.setLocationAtPoint(n.renderWorldCopies?a.wrap():a,d)}this._fireMoveEvents(i)},t=>{this._afterEase(i,t)},e),this}_prepareEase(e,i,n={}){this._moving=!0,i||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const n=this._zooming,r=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),r&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}flyTo(e,i){if(!e.essential&&t.exported.prefersReducedMotion){const n=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);const n=this.transform,r=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,n.minZoom,n.maxZoom):r,u="bearing"in e?this._normalizeBearing(e.bearing,o):o,c="pitch"in e?+e.pitch:a,h="padding"in e?e.padding:n.padding,p=n.zoomScale(l-r),d=t.pointGeometry.convert(e.offset);let f=n.centerPoint.add(d);const m=n.pointLocation(f),g=t.LngLat.convert(e.center||m);this._normalizeCenter(g);const _=n.project(m),y=n.project(g).sub(_);let x=e.curve;const v=Math.max(n.width,n.height),b=v/p,w=y.mag();if("minZoom"in e){const i=t.clamp(Math.min(e.minZoom,r,l),n.minZoom,n.maxZoom),o=v/n.zoomScale(i-r);x=Math.sqrt(o/w*2)}const S=x*x;function T(t){const e=(b*b-v*v+(t?-1:1)*S*S*w*w)/(2*(t?b:v)*S*w);return Math.log(Math.sqrt(e*e+1)-e)}function E(t){return(Math.exp(t)-Math.exp(-t))/2}function A(t){return(Math.exp(t)+Math.exp(-t))/2}const I=T(0);let C=function(t){return A(I)/A(I+x*t)},P=function(t){return v*((A(I)*(E(e=I+x*t)/A(e))-E(I))/S)/w;var e},M=(T(1)-I)/x;if(Math.abs(w)<1e-6||!isFinite(M)){if(Math.abs(v-b)<1e-6)return this.easeTo(e,i);const t=b<v?-1:1;M=Math.abs(Math.log(b/v))/x,P=function(){return 0},C=function(e){return Math.exp(t*x*e)}}return e.duration="duration"in e?+e.duration:1e3*M/("screenSpeed"in e?+e.screenSpeed/x:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==u,this._pitching=c!==a,this._padding=!n.isPaddingEqual(h),this._prepareEase(i,!1),this._ease(e=>{const p=e*M,m=1/C(p);n.zoom=1===e?l:r+n.scaleZoom(m),this._rotating&&(n.bearing=t.number(o,u,e)),this._pitching&&(n.pitch=t.number(a,c,e)),this._padding&&(n.interpolatePadding(s,h,e),f=n.centerPoint.add(d));const x=1===e?g:n.unproject(_.add(y.mult(P(p))).mult(m));n.setLocationAtPoint(n.renderWorldCopies?x.wrap():x,f),this._fireMoveEvents(i)},()=>this._afterEase(i),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,i,n){!1===n.animate||0===n.duration?(e(1),i()):(this._easeStart=t.exported.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const e=Math.min((t.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(e,i){e=t.wrap(e,-180,180);const n=Math.abs(e-i);return Math.abs(e-360-i)<n&&(e-=360),Math.abs(e+360-i)<n&&(e+=360),e}_normalizeCenter(t){const e=this.transform;if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}}class Jn{constructor(e={}){this.options=e,t.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=o.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=o.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){o.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",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(t,e){const i=this._map._getUIString("AttributionControl."+e);t.title=i,t.setAttribute("aria-label",i)}_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","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"!=typeof t?"":t)):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const n=e[i];if(n.used){const e=n.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter(t=>String(t).trim()),t.sort((t,e)=>t.length-e.length),t=t.filter((e,i)=>{for(let n=i+1;n<t.length;n++)if(t[n].indexOf(e)>=0)return!1;return!0});const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_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","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Yn{constructor(e={}){this.options=e,t.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=o.create("div","maplibregl-ctrl mapboxgl-ctrl");const e=o.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){o.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact","mapboxgl-compact"):e.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Qn{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const tr={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},er={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},ir={showCompass:!0,showZoom:!0,visualizePitch:!1};class nr{constructor(e,i,n=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new Sn({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,n&&(this.mousePitch=new Tn({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener(i,"mousedown",this.mousedown),o.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),o.addEventListener(i,"touchmove",this.touchmove),o.addEventListener(i,"touchend",this.touchend),o.addEventListener(i,"touchcancel",this.reset)}down(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),o.disableDrag()}move(t,e){const i=this.map,n=this.mouseRotate.mousemoveWindow(t,e);if(n&&n.bearingDelta&&i.setBearing(i.getBearing()+n.bearingDelta),this.mousePitch){const n=this.mousePitch.mousemoveWindow(t,e);n&&n.pitchDelta&&i.setPitch(i.getPitch()+n.pitchDelta)}}off(){const t=this.element;o.removeEventListener(t,"mousedown",this.mousedown),o.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(t,"touchmove",this.touchmove),o.removeEventListener(t,"touchend",this.touchend),o.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){o.enableDrag(),o.removeEventListener(window,"mousemove",this.mousemove),o.removeEventListener(window,"mouseup",this.mouseup)}mousedown(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),o.mousePos(this.element,e)),o.addEventListener(window,"mousemove",this.mousemove),o.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,o.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function rr(e,i,n){if(e=new t.LngLat(e.lng,e.lat),i){const r=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=n.locationPoint(e).distSqr(i);n.locationPoint(r).distSqr(i)<a?e=r:n.locationPoint(o).distSqr(i)<a&&(e=o)}for(;Math.abs(e.lng-n.center.lng)>180;){const t=n.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=n.width&&t.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}const or={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 ar(t,e,i){const n=t.classList;for(const t in or)n.remove(`maplibregl-${i}-anchor-${t}`,`mapboxgl-${i}-anchor-${t}`);n.add(`maplibregl-${i}-anchor-${e}`,`mapboxgl-${i}-anchor-${e}`)}class sr extends t.Evented{constructor(e,i){if(super(),(e instanceof HTMLElement||i)&&(e=t.extend({element:e},i)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.pointGeometry.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=o.create("div"),this._element.setAttribute("aria-label","Map marker");const i=o.createNS("http://www.w3.org/2000/svg","svg"),n=41,r=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",n+"px"),i.setAttributeNS(null,"width",r+"px"),i.setAttributeNS(null,"viewBox",`0 0 ${r} ${n}`);const a=o.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");const s=o.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const l=o.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const u=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of u){const e=o.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const c=o.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);const h=o.createNS("http://www.w3.org/2000/svg","path");h.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(h);const p=o.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=o.createNS("http://www.w3.org/2000/svg","path");d.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"),p.appendChild(d);const f=o.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=o.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=o.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 _=o.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),s.appendChild(l),s.appendChild(c),s.appendChild(p),s.appendChild(f),s.appendChild(m),i.appendChild(s),i.setAttributeNS(null,"height",n*this._scale+"px"),i.setAttributeNS(null,"width",r*this._scale+"px"),this._element.appendChild(i),this._offset=t.pointGeometry.convert(e&&e.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),ar(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),o.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,n=Math.sqrt(Math.pow(i,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[n,-1*(e-i+n)],"bottom-right":[-n,-1*(e-i+n)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()}_onMapClick(t){const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=rr(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(e=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),o.setTransform(this._element,`${or[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${e}`)}getOffset(){return this._offset}setOffset(e){return this._offset=t.pointGeometry.convert(e),this._update(),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.Event("dragstart"))),this.fire(new t.Event("drag")))}_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.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const lr={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ur,cr=0,hr=!1;const pr={maxWidth:100,unit:"metric"};function dr(t,e,i){const n=i&&i.maxWidth||100,r=t._container.clientHeight/2,o=t.unproject([0,r]),a=t.unproject([n,r]),s=o.distanceTo(a);if(i&&"imperial"===i.unit){const i=3.2808*s;i>5280?fr(e,n,i/5280,t._getUIString("ScaleControl.Miles")):fr(e,n,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?fr(e,n,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?fr(e,n,s/1e3,t._getUIString("ScaleControl.Kilometers")):fr(e,n,s,t._getUIString("ScaleControl.Meters"))}function fr(t,e,i,n){const r=function(t){const e=Math.pow(10,(""+Math.floor(t)).length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(r/i)+"px",t.innerHTML=`${r}&nbsp;${n}`}const mr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},gr=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");const _r={supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:class extends Kn{constructor(e){var i;if(t.PerformanceUtils.mark(t.PerformanceMarkers.create),null!=(e=t.extend({},er,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Qi(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new Qn,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},tr,e.locale),this._clickTolerance=e.clickTolerance,this._pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:devicePixelRatio,this._requestManager=new a(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),"undefined"!=typeof window&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new $n(this,e),this._hash=e.hash&&new tn("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Jn({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new Yn,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",e=>{this._update("style"===e.dataType),this.fire(new t.Event(e.dataType+"data",e))}),this.on("dataloading",e=>{this.fire(new t.Event(e.dataType+"dataloading",e))}),this.on("dataabort",e=>{this.fire(new t.Event("sourcedataabort",e))})}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=e.onAdd(this);this._controls.push(e);const r=this._controlPositions[i];return-1!==i.indexOf("bottom")?r.insertBefore(n,r.firstChild):r.appendChild(n),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(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(t){return this._controls.indexOf(t)>-1}resize(e){const i=this._containerDimensions(),n=i[0],r=i[1];this._resizeCanvas(n,r,this.getPixelRatio()),this.transform.resize(n,r),this.painter.resize(n,r,this.getPixelRatio());const o=!this._moving;return o&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),o&&this.fire(new t.Event("moveend",e)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(t){const[e,i]=this._containerDimensions();this._pixelRatio=t,this._resizeCanvas(e,i,t),this.painter.resize(e,i,t)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(e){return this.transform.locationPoint(t.LngLat.convert(e))}unproject(e){return this.transform.pointLocation(t.pointGeometry.convert(e))}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let n=!1;const r=r=>{const o=this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[];o.length?n||(n=!0,i.call(this,new cn(t,this,r.originalEvent,{features:o}))):n=!1};return{layer:e,listener:i,delegates:{mousemove:r,mouseout:()=>{n=!1}}}}if("mouseleave"===t||"mouseout"===t){let n=!1;const r=r=>{(this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[]).length?n=!0:n&&(n=!1,i.call(this,new cn(t,this,r.originalEvent)))},o=e=>{n&&(n=!1,i.call(this,new cn(t,this,e.originalEvent)))};return{layer:e,listener:i,delegates:{mousemove:r,mouseout:o}}}{const n=t=>{const n=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,i.call(this,t),delete t.features)};return{layer:e,listener:i,delegates:{[t]:n}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const n=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(n);for(const t in n.delegates)this.on(t,n.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const n=this._createDelegatedListener(t,e,i);for(const t in n.delegates)this.once(t,n.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(n=>{const r=this._delegatedListeners[t];for(let t=0;t<r.length;t++){const n=r[t];if(n.layer===e&&n.listener===i){for(const t in n.delegates)this.off(t,n.delegates[t]);return r.splice(t,1),this}}})(),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let n;if(void 0!==i||void 0===e||e instanceof t.pointGeometry||Array.isArray(e)||(i=e,e=void 0),i=i||{},(e=e||[[0,0],[this.transform.width,this.transform.height]])instanceof t.pointGeometry||"number"==typeof e[0])n=[t.pointGeometry.convert(e)];else{const i=t.pointGeometry.convert(e[0]),r=t.pointGeometry.convert(e[1]);n=[i,new t.pointGeometry(r.x,i.y),r,new t.pointGeometry(i.x,r.y),i]}return this.style.queryRenderedFeatures(n,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(e,i){return!1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),t?(this.style=new ie(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t):this.style.loadJSON(t),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ie(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const n=this._requestManager.transformRequest(e,t.ResourceType.Style);t.getJSON(n,(e,n)=>{e?this.fire(new t.ErrorEvent(e)):n&&this._updateDiff(n,i)})}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e)&&this._update(!0)}catch(n){t.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)))}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i,{pixelRatio:n=1,sdf:r=!1,stretchX:o,stretchY:a,content:s}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||t.isImageBitmap(i)){const{width:l,height:u,data:c}=t.exported.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:l,height:u},c),pixelRatio:n,stretchX:o,stretchY:a,content:s,sdf:r,version:0})}else{if(void 0===i.width||void 0===i.height)return this.fire(new t.ErrorEvent(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:l,height:u,data:c}=i,h=i;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:u},new Uint8Array(c)),pixelRatio:n,stretchX:o,stretchY:a,content:s,sdf:r,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e)}}}updateImage(e,i){const n=this.style.getImage(e);if(!n)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=i instanceof HTMLImageElement||t.isImageBitmap(i)?t.exported.getImageData(i):i,{width:o,height:a,data:s}=r;if(void 0===o||void 0===a)return this.fire(new t.ErrorEvent(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!==n.data.width||a!==n.data.height)return this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(i instanceof HTMLImageElement||t.isImageBitmap(i));n.data.replace(s,l),this.style.updateImage(e,n)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(e,i){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),i)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,n={}){return this.style.setPaintProperty(t,e,i,n),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,n={}){return this.style.setLayoutProperty(t,e,i,n),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map","mapboxgl-map");const e=this._canvasContainer=o.create("div","maplibregl-canvas-container mapboxgl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const i=this._containerDimensions();this._resizeCanvas(i[0],i[1],this.getPixelRatio());const n=this._controlContainer=o.create("div","maplibregl-control-container mapboxgl-control-container",t),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(t=>{r[t]=o.create("div",`maplibregl-ctrl-${t} mapboxgl-ctrl-${t}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,e,i){this._canvas.width=i*t,this._canvas.height=i*e,this._canvas.style.width=t+"px",this._canvas.style.height=e+"px"}_setupPainter(){const i=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",i)||this._canvas.getContext("experimental-webgl",i);n?(this.painter=new Xi(n,this.transform),t.exported$1.testSupport(n)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))}_onMapScroll(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(e){let i,n=0;const r=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=r.createQueryEXT(),r.beginQueryEXT(r.TIME_ELAPSED_EXT,i),n=t.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=t.exported.now();this.style.zoomHistory.update(e,i);const n=new t.EvaluationParameters(e,{now:i,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=n.crossFadingFactor();1===r&&r===this._crossFadingFactor||(o=!0,this._crossFadingFactor=r),this.style.update(n)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.load),this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const e=t.exported.now()-n;r.endQueryEXT(r.TIME_ELAPSED_EXT,i),setTimeout(()=>{const n=r.getQueryObjectEXT(i,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(i),this.fire(new t.Event("gpu-timing-frame",{cpuTime:e,gpuTime:n}))},50)}if(this.listens("gpu-timing-layer")){const e=this.painter.collectGpuTimers();setTimeout(()=>{const i=this.painter.queryGpuTimers(e);this.fire(new t.Event("gpu-timing-layer",{layerTimes:i}))},50)}const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),o.remove(this._canvasContainer),o.remove(this._controlContainer),this._container.classList.remove("maplibregl-map","mapboxgl-map"),t.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new t.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.exported.frame(e=>{t.PerformanceUtils.frame(e),this._frame=null,this._render(e)}))}_onWindowOnline(){this._update()}_onWindowResize(t){this._trackResize&&this.resize({originalEvent:t})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}_setCacheLimits(e,i){t.setCacheLimits(e,i)}},NavigationControl:class{constructor(e){this.options=t.extend({},ir,e),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new nr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){o.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const i=o.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}_setButtonTitle(t,e){const i=this._map._getUIString("NavigationControl."+e);t.title=i,t.setAttribute("aria-label",i)}},GeolocateControl:class extends t.Evented{constructor(e){super(),this.options=t.extend({},lr,e),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(t){var e;return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),e=this._setupUI,void 0!==ur?e(ur):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then(t=>{ur="denied"!==t.state,e(ur)}):(ur=!!window.navigator.geolocation,e(ur)),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(),o.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,cr=0,hr=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background")}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","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}}_updateCamera(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,r=this._map.getBearing(),o=t.extend({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(n),o,{geolocateSource:!0})}_updateMarker(e){if(e){const i=new t.LngLat(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.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),i=this._map.unproject([1,t]),n=e.distanceTo(i),r=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=r+"px",this._circleElement.style.height=r+"px"}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&hr)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(e){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=o.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.warnOnce("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 t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new sr(this._dotElement),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new sr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return t.warnOnce("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.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":cr--,hr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),cr++,cr>1?(t={maximumAge:6e5,timeout:0},hr=!0):(t=this.options.positionOptions,hr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Jn,LogoControl:Yn,ScaleControl:class{constructor(e){this.options=t.extend({},pr,e),t.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){dr(this._map,this._container,this.options)}onAdd(t){return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){o.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(t){this.options.unit=t,dr(this._map,this._container,this.options)}},FullscreenControl:class{constructor(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"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=o.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){o.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const t=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends t.Evented{constructor(e){super(),this.options=t.extend(Object.create(mr),e),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&o.remove(this._content),this._container&&(o.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let n;for(i.innerHTML=t;n=i.firstChild,n;)e.appendChild(n);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(t){this._update(t.point)}_onMouseMove(t){this._update(t.point)}_onDrag(t){this._update(t.point)}_update(e){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=o.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=o.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(t=>this._container.classList.add(t)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=rr(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!e)return;const i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);let n=this.options.anchor;const r=function e(i){if(i){if("number"==typeof i){const e=Math.round(Math.sqrt(.5*Math.pow(i,2)));return{center:new t.pointGeometry(0,0),top:new t.pointGeometry(0,i),"top-left":new t.pointGeometry(e,e),"top-right":new t.pointGeometry(-e,e),bottom:new t.pointGeometry(0,-i),"bottom-left":new t.pointGeometry(e,-e),"bottom-right":new t.pointGeometry(-e,-e),left:new t.pointGeometry(i,0),right:new t.pointGeometry(-i,0)}}if(i instanceof t.pointGeometry||Array.isArray(i)){const e=t.pointGeometry.convert(i);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:t.pointGeometry.convert(i.center||[0,0]),top:t.pointGeometry.convert(i.top||[0,0]),"top-left":t.pointGeometry.convert(i["top-left"]||[0,0]),"top-right":t.pointGeometry.convert(i["top-right"]||[0,0]),bottom:t.pointGeometry.convert(i.bottom||[0,0]),"bottom-left":t.pointGeometry.convert(i["bottom-left"]||[0,0]),"bottom-right":t.pointGeometry.convert(i["bottom-right"]||[0,0]),left:t.pointGeometry.convert(i.left||[0,0]),right:t.pointGeometry.convert(i.right||[0,0])}}return e(new t.pointGeometry(0,0))}(this.options.offset);if(!n){const t=this._container.offsetWidth,e=this._container.offsetHeight;let o;o=i.y+r.bottom.y<e?["top"]:i.y>this._map.transform.height-e?["bottom"]:[],i.x<t/2?o.push("left"):i.x>this._map.transform.width-t/2&&o.push("right"),n=0===o.length?"bottom":o.join("-")}const a=i.add(r[n]).round();o.setTransform(this._container,`${or[n]} translate(${a.x}px,${a.y}px)`),ar(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(gr);t&&t.focus()}_onClose(){this.remove()}},Marker:sr,Style:ie,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.pointGeometry,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,AJAXError:t.AJAXError,config:t.config,CanvasSource:B,GeoJSONSource:M,ImageSource:z,RasterDEMTileSource:P,RasterTileSource:I,VectorTileSource:A,VideoSource:L,prewarm:function(){X().acquire(W)},clearPrewarmedResources:function(){const t=$;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(W),$=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()"))},get workerCount(){return Z.workerCount},set workerCount(t){Z.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage(e){t.clearTileCache(e)},workerUrl:"",addProtocol(e,i){t.config.REGISTERED_PROTOCOLS[e]=i},removeProtocol(e){delete t.config.REGISTERED_PROTOCOLS[e]}};return Xn.extend(_r,{isSafari:t.isSafari,getPerformanceMetrics:t.PerformanceUtils.getPerformanceMetrics}),_r})),i}()},function(t,e){var i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){var n=i(65),r=("string"==typeof n&&(n=[[t.i,n,""]]),{});r.transform=void 0,i(9)(n,r),n.locals&&(t.exports=n.locals)},function(t,e,i){var n=i(17);(t.exports=i(8)(!1)).push([t.i,".maplibregl-ctrl-floors.hide,\n.mapxus-floor-selector-layout.hide{\n display: none;\n}\n.mapxus-floor-selector-layout {\n -moz-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.5);\n -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.5);\n box-shadow: 0 1px 1px 0 rgba(0,0,0,0.5);\n width: 30px;\n visibility: visible;\n}\n.mapxus-floor-selector-outer {\n position: relative;\n width: 30px;\n z-index: 100;\n overflow: hidden;\n}\n.mapxus-floor-selector-inner {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: -20px;\n overflow-y: auto;\n overflow-x: hidden\n}\n.mapxus-floor-selector-inner > .floor {\n outline: none;\n font-family: Helvetica, Arial, sans-serif;\n cursor: pointer;\n width: 30px;\n border: 0;\n background: #fff;\n font-weight: bold;\n font-size: 12px;\n padding: inherit;\n height: 34px;\n overflow-x: auto;\n overflow-y: hidden\n}\n.mapxus-floor-selector-inner > .floor:not(:disabled):hover {\n background-color: rgba(0,0,0,.05) !important;\n}\n.mapxus-floor-selector-inner > .floor::-webkit-scrollbar {\n height: 4px;\n}\n.mapxus-floor-selector-inner > .floor::-webkit-scrollbar-track {\n background-color: white;\n -webkit-border-radius: 2em;\n -moz-border-radius: 2em;\n border-radius:2em;\n}\n.mapxus-floor-selector-inner > .floor::-webkit-scrollbar-thumb {\n background-color: rgb(83, 177, 207);\n -webkit-border-radius: 2em;\n -moz-border-radius: 2em;\n border-radius:2em;\n}\n.mapxus-floor-selector-up {\n margin-top: -4px;\n z-index: 102;\n position: absolute;\n width: 30px;\n height: 26px;\n cursor: pointer;\n background-size: 38px;\n background-position-x: center;\n background-repeat: no-repeat;\n background-image:url("+n(i(66))+");\n}\n.mapxus-floor-selector-up.hide {\n visibility: hidden;\n}\n.mapxus-floor-selector-down {\n z-index: 101;\n position: absolute;\n width: 30px;\n height: 26px;\n cursor: pointer;\n background-size: 38px;\n background-position-x: center;\n background-repeat: no-repeat;\n background-image:url("+n(i(67))+");\n}\n.mapxus-floor-selector-down.hide {\n visibility: hidden;\n}\n",""])},function(t,e){t.exports="\"data:image/svg+xml,%3C?xml version='1.0' encoding='utf-8'?%3E %3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='41.409260218957115' width='51.409260218957115'%3E %3Cdefs%3E %3Crect id='rect-0' opacity='1' x='4.704630109478558' y='4.704630109478558' width='42' height='32'/%3E %3ClinearGradient id='linearGradient-1' x1='0.5' y1='0' x2='0.5' y2='1'%3E %3Cstop offset='0' stop-color='rgb(255,255,255)' stop-opacity='0'/%3E %3Cstop offset='0.41' stop-color='rgb(255,255,255)' stop-opacity='0.8'/%3E %3Cstop offset='1' stop-color='rgb(200,200,200)' stop-opacity='1'/%3E %3C/linearGradient%3E %3Cpath id='path-2' opacity='1' fill-rule='evenodd' d='M18.02605868090714,23.704630109478558 L25.70463010947857,30.704630109478558 L33.38320153805,23.704630109478558 '/%3E %3C/defs%3E %3Cg transform='translate(25.704630109478558, 20.704630109478558) rotate(180.00006436155007) translate(-25.704630109478558, -20.704630109478558)' opacity='1'%3E %3Cg opacity='1'%3E %3Cuse xlink:href='%23rect-0' fill='url(%23linearGradient-1)'/%3E %3C/g%3E %3Cg opacity='1'%3E %3Cuse xlink:href='%23path-2' fill-opacity='0' stroke='rgb(187,187,189)' stroke-opacity='1' stroke-width='2'/%3E %3C/g%3E %3C/g%3E %3C/svg%3E\""},function(t,e){t.exports="\"data:image/svg+xml,%3C?xml version='1.0' encoding='utf-8'?%3E %3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='41.409260218957115' width='51.409260218957115'%3E %3Cdefs%3E %3Crect id='rect-0' opacity='1' x='4.704630109478558' y='4.704630109478558' width='42' height='32'/%3E %3ClinearGradient id='linearGradient-1' x1='0.5' y1='0' x2='0.5' y2='1'%3E %3Cstop offset='0' stop-color='rgb(255,255,255)' stop-opacity='0'/%3E %3Cstop offset='0.41' stop-color='rgb(255,255,255)' stop-opacity='0.8'/%3E %3Cstop offset='1' stop-color='rgb(200,200,200)' stop-opacity='1'/%3E %3C/linearGradient%3E %3Cpath id='path-2' opacity='1' fill-rule='evenodd' d='M18.02605868090714,23.704630109478558 L25.70463010947857,30.704630109478558 L33.38320153805,23.704630109478558 '/%3E %3C/defs%3E %3Cg opacity='1'%3E %3Cg opacity='1'%3E %3Cuse xlink:href='%23rect-0' fill='url(%23linearGradient-1)'/%3E %3C/g%3E %3Cg opacity='1'%3E %3Cuse xlink:href='%23path-2' fill-opacity='0' stroke='rgb(187,187,189)' stroke-opacity='1' stroke-width='2'/%3E %3C/g%3E %3C/g%3E %3C/svg%3E\""},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var i=e.protocol+"//"+e.host,n=i+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){return e=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e})),/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(e)?t:(t=0===e.indexOf("//")?e:0===e.indexOf("/")?i+e:n+e.replace(/^\.\//,""),"url("+JSON.stringify(t)+")")}))}},function(t,e,i){var n=i(70),r=("string"==typeof n&&(n=[[t.i,n,""]]),{});r.transform=void 0,i(9)(n,r),n.locals&&(t.exports=n.locals)},function(t,e,i){var n=i(17);(t.exports=i(8)(!1)).push([t.i,".maplibregl-ctrl-building-filter.hide {\n display: none;\n}\n.mapxus-building-filter-icon {\n width: 30px;\n height: 30px;\n background-image: url("+n(i(71))+");\n background-size: 30px;\n background-color: white;\n border-radius: 4px;\n -moz-box-shadow: 0 0 2px rgba(0,0,0,0.1);\n -webkit-box-shadow: 0 0 2px rgba(0,0,0,0.1);\n box-shadow: 0 0 0 2px rgba(0,0,0,0.1);\n cursor: pointer;\n}\n.mapxus-building-name-layout {\n width: 125px;\n right: 45px;\n margin-top: -30px;\n position: absolute;\n overflow: hidden;\n}\n.mapxus-building-name-list {\n width: 140px;\n position: absolute;\n overflow-y: auto;\n}\n.mapxus-building-name {\n width: 115px;\n color: white;\n background: red;\n border-radius: 3px;\n padding: 2px 4px;\n margin: 2px;\n cursor: pointer;\n word-wrap: break-word;\n}\n.mapxus-building-name.active {\n background: cornflowerblue;\n}\n.mapxus-building-name:hover {\n background: rgba(0,0,0,0.5);\n}\n",""])},function(t,e){t.exports="\"data:image/svg+xml,%3C?xml version='1.0' encoding='utf-8'?%3E %3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E %3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0' y='0' width='15' height='15' viewBox='0, 0, 15, 15'%3E %3Cg%3E %3Cpath d='M13.639 4H12V1.361A.361.361 0 0 0 11.639 1h-.278a.361.361 0 0 0-.361.361V4H9.361A.361.361 0 0 0 9 4.361V10H5.363a.363.363 0 0 0-.363.363v3.275a.363.363 0 0 0 .363.362h8.276a.361.361 0 0 0 .361-.361V4.361A.361.361 0 0 0 13.639 4zM7 12H6v-1h1zm2 0H8v-1h1zm2 0h-1v-1h1zm0-2h-1V9h1zm0-2h-1V7h1zm0-2h-1V5h1zm2 6h-1v-1h1zm0-2h-1V9h1zm0-2h-1V7h1zm0-2h-1V5h1zM8 1.361A.361.361 0 0 0 7.639 1H5.361A.361.361 0 0 0 5 1.361V3H3.361A.361.361 0 0 0 3 3.361V4H1.361A.361.361 0 0 0 1 4.361v9.278a.361.361 0 0 0 .361.361H4V9h4zM3 12H2v-1h1zm0-2H2V9h1zm0-2H2V7h1zm0-2H2V5h1zm2 2H4V7h1zm0-2H4V5h1zm2 2H6V7h1zm0-2H6V5h1zm0-2H6V3h1z'%3E%3C/path%3E %3C/g%3E %3C/svg%3E\""},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.outdoorConfig=void 0;var n=i(29);e.outdoorConfig=function(){return{url:n.mapxusTheme_v2}}},function(t,e,i){!function(e,i){"use strict";"function"==typeof window.define&&window.define.amd?window.define(i):t.exports?t.exports=i():e.exports?e.exports=i():e.Fingerprint2=i()}(this,(function(){"use strict";function t(e){if(!(this instanceof t))return new t(e);this.options=this.extend(e,{swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",detectScreenOrientation:!0,sortPluginsFor:[/palemoon/i],userDefinedFonts:[],excludeDoNotTrack:!0,excludePixelRatio:!0}),this.nativeForEach=Array.prototype.forEach,this.nativeMap=Array.prototype.map}return t.prototype={extend:function(t,e){if(null==t)return e;for(var i in t)null!=t[i]&&e[i]!==t[i]&&(e[i]=t[i]);return e},get:function(t){var e=this,i={data:[],addPreprocessedComponent:function(t){var n=t.value;"function"==typeof e.options.preprocessor&&(n=e.options.preprocessor(t.key,n)),i.data.push({key:t.key,value:n})}};i=this.userAgentKey(i);i=this.languageKey(i),i=this.colorDepthKey(i),i=this.deviceMemoryKey(i),i=this.pixelRatioKey(i),i=this.hardwareConcurrencyKey(i),i=this.screenResolutionKey(i),i=this.availableScreenResolutionKey(i),i=this.timezoneOffsetKey(i),i=this.sessionStorageKey(i),i=this.localStorageKey(i),i=this.indexedDbKey(i),i=this.addBehaviorKey(i),i=this.openDatabaseKey(i),i=this.cpuClassKey(i),i=this.platformKey(i),i=this.doNotTrackKey(i),i=this.pluginsKey(i),i=this.canvasKey(i),i=this.webglKey(i),i=this.webglVendorAndRendererKey(i),i=this.adBlockKey(i),i=this.hasLiedLanguagesKey(i),i=this.hasLiedResolutionKey(i),i=this.hasLiedOsKey(i),i=this.hasLiedBrowserKey(i),i=this.touchSupportKey(i),i=this.customEntropyFunction(i),this.fontsKey(i,(function(i){e.audioKey(i,(function(i){var n=[],r=(e.each(i.data,(function(t){(t=t.value)&&"function"==typeof t.join?n.push(t.join(";")):n.push(t)})),e.x64hash128(n.join("~~~"),31));return t(r,i.data)}))}))},audioKey:function(t,e){if(this.options.excludeAudioFP)return e(t);var i=window.OfflineAudioContext||window.webkitOfflineAudioContext;if(null==i)return t.addPreprocessedComponent({key:"audio_fp",value:null}),e(t);var n=new i(1,44100,44100),r=n.createOscillator(),o=(r.type="triangle",r.frequency.setValueAtTime(1e4,n.currentTime),n.createDynamicsCompressor());this.each([["threshold",-50],["knee",40],["ratio",12],["reduction",-20],["attack",0],["release",.25]],(function(t){void 0!==o[t[0]]&&"function"==typeof o[t[0]].setValueAtTime&&o[t[0]].setValueAtTime(t[1],n.currentTime)})),n.oncomplete=function(i){return i=i.renderedBuffer.getChannelData(0).slice(4500,5e3).reduce((function(t,e){return t+Math.abs(e)}),0).toString(),r.disconnect(),o.disconnect(),t.addPreprocessedComponent({key:"audio_fp",value:i}),e(t)},r.connect(o),o.connect(n.destination),r.start(0),n.startRendering()},customEntropyFunction:function(t){return"function"==typeof this.options.customFunction&&t.addPreprocessedComponent({key:"custom",value:this.options.customFunction()}),t},userAgentKey:function(t){return this.options.excludeUserAgent||t.addPreprocessedComponent({key:"user_agent",value:this.getUserAgent()}),t},getUserAgent:function(){return navigator.userAgent},languageKey:function(t){return this.options.excludeLanguage||t.addPreprocessedComponent({key:"language",value:navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage||""}),t},colorDepthKey:function(t){return this.options.excludeColorDepth||t.addPreprocessedComponent({key:"color_depth",value:window.screen.colorDepth||-1}),t},deviceMemoryKey:function(t){return this.options.excludeDeviceMemory||t.addPreprocessedComponent({key:"device_memory",value:this.getDeviceMemory()}),t},getDeviceMemory:function(){return navigator.deviceMemory||-1},pixelRatioKey:function(t){return this.options.excludePixelRatio||t.addPreprocessedComponent({key:"pixel_ratio",value:this.getPixelRatio()}),t},getPixelRatio:function(){return window.devicePixelRatio||""},screenResolutionKey:function(t){return this.options.excludeScreenResolution?t:this.getScreenResolution(t)},getScreenResolution:function(t){var e=this.options.detectScreenOrientation&&window.screen.height>window.screen.width?[window.screen.height,window.screen.width]:[window.screen.width,window.screen.height];return t.addPreprocessedComponent({key:"resolution",value:e}),t},availableScreenResolutionKey:function(t){return this.options.excludeAvailableScreenResolution?t:this.getAvailableScreenResolution(t)},getAvailableScreenResolution:function(t){var e;return void 0!==(e=window.screen.availWidth&&window.screen.availHeight?!this.options.detectScreenOrientation||window.screen.availHeight>window.screen.availWidth?[window.screen.availHeight,window.screen.availWidth]:[window.screen.availWidth,window.screen.availHeight]:e)&&t.addPreprocessedComponent({key:"available_resolution",value:e}),t},timezoneOffsetKey:function(t){return this.options.excludeTimezoneOffset||t.addPreprocessedComponent({key:"timezone_offset",value:(new Date).getTimezoneOffset()}),t},sessionStorageKey:function(t){return!this.options.excludeSessionStorage&&this.hasSessionStorage()&&t.addPreprocessedComponent({key:"session_storage",value:1}),t},localStorageKey:function(t){return!this.options.excludeSessionStorage&&this.hasLocalStorage()&&t.addPreprocessedComponent({key:"local_storage",value:1}),t},indexedDbKey:function(t){return!this.options.excludeIndexedDB&&this.hasIndexedDB()&&t.addPreprocessedComponent({key:"indexed_db",value:1}),t},addBehaviorKey:function(t){return!this.options.excludeAddBehavior&&document.body&&document.body.addBehavior&&t.addPreprocessedComponent({key:"add_behavior",value:1}),t},openDatabaseKey:function(t){return!this.options.excludeOpenDatabase&&window.openDatabase&&t.addPreprocessedComponent({key:"open_database",value:1}),t},cpuClassKey:function(t){return this.options.excludeCpuClass||t.addPreprocessedComponent({key:"cpu_class",value:this.getNavigatorCpuClass()}),t},platformKey:function(t){return this.options.excludePlatform||t.addPreprocessedComponent({key:"navigator_platform",value:this.getNavigatorPlatform()}),t},doNotTrackKey:function(t){return this.options.excludeDoNotTrack||t.addPreprocessedComponent({key:"do_not_track",value:this.getDoNotTrack()}),t},canvasKey:function(t){return!this.options.excludeCanvas&&this.isCanvasSupported()&&t.addPreprocessedComponent({key:"canvas",value:this.getCanvasFp()}),t},webglKey:function(t){return!this.options.excludeWebGL&&this.isWebGlSupported()&&t.addPreprocessedComponent({key:"webgl",value:this.getWebglFp()}),t},webglVendorAndRendererKey:function(t){return!this.options.excludeWebGLVendorAndRenderer&&this.isWebGlSupported()&&t.addPreprocessedComponent({key:"webgl_vendor",value:this.getWebglVendorAndRenderer()}),t},adBlockKey:function(t){return this.options.excludeAdBlock||t.addPreprocessedComponent({key:"adblock",value:this.getAdBlock()}),t},hasLiedLanguagesKey:function(t){return this.options.excludeHasLiedLanguages||t.addPreprocessedComponent({key:"has_lied_languages",value:this.getHasLiedLanguages()}),t},hasLiedResolutionKey:function(t){return this.options.excludeHasLiedResolution||t.addPreprocessedComponent({key:"has_lied_resolution",value:this.getHasLiedResolution()}),t},hasLiedOsKey:function(t){return this.options.excludeHasLiedOs||t.addPreprocessedComponent({key:"has_lied_os",value:this.getHasLiedOs()}),t},hasLiedBrowserKey:function(t){return this.options.excludeHasLiedBrowser||t.addPreprocessedComponent({key:"has_lied_browser",value:this.getHasLiedBrowser()}),t},fontsKey:function(t,e){return this.options.excludeJsFonts?this.flashFontsKey(t,e):this.jsFontsKey(t,e)},flashFontsKey:function(t,e){return!this.options.excludeFlashFonts&&this.hasSwfObjectLoaded()&&this.hasMinFlashInstalled()&&void 0!==this.options.swfPath?void this.loadSwfAndDetectFonts((function(i){t.addPreprocessedComponent({key:"swf_fonts",value:i.join(";")}),e(t)})):e(t)},jsFontsKey:function(t,e){var i=this;return setTimeout((function(){function n(){var t=document.createElement("span");return t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="72px",t.style.fontStyle="normal",t.style.fontWeight="normal",t.style.letterSpacing="normal",t.style.lineBreak="auto",t.style.lineHeight="normal",t.style.textTransform="none",t.style.textAlign="left",t.style.textDecoration="none",t.style.textShadow="none",t.style.whiteSpace="normal",t.style.wordBreak="normal",t.style.wordSpacing="normal",t.innerHTML="mmmmmmmmmmlli",t}var r=["monospace","sans-serif","serif"],o=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"],a=(o=(o=(o=i.options.extendedJsFonts?o.concat(["Abadi MT Condensed Light","Academy Engraved LET","ADOBE CASLON PRO","Adobe Garamond","ADOBE GARAMOND PRO","Agency FB","Aharoni","Albertus Extra Bold","Albertus Medium","Algerian","Amazone BT","American Typewriter","American Typewriter Condensed","AmerType Md BT","Andalus","Angsana New","AngsanaUPC","Antique Olive","Aparajita","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arabic Typesetting","ARCHER","ARNO PRO","Arrus BT","Aurora Cn BT","AvantGarde Bk BT","AvantGarde Md BT","AVENIR","Ayuthaya","Bandy","Bangla Sangam MN","Bank Gothic","BankGothic Md BT","Baskerville","Baskerville Old Face","Batang","BatangChe","Bauer Bodoni","Bauhaus 93","Bazooka","Bell MT","Bembo","Benguiat Bk BT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BernhardFashion BT","BernhardMod BT","Big Caslon","BinnerD","Blackadder ITC","BlairMdITC TT","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bodoni MT","Bodoni MT Black","Bodoni MT Condensed","Bodoni MT Poster Compressed","Bookshelf Symbol 7","Boulder","Bradley Hand","Bradley Hand ITC","Bremen Bd BT","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script MT","Californian FB","Calisto MT","Calligrapher","Candara","CaslonOpnface BT","Castellar","Centaur","Cezanne","CG Omega","CG Times","Chalkboard","Chalkboard SE","Chalkduster","Charlesworth","Charter Bd BT","Charter BT","Chaucer","ChelthmITC Bk BT","Chiller","Clarendon","Clarendon Condensed","CloisterBlack BT","Cochin","Colonna MT","Constantia","Cooper Black","Copperplate","Copperplate Gothic","Copperplate Gothic Bold","Copperplate Gothic Light","CopperplGoth Bd BT","Corbel","Cordia New","CordiaUPC","Cornerstone","Coronet","Cuckoo","Curlz MT","DaunPenh","Dauphin","David","DB LCD Temp","DELICIOUS","Denmark","DFKai-SB","Didot","DilleniaUPC","DIN","DokChampa","Dotum","DotumChe","Ebrima","Edwardian Script ITC","Elephant","English 111 Vivace BT","Engravers MT","EngraversGothic BT","Eras Bold ITC","Eras Demi ITC","Eras Light ITC","Eras Medium ITC","EucrosiaUPC","Euphemia","Euphemia UCAS","EUROSTILE","Exotc350 Bd BT","FangSong","Felix Titling","Fixedsys","FONTIN","Footlight MT Light","Forte","FrankRuehl","Fransiscan","Freefrm721 Blk BT","FreesiaUPC","Freestyle Script","French Script MT","FrnkGothITC Bk BT","Fruitger","FRUTIGER","Futura","Futura Bk BT","Futura Lt BT","Futura Md BT","Futura ZBlk BT","FuturaBlack BT","Gabriola","Galliard BT","Gautami","Geeza Pro","Geometr231 BT","Geometr231 Hv BT","Geometr231 Lt BT","GeoSlab 703 Lt BT","GeoSlab 703 XBd BT","Gigi","Gill Sans","Gill Sans MT","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Gloucester MT Extra Condensed","GOTHAM","GOTHAM BOLD","Goudy Old Style","Goudy Stout","GoudyHandtooled BT","GoudyOLSt BT","Gujarati Sangam MN","Gulim","GulimChe","Gungsuh","GungsuhChe","Gurmukhi MN","Haettenschweiler","Harlow Solid Italic","Harrington","Heather","Heiti SC","Heiti TC","HELV","Herald","High Tower Text","Hiragino Kaku Gothic ProN","Hiragino Mincho ProN","Hoefler Text","Humanst 521 Cn BT","Humanst521 BT","Humanst521 Lt BT","Imprint MT Shadow","Incised901 Bd BT","Incised901 BT","Incised901 Lt BT","INCONSOLATA","Informal Roman","Informal011 BT","INTERSTATE","IrisUPC","Iskoola Pota","JasmineUPC","Jazz LET","Jenson","Jester","Jokerman","Juice ITC","Kabel Bk BT","Kabel Ult BT","Kailasa","KaiTi","Kalinga","Kannada Sangam MN","Kartika","Kaufmann Bd BT","Kaufmann BT","Khmer UI","KodchiangUPC","Kokila","Korinna BT","Kristen ITC","Krungthep","Kunstler Script","Lao UI","Latha","Leelawadee","Letter Gothic","Levenim MT","LilyUPC","Lithograph","Lithograph Light","Long Island","Lydian BT","Magneto","Maiandra GD","Malayalam Sangam MN","Malgun Gothic","Mangal","Marigold","Marion","Marker Felt","Market","Marlett","Matisse ITC","Matura MT Script Capitals","Meiryo","Meiryo UI","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","MingLiU-ExtB","Minion","Minion Pro","Miriam","Miriam Fixed","Mistral","Modern","Modern No. 20","Mona Lisa Solid ITC TT","Mongolian Baiti","MONO","MoolBoran","Mrs Eaves","MS LineDraw","MS Mincho","MS PMincho","MS Reference Specialty","MS UI Gothic","MT Extra","MUSEO","MV Boli","Nadeem","Narkisim","NEVIS","News Gothic","News GothicMT","NewsGoth BT","Niagara Engraved","Niagara Solid","Noteworthy","NSimSun","Nyala","OCR A Extended","Old Century","Old English Text MT","Onyx","Onyx BT","OPTIMA","Oriya Sangam MN","OSAKA","OzHandicraft BT","Palace Script MT","Papyrus","Parchment","Party LET","Pegasus","Perpetua","Perpetua Titling MT","PetitaBold","Pickwick","Plantagenet Cherokee","Playbill","PMingLiU","PMingLiU-ExtB","Poor Richard","Poster","PosterBodoni BT","PRINCETOWN LET","Pristina","PTBarnum BT","Pythagoras","Raavi","Rage Italic","Ravie","Ribbon131 Bd BT","Rockwell","Rockwell Condensed","Rockwell Extra Bold","Rod","Roman","Sakkal Majalla","Santa Fe LET","Savoye LET","Sceptre","Script","Script MT Bold","SCRIPTINA","Serifa","Serifa BT","Serifa Th BT","ShelleyVolante BT","Sherwood","Shonar Bangla","Showcard Gothic","Shruti","Signboard","SILKSCREEN","SimHei","Simplified Arabic","Simplified Arabic Fixed","SimSun","SimSun-ExtB","Sinhala Sangam MN","Sketch Rockwell","Skia","Small Fonts","Snap ITC","Snell Roundhand","Socket","Souvenir Lt BT","Staccato222 BT","Steamer","Stencil","Storybook","Styllo","Subway","Swis721 BlkEx BT","Swiss911 XCm BT","Sylfaen","Synchro LET","System","Tamil Sangam MN","Technical","Teletype","Telugu Sangam MN","Tempus Sans ITC","Terminal","Thonburi","Traditional Arabic","Trajan","TRAJAN PRO","Tristan","Tubular","Tunga","Tw Cen MT","Tw Cen MT Condensed","Tw Cen MT Condensed Extra Bold","TypoUpright BT","Unicorn","Univers","Univers CE 55 Medium","Univers Condensed","Utsaah","Vagabond","Vani","Vijaya","Viner Hand ITC","VisualUI","Vivaldi","Vladimir Script","Vrinda","Westminster","WHITNEY","Wide Latin","ZapfEllipt BT","ZapfHumnst BT","ZapfHumnst Dm BT","Zapfino","Zurich BlkEx BT","Zurich Ex BT","ZWAdobeF"]):o).concat(i.options.userDefinedFonts)).filter((function(t,e){return o.indexOf(t)===e})),document.getElementsByTagName("body")[0]),s=document.createElement("div"),l=document.createElement("div"),u={},c={},h=function(){for(var t=[],e=0,i=r.length;e<i;e++){var o=n();o.style.fontFamily=r[e],s.appendChild(o),t.push(o)}return t}();a.appendChild(s);for(var p=0,d=r.length;p<d;p++)u[r[p]]=h[p].offsetWidth,c[r[p]]=h[p].offsetHeight;var f=function(){for(var t,e,i={},a=0,s=o.length;a<s;a++){for(var u=[],c=0,h=r.length;c<h;c++){p=o[a],t=r[c],e=void 0,(e=n()).style.fontFamily="'"+p+"',"+t;var p=e;l.appendChild(p),u.push(p)}i[o[a]]=u}return i}();a.appendChild(l);for(var m=[],g=0,_=o.length;g<_;g++)!function(t){for(var e=!1,i=0;i<r.length;i++)if(e=t[i].offsetWidth!==u[r[i]]||t[i].offsetHeight!==c[r[i]])return e;return e}(f[o[g]])||m.push(o[g]);a.removeChild(l),a.removeChild(s),t.addPreprocessedComponent({key:"js_fonts",value:m}),e(t)}),1)},pluginsKey:function(t){return this.options.excludePlugins||(this.isIE()?this.options.excludeIEPlugins||t.addPreprocessedComponent({key:"ie_plugins",value:this.getIEPlugins()}):t.addPreprocessedComponent({key:"regular_plugins",value:this.getRegularPlugins()})),t},getRegularPlugins:function(){var t=[];if(navigator.plugins)for(var e=0,i=navigator.plugins.length;e<i;e++)navigator.plugins[e]&&t.push(navigator.plugins[e]);return this.pluginsShouldBeSorted()&&(t=t.sort((function(t,e){return t.name>e.name?1:t.name<e.name?-1:0}))),this.map(t,(function(t){var e=this.map(t,(function(t){return[t.type,t.suffixes].join("~")})).join(",");return[t.name,t.description,e].join("::")}),this)},getIEPlugins:function(){var t=[];return(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,"ActiveXObject")||"ActiveXObject"in window)&&(t=this.map(["AcroPDF.PDF","Adodb.Stream","AgControl.AgControl","DevalVRXCtrl.DevalVRXCtrl.1","MacromediaFlashPaper.MacromediaFlashPaper","Msxml2.DOMDocument","Msxml2.XMLHTTP","PDF.PdfCtrl","QuickTime.QuickTime","QuickTimeCheckObject.QuickTimeCheck.1","RealPlayer","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","Scripting.Dictionary","SWCtl.SWCtl","Shell.UIHelper","ShockwaveFlash.ShockwaveFlash","Skype.Detection","TDCCtl.TDCCtl","WMPlayer.OCX","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1"],(function(t){try{return new window.ActiveXObject(t),t}catch(t){return null}}))),navigator.plugins?t.concat(this.getRegularPlugins()):t},pluginsShouldBeSorted:function(){for(var t=!1,e=0,i=this.options.sortPluginsFor.length;e<i;e++){var n=this.options.sortPluginsFor[e];if(navigator.userAgent.match(n)){t=!0;break}}return t},touchSupportKey:function(t){return this.options.excludeTouchSupport||t.addPreprocessedComponent({key:"touch_support",value:this.getTouchSupport()}),t},hardwareConcurrencyKey:function(t){return this.options.excludeHardwareConcurrency||t.addPreprocessedComponent({key:"hardware_concurrency",value:this.getHardwareConcurrency()}),t},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(t){return!0}},hasLocalStorage:function(){try{return!!window.localStorage}catch(t){return!0}},hasIndexedDB:function(){try{return!!window.indexedDB}catch(t){return!0}},getHardwareConcurrency:function(){return navigator.hardwareConcurrency||"unknown"},getNavigatorCpuClass:function(){return navigator.cpuClass||"unknown"},getNavigatorPlatform:function(){return navigator.platform||"unknown"},getDoNotTrack:function(){return navigator.doNotTrack||navigator.msDoNotTrack||window.doNotTrack||"unknown"},getTouchSupport:function(){var t=0,e=!1;void 0!==navigator.maxTouchPoints?t=navigator.maxTouchPoints:void 0!==navigator.msMaxTouchPoints&&(t=navigator.msMaxTouchPoints);try{document.createEvent("TouchEvent"),e=!0}catch(t){}return[t,e,"ontouchstart"in window]},getCanvasFp:function(){var t=[],e=document.createElement("canvas"),i=(e.width=2e3,e.height=200,e.style.display="inline",e.getContext("2d"));return i.rect(0,0,10,10),i.rect(2,2,6,6),t.push("canvas winding:"+(!1===i.isPointInPath(5,5,"evenodd")?"yes":"no")),i.textBaseline="alphabetic",i.fillStyle="#f60",i.fillRect(125,1,62,20),i.fillStyle="#069",this.options.dontUseFakeFontInCanvas?i.font="11pt Arial":i.font="11pt no-real-font-123",i.fillText("Cwm fjordbank glyphs vext quiz, 😃",2,15),i.fillStyle="rgba(102, 204, 0, 0.2)",i.font="18pt Arial",i.fillText("Cwm fjordbank glyphs vext quiz, 😃",4,45),i.globalCompositeOperation="multiply",i.fillStyle="rgb(255,0,255)",i.beginPath(),i.arc(50,50,50,0,2*Math.PI,!0),i.closePath(),i.fill(),i.fillStyle="rgb(0,255,255)",i.beginPath(),i.arc(100,50,50,0,2*Math.PI,!0),i.closePath(),i.fill(),i.fillStyle="rgb(255,255,0)",i.beginPath(),i.arc(75,100,50,0,2*Math.PI,!0),i.closePath(),i.fill(),i.fillStyle="rgb(255,0,255)",i.arc(75,75,75,0,2*Math.PI,!0),i.arc(75,75,25,0,2*Math.PI,!0),i.fill("evenodd"),e.toDataURL&&t.push("canvas fp:"+e.toDataURL()),t.join("~")},getWebglFp:function(){function t(t){return e.clearColor(0,0,0,1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),"["+t[0]+", "+t[1]+"]"}var e;if(!(e=this.getWebglCanvas()))return null;var i=[],n=e.createBuffer(),r=(e.bindBuffer(e.ARRAY_BUFFER,n),new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0])),o=(r=(e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW),n.itemSize=3,n.numItems=3,e.createProgram()),e.createShader(e.VERTEX_SHADER)),a=(e.shaderSource(o,"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}"),e.compileShader(o),e.createShader(e.FRAGMENT_SHADER));e.shaderSource(a,"precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}"),e.compileShader(a),e.attachShader(r,o),e.attachShader(r,a),e.linkProgram(r),e.useProgram(r),r.vertexPosAttrib=e.getAttribLocation(r,"attrVertex"),r.offsetUniform=e.getUniformLocation(r,"uniformOffset"),e.enableVertexAttribArray(r.vertexPosArray),e.vertexAttribPointer(r.vertexPosAttrib,n.itemSize,e.FLOAT,!1,0,0),e.uniform2f(r.offsetUniform,1,1),e.drawArrays(e.TRIANGLE_STRIP,0,n.numItems);try{i.push(e.canvas.toDataURL())}catch(t){}i.push("extensions:"+(e.getSupportedExtensions()||[]).join(";")),i.push("webgl aliased line width range:"+t(e.getParameter(e.ALIASED_LINE_WIDTH_RANGE))),i.push("webgl aliased point size range:"+t(e.getParameter(e.ALIASED_POINT_SIZE_RANGE))),i.push("webgl alpha bits:"+e.getParameter(e.ALPHA_BITS)),i.push("webgl antialiasing:"+(e.getContextAttributes().antialias?"yes":"no")),i.push("webgl blue bits:"+e.getParameter(e.BLUE_BITS)),i.push("webgl depth bits:"+e.getParameter(e.DEPTH_BITS)),i.push("webgl green bits:"+e.getParameter(e.GREEN_BITS)),i.push("webgl max anisotropy:"+((a=(o=e).getExtension("EXT_texture_filter_anisotropic")||o.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||o.getExtension("MOZ_EXT_texture_filter_anisotropic"))?0===(o=o.getParameter(a.MAX_TEXTURE_MAX_ANISOTROPY_EXT))?2:o:null)),i.push("webgl max combined texture image units:"+e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),i.push("webgl max cube map texture size:"+e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE)),i.push("webgl max fragment uniform vectors:"+e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)),i.push("webgl max render buffer size:"+e.getParameter(e.MAX_RENDERBUFFER_SIZE)),i.push("webgl max texture image units:"+e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)),i.push("webgl max texture size:"+e.getParameter(e.MAX_TEXTURE_SIZE)),i.push("webgl max varying vectors:"+e.getParameter(e.MAX_VARYING_VECTORS)),i.push("webgl max vertex attribs:"+e.getParameter(e.MAX_VERTEX_ATTRIBS)),i.push("webgl max vertex texture image units:"+e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),i.push("webgl max vertex uniform vectors:"+e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS)),i.push("webgl max viewport dims:"+t(e.getParameter(e.MAX_VIEWPORT_DIMS))),i.push("webgl red bits:"+e.getParameter(e.RED_BITS)),i.push("webgl renderer:"+e.getParameter(e.RENDERER)),i.push("webgl shading language version:"+e.getParameter(e.SHADING_LANGUAGE_VERSION)),i.push("webgl stencil bits:"+e.getParameter(e.STENCIL_BITS)),i.push("webgl vendor:"+e.getParameter(e.VENDOR)),i.push("webgl version:"+e.getParameter(e.VERSION));try{var s=e.getExtension("WEBGL_debug_renderer_info");s&&(i.push("webgl unmasked vendor:"+e.getParameter(s.UNMASKED_VENDOR_WEBGL)),i.push("webgl unmasked renderer:"+e.getParameter(s.UNMASKED_RENDERER_WEBGL)))}catch(t){}if(!e.getShaderPrecisionFormat)return i.join("~");var l=this;return l.each(["FLOAT","INT"],(function(t){l.each(["VERTEX","FRAGMENT"],(function(n){l.each(["HIGH","MEDIUM","LOW"],(function(r){l.each(["precision","rangeMin","rangeMax"],(function(o){var a=e.getShaderPrecisionFormat(e[n+"_SHADER"],e[r+"_"+t])[o];"precision"!==o&&(o="precision "+o),o=["webgl ",n.toLowerCase()," shader ",r.toLowerCase()," ",t.toLowerCase()," ",o,":",a];i.push(o.join(""))}))}))}))})),i.join("~")},getWebglVendorAndRenderer:function(){try{var t=this.getWebglCanvas(),e=t.getExtension("WEBGL_debug_renderer_info");return t.getParameter(e.UNMASKED_VENDOR_WEBGL)+"~"+t.getParameter(e.UNMASKED_RENDERER_WEBGL)}catch(t){return null}},getAdBlock:function(){var t=document.createElement("div"),e=(t.innerHTML="&nbsp;",!(t.className="adsbox"));try{document.body.appendChild(t),e=0===document.getElementsByClassName("adsbox")[0].offsetHeight,document.body.removeChild(t)}catch(t){e=!1}return e},getHasLiedLanguages:function(){if(void 0!==navigator.languages)try{if(navigator.languages[0].substr(0,2)!==navigator.language.substr(0,2))return!0}catch(t){return!0}return!1},getHasLiedResolution:function(){return window.screen.width<window.screen.availWidth||window.screen.height<window.screen.availHeight},getHasLiedOs:function(){var t=navigator.userAgent.toLowerCase(),e=navigator.oscpu,i=navigator.platform.toLowerCase();t=0<=t.indexOf("windows phone")?"Windows Phone":0<=t.indexOf("win")?"Windows":0<=t.indexOf("android")?"Android":0<=t.indexOf("linux")?"Linux":0<=t.indexOf("iphone")||0<=t.indexOf("ipad")?"iOS":0<=t.indexOf("mac")?"Mac":"Other";if(("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints)&&"Windows Phone"!=t&&"Android"!=t&&"iOS"!=t&&"Other"!=t)return!0;if(void 0!==e){if(0<=(e=e.toLowerCase()).indexOf("win")&&"Windows"!=t&&"Windows Phone"!=t)return!0;if(0<=e.indexOf("linux")&&"Linux"!=t&&"Android"!=t)return!0;if(0<=e.indexOf("mac")&&"Mac"!=t&&"iOS"!=t)return!0;if((-1===e.indexOf("win")&&-1===e.indexOf("linux")&&-1===e.indexOf("mac"))!=("Other"==t))return!0}return 0<=i.indexOf("win")&&"Windows"!=t&&"Windows Phone"!=t||(0<=i.indexOf("linux")||0<=i.indexOf("android")||0<=i.indexOf("pike"))&&"Linux"!=t&&"Android"!=t||(0<=i.indexOf("mac")||0<=i.indexOf("ipad")||0<=i.indexOf("ipod")||0<=i.indexOf("iphone"))&&"Mac"!=t&&"iOS"!=t||(-1===i.indexOf("win")&&-1===i.indexOf("linux")&&-1===i.indexOf("mac"))!=("Other"==t)||void 0===navigator.plugins&&"Windows"!=t&&"Windows Phone"!=t},getHasLiedBrowser:function(){var t,e,i=navigator.userAgent.toLowerCase(),n=navigator.productSub;if(("Chrome"==(t=0<=i.indexOf("firefox")?"Firefox":0<=i.indexOf("opera")||0<=i.indexOf("opr")?"Opera":0<=i.indexOf("chrome")?"Chrome":0<=i.indexOf("safari")?"Safari":0<=i.indexOf("trident")?"Internet Explorer":"Other")||"Safari"==t||"Opera"==t)&&"20030107"!==n)return!0;if(37===(i=eval.toString().length)&&"Safari"!=t&&"Firefox"!=t&&"Other"!=t)return!0;if(39===i&&"Internet Explorer"!=t&&"Other"!=t)return!0;if(33===i&&"Chrome"!=t&&"Opera"!=t&&"Other"!=t)return!0;try{throw"a"}catch(t){try{t.toSource(),e=!0}catch(t){e=!1}}return!(!e||"Firefox"==t||"Other"==t)},isCanvasSupported:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},isWebGlSupported:function(){if(!this.isCanvasSupported())return!1;var t=this.getWebglCanvas();return!!window.WebGLRenderingContext&&!!t},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},hasSwfObjectLoaded:function(){return void 0!==window.swfobject},hasMinFlashInstalled:function(){return window.swfobject.hasFlashPlayerVersion("9.0.0")},addFlashDivNode:function(){var t=document.createElement("div");t.setAttribute("id",this.options.swfContainerId),document.body.appendChild(t)},loadSwfAndDetectFonts:function(t){var e="___fp_swf_loaded",i=(window[e]=function(e){t(e)},this.options.swfContainerId);this.addFlashDivNode(),e={onReady:e};window.swfobject.embedSWF(this.options.swfPath,i,"1","1","9.0.0",!1,e,{allowScriptAccess:"always",menu:"false"},{})},getWebglCanvas:function(){var t=document.createElement("canvas"),e=null;try{e=t.getContext("webgl")||t.getContext("experimental-webgl")}catch(t){}return e||null},each:function(t,e,i){if(null!==t)if(this.nativeForEach&&t.forEach===this.nativeForEach)t.forEach(e,i);else if(t.length===+t.length){for(var n=0,r=t.length;n<r;n++)if(e.call(i,t[n],n,t)==={})return}else for(var o in t)if(t.hasOwnProperty(o)&&e.call(i,t[o],o,t)==={})return},map:function(t,e,i){var n=[];return null==t?n:this.nativeMap&&t.map===this.nativeMap?t.map(e,i):(this.each(t,(function(t,r,o){n[n.length]=e.call(i,t,r,o)})),n)},x64Add:function(t,e){t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]],e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]];var i=[0,0,0,0];return i[3]+=t[3]+e[3],i[2]+=i[3]>>>16,i[3]&=65535,i[2]+=t[2]+e[2],i[1]+=i[2]>>>16,i[2]&=65535,i[1]+=t[1]+e[1],i[0]+=i[1]>>>16,i[1]&=65535,i[0]+=t[0]+e[0],i[0]&=65535,[i[0]<<16|i[1],i[2]<<16|i[3]]},x64Multiply:function(t,e){t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]],e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]];var i=[0,0,0,0];return i[3]+=t[3]*e[3],i[2]+=i[3]>>>16,i[3]&=65535,i[2]+=t[2]*e[3],i[1]+=i[2]>>>16,i[2]&=65535,i[2]+=t[3]*e[2],i[1]+=i[2]>>>16,i[2]&=65535,i[1]+=t[1]*e[3],i[0]+=i[1]>>>16,i[1]&=65535,i[1]+=t[2]*e[2],i[0]+=i[1]>>>16,i[1]&=65535,i[1]+=t[3]*e[1],i[0]+=i[1]>>>16,i[1]&=65535,i[0]+=t[0]*e[3]+t[1]*e[2]+t[2]*e[1]+t[3]*e[0],i[0]&=65535,[i[0]<<16|i[1],i[2]<<16|i[3]]},x64Rotl:function(t,e){return 32==(e%=64)?[t[1],t[0]]:e<32?[t[0]<<e|t[1]>>>32-e,t[1]<<e|t[0]>>>32-e]:[t[1]<<(e-=32)|t[0]>>>32-e,t[0]<<e|t[1]>>>32-e]},x64LeftShift:function(t,e){return 0==(e%=64)?t:e<32?[t[0]<<e|t[1]>>>32-e,t[1]<<e]:[t[1]<<e-32,0]},x64Xor:function(t,e){return[t[0]^e[0],t[1]^e[1]]},x64Fmix:function(t){return t=this.x64Xor(t,[0,t[0]>>>1]),t=this.x64Multiply(t,[4283543511,3981806797]),t=this.x64Xor(t,[0,t[0]>>>1]),t=this.x64Multiply(t,[3301882366,444984403]),this.x64Xor(t,[0,t[0]>>>1])},x64hash128:function(t,e){for(var i=(t=t||"").length%16,n=t.length-i,r=[0,e=e||0],o=[0,e],a=[0,0],s=[0,0],l=[2277735313,289559509],u=[1291169091,658871167],c=0;c<n;c+=16)a=[255&t.charCodeAt(c+4)|(255&t.charCodeAt(c+5))<<8|(255&t.charCodeAt(c+6))<<16|(255&t.charCodeAt(c+7))<<24,255&t.charCodeAt(c)|(255&t.charCodeAt(c+1))<<8|(255&t.charCodeAt(c+2))<<16|(255&t.charCodeAt(c+3))<<24],s=[255&t.charCodeAt(c+12)|(255&t.charCodeAt(c+13))<<8|(255&t.charCodeAt(c+14))<<16|(255&t.charCodeAt(c+15))<<24,255&t.charCodeAt(c+8)|(255&t.charCodeAt(c+9))<<8|(255&t.charCodeAt(c+10))<<16|(255&t.charCodeAt(c+11))<<24],a=this.x64Multiply(a,l),a=this.x64Rotl(a,31),a=this.x64Multiply(a,u),r=this.x64Xor(r,a),r=this.x64Rotl(r,27),r=this.x64Add(r,o),r=this.x64Add(this.x64Multiply(r,[0,5]),[0,1390208809]),s=this.x64Multiply(s,u),s=this.x64Rotl(s,33),s=this.x64Multiply(s,l),o=this.x64Xor(o,s),o=this.x64Rotl(o,31),o=this.x64Add(o,r),o=this.x64Add(this.x64Multiply(o,[0,5]),[0,944331445]);switch(a=[0,0],s=[0,0],i){case 15:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+14)],48));case 14:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+13)],40));case 13:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+12)],32));case 12:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+11)],24));case 11:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+10)],16));case 10:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+9)],8));case 9:s=this.x64Xor(s,[0,t.charCodeAt(c+8)]),s=this.x64Multiply(s,u),s=this.x64Rotl(s,33),s=this.x64Multiply(s,l),o=this.x64Xor(o,s);case 8:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+7)],56));case 7:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+6)],48));case 6:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+5)],40));case 5:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+4)],32));case 4:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+3)],24));case 3:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+2)],16));case 2:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+1)],8));case 1:a=this.x64Xor(a,[0,t.charCodeAt(c)]),a=this.x64Multiply(a,l),a=this.x64Rotl(a,31),a=this.x64Multiply(a,u),r=this.x64Xor(r,a)}return r=this.x64Xor(r,[0,t.length]),o=this.x64Xor(o,[0,t.length]),r=this.x64Add(r,o),o=this.x64Add(o,r),r=this.x64Fmix(r),o=this.x64Fmix(o),r=this.x64Add(r,o),o=this.x64Add(o,r),("00000000"+(r[0]>>>0).toString(16)).slice(-8)+("00000000"+(r[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)}},t.VERSION="1.8.0",t}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LogoControl=void 0,i(75);var n=i(10);function r(){}r.prototype.onAdd=function(t){return this._container=n.domCreate("div","maplibregl-ctrl mapxus-ctrl-logo",t.getContainer()),(t=n.domCreate("a","mapxus-logo",this._container)).target="_blank",t.href="http://www.mapxus.com/",t.setAttribute("aria-label","Mapxus logo"),t.setAttribute("rel","noopener"),this._container.appendChild(t),this._container},r.prototype.onRemove=function(){n.domRemove(this._container)},r.prototype.getDefaultPosition=function(){return"bottom-left"},e.LogoControl=r},function(t,e,i){var n=i(76),r=("string"==typeof n&&(n=[[t.i,n,""]]),{});r.transform=void 0,i(9)(n,r),n.locals&&(t.exports=n.locals)},function(t,e,i){var n=i(17);(t.exports=i(8)(!1)).push([t.i,".mapxus-logo {\n width: 106.4px;\n height: 28.4px;\n margin: 0 0 -3px 3px;\n display: block;\n background-repeat: no-repeat;\n cursor: pointer;\n background-image: url("+n(i(77))+");\n background-size: contain;\n}",""])},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATAAAABRCAYAAABVJPq4AAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABzbSURBVHgB7Z0HnBfVtcfPLrANdqVlETCWZU0MVqyAaDAosHRUSIzl2RJLorHHgorl2RKNSl7UlzxFDSriY4WVsjSJYqE9xYI+UcEGAoKULWyBze+3O//N/z87d+bOv8Bfc76fz+zM/ufOnZk7954599xzz4goiqIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoivJvQIb8m1NSUpJdXV2dm5eXl5OVlZVTX1/fMSMjo8vOnTu7tGrVKq+hoeEl8LkoipJ2tJbvOcOGDcvD6iAIo7137dpVCOHUFf93hmAqxLoblg4FBQUd8H8+hFZ77G/F45A+ksU5WHqLoihpx/daA4Pw2hcCaRE2fygJAOF2ArSwRaIoSlph1MDGjx+f+cYbb7SH1pIzd+7cdfipQSwoLi7OLioq2guCoyA7O7s9fuqAPL6AAPhQdjO4hhslQeHlMAqLCjBFSTOMGtjQoUPPhwD4z8zMzErYhfrNnDnza690Q4YMGYnu1lhs7u0s+dBYcnBsLrZzsLTG/1/j/75lZWWrZTcB7esgnHM5NvMkcVbl5OQcOWXKlApRFCVtyDTtQONvh2VvCJ/u0iSYPIHw+j1Wv8TyMyw9sfwQx/0A63biaHjMB4LwCNlNUHvkSpIjvEgPGPp7iqIoaYVRgEFwbXA2W0P4ZImZH4gFMJAPkN3EsmXLDsXqVEkeLKefi6IoaYWfBrbD2aQW5anJlJSUFIilloP8+shuAue6BksbSSLIb0SfPn1yRVGUtCHTZ9+W5kSZmR29ErRu3bqT2HfT9oVdqrOkGNjk2FUdJkkGAmy/wsLCXqIoStrgp4FVRrY5EumVBvavvaTJUB8I8uPI5GGSQnr27JkFYUubXHtJMuhSt0E5/EIURUkbjAIMNqu65kSZmZ52rrq6ug7iEmBo6JVeaSkAIMCOkxRSVFTUF+cYK6njGFEUJW0wCjBoG1uitj1tP45XezRV+O01MZNSAYBz3yb+3eJEOfDUU0/dTxRFSQuMjT0rK6s2sg3BYOqSud0rOGfwLUNaCsKUTcmBfW0gVv0ktXSqra09TRRFSQuMAgzdxqrINrp/BV5pINj2cf1Eh9VXxQA1Noxc9pDkk8GRR0mt9hUh6QMEiqLEh7HBt2nTplmAOV71LfDoQm6AsFuJ9bdiACOXx0qSGTVq1JE478myG8A9H787RlMVRQnGKMCmTJlSG/WvZ4OF0Ojm+n/TUUcd9Rk214uZpAqw/v3756BreidVMNk90Kl3tCiKsscJ6nJFvPGzDftjupCQIRvHjx+/C5tGQz7SJNVO1a5du8EQnANDHGI1Kd0P3MOpENRJdZRVFCU8vgIMDbXWWZu6TDFGfGhCjV1HCJRlhvRMc6AkiTFjxnC+5pVib/ui8HpEEuf4rkAURdmjBDX8b/gHAqmFDQxdN07WjvHChzDZzDXsXEtNGdKhdciQIUlxRdixY8cJWJ0Y4pAPcG23SNNoaSLk4z5+Koqi7FF8I7JGnFKxbuFGga7bPh7p13JdXV29GoMAX3qMUjbSqlWrvlh9JgkAAcprvyLMMbie+0pLSzfBCP86tveVxGC39Wn5DoJBj/a1tbX7c3vnzp3ry8vLGSopdNea+eD47ljYnf722GOP/cIxISQVPuu8vLwicV6YGCHf8SlYuXJlrewBaHfF9ewbuR7cfwXK8GNRQuEMhnVHr6zRfp2dnV0FpeSzWbNm1djmERRSejv/oLG3mAsJIbQPThybWevWjQKsT58+W5YvX87RSE8BhuOOxOpZSQBUII469rdND+G6HHarp6dPn877mYSfEp0WdCIqcvuFCxdukT3IoEGDuuLBz/Tah3K+56WXXprM7REjRhyGMrgUmwPQ4IojIbO5xr4K7HsZgmES1jNRRttN5xs9evSPcPzlSMd8DorkQfDMd6BSvoHyfQ77p+Lc30ic0DxQU1NDl5Wxjo2zbfT+Hj161BcXF8/HNfwPzjcD52ocNR86dOgIXM9t4l0eFyHdkujfhg8fTufqRyKhxKPAaRtuKSsre4n/UIjm5+efgXRn4veTpGkwRyL3j/vein0vY9+TkK0zg4TryJEjS5F2f699uKfSGTNm3O53PIVoQUHBc9hs0ZtBvmyYp0fH38N93oPrG+SRdsP27dtHoh7vEAtQvmfhfq/22ofyHRnw/YgM1LX+SHcWroXht/bnj5H6U19fTxmyC9f6NvY/hXSlQd+j8BVgyGQLbpCbWYyxFf12ReYtbEBbt25tFGBMh4ugId/TuI6G0ofzFuN9g7Iy4abvkKhKFACv+8bI9aOCLMPxHKAolPjZNzc393Cs/yF7EDyjbDwjz1hr+L0rKgwDTN6DhTHb2hvS0RwwHM90ONZvojHej4ozVZrKrZGBAwcWQlDehUo2Bv8WGC6HgSzZuE/C+lqc+7aPP/74+ZDPOQN1ZwS0eI4sH+KTjoEyByHNQCzv4Jir0GAXYLubqTy8ghIgbVscc5RTz90U8w/KYwiOvR5pjsPiWedoGsFqFKOWQLguKSoquqGiomIRBEO9V3rUwXKkfcRwnUU45yt4BgvFAHpAl+F5jfAafacQRd10N/wfG8qF2jenA1oJMJyu2FS+uB6Wr6fAwfPpjWPH8cWHtd/8aZq16BZ1JNJdh+P+kJOT89iUKVOqTYmN4IKaVbnFixe3c+12h2qucmkjK8QALu4QvD07SJzgTXgWVkeHOKQcD3Rh5B9Gl0XhzJYEQTc5rSd3oyH8hJoVNql52U5wZ0V7Fg3oAScwJN+6RRBe1FwuELPwcsOKPhEN+UG+rGwOgNaVhfNSe3o+QHg14zTgw3Gu6ajsv5bkQo3hOpxiKr+LIHYvTJYZZ5wsQD292ZQI9fGvWM0y7C7AOf9KDd9rJ7TgQxgu3SC8PoHwvxoNfqekCdTacF2zsQwVy+APDnTT+hPu5wUndFcLbN0oBFLQ7TbQxZSW4GLXiAG+rbD/AIkDdi1w7O9CHLIL6R90+bWRlyRBkG8JVXlJX9igj5LwtMYzunzp0qVnDxgwoBO2nxeProoFrXDsxRBiV0nwB2Qyqqqq7sF6nNhr1v86OCODXcwJWCdNiCGvc/CM7xKzG5Hfsbzf6yEAz/faTwGDvC8W84BSMQTgNV476urqLhLvF1IN8rxq/vz5myRNwIDdoSiKPzsaalzg2CHoMd3r5brkK8BQGHVR2/mufd1cJ1kb/T9U5LVIs07MxOUPBmn8C5wrTHjqN9atW/ey+0dolzOwsjYWesHuClT57+sn1zKgwU2ArfFZdrEkftiWx0Oz8o2lBu1pKNL91kurCAEFX9JitjldpVYSP1l8eUJ78Byxduw712IxaUtXDx48OCYEFQTi8Sii8wzppx1zzDEJv5iTCQTPXYkIrwjI46KuXbue4v7dV4ChAm+MbMP2kePKMMYHDA/qi+j/jzvuuE1I866YL+gECQm7GKzkIQ6px3WNg3G5zr2DRl/ktUQSgCGCUEbfiVDTzsvoPaxfwPI07r0c/68JOIwvrVM8fl+F5X+xTKQB3fnfD2owE/D8PIUBhBu/u/CYRRRdmijm4vofx0IjOO+nXnYTuD5q8+9jeQ4vwIn46RUsQdpOPgzTTzluRy1Az4blaBrQyoGZ4il0wRrNLdRA2C0X14AGwe9f4ppuSMUocLzgudLn0zR3eAvK81IsB+K+WqGM+K1WmmRMLlh8t93mrkNBbhQVkRdidFBD52OxbhU2RgNzDPlvisGQDw4Na8h3tK9DbdMj7UKMsBg/h8aRMqxCC1JXHsNRqL9NJ5uDB6ugEV+M8ns9erSJhnk0oItwD7eKhabhaNTXY3khMupH6E6Bbs1ICHMapU3zZo/C+WnXWuGxj7a1bj6n3sSuHO7heeTxdcQwzu47NOCf4fjrHRtVqqBQWITzj+OXriL3Thvha6+9tjfsg9c5XVdTyPF9cZ202z7q3sF6g/b0RxzPhu7VLTwc5Up3oVu7d+/O0d9ijzQ1SDMOo8efSnphCiPP8rwQ10vhLfQMkKYXweSTTz55NupkuSF2YE8oUowC3WyuCupCNn9GDBlGdyHz3CF2+Ok09/Eo1LfFnHdnGPKt7WB8g+GcvxN7r3te872mUSCCwpgjidMdtpuUBmpMBJTzR6gQvWfNmrXAPVQ+Z86cDRxZxOaFFvlsRndgEBrvU9HCi7z44otbMOz/JDbHUksxZEEtrMT9o+PP9xsxU4tzj8I5H8A9fBn9PHk/+H0mhOcwRyNKFc+hrgzEPb4afe98Sc+dO3ctfrsCdZ32sm2mDPx6Djj+HVz/jWLmcigDw5D/dV478Xs5hMBTkmZ4BHuIUIGXged0w3nz5m3F6hrDcXl41jGuWUFTiTZHbTe/XXDyHBSae0j6K/fxeKh+wQ05vG/9oY+99trrTKyOtE1PX6Rp06bN80uDBrES6V6XxDld0pMqPIMz8ZbfbEpADaCsrGyi4xtnBMLrQpTnu35p6DOFZ3qfT5IWz48alJjdWXagYY8J+io6nuM22Oouw7kTMgkYmAbhcFaQcyXK5gWsLhOzQ/DBsF8VG/Y1wHb1mDR1y72gslAm3uW0Hu3xbEnCHN9kg7pn8pHMxz6j7biiooI9t8uxXOle6CAfnbZ1wAXscJziMqMFFjLpiP/d04haGOxLS0s34M1Bh1bPbyriGLpCTJQA0NVpi4p8l9hTi2u/1yYh8p2D6+grCUDfH6yukvRjCRrfMpuE0DD+jjIba7BD7aqtrZ1vkw/K8ynkw4bcwk6D37007kGmvFDHymiUhuYjQfCjwyNHjrwJ558myfseKO/nBpSJlXCAIJkMW84Z2BxsSMJpb54e+9TmBg0adBnaVl8fzaUFKKM7KMAlDUF5/L9hTIb2rCfpMgON6tny8vIY2eFo2RPEAl8NDJWaBdNoo8IbuLlS4KG6I7HuwAWZCtHPH8xqdAtdoHOw6ij2zD/iiCPesUmICsO3XrUkAO69Bz3iJf14yzYhGt47uA+TB/4nto2ksrJyNfIxxYNr8cJE2p8Y0rKeTQpjlIYWtACrDyVJoH6+C+3POj9qabifx33y8x09Z0PG8f8l9tc3DyPs/y1pSufOnalJrTXspq/b/TBhvAsl52kMVPwHbKn7mwZ6TAR1Iak2Nxqno6OyomK5Da47IG09uyk47hUxc3SQkyMHDHC+a8UeGjTvtK340BLfw+ptSRAI2TGSZkR9nDgQRuBFetOAyhqxxLGzWU0hcnzounjtQ93bhDoVtkvIUcJXJUmgTGbbal8RcM0fmPYZDPAxoBt+N85ZKsF8npWVdaHXCHu6MHHiRPbgaN80DtRhP43yZ6GsJ6LsVnEuJNr8kxBqJf369Qt0dvcVYMiQmkmkgJpD6uBk7jmOVRAynpUWadmFMU1TaG1hyD8PD9Ta2I8CgU35xTckBLj2WZIgnAeWbjHCUBZW00MsCDXCanve3NzcLK9AAU4e22tqauLRjFdLkogEJwiD8zGcKq99GYbIxu4s0F2nOcI4x5YDJeC2qVOnJhQQYXcADXYa7aKW7i7U0LvTgRjrme3bt18MQXZnSUmJ0ZHYV4ChW8FRyMYTI9NoTSlGMnK00tTFwAjdKuw3hpiGkDQ6HjpTKcLYlujbdUfYtya6x9OinXbjpK/GCAsHug+ZRJJLQs7JiYK6V59oXcrPz6dPpV/XtQZ19jX5btAAIXYzyoT+ku+HOZA+YljdBDm0wu3QG8G38uANWRd5GFhHfxuyU0wmmZlfmfJwhkVXmvbjQRg98vEgf4ObKBJ7JkMFXykhgSGRxsb3JDFyUA4jRLEGNla6SHhqKzRZdOjQIZ4pRYlM0HdjO++zGQhl2nY8nVYttRDGubtJfD5BiHxyoYE9wml18h0BAzFTUS59cN2MoPwkFna1be2bP0Z3ee6QIUNa2BB9BRhGdrY6djCJnkGe4QqvEzBliOmNAQ5Nhnz0gxlv6VKxp4Kx8SWO4WQaX51JzwmBPNLVnSItOfroo2kj8fRkZx3Di2V/CY+1q00q8kKPgi9cT0M07unLoONhzGZ7uEYCHIuR10kQdDdI4jDWmvV8Xryk455axTBNEGTl0MjORTn1hvJCgXYr6sBC7K7wOxZpCnHuxxy/wX9dT9BJqRI7GURsFRwXzXcl8zUWczjVZ/cRXoZ83Bx9W/y8s2Pg9BgUTtyeyCicuZI4hw0cOPCHoljBgRaUu7GrhLo3WEKANzRHx619Cy04IQ67plELR2P1nXIVFSYqX+y4gpOlLdOaDOlt8Qy6iD2BAxE20OQEW/USxj2DQDsJ2vgRnFrEkV/TMbjOXgUFBTEuWUEBDSkYaJwvRuaN6jQaaB5HDlz+HV/55eHMiaRh10vS58CQ33vlypXNo5Uw2jFYYphoq/XoJ98nCQAhuxiV50vc2z4SPx3QhWBf/4+i2MLn/ivDvstRFyahsn8iFuD5XSKJxXhz07Fbt25XYaTPyqcQBueDUX/ONO0PCuGExnkeI5yIPXm4579L0wR23+4Y8t1o8MniwAJ7DiskgBEjRnRpaArmaEMGnl3njJaBIimItrlnczjPmFPRHoEWeirStHDq5dxjLP2x2ewiZWNAjfgGNfqBQd3kBOYYIz6Eja9qjNGkjwMM+TGqOh7KuWL4lJsXKKTHIM3XSALgTfAtrnGmJAjyGCKKNag7bNSmUctOeDE948y99WXUqFFs+OMk+YxHQwyMOOJofww7ZLKbrUej/T/T8TBS78/IFV778DuDZm40HHoYyofzMIOiePhpupdAOAX2dnAd54rB7cUN8ivEs/sAbXmde4H8mOrnPkV7mRgcfnGtMT0cGwFW6awbBQoqXIuJ3Mj0a78MaMhHmo9M+xmhNbLNONnOnEcrkJaz2v8iSYAFK4nTjzMHRLGCYafRMBb4JDkWz2Uy3/5eOzmhGvsGowvCuZip+DJ7DhriNGhXp4lBSHCKEK7xRTHMOCEM6Gfax24qzvGweM8goCvHr3D8TabjUf/vhgA9XHxw5h6aRmg7If8nTGUsTVFyR2J9i1gCOUHFx/P7sDjXgAMOOMD4MR6n/Zgc12PuIbALKY4/iiO4WBAd8bDaxV5Pw3qLfOiVa/qSTy+GPqaRDw/j9xJC+8J1PYRGEHrk0Qvc26s4/zdhzu+GU3EwYsL5fWWiWIG38u14jowm4Wn7Qf1ipIalaETzaPDF8jGOaQwFje7dyfj/xIzgUDyJwG7p04z4ivPMwbW+zWl2WP8I//dmGJiIicXANgioO0w7nSgTQ732MQoH6vcqdKu+wTnPMHTh2mPfwxiVHGQKvdyuXbv3q6url/tMmxvIgSzcI+PsL0L5foqeE7uotE1ReHGxDuzILiLy4vxQL6HXGtfLqUTjPv3000nREWkcTfBmj7nWjbi9BWzeWFXOgR2dtVtKV/h1DyNAOPhNyD2A05MYuliaooha4cRAelSShNMvTzggHMpIv9wdgmnTpi2W4Dmx7Dqcxzl0DBKAZ09Bcjd+G5Bi4RWBtiI2coa+oSBd5EwbYn31E158wd8DE4enHY8hjRqaPraS6XHg2xipbYybTxNHbW0t7cKe3W1cy/GO+4UnjEiMNA+JP5zWxZDe/FjKagjd951J/mMljqi0EH5P+ETo6MZRxR49evDF9AyWh7HMQPq3Gpoi1XrB9hnjLRAowGj8i2w7fifdXfs3R1wt/IBWQslp9MgHvXBDDCli7XvDYHqMby/JhQIs0dhew23jwCtNoAvIDz4k49NkaRPQz4HBrjwFB7u/OTk5D2DT5Ot4U/SUuNmzZzPszp0GfzK25Qtgr+thyEu2b9/Oa0mGmcQK2qXRRunqYfL144uHDqqcAM8AALQfGwdhkNez6KXF9PYCBRjnyEW2KysrKcDcE7k3rV69ujIon6qqKgpC42gSJD6/mhMmuulmCL0HJMngrTHfK7JGSDr79fGVlnBYHXVgJCp1IuGN5uN4qxFDG5zQQImE6FkErekS94hbhCVLlvwcAslU58tyc3PL3T+iDd6L+mmyGe6NNjHB9PLkPFW0Q2p7VoEOPGAbDjVNr6ysjPZpRpYIlBEBLONLzv1joABDATergAyjg8KL0cAYhcImquqcOXN4A2/6JOEnvcJ4Fj9SWlr6kSQZBudDxU3UK58qpTq1hoTx2Rx71zMSTgumRjLR6bp/LkmCLzI0Gl4PDfRhNDtGZ3mInz1zh4qJQEdtvCz/hHRedmgObHh+WYihZpzgh6auWUlRUdH5hn0yf/789TgnR2x9Y6y5YZvAC2Y4u+4SEggxRsz9NZZ45m5ygj7Dh5d49bZsbGDN9q26ujpOvo1R8fD/V2IJ0vrFpgozglQBdTiVvlZWsa/8QCU7JRLLXLGHth6GT3L8qQI1BTRGCr0LMJJ3gd8HeeMFQnXj2rVrx6In8kucJ8gfjbNAlqOhj8a1XMF7MSXEdf9BDC4JOM+fabg3HYt8l2P1F5+876ZPmmk/rm0t2s8pOA/974KcvzmIN4EDJRAgiyVOcD98KR2P5VYfu5gbfvPg7IqKirGmjyTbjEI227egVezt4ehpPWMfx7+JhytJ4LZUfhEbb91SXCvjxCcy14x2DU4LmScpZOPGjV916dLF0/kRQtQ6lhU0z60YATod9+41EhjqC9toQJchn84ev1tVXEfzmAz7z5QVK1b0xIuT98coBY1ft0Ed3AqBwnr3WnZ29ptMjwreeCzumdrSGq98YYd9U+KAIWuwTIaQnNq1a1eGD++D8++H62jrXA+7VvSF/AeuI9AhlKAdUIA94f6dgQigmQV2oyHkb4fRfi7y8ewu4vp8PQOcsEd/g137CYxO8ruavXEMPwrMOk+N9htcywcFBQUvT5o0Kfq5PY5zepZj27ZtfW2YKBsqO7ejHO/GyGs/PCsGNKVJqgMjHDrzrjm1jP5iL/fq1ev9oLBYgZ+wghbRNyo0NLtF90vUNwKp6jJeuVhAoyUqAi/Q9iOrLaA/GW7uBEZ7lRSCN9hCMbt9WIGyeRxlc4EoaQu6cv1Rp0zzYK9E9+dBUdKWwG4bhEWzfQsPmm+dmOHUMDGTKE05NCwJgOMfTbXwIrjXhP24IPh/mm4xwhTl+4TNKGRz9wHCg744ua79FRKOpRInTtSLF2X3kHCMMJZXYWHhgaIoSkoIFGA1NTXsDzdqYWiQ7DrGTHeArSOUfYQOgBI/E6DSJy3iph+wuzCoXFw2kyiyYEvTuZGKkiJsw+lEvPGL3F7PplDSJtq0aROvD8oqGBST5nUfhPOBhmQ4/Z0miqKkhEABhhEHal8RRzx3rCsGEaySEGC063MxeOb6AWHy8DPPPBM4ZSmZQHtidIpEPbttRnoVRYmDQAGWm5u7C8IjYsh3R2LdhKHpsB9eoCE/rHfzhxgu3+2fj3IcZeP1xOYwdRnK7gxRFCUlBAowdPlqTI5nDExWWVkZz5djQhnyoeU9xsmosgeAAJou4VmNMrsQI5Cjpk+fnoz5fYqieBDYvdm4cWNDfn6+p/DgRO6FCxeG/goMBN9STtEXCz808HVeXt7fZA8Bze/+6urqbs40le4ByRlihVNI7uLcvohzpaIoqSFQgNFjd9iwYR+hAR/tsZsjiqE/ogGtbUHbtm2/aggO30xD+nn8bLzsIRzN77IxY8ZcjRHZsbhmBluMKQu6W0Aos4t714wZM0J/S1DZc+C5bcYLZ6Fhd9Ln2irJxUYDktGjR3eqr6/vh4banN4J6PaKaaZ9EBCK9I862C8N8l8DgbAi7HceUwnDG+Peh+La+Mk3hgJZg/+v69Wr1wLbr4EripIcrASY0hJ+QaagoKBw27ZtGxghQBRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFSQX/BO3KWsJPj46IAAAAAElFTkSuQmCC"},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AttributionControl=void 0,i(79);var n=i(10);function r(t){this._theme=t.theme||"default"}r.prototype.onAdd=function(t){return this._container=n.domCreate("div","maplibregl-ctrl mapxus-ctrl-attribution",t.getContainer()),this._anchor=n.domCreate("a","mapxus-attribution",this._container),this._anchor.target="_blank",this._setCopyrightInfo(this._theme),this._anchor.setAttribute("aria-label","Mapxus attribution"),this._anchor.setAttribute("rel","noopener"),this._container.appendChild(this._anchor),this._container},r.prototype.onRemove=function(){n.domRemove(this._container)},r.prototype.getDefaultPosition=function(){return"bottom-right"},r.prototype.changeTheme=function(t){this._setCopyrightInfo(t)},r.prototype._setCopyrightInfo=function(t){this._anchor.innerText="landsD"===t?"© The Government of the Hong Kong SAR":"© OpenStreetMap contributors",this._anchor.href="landsD"===t?"https://www.map.gov.hk/gm/":"https://www.openstreetmap.org/copyright/"},e.AttributionControl=r},function(t,e,i){var n=i(80),r=("string"==typeof n&&(n=[[t.i,n,""]]),{});r.transform=void 0,i(9)(n,r),n.locals&&(t.exports=n.locals)},function(t,e,i){(t.exports=i(8)(!1)).push([t.i,".mapxus-ctrl-attribution {\n margin: 0 10px 5px 0 !important;\n}\n.mapxus-attribution {\n text-decoration: none;\n color: #404040;\n}",""])},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DistanceSearchType=void 0,(e=e.DistanceSearchType||(e.DistanceSearchType={})).POINT="Point",e.POLYGON="Polygon"},function(t,e,i){"use strict";function n(t){return-1<t.id.indexOf("mapxus-poi-restroom")}function r(t){var e=-1<t.id.indexOf("mapxus-poi-stairs"),i=-1<t.id.indexOf("mapxus-poi-escalator"),n=-1<t.id.indexOf("mapxus-poi-elevator");t=-1<t.id.indexOf("mapxus-poi-ramp");return e||i||n||t}function o(t){return/en/.test(t)}function a(t){return"zh-Hans"===t||"zh"===t||"zh-CN"===t}function s(t){return"zh-Hant"===t||"zh-TW"===t||"zh-HK"===t}Object.defineProperty(e,"__esModule",{value:!0}),e.isTraditionalChinese=e.isSimplifiedChinese=e.isEnglish=e.isConnectorPoi=e.isToiletPoi=e.getTextFieldCoalesceList=void 0,e.getTextFieldCoalesceList=function(t,e){return t.map((function(t){var i=[];i=o(e)?["coalesce",["get","name:en"],["get","name"]]:a(e)?["coalesce",["get","name:zh-Hans"],["get","name"]]:s(e)?["coalesce",["get","name:zh-Hant"],["get","name"]]:["coalesce",["get","name"]];return(n(t)||r(t))&&(i=""),{layerId:t.id,coalesce:i}}))},e.isToiletPoi=n,e.isConnectorPoi=r,e.isEnglish=o,e.isSimplifiedChinese=a,e.isTraditionalChinese=s},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ThemeType=void 0,(e=e.ThemeType||(e.ThemeType={})).CHRISTMAS="christmas",e.HALLOWEEN="halloween",e.MAPPY_BEE="mappyBee",e.MAPXUS="mapxus",e.LANDS_D="landsD",e.COMMON="common",e.MAPXUS_V2="mapxus_v2"},function(t,e,i){"use strict";var n,r,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.Marker=void 0,i=i(5),o(a,r=i.Evented),a.prototype.onEventListener=function(t,e){this._map.on(t,this._layerId,e)},a.prototype.addTo=function(t){return this._map=t.getMap(),this._indoor=t.getIndoor(),this},a.prototype.create=function(t,e,i){var n=this;return this._coordinates=t,this._floor=e||"",this._buildingId=i||"",this._map.hasImage(this._imageName)?this._createData():this._loadImage((function(t){n._map.addImage(n._imageName,t),n._createData()})),this},a.prototype.remove=function(){return this._map.getLayer(this._layerId)&&(this._map.removeLayer(this._layerId),this._map.removeSource(this._sourceId)),this},a.prototype.switch=function(t,e){return this._map.getLayer(this._layerId)&&this._map.setFilter(this._layerId,["any",["all",["==","floor",t],["==","buildingId",e]],["==","buildingId",""],["==","floor",""]]),this},Object.defineProperty(a.prototype,"layerId",{get:function(){return this._layerId},enumerable:!1,configurable:!0}),a.prototype.setImageUrl=function(t){return this._imageUrl=t,this._imageName=this._imageName+"_"+t,this},a.prototype.setImageScale=function(t){return this._imageScale=t,this},a.prototype._createData=function(){var t=this;this._addSource()._addLayer(),this._indoor.currentFloor===this._floor&&this._indoor.buildingId===this._buildingId||this.switch(this._indoor.currentFloor||"",this._indoor.buildingId||""),this._indoor.on("switchFloor",(function(e){e=e.target,t.switch(e.currentFloor,e.buildingId)})),this._indoor.on("selectBuilding",(function(e){e.feature||t.switch("","")}))},a.prototype._loadImage=function(t){this._map.loadImage(this._imageUrl,(function(e,i){if(e)throw e;t(i)}))},a.prototype._addSource=function(){return this._map.getSource(this._sourceId)||this._map.addSource(this._sourceId,{type:"geojson",data:{type:"Feature",geometry:{type:this._isMultiArray()?"MultiPoint":"Point",coordinates:this._coordinates},properties:{floor:this._floor,buildingId:this._buildingId}}}),this},a.prototype._addLayer=function(){return this._map.getLayer(this._layerId)||this._map.addLayer({id:this._layerId,type:"symbol",source:this._sourceId,layout:{"icon-image":this._imageName,"icon-size":this._imageScale}}),this},a.prototype._isMultiArray=function(){for(var t=0,e=this._coordinates;t<e.length;t++)if(e[t]instanceof Array)return!0;return!1},i=a;function a(t){var e=r.call(this)||this,i=(t=(t&&e.addTo(t),Math.floor(1e3*Math.random())),"mapxus_marker");return e._sourceId=i+"_source_"+t,e._layerId=i+"_layer_"+t,e._imageName="poi-01",e._imageUrl="https://map-service.mapxus.co.jp/bssww/assets/origin-marker.png",e._imageScale=.65,e}e.Marker=i},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RouteService=void 0;var n=i(7),r=i(86);function o(){this._api="/api/v1/route",this._request=new n.Request}o.prototype.search=function(t,e,i,n,o,a,s,l,u){if(void 0===s&&(s=r.WayFindingVehicleType.FOOT),!t.length||!e.length)throw new Error("Coord cannot be empty.");if(2!==t.length||2!==e.length)throw new Error("Coord cannot less than 2.");return t=[this._api+"?fromLon="+t[0],"fromLat="+t[1],"toLon="+e[0],"toLat="+e[1],"fromBuilding="+o,"toBuilding="+a,"fromFloor="+i,"toFloor="+n,"vehicle="+s],l&&t.push("locale="+l),u&&t.push("toDoor="+u),this._request.get(t.join("&"))},e.RouteService=o},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WayFindingVehicleType=void 0,(e=e.WayFindingVehicleType||(e.WayFindingVehicleType={})).FOOT="foot",e.WHEELCHAIR="wheelchair",e.ESCALATOR="escalator"},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.version=void 0,e.version="5.0.0-jp"}],i={},t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:n})},t.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},t.t=function(e,i){if(1&i&&(e=t(e)),8&i)return e;if(4&i&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&i&&"string"!=typeof e)for(var r in e)t.d(n,r,function(t){return e[t]}.bind(null,r));return n},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},t.p="",t(t.s=18);function t(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var e,i}));
17
+ t.exports=function(t){return null!=t&&null!=t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}},function(t,e,i){"use strict";var n=i(15),r=i(3),o=i(55),a=i(56);function s(t){this.defaults=t,this.interceptors={request:new o,response:new o}}s.prototype.request=function(t){"string"==typeof t&&(t=r.merge({url:arguments[0]},arguments[1])),(t=r.merge(n,{method:"get"},this.defaults,t)).method=t.method.toLowerCase();var e=[a,void 0],i=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)i=i.then(e.shift(),e.shift());return i},r.forEach(["delete","get","head","options"],(function(t){s.prototype[t]=function(e,i){return this.request(r.merge(i||{},{method:t,url:e}))}})),r.forEach(["post","put","patch"],(function(t){s.prototype[t]=function(e,i,n){return this.request(r.merge(n||{},{method:t,url:e,data:i}))}})),t.exports=s},function(t,e){var i,n;t=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return(i=setTimeout)(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}var s,l=[],u=!1,c=-1;function h(){u&&s&&(u=!1,s.length?l=s.concat(l):c=-1,l.length&&p())}function p(){if(!u){for(var t=a(h),e=(u=!0,l.length);e;){for(s=l,l=[];++c<e;)s&&s[c].run();c=-1,e=l.length}s=null,u=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return(n=clearTimeout)(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function f(){}t.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];l.push(new d(t,e)),1!==l.length||u||a(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=f,t.addListener=f,t.once=f,t.off=f,t.removeListener=f,t.removeAllListeners=f,t.emit=f,t.prependListener=f,t.prependOnceListener=f,t.listeners=function(t){return[]},t.binding=function(t){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(t){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}},function(t,e,i){"use strict";var n=i(3);t.exports=function(t,e){n.forEach(t,(function(i,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=i,delete t[n])}))}},function(t,e,i){"use strict";var n=i(23);t.exports=function(t,e,i){var r=i.config.validateStatus;i.status&&r&&!r(i.status)?e(n("Request failed with status code "+i.status,i.config,null,i.request,i)):t(i)}},function(t,e,i){"use strict";t.exports=function(t,e,i,n,r){return t.config=e,i&&(t.code=i),t.request=n,t.response=r,t}},function(t,e,i){"use strict";var n=i(3);function r(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,i){return e?((i=i?i(e):n.isURLSearchParams(e)?e.toString():(o=[],n.forEach(e,(function(t,e){null!=t&&(n.isArray(t)?e+="[]":t=[t],n.forEach(t,(function(t){n.isDate(t)?t=t.toISOString():n.isObject(t)&&(t=JSON.stringify(t)),o.push(r(e)+"="+r(t))})))})),o.join("&")))&&(t+=(-1===t.indexOf("?")?"?":"&")+i),t):t;var o}},function(t,e,i){"use strict";var n=i(3),r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,i,o={};return t&&n.forEach(t.split("\n"),(function(t){i=t.indexOf(":"),e=n.trim(t.substr(0,i)).toLowerCase(),i=n.trim(t.substr(i+1)),!e||o[e]&&0<=r.indexOf(e)||(o[e]="set-cookie"===e?(o[e]||[]).concat([i]):o[e]?o[e]+", "+i:i)})),o}},function(t,e,i){"use strict";var n,r,o,a=i(3);function s(t){return r&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}t.exports=a.isStandardBrowserEnv()?(r=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a"),n=s(window.location.href),function(t){return(t=a.isString(t)?s(t):t).protocol===n.protocol&&t.host===n.host}):function(){return!0}},function(t,e,i){"use strict";var n=i(3);t.exports=n.isStandardBrowserEnv()?{write:function(t,e,i,r,o,a){var s=[];s.push(t+"="+encodeURIComponent(e)),n.isNumber(i)&&s.push("expires="+new Date(i).toGMTString()),n.isString(r)&&s.push("path="+r),n.isString(o)&&s.push("domain="+o),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read:function(t){return(t=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)")))?decodeURIComponent(t[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(t,e,i){"use strict";var n=i(3);function r(){this.handlers=[]}r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){n.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=r},function(t,e,i){"use strict";var n=i(3),r=i(57),o=i(24),a=i(15),s=i(58),l=i(59);function u(t){t.cancelToken&&t.cancelToken.throwIfRequested()}t.exports=function(t){return u(t),t.baseURL&&!s(t.url)&&(t.url=l(t.baseURL,t.url)),t.headers=t.headers||{},t.data=r(t.data,t.headers,t.transformRequest),t.headers=n.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||a.adapter)(t).then((function(e){return u(t),e.data=r(e.data,e.headers,t.transformResponse),e}),(function(e){return o(e)||(u(t),e&&e.response&&(e.response.data=r(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))}},function(t,e,i){"use strict";var n=i(3);t.exports=function(t,e,i){return n.forEach(i,(function(i){t=i(t,e)})),t}},function(t,e,i){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e,i){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,i){"use strict";var n=i(25);function r(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");this.promise=new Promise((function(t){e=t}));var e,i=this;t((function(t){i.reason||(i.reason=new n(t),e(i.reason))}))}r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var t;return{token:new r((function(e){t=e})),cancel:t}},t.exports=r},function(t,e,i){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,i){t.exports=function(){"use strict";var t,e,i;function n(n,r){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a),i=r(a),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=r;else t=r}return n(0,(function(t){var e=i;function i(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}function n(t,i,n,r){const o=new e(t,i,n,r);return function(t){return o.solve(t)}}i.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=r/o}var a=0,s=1;for(i=t,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-t)<e));n++)t>r?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};const r=n(.25,.1,.25,1);function o(t,e,i){return Math.min(i,Math.max(e,t))}function a(t,e,i){const n=i-e,r=((t-e)%n+n)%n+e;return r===e?i:r}function s(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let l=1;function u(t,e){t.forEach(t=>{e[t]&&(e[t]=e[t].bind(e))})}function c(t,e,i){const n={};for(const r in t)n[r]=e.call(i||this,t[r],r,t);return n}function h(t,e,i){const n={};for(const r in t)e.call(i||this,t[r],r,t)&&(n[r]=t[r]);return n}function p(t){return Array.isArray(t)?t.map(p):"object"==typeof t&&t?c(t,p):t}const d={};function f(t){d[t]||("undefined"!=typeof console&&console.warn(t),d[t]=!0)}function m(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function g(t){let e=0;for(let i,n,r=0,o=t.length,a=o-1;r<o;a=r++)i=t[r],n=t[a],e+=(n.x-i.x)*(i.y+n.y);return e}function _(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function y(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,i,n,r)=>{const o=n||r;return e[i]=!o||o.toLowerCase(),""}),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}let x,v,b=null;function w(t){if(null==b){const e=t.navigator?t.navigator.userAgent:null;b=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return b}function S(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const T={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const i=window.document.createElement("canvas"),n=i.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return i.width=t.width,i.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:t=>(x||(x=document.createElement("a")),x.href=t,x.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==v&&(v=matchMedia("(prefers-reduced-motion: reduce)")),v.matches)}};var E=A;function A(t,e){this.x=t,this.y=e}A.prototype={clone:function(){return new A(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),r=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},A.convert=function(t){return t instanceof A?t:Array.isArray(t)?new A(t[0],t[1]):t};const I={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},C="mapbox-tiles";let P,M=500,k=50;function z(){"undefined"==typeof caches||P||(P=caches.open(C))}let L=1/0;const B={supported:!1,testSupport:function(t){!O&&R&&(F?U(t):D=t)}};let D,R,O=!1,F=!1;function U(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,R),t.isContextLost())return;B.supported=!0}catch(t){}t.deleteTexture(e),O=!0}"undefined"!=typeof document&&(R=document.createElement("img"),R.onload=function(){D&&U(D),D=null,F=!0},R.onerror=function(){O=!0,D=null},R.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const j={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(j);class N extends Error{constructor(t,e,i,n){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=n}}const V=_()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function G(t,e){const i=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:V(),signal:i.signal});let r=!1,o=!1;return"json"===t.type&&n.headers.set("Accept","application/json"),((i,a,s)=>{if(o)return;Date.now();fetch(n).then(i=>i.ok?((i,n,a)=>{("arrayBuffer"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then(t=>{o||(r=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))}).catch(t=>{o||e(new Error(t.message))})})(i):i.blob().then(n=>e(new N(i.status,i.statusText,t.url,n)))).catch(t=>{20!==t.code&&e(new Error(t.message))})})(),{cancel:()=>{o=!0,r||i.abort()}}}const q=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(_()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!_()){const i=t.url.substring(0,t.url.indexOf("://"));return(I.REGISTERED_PROTOCOLS[i]||G)(t,e)}}if(!(/^file:/.test(i=t.url)||/^file:/.test(V())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return G(t,e);if(_()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(t,e){const i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(i.responseType="arraybuffer");for(const e in t.headers)i.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===t.credentials,i.onerror=()=>{e(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let n=i.response;if("json"===t.type)try{n=JSON.parse(i.response)}catch(t){return e(t)}e(null,n,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else{const n=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});e(new N(i.status,i.statusText,t.url,n))}},i.send(t.body),{cancel:()=>i.abort()}}(t,e)},W=function(t,e){return q(s(t,{type:"arrayBuffer"}),e)};function Z(t){const e=window.document.createElement("a");return e.href=t,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const H="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let $,X;$=[],X=0;const K=function(t,e){if(B.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),X>=I.MAX_PARALLEL_IMAGE_REQUESTS){const i={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return $.push(i),i}X++;let i=!1;const n=()=>{if(!i)for(i=!0,X--;$.length&&X<I.MAX_PARALLEL_IMAGE_REQUESTS;){const t=$.shift(),{requestParameters:e,callback:i,cancelled:n}=t;n||(t.cancel=K(e,i).cancel)}},r=W(t,(t,i,r,o)=>{n(),t?e(t):i&&function(t,e){"function"==typeof createImageBitmap?function(t,e){const i=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(i).then(t=>{e(null,t)}).catch(t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(t,e):function(t,e){const i=new Image;i.onload=()=>{e(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>{i.src=H})},i.onerror=()=>e(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(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(n):H}(t,e)}(i,(t,i)=>{null!=t?e(t):null!=i&&e(null,i,{cacheControl:r,expires:o})})});return{cancel:()=>{r.cancel(),n()}}};function J(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function Y(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);-1!==n&&i[t].splice(n,1)}}class Q{constructor(t,e={}){s(this,e),this.type=t}}class tt extends Q{constructor(t,e={}){super("error",s({error:t},e))}}class et{on(t,e){return this._listeners=this._listeners||{},J(t,e,this._listeners),this}off(t,e){return Y(t,e,this._listeners),Y(t,e,this._oneTimeListeners),this}once(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},J(t,e,this._oneTimeListeners),this}fire(t,e){"string"==typeof t&&(t=new Q(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of n)Y(i,e,this._oneTimeListeners),e.call(this,t);const r=this._eventedParent;r&&(s(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(t))}else t instanceof tt&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var it={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},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},"*":{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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},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:{},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"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","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},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:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"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-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},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:"*",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}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","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"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},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"},"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:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},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"}}};class nt{constructor(t,e,i,n){this.message=(t?t+": ":"")+i,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function rt(t){const e=t.value;return e?[new nt(t.key,e,"constants have been deprecated as of v8")]:[]}function ot(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}function at(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function st(t){if(Array.isArray(t))return t.map(st);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=st(t[i]);return e}return at(t)}class lt extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class ut{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new ut(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const ct={kind:"null"},ht={kind:"number"},pt={kind:"string"},dt={kind:"boolean"},ft={kind:"color"},mt={kind:"object"},gt={kind:"value"},_t={kind:"collator"},yt={kind:"formatted"},xt={kind:"resolvedImage"};function vt(t,e){return{kind:"array",itemType:t,N:e}}function bt(t){if("array"===t.kind){const e=bt(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const wt=[ct,ht,pt,dt,ft,yt,mt,vt(gt),xt];function St(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!St(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of wt)if(!St(t,e))return null}return`Expected ${bt(t)} but found ${bt(e)} instead.`}function Tt(t,e){return e.some(e=>e.kind===t.kind)}function Et(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}var At,It={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Ct(t){return(t=Math.round(t))<0?0:t>255?255:t}function Pt(t){return Ct("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function Mt(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function kt(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{At={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in It)return It[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),r=i.indexOf(")");if(-1!==n&&r+1===i.length){var o=i.substr(0,n),a=i.substr(n+1,r-(n+1)).split(","),s=1;switch(o){case"rgba":if(4!==a.length)return null;s=Mt(a.pop());case"rgb":return 3!==a.length?null:[Pt(a[0]),Pt(a[1]),Pt(a[2]),s];case"hsla":if(4!==a.length)return null;s=Mt(a.pop());case"hsl":if(3!==a.length)return null;var l=(parseFloat(a[0])%360+360)%360/360,u=Mt(a[1]),c=Mt(a[2]),h=c<=.5?c*(u+1):c+u-c*u,p=2*c-h;return[Ct(255*kt(p,h,l+1/3)),Ct(255*kt(p,h,l)),Ct(255*kt(p,h,l-1/3)),s];default:return null}}return null}}catch(t){}class zt{constructor(t,e,i,n=1){this.r=t,this.g=e,this.b=i,this.a=n}static parse(t){if(!t)return;if(t instanceof zt)return t;if("string"!=typeof t)return;const e=At(t);return e?new zt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,i,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(i)},${n})`}toArray(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*i/n,n]}}zt.black=new zt(0,0,0,1),zt.white=new zt(1,1,1,1),zt.transparent=new zt(0,0,0,0),zt.red=new zt(1,0,0,1);class Lt{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Bt{constructor(t,e,i,n,r){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r}}class Dt{constructor(t){this.sections=t}static fromString(t){return new Dt([new Bt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof Dt?t:Dt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const i={};e.fontStack&&(i["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(i["font-scale"]=e.scale),e.textColor&&(i["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(i)}return t}}class Rt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Rt({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Ot(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ft(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof zt)return!0;if(t instanceof Lt)return!0;if(t instanceof Dt)return!0;if(t instanceof Rt)return!0;if(Array.isArray(t)){for(const e of t)if(!Ft(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Ft(t[e]))return!1;return!0}return!1}function Ut(t){if(null===t)return ct;if("string"==typeof t)return pt;if("boolean"==typeof t)return dt;if("number"==typeof t)return ht;if(t instanceof zt)return ft;if(t instanceof Lt)return _t;if(t instanceof Dt)return yt;if(t instanceof Rt)return xt;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Ut(e);if(i){if(i===t)continue;i=gt;break}i=t}return vt(i||gt,e)}return mt}function jt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof zt||t instanceof Dt||t instanceof Rt?t.toString():JSON.stringify(t)}class Nt{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ft(t[1]))return e.error("invalid value");const i=t[1];let n=Ut(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new Nt(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof zt?["rgba"].concat(this.value.toArray()):this.value instanceof Dt?this.value.serialize():this.value}}class Vt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Gt={string:pt,number:ht,boolean:dt,object:mt};class qt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,o;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in Gt)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=Gt[i],n++}else r=gt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);o=t[2],n++}i=vt(r,o)}else i=Gt[r];const o=[];for(;n<t.length;n++){const i=e.parse(t[n],n,gt);if(!i)return null;o.push(i)}return new qt(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!St(this.type,Ut(i)))return i;if(e===this.args.length-1)throw new Vt(`Expected value to be of type ${bt(this.type)}, but found ${bt(Ut(i))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const i=t.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){e.push(i.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map(t=>t.serialize()))}}class Wt{constructor(t){this.type=yt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const o=t[i];if(r&&"object"==typeof o&&!Array.isArray(o)){r=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,ht),!t))return null;let i=null;if(o["text-font"]&&(i=e.parse(o["text-font"],1,vt(pt)),!i))return null;let a=null;if(o["text-color"]&&(a=e.parse(o["text-color"],1,ft),!a))return null;const s=n[n.length-1];s.scale=t,s.font=i,s.textColor=a}else{const o=e.parse(t[i],1,gt);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:o,scale:null,font:null,textColor:null})}}return new Wt(n)}evaluate(t){return new Dt(this.sections.map(e=>{const i=e.content.evaluate(t);return Ut(i)===xt?new Bt("",i,null,null,null):new Bt(jt(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const i={};e.scale&&(i["font-scale"]=e.scale.serialize()),e.font&&(i["text-font"]=e.font.serialize()),e.textColor&&(i["text-color"]=e.textColor.serialize()),t.push(i)}return t}}class Zt{constructor(t){this.type=xt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,pt);return i?new Zt(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Rt.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Ht={"to-boolean":dt,"to-color":ft,"to-number":ht,"to-string":pt};class $t{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=Ht[i],r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,gt);if(!n)return null;r.push(n)}return new $t(n,r)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof zt)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Ot(e[0],e[1],e[2],e[3]),!i))return new zt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Vt(i||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new Vt(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Dt.fromString(jt(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?Rt.fromString(jt(this.args[0].evaluate(t))):jt(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){if("formatted"===this.type.kind)return new Wt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Zt(this.args[0]).serialize();const t=["to-"+this.type.kind];return this.eachChild(e=>{t.push(e.serialize())}),t}}const Xt=["Unknown","Point","LineString","Polygon"];class Kt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Xt[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(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=zt.parse(t)),e}}class Jt{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(t=>t.serialize()))}static parse(t,e){const i=t[0],n=Jt.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=o.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let s=null;for(const[n,o]of a){s=new ve(e.registry,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],r=Array.isArray(n)?n[e-1]:n.type,o=s.parse(i,1+a.length,r);if(!o){l=!0;break}a.push(o)}if(!l)if(Array.isArray(n)&&n.length!==a.length)s.error(`Expected ${n.length} arguments, but found ${a.length} instead.`);else{for(let t=0;t<a.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=a[t];s.concat(t+1).checkSubtype(e,i.type)}if(0===s.errors.length)return new Jt(i,r,o,a)}}if(1===a.length)e.errors.push(...s.errors);else{const i=(a.length?a:o).map(([t])=>{return e=t,Array.isArray(e)?`(${e.map(bt).join(", ")})`:`(${bt(e.type)}...)`;var e}).join(" | "),n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],1+n.length);if(!r)return null;n.push(bt(r.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){Jt.definitions=e;for(const i in e)t[i]=Jt}}class Yt{constructor(t,e,i){this.type=_t,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,dt);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,dt);if(!r)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,pt),!o)?null:new Yt(n,r,o)}evaluate(t){return new Lt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const Qt=8192;function te(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function ee(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ie(t,e){const i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,r=Math.pow(2,e.z);return[Math.round(i*r*Qt),Math.round(n*r*Qt)]}function ne(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],o=t[0]-i[0],a=t[1]-i[1];return n*a-o*r==0&&n*o<=0&&r*a<=0}function re(t,e){let i=!1;for(let a=0,s=e.length;a<s;a++){const s=e[a];for(let e=0,a=s.length;e<a-1;e++){if(ne(t,s[e],s[e+1]))return!1;(r=s[e])[1]>(n=t)[1]!=(o=s[e+1])[1]>n[1]&&n[0]<(o[0]-r[0])*(n[1]-r[1])/(o[1]-r[1])+r[0]&&(i=!i)}}var n,r,o;return i}function oe(t,e){for(let i=0;i<e.length;i++)if(re(t,e[i]))return!0;return!1}function ae(t,e,i,n){const r=n[0]-i[0],o=n[1]-i[1],a=(t[0]-i[0])*o-r*(t[1]-i[1]),s=(e[0]-i[0])*o-r*(e[1]-i[1]);return a>0&&s<0||a<0&&s>0}function se(t,e,i){for(const u of i)for(let i=0;i<u.length-1;++i)if(0!=(s=[(a=u[i+1])[0]-(o=u[i])[0],a[1]-o[1]])[0]*(l=[(r=e)[0]-(n=t)[0],r[1]-n[1]])[1]-s[1]*l[0]&&ae(n,r,o,a)&&ae(o,a,n,r))return!0;var n,r,o,a,s,l;return!1}function le(t,e){for(let i=0;i<t.length;++i)if(!re(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(se(t[i],t[i+1],e))return!1;return!0}function ue(t,e){for(let i=0;i<e.length;i++)if(le(t,e[i]))return!0;return!1}function ce(t,e,i){const n=[];for(let r=0;r<t.length;r++){const o=[];for(let n=0;n<t[r].length;n++){const a=ie(t[r][n],i);te(e,a),o.push(a)}n.push(o)}return n}function he(t,e,i){const n=[];for(let r=0;r<t.length;r++){const o=ce(t[r],e,i);n.push(o)}return n}function pe(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}te(e,t)}function de(t,e,i,n){const r=Math.pow(2,n.z)*Qt,o=[n.x*Qt,n.y*Qt],a=[];for(const n of t)for(const t of n){const n=[t.x+o[0],t.y+o[1]];pe(n,e,i,r),a.push(n)}return a}function fe(t,e,i,n){const r=Math.pow(2,n.z)*Qt,o=[n.x*Qt,n.y*Qt],a=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+o[0],n.y+o[1]];te(e,i),t.push(i)}a.push(t)}if(e[2]-e[0]<=r/2){(s=e)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const t of a)for(const n of t)pe(n,e,i,r)}var s;return a}class me{constructor(t,e){this.type=dt,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ft(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const i=e.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new me(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new me(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new me(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const o=ce(e.coordinates,n,r),a=de(t.geometry(),i,n,r);if(!ee(i,n))return!1;for(const t of a)if(!re(t,o))return!1}if("MultiPolygon"===e.type){const o=he(e.coordinates,n,r),a=de(t.geometry(),i,n,r);if(!ee(i,n))return!1;for(const t of a)if(!oe(t,o))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const o=ce(e.coordinates,n,r),a=fe(t.geometry(),i,n,r);if(!ee(i,n))return!1;for(const t of a)if(!le(t,o))return!1}if("MultiPolygon"===e.type){const o=he(e.coordinates,n,r),a=fe(t.geometry(),i,n,r);if(!ee(i,n))return!1;for(const t of a)if(!ue(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function ge(t){if(t instanceof Jt){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof me)return!1;let e=!0;return t.eachChild(t=>{e&&!ge(t)&&(e=!1)}),e}function _e(t){if(t instanceof Jt&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!_e(t)&&(e=!1)}),e}function ye(t,e){if(t instanceof Jt&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(t=>{i&&!ye(t,e)&&(i=!1)}),i}class xe{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new xe(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class ve{constructor(t,e=[],i,n=new ut,r=[]){this.registry=t,this.path=e,this.key=e.map(t=>`[${t}]`).join(""),this.scope=n,this.errors=r,this.expectedType=i}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new qt(e,[t]):"coerce"===i?new $t(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof Nt)&&"resolvedImage"!==n.type.kind&&function t(e){if(e instanceof xe)return t(e.boundExpression);if(e instanceof Jt&&"error"===e.name)return!1;if(e instanceof Yt)return!1;if(e instanceof me)return!1;const i=e instanceof $t||e instanceof qt;let n=!0;return e.eachChild(e=>{n=i?n&&t(e):n&&e instanceof Nt}),!!n&&ge(e)&&ye(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(n)){const e=new Kt;try{n=new Nt(n.type,n.evaluate(e))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new ve(this.registry,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new lt(i,t))}checkSubtype(t,e){const i=St(t,e);return i&&this.error(i),i}}function be(t,e){const i=t.length-1;let n,r,o=0,a=i,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),n=t[s],r=t[s+1],n<=e){if(s===i||e<r)return s;o=s+1}else{if(!(n>e))throw new Vt("Input is not a number.");a=s-1}return 0}class we{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,ht);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i<t.length;i+=2){const o=1===i?-1/0:t[i],a=t[i+1],s=i,l=i+1;if("number"!=typeof o)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(n.length&&n[n.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const u=e.parse(a,l,r);if(!u)return null;r=r||u.type,n.push([o,u])}return new we(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;return n>=e[r-1]?i[r-1].evaluate(t):i[be(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){const t=["step",this.input.serialize()];for(let e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}function Se(t,e,i){return t*(1-i)+e*i}var Te=Object.freeze({__proto__:null,number:Se,color:function(t,e,i){return new zt(Se(t.r,e.r,i),Se(t.g,e.g,i),Se(t.b,e.b,i),Se(t.a,e.a,i))},array:function(t,e,i){return t.map((t,n)=>Se(t,e[n],i))}});const Ee=6/29*3*(6/29),Ae=Math.PI/180,Ie=180/Math.PI;function Ce(t){return t>.008856451679035631?Math.pow(t,1/3):t/Ee+4/29}function Pe(t){return t>6/29?t*t*t:Ee*(t-4/29)}function Me(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ke(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ze(t){const e=ke(t.r),i=ke(t.g),n=ke(t.b),r=Ce((.4124564*e+.3575761*i+.1804375*n)/.95047),o=Ce((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*o-16,a:500*(r-o),b:200*(o-Ce((.0193339*e+.119192*i+.9503041*n)/1.08883)),alpha:t.a}}function Le(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Pe(e),i=.95047*Pe(i),n=1.08883*Pe(n),new zt(Me(3.2404542*i-1.5371385*e-.4985314*n),Me(-.969266*i+1.8760108*e+.041556*n),Me(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function Be(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const De={forward:ze,reverse:Le,interpolate:function(t,e,i){return{l:Se(t.l,e.l,i),a:Se(t.a,e.a,i),b:Se(t.b,e.b,i),alpha:Se(t.alpha,e.alpha,i)}}},Re={forward:function(t){const{l:e,a:i,b:n}=ze(t),r=Math.atan2(n,i)*Ie;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Ae,i=t.c;return Le({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:Be(t.h,e.h,i),c:Se(t.c,e.c,i),l:Se(t.l,e.l,i),alpha:Se(t.alpha,e.alpha,i)}}};var Oe=Object.freeze({__proto__:null,lab:De,hcl:Re});class Fe{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,i,n,r){let o=0;if("exponential"===t.name)o=Ue(i,t.base,n,r);else if("linear"===t.name)o=Ue(i,1,n,r);else if("cubic-bezier"===t.name){const a=t.controlPoints;o=new e(a[0],a[1],a[2],a[3]).solve(Ue(i,1,n,r))}return o}static parse(t,e){let[i,n,r,...o]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error("Unknown interpolation type "+String(n[0]),1,0);{const t=n.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(r=e.parse(r,2,ht),!r)return null;const a=[];let s=null;"interpolate-hcl"===i||"interpolate-lab"===i?s=ft:e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);for(let t=0;t<o.length;t+=2){const i=o[t],n=o[t+1],r=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',r);if(a.length&&a[a.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const u=e.parse(n,l,s);if(!u)return null;s=s||u.type,a.push([i,u])}return"number"===s.kind||"color"===s.kind||"array"===s.kind&&"number"===s.itemType.kind&&"number"==typeof s.N?new Fe(s,i,n,r,a):e.error(`Type ${bt(s)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const o=be(e,n),a=Fe.interpolationFactor(this.interpolation,n,e[o],e[o+1]),s=i[o].evaluate(t),l=i[o+1].evaluate(t);return"interpolate"===this.operator?Te[this.type.kind.toLowerCase()](s,l,a):"interpolate-hcl"===this.operator?Re.reverse(Re.interpolate(Re.forward(s),Re.forward(l),a)):De.reverse(De.interpolate(De.forward(s),De.forward(l),a))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)e.push(this.labels[t],this.outputs[t].serialize());return e}}function Ue(t,e,i,n){const r=n-i,o=t-i;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}class je{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const n=e.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}const o=n&&r.some(t=>St(n,t.type));return new je(o?gt:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(t),i&&i instanceof Rt&&!i.available&&(e||(e=i.name),i=null,n===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){const t=["coalesce"];return this.eachChild(e=>{t.push(e.serialize())}),t}}class Ne{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=e.parse(t[n+1],n+1);if(!o)return null;i.push([r,o])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new Ne(i,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[e,i]of this.bindings)t.push(e,i.serialize());return t.push(this.result.serialize()),t}}class Ve{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ht),n=e.parse(t[2],2,vt(e.expectedType||gt));return i&&n?new Ve(n.type.itemType,i,n):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Vt(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new Vt(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Vt(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Ge{constructor(t,e){this.type=dt,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,gt),n=e.parse(t[2],2,gt);return i&&n?Tt(i.type,[dt,pt,ht,ct,gt])?new Ge(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Et(e,["boolean","string","number","null"]))throw new Vt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Ut(e))} instead.`);if(!Et(i,["string","array"]))throw new Vt(`Expected second argument to be of type array or string, but found ${bt(Ut(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class qe{constructor(t,e,i){this.type=ht,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,gt),n=e.parse(t[2],2,gt);if(!i||!n)return null;if(!Tt(i.type,[dt,pt,ht,ct,gt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,ht);return r?new qe(i,n,r):null}return new qe(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Et(e,["boolean","string","number","null"]))throw new Vt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Ut(e))} instead.`);if(!Et(i,["string","array"]))throw new Vt(`Expected second argument to be of type array or string, but found ${bt(Ut(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class We{constructor(t,e,i,n,r,o){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},o=[];for(let a=2;a<t.length-1;a+=2){let s=t[a];const l=t[a+1];Array.isArray(s)||(s=[s]);const u=e.concat(a);if(0===s.length)return u.error("Expected at least one branch label.");for(const t of s){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(i){if(u.checkSubtype(i,Ut(t)))return null}else i=Ut(t);if(void 0!==r[String(t)])return u.error("Branch labels must be unique.");r[String(t)]=o.length}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,o.push(c)}const a=e.parse(t[1],1,gt);if(!a)return null;const s=e.parse(t[t.length-1],t.length-1,n);return s?"value"!==a.type.kind&&e.concat(1).checkSubtype(i,a.type)?null:new We(i,n,a,r,o,s):null}evaluate(t){const e=this.input.evaluate(t);return(Ut(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),i=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=i.length,i.push([this.cases[t],[t]])):i[e][1].push(t)}const r=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of i)t.push(1===n.length?r(n[0]):n.map(r)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class Ze{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;r<t.length-1;r+=2){const o=e.parse(t[r],r,dt);if(!o)return null;const a=e.parse(t[r+1],r+1,i);if(!a)return null;n.push([o,a]),i=i||a.type}const r=e.parse(t[t.length-1],t.length-1,i);return r?new Ze(i,n,r):null}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild(e=>{t.push(e.serialize())}),t}}class He{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,gt),n=e.parse(t[2],2,ht);if(!i||!n)return null;if(!Tt(i.type,[vt(gt),pt,gt]))return e.error(`Expected first argument to be of type array or string, but found ${bt(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,ht);return r?new He(i.type,i,n,r):null}return new He(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!Et(e,["string","array"]))throw new Vt(`Expected first argument to be of type array or string, but found ${bt(Ut(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function $e(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Xe(t,e,i,n){return 0===n.compare(e,i)}function Ke(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=dt,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let o=e.parse(t[1],1,gt);if(!o)return null;if(!$e(i,o.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${bt(o.type)}'.`);let a=e.parse(t[2],2,gt);if(!a)return null;if(!$e(i,a.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${bt(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${bt(o.type)}' and '${bt(a.type)}'.`);n&&("value"===o.type.kind&&"value"!==a.type.kind?o=new qt(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new qt(o.type,[a])));let s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(s=e.parse(t[3],3,_t),!s)return null}return new r(o,a,s)}evaluate(r){const o=this.lhs.evaluate(r),a=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=Ut(o),i=Ut(a);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Vt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=Ut(o),i=Ut(a);if("string"!==t.kind||"string"!==i.kind)return e(r,o,a)}return this.collator?i(r,o,a,this.collator.evaluate(r)):e(r,o,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild(t=>{e.push(t.serialize())}),e}}}const Je=Ke("==",(function(t,e,i){return e===i}),Xe),Ye=Ke("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!Xe(0,e,i,n)})),Qe=Ke("<",(function(t,e,i){return e<i}),(function(t,e,i,n){return n.compare(e,i)<0})),ti=Ke(">",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),ei=Ke("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),ii=Ke(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class ni{constructor(t,e,i,n,r){this.type=pt,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=r}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,ht);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,pt),!r))return null;let o=null;if(n.currency&&(o=e.parse(n.currency,1,pt),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,ht),!a))return null;let s=null;return n["max-fraction-digits"]&&(s=e.parse(n["max-fraction-digits"],1,ht),!s)?null:new ni(i,r,o,a,s)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class ri{constructor(t){this.type=ht,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${bt(i.type)} instead.`):new ri(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Vt(`Expected value to be of type string or array, but found ${bt(Ut(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild(e=>{t.push(e.serialize())}),t}}const oi={"==":Je,"!=":Ye,">":ti,"<":Qe,">=":ii,"<=":ei,array:qt,at:Ve,boolean:qt,case:Ze,coalesce:je,collator:Yt,format:Wt,image:Zt,in:Ge,"index-of":qe,interpolate:Fe,"interpolate-hcl":Fe,"interpolate-lab":Fe,length:ri,let:Ne,literal:Nt,match:We,number:qt,"number-format":ni,object:qt,slice:He,step:we,string:qt,"to-boolean":$t,"to-color":$t,"to-number":$t,"to-string":$t,var:xe,within:me};function ai(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const o=r?r.evaluate(t):1,a=Ot(e,i,n,o);if(a)throw new Vt(a);return new zt(e/255*o,i/255*o,n/255*o,o)}function si(t,e){return t in e}function li(t,e){const i=e[t];return void 0===i?null:i}function ui(t){return{type:t}}function ci(t){return{result:"success",value:t}}function hi(t){return{result:"error",value:t}}function pi(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function di(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function fi(t){return!!t.expression&&t.expression.interpolated}function mi(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function gi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function _i(t){return t}function yi(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function xi(t,e,i,n,r){return yi(typeof i===r?n[i]:void 0,t.default,e.default)}function vi(t,e,i){if("number"!==mi(i))return yi(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const r=be(t.stops.map(t=>t[0]),i);return t.stops[r][1]}function bi(t,e,i){const n=void 0!==t.base?t.base:1;if("number"!==mi(i))return yi(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];const o=be(t.stops.map(t=>t[0]),i),a=function(t,e,i,n){const r=n-i,o=t-i;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}(i,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1];let u=Te[e.type]||_i;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=Oe[t.colorSpace];u=(t,i)=>e.reverse(e.interpolate(e.forward(t),e.forward(i),a))}return"function"==typeof s.evaluate?{evaluate(...t){const e=s.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==i)return u(e,i,a)}}:u(s,l,a)}function wi(t,e,i){return"color"===e.type?i=zt.parse(i):"formatted"===e.type?i=Dt.fromString(i.toString()):"resolvedImage"===e.type?i=Rt.fromString(i.toString()):mi(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0),yi(i,t.default,e.default)}Jt.register(oi,{error:[{kind:"error"},[pt],(t,[e])=>{throw new Vt(e.evaluate(t))}],typeof:[pt,[gt],(t,[e])=>bt(Ut(e.evaluate(t)))],"to-rgba":[vt(ht,4),[ft],(t,[e])=>e.evaluate(t).toArray()],rgb:[ft,[ht,ht,ht],ai],rgba:[ft,[ht,ht,ht,ht],ai],has:{type:dt,overloads:[[[pt],(t,[e])=>si(e.evaluate(t),t.properties())],[[pt,mt],(t,[e,i])=>si(e.evaluate(t),i.evaluate(t))]]},get:{type:gt,overloads:[[[pt],(t,[e])=>li(e.evaluate(t),t.properties())],[[pt,mt],(t,[e,i])=>li(e.evaluate(t),i.evaluate(t))]]},"feature-state":[gt,[pt],(t,[e])=>li(e.evaluate(t),t.featureState||{})],properties:[mt,[],t=>t.properties()],"geometry-type":[pt,[],t=>t.geometryType()],id:[gt,[],t=>t.id()],zoom:[ht,[],t=>t.globals.zoom],"heatmap-density":[ht,[],t=>t.globals.heatmapDensity||0],"line-progress":[ht,[],t=>t.globals.lineProgress||0],accumulated:[gt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[ht,ui(ht),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[ht,ui(ht),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:ht,overloads:[[[ht,ht],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[ht],(t,[e])=>-e.evaluate(t)]]},"/":[ht,[ht,ht],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[ht,[ht,ht],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[ht,[],()=>Math.LN2],pi:[ht,[],()=>Math.PI],e:[ht,[],()=>Math.E],"^":[ht,[ht,ht],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[ht,[ht],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[ht,[ht],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[ht,[ht],(t,[e])=>Math.log(e.evaluate(t))],log2:[ht,[ht],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[ht,[ht],(t,[e])=>Math.sin(e.evaluate(t))],cos:[ht,[ht],(t,[e])=>Math.cos(e.evaluate(t))],tan:[ht,[ht],(t,[e])=>Math.tan(e.evaluate(t))],asin:[ht,[ht],(t,[e])=>Math.asin(e.evaluate(t))],acos:[ht,[ht],(t,[e])=>Math.acos(e.evaluate(t))],atan:[ht,[ht],(t,[e])=>Math.atan(e.evaluate(t))],min:[ht,ui(ht),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[ht,ui(ht),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[ht,[ht],(t,[e])=>Math.abs(e.evaluate(t))],round:[ht,[ht],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[ht,[ht],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[ht,[ht],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[dt,[pt,gt],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[dt,[gt],(t,[e])=>t.id()===e.value],"filter-type-==":[dt,[pt],(t,[e])=>t.geometryType()===e.value],"filter-<":[dt,[pt,gt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[dt,[gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[dt,[pt,gt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[dt,[gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[dt,[pt,gt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[dt,[gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[dt,[pt,gt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[dt,[gt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[dt,[gt],(t,[e])=>e.value in t.properties()],"filter-has-id":[dt,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[dt,[vt(pt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[dt,[vt(gt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[dt,[pt,vt(gt)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[dt,[pt,vt(gt)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:dt,overloads:[[[dt,dt],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[ui(dt),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:dt,overloads:[[[dt,dt],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[ui(dt),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[dt,[dt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[dt,[pt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[pt,[pt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[pt,[pt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[pt,ui(gt),(t,e)=>e.map(e=>jt(e.evaluate(t))).join("")],"resolved-locale":[pt,[_t],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Si{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Kt,this._defaultValue=e?function(t){return"color"===t.type&&gi(t.default)?new zt(0,0,0,0):"color"===t.type?zt.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Vt(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Ti(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in oi}function Ei(t,e){const i=new ve(oi,[],e?function(t){const e={color:ft,string:pt,number:ht,enum:pt,boolean:dt,formatted:yt,resolvedImage:xt};return"array"===t.type?vt(e[t.value]||gt,t.length):e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?ci(new Si(n,e)):hi(i.errors)}class Ai{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!_e(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,o)}evaluate(t,e,i,n,r,o){return this._styleExpression.evaluate(t,e,i,n,r,o)}}class Ii{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!_e(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,o)}evaluate(t,e,i,n,r,o){return this._styleExpression.evaluate(t,e,i,n,r,o)}interpolationFactor(t,e,i){return this.interpolationType?Fe.interpolationFactor(this.interpolationType,t,e,i):0}}function Ci(t,e){const i=Ei(t,e);if("error"===i.result)return i;const n=i.value.expression,r=ge(n);if(!r&&!pi(e))return hi([new lt("","data expressions not supported")]);const o=ye(n,["zoom"]);if(!o&&!di(e))return hi([new lt("","zoom expressions not supported")]);const a=function t(e){let i=null;if(e instanceof Ne)i=t(e.result);else if(e instanceof je){for(const n of e.args)if(i=t(n),i)break}else(e instanceof we||e instanceof Fe)&&e.input instanceof Jt&&"zoom"===e.input.name&&(i=e);return i instanceof lt||e.eachChild(e=>{const n=t(e);n instanceof lt?i=n:!i&&n?i=new lt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&n&&i!==n&&(i=new lt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),i}(n);return a||o?a instanceof lt?hi([a]):a instanceof Fe&&!fi(e)?hi([new lt("",'"interpolate" expressions cannot be used with this property')]):ci(a?new Ii(r?"camera":"composite",i.value,a.labels,a instanceof Fe?a.interpolation:void 0):new Ai(r?"constant":"source",i.value)):hi([new lt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Pi{constructor(t,e){this._parameters=t,this._specification=e,ot(this,function t(e,i){const n="color"===i.type,r=e.stops&&"object"==typeof e.stops[0][0],o=r||!(r||void 0!==e.property),a=e.type||(fi(i)?"exponential":"interval");if(n&&((e=ot({},e)).stops&&(e.stops=e.stops.map(t=>[t[0],zt.parse(t[1])])),e.default=zt.parse(e.default?e.default:i.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Oe[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);let s,l,u;if("exponential"===a)s=bi;else if("interval"===a)s=vi;else if("categorical"===a){s=xi,l=Object.create(null);for(const t of e.stops)l[t[0]]=t[1];u=typeof e.stops[0][0]}else{if("identity"!==a)throw new Error(`Unknown function type "${a}"`);s=wi}if(r){const n={},r=[];for(let t=0;t<e.stops.length;t++){const i=e.stops[t],o=i[0].zoom;void 0===n[o]&&(n[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},r.push(o)),n[o].stops.push([i[0].value,i[1]])}const o=[];for(const e of r)o.push([n[e].zoom,t(n[e],i)]);const a={name:"linear"};return{kind:"composite",interpolationType:a,interpolationFactor:Fe.interpolationFactor.bind(void 0,a),zoomStops:o.map(t=>t[0]),evaluate:({zoom:t},n)=>bi({stops:o,base:e.base},i,t).evaluate(t,n)}}if(o){const t="exponential"===a?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:t,interpolationFactor:Fe.interpolationFactor.bind(void 0,t),zoomStops:e.stops.map(t=>t[0]),evaluate:({zoom:t})=>s(e,i,t,l,u)}}return{kind:"source",evaluate(t,n){const r=n&&n.properties?n.properties[e.property]:void 0;return void 0===r?yi(e.default,i.default):s(e,i,r,l,u)}}}(this._parameters,this._specification))}static deserialize(t){return new Pi(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Mi(t){const e=t.key,i=t.value,n=t.valueSpec||{},r=t.objectElementValidators||{},o=t.style,a=t.styleSpec;let s=[];const l=mi(i);if("object"!==l)return[new nt(e,i,`object expected, ${l} found`)];for(const t in i){const l=t.split(".")[0],u=n[l]||n["*"];let c;if(r[l])c=r[l];else if(n[l])c=nn;else if(r["*"])c=r["*"];else{if(!n["*"]){s.push(new nt(e,i[t],`unknown property "${t}"`));continue}c=nn}s=s.concat(c({key:(e?e+".":e)+t,value:i[t],valueSpec:u,style:o,styleSpec:a,object:i,objectKey:t},i))}for(const t in n)r[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&s.push(new nt(e,i,`missing required property "${t}"`));return s}function ki(t){const e=t.value,i=t.valueSpec,n=t.style,r=t.styleSpec,o=t.key,a=t.arrayElementValidator||nn;if("array"!==mi(e))return[new nt(o,e,`array expected, ${mi(e)} found`)];if(i.length&&e.length!==i.length)return[new nt(o,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new nt(o,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let s={type:i.value,values:i.values};r.$version<7&&(s.function=i.function),"object"===mi(i.value)&&(s=i.value);let l=[];for(let t=0;t<e.length;t++)l=l.concat(a({array:e,arrayIndex:t,value:e[t],valueSpec:s,style:n,styleSpec:r,key:`${o}[${t}]`}));return l}function zi(t){const e=t.key,i=t.value,n=t.valueSpec;let r=mi(i);return"number"===r&&i!=i&&(r="NaN"),"number"!==r?[new nt(e,i,`number expected, ${r} found`)]:"minimum"in n&&i<n.minimum?[new nt(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new nt(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Li(t){const e=t.valueSpec,i=at(t.value.type);let n,r,o,a={};const s="categorical"!==i&&void 0===t.value.property,l=!s,u="array"===mi(t.value.stops)&&"array"===mi(t.value.stops[0])&&"object"===mi(t.value.stops[0][0]),c=Mi({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new nt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(ki({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===mi(n)&&0===n.length&&e.push(new nt(t.key,n,"array must have at least one stop")),e},default:function(t){return nn({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&s&&c.push(new nt(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||c.push(new nt(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!fi(t.valueSpec)&&c.push(new nt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!pi(t.valueSpec)?c.push(new nt(t.key,t.value,"property functions not supported")):s&&!di(t.valueSpec)&&c.push(new nt(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!u||void 0!==t.value.property||c.push(new nt(t.key,t.value,'"property" property is required')),c;function h(t){let i=[];const n=t.value,s=t.key;if("array"!==mi(n))return[new nt(s,n,`array expected, ${mi(n)} found`)];if(2!==n.length)return[new nt(s,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==mi(n[0]))return[new nt(s,n,`object expected, ${mi(n[0])} found`)];if(void 0===n[0].zoom)return[new nt(s,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new nt(s,n,"object stop key must have value")];if(o&&o>at(n[0].zoom))return[new nt(s,n[0].zoom,"stop zoom values must appear in ascending order")];at(n[0].zoom)!==o&&(o=at(n[0].zoom),r=void 0,a={}),i=i.concat(Mi({key:s+"[0]",value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:zi,value:p}}))}else i=i.concat(p({key:s+"[0]",value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return Ti(st(n[1]))?i.concat([new nt(s+"[1]",n[1],"expressions are not allowed in function stops.")]):i.concat(nn({key:s+"[1]",value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,o){const s=mi(t.value),l=at(t.value),u=null!==t.value?t.value:o;if(n){if(s!==n)return[new nt(t.key,u,`${s} stop domain type must match previous stop domain type ${n}`)]}else n=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new nt(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){let n=`number expected, ${s} found`;return pi(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new nt(t.key,u,n)]}return"categorical"!==i||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&void 0!==r&&l<r?[new nt(t.key,u,"stop domain values must appear in ascending order")]:(r=l,"categorical"===i&&l in a?[new nt(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new nt(t.key,u,"integer expected, found "+l)]}}function Bi(t){const e=("property"===t.expressionContext?Ci:Ei)(st(t.value),t.valueSpec);if("error"===e.result)return e.value.map(e=>new nt(`${t.key}${e.key}`,t.value,e.message));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new nt(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!_e(i))return[new nt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!_e(i))return[new nt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!ye(i,["zoom","feature-state"]))return[new nt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!ge(i))return[new nt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Di(t){const e=t.key,i=t.value,n=t.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(at(i))&&r.push(new nt(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(at(i))&&r.push(new nt(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function Ri(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Ri(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Oi={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Fi(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Ri(t)||(t=Ni(t));const e=Ei(t,Oi);if("error"===e.result)throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,i,n)=>e.value.evaluate(t,i,{},n),needGeometry:ji(t)}}function Ui(t,e){return t<e?-1:t>e?1:0}function ji(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(ji(t[e]))return!0;return!1}function Ni(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Vi(t[1],t[2],"=="):"!="===e?Wi(Vi(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Vi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Ni))):"all"===e?["all"].concat(t.slice(1).map(Ni)):"none"===e?["all"].concat(t.slice(1).map(Ni).map(Wi)):"in"===e?Gi(t[1],t.slice(2)):"!in"===e?Wi(Gi(t[1],t.slice(2))):"has"===e?qi(t[1]):"!has"===e?Wi(qi(t[1])):"within"!==e||t;var i}function Vi(t,e,i){switch(t){case"$type":return["filter-type-"+i,e];case"$id":return["filter-id-"+i,e];default:return["filter-"+i,t,e]}}function Gi(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Ui)]]:["filter-in-small",t,["literal",e]]}}function qi(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Wi(t){return["!",t]}function Zi(t){return Ri(st(t.value))?Bi(ot({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){const i=e.value,n=e.key;if("array"!==mi(i))return[new nt(n,i,`array expected, ${mi(i)} found`)];const r=e.styleSpec;let o,a=[];if(i.length<1)return[new nt(n,i,"filter array must have at least 1 element")];switch(a=a.concat(Di({key:n+"[0]",value:i[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),at(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===at(i[1])&&a.push(new nt(n,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":3!==i.length&&a.push(new nt(n,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(o=mi(i[1]),"string"!==o&&a.push(new nt(n+"[1]",i[1],`string expected, ${o} found`)));for(let t=2;t<i.length;t++)o=mi(i[t]),"$type"===at(i[1])?a=a.concat(Di({key:`${n}[${t}]`,value:i[t],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==o&&"number"!==o&&"boolean"!==o&&a.push(new nt(`${n}[${t}]`,i[t],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let r=1;r<i.length;r++)a=a.concat(t({key:`${n}[${r}]`,value:i[r],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":o=mi(i[1]),2!==i.length?a.push(new nt(n,i,`filter array for "${i[0]}" operator must have 2 elements`)):"string"!==o&&a.push(new nt(n+"[1]",i[1],`string expected, ${o} found`));break;case"within":o=mi(i[1]),2!==i.length?a.push(new nt(n,i,`filter array for "${i[0]}" operator must have 2 elements`)):"object"!==o&&a.push(new nt(n+"[1]",i[1],`object expected, ${o} found`))}return a}(t)}function Hi(t,e){const i=t.key,n=t.style,r=t.styleSpec,o=t.value,a=t.objectKey,s=r[`${e}_${t.layerType}`];if(!s)return[];const l=a.match(/^(.*)-transition$/);if("paint"===e&&l&&s[l[1]]&&s[l[1]].transition)return nn({key:i,value:o,valueSpec:r.transition,style:n,styleSpec:r});const u=t.valueSpec||s[a];if(!u)return[new nt(i,o,`unknown property "${a}"`)];let c;if("string"===mi(o)&&pi(u)&&!u.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new nt(i,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];const h=[];return"symbol"===t.layerType&&("text-field"===a&&n&&!n.glyphs&&h.push(new nt(i,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&gi(st(o))&&"identity"===at(o.type)&&h.push(new nt(i,o,'"text-font" does not support identity functions'))),h.concat(nn({key:t.key,value:o,valueSpec:u,style:n,styleSpec:r,expressionContext:"property",propertyType:e,propertyKey:a}))}function $i(t){return Hi(t,"paint")}function Xi(t){return Hi(t,"layout")}function Ki(t){let e=[];const i=t.value,n=t.key,r=t.style,o=t.styleSpec;i.type||i.ref||e.push(new nt(n,i,'either "type" or "ref" is required'));let a=at(i.type);const s=at(i.ref);if(i.id){const o=at(i.id);for(let a=0;a<t.arrayIndex;a++){const t=r.layers[a];at(t.id)===o&&e.push(new nt(n,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in i&&e.push(new nt(n,i[t],`"${t}" is prohibited for ref layers`))}),r.layers.forEach(e=>{at(e.id)===s&&(t=e)}),t?t.ref?e.push(new nt(n,i.ref,"ref cannot reference another ref layer")):a=at(t.type):e.push(new nt(n,i.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(i.source){const t=r.sources&&r.sources[i.source],o=t&&at(t.type);t?"vector"===o&&"raster"===a?e.push(new nt(n,i.source,`layer "${i.id}" requires a raster source`)):"raster"===o&&"raster"!==a?e.push(new nt(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==a?e.push(new nt(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new nt(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new nt(n,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new nt(n,i.source,`source "${i.source}" not found`))}else e.push(new nt(n,i,'missing required property "source"'));return e=e.concat(Mi({key:n,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>nn({key:n+".type",value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:i,objectKey:"type"}),filter:Zi,layout:t=>Mi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>Xi(ot({layerType:a},t))}}),paint:t=>Mi({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>$i(ot({layerType:a},t))}})}})),e}function Ji(t){const e=t.value,i=t.key,n=mi(e);return"string"!==n?[new nt(i,e,`string expected, ${n} found`)]:[]}const Yi={promoteId:function({key:t,value:e}){if("string"===mi(e))return Ji({key:t,value:e});{const i=[];for(const n in e)i.push(...Ji({key:`${t}.${n}`,value:e[n]}));return i}}};function Qi(t){const e=t.value,i=t.key,n=t.styleSpec,r=t.style;if(!e.type)return[new nt(i,e,'"type" is required')];const o=at(e.type);let a;switch(o){case"vector":case"raster":case"raster-dem":return a=Mi({key:i,value:e,valueSpec:n["source_"+o.replace("-","_")],style:t.style,styleSpec:n,objectElementValidators:Yi}),a;case"geojson":if(a=Mi({key:i,value:e,valueSpec:n.source_geojson,style:r,styleSpec:n,objectElementValidators:Yi}),e.cluster)for(const t in e.clusterProperties){const[n,r]=e.clusterProperties[t],o="string"==typeof n?[n,["accumulated"],["get",t]]:n;a.push(...Bi({key:`${i}.${t}.map`,value:r,expressionContext:"cluster-map"})),a.push(...Bi({key:`${i}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return Mi({key:i,value:e,valueSpec:n.source_video,style:r,styleSpec:n});case"image":return Mi({key:i,value:e,valueSpec:n.source_image,style:r,styleSpec:n});case"canvas":return[new nt(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Di({key:i+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,styleSpec:n})}}function tn(t){const e=t.value,i=t.styleSpec,n=i.light,r=t.style;let o=[];const a=mi(e);if(void 0===e)return o;if("object"!==a)return o=o.concat([new nt("light",e,`object expected, ${a} found`)]),o;for(const t in e){const a=t.match(/^(.*)-transition$/);o=o.concat(a&&n[a[1]]&&n[a[1]].transition?nn({key:t,value:e[t],valueSpec:i.transition,style:r,styleSpec:i}):n[t]?nn({key:t,value:e[t],valueSpec:n[t],style:r,styleSpec:i}):[new nt(t,e[t],`unknown property "${t}"`)])}return o}const en={"*":()=>[],array:ki,boolean:function(t){const e=t.value,i=t.key,n=mi(e);return"boolean"!==n?[new nt(i,e,`boolean expected, ${n} found`)]:[]},number:zi,color:function(t){const e=t.key,i=t.value,n=mi(i);return"string"!==n?[new nt(e,i,`color expected, ${n} found`)]:null===At(i)?[new nt(e,i,`color expected, "${i}" found`)]:[]},constants:rt,enum:Di,filter:Zi,function:Li,layer:Ki,object:Mi,source:Qi,light:tn,string:Ji,formatted:function(t){return 0===Ji(t).length?[]:Bi(t)},resolvedImage:function(t){return 0===Ji(t).length?[]:Bi(t)}};function nn(t){const e=t.value,i=t.valueSpec,n=t.styleSpec;return i.expression&&gi(at(e))?Li(t):i.expression&&Ti(st(e))?Bi(t):i.type&&en[i.type]?en[i.type](t):Mi(ot({},t,{valueSpec:i.type?n[i.type]:i}))}function rn(t){const e=t.value,i=t.key,n=Ji(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new nt(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new nt(i,e,'"glyphs" url must include a "{range}" token'))),n}function on(t,e=it){let i=[];return i=i.concat(nn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:rn,"*":()=>[]}})),t.constants&&(i=i.concat(rt({key:"constants",value:t.constants,style:t,styleSpec:e}))),an(i)}function an(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function sn(t){return function(...e){return an(t.apply(this,e))}}on.source=sn(Qi),on.light=sn(tn),on.layer=sn(Ki),on.filter=sn(Zi),on.paintProperty=sn($i),on.layoutProperty=sn(Xi);const ln=on,un=ln.light,cn=ln.paintProperty,hn=ln.layoutProperty;function pn(t,e){let i=!1;if(e&&e.length)for(const n of e)t.fire(new tt(new Error(n.message))),i=!0;return i}class dn{constructor(t,e,i){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const r=new Int32Array(this.arrayBuffer);t=r[0],this.d=(e=r[1])+2*(i=r[2]);for(let t=0;t<this.d*this.d;t++){const e=r[3+t],i=r[3+t+1];n.push(e===i?null:r.subarray(e,i))}const o=r[3+n.length+1];this.keys=r.subarray(r[3+n.length],o),this.bboxes=r.subarray(o),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;const r=i/e*t;this.min=-r,this.max=t+r}insert(t,e,i,n,r){this._forEachCell(e,i,n,r,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(r)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,n,r,o){this.cells[r].push(o)}query(t,e,i,n,r){const o=this.min,a=this.max;if(t<=o&&e<=o&&a<=i&&a<=n&&!r)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(t,e,i,n,this._queryCell,o,{},r),o}}_queryCell(t,e,i,n,r,o,a,s){const l=this.cells[r];if(null!==l){const r=this.keys,u=this.bboxes;for(let c=0;c<l.length;c++){const h=l[c];if(void 0===a[h]){const l=4*h;(s?s(u[l+0],u[l+1],u[l+2],u[l+3]):t<=u[l+2]&&e<=u[l+3]&&i>=u[l+0]&&n>=u[l+1])?(a[h]=!0,o.push(r[h])):a[h]=!1}}}}_forEachCell(t,e,i,n,r,o,a,s){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(i),h=this._convertToCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&r.call(this,t,e,i,n,u,o,a,s))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let t=0;t<this.cells.length;t++)i+=this.cells[t].length;const n=new Int32Array(e+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let r=e;for(let e=0;e<t.length;e++){const i=t[e];n[3+e]=r,n.set(i,r),r+=i.length}return n[3+t.length]=r,n.set(this.keys,r),r+=this.keys.length,n[3+t.length+1]=r,n.set(this.bboxes,r),r+=this.bboxes.length,n.buffer}static serialize(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new dn(t.buffer)}}const fn={};function mn(t,e,i={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),fn[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}mn("Object",Object),mn("TransferableGridIndex",dn),mn("Color",zt),mn("Error",Error),mn("AJAXError",N),mn("ResolvedImage",Rt),mn("StylePropertyFunction",Pi),mn("StyleExpression",Si,{omit:["_evaluator"]}),mn("ZoomDependentExpression",Ii),mn("ZoomConstantExpression",Ai),mn("CompoundExpression",Jt,{omit:["_evaluate"]});for(const t in oi)oi[t]._classRegistryKey||mn("Expression_"+t,oi[t]);function gn(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function _n(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(gn(t))return e&&e.push(t),t;if(S(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const i=t;return e&&e.push(i.buffer),i}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const n of t)i.push(_n(n,e));return i}if("object"==typeof t){const i=t.constructor,n=i._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");const r=i.serialize?i.serialize(t,e):{};if(!i.serialize){for(const i in t){if(!t.hasOwnProperty(i))continue;if(fn[n].omit.indexOf(i)>=0)continue;const o=t[i];r[i]=fn[n].shallow.indexOf(i)>=0?o:_n(o,e)}t instanceof Error&&(r.message=t.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(r.$name=n),r}throw new Error("can't serialize object of type "+typeof t)}function yn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||gn(t)||S(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(yn);if("object"==typeof t){const e=t.$name||"Object";if(!fn[e])throw new Error("can't deserialize unregistered class "+e);const{klass:i}=fn[e];if(!i)throw new Error("can't deserialize unregistered class "+e);if(i.deserialize)return i.deserialize(t);const n=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const r=t[i];n[i]=fn[e].shallow.indexOf(i)>=0?r:yn(r)}return n}throw new Error("can't deserialize object of type "+typeof t)}class xn{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}const vn={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function bn(t){for(const e of t)if(Tn(e.charCodeAt(0)))return!0;return!1}function wn(t){for(const e of t)if(!Sn(e.charCodeAt(0)))return!1;return!0}function Sn(t){return!(vn.Arabic(t)||vn["Arabic Supplement"](t)||vn["Arabic Extended-A"](t)||vn["Arabic Presentation Forms-A"](t)||vn["Arabic Presentation Forms-B"](t))}function Tn(t){return!(746!==t&&747!==t&&(t<4352||!(vn["Bopomofo Extended"](t)||vn.Bopomofo(t)||vn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||vn["CJK Compatibility Ideographs"](t)||vn["CJK Compatibility"](t)||vn["CJK Radicals Supplement"](t)||vn["CJK Strokes"](t)||!(!vn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||vn["CJK Unified Ideographs Extension A"](t)||vn["CJK Unified Ideographs"](t)||vn["Enclosed CJK Letters and Months"](t)||vn["Hangul Compatibility Jamo"](t)||vn["Hangul Jamo Extended-A"](t)||vn["Hangul Jamo Extended-B"](t)||vn["Hangul Jamo"](t)||vn["Hangul Syllables"](t)||vn.Hiragana(t)||vn["Ideographic Description Characters"](t)||vn.Kanbun(t)||vn["Kangxi Radicals"](t)||vn["Katakana Phonetic Extensions"](t)||vn.Katakana(t)&&12540!==t||!(!vn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!vn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||vn["Unified Canadian Aboriginal Syllabics"](t)||vn["Unified Canadian Aboriginal Syllabics Extended"](t)||vn["Vertical Forms"](t)||vn["Yijing Hexagram Symbols"](t)||vn["Yi Syllables"](t)||vn["Yi Radicals"](t))))}function En(t){return!(Tn(t)||function(t){return!!(vn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||vn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||vn["Letterlike Symbols"](t)||vn["Number Forms"](t)||vn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||vn["Control Pictures"](t)&&9251!==t||vn["Optical Character Recognition"](t)||vn["Enclosed Alphanumerics"](t)||vn["Geometric Shapes"](t)||vn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||vn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||vn["CJK Symbols and Punctuation"](t)||vn.Katakana(t)||vn["Private Use Area"](t)||vn["CJK Compatibility Forms"](t)||vn["Small Form Variants"](t)||vn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function An(t){return t>=1424&&t<=2303||vn["Arabic Presentation Forms-A"](t)||vn["Arabic Presentation Forms-B"](t)}function In(t,e){return!(!e&&An(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||vn.Khmer(t))}function Cn(t){for(const e of t)if(An(e.charCodeAt(0)))return!0;return!1}const Pn="deferred",Mn="loading",kn="loaded";let zn=null,Ln="unavailable",Bn=null;const Dn=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Ln="error"),zn&&zn(t)};function Rn(){On.fire(new Q("pluginStateChange",{pluginStatus:Ln,pluginURL:Bn}))}const On=new et,Fn=function(){return Ln},Un=function(){if(Ln!==Pn||!Bn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ln=Mn,Rn(),Bn&&W({url:Bn},t=>{t?Dn(t):(Ln=kn,Rn())})},jn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ln===kn||null!=jn.applyArabicShaping,isLoading:()=>Ln===Mn,setState(t){Ln=t.pluginStatus,Bn=t.pluginURL},isParsed:()=>null!=jn.applyArabicShaping&&null!=jn.processBidirectionalText&&null!=jn.processStyledBidirectionalText,getPluginURL:()=>Bn};class Nn{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new xn,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!In(i.charCodeAt(0),e))return!1;return!0}(t,jn.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class Vn{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(gi(t))return new Pi(t,e);if(Ti(t)){const i=Ci(t,e);if("error"===i.result)throw new Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));return i.value}{let i=t;return"string"==typeof t&&"color"===e.type&&(i=zt.parse(t)),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class Gn{constructor(t){this.property=t,this.value=new Vn(t,void 0)}transitioned(t,e){return new Wn(this.property,this.value,e,s({},t.transition,this.transition),t.now)}untransitioned(){return new Wn(this.property,this.value,null,{},0)}}class qn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return p(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Gn(this._values[t].property)),this._values[t].value=new Vn(this._values[t].property,null===e?void 0:p(e))}getTransition(t){return p(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Gn(this._values[t].property)),this._values[t].transition=p(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const n=this.getTransition(e);void 0!==n&&(t[e+"-transition"]=n)}return t}transitioned(t,e){const i=new Zn(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(t,e._values[n]);return i}untransitioned(){const t=new Zn(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class Wn{constructor(t,e,i,n,r){this.property=t,this.value=e,this.begin=r+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const n=t.now||0,r=this.value.possiblyEvaluate(t,e,i),o=this.prior;if(o){if(n>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(n<this.begin)return o.possiblyEvaluate(t,e,i);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,i),r,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(a))}}return r}}class Zn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const n=new Xn(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].possiblyEvaluate(t,e,i);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Hn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return p(this._values[t].value)}setValue(t,e){this._values[t]=new Vn(this._values[t].property,null===e?void 0:p(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const n=new Xn(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].possiblyEvaluate(t,e,i);return n}}class $n{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,n){return this.property.evaluate(this.value,this.parameters,t,e,i,n)}}class Xn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Kn{constructor(t){this.specification=t}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,i){const n=Te[this.specification.type];return n?n(t,e,i):t}}class Jn{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,n){return new $n(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,n)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new $n(this,{kind:"constant",value:void 0},t.parameters);const n=Te[this.specification.type];return n?new $n(this,{kind:"constant",value:n(t.value.value,e.value.value,i)},t.parameters):t}evaluate(t,e,i,n,r,o){return"constant"===t.kind?t.value:t.evaluate(e,i,n,r,o)}}class Yn extends Jn{possiblyEvaluate(t,e,i,n){if(void 0===t.value)return new $n(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const r=t.expression.evaluate(e,null,{},i,n),o="resolvedImage"===t.property.specification.type&&"string"!=typeof r?r.name:r,a=this._calculate(o,o,o,e);return new $n(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new $n(this,{kind:"constant",value:i},e)}return new $n(this,t.expression,e)}evaluate(t,e,i,n,r,o){if("source"===t.kind){const a=t.evaluate(e,i,n,r,o);return this._calculate(a,a,a,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,n),t.evaluate({zoom:Math.floor(e.zoom)},i,n),t.evaluate({zoom:Math.floor(e.zoom)+1},i,n),e):t.value}_calculate(t,e,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Qn{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){if(void 0!==t.value){if("constant"===t.expression.kind){const r=t.expression.evaluate(e,null,{},i,n);return this._calculate(r,r,r,e)}return this._calculate(t.expression.evaluate(new Nn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Nn(Math.floor(e.zoom),e)),t.expression.evaluate(new Nn(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class tr{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){return!!t.expression.evaluate(e,null,{},i,n)}interpolate(){return!1}}class er{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new Vn(i,void 0),r=this.defaultTransitionablePropertyValues[e]=new Gn(i);this.defaultTransitioningPropertyValues[e]=r.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}mn("DataDrivenProperty",Jn),mn("DataConstantProperty",Kn),mn("CrossFadedDataDrivenProperty",Yn),mn("CrossFadedProperty",Qn),mn("ColorRampProperty",tr);const ir="-transition";class nr extends et{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Hn(e.layout)),e.paint)){this._transitionablePaint=new qn(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Xn(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}){null!=e&&this._validate(hn,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(ir)?this._transitionablePaint.getTransition(t.slice(0,-ir.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(cn,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(ir))return this._transitionablePaint.setTransition(t.slice(0,-ir.length),e||void 0),!1;{const i=this._transitionablePaint._values[t],n="cross-faded-data-driven"===i.property.specification["property-type"],r=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||r||n||this._handleOverridablePaintPropertyUpdate(t,o,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),h(t,(t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length))}_validate(t,e,i,n,r={}){return(!r||!1!==r.validate)&&pn(this,t.call(ln,{key:e,layerType:this.type,objectKey:i,value:n,styleSpec:it,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof $n&&pi(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const rr={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class or{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ar{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function sr(t,e=1){let i=0,n=0;return{members:t.map(t=>{const r=rr[t.type].BYTES_PER_ELEMENT,o=i=lr(i,Math.max(e,r)),a=t.components||1;return n=Math.max(n,r),i+=r*a,{name:t.name,type:t.type,components:a,offset:o}}),size:lr(i,Math.max(n,e)),alignment:e}}function lr(t,e){return Math.ceil(t/e)*e}class ur extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=i,t}}ur.prototype.bytesPerElement=4,mn("StructArrayLayout2i4",ur);class cr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=n,this.int16[o+3]=r,t}}cr.prototype.bytesPerElement=8,mn("StructArrayLayout4i8",cr);class hr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=n,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,t}}hr.prototype.bytesPerElement=12,mn("StructArrayLayout2i4i12",hr);class pr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,a){const s=4*t,l=8*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.uint8[l+4]=n,this.uint8[l+5]=r,this.uint8[l+6]=o,this.uint8[l+7]=a,t}}pr.prototype.bytesPerElement=8,mn("StructArrayLayout2i4ub8",pr);class dr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=i,t}}dr.prototype.bytesPerElement=8,mn("StructArrayLayout2f8",dr);class fr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o,a,s,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,n,r,o,a,s,l,u)}emplace(t,e,i,n,r,o,a,s,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=i,this.uint16[h+2]=n,this.uint16[h+3]=r,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}fr.prototype.bytesPerElement=20,mn("StructArrayLayout10ui20",fr);class mr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o,a,s,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,n,r,o,a,s,l,u,c,h)}emplace(t,e,i,n,r,o,a,s,l,u,c,h,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=n,this.int16[d+3]=r,this.uint16[d+4]=o,this.uint16[d+5]=a,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,t}}mr.prototype.bytesPerElement=24,mn("StructArrayLayout4i4ui4i24",mr);class gr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=3*t;return this.float32[r+0]=e,this.float32[r+1]=i,this.float32[r+2]=n,t}}gr.prototype.bytesPerElement=12,mn("StructArrayLayout3f12",gr);class _r extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}_r.prototype.bytesPerElement=4,mn("StructArrayLayout1ul4",_r);class yr extends ar{_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(t,e,i,n,r,o,a,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,i,n,r,o,a,s,l)}emplace(t,e,i,n,r,o,a,s,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=i,this.int16[c+2]=n,this.int16[c+3]=r,this.int16[c+4]=o,this.int16[c+5]=a,this.uint32[h+3]=s,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}yr.prototype.bytesPerElement=20,mn("StructArrayLayout6i1ul2ui20",yr);class xr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,a){const s=6*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=n,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,t}}xr.prototype.bytesPerElement=12,mn("StructArrayLayout2i2i2i12",xr);class vr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n,r)}emplace(t,e,i,n,r,o){const a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=i,this.float32[a+2]=n,this.int16[s+6]=r,this.int16[s+7]=o,t}}vr.prototype.bytesPerElement=16,mn("StructArrayLayout2f1f2i16",vr);class br extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=i,this.float32[a+1]=n,this.float32[a+2]=r,t}}br.prototype.bytesPerElement=12,mn("StructArrayLayout2ub2f12",br);class wr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=3*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,this.uint16[r+2]=n,t}}wr.prototype.bytesPerElement=6,mn("StructArrayLayout3ui6",wr);class Sr extends ar{_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(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g)}emplace(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g,_){const y=24*t,x=12*t,v=48*t;return this.int16[y+0]=e,this.int16[y+1]=i,this.uint16[y+2]=n,this.uint16[y+3]=r,this.uint32[x+2]=o,this.uint32[x+3]=a,this.uint32[x+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=u,this.uint16[y+12]=c,this.float32[x+7]=h,this.float32[x+8]=p,this.uint8[v+36]=d,this.uint8[v+37]=f,this.uint8[v+38]=m,this.uint32[x+10]=g,this.int16[y+22]=_,t}}Sr.prototype.bytesPerElement=48,mn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Sr);class Tr extends ar{_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(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g,_,y,x,v,b,w,S,T,E,A,I){const C=this.length;return this.resize(C+1),this.emplace(C,t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g,_,y,x,v,b,w,S,T,E,A,I)}emplace(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g,_,y,x,v,b,w,S,T,E,A,I,C){const P=34*t,M=17*t;return this.int16[P+0]=e,this.int16[P+1]=i,this.int16[P+2]=n,this.int16[P+3]=r,this.int16[P+4]=o,this.int16[P+5]=a,this.int16[P+6]=s,this.int16[P+7]=l,this.uint16[P+8]=u,this.uint16[P+9]=c,this.uint16[P+10]=h,this.uint16[P+11]=p,this.uint16[P+12]=d,this.uint16[P+13]=f,this.uint16[P+14]=m,this.uint16[P+15]=g,this.uint16[P+16]=_,this.uint16[P+17]=y,this.uint16[P+18]=x,this.uint16[P+19]=v,this.uint16[P+20]=b,this.uint16[P+21]=w,this.uint16[P+22]=S,this.uint32[M+12]=T,this.float32[M+13]=E,this.float32[M+14]=A,this.float32[M+15]=I,this.float32[M+16]=C,t}}Tr.prototype.bytesPerElement=68,mn("StructArrayLayout8i15ui1ul4f68",Tr);class Er extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Er.prototype.bytesPerElement=4,mn("StructArrayLayout1f4",Er);class Ar extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=3*t;return this.int16[r+0]=e,this.int16[r+1]=i,this.int16[r+2]=n,t}}Ar.prototype.bytesPerElement=6,mn("StructArrayLayout3i6",Ar);class Ir extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=4*t;return this.uint32[2*t+0]=e,this.uint16[r+2]=i,this.uint16[r+3]=n,t}}Ir.prototype.bytesPerElement=8,mn("StructArrayLayout1ul2ui8",Ir);class Cr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,t}}Cr.prototype.bytesPerElement=4,mn("StructArrayLayout2ui4",Cr);class Pr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Pr.prototype.bytesPerElement=2,mn("StructArrayLayout1ui2",Pr);class Mr extends ar{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=n,this.float32[o+3]=r,t}}Mr.prototype.bytesPerElement=16,mn("StructArrayLayout4f16",Mr);class kr extends or{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 E(this.anchorPointX,this.anchorPointY)}}kr.prototype.size=20;class zr extends yr{get(t){return new kr(this,t)}}mn("CollisionBoxArray",zr);class Lr extends or{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Lr.prototype.size=48;class Br extends Sr{get(t){return new Lr(this,t)}}mn("PlacedSymbolArray",Br);class Dr extends or{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(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Dr.prototype.size=68;class Rr extends Tr{get(t){return new Dr(this,t)}}mn("SymbolInstanceArray",Rr);class Or extends Er{getoffsetX(t){return this.float32[1*t+0]}}mn("GlyphOffsetArray",Or);class Fr extends Ar{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}mn("SymbolLineVertexArray",Fr);class Ur extends or{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]}}Ur.prototype.size=8;class jr extends Ir{get(t){return new Ur(this,t)}}mn("FeatureIndexArray",jr);class Nr extends ur{}class Vr extends ur{}class Gr extends hr{}class qr extends pr{}class Wr extends dr{}class Zr extends fr{}class Hr extends mr{}class $r extends gr{}class Xr extends _r{}class Kr extends xr{}class Jr extends br{}class Yr extends wr{}class Qr extends Cr{}const to=sr([{name:"a_pos",components:2,type:"Int16"}],4),{members:eo}=to;class io{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,n){let r=this.segments[this.segments.length-1];return t>io.MAX_VERTEX_ARRAY_LENGTH&&f(`Max vertices per segment is ${io.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!r||r.vertexLength+t>io.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==n)&&(r={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==n&&(r.sortKey=n),this.segments.push(r)),r}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,n){return new io([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}function no(t,e){return 256*(t=o(Math.floor(t),0,255))+o(Math.floor(e),0,255)}io.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,mn("SegmentVector",io);const ro=sr([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var oo={exports:{}},ao={exports:{}};ao.exports=function(t,e){var i,n,r,o,a,s,l,u;for(n=t.length-(i=3&t.length),r=e,a=3432918353,s=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,r=27492+(65535&(o=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return r^=t.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0};var so={exports:{}};so.exports=function(t,e){for(var i,n=t.length,r=e^n,o=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:r^=(255&t.charCodeAt(o+2))<<16;case 2:r^=(255&t.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0};var lo=ao.exports,uo=so.exports;oo.exports=lo,oo.exports.murmur3=lo,oo.exports.murmur2=uo;var co=oo.exports;class ho{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,n){this.ids.push(po(t)),this.positions.push(e,i,n)}getPositions(t){const e=po(t);let i=0,n=this.ids.length-1;for(;i<n;){const t=i+n>>1;this.ids[t]>=e?n=t:i=t+1}const r=[];for(;this.ids[i]===e;)r.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return r}static serialize(t,e){const i=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,i,n,r){for(;n<r;){const o=e[n+r>>1];let a=n-1,s=r+1;for(;;){do{a++}while(e[a]<o);do{s--}while(e[s]>o);if(a>=s)break;fo(e,a,s),fo(i,3*a,3*s),fo(i,3*a+1,3*s+1),fo(i,3*a+2,3*s+2)}s-n<r-s?(t(e,i,n,s),n=s+1):(t(e,i,s+1,r),r=s)}}(i,n,0,i.length-1),e&&e.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(t){const e=new ho;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function po(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:co(String(t))}function fo(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}mn("FeaturePositionMap",ho);class mo{constructor(t,e){this.gl=t.gl,this.location=e}}class go extends mo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class _o extends mo{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class yo extends mo{constructor(t,e){super(t,e),this.current=zt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const xo=new Float32Array(16);function vo(t){return[no(255*t.r,255*t.g),no(255*t.b,255*t.a)]}class bo{constructor(t,e,i){this.value=t,this.uniformNames=e.map(t=>"u_"+t),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new yo(t,e):new go(t,e)}}class wo{constructor(t,e){this.uniformNames=e.map(t=>"u_"+t),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,n){const r="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;r&&t.set(r)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new _o(t,e):new go(t,e)}}class So{constructor(t,e,i,n){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:"a_"+t,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(t,e,i,n,r){const o=this.paintVertexArray.length,a=this.expression.evaluate(new Nn(0),e,{},n,[],r);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)}updatePaintArray(t,e,i,n){const r=this.expression.evaluate({zoom:0},i,n);this._setPaintValue(t,e,r)}_setPaintValue(t,e,i){if("color"===this.type){const n=vo(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class To{constructor(t,e,i,n,r,o){this.expression=t,this.uniformNames=e.map(t=>`u_${t}_t`),this.type=i,this.useIntegerZoom=n,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:"a_"+t,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(t,e,i,n,r){const o=this.expression.evaluate(new Nn(this.zoom),e,{},n,[],r),a=this.expression.evaluate(new Nn(this.zoom+1),e,{},n,[],r),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)}updatePaintArray(t,e,i,n){const r=this.expression.evaluate({zoom:this.zoom},i,n),o=this.expression.evaluate({zoom:this.zoom+1},i,n);this._setPaintValue(t,e,r,o)}_setPaintValue(t,e,i,n){if("color"===this.type){const r=vo(i),o=vo(n);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1],o[0],o[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i,n);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=o(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,e,i){return new go(t,e)}}class Eo{constructor(t,e,i,n,r,o){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=n,this.layerId=o,this.zoomInPaintVertexArray=new r,this.zoomOutPaintVertexArray=new r}populatePaintArray(t,e,i){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,n,r){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],r)}_setPaintValues(t,e,i,n){if(!n||!i)return;const{min:r,mid:o,max:a}=i,s=n[r],l=n[o],u=n[a];if(s&&l&&u)for(let i=t;i<e;i++)this.zoomInPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,ro.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ro.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ao{constructor(t,e,i){this.binders={},this._buffers=[];const n=[];for(const r in t.paint._values){if(!i(r))continue;const o=t.paint.get(r);if(!(o instanceof $n&&pi(o.property.specification)))continue;const a=Co(r,t.type),s=o.value,l=o.property.specification.type,u=o.property.useIntegerZoom,c=o.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===s.kind)this.binders[r]=h?new wo(s.value,a):new bo(s.value,a,l),n.push("/u_"+r);else if("source"===s.kind||h){const i=Po(r,l,"source");this.binders[r]=h?new Eo(s,l,u,e,i,t.id):new So(s,a,l,i),n.push("/a_"+r)}else{const t=Po(r,l,"composite");this.binders[r]=new To(s,a,l,u,e,t),n.push("/z_"+r)}}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof So||e instanceof To?e.maxValue:0}populatePaintArrays(t,e,i,n,r){for(const o in this.binders){const a=this.binders[o];(a instanceof So||a instanceof To||a instanceof Eo)&&a.populatePaintArray(t,e,i,n,r)}}setConstantPatternPositions(t,e){for(const i in this.binders){const n=this.binders[i];n instanceof wo&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,n,r){let o=!1;for(const a in t){const s=e.getPositions(a);for(const e of s){const s=i.feature(e.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof So||l instanceof To||l instanceof Eo)&&!0===l.expression.isStateDependent){const u=n.paint.get(i);l.expression=u.value,l.updatePaintArray(e.start,e.end,s,t[a],r),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof bo||i instanceof wo)&&t.push(...i.uniformNames.map(t=>"#define HAS_UNIFORM_"+t))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof So||i instanceof To)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name);else if(i instanceof Eo)for(let e=0;e<ro.members.length;e++)t.push(ro.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof bo||i instanceof wo||i instanceof To)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const i=[];for(const n in this.binders){const r=this.binders[n];if(r instanceof bo||r instanceof wo||r instanceof To)for(const o of r.uniformNames)if(e[o]){const a=r.getBinding(t,e[o],o);i.push({name:o,property:n,binding:a})}}return i}setUniforms(t,e,i,n){for(const{name:t,property:r,binding:o}of e)this.binders[r].setUniform(o,n,i.get(r),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof Eo){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof So||i instanceof To)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof So||i instanceof To||i instanceof Eo)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof So||e instanceof To||e instanceof Eo)&&e.destroy()}}}class Io{constructor(t,e,i=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Ao(n,e,i);this.needsUpload=!1,this._featureMap=new ho,this._bufferOffset=0}populatePaintArrays(t,e,i,n,r,o){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,n,r,o);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,n){for(const r of i)this.needsUpload=this.programConfigurations[r.id].updatePaintArrays(t,this._featureMap,e,r,n)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Co(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(e+"-","").replace(/-/g,"_")]}function Po(t,e,i){const n={color:{source:dr,composite:Mr},number:{source:Er,composite:dr}},r=function(t){return{"line-pattern":{source:Zr,composite:Zr},"fill-pattern":{source:Zr,composite:Zr},"fill-extrusion-pattern":{source:Zr,composite:Zr}}[t]}(t);return r&&r[i]||n[e][i]}mn("ConstantBinder",bo),mn("CrossFadedConstantBinder",wo),mn("SourceExpressionBinder",So),mn("CrossFadedCompositeBinder",Eo),mn("CompositeExpressionBinder",To),mn("ProgramConfiguration",Ao,{omit:["_buffers"]}),mn("ProgramConfigurationSet",Io);var Mo=8192;const ko=Math.pow(2,14)-1,zo=-ko-1;function Lo(t){const e=Mo/t.extent,i=t.loadGeometry();for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++){const i=n[t],r=Math.round(i.x*e),a=Math.round(i.y*e);i.x=o(r,zo,ko),i.y=o(a,zo,ko),(r<i.x||r>i.x+1||a<i.y||a>i.y+1)&&f("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Bo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Lo(t):[]}}function Do(t,e,i,n,r){t.emplaceBack(2*e+(n+1)/2,2*i+(r+1)/2)}class Ro{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Nr,this.indexArray=new Yr,this.segments=new io,this.programConfigurations=new Io(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){const n=this.layers[0],r=[];let o=null,a=!1;"circle"===n.type&&(o=n.layout.get("circle-sort-key"),a=!o.isConstant());for(const{feature:e,id:n,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Bo(e,t);if(!this.layers[0]._featureFilter.filter(new Nn(this.zoom),u,i))continue;const c=a?o.evaluate(u,{},i):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?u.geometry:Lo(e),patterns:{},sortKey:c};r.push(h)}a&&r.sort((t,e)=>t.sortKey-e.sortKey);for(const n of r){const{geometry:r,index:o,sourceLayerIndex:a}=n,s=t[o].feature;this.addFeature(n,r,o,i),e.featureIndex.insert(s,r,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,eo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,n){for(const i of e)for(const e of i){const i=e.x,n=e.y;if(i<0||i>=Mo||n<0||n>=Mo)continue;const r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=r.vertexLength;Do(this.layoutVertexArray,i,n,-1,-1),Do(this.layoutVertexArray,i,n,1,-1),Do(this.layoutVertexArray,i,n,1,1),Do(this.layoutVertexArray,i,n,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+3,o+2),r.vertexLength+=4,r.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},n)}}function Oo(t,e){for(let i=0;i<t.length;i++)if(Zo(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(Zo(t,e[i]))return!0;return!!No(t,e)}function Fo(t,e,i){return!!Zo(t,e)||!!Go(e,t,i)}function Uo(t,e){if(1===t.length)return Wo(e,t[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let e=0;e<n.length;e++)if(Zo(t,n[e]))return!0}for(let i=0;i<t.length;i++)if(Wo(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(No(t,e[i]))return!0;return!1}function jo(t,e,i){if(t.length>1){if(No(t,e))return!0;for(let n=0;n<e.length;n++)if(Go(e[n],t,i))return!0}for(let n=0;n<t.length;n++)if(Go(t[n],e,i))return!0;return!1}function No(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1];for(let t=0;t<e.length-1;t++)if(Vo(n,r,e[t],e[t+1]))return!0}return!1}function Vo(t,e,i,n){return m(t,i,n)!==m(e,i,n)&&m(t,e,i)!==m(t,e,n)}function Go(t,e,i){const n=i*i;if(1===e.length)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++)if(qo(t,e[i-1],e[i])<n)return!0;return!1}function qo(t,e,i){const n=e.distSqr(i);if(0===n)return t.distSqr(e);const r=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/n;return t.distSqr(r<0?e:r>1?i:i.sub(e)._mult(r)._add(e))}function Wo(t,e){let i,n,r,o=!1;for(let a=0;a<t.length;a++){i=t[a];for(let t=0,a=i.length-1;t<i.length;a=t++)n=i[t],r=i[a],n.y>e.y!=r.y>e.y&&e.x<(r.x-n.x)*(e.y-n.y)/(r.y-n.y)+n.x&&(o=!o)}return o}function Zo(t,e){let i=!1;for(let n=0,r=t.length-1;n<t.length;r=n++){const o=t[n],a=t[r];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)}return i}function Ho(t,e,i){const n=i[0],r=i[2];if(t.x<n.x&&e.x<n.x||t.x>r.x&&e.x>r.x||t.y<n.y&&e.y<n.y||t.y>r.y&&e.y>r.y)return!1;const o=m(t,e,i[0]);return o!==m(t,e,i[1])||o!==m(t,e,i[2])||o!==m(t,e,i[3])}function $o(t,e,i){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function Xo(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ko(t,e,i,n,r){if(!e[0]&&!e[1])return t;const o=E.convert(e)._mult(r);"viewport"===i&&o._rotate(-n);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(o));return a}mn("CircleBucket",Ro,{omit:["layers"]});const Jo=new er({"circle-sort-key":new Jn(it.layout_circle["circle-sort-key"])});var Yo={paint:new er({"circle-radius":new Jn(it.paint_circle["circle-radius"]),"circle-color":new Jn(it.paint_circle["circle-color"]),"circle-blur":new Jn(it.paint_circle["circle-blur"]),"circle-opacity":new Jn(it.paint_circle["circle-opacity"]),"circle-translate":new Kn(it.paint_circle["circle-translate"]),"circle-translate-anchor":new Kn(it.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Kn(it.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Kn(it.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Jn(it.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Jn(it.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Jn(it.paint_circle["circle-stroke-opacity"])}),layout:Jo},Qo="undefined"!=typeof Float32Array?Float32Array:Array;function ta(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ea(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],m=e[12],g=e[13],_=e[14],y=e[15],x=i[0],v=i[1],b=i[2],w=i[3];return t[0]=x*n+v*s+b*h+w*m,t[1]=x*r+v*l+b*p+w*g,t[2]=x*o+v*u+b*d+w*_,t[3]=x*a+v*c+b*f+w*y,t[4]=(x=i[4])*n+(v=i[5])*s+(b=i[6])*h+(w=i[7])*m,t[5]=x*r+v*l+b*p+w*g,t[6]=x*o+v*u+b*d+w*_,t[7]=x*a+v*c+b*f+w*y,t[8]=(x=i[8])*n+(v=i[9])*s+(b=i[10])*h+(w=i[11])*m,t[9]=x*r+v*l+b*p+w*g,t[10]=x*o+v*u+b*d+w*_,t[11]=x*a+v*c+b*f+w*y,t[12]=(x=i[12])*n+(v=i[13])*s+(b=i[14])*h+(w=i[15])*m,t[13]=x*r+v*l+b*p+w*g,t[14]=x*o+v*u+b*d+w*_,t[15]=x*a+v*c+b*f+w*y,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var ia,na=ea;function ra(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3];return t[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*a,t[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*a,t[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*a,t[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*a,t}function oa(t,e){const i=ra([],[t.x,t.y,0,1],e);return new E(i[0]/i[3],i[1]/i[3])}ia=new Qo(4),Qo!=Float32Array&&(ia[0]=0,ia[1]=0,ia[2]=0,ia[3]=0);class aa extends Ro{}mn("HeatmapBucket",aa,{omit:["layers"]});var sa={paint:new er({"heatmap-radius":new Jn(it.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Jn(it.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Kn(it.paint_heatmap["heatmap-intensity"]),"heatmap-color":new tr(it.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Kn(it.paint_heatmap["heatmap-opacity"])})};function la(t,{width:e,height:i},n,r){if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==e*i*n)throw new RangeError(`mismatched image size. expected: ${r.length} but got: ${e*i*n}`)}else r=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=r,t}function ua(t,{width:e,height:i},n){if(e===t.width&&i===t.height)return;const r=la({},{width:e,height:i},n);ca(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},n),t.width=e,t.height=i,t.data=r.data}function ca(t,e,i,n,r,o){if(0===r.width||0===r.height)return e;if(r.width>t.width||r.height>t.height||i.x>t.width-r.width||i.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>e.width||r.height>e.height||n.x>e.width-r.width||n.y>e.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const a=t.data,s=e.data;for(let l=0;l<r.height;l++){const u=((i.y+l)*t.width+i.x)*o,c=((n.y+l)*e.width+n.x)*o;for(let t=0;t<r.width*o;t++)s[c+t]=a[u+t]}return e}class ha{constructor(t,e){la(this,t,1,e)}resize(t){ua(this,t,1)}clone(){return new ha({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,n,r){ca(t,e,i,n,r,1)}}class pa{constructor(t,e){la(this,t,4,e)}resize(t){ua(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new pa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,n,r){ca(t,e,i,n,r,4)}}function da(t){const e={},i=t.resolution||256,n=t.clips?t.clips.length:1,r=t.image||new pa({width:i,height:n}),o=(i,n,o)=>{e[t.evaluationKey]=o;const a=t.expression.evaluate(e);r.data[i+n+0]=Math.floor(255*a.r/a.a),r.data[i+n+1]=Math.floor(255*a.g/a.a),r.data[i+n+2]=Math.floor(255*a.b/a.a),r.data[i+n+3]=Math.floor(255*a.a)};if(t.clips)for(let e=0,r=0;e<n;++e,r+=4*i)for(let n=0,a=0;n<i;n++,a+=4){const s=n/(i-1),{start:l,end:u}=t.clips[e];o(r,a,l*(1-s)+u*s)}else for(let t=0,e=0;t<i;t++,e+=4)o(0,e,t/(i-1));return r}mn("AlphaImage",ha),mn("RGBAImage",pa);var fa={paint:new er({"hillshade-illumination-direction":new Kn(it.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Kn(it.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Kn(it.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Kn(it.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Kn(it.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Kn(it.paint_hillshade["hillshade-accent-color"])})};const ma=sr([{name:"a_pos",components:2,type:"Int16"}],4),{members:ga}=ma;var _a={exports:{}};function ya(t,e,i){i=i||2;var n,r,o,a,s,l,u,c=e&&e.length,h=c?e[0]*i:t.length,p=xa(t,0,h,i,!0),d=[];if(!p||p.next===p.prev)return d;if(c&&(p=function(t,e,i,n){var r,o,a,s=[];for(r=0,o=e.length;r<o;r++)(a=xa(t,e[r]*n,r<o-1?e[r+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),s.push(Ma(a));for(s.sort(Aa),r=0;r<s.length;r++)i=va(i=Ia(s[r],i),i.next);return i}(t,e,p,i)),t.length>80*i){n=o=t[0],r=a=t[1];for(var f=i;f<h;f+=i)(s=t[f])<n&&(n=s),(l=t[f+1])<r&&(r=l),s>o&&(o=s),l>a&&(a=l);u=0!==(u=Math.max(o-n,a-r))?1/u:0}return ba(p,d,i,n,r,u),d}function xa(t,e,i,n,r){var o,a;if(r===Ga(t,e,i,n)>0)for(o=e;o<i;o+=n)a=ja(o,t[o],t[o+1],a);else for(o=i-n;o>=e;o-=n)a=ja(o,t[o],t[o+1],a);return a&&Ba(a,a.next)&&(Na(a),a=a.next),a}function va(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!Ba(n,n.next)&&0!==La(n.prev,n,n.next))n=n.next;else{if(Na(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function ba(t,e,i,n,r,o,a){if(t){!a&&o&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=Pa(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,o,a,s,l,u=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,n=i,s=0,e=0;e<u&&(s++,n=n.nextZ);e++);for(l=u;s>0||l>0&&n;)0!==s&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=n}o.nextZ=null,u*=2}while(a>1)}(r)}(t,n,r,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?Sa(t,n,r,o):wa(t))e.push(s.i/i),e.push(t.i/i),e.push(l.i/i),Na(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?ba(t=Ta(va(t),e,i),e,i,n,r,o,2):2===a&&Ea(t,e,i,n,r,o):ba(va(t),e,i,n,r,o,1);break}}}function wa(t){var e=t.prev,i=t,n=t.next;if(La(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(ka(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&La(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Sa(t,e,i,n){var r=t.prev,o=t,a=t.next;if(La(r,o,a)>=0)return!1;for(var s=r.x>o.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,l=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,u=Pa(r.x<o.x?r.x<a.x?r.x:a.x:o.x<a.x?o.x:a.x,r.y<o.y?r.y<a.y?r.y:a.y:o.y<a.y?o.y:a.y,e,i,n),c=Pa(s,l,e,i,n),h=t.prevZ,p=t.nextZ;h&&h.z>=u&&p&&p.z<=c;){if(h!==t.prev&&h!==t.next&&ka(r.x,r.y,o.x,o.y,a.x,a.y,h.x,h.y)&&La(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,p!==t.prev&&p!==t.next&&ka(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&La(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;h&&h.z>=u;){if(h!==t.prev&&h!==t.next&&ka(r.x,r.y,o.x,o.y,a.x,a.y,h.x,h.y)&&La(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;p&&p.z<=c;){if(p!==t.prev&&p!==t.next&&ka(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&La(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Ta(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!Ba(r,o)&&Da(r,n,n.next,o)&&Fa(r,o)&&Fa(o,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(o.i/i),Na(n),Na(n.next),n=t=o),n=n.next}while(n!==t);return va(n)}function Ea(t,e,i,n,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&za(a,s)){var l=Ua(a,s);return a=va(a,a.next),l=va(l,l.next),ba(a,e,i,n,r,o),void ba(l,e,i,n,r,o)}s=s.next}a=a.next}while(a!==t)}function Aa(t,e){return t.x-e.x}function Ia(t,e){var i=function(t,e){var i,n=e,r=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(o===n.y)return n;if(o===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!i)return null;if(r===a)return i;var l,u=i,c=i.x,h=i.y,p=1/0;n=i;do{r>=n.x&&n.x>=c&&r!==n.x&&ka(o<h?r:a,o,c,h,o<h?a:r,o,n.x,n.y)&&(l=Math.abs(o-n.y)/(r-n.x),Fa(n,t)&&(l<p||l===p&&(n.x>i.x||n.x===i.x&&Ca(i,n)))&&(i=n,p=l)),n=n.next}while(n!==u);return i}(t,e);if(!i)return e;var n=Ua(i,t),r=va(i,i.next);return va(n,n.next),e===i?r:e}function Ca(t,e){return La(t.prev,t,e.prev)<0&&La(e.next,t,t.next)<0}function Pa(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ma(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function ka(t,e,i,n,r,o,a,s){return(r-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(i-a)*(e-s)>=0&&(i-a)*(o-s)-(r-a)*(n-s)>=0}function za(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Da(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Fa(t,e)&&Fa(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(La(t.prev,t,e.prev)||La(t,e.prev,e))||Ba(t,e)&&La(t.prev,t,t.next)>0&&La(e.prev,e,e.next)>0)}function La(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Ba(t,e){return t.x===e.x&&t.y===e.y}function Da(t,e,i,n){var r=Oa(La(t,e,i)),o=Oa(La(t,e,n)),a=Oa(La(i,n,t)),s=Oa(La(i,n,e));return r!==o&&a!==s||!(0!==r||!Ra(t,i,e))||!(0!==o||!Ra(t,n,e))||!(0!==a||!Ra(i,t,n))||!(0!==s||!Ra(i,e,n))}function Ra(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Oa(t){return t>0?1:t<0?-1:0}function Fa(t,e){return La(t.prev,t,t.next)<0?La(t,e,t.next)>=0&&La(t,t.prev,e)>=0:La(t,e,t.prev)<0||La(t,t.next,e)<0}function Ua(t,e){var i=new Va(t.i,t.x,t.y),n=new Va(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function ja(t,e,i,n){var r=new Va(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Na(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Va(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ga(t,e,i,n){for(var r=0,o=e,a=i-n;o<i;o+=n)r+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return r}_a.exports=ya,_a.exports.default=ya,ya.deviation=function(t,e,i,n){var r=e&&e.length,o=Math.abs(Ga(t,0,r?e[0]*i:t.length,i));if(r)for(var a=0,s=e.length;a<s;a++)o-=Math.abs(Ga(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i));var l=0;for(a=0;a<n.length;a+=3){var u=n[a]*i,c=n[a+1]*i,h=n[a+2]*i;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},ya.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var a=0;a<e;a++)i.vertices.push(t[r][o][a]);r>0&&i.holes.push(n+=t[r-1].length)}return i};var qa=_a.exports;function Wa(t,e,i,n,r){!function t(e,i,n,r,o){for(;r>n;){if(r-n>600){var a=r-n+1,s=i-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);t(e,i,Math.max(n,Math.floor(i-s*u/a+c)),Math.min(r,Math.floor(i+(a-s)*u/a+c)),o)}var h=e[i],p=n,d=r;for(Za(e,n,i),o(e[r],h)>0&&Za(e,n,r);p<d;){for(Za(e,p,d),p++,d--;o(e[p],h)<0;)p++;for(;o(e[d],h)>0;)d--}0===o(e[n],h)?Za(e,n,d):Za(e,++d,r),d<=i&&(n=d+1),i<=d&&(r=d-1)}}(t,e,i||0,n||t.length-1,r||Ha)}function Za(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Ha(t,e){return t<e?-1:t>e?1:0}function $a(t,e){const i=t.length;if(i<=1)return[t];const n=[];let r,o;for(let e=0;e<i;e++){const i=g(t[e]);0!==i&&(t[e].area=Math.abs(i),void 0===o&&(o=i<0),o===i<0?(r&&n.push(r),r=[t[e]]):r.push(t[e]))}if(r&&n.push(r),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(Wa(n[t],e,1,n[t].length-1,Xa),n[t]=n[t].slice(0,e));return n}function Xa(t,e){return e.area-t.area}function Ka(t,e,i){const n=i.patternDependencies;let r=!1;for(const i of e){const e=i.paint.get(t+"-pattern");e.isConstant()||(r=!0);const o=e.constantOr(null);o&&(r=!0,n[o.to]=!0,n[o.from]=!0)}return r}function Ja(t,e,i,n,r){const o=r.patternDependencies;for(const a of e){const e=a.paint.get(t+"-pattern").value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},i,{},r.availableImages),s=e.evaluate({zoom:n},i,{},r.availableImages),l=e.evaluate({zoom:n+1},i,{},r.availableImages);t=t&&t.name?t.name:t,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,o[t]=!0,o[s]=!0,o[l]=!0,i.patterns[a.id]={min:t,mid:s,max:l}}}return i}class Ya{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Vr,this.indexArray=new Yr,this.indexArray2=new Qr,this.programConfigurations=new Io(t.layers,t.zoom),this.segments=new io,this.segments2=new io,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){this.hasPattern=Ka("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),r=!n.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Bo(a,t);if(!this.layers[0]._featureFilter.filter(new Nn(this.zoom),c,i))continue;const h=r?n.evaluate(c,{},i,e.availableImages):void 0,p={id:s,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Lo(a),patterns:{},sortKey:h};o.push(p)}r&&o.sort((t,e)=>t.sortKey-e.sortKey);for(const n of o){const{geometry:r,index:o,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Ja("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,r,o,i,{});e.featureIndex.insert(t[o].feature,r,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ga),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,e,i,n,r){for(const t of $a(e,500)){let e=0;for(const i of t)e+=i.length;const i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=i.vertexLength,r=[],o=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&o.push(r.length/2);const i=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=i.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),r.push(e[0].x),r.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),r.push(e[t].x),r.push(e[t].y);i.vertexLength+=e.length,i.primitiveLength+=e.length}const a=qa(r,o);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(n+a[t],n+a[t+1],n+a[t+2]);i.vertexLength+=e,i.primitiveLength+=a.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}}mn("FillBucket",Ya,{omit:["layers","patternFeatures"]});const Qa=new er({"fill-sort-key":new Jn(it.layout_fill["fill-sort-key"])});var ts={paint:new er({"fill-antialias":new Kn(it.paint_fill["fill-antialias"]),"fill-opacity":new Jn(it.paint_fill["fill-opacity"]),"fill-color":new Jn(it.paint_fill["fill-color"]),"fill-outline-color":new Jn(it.paint_fill["fill-outline-color"]),"fill-translate":new Kn(it.paint_fill["fill-translate"]),"fill-translate-anchor":new Kn(it.paint_fill["fill-translate-anchor"]),"fill-pattern":new Yn(it.paint_fill["fill-pattern"])}),layout:Qa};const es=sr([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:is}=es;var ns={},rs=E,os=as;function as(t,e,i,n,r){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=r,t.readFields(ss,this,e)}function ss(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var n=e._keys[t.readVarint()],r=e._values[t.readVarint()];e.properties[n]=r}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function ls(t){for(var e,i,n=0,r=0,o=t.length,a=o-1;r<o;a=r++)n+=((i=t[a]).x-(e=t[r]).x)*(e.y+i.y);return n}as.types=["Unknown","Point","LineString","Polygon"],as.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,n=1,r=0,o=0,a=0,s=[];t.pos<i;){if(r<=0){var l=t.readVarint();n=7&l,r=l>>3}if(r--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new rs(o,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},as.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,r=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();i=7&c,n=c>>3}if(n--,1===i||2===i)(r+=t.readSVarint())<a&&(a=r),r>s&&(s=r),(o+=t.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,u]},as.prototype.toGeoJSON=function(t,e,i){var n,r,o=this.extent*Math.pow(2,i),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=as.types[this.type];function c(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+a)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+s)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,n,r=[],o=0;o<e;o++){var a=ls(t[o]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(i&&r.push(i),i=[t[o]]):i.push(t[o]))}return i&&r.push(i),r}(l),n=0;n<l.length;n++)for(r=0;r<l[n].length;r++)c(l[n][r])}1===l.length?l=l[0]:u="Multi"+u;var p={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var us=os,cs=hs;function hs(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ps,this,e),this.length=this._features.length}function ps(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(i))}hs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new us(this._pbf,e,this.extent,this._keys,this._values)};var ds=cs;function fs(t,e,i){if(3===t){var n=new ds(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}ns.VectorTile=function(t,e){this.layers=t.readFields(fs,{},e)},ns.VectorTileFeature=os,ns.VectorTileLayer=cs;const ms=ns.VectorTileFeature.types,gs=Math.pow(2,13);function _s(t,e,i,n,r,o,a,s){t.emplaceBack(e,i,2*Math.floor(n*gs)+a,r*gs*2,o*gs*2,Math.round(s))}class ys{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Gr,this.indexArray=new Yr,this.programConfigurations=new Io(t.layers,t.zoom),this.segments=new io,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){this.features=[],this.hasPattern=Ka("fill-extrusion",this.layers,e);for(const{feature:n,id:r,index:o,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,s=Bo(n,t);if(!this.layers[0]._featureFilter.filter(new Nn(this.zoom),s,i))continue;const l={id:r,sourceLayerIndex:a,index:o,geometry:t?s.geometry:Lo(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(Ja("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,o,i,{}),e.featureIndex.insert(n,l.geometry,o,a,this.index,!0)}}addFeatures(t,e,i){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,i)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,is),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,n,r){for(const i of $a(e,500)){let e=0;for(const t of i)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(vs(t))continue;let e=0;for(let i=0;i<t.length;i++){const r=t[i];if(i>=1){const o=t[i-1];if(!xs(r,o)){n.vertexLength+4>io.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=r.sub(o)._perp()._unit(),i=o.dist(r);e+i>32768&&(e=0),_s(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,0,e),_s(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,1,e),e+=i,_s(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,0,e),_s(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,1,e);const a=n.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>io.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==ms[t.type])continue;const r=[],o=[],a=n.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&o.push(r.length/2);for(let e=0;e<t.length;e++){const i=t[e];_s(this.layoutVertexArray,i.x,i.y,0,0,1,1,0),r.push(i.x),r.push(i.y)}}const s=qa(r,o);for(let t=0;t<s.length;t+=3)this.indexArray.emplaceBack(a+s[t],a+s[t+2],a+s[t+1]);n.primitiveLength+=s.length/3,n.vertexLength+=e}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}}function xs(t,e){return t.x===e.x&&(t.x<0||t.x>Mo)||t.y===e.y&&(t.y<0||t.y>Mo)}function vs(t){return t.every(t=>t.x<0)||t.every(t=>t.x>Mo)||t.every(t=>t.y<0)||t.every(t=>t.y>Mo)}mn("FillExtrusionBucket",ys,{omit:["layers","features"]});var bs={paint:new er({"fill-extrusion-opacity":new Kn(it["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Jn(it["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Kn(it["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Kn(it["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Yn(it["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Jn(it["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Jn(it["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Kn(it["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function ws(t,e){return t.x*e.x+t.y*e.y}function Ss(t,e){if(1===t.length){let i=0;const n=e[i++];let r;for(;!r||n.equals(r);)if(r=e[i++],!r)return 1/0;for(;i<e.length;i++){const o=e[i],a=t[0],s=r.sub(n),l=o.sub(n),u=a.sub(n),c=ws(s,s),h=ws(s,l),p=ws(l,l),d=ws(u,s),f=ws(u,l),m=c*p-h*h,g=(p*d-h*f)/m,_=(c*f-h*d)/m,y=n.z*(1-g-_)+r.z*g+o.z*_;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}const Ts=sr([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Es}=Ts,As=sr([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Is}=As,Cs=ns.VectorTileFeature.types,Ps=Math.cos(Math.PI/180*37.5),Ms=Math.pow(2,14)/.5;class ks{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new qr,this.layoutVertexArray2=new Wr,this.indexArray=new Yr,this.programConfigurations=new Io(t.layers,t.zoom),this.segments=new io,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){this.hasPattern=Ka("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),r=!n.isConstant(),o=[];for(const{feature:e,id:a,index:s,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Bo(e,t);if(!this.layers[0]._featureFilter.filter(new Nn(this.zoom),u,i))continue;const c=r?n.evaluate(u,{},i):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:s,geometry:t?u.geometry:Lo(e),patterns:{},sortKey:c};o.push(h)}r&&o.sort((t,e)=>t.sortKey-e.sortKey);for(const n of o){const{geometry:r,index:o,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Ja("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,r,o,i,{});e.featureIndex.insert(t[o].feature,r,o,a,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Is)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Es),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,i,n,r){const o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),s=o.get("line-cap"),l=o.get("line-miter-limit"),u=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,a,s,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}addLine(t,e,i,n,r,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const a="Polygon"===Cs[e.type];let s=t.length;for(;s>=2&&t[s-1].equals(t[s-2]);)s--;let l=0;for(;l<s-1&&t[l].equals(t[l+1]);)l++;if(s<(a?3:2))return;"bevel"===i&&(r=1.05);const u=this.overscaling<=16?122880/(512*this.overscaling):0,c=this.segments.prepareSegment(10*s,this.layoutVertexArray,this.indexArray);let h,p,d,f,m;this.e1=this.e2=-1,a&&(h=t[s-2],m=t[l].sub(h)._unit()._perp());for(let e=l;e<s;e++){if(d=e===s-1?a?t[l+1]:void 0:t[e+1],d&&t[e].equals(d))continue;m&&(f=m),h&&(p=h),h=t[e],m=d?d.sub(h)._unit()._perp():f,f=f||m;let g=f.add(m);0===g.x&&0===g.y||g._unit();const _=f.x*m.x+f.y*m.y,y=g.x*m.x+g.y*m.y,x=0!==y?1/y:1/0,v=2*Math.sqrt(2-2*y),b=y<Ps&&p&&d,w=f.x*m.y-f.y*m.x>0;if(b&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,f,0,0,c),p=e}}const S=p&&d;let T=S?i:a?"butt":n;if(S&&"round"===T&&(x<o?T="miter":x<=2&&(T="fakeround")),"miter"===T&&x>r&&(T="bevel"),"bevel"===T&&(x>2&&(T="flipbevel"),x<r&&(T="miter")),p&&this.updateDistance(p,h),"miter"===T)g._mult(x),this.addCurrentVertex(h,g,0,0,c);else if("flipbevel"===T){if(x>100)g=m.mult(-1);else{const t=x*f.add(m).mag()/f.sub(m).mag();g._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(h,g,0,0,c),this.addCurrentVertex(h,g.mult(-1),0,0,c)}else if("bevel"===T||"fakeround"===T){const t=-Math.sqrt(x*x-1),e=w?t:0,i=w?0:t;if(p&&this.addCurrentVertex(h,f,e,i,c),"fakeround"===T){const t=Math.round(180*v/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+_*(_*(3.55645-1.43519*_)-3.2452))*t*t+(.848013+_*(.215638*_-1.06021)))}const n=m.sub(f)._mult(i)._add(f)._unit()._mult(w?-1:1);this.addHalfVertex(h,n.x,n.y,!1,w,0,c)}}d&&this.addCurrentVertex(h,m,-e,-i,c)}else if("butt"===T)this.addCurrentVertex(h,g,0,0,c);else if("square"===T){const t=p?1:-1;this.addCurrentVertex(h,g,t,t,c)}else"round"===T&&(p&&(this.addCurrentVertex(h,f,0,0,c),this.addCurrentVertex(h,f,1,1,c,!0)),d&&(this.addCurrentVertex(h,m,-1,-1,c,!0),this.addCurrentVertex(h,m,0,0,c)));if(b&&e<s-1){const t=h.dist(d);if(t>2*u){const e=h.add(d.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,m,0,0,c),h=e}}}}addCurrentVertex(t,e,i,n,r,o=!1){const a=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,r),this.addHalfVertex(t,a,s,o,!0,-n,r),this.distance>Ms/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,i,n,r,o))}addHalfVertex({x:t,y:e},i,n,r,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(Ms-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(r?1:0),(e<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*n)+128,1+(0===a?0:a<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 u=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),s.primitiveLength++),o?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}mn("LineBucket",ks,{omit:["layers","patternFeatures"]});const zs=new er({"line-cap":new Kn(it.layout_line["line-cap"]),"line-join":new Jn(it.layout_line["line-join"]),"line-miter-limit":new Kn(it.layout_line["line-miter-limit"]),"line-round-limit":new Kn(it.layout_line["line-round-limit"]),"line-sort-key":new Jn(it.layout_line["line-sort-key"])});var Ls={paint:new er({"line-opacity":new Jn(it.paint_line["line-opacity"]),"line-color":new Jn(it.paint_line["line-color"]),"line-translate":new Kn(it.paint_line["line-translate"]),"line-translate-anchor":new Kn(it.paint_line["line-translate-anchor"]),"line-width":new Jn(it.paint_line["line-width"]),"line-gap-width":new Jn(it.paint_line["line-gap-width"]),"line-offset":new Jn(it.paint_line["line-offset"]),"line-blur":new Jn(it.paint_line["line-blur"]),"line-dasharray":new Qn(it.paint_line["line-dasharray"]),"line-pattern":new Yn(it.paint_line["line-pattern"]),"line-gradient":new tr(it.paint_line["line-gradient"])}),layout:zs};const Bs=new class extends Jn{possiblyEvaluate(t,e){return e=new Nn(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,n){return e=s({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,n)}}(Ls.paint.properties["line-width"].specification);function Ds(t,e){return e>0?e+2*t:t}Bs.useIntegerZoom=!0;const Rs=sr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Os=sr([{name:"a_projected_pos",components:3,type:"Float32"}],4);sr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Fs=sr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);sr([{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 Us=sr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),js=sr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ns(t,e,i){return t.sections.forEach(t=>{t.text=function(t,e,i){const n=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),jn.applyArabicShaping&&(t=jn.applyArabicShaping(t)),t}(t.text,e,i)}),t}sr([{name:"triangle",components:3,type:"Uint16"}]),sr([{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"}]),sr([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),sr([{type:"Float32",name:"offsetX"}]),sr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Vs={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Gs=Zs,qs=function(t,e,i,n,r){var o,a,s=8*r-n-1,l=(1<<s)-1,u=l>>1,c=-7,h=i?r-1:0,p=i?-1:1,d=t[e+h];for(h+=p,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=u}return(d?-1:1)*a*Math.pow(2,o-n)},Ws=function(t,e,i,n,r,o){var a,s,l,u=8*o-r-1,c=(1<<u)-1,h=c>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,f=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,r),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,r),a=0));r>=8;t[i+d]=255&s,d+=f,s/=256,r-=8);for(a=a<<r|s,u+=r;u>0;t[i+d]=255&a,d+=f,a/=256,u-=8);t[i+d-f]|=128*m};function Zs(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Zs.Varint=0,Zs.Fixed64=1,Zs.Bytes=2,Zs.Fixed32=5;var Hs,$s=4294967296,Xs=1/$s,Ks="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Js(t){return t.type===Zs.Bytes?t.readVarint()+t.pos:t.pos+1}function Ys(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Qs(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function tl(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function el(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function il(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function nl(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function rl(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function ol(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function al(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function sl(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function ll(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function ul(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function cl(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function hl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function pl(t,e,i){1===t&&i.readMessage(dl,e)}function dl(t,e,i){if(3===t){const{id:t,bitmap:n,width:r,height:o,left:a,top:s,advance:l}=i.readMessage(fl,{});e.push({id:t,bitmap:new ha({width:r+6,height:o+6},n),metrics:{width:r,height:o,left:a,top:s,advance:l}})}}function fl(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}function ml(t){let e=0,i=0;for(const n of t)e+=n.w*n.h,i=Math.max(i,n.w);t.sort((t,e)=>e.h-t.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let r=0,o=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const i=n[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,o=Math.max(o,e.y+e.h),r=Math.max(r,e.x+e.w),e.w===i.w&&e.h===i.h){const e=n.pop();t<n.length&&(n[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(n.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:r,h:o,fill:e/(r*o)||0}}Zs.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),r=n>>3,o=this.pos;this.type=7&n,t(r,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=ul(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=hl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=ul(this.buf,this.pos)+ul(this.buf,this.pos+4)*$s;return this.pos+=8,t},readSFixed64:function(){var t=ul(this.buf,this.pos)+hl(this.buf,this.pos+4)*$s;return this.pos+=8,t},readFloat:function(){var t=qs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=qs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,o=i.buf;if(n=(112&(r=o[i.pos++]))>>4,r<128)return Ys(t,n,e);if(n|=(127&(r=o[i.pos++]))<<3,r<128)return Ys(t,n,e);if(n|=(127&(r=o[i.pos++]))<<10,r<128)return Ys(t,n,e);if(n|=(127&(r=o[i.pos++]))<<17,r<128)return Ys(t,n,e);if(n|=(127&(r=o[i.pos++]))<<24,r<128)return Ys(t,n,e);if(n|=(1&(r=o[i.pos++]))<<31,r<128)return Ys(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ks?function(t,e,i){return Ks.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var n="",r=e;r<i;){var o,a,s,l=t[r],u=null,c=l>239?4:l>223?3:l>191?2:1;if(r+c>i)break;1===c?l<128&&(u=l):2===c?128==(192&(o=t[r+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(a=t[r+2],128==(192&(o=t[r+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&o)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[r+2],s=t[r+3],128==(192&(o=t[r+1]))&&128==(192&a)&&128==(192&s)&&((u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),r+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Zs.Bytes)return t.push(this.readVarint(e));var i=Js(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Zs.Bytes)return t.push(this.readSVarint());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Zs.Bytes)return t.push(this.readBoolean());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Zs.Bytes)return t.push(this.readFloat());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Zs.Bytes)return t.push(this.readDouble());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Zs.Bytes)return t.push(this.readFixed32());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Zs.Bytes)return t.push(this.readSFixed32());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Zs.Bytes)return t.push(this.readFixed64());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Zs.Bytes)return t.push(this.readSFixed64());var e=Js(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Zs.Varint)for(;this.buf[this.pos++]>127;);else if(e===Zs.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Zs.Fixed32)this.pos+=4;else{if(e!==Zs.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),cl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),cl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),cl(this.buf,-1&t,this.pos),cl(this.buf,Math.floor(t*Xs),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),cl(this.buf,-1&t,this.pos),cl(this.buf,Math.floor(t*Xs),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,i){for(var n,r,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!r){n>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Qs(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),Ws(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Ws(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&Qs(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,Zs.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,tl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,el,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,rl,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,il,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,nl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ol,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,al,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,sl,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,ll,e)},writeBytesField:function(t,e){this.writeTag(t,Zs.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Zs.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Zs.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Zs.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Zs.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Zs.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class gl{constructor(t,{pixelRatio:e,version:i,stretchX:n,stretchY:r,content:o}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=r,this.content=o,this.version=i}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 _l{constructor(t,e){const i={},n={};this.haveRenderCallbacks=[];const r=[];this.addImages(t,i,r),this.addImages(e,n,r);const{w:o,h:a}=ml(r),s=new pa({width:o||1,height:a||1});for(const e in t){const n=t[e],r=i[e].paddedRect;pa.copy(n.data,s,{x:0,y:0},{x:r.x+1,y:r.y+1},n.data)}for(const t in e){const i=e[t],r=n[t].paddedRect,o=r.x+1,a=r.y+1,l=i.data.width,u=i.data.height;pa.copy(i.data,s,{x:0,y:0},{x:o,y:a},i.data),pa.copy(i.data,s,{x:0,y:u-1},{x:o,y:a-1},{width:l,height:1}),pa.copy(i.data,s,{x:0,y:0},{x:o,y:a+u},{width:l,height:1}),pa.copy(i.data,s,{x:l-1,y:0},{x:o-1,y:a},{width:1,height:u}),pa.copy(i.data,s,{x:0,y:0},{x:o+l,y:a},{width:1,height:u})}this.image=s,this.iconPositions=i,this.patternPositions=n}addImages(t,e,i){for(const n in t){const r=t[n],o={x:0,y:0,w:r.data.width+2,h:r.data.height+2};i.push(o),e[n]=new gl(o,r),r.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,r]=t.tl;i.update(e.data,void 0,{x:n,y:r})}}mn("ImagePosition",gl),mn("ImageAtlas",_l),t.WritingMode=void 0,(Hs=t.WritingMode||(t.WritingMode={}))[Hs.none=0]="none",Hs[Hs.horizontal=1]="horizontal",Hs[Hs.vertical=2]="vertical",Hs[Hs.horizontalOnly=3]="horizontalOnly";class yl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const i=new yl;return i.scale=t||1,i.fontStack=e,i}static forImage(t){const e=new yl;return e.imageName=t,e}}class xl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new xl;for(let n=0;n<t.sections.length;n++){const r=t.sections[n];r.image?i.addImageSection(r):i.addTextSection(r,e)}return i}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let i=0;i<t.length;i++){const n=t.charCodeAt(i+1)||null,r=t.charCodeAt(i-1)||null;e+=n&&En(n)&&!Vs[t[i+1]]||r&&En(r)&&!Vs[t[i-1]]||!Vs[t[i]]?t[i]:Vs[t[i]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&bl[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=0&&i>=t&&bl[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new xl;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,e)=>Math.max(t,this.sections[e].scale),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(yl.forText(t.scale,t.fontStack||e));const i=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(i)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void f("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(yl.forImage(e)),this.sectionIndex.push(this.sections.length-1)):f("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function vl(e,i,n,r,o,a,s,l,u,c,h,p,d,f,m,g){const _=xl.fromFeature(e,o);let y;p===t.WritingMode.vertical&&_.verticalizePunctuation();const{processBidirectionalText:x,processStyledBidirectionalText:v}=jn;if(x&&1===_.sections.length){y=[];const t=x(_.toString(),Il(_,c,a,i,r,f,m));for(const e of t){const t=new xl;t.text=e,t.sections=_.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);y.push(t)}}else if(v){y=[];const t=v(_.text,_.sectionIndex,Il(_,c,a,i,r,f,m));for(const e of t){const t=new xl;t.text=e[0],t.sectionIndex=e[1],t.sections=_.sections,y.push(t)}}else y=function(t,e){const i=[],n=t.text;let r=0;for(const n of e)i.push(t.substring(r,n)),r=n;return r<n.length&&i.push(t.substring(r,n.length)),i}(_,Il(_,c,a,i,r,f,m));const b=[],w={positionedLines:b,text:_.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(e,i,n,r,o,a,s,l,u,c,h,p){let d=0,f=-17,m=0,g=0;const _="right"===l?1:"left"===l?0:.5;let y=0;for(const s of o){s.trim();const o=s.getMaxScale(),l=24*(o-1),v={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=v;const b=v.positionedGlyphs;let w=0;if(!s.length()){f+=a,++y;continue}for(let a=0;a<s.length();a++){const m=s.getSection(a),g=s.getSectionIndex(a),_=s.getCharCode(a);let y=0,v=null,S=null,T=null,E=24;const A=!(u===t.WritingMode.horizontal||!h&&!Tn(_)||h&&(bl[_]||(x=_,vn.Arabic(x)||vn["Arabic Supplement"](x)||vn["Arabic Extended-A"](x)||vn["Arabic Presentation Forms-A"](x)||vn["Arabic Presentation Forms-B"](x))));if(m.imageName){const t=r[m.imageName];if(!t)continue;T=m.imageName,e.iconsInText=e.iconsInText||!0,S=t.paddedRect;const i=t.displaySize;m.scale=24*m.scale/p,v={width:i[0],height:i[1],left:1,top:-3,advance:A?i[1]:i[0]},y=l+(24-i[1]*m.scale),E=v.advance;const n=A?i[0]*m.scale-24*o:i[1]*m.scale-24*o;n>0&&n>w&&(w=n)}else{const t=n[m.fontStack],e=t&&t[_];if(e&&e.rect)S=e.rect,v=e.metrics;else{const t=i[m.fontStack],e=t&&t[_];if(!e)continue;v=e.metrics}y=24*(o-m.scale)}A?(e.verticalizable=!0,b.push({glyph:_,imageName:T,x:d,y:f+y,vertical:A,scale:m.scale,fontStack:m.fontStack,sectionIndex:g,metrics:v,rect:S}),d+=E*m.scale+c):(b.push({glyph:_,imageName:T,x:d,y:f+y,vertical:A,scale:m.scale,fontStack:m.fontStack,sectionIndex:g,metrics:v,rect:S}),d+=v.advance*m.scale+c)}0!==b.length&&(m=Math.max(d-c,m),Pl(b,0,b.length-1,_,w)),d=0;const S=a*o+w;v.lineOffset=Math.max(w,l),f+=S,g=Math.max(S,g),++y}var x;const v=f- -17,{horizontalAlign:b,verticalAlign:w}=Cl(s);(function(t,e,i,n,r,o,a,s,l){const u=(e-i)*r;let c=0;c=o!==a?-s*n- -17:(-n*l+.5)*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c})(e.positionedLines,_,b,w,m,g,a,v,o.length),e.top+=-w*v,e.bottom=e.top+v,e.left+=-b*m,e.right=e.left+m}(w,i,n,r,y,s,l,u,p,c,d,g),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const bl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},wl={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Sl(t,e,i,n,r,o){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*24/o+r:0}{const n=i[e.fontStack],o=n&&n[t];return o?o.metrics.advance*e.scale+r:0}}function Tl(t,e,i,n){const r=Math.pow(t-e,2);return n?t<e?r/2:2*r:r+Math.abs(i)*i}function El(t,e,i){let n=0;return 10===t&&(n-=1e4),i&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Al(t,e,i,n,r,o){let a=null,s=Tl(e,i,r,o);for(const t of n){const n=Tl(e-t.x,i,r,o)+t.badness;n<=s&&(a=t,s=n)}return{index:t,x:e,priorBreak:a,badness:s}}function Il(t,e,i,n,r,o,a){if("point"!==o)return[];if(!t)return[];const s=[],l=function(t,e,i,n,r,o){let a=0;for(let i=0;i<t.length();i++){const s=t.getSection(i);a+=Sl(t.getCharCode(i),s,n,r,e,o)}return a/Math.max(1,Math.ceil(a/i))}(t,e,i,n,r,a),u=t.text.indexOf("​")>=0;let c=0;for(let i=0;i<t.length();i++){const o=t.getSection(i),p=t.getCharCode(i);if(bl[p]||(c+=Sl(p,o,n,r,e,a)),i<t.length()-1){const e=!((h=p)<11904||!(vn["Bopomofo Extended"](h)||vn.Bopomofo(h)||vn["CJK Compatibility Forms"](h)||vn["CJK Compatibility Ideographs"](h)||vn["CJK Compatibility"](h)||vn["CJK Radicals Supplement"](h)||vn["CJK Strokes"](h)||vn["CJK Symbols and Punctuation"](h)||vn["CJK Unified Ideographs Extension A"](h)||vn["CJK Unified Ideographs"](h)||vn["Enclosed CJK Letters and Months"](h)||vn["Halfwidth and Fullwidth Forms"](h)||vn.Hiragana(h)||vn["Ideographic Description Characters"](h)||vn["Kangxi Radicals"](h)||vn["Katakana Phonetic Extensions"](h)||vn.Katakana(h)||vn["Vertical Forms"](h)||vn["Yi Radicals"](h)||vn["Yi Syllables"](h)));(wl[p]||e||o.imageName)&&s.push(Al(i+1,c,l,s,El(p,t.getCharCode(i+1),e&&u),!1))}}var h;return function t(e){return e?t(e.priorBreak).concat(e.index):[]}(Al(t.length(),c,l,s,0,!0))}function Cl(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Pl(t,e,i,n,r){if(!n&&!r)return;const o=t[i],a=(t[i].x+o.metrics.advance*o.scale)*n;for(let n=e;n<=i;n++)t[n].x-=a,t[n].y+=r}function Ml(t,e,i){const{horizontalAlign:n,verticalAlign:r}=Cl(i),o=e[0]-t.displaySize[0]*n,a=e[1]-t.displaySize[1]*r;return{image:t,top:a,bottom:a+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function kl(t,e,i,n,r,o){const a=t.image;let s;if(a.content){const t=a.content,e=a.pixelRatio||1;s=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*o,u=e.right*o;let c,h,p,d;"width"===i||"both"===i?(d=r[0]+l-n[3],h=r[0]+u+n[1]):(d=r[0]+(l+u-a.displaySize[0])/2,h=d+a.displaySize[0]);const f=e.top*o,m=e.bottom*o;return"height"===i||"both"===i?(c=r[1]+f-n[0],p=r[1]+m+n[2]):(c=r[1]+(f+m-a.displaySize[1])/2,p=c+a.displaySize[1]),{image:a,top:c,right:h,bottom:p,left:d,collisionPadding:s}}const zl=128;function Ll(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Nn(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=i;let r=0;for(;r<e.length&&e[r]<=t;)r++;r=Math.max(0,r-1);let o=r;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const a=e[r],s=e[o];return"composite"===i.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:s,minSize:i.evaluate(new Nn(a)),maxSize:i.evaluate(new Nn(s)),interpolationType:n}}}class Bl extends E{constructor(t,e,i,n){super(t,e),this.angle=i,void 0!==n&&(this.segment=n)}clone(){return new Bl(this.x,this.y,this.angle,this.segment)}}function Dl(t,e,i,n,r){if(void 0===e.segment)return!0;let o=e,a=e.segment+1,s=0;for(;s>-i/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;s<i/2;){const e=t[a],i=t[a+1];if(!i)return!1;let o=t[a-1].angleTo(e)-e.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:o}),u+=o;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>r)return!1;a++,s+=e.dist(i)}return!0}function Rl(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function Ol(t,e,i){return t?.6*e*i:0}function Fl(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Ul(t,e,i,n,r,o){const a=Ol(i,r,o),s=Fl(i,n)*o;let l=0;const u=Rl(t)/2;for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1],o=n.dist(r);if(l+o>u){const c=(u-l)/o,h=Se(n.x,r.x,c),p=Se(n.y,r.y,c),d=new Bl(h,p,r.angleTo(n),i);return d._round(),!a||Dl(t,d,s,a,e)?d:void 0}l+=o}}function jl(t,e,i,n,r,o,a,s,l){const u=Ol(n,o,a),c=Fl(n,r),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),function t(e,i,n,r,o,a,s,l,u){const c=a/2,h=Rl(e);let p=0,d=i-n,f=[];for(let t=0;t<e.length-1;t++){const i=e[t],s=e[t+1],l=i.dist(s),m=s.angleTo(i);for(;d+n<p+l;){d+=n;const g=(d-p)/l,_=Se(i.x,s.x,g),y=Se(i.y,s.y,g);if(_>=0&&_<u&&y>=0&&y<u&&d-c>=0&&d+c<=h){const i=new Bl(_,y,m,t);i._round(),r&&!Dl(e,i,a,r,o)||f.push(i)}}p+=l}return l||f.length||s||(f=t(e,p/2,n,r,o,a,s,!0,u)),f}(t,p?e/2*s%e:(c/2+2*o)*a*s%e,e,u,i,h,p,!1,l)}function Nl(t,e,i,n,r){const o=[];for(let a=0;a<t.length;a++){const s=t[a];let l;for(let t=0;t<s.length-1;t++){let a=s[t],u=s[t+1];a.x<e&&u.x<e||(a.x<e?a=new E(e,a.y+(e-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x<e&&(u=new E(e,a.y+(e-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y<i&&u.y<i||(a.y<i?a=new E(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round():u.y<i&&(u=new E(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round()),a.x>=n&&u.x>=n||(a.x>=n?a=new E(n,a.y+(n-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x>=n&&(u=new E(n,a.y+(n-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y>=r&&u.y>=r||(a.y>=r?a=new E(a.x+(r-a.y)/(u.y-a.y)*(u.x-a.x),r)._round():u.y>=r&&(u=new E(a.x+(r-a.y)/(u.y-a.y)*(u.x-a.x),r)._round()),l&&a.equals(l[l.length-1])||(l=[a],o.push(l)),l.push(u)))))}}return o}function Vl(t,e,i,n){const r=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2,l=o.paddedRect.h-2,u=t.right-t.left,c=t.bottom-t.top,h=o.stretchX||[[0,s]],p=o.stretchY||[[0,l]],d=(t,e)=>t+e[1]-e[0],f=h.reduce(d,0),m=p.reduce(d,0),g=s-f,_=l-m;let y=0,x=f,v=0,b=m,w=0,S=g,T=0,A=_;if(o.content&&n){const t=o.content;y=Gl(h,0,t[0]),v=Gl(p,0,t[1]),x=Gl(h,t[0],t[2]),b=Gl(p,t[1],t[3]),w=t[0]-y,T=t[1]-v,S=t[2]-t[0]-x,A=t[3]-t[1]-b}const I=(n,r,s,l)=>{const h=Wl(n.stretch-y,x,u,t.left),p=Zl(n.fixed-w,S,n.stretch,f),d=Wl(r.stretch-v,b,c,t.top),g=Zl(r.fixed-T,A,r.stretch,m),_=Wl(s.stretch-y,x,u,t.left),I=Zl(s.fixed-w,S,s.stretch,f),C=Wl(l.stretch-v,b,c,t.top),P=Zl(l.fixed-T,A,l.stretch,m),M=new E(h,d),k=new E(_,d),z=new E(_,C),L=new E(h,C),B=new E(p/a,g/a),D=new E(I/a,P/a),R=e*Math.PI/180;if(R){const t=Math.sin(R),e=Math.cos(R),i=[e,-t,t,e];M._matMult(i),k._matMult(i),L._matMult(i),z._matMult(i)}const O=n.stretch+n.fixed,F=r.stretch+r.fixed;return{tl:M,tr:k,bl:L,br:z,tex:{x:o.paddedRect.x+1+O,y:o.paddedRect.y+1+F,w:s.stretch+s.fixed-O,h:l.stretch+l.fixed-F},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:B,pixelOffsetBR:D,minFontScaleX:S/a/u,minFontScaleY:A/a/c,isSDF:i}};if(n&&(o.stretchX||o.stretchY)){const t=ql(h,g,f),e=ql(p,_,m);for(let i=0;i<t.length-1;i++){const n=t[i],o=t[i+1];for(let t=0;t<e.length-1;t++)r.push(I(n,e[t],o,e[t+1]))}}else r.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));return r}function Gl(t,e,i){let n=0;for(const r of t)n+=Math.max(e,Math.min(i,r[1]))-Math.max(e,Math.min(i,r[0]));return n}function ql(t,e,i){const n=[{fixed:-1,stretch:0}];for(const[e,i]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(i-e)})}return n.push({fixed:e+1,stretch:i}),n}function Wl(t,e,i,n){return t/e*i+n}function Zl(t,e,i,n){return t-e*i/n}mn("Anchor",Bl);class Hl{constructor(t,e,i,n,r,o,a,s,l,u){if(this.boxStartIndex=t.length,l){let t=o.top,e=o.bottom;const i=o.collisionPadding;i&&(t-=i[1],e+=i[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let l=o.top*a-s,c=o.bottom*a+s,h=o.left*a-s,p=o.right*a+s;const d=o.collisionPadding;if(d&&(h-=d[0]*a,l-=d[1]*a,p+=d[2]*a,c+=d[3]*a),u){const t=new E(h,l),e=new E(p,l),i=new E(h,c),n=new E(p,c),r=u*Math.PI/180;t._rotate(r),e._rotate(r),i._rotate(r),n._rotate(r),h=Math.min(t.x,e.x,i.x,n.x),p=Math.max(t.x,e.x,i.x,n.x),l=Math.min(t.y,e.y,i.y,n.y),c=Math.max(t.y,e.y,i.y,n.y)}t.emplaceBack(e.x,e.y,h,l,p,c,i,n,r)}this.boxEndIndex=t.length}}class $l{constructor(t=[],e=Xl){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,n=e[t];for(;t>0;){const r=t-1>>1,o=e[r];if(i(n,o)>=0)break;e[t]=o,t=r}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let n=1+(t<<1),o=e[n];const a=n+1;if(a<this.length&&i(e[a],o)<0&&(n=a,o=e[a]),i(o,r)>=0)break;e[t]=o,t=n}e[t]=r}}function Xl(t,e){return t<e?-1:t>e?1:0}function Kl(t,e=1,i=!1){let n=1/0,r=1/0,o=-1/0,a=-1/0;const s=t[0];for(let t=0;t<s.length;t++){const e=s[t];(!t||e.x<n)&&(n=e.x),(!t||e.y<r)&&(r=e.y),(!t||e.x>o)&&(o=e.x),(!t||e.y>a)&&(a=e.y)}const l=Math.min(o-n,a-r);let u=l/2;const c=new $l([],Jl);if(0===l)return new E(n,r);for(let e=n;e<o;e+=l)for(let i=r;i<a;i+=l)c.push(new Yl(e+u,i+u,u,t));let h=function(t){let e=0,i=0,n=0;const r=t[0];for(let t=0,o=r.length,a=o-1;t<o;a=t++){const o=r[t],s=r[a],l=o.x*s.y-s.x*o.y;i+=(o.x+s.x)*l,n+=(o.y+s.y)*l,e+=3*l}return new Yl(i/e,n/e,0,t)}(t),p=c.length;for(;c.length;){const n=c.pop();(n.d>h.d||!h.d)&&(h=n,i&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,p)),n.max-h.d<=e||(u=n.h/2,c.push(new Yl(n.p.x-u,n.p.y-u,u,t)),c.push(new Yl(n.p.x+u,n.p.y-u,u,t)),c.push(new Yl(n.p.x-u,n.p.y+u,u,t)),c.push(new Yl(n.p.x+u,n.p.y+u,u,t)),p+=4)}return i&&(console.log("num probes: "+p),console.log("best distance: "+h.d)),h.p}function Jl(t,e){return e.max-t.max}function Yl(t,e,i,n){this.p=new E(t,e),this.h=i,this.d=function(t,e){let i=!1,n=1/0;for(let r=0;r<e.length;r++){const o=e[r];for(let e=0,r=o.length,a=r-1;e<r;a=e++){const r=o[e],s=o[a];r.y>t.y!=s.y>t.y&&t.x<(s.x-r.x)*(t.y-r.y)/(s.y-r.y)+r.x&&(i=!i),n=Math.min(n,qo(t,r,s))}}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}const Ql=Number.POSITIVE_INFINITY;function tu(t,e){return e[1]!==Ql?function(t,e,i){let n=0,r=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":r=i-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-i}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,r]}(t,e[0],e[1]):function(t,e){let i=0,n=0;e<0&&(e=0);const r=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":i=-r;break;case"top-left":case"bottom-left":i=r;break;case"left":i=e;break;case"right":i=-e}return[i,n]}(t,e[0])}function eu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function iu(e,i,n,r,o,a,s,l,u,c,h){let p=a.textMaxSize.evaluate(i,{});void 0===p&&(p=s);const d=e.layers[0].layout,m=d.get("icon-offset").evaluate(i,{},h),g=ou(n.horizontal),_=s/24,y=e.tilePixelRatio*_,x=e.tilePixelRatio*p/24,v=e.tilePixelRatio*l,b=e.tilePixelRatio*d.get("symbol-spacing"),w=d.get("text-padding")*e.tilePixelRatio,S=d.get("icon-padding")*e.tilePixelRatio,T=d.get("text-max-angle")/180*Math.PI,E="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),A="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),I=d.get("symbol-placement"),C=b/2,P=d.get("icon-text-fit");let M;r&&"none"!==P&&(e.allowVerticalPlacement&&n.vertical&&(M=kl(r,n.vertical,P,d.get("icon-text-fit-padding"),m,_)),g&&(r=kl(r,g,P,d.get("icon-text-fit-padding"),m,_)));const k=(l,p)=>{p.x<0||p.x>=Mo||p.y<0||p.y>=Mo||function(e,i,n,r,o,a,s,l,u,c,h,p,d,m,g,_,y,x,v,b,w,S,T,E,A){const I=e.addToLineVertexArray(i,n);let C,P,M,k,z=0,L=0,B=0,D=0,R=-1,O=-1;const F={};let U=co(""),j=0,N=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[j,N]=l.layout.get("text-offset").evaluate(w,{},E).map(t=>24*t):(j=24*l.layout.get("text-radial-offset").evaluate(w,{},E),N=Ql),e.allowVerticalPlacement&&r.vertical){const t=l.layout.get("text-rotate").evaluate(w,{},E)+90;M=new Hl(u,i,c,h,p,r.vertical,d,m,g,t),s&&(k=new Hl(u,i,c,h,p,s,y,x,g,t))}if(o){const n=l.layout.get("icon-rotate").evaluate(w,{}),r="none"!==l.layout.get("icon-text-fit"),a=Vl(o,n,T,r),d=s?Vl(s,n,T,r):void 0;P=new Hl(u,i,c,h,p,o,y,x,!1,n),z=4*a.length;const m=e.iconSizeData;let g=null;"source"===m.kind?(g=[zl*l.layout.get("icon-size").evaluate(w,{})],g[0]>nu&&f(e.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".')):"composite"===m.kind&&(g=[zl*S.compositeIconSizes[0].evaluate(w,{},E),zl*S.compositeIconSizes[1].evaluate(w,{},E)],(g[0]>nu||g[1]>nu)&&f(e.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".')),e.addSymbols(e.icon,a,g,b,v,w,t.WritingMode.none,i,I.lineStartIndex,I.lineLength,-1,E),R=e.icon.placedSymbolArray.length-1,d&&(L=4*d.length,e.addSymbols(e.icon,d,g,b,v,w,t.WritingMode.vertical,i,I.lineStartIndex,I.lineLength,-1,E),O=e.icon.placedSymbolArray.length-1)}const V=Object.keys(r.horizontal);for(const n of V){const o=r.horizontal[n];if(!C){U=co(o.text);const t=l.layout.get("text-rotate").evaluate(w,{},E);C=new Hl(u,i,c,h,p,o,d,m,g,t)}const s=1===o.positionedLines.length;if(B+=ru(e,i,o,a,l,g,w,_,I,r.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,s?V:[n],F,R,S,E),s)break}r.vertical&&(D+=ru(e,i,r.vertical,a,l,g,w,_,I,t.WritingMode.vertical,["vertical"],F,O,S,E));const G=C?C.boxStartIndex:e.collisionBoxArray.length,q=C?C.boxEndIndex:e.collisionBoxArray.length,W=M?M.boxStartIndex:e.collisionBoxArray.length,Z=M?M.boxEndIndex:e.collisionBoxArray.length,H=P?P.boxStartIndex:e.collisionBoxArray.length,$=P?P.boxEndIndex:e.collisionBoxArray.length,X=k?k.boxStartIndex:e.collisionBoxArray.length,K=k?k.boxEndIndex:e.collisionBoxArray.length;let J=-1;const Y=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;J=Y(C,J),J=Y(M,J),J=Y(P,J),J=Y(k,J);const Q=J>-1?1:0;Q&&(J*=A/24),e.glyphOffsetArray.length>=fu.MAX_GLYPHS&&f("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,w.sortKey),e.symbolInstances.emplaceBack(i.x,i.y,F.right>=0?F.right:-1,F.center>=0?F.center:-1,F.left>=0?F.left:-1,F.vertical||-1,R,O,U,G,q,W,Z,H,$,X,K,c,B,D,z,L,Q,0,d,j,N,J)}(e,p,l,n,r,o,M,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,y,w,E,u,v,S,A,m,i,a,c,h,s)};if("line"===I)for(const t of Nl(i.geometry,0,0,Mo,Mo)){const i=jl(t,b,T,n.vertical||g,r,24,x,e.overscaling,Mo);for(const n of i){const i=g;i&&au(e,i.text,C,n)||k(t,n)}}else if("line-center"===I){for(const t of i.geometry)if(t.length>1){const e=Ul(t,T,n.vertical||g,r,24,x);e&&k(t,e)}}else if("Polygon"===i.type)for(const t of $a(i.geometry,0)){const e=Kl(t,16);k(t[0],new Bl(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry)k(t,new Bl(t[0].x,t[0].y,0));else if("Point"===i.type)for(const t of i.geometry)for(const e of t)k([e],new Bl(e.x,e.y,0))}const nu=32640;function ru(t,e,i,n,r,o,a,s,l,u,c,h,p,d,m){const g=function(t,e,i,n,r,o,a,s){const l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const o=n.rect||{};let c=4,h=!0,p=1,d=0;const f=(r||s)&&n.vertical,m=n.metrics.advance*n.scale/2;if(s&&e.verticalizable){const e=24*(n.scale-1),i=(24-n.metrics.width*n.scale)/2;d=t.lineOffset/2-(n.imageName?-i:e)}if(n.imageName){const t=a[n.imageName];h=t.sdf,p=t.pixelRatio,c=1/p}const g=r?[n.x+m,n.y]:[0,0];let _=r?[0,0]:[n.x+m+i[0],n.y+i[1]-d],y=[0,0];f&&(y=_,_=[0,0]);const x=(n.metrics.left-c)*n.scale-m+_[0],v=(-n.metrics.top-c)*n.scale+_[1],b=x+o.w*n.scale/p,w=v+o.h*n.scale/p,S=new E(x,v),T=new E(b,v),A=new E(x,w),I=new E(b,w);if(f){const t=new E(-m,m- -17),e=-Math.PI/2,i=12-m,r=new E(22-i,-(n.imageName?i:0)),o=new E(...y);S._rotateAround(e,t)._add(r)._add(o),T._rotateAround(e,t)._add(r)._add(o),A._rotateAround(e,t)._add(r)._add(o),I._rotateAround(e,t)._add(r)._add(o)}if(l){const t=Math.sin(l),e=Math.cos(l),i=[e,-t,t,e];S._matMult(i),T._matMult(i),A._matMult(i),I._matMult(i)}const C=new E(0,0),P=new E(0,0);u.push({tl:S,tr:T,bl:A,br:I,tex:o,writingMode:e.writingMode,glyphOffset:g,sectionIndex:n.sectionIndex,isSDF:h,pixelOffsetTL:C,pixelOffsetBR:P,minFontScaleX:0,minFontScaleY:0})}return u}(0,i,s,r,o,a,n,t.allowVerticalPlacement),_=t.textSizeData;let y=null;"source"===_.kind?(y=[zl*r.layout.get("text-size").evaluate(a,{})],y[0]>nu&&f(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".')):"composite"===_.kind&&(y=[zl*d.compositeTextSizes[0].evaluate(a,{},m),zl*d.compositeTextSizes[1].evaluate(a,{},m)],(y[0]>nu||y[1]>nu)&&f(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".')),t.addSymbols(t.text,g,y,s,o,a,u,e,l.lineStartIndex,l.lineLength,p,m);for(const e of c)h[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function ou(t){for(const e in t)return t[e];return null}function au(t,e,i,n){const r=t.compareText;if(e in r){const t=r[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<i)return!0}else r[e]=[];return r[e].push(n),!1}const su=ns.VectorTileFeature.types,lu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function uu(t,e,i,n,r,o,a,s,l,u,c,h,p){const d=s?Math.min(nu,Math.round(s[0])):0,f=s?Math.min(nu,Math.round(s[1])):0;t.emplaceBack(e,i,Math.round(32*n),Math.round(32*r),o,a,(d<<1)+(l?1:0),f,16*u,16*c,256*h,256*p)}function cu(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function hu(t){for(const e of t.sections)if(Cn(e.text))return!0;return!1}class pu{constructor(t){this.layoutVertexArray=new Hr,this.indexArray=new Yr,this.programConfigurations=t,this.segments=new io,this.dynamicLayoutVertexArray=new $r,this.opacityVertexArray=new Xr,this.placedSymbolArray=new Br}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Rs.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Os.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,lu,!0),this.opacityVertexBuffer.itemSize=1),(i||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}mn("SymbolBuffers",pu);class du{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new io,this.collisionVertexArray=new Jr}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Fs.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}mn("CollisionBuffers",du);class fu{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ta([]),this.placementViewportMatrix=ta([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ll(this.zoom,i["text-size"]),this.iconSizeData=Ll(this.zoom,i["icon-size"]);const n=this.layers[0].layout,r=n.get("symbol-sort-key"),o=n.get("symbol-z-order");this.canOverlap="never"!==xu(n,"text-overlap","text-allow-overlap")||"never"!==xu(n,"icon-overlap","icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!r.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map(e=>t.WritingMode[e])),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.sourceID=e.sourceID}createArrays(){this.text=new pu(new Io(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new pu(new Io(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Or,this.lineVertexArray=new Fr,this.symbolInstances=new Rr}calculateGlyphDependencies(t,e,i,n,r){for(let o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(i||n)&&r){const i=Vs[t.charAt(o)];i&&(e[i.charCodeAt(0)]=!0)}}populate(e,i,n){const r=this.layers[0],o=r.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=("constant"!==s.value.kind||s.value.value instanceof Dt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;const p=i.iconDependencies,d=i.glyphDependencies,f=i.availableImages,m=new Nn(this.zoom);for(const{feature:i,id:s,index:l,sourceLayerIndex:g}of e){const e=r._featureFilter.needGeometry,_=Bo(i,e);if(!r._featureFilter.filter(m,_,n))continue;let y,x;if(e||(_.geometry=Lo(i)),u){const t=r.getValueAndResolveTokens("text-field",_,n,f),e=Dt.factory(t);hu(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Fn()||this.hasRTLText&&jn.isParsed())&&(y=Ns(e,r,_))}if(c){const t=r.getValueAndResolveTokens("icon-image",_,n,f);x=t instanceof Rt?t:Rt.fromString(t)}if(!y&&!x)continue;const v=this.sortFeaturesByKey?h.evaluate(_,{},n):void 0;if(this.features.push({id:s,text:y,icon:x,index:l,sourceLayerIndex:g,geometry:_.geometry,properties:i.properties,type:su[i.type],sortKey:v}),x&&(p[x.name]=!0),y){const e=a.evaluate(_,{},n).join(","),i="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.WritingMode.vertical)>=0;for(const t of y.sections)if(t.image)p[t.image.name]=!0;else{const n=bn(y.toString()),r=t.fontStack||e,o=d[r]=d[r]||{};this.calculateGlyphDependencies(t.text,o,i,this.allowVerticalPlacement,n)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},i={},n=[];let r=0;function o(e){n.push(t[e]),r++}function a(t,e,r){const o=i[t];return delete i[t],i[e]=o,n[o].geometry[0].pop(),n[o].geometry[0]=n[o].geometry[0].concat(r[0]),o}function s(t,i,r){const o=e[i];return delete e[i],e[t]=o,n[o].geometry[0].shift(),n[o].geometry[0]=r[0].concat(n[o].geometry[0]),o}function l(t,e,i){const n=i?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){o(u);continue}const d=l(p,h),f=l(p,h,!0);if(d in i&&f in e&&i[d]!==e[f]){const t=s(d,f,h),r=a(d,f,n[t].geometry);delete e[d],delete i[f],i[l(p,n[r].geometry,!0)]=r,n[t].geometry=null}else d in i?a(d,f,h):f in e?s(d,f,h):(o(u),e[d]=r-1,i[f]=r-1)}return n.filter(t=>t.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((t,e)=>t.sortKey-e.sortKey)}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const r={};for(let n=t.segment+1;n<e.length;n++)r[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:i},n<e.length-1&&(i+=e[n+1].dist(e[n]));for(let i=t.segment||0;i>=0;i--)r[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:n},i>0&&(n+=e[i-1].dist(e[i]));for(let t=0;t<e.length;t++){const e=r[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,i,n,r,o,a,s,l,u,c,h,p){const d=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*i.length,f,d,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&s===t.WritingMode.vertical?Math.PI/2:0,x=a.text&&a.text.sections;for(let t=0;t<i.length;t++){const{tl:r,tr:o,bl:s,br:u,tex:c,pixelOffsetTL:h,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:v,glyphOffset:b,isSDF:w,sectionIndex:S}=i[t],T=m.vertexLength,E=b[1];uu(f,l.x,l.y,r.x,E+r.y,c.x,c.y,n,w,h.x,h.y,_,v),uu(f,l.x,l.y,o.x,E+o.y,c.x+c.w,c.y,n,w,g.x,h.y,_,v),uu(f,l.x,l.y,s.x,E+s.y,c.x,c.y+c.h,n,w,h.x,g.y,_,v),uu(f,l.x,l.y,u.x,E+u.y,c.x+c.w,c.y+c.h,n,w,g.x,g.y,_,v),cu(e.dynamicLayoutVertexArray,l,y),d.emplaceBack(T,T+1,T+2),d.emplaceBack(T+1,T+2,T+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),t!==i.length-1&&S===i[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(f.length,a,a.index,{},p,x&&x[S])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,u,c,l.segment,n?n[0]:0,n?n[1]:0,r[0],r[1],s,0,!1,0,h)}_addCollisionDebugVertex(t,e,i,n,r,o){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,n,r,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,i,n,r,o,a){const s=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),l=s.vertexLength,u=r.layoutVertexArray,c=r.collisionVertexArray,h=a.anchorX,p=a.anchorY;this._addCollisionDebugVertex(u,c,o,h,p,new E(t,e)),this._addCollisionDebugVertex(u,c,o,h,p,new E(i,e)),this._addCollisionDebugVertex(u,c,o,h,p,new E(i,n)),this._addCollisionDebugVertex(u,c,o,h,p,new E(t,n)),s.vertexLength+=4;const d=r.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),s.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,n){for(let r=t;r<e;r++){const t=this.collisionBoxArray.get(r);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new du(Kr,Us.members,Qr),this.iconCollisionBox=new du(Kr,Us.members,Qr);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,n,r,o,a,s,l){const u={};for(let n=e;n<i;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},u.textFeatureIndex=e.featureIndex;break}for(let e=n;e<r;e++){const i=t.get(e);u.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},u.verticalTextFeatureIndex=i.featureIndex;break}for(let e=o;e<a;e++){const i=t.get(e);u.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},u.iconFeatureIndex=i.featureIndex;break}for(let e=s;e<l;e++){const i=t.get(e);u.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},u.verticalIconFeatureIndex=i.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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(t,e){const i=t.placedSymbolArray.get(e),n=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),i=Math.cos(t),n=[],r=[],o=[];for(let t=0;t<this.symbolInstances.length;++t){o.push(t);const a=this.symbolInstances.get(t);n.push(0|Math.round(e*a.anchorX+i*a.anchorY)),r.push(a.featureIndex)}return o.sort((t,e)=>n[t]-n[e]||r[e]-r[t]),o}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}mn("SymbolBucket",fu,{omit:["layers","collisionBoxArray","features","compareText"]}),fu.MAX_GLYPHS=65535,fu.addDynamicAttributes=cu;const mu=new er({"symbol-placement":new Kn(it.layout_symbol["symbol-placement"]),"symbol-spacing":new Kn(it.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Kn(it.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Jn(it.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Kn(it.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Kn(it.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Kn(it.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Kn(it.layout_symbol["icon-ignore-placement"]),"icon-optional":new Kn(it.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Kn(it.layout_symbol["icon-rotation-alignment"]),"icon-size":new Jn(it.layout_symbol["icon-size"]),"icon-text-fit":new Kn(it.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Kn(it.layout_symbol["icon-text-fit-padding"]),"icon-image":new Jn(it.layout_symbol["icon-image"]),"icon-rotate":new Jn(it.layout_symbol["icon-rotate"]),"icon-padding":new Kn(it.layout_symbol["icon-padding"]),"icon-keep-upright":new Kn(it.layout_symbol["icon-keep-upright"]),"icon-offset":new Jn(it.layout_symbol["icon-offset"]),"icon-anchor":new Jn(it.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Kn(it.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Kn(it.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Kn(it.layout_symbol["text-rotation-alignment"]),"text-field":new Jn(it.layout_symbol["text-field"]),"text-font":new Jn(it.layout_symbol["text-font"]),"text-size":new Jn(it.layout_symbol["text-size"]),"text-max-width":new Jn(it.layout_symbol["text-max-width"]),"text-line-height":new Kn(it.layout_symbol["text-line-height"]),"text-letter-spacing":new Jn(it.layout_symbol["text-letter-spacing"]),"text-justify":new Jn(it.layout_symbol["text-justify"]),"text-radial-offset":new Jn(it.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Kn(it.layout_symbol["text-variable-anchor"]),"text-anchor":new Jn(it.layout_symbol["text-anchor"]),"text-max-angle":new Kn(it.layout_symbol["text-max-angle"]),"text-writing-mode":new Kn(it.layout_symbol["text-writing-mode"]),"text-rotate":new Jn(it.layout_symbol["text-rotate"]),"text-padding":new Kn(it.layout_symbol["text-padding"]),"text-keep-upright":new Kn(it.layout_symbol["text-keep-upright"]),"text-transform":new Jn(it.layout_symbol["text-transform"]),"text-offset":new Jn(it.layout_symbol["text-offset"]),"text-allow-overlap":new Kn(it.layout_symbol["text-allow-overlap"]),"text-overlap":new Kn(it.layout_symbol["text-overlap"]),"text-ignore-placement":new Kn(it.layout_symbol["text-ignore-placement"]),"text-optional":new Kn(it.layout_symbol["text-optional"])});var gu={paint:new er({"icon-opacity":new Jn(it.paint_symbol["icon-opacity"]),"icon-color":new Jn(it.paint_symbol["icon-color"]),"icon-halo-color":new Jn(it.paint_symbol["icon-halo-color"]),"icon-halo-width":new Jn(it.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Jn(it.paint_symbol["icon-halo-blur"]),"icon-translate":new Kn(it.paint_symbol["icon-translate"]),"icon-translate-anchor":new Kn(it.paint_symbol["icon-translate-anchor"]),"text-opacity":new Jn(it.paint_symbol["text-opacity"]),"text-color":new Jn(it.paint_symbol["text-color"],{runtimeType:ft,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Jn(it.paint_symbol["text-halo-color"]),"text-halo-width":new Jn(it.paint_symbol["text-halo-width"]),"text-halo-blur":new Jn(it.paint_symbol["text-halo-blur"]),"text-translate":new Kn(it.paint_symbol["text-translate"]),"text-translate-anchor":new Kn(it.paint_symbol["text-translate-anchor"])}),layout:mu};class _u{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:ct,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}mn("FormatSectionOverride",_u,{omit:["defaultValue"]});class yu extends nr{constructor(t){super(t,gu)}recalculate(t,e){if(super.recalculate(t,e),"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 t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,n){const r=this.layout.get(t).evaluate(e,{},i,n),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Ti(o.value)||!r?r:function(t,e){return e.replace(/{([^{}]+)}/g,(e,i)=>i in t?String(t[i]):"")}(e.properties,r)}createBucket(t){return new fu(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of gu.paint.overridableProperties){if(!yu.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new _u(e),n=new Si(i,e.property.specification);let r=null;r="constant"===e.value.kind||"source"===e.value.kind?new Ai("source",n):new Ii("composite",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new $n(e.property,r,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&yu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),n=gu.paint.properties[e];let r=!1;const o=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(r=!0)};if("constant"===i.value.kind&&i.value.value instanceof Dt)o(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{r||(e instanceof Nt&&Ut(e.value)===yt?o(e.value.sections):e instanceof Wt?o(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return r}}function xu(t,e,i){let n="never";const r=t.get(e);return r?n=r:t.get(i)&&(n="always"),n}var vu={paint:new er({"background-color":new Kn(it.paint_background["background-color"]),"background-pattern":new Qn(it.paint_background["background-pattern"]),"background-opacity":new Kn(it.paint_background["background-opacity"])})},bu={paint:new er({"raster-opacity":new Kn(it.paint_raster["raster-opacity"]),"raster-hue-rotate":new Kn(it.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Kn(it.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Kn(it.paint_raster["raster-brightness-max"]),"raster-saturation":new Kn(it.paint_raster["raster-saturation"]),"raster-contrast":new Kn(it.paint_raster["raster-contrast"]),"raster-resampling":new Kn(it.paint_raster["raster-resampling"]),"raster-fade-duration":new Kn(it.paint_raster["raster-fade-duration"])})};class wu extends nr{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}}const Su={circle:class extends nr{constructor(t){super(t,Yo)}createBucket(t){return new Ro(t)}queryRadius(t){const e=t;return $o("circle-radius",this,e)+$o("circle-stroke-width",this,e)+Xo(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,n,r,o,a,s){const l=Ko(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),u=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:function(t,e){return t.map(t=>oa(t,e))}(l,s),p=c?u*a:u;for(const t of n)for(const e of t){const t=c?e:oa(e,s);let i=p;const n=ra([],[e.x,e.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=n[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=o.cameraToCenterDistance/n[3]),Fo(h,t,i))return!0}return!1}},heatmap:class extends nr{constructor(t){super(t,sa),this._updateColorRamp()}createBucket(t){return new aa(t)}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=da({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},hillshade:class extends nr{constructor(t){super(t,fa)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends nr{constructor(t){super(t,ts)}recalculate(t,e){super.recalculate(t,e);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(t){return new Ya(t)}queryRadius(){return Xo(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,n,r,o,a){return Uo(Ko(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),n)}isTileClipped(){return!0}},"fill-extrusion":class extends nr{constructor(t){super(t,bs)}createBucket(t){return new ys(t)}queryRadius(){return Xo(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,n,r,o,a,s){const l=Ko(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,a),u=this.paint.get("fill-extrusion-height").evaluate(e,i),c=this.paint.get("fill-extrusion-base").evaluate(e,i),h=function(t,e,i,n){const r=[];for(const i of t){const t=[i.x,i.y,0,1];ra(t,t,e),r.push(new E(t[0]/t[3],t[1]/t[3]))}return r}(l,s),p=function(t,e,i,n){const r=[],o=[],a=n[8]*e,s=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*i,h=n[9]*i,p=n[10]*i,d=n[11]*i;for(const e of t){const t=[],i=[];for(const r of e){const e=r.x,o=r.y,f=n[0]*e+n[4]*o+n[12],m=n[1]*e+n[5]*o+n[13],g=n[2]*e+n[6]*o+n[14],_=n[3]*e+n[7]*o+n[15],y=g+l,x=_+u,v=f+c,b=m+h,w=g+p,S=_+d,T=new E((f+a)/x,(m+s)/x);T.z=y/x,t.push(T);const A=new E(v/S,b/S);A.z=w/S,i.push(A)}r.push(t),o.push(i)}return[r,o]}(n,c,u,s);return function(t,e,i){let n=1/0;Uo(i,e)&&(n=Ss(i,e[0]));for(let r=0;r<e.length;r++){const o=e[r],a=t[r];for(let t=0;t<o.length-1;t++){const e=o[t],r=[e,o[t+1],a[t+1],a[t],e];Oo(i,r)&&(n=Math.min(n,Ss(i,r)))}}return n!==1/0&&n}(p[0],p[1],h)}},line:class extends nr{constructor(t){super(t,Ls),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof we,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Bs.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new ks(t)}queryRadius(t){const e=t,i=Ds($o("line-width",this,e),$o("line-gap-width",this,e)),n=$o("line-offset",this,e);return i/2+Math.abs(n)+Xo(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,r,o,a){const s=Ko(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,a),l=a/2*Ds(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),u=this.paint.get("line-offset").evaluate(e,i);return u&&(n=function(t,e){const i=[];for(let n=0;n<t.length;n++){const r=t[n],o=[];for(let t=0;t<r.length;t++){const i=r[t-1],n=r[t],a=r[t+1],s=0===t?new E(0,0):n.sub(i)._unit()._perp(),l=t===r.length-1?new E(0,0):a.sub(n)._unit()._perp(),u=s._add(l)._unit(),c=u.x*l.x+u.y*l.y;0!==c&&u._mult(1/c),o.push(u._mult(e)._add(n))}i.push(o)}return i}(n,u*a)),function(t,e,i){for(let n=0;n<e.length;n++){const r=e[n];if(t.length>=3)for(let e=0;e<r.length;e++)if(Zo(t,r[e]))return!0;if(jo(t,r,i))return!0}return!1}(s,n,l)}isTileClipped(){return!0}},symbol:yu,background:class extends nr{constructor(t){super(t,vu)}},raster:class extends nr{constructor(t){super(t,bu)}}};class Tu{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const Eu=6371008.8;class Au{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Au(a(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,n=t.lat*e,r=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Eu*Math.acos(Math.min(r,1))}toBounds(t=0){const e=360*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return new Iu(new Au(this.lng-i,this.lat-e),new Au(this.lng+i,this.lat+e))}static convert(t){if(t instanceof Au)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Au(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Au(Number("lng"in t?t.lng:t.lon),Number(t.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>]")}}class Iu{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof Au?new Au(t.lng,t.lat):Au.convert(t),this}setSouthWest(t){return this._sw=t instanceof Au?new Au(t.lng,t.lat):Au.convert(t),this}extend(t){const e=this._sw,i=this._ne;let n,r;if(t instanceof Au)n=t,r=t;else{if(!(t instanceof Iu))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Iu.convert(t)):this.extend(Au.convert(t)):this;if(n=t._sw,r=t._ne,!n||!r)return this}return e||i?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Au(n.lng,n.lat),this._ne=new Au(r.lng,r.lat)),this}getCenter(){return new Au((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 Au(this.getWest(),this.getNorth())}getSouthEast(){return new Au(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(t){const{lng:e,lat:i}=Au.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}static convert(t){return t instanceof Iu?t:t?new Iu(t):t}}const Cu=2*Math.PI*Eu;function Pu(t){return Cu*Math.cos(t*Math.PI/180)}function Mu(t){return(180+t)/360}function ku(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function zu(t,e){return t/Pu(e)}function Lu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Bu{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Au.convert(t);return new Bu(Mu(i.lng),ku(i.lat),zu(e,i.lat))}toLngLat(){return new Au(360*this.x-180,Lu(this.y))}toAltitude(){return this.z*Pu(Lu(this.y))}meterInMercatorCoordinateUnits(){return 1/Cu*(t=Lu(this.y),1/Math.cos(t*Math.PI/180));var t}}function Du(t,e,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class Ru{constructor(t,e,i){this.z=t,this.x=e,this.y=i,this.key=Uu(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const n=(o=this.y,a=this.z,s=Du(256*(r=this.x),256*(o=Math.pow(2,a)-o-1),a),l=Du(256*(r+1),256*(o+1),a),s[0]+","+s[1]+","+l[0]+","+l[1]);var r,o,a,s,l;const u=function(t,e,i){let n,r="";for(let o=t;o>0;o--)n=1<<o-1,r+=(e&n?1:0)+(i&n?2:0);return r}(this.z,this.x,this.y);return t[(this.x+this.y)%t.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,e>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,n)}getTilePoint(t){const e=Math.pow(2,this.z);return new E((t.x*e-this.x)*Mo,(t.y*e-this.y)*Mo)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ou{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Uu(t,e.z,e.z,e.x,e.y)}}class Fu{constructor(t,e,i,n,r){this.overscaledZ=t,this.wrap=e,this.canonical=new Ru(i,+n,+r),this.key=Uu(e,t,i,n,r)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){const e=this.canonical.z-t;return t>this.canonical.z?new Fu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Fu(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){const i=this.canonical.z-t;return t>this.canonical.z?Uu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Uu(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Fu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,n=2*this.canonical.y;return[new Fu(e,this.wrap,e,i,n),new Fu(e,this.wrap,e,i+1,n),new Fu(e,this.wrap,e,i,n+1),new Fu(e,this.wrap,e,i+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Fu(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Fu(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Ou(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Bu(t.x-this.wrap,t.y))}}function Uu(t,e,i,n,r){(t*=2)<0&&(t=-1*t-1);const o=1<<i;return(o*o*t+o*r+n).toString(36)+i.toString(36)+e.toString(36)}mn("CanonicalTileID",Ru),mn("OverscaledTileID",Fu,{omit:["posMatrix"]});class ju{constructor(t,e,i){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return void f(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const n=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=i||"mapbox";for(let t=0;t<n;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(n,t)]=this.data[this._idx(n-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,n)]=this.data[this._idx(t,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)]}get(t,e){const i=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(i[n],i[n+1],i[n+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,i){return(256*t*256+256*e+i)/10-1e4}_unpackTerrarium(t,e,i){return 256*t+e+i/256-32768}getPixels(){return new pa({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,r=e*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(e){case-1:n=r-1;break;case 1:r=n+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}const s=-e*this.dim,l=-i*this.dim;for(let e=o;e<a;e++)for(let i=n;i<r;i++)this.data[this._idx(i,e)]=t.data[this._idx(i+s,e+l)]}}mn("DEMData",ju);class Nu{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class Vu{constructor(t,e,i,n,r){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=n,this.properties=t.properties,this.id=r}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class Gu{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new dn(Mo,16,0),this.grid3D=new dn(Mo,16,0),this.featureIndexArray=new jr,this.promoteId=e}insert(t,e,i,n,r,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,r);const s=o?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const i=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<i.length;t++){const e=i[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<Mo&&n[1]<Mo&&n[2]>=0&&n[3]>=0&&s.insert(a,n[0],n[1],n[2],n[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new ns.VectorTile(new Gs(this.rawTileData)).layers,this.sourceLayerCoder=new Nu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,n){this.loadVTLayers();const r=t.params||{},o=Mo/t.tileSize/t.scale,a=Fi(r.filter),s=t.queryGeometry,l=t.queryPadding*o,u=Wu(s),c=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),h=Wu(t.cameraQueryGeometry),p=this.grid3D.query(h.minX-l,h.minY-l,h.maxX+l,h.maxY+l,(e,i,n,r)=>function(t,e,i,n,r){for(const o of t)if(e<=o.x&&i<=o.y&&n>=o.x&&r>=o.y)return!0;const o=[new E(e,i),new E(e,r),new E(n,r),new E(n,i)];if(t.length>2)for(const e of o)if(Zo(t,e))return!0;for(let e=0;e<t.length-1;e++)if(Ho(t[e],t[e+1],o))return!0;return!1}(t.cameraQueryGeometry,e-l,i-l,n+l,r+l));for(const t of p)c.push(t);c.sort(Zu);const d={};let f;for(let l=0;l<c.length;l++){const u=c[l];if(u===f)continue;f=u;const h=this.featureIndexArray.get(u);let p=null;this.loadMatchingFeature(d,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,a,r.layers,r.availableImages,e,i,n,(e,i,n)=>(p||(p=Lo(e)),i.queryIntersectsFeature(s,e,n,p,this.z,t.transform,o,t.pixelPosMatrix)))}return d}loadMatchingFeature(t,e,i,n,r,o,a,l,u,c,h){const p=this.bucketLayerIDs[e];if(o&&!function(t,e){for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(o,p))return;const d=this.sourceLayerCoder.decode(i),f=this.vtLayers[d].feature(n);if(r.needGeometry){const t=Bo(f,!0);if(!r.filter(new Nn(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!r.filter(new Nn(this.tileID.overscaledZ),f))return;const m=this.getId(f,d);for(let e=0;e<p.length;e++){const i=p[e];if(o&&o.indexOf(i)<0)continue;const r=l[i];if(!r)continue;let d={};m&&c&&(d=c.getState(r.sourceLayer||"_geojsonTileLayer",m));const g=s({},u[i]);g.paint=qu(g.paint,r.paint,f,d,a),g.layout=qu(g.layout,r.layout,f,d,a);const _=!h||h(f,r,d);if(!_)continue;const y=new Vu(f,this.z,this.x,this.y,m);y.layer=g;let x=t[i];void 0===x&&(x=t[i]=[]),x.push({featureIndex:n,feature:y,intersectionZ:_})}}lookupSymbolFeatures(t,e,i,n,r,o,a,s){const l={};this.loadVTLayers();const u=Fi(r);for(const r of t)this.loadMatchingFeature(l,i,n,r,u,o,a,s,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const i of e)if(t===i)return!0;return!1}getId(t,e){let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i))),i}}function qu(t,e,i,n,r){return c(t,(t,o)=>{const a=e instanceof Xn?e.get(o):null;return a&&a.evaluate?a.evaluate(i,n,r):a})}function Wu(t){let e=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),n=Math.max(n,o.x),r=Math.max(r,o.y);return{minX:e,minY:i,maxX:n,maxY:r}}function Zu(t,e){return e-t}var Hu;mn("FeatureIndex",Gu,{omit:["rawTileData","sourceLayerCoder"]}),t.PerformanceMarkers=void 0,(Hu=t.PerformanceMarkers||(t.PerformanceMarkers={})).create="create",Hu.load="load",Hu.fullLoad="fullLoad";let $u=null,Xu=[];const Ku=1e3/30,Ju={mark(t){performance.mark(t)},frame(t){const e=t;null!=$u&&Xu.push(e-$u),$u=e},clearMetrics(){$u=null,Xu=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const e in t.PerformanceMarkers)performance.clearMarks(t.PerformanceMarkers[e])},getPerformanceMetrics(){performance.measure("loadTime",t.PerformanceMarkers.create,t.PerformanceMarkers.load),performance.measure("fullLoadTime",t.PerformanceMarkers.create,t.PerformanceMarkers.fullLoad);const e=performance.getEntriesByName("loadTime")[0].duration,i=performance.getEntriesByName("fullLoadTime")[0].duration,n=Xu.length,r=1/(Xu.reduce((t,e)=>t+e,0)/n/1e3),o=Xu.filter(t=>t>Ku).reduce((t,e)=>t+(e-Ku)/Ku,0);return{loadTime:e,fullLoadTime:i,fps:r,percentDroppedFrames:o/(n+o)*100}}};t.AJAXError=N,t.ARRAY_TYPE=Qo,t.Actor=class{constructor(t,e,i){this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},u(["receive","process"],this),this.invoker=new Tu(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=_()?t:window}send(t,e,i,n,r=!1){const o=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(this.callbacks[o]=i);const a=w(this.globalScope)?void 0:[];return this.target.postMessage({id:o,type:t,hasCallback:!!i,targetMapId:n,mustQueue:r,sourceMapId:this.mapId,data:_n(e,a)},a),{cancel:()=>{i&&delete this.callbacks[o],this.target.postMessage({id:o,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(t){const e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[i];const t=this.cancelCallbacks[i];delete this.cancelCallbacks[i],t&&t()}else _()||e.mustQueue?(this.tasks[i]=e,this.taskQueue.push(i),this.invoker.trigger()):this.processTask(i,e)}process(){if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){if("<response>"===e.type){const i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i(yn(e.error)):i(null,yn(e.data)))}else{let i=!1;const n=w(this.globalScope)?void 0:[],r=e.hasCallback?(e,r)=>{i=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?_n(e):null,data:_n(r,n)},n)}:t=>{i=!0};let o=null;const a=yn(e.data);if(this.parent[e.type])o=this.parent[e.type](e.sourceMapId,a,r);else if(this.parent.getWorkerSource){const t=e.type.split(".");o=this.parent.getWorkerSource(e.sourceMapId,t[0],a.source)[t[1]](a,r)}else r(new Error("Could not find function "+e.type));!i&&o&&o.cancel&&(this.cancelCallbacks[t]=o.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.AlphaImage=ha,t.CanonicalTileID=Ru,t.CollisionBoxArray=zr,t.CollisionCircleLayoutArray=class extends vr{},t.Color=zt,t.DEMData=ju,t.DataConstantProperty=Kn,t.DictionaryCoder=Nu,t.EXTENT=Mo,t.ErrorEvent=tt,t.EvaluationParameters=Nn,t.Event=Q,t.Evented=et,t.FeatureIndex=Gu,t.FillBucket=Ya,t.FillExtrusionBucket=ys,t.GeoJSONFeature=Vu,t.ImageAtlas=_l,t.ImagePosition=gl,t.LineBucket=ks,t.LineStripIndexArray=class extends Pr{},t.LngLat=Au,t.LngLatBounds=Iu,t.MercatorCoordinate=Bu,t.ONE_EM=24,t.OverscaledTileID=Fu,t.PerformanceUtils=Ju,t.PosArray=class extends ur{},t.Properties=er,t.QuadTriangleArray=class extends wr{},t.RGBAImage=pa,t.RasterBoundsArray=class extends cr{},t.RequestPerformance=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.ResourceType=j,t.SegmentVector=io,t.SymbolBucket=fu,t.Transitionable=qn,t.TriangleIndexArray=Yr,t.Uniform1f=go,t.Uniform1i=class extends mo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.Uniform2f=class extends mo{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.Uniform3f=class extends mo{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.Uniform4f=_o,t.UniformColor=yo,t.UniformMatrix4f=class extends mo{constructor(t,e){super(t,e),this.current=xo}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.UnwrappedTileID=Ou,t.ValidationError=nt,t.ZoomHistory=xn,t.addDynamicAttributes=cu,t.asyncAll=function(t,e,i){if(!t.length)return i(null,[]);let n=t.length;const r=new Array(t.length);let o=null;t.forEach((t,a)=>{e(t,(t,e)=>{t&&(o=t),r[a]=e,0==--n&&i(o,r)})})},t.bezier=n,t.bindAll=u,t.cacheEntryPossiblyAdded=function(t){L++,L>k&&(t.getActor().send("enforceCacheSizeLimit",M),L=0)},t.clamp=o,t.clearTileCache=function(t){const e=caches.delete(C);t&&e.catch(t).then(()=>t())},t.clipLine=Nl,t.clone=function(t){var e=new Qo(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=p,t.collisionCircleLayout=js,t.config=I,t.create=function(){var t=new Qo(16);return Qo!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.createExpression=Ei,t.createFilter=Fi,t.createLayout=sr,t.createStyleLayer=function(t){return"custom"===t.type?new wu(t):new Su[t.type](t)},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.ease=r,t.emitValidationErrors=pn,t.enforceCacheSizeLimit=function(t){z(),P&&P.then(e=>{e.keys().then(i=>{for(let n=0;n<i.length-t;n++)e.delete(i[n])})})},t.evaluateSizeForFeature=function(t,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:r}){return"source"===t.kind?n/zl:"composite"===t.kind?Se(n/zl,r/zl,i):e},t.evaluateSizeForZoom=function(t,e){let i=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){const{interpolationType:r,minZoom:a,maxZoom:s}=t,l=r?o(Fe.interpolationFactor(r,e,a,s),0,1):0;"camera"===t.kind?n=Se(t.minSize,t.maxSize,l):i=l}return{uSizeT:i,uSize:n}},t.evaluateVariableOffset=tu,t.evented=On,t.exported=T,t.exported$1=B,t.extend=s,t.filterObject=h,t.getAnchorAlignment=Cl,t.getAnchorJustification=eu,t.getArrayBuffer=W,t.getImage=K,t.getJSON=function(t,e){return q(s(t,{type:"json"}),e)},t.getOverlapMode=xu,t.getRTLTextPluginStatus=Fn,t.getReferrer=V,t.getVideo=function(t,e){const i=window.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let e=0;e<t.length;e++){const n=window.document.createElement("source");Z(t[e])||(i.crossOrigin="Anonymous"),n.src=t[e],i.appendChild(n)}return{cancel:()=>{}}},t.identity=ta,t.invert=function(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=i*s-n*a,x=i*l-r*a,v=i*u-o*a,b=n*l-r*s,w=n*u-o*s,S=r*u-o*l,T=c*m-h*f,E=c*g-p*f,A=c*_-d*f,I=h*g-p*m,C=h*_-d*m,P=p*_-d*g,M=y*P-x*C+v*I+b*A-w*E+S*T;return M?(t[0]=(s*P-l*C+u*I)*(M=1/M),t[1]=(r*C-n*P-o*I)*M,t[2]=(m*S-g*w+_*b)*M,t[3]=(p*w-h*S-d*b)*M,t[4]=(l*A-a*P-u*E)*M,t[5]=(i*P-r*A+o*E)*M,t[6]=(g*v-f*S-_*x)*M,t[7]=(c*S-p*v+d*x)*M,t[8]=(a*C-s*A+u*T)*M,t[9]=(n*A-i*C-o*T)*M,t[10]=(f*w-m*v+_*y)*M,t[11]=(h*v-c*w-d*y)*M,t[12]=(s*E-a*I-l*T)*M,t[13]=(i*I-n*E+r*T)*M,t[14]=(m*x-f*b-g*y)*M,t[15]=(c*b-h*x+p*y)*M,t):null},t.isImageBitmap=S,t.isSafari=w,t.keysDifference=function(t,e){const i=[];for(const n in t)n in e||i.push(n);return i},t.lazyLoadRTLTextPlugin=function(){jn.isLoading()||jn.isLoaded()||"deferred"!==Fn()||Un()},t.makeRequest=q,t.mapObject=c,t.mercatorXfromLng=Mu,t.mercatorYfromLat=ku,t.mercatorZfromAltitude=zu,t.mul=na,t.multiply=ea,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.number=Se,t.ortho=function(t,e,i,n,r,o,a){var s=1/(e-i),l=1/(n-r),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+i)*s,t[13]=(r+n)*l,t[14]=(a+o)*u,t[15]=1,t},t.parseCacheControl=y,t.parseGlyphPBF=function(t){return new Gs(t).readFields(pl,[])},t.pbf=Gs,t.performSymbolLayout=function(e,i,n,r,o,a,s){e.createArrays(),e.tilePixelRatio=Mo/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const l=e.layers[0].layout,u=e.layers[0]._unevaluatedLayout._values,c={layoutIconSize:u["icon-size"].possiblyEvaluate(new Nn(e.zoom+1),s),layoutTextSize:u["text-size"].possiblyEvaluate(new Nn(e.zoom+1),s),textMaxSize:u["text-size"].possiblyEvaluate(new Nn(18))};if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.textSizeData;c.compositeTextSizes=[u["text-size"].possiblyEvaluate(new Nn(t),s),u["text-size"].possiblyEvaluate(new Nn(i),s)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.iconSizeData;c.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new Nn(t),s),u["icon-size"].possiblyEvaluate(new Nn(i),s)]}const h=24*l.get("text-line-height"),p="viewport"!==l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),d=l.get("text-keep-upright"),m=l.get("text-size");for(const a of e.features){const u=l.get("text-font").evaluate(a,{},s).join(","),g=m.evaluate(a,{},s),_=c.layoutTextSize.evaluate(a,{},s),y=c.layoutIconSize.evaluate(a,{},s),x={horizontal:{},vertical:void 0},v=a.text;let b,w=[0,0];if(v){const r=v.toString(),c=24*l.get("text-letter-spacing").evaluate(a,{},s),f=wn(r)?c:0,m=l.get("text-anchor").evaluate(a,{},s),y=l.get("text-variable-anchor");if(!y){const t=l.get("text-radial-offset").evaluate(a,{},s);w=t?tu(m,[24*t,Ql]):l.get("text-offset").evaluate(a,{},s).map(t=>24*t)}let b=p?"center":l.get("text-justify").evaluate(a,{},s);const S=l.get("symbol-placement"),T="point"===S?24*l.get("text-max-width").evaluate(a,{},s):0,E=()=>{e.allowVerticalPlacement&&bn(r)&&(x.vertical=vl(v,i,n,o,u,T,h,m,"left",f,w,t.WritingMode.vertical,!0,S,_,g))};if(!p&&y){const e="auto"===b?y.map(t=>eu(t)):[b];let r=!1;for(let a=0;a<e.length;a++){const s=e[a];if(!x.horizontal[s])if(r)x.horizontal[s]=x.horizontal[0];else{const e=vl(v,i,n,o,u,T,h,"center",s,f,w,t.WritingMode.horizontal,!1,S,_,g);e&&(x.horizontal[s]=e,r=1===e.positionedLines.length)}}E()}else{"auto"===b&&(b=eu(m));const e=vl(v,i,n,o,u,T,h,m,b,f,w,t.WritingMode.horizontal,!1,S,_,g);e&&(x.horizontal[b]=e),E(),bn(r)&&p&&d&&(x.vertical=vl(v,i,n,o,u,T,h,m,b,f,w,t.WritingMode.vertical,!1,S,_,g))}}let S=!1;if(a.icon&&a.icon.name){const t=r[a.icon.name];t&&(b=Ml(o[a.icon.name],l.get("icon-offset").evaluate(a,{},s),l.get("icon-anchor").evaluate(a,{},s)),S=!!t.sdf,void 0===e.sdfIcons?e.sdfIcons=S:e.sdfIcons!==S&&f("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.pixelRatio||0!==l.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}const T=ou(x.horizontal)||x.vertical;e.iconsInText=!!T&&T.iconsInText,(T||b)&&iu(e,a,x,b,r,c,_,y,w,S,s)}a&&e.generateCollisionDebugBuffers()},t.perspective=function(t,e,i,n,r){var o,a=1/Math.tan(e/2);return t[0]=a/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=r&&r!==1/0?(t[10]=(r+n)*(o=1/(n-r)),t[14]=2*r*n*o):(t[10]=-1,t[14]=-2*n),t},t.pick=function(t,e){const i={};for(let n=0;n<e.length;n++){const r=e[n];r in t&&(i[r]=t[r])}return i},t.plugin=jn,t.pointGeometry=E,t.polygonIntersectsPolygon=Oo,t.potpack=ml,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.register=mn,t.registerForPluginStateChange=function(t){return t({pluginStatus:Ln,pluginURL:Bn}),On.on("pluginStateChange",t),t},t.renderColorRamp=da,t.rotateX=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*r+u*n,t[5]=a*r+c*n,t[6]=s*r+h*n,t[7]=l*r+p*n,t[8]=u*r-o*n,t[9]=c*r-a*n,t[10]=h*r-s*n,t[11]=p*r-l*n,t},t.rotateZ=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*r+u*n,t[1]=a*r+c*n,t[2]=s*r+h*n,t[3]=l*r+p*n,t[4]=u*r-o*n,t[5]=c*r-a*n,t[6]=h*r-s*n,t[7]=p*r-l*n,t},t.scale=function(t,e,i){var n=i[0],r=i[1],o=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.scale$1=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},t.setCacheLimits=function(t,e){M=t,k=e},t.setRTLTextPlugin=function(t,e,i=!1){if(Ln===Pn||Ln===Mn||Ln===kn)throw new Error("setRTLTextPlugin cannot be called multiple times.");Bn=T.resolveURL(t),Ln=Pn,zn=e,Rn(),i||Un()},t.spec=it,t.sphericalToCartesian=function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(i),y:t*Math.sin(e)*Math.sin(i),z:t*Math.cos(i)}},t.toEvaluationFeature=Bo,t.transformMat4=ra,t.translate=function(t,e,i){var n,r,o,a,s,l,u,c,h,p,d,f,m=i[0],g=i[1],_=i[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*_+e[12],t[13]=e[1]*m+e[5]*g+e[9]*_+e[13],t[14]=e[2]*m+e[6]*g+e[10]*_+e[14],t[15]=e[3]*m+e[7]*g+e[11]*_+e[15]):(r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=n=e[0],t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=n*m+s*g+h*_+e[12],t[13]=r*m+l*g+p*_+e[13],t[14]=o*m+u*g+d*_+e[14],t[15]=a*m+c*g+f*_+e[15]),t},t.triggerPluginCompletionEvent=Dn,t.unicodeBlockLookup=vn,t.uniqueId=function(){return l++},t.validateCustomStyleLayer=function(t){const e=[],i=t.id;return void 0===i&&e.push({message:`layers.${i}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},t.validateLight=un,t.validateStyle=ln,t.vectorTile=ns,t.warnOnce=f,t.wrap=a})),n(0,(function(t){function e(t){const i=typeof t;if("number"===i||"boolean"===i||"string"===i||null==t)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(const n of t)i+=e(n)+",";return i+"]"}const n=Object.keys(t).sort();let r="{";for(let i=0;i<n.length;i++)r+=`${JSON.stringify(n[i])}:${e(t[n[i]])},`;return r+"}"}function i(i){let n="";for(const r of t.refProperties)n+="/"+e(i[r]);return n}class n{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,n){for(const i of e){this._layerConfigs[i.id]=i;const e=this._layers[i.id]=t.createStyleLayer(i);e._featureFilter=t.createFilter(e.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const t of n)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=function(t,e){const n={};for(let r=0;r<t.length;r++){const o=e&&e[t[r].id]||i(t[r]);e&&(e[t[r].id]=o);let a=n[o];a||(a=n[o]=[]),a.push(t[r])}const r=[];for(const t in n)r.push(n[t]);return r}(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map(t=>this._layers[t.id]),i=e[0];if("none"===i.visibility)continue;const n=i.source||"";let r=this.familiesBySource[n];r||(r=this.familiesBySource[n]={});const o=i.sourceLayer||"_geojsonTileLayer";let a=r[o];a||(a=r[o]=[]),a.push(e)}}}class r{constructor(e){const i={},n=[];for(const t in e){const r=e[t],o=i[t]={};for(const t in r){const e=r[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};n.push(i),o[t]={rect:i,metrics:e.metrics}}}const{w:r,h:o}=t.potpack(n),a=new t.AlphaImage({width:r||1,height:o||1});for(const n in e){const r=e[n];for(const e in r){const o=r[+e];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const s=i[n][e].rect;t.AlphaImage.copy(o.bitmap,a,{x:0,y:0},{x:s.x+1,y:s.y+1},o.bitmap)}}this.image=a,this.positions=i}}t.register("GlyphAtlas",r);class o{constructor(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId}parse(e,i,n,o,s){this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;const l=new t.DictionaryCoder(Object.keys(e.layers).sort()),u=new t.FeatureIndex(this.tileID,this.promoteId);u.bucketLayerIDs=[];const c={},h={featureIndex:u,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},p=i.familiesBySource[this.source];for(const i in p){const r=e.layers[i];if(!r)continue;1===r.version&&t.warnOnce(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const o=l.encode(i),s=[];for(let t=0;t<r.length;t++){const e=r.feature(t),n=u.getId(e,i);s.push({feature:e,id:n,index:t,sourceLayerIndex:o})}for(const t of p[i]){const e=t[0];e.minzoom&&this.zoom<Math.floor(e.minzoom)||e.maxzoom&&this.zoom>=e.maxzoom||"none"!==e.visibility&&(a(t,this.zoom,n),(c[e.id]=e.createBucket({index:u.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(s,h,this.tileID.canonical),u.bucketLayerIDs.push(t.map(t=>t.id)))}}let d,f,m,g;const _=t.mapObject(h.glyphDependencies,t=>Object.keys(t).map(Number));Object.keys(_).length?o.send("getGlyphs",{uid:this.uid,stacks:_},(t,e)=>{d||(d=t,f=e,v.call(this))}):f={};const y=Object.keys(h.iconDependencies);y.length?o.send("getImages",{icons:y,source:this.source,tileID:this.tileID,type:"icons"},(t,e)=>{d||(d=t,m=e,v.call(this))}):m={};const x=Object.keys(h.patternDependencies);function v(){if(d)return s(d);if(f&&m&&g){const e=new r(f),i=new t.ImageAtlas(m,g);for(const r in c){const o=c[r];o instanceof t.SymbolBucket?(a(o.layers,this.zoom,n),t.performSymbolLayout(o,f,e.positions,m,i.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):o.hasPattern&&(o instanceof t.LineBucket||o instanceof t.FillBucket||o instanceof t.FillExtrusionBucket)&&(a(o.layers,this.zoom,n),o.addFeatures(h,this.tileID.canonical,i.patternPositions))}this.status="done",s(null,{buckets:Object.values(c).filter(t=>!t.isEmpty()),featureIndex:u,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:i,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?m:null,glyphPositions:this.returnDependencies?e.positions:null})}}x.length?o.send("getImages",{icons:x,source:this.source,tileID:this.tileID,type:"patterns"},(t,e)=>{d||(d=t,g=e,v.call(this))}):g={},v.call(this)}}function a(e,i,n){const r=new t.EvaluationParameters(i);for(const t of e)t.recalculate(r,n)}function s(e,i){const n=t.getArrayBuffer(e.request,(e,n,r,o)=>{e?i(e):n&&i(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(n)),rawData:n,cacheControl:r,expires:o})});return()=>{n.cancel(),i()}}class l{constructor(t,e,i,n){this.actor=t,this.layerIndex=e,this.availableImages=i,this.loadVectorData=n||s,this.loading={},this.loaded={}}loadTile(e,i){const n=e.uid;this.loading||(this.loading={});const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),a=this.loading[n]=new o(e);a.abort=this.loadVectorData(e,(e,o)=>{if(delete this.loading[n],e||!o)return a.status="done",this.loaded[n]=a,i(e);const s=o.rawData,l={};o.expires&&(l.expires=o.expires),o.cacheControl&&(l.cacheControl=o.cacheControl);const u={};if(r){const t=r.finish();t&&(u.resourceTiming=JSON.parse(JSON.stringify(t)))}a.vectorTile=o.vectorTile,a.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,(e,n)=>{if(e||!n)return i(e);i(null,t.extend({rawTileData:s.slice(0)},n,l,u))}),this.loaded=this.loaded||{},this.loaded[n]=a})}reloadTile(t,e){const i=this.loaded,n=t.uid,r=this;if(i&&i[n]){const o=i[n];o.showCollisionBoxes=t.showCollisionBoxes;const a=(t,i)=>{const n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,r.layerIndex,this.availableImages,r.actor,n)),e(t,i)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a())}}abortTile(t,e){const i=this.loading,n=t.uid;i&&i[n]&&i[n].abort&&(i[n].abort(),delete i[n]),e()}removeTile(t,e){const i=this.loaded,n=t.uid;i&&i[n]&&delete i[n],e()}}class u{constructor(){this.loaded={}}loadTile(e,i){const{uid:n,encoding:r,rawImageData:o}=e,a=t.isImageBitmap(o)?this.getImageData(o):o,s=new t.DEMData(n,a,r);this.loaded=this.loaded||{},this.loaded[n]=s,i(null,s)}getImageData(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:i.width,height:i.height},i.data)}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}var c=function t(e,i){var n,r=e&&e.type;if("FeatureCollection"===r)for(n=0;n<e.features.length;n++)t(e.features[n],i);else if("GeometryCollection"===r)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],i);else if("Feature"===r)t(e.geometry,i);else if("Polygon"===r)h(e.coordinates,i);else if("MultiPolygon"===r)for(n=0;n<e.coordinates.length;n++)h(e.coordinates[n],i);return e};function h(t,e){if(0!==t.length){p(t[0],e);for(var i=1;i<t.length;i++)p(t[i],!e)}}function p(t,e){for(var i=0,n=0,r=0,o=t.length,a=o-1;r<o;a=r++){var s=(t[r][0]-t[a][0])*(t[a][1]+t[r][1]),l=i+s;n+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+n>=0!=!!e&&t.reverse()}const d=t.vectorTile.VectorTileFeature.prototype.toGeoJSON;class f{constructor(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const i of this._feature.geometry)e.push([new t.pointGeometry(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const n=[];for(const e of i)n.push(new t.pointGeometry(e[0],e[1]));e.push(n)}return e}}toGeoJSON(t,e,i){return d.call(this,t,e,i)}}class m{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e}feature(t){return new f(this._features[t])}}var g={exports:{}},_=t.pointGeometry,y=t.vectorTile.VectorTileFeature,x=v;function v(t,e){this.options=e||{},this.features=t,this.length=t.length}function b(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}v.prototype.feature=function(t){return new b(this.features[t],this.options.extent)},b.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var i=t[e],n=[],r=0;r<i.length;r++)n.push(new _(i[r][0],i[r][1]));this.geometry.push(n)}return this.geometry},b.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,n=1/0,r=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),i=Math.max(i,l.x),n=Math.min(n,l.y),r=Math.max(r,l.y)}return[e,n,i,r]},b.prototype.toGeoJSON=y.prototype.toGeoJSON;var w=t.pbf,S=x;function T(t){var e=new w;return function(t,e){for(var i in t.layers)e.writeMessage(3,E,t.layers[i])}(t,e),e.finish()}function E(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)n.feature=t.feature(i),e.writeMessage(2,A,n);var r=n.keys;for(i=0;i<r.length;i++)e.writeStringField(3,r[i]);var o=n.values;for(i=0;i<o.length;i++)e.writeMessage(4,k,o[i])}function A(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,I,t),e.writeVarintField(3,i.type),e.writeMessage(4,M,i)}function I(t,e){var i=t.feature,n=t.keys,r=t.values,o=t.keycache,a=t.valuecache;for(var s in i.properties){var l=i.properties[s],u=o[s];if(null!==l){void 0===u&&(n.push(s),o[s]=u=n.length-1),e.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=a[h];void 0===p&&(r.push(l),a[h]=p=r.length-1),e.writeVarint(p)}}}function C(t,e){return(e<<3)+(7&t)}function P(t){return t<<1^t>>31}function M(t,e){for(var i=t.loadGeometry(),n=t.type,r=0,o=0,a=i.length,s=0;s<a;s++){var l=i[s],u=1;1===n&&(u=l.length),e.writeVarint(C(1,u));for(var c=3===n?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(C(2,c-1));var p=l[h].x-r,d=l[h].y-o;e.writeVarint(P(p)),e.writeVarint(P(d)),r+=p,o+=d}3===n&&e.writeVarint(C(7,1))}}function k(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}g.exports=T,g.exports.fromVectorTileJs=T,g.exports.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var n in t)i[n]=new S(t[n].features,e),i[n].name=n,i[n].version=e.version,i[n].extent=e.extent;return T({layers:i})},g.exports.GeoJSONWrapper=S;var z=g.exports;function L(t,e,i,n,r,o){if(r-n<=i)return;const a=n+r>>1;(function t(e,i,n,r,o,a){for(;o>r;){if(o-r>600){const s=o-r+1,l=n-r+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1);t(e,i,n,Math.max(r,Math.floor(n-l*c/s+h)),Math.min(o,Math.floor(n+(s-l)*c/s+h)),a)}const s=i[2*n+a];let l=r,u=o;for(B(e,i,r,n),i[2*o+a]>s&&B(e,i,r,o);l<u;){for(B(e,i,l,u),l++,u--;i[2*l+a]<s;)l++;for(;i[2*u+a]>s;)u--}i[2*r+a]===s?B(e,i,r,u):(u++,B(e,i,u,o)),u<=n&&(r=u+1),n<=u&&(o=u-1)}})(t,e,a,n,r,o%2),L(t,e,i,n,a-1,o+1),L(t,e,i,a+1,r,o+1)}function B(t,e,i,n){D(t,i,n),D(e,2*i,2*n),D(e,2*i+1,2*n+1)}function D(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function R(t,e,i,n){const r=t-i,o=e-n;return r*r+o*o}const O=t=>t[0],F=t=>t[1];class U{constructor(t,e=O,i=F,n=64,r=Float64Array){this.nodeSize=n,this.points=t;const o=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(t.length),s=this.coords=new r(2*t.length);for(let n=0;n<t.length;n++)a[n]=n,s[2*n]=e(t[n]),s[2*n+1]=i(t[n]);L(a,s,n,0,a.length-1,0)}range(t,e,i,n){return function(t,e,i,n,r,o,a){const s=[0,t.length-1,0],l=[];let u,c;for(;s.length;){const h=s.pop(),p=s.pop(),d=s.pop();if(p-d<=a){for(let a=d;a<=p;a++)u=e[2*a],c=e[2*a+1],u>=i&&u<=r&&c>=n&&c<=o&&l.push(t[a]);continue}const f=Math.floor((d+p)/2);u=e[2*f],c=e[2*f+1],u>=i&&u<=r&&c>=n&&c<=o&&l.push(t[f]);const m=(h+1)%2;(0===h?i<=u:n<=c)&&(s.push(d),s.push(f-1),s.push(m)),(0===h?r>=u:o>=c)&&(s.push(f+1),s.push(p),s.push(m))}return l}(this.ids,this.coords,t,e,i,n,this.nodeSize)}within(t,e,i){return function(t,e,i,n,r,o){const a=[0,t.length-1,0],s=[],l=r*r;for(;a.length;){const u=a.pop(),c=a.pop(),h=a.pop();if(c-h<=o){for(let r=h;r<=c;r++)R(e[2*r],e[2*r+1],i,n)<=l&&s.push(t[r]);continue}const p=Math.floor((h+c)/2),d=e[2*p],f=e[2*p+1];R(d,f,i,n)<=l&&s.push(t[p]);const m=(u+1)%2;(0===u?i-r<=d:n-r<=f)&&(a.push(h),a.push(p-1),a.push(m)),(0===u?i+r>=d:n+r>=f)&&(a.push(p+1),a.push(c),a.push(m))}return s}(this.ids,this.coords,t,e,i,this.nodeSize)}}const j={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},N=Math.fround||(V=new Float32Array(1),t=>(V[0]=+t,V[0]));var V;class G{constructor(t){this.options=J(Object.create(j),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:i,maxZoom:n,nodeSize:r}=this.options;e&&console.time("total time");const o=`prepare ${t.length} points`;e&&console.time(o),this.points=t;let a=[];for(let e=0;e<t.length;e++)t[e].geometry&&a.push(W(t[e],e));this.trees[n+1]=new U(a,Y,Q,r,Float32Array),e&&console.timeEnd(o);for(let t=n;t>=i;t--){const i=+Date.now();a=this._cluster(a,t),this.trees[t]=new U(a,Y,Q,r,Float32Array),e&&console.log("z%d: %d clusters in %dms",t,a.length,+Date.now()-i)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let r=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,r=180;else if(i>r){const t=this.getClusters([i,n,180,o],e),a=this.getClusters([-180,n,r,o],e);return t.concat(a)}const a=this.trees[this._limitZoom(e)],s=a.range($(i),X(o),$(r),X(n)),l=[];for(const t of s){const e=a.points[t];l.push(e.numPoints?Z(e):this.points[e.index])}return l}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),n="No cluster with the specified id.",r=this.trees[i];if(!r)throw new Error(n);const o=r.points[e];if(!o)throw new Error(n);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=r.within(o.x,o.y,a),l=[];for(const e of s){const i=r.points[e];i.parentId===t&&l.push(i.numPoints?Z(i):this.points[i.index])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,i){const n=[];return this._appendLeaves(n,t,e=e||10,i=i||0,0),n}getTile(t,e,i){const n=this.trees[this._limitZoom(t)],r=Math.pow(2,t),{extent:o,radius:a}=this.options,s=a/o,l=(i-s)/r,u=(i+1+s)/r,c={features:[]};return this._addTileFeatures(n.range((e-s)/r,l,(e+1+s)/r,u),n.points,e,i,r,c),0===e&&this._addTileFeatures(n.range(1-s/r,l,1,u),n.points,r,i,r,c),e===r-1&&this._addTileFeatures(n.range(0,l,s/r,u),n.points,-1,i,r,c),c.features.length?c:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,n,r){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?r+o.point_count<=n?r+=o.point_count:r=this._appendLeaves(t,o.cluster_id,i,n,r):r<n?r++:t.push(e),t.length===i)break}return r}_addTileFeatures(t,e,i,n,r,o){for(const a of t){const t=e[a],s=t.numPoints;let l,u,c;if(s)l=H(t),u=t.x,c=t.y;else{const e=this.points[t.index];l=e.properties,u=$(e.geometry.coordinates[0]),c=X(e.geometry.coordinates[1])}const h={type:1,geometry:[[Math.round(this.options.extent*(u*r-i)),Math.round(this.options.extent*(c*r-n))]],tags:l};let p;s?p=t.id:this.options.generateId?p=t.index:this.points[t.index].id&&(p=this.points[t.index].id),void 0!==p&&(h.id=p),o.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))}_cluster(t,e){const i=[],{radius:n,extent:r,reduce:o,minPoints:a}=this.options,s=n/(r*Math.pow(2,e));for(let n=0;n<t.length;n++){const r=t[n];if(r.zoom<=e)continue;r.zoom=e;const l=this.trees[e+1],u=l.within(r.x,r.y,s),c=r.numPoints||1;let h=c;for(const t of u){const i=l.points[t];i.zoom>e&&(h+=i.numPoints||1)}if(h>c&&h>=a){let t=r.x*c,a=r.y*c,s=o&&c>1?this._map(r,!0):null;const p=(n<<5)+(e+1)+this.points.length;for(const i of u){const n=l.points[i];if(n.zoom<=e)continue;n.zoom=e;const u=n.numPoints||1;t+=n.x*u,a+=n.y*u,n.parentId=p,o&&(s||(s=this._map(r,!0)),o(s,this._map(n)))}r.parentId=p,i.push(q(t/h,a/h,p,h,s))}else if(i.push(r),h>1)for(const t of u){const n=l.points[t];n.zoom<=e||(n.zoom=e,i.push(n))}}return i}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?J({},t.properties):t.properties;const i=this.points[t.index].properties,n=this.options.map(i);return e&&n===i?J({},n):n}}function q(t,e,i,n,r){return{x:N(t),y:N(e),zoom:1/0,id:i,parentId:-1,numPoints:n,properties:r}}function W(t,e){const[i,n]=t.geometry.coordinates;return{x:N($(i)),y:N(X(n)),zoom:1/0,index:e,parentId:-1}}function Z(t){return{type:"Feature",id:t.id,properties:H(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),K(t.y)]}};var e}function H(t){const e=t.numPoints,i=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return J(J({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:i})}function $(t){return t/360+.5}function X(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function K(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function J(t,e){for(const i in e)t[i]=e[i];return t}function Y(t){return t.x}function Q(t){return t.y}function tt(t,e,i,n,r,o){var a=r-i,s=o-n;if(0!==a||0!==s){var l=((t-i)*a+(e-n)*s)/(a*a+s*s);l>1?(i=r,n=o):l>0&&(i+=a*l,n+=s*l)}return(a=t-i)*a+(s=e-n)*s}function et(t,e,i,n){var r={id:void 0===t?null:t,type:e,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)it(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var n=0;n<e.length;n++)it(t,e[n]);else if("MultiPolygon"===i)for(n=0;n<e.length;n++)for(var r=0;r<e[n].length;r++)it(t,e[n][r])}(r),r}function it(t,e){for(var i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function nt(t,e,i,n){if(e.geometry){var r=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),s=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=n||0),"Point"===o)rt(r,s);else if("MultiPoint"===o)for(var u=0;u<r.length;u++)rt(r[u],s);else if("LineString"===o)ot(r,s,a,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(u=0;u<r.length;u++)ot(r[u],s=[],a,!1),t.push(et(l,"LineString",s,e.properties));return}at(r,s,a,!1)}else if("Polygon"===o)at(r,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(u=0;u<e.geometry.geometries.length;u++)nt(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},i,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<r.length;u++){var c=[];at(r[u],c,a,!0),s.push(c)}}t.push(et(l,o,s,e.properties))}}function rt(t,e){e.push(st(t[0])),e.push(lt(t[1])),e.push(0)}function ot(t,e,i,n){for(var r,o,a=0,s=0;s<t.length;s++){var l=st(t[s][0]),u=lt(t[s][1]);e.push(l),e.push(u),e.push(0),s>0&&(a+=n?(r*u-l*o)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(u-o,2))),r=l,o=u}var c=e.length-3;e[2]=1,function t(e,i,n,r){for(var o,a=r,s=n-i>>1,l=n-i,u=e[i],c=e[i+1],h=e[n],p=e[n+1],d=i+3;d<n;d+=3){var f=tt(e[d],e[d+1],u,c,h,p);if(f>a)o=d,a=f;else if(f===a){var m=Math.abs(d-s);m<l&&(o=d,l=m)}}a>r&&(o-i>3&&t(e,i,o,r),e[o+2]=a,n-o>3&&t(e,o,n,r))}(e,0,c,i),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function at(t,e,i,n){for(var r=0;r<t.length;r++){var o=[];ot(t[r],o,i,n),e.push(o)}}function st(t){return t/360+.5}function lt(t){var e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function ut(t,e,i,n,r,o,a,s){if(n/=e,o>=(i/=e)&&a<n)return t;if(a<i||o>=n)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],h=c.geometry,p=c.type,d=0===r?c.minX:c.minY,f=0===r?c.maxX:c.maxY;if(d>=i&&f<n)l.push(c);else if(!(f<i||d>=n)){var m=[];if("Point"===p||"MultiPoint"===p)ct(h,m,i,n,r);else if("LineString"===p)ht(h,m,i,n,r,!1,s.lineMetrics);else if("MultiLineString"===p)dt(h,m,i,n,r,!1);else if("Polygon"===p)dt(h,m,i,n,r,!0);else if("MultiPolygon"===p)for(var g=0;g<h.length;g++){var _=[];dt(h[g],_,i,n,r,!0),_.length&&m.push(_)}if(m.length){if(s.lineMetrics&&"LineString"===p){for(g=0;g<m.length;g++)l.push(et(c.id,p,m[g],c.tags));continue}"LineString"!==p&&"MultiLineString"!==p||(1===m.length?(p="LineString",m=m[0]):p="MultiLineString"),"Point"!==p&&"MultiPoint"!==p||(p=3===m.length?"Point":"MultiPoint"),l.push(et(c.id,p,m,c.tags))}}}return l.length?l:null}function ct(t,e,i,n,r){for(var o=0;o<t.length;o+=3){var a=t[o+r];a>=i&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function ht(t,e,i,n,r,o,a){for(var s,l,u=pt(t),c=0===r?mt:gt,h=t.start,p=0;p<t.length-3;p+=3){var d=t[p],f=t[p+1],m=t[p+2],g=t[p+3],_=t[p+4],y=0===r?d:f,x=0===r?g:_,v=!1;a&&(s=Math.sqrt(Math.pow(d-g,2)+Math.pow(f-_,2))),y<i?x>i&&(l=c(u,d,f,g,_,i),a&&(u.start=h+s*l)):y>n?x<n&&(l=c(u,d,f,g,_,n),a&&(u.start=h+s*l)):ft(u,d,f,m),x<i&&y>=i&&(l=c(u,d,f,g,_,i),v=!0),x>n&&y<=n&&(l=c(u,d,f,g,_,n),v=!0),!o&&v&&(a&&(u.end=h+s*l),e.push(u),u=pt(t)),a&&(h+=s)}var b=t.length-3;d=t[b],f=t[b+1],m=t[b+2],(y=0===r?d:f)>=i&&y<=n&&ft(u,d,f,m),b=u.length-3,o&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&ft(u,u[0],u[1],u[2]),u.length&&e.push(u)}function pt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function dt(t,e,i,n,r,o){for(var a=0;a<t.length;a++)ht(t[a],e,i,n,r,o,!1)}function ft(t,e,i,n){t.push(e),t.push(i),t.push(n)}function mt(t,e,i,n,r,o){var a=(o-e)/(n-e);return t.push(o),t.push(i+(r-i)*a),t.push(1),a}function gt(t,e,i,n,r,o){var a=(o-i)/(r-i);return t.push(e+(n-e)*a),t.push(o),t.push(1),a}function _t(t,e){for(var i=[],n=0;n<t.length;n++){var r,o=t[n],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)r=yt(o.geometry,e);else if("MultiLineString"===a||"Polygon"===a){r=[];for(var s=0;s<o.geometry.length;s++)r.push(yt(o.geometry[s],e))}else if("MultiPolygon"===a)for(r=[],s=0;s<o.geometry.length;s++){for(var l=[],u=0;u<o.geometry[s].length;u++)l.push(yt(o.geometry[s][u],e));r.push(l)}i.push(et(o.id,a,r,o.tags))}return i}function yt(t,e){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var n=0;n<t.length;n+=3)i.push(t[n]+e,t[n+1],t[n+2]);return i}function xt(t,e){if(t.transformed)return t;var i,n,r,o=1<<t.z,a=t.x,s=t.y;for(i=0;i<t.features.length;i++){var l=t.features[i],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(n=0;n<u.length;n+=2)l.geometry.push(vt(u[n],u[n+1],e,o,a,s));else for(n=0;n<u.length;n++){var h=[];for(r=0;r<u[n].length;r+=2)h.push(vt(u[n][r],u[n][r+1],e,o,a,s));l.geometry.push(h)}}return t.transformed=!0,t}function vt(t,e,i,n,r,o){return[Math.round(i*(t*n-r)),Math.round(i*(e*n-o))]}function bt(t,e,i,n,r){for(var o=e===r.maxZoom?0:r.tolerance/((1<<e)*r.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,wt(a,t[s],o,r);var l=t[s].minX,u=t[s].minY,c=t[s].maxX,h=t[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function wt(t,e,i,n){var r=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s<r.length;s+=3)a.push(r[s]),a.push(r[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)St(a,r,t,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<r.length;s++)St(a,r[s],t,i,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(var l=0;l<r.length;l++){var u=r[l];for(s=0;s<u.length;s++)St(a,u[s],t,i,!0,0===s)}if(a.length){var c=e.tags||null;if("LineString"===o&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=r.start/r.size,c.mapbox_clip_end=r.end/r.size}var p={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function St(t,e,i,n,r,o){var a=n*n;if(n>0&&e.size<(r?a:n))i.numPoints+=e.length/3;else{for(var s=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>a)&&(i.numSimplified++,s.push(e[l]),s.push(e[l+1])),i.numPoints++;r&&function(t,e){for(var i=0,n=0,r=t.length,o=r-2;n<r;o=n,n+=2)i+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(i>0===e)for(n=0,r=t.length;n<r/2;n+=2){var a=t[n],s=t[n+1];t[n]=t[r-2-n],t[n+1]=t[r-1-n],t[r-2-n]=a,t[r-1-n]=s}}(s,o),t.push(s)}}function Tt(t,e){var i=(e=this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(Object.create(this.options),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)nt(i,t.features[n],e,n);else nt(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=function(t,e){var i=e.buffer/e.extent,n=t,r=ut(t,1,-1-i,i,0,-1,2,e),o=ut(t,1,1-i,2+i,0,-1,2,e);return(r||o)&&(n=ut(t,1,-i,1+i,0,-1,2,e)||[],r&&(n=_t(r,1).concat(n)),o&&(n=n.concat(_t(o,-1)))),n}(n,e)).length&&this.splitTile(n,0,0,0),i&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Et(t,e,i){return 32*((1<<t)*i+e)+t}function At(t,e){const i=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);const n=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!n)return e(null,null);const r=new m(n.features);let o=z(r);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:r,rawData:o.buffer})}Tt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Tt.prototype.splitTile=function(t,e,i,n,r,o,a){for(var s=[t,e,i,n],l=this.options,u=l.debug;s.length;){n=s.pop(),i=s.pop(),e=s.pop(),t=s.pop();var c=1<<e,h=Et(e,i,n),p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=bt(t,e,i,n,l),this.tileCoords.push({z:e,x:i,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var d="z"+e;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(p.source=t,r){if(e===l.maxZoom||e===r)continue;var f=1<<r-e;if(i!==Math.floor(o/f)||n!==Math.floor(a/f))continue}else if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==t.length){u>1&&console.time("clipping");var m,g,_,y,x,v,b=.5*l.buffer/l.extent,w=.5-b,S=.5+b,T=1+b;m=g=_=y=null,x=ut(t,c,i-b,i+S,0,p.minX,p.maxX,l),v=ut(t,c,i+w,i+T,0,p.minX,p.maxX,l),t=null,x&&(m=ut(x,c,n-b,n+S,1,p.minY,p.maxY,l),g=ut(x,c,n+w,n+T,1,p.minY,p.maxY,l),x=null),v&&(_=ut(v,c,n-b,n+S,1,p.minY,p.maxY,l),y=ut(v,c,n+w,n+T,1,p.minY,p.maxY,l),v=null),u>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*i,2*n),s.push(g||[],e+1,2*i,2*n+1),s.push(_||[],e+1,2*i+1,2*n),s.push(y||[],e+1,2*i+1,2*n+1)}}},Tt.prototype.getTile=function(t,e,i){var n=this.options,r=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<<t,s=Et(t,e=(e%a+a)%a,i);if(this.tiles[s])return xt(this.tiles[s],r);o>1&&console.log("drilling down to z%d-%d-%d",t,e,i);for(var l,u=t,c=e,h=i;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Et(u,c,h)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,h),o>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,i),o>1&&console.timeEnd("drilling down"),this.tiles[s]?xt(this.tiles[s],r):null):null};class It extends l{constructor(t,e,i,n){super(t,e,i,At),n&&(this.loadGeoJSON=n)}loadData(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;const e=this._pendingCallback,i=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;const n=!!(i&&i.request&&i.request.collectResourceTiming)&&new t.RequestPerformance(i.request);this.loadGeoJSON(i,(r,o)=>{if(r||!o)return e(r);if("object"!=typeof o)return e(new Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));{c(o,!0);try{if(i.filter){const e=t.createExpression(i.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===e.result)throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));const n=o.features.filter(t=>e.value.evaluate({zoom:0},t));o={type:"FeatureCollection",features:n}}this._geoJSONIndex=i.cluster?new G(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const n={},r={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(i);for(const e of s){const[o,a]=i[e],s=t.createExpression(a),l=t.createExpression("string"==typeof o?[o,["accumulated"],["get",e]]:o);n[e]=s.value,r[e]=l.value}return e.map=t=>{a.properties=t;const e={};for(const t of s)e[t]=n[t].evaluate(o,a);return e},e.reduce=(t,e)=>{a.properties=e;for(const e of s)o.accumulated=t[e],t[e]=r[e].evaluate(o,a)},e}(i)).load(o.features):function(t,e){return new Tt(t,e)}(o,i.geojsonVtOptions)}catch(r){return e(r)}this.loaded={};const a={};if(n){const t=n.finish();t&&(a.resourceTiming={},a.resourceTiming[i.source]=JSON.parse(JSON.stringify(t)))}e(null,a)}})}coalesce(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())}reloadTile(t,e){const i=this.loaded;return i&&i[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}loadGeoJSON(e,i){if(e.request)t.getJSON(e.request,i);else{if("string"!=typeof e.data)return i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));try{return i(null,JSON.parse(e.data))}catch(t){return i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}}}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class Ct{constructor(e){this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:l,geojson:It},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,i){this.availableImages[t]=e;for(const i in this.workerSources[t]){const n=this.workerSources[t][i];for(const t in n)n[t].availableImages=e}i()}setLayers(t,e,i){this.getLayerIndex(t).replace(e),i()}updateLayers(t,e,i){this.getLayerIndex(t).update(e.layers,e.removedIds),i()}loadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).loadTile(e,i)}loadDEMTile(t,e,i){this.getDEMWorkerSource(t,e.source).loadTile(e,i)}reloadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).reloadTile(e,i)}abortTile(t,e,i){this.getWorkerSource(t,e.type,e.source).abortTile(e,i)}removeTile(t,e,i){this.getWorkerSource(t,e.type,e.source).removeTile(e,i)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,i){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,i):i()}loadWorkerSource(t,e,i){try{this.self.importScripts(e.url),i()}catch(t){i(t.toString())}}syncRTLPluginState(e,i,n){try{t.plugin.setState(i);const e=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=e){this.self.importScripts(e);const i=t.plugin.isParsed();n(i?void 0:new Error("RTL Text Plugin failed to import scripts from "+e),i)}}catch(e){n(e.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new n),e}getWorkerSource(t,e,i){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){const n={send:(e,i,n)=>{this.actor.send(e,i,n,t)}};this.workerSources[t][e][i]=new this.workerSourceTypes[e](n,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][e][i]}getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new u),this.demWorkerSources[t][e]}enforceCacheSizeLimit(e,i){t.enforceCacheSizeLimit(i)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Ct(self)),Ct})),n(0,(function(t){var e=i;function i(t){return!function(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,i=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(i);try{e=new Worker(n),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(n),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var i=e.getImageData(0,0,1,1);return i&&i.width===t.width}()?(void 0===n[e=t&&t.failIfMajorPerformanceCaveat]&&(n[e]=function(t){var e,n=function(t){var e=document.createElement("canvas"),n=Object.create(i.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,e.getContext("webgl",n)||e.getContext("experimental-webgl",n)}(t);if(!n)return!1;try{e=n.createShader(n.VERTEX_SHADER)}catch(t){return!1}return!(!e||n.isContextLost())&&(n.shaderSource(e,"void main() {}"),n.compileShader(e),!0===n.getShaderParameter(e,n.COMPILE_STATUS))}(e)),n[e]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var e}(t)}var n={};function r(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!r(t[i],e[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(!r(t[i],e[i]))return!1;return!0}return t===e}i.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class o{static testProp(t){if(!o.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in o.docStyle)return t[e];return t[0]}static create(t,e,i){const n=window.document.createElement(t);return void 0!==e&&(n.className=e),i&&i.appendChild(n),n}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){o.docStyle&&o.selectProp&&(o.userSelect=o.docStyle[o.selectProp],o.docStyle[o.selectProp]="none")}static enableDrag(){o.docStyle&&o.selectProp&&(o.docStyle[o.selectProp]=o.userSelect)}static setTransform(t,e){t.style[o.transformProp]=e}static addEventListener(t,e,i,n={}){t.addEventListener(e,i,"passive"in n?n:n.capture)}static removeEventListener(t,e,i,n={}){t.removeEventListener(e,i,"passive"in n?n:n.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",o.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",o.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",o.suppressClickInternal,!0)},0)}static mousePos(e,i){const n=e.getBoundingClientRect();return new t.pointGeometry(i.clientX-n.left-e.clientLeft,i.clientY-n.top-e.clientTop)}static touchPos(e,i){const n=e.getBoundingClientRect(),r=[];for(let o=0;o<i.length;o++)r.push(new t.pointGeometry(i[o].clientX-n.left-e.clientLeft,i[o].clientY-n.top-e.clientTop));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}o.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,o.selectProp=o.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),o.transformProp=o.testProp(["transform","WebkitTransform"]);class a{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,i){const n=function(t){const e=t.match(s);if(!e)throw new Error(`Unable to parse URL "${t}"`);return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}(t);return n.path+=`${e}${i}`,function(t){const e=t.params.length?"?"+t.params.join("&"):"";return`${t.protocol}://${t.authority}${t.path}${e}`}(n)}setTransformRequest(t){this._transformRequestFn=t}}const s=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function l(e){var i=new t.ARRAY_TYPE(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}var u,c=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t};u=new t.ARRAY_TYPE(3),t.ARRAY_TYPE!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var h=function(t){var e=t[0],i=t[1];return e*e+i*i};!function(){var e=new t.ARRAY_TYPE(2);t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0)}();class p{constructor(t,e,i,n){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,n)}update(e,i,n){const{width:r,height:o}=e,a=!(this.size&&this.size[0]===r&&this.size[1]===o||n),{context:s}=this,{gl:l}=s;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),a)this.size=[r,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,r,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:a}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,a,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,a,r,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:n}=this,{gl:r}=n;r.bindTexture(r.TEXTURE_2D,this.texture),i!==r.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=r.LINEAR),t!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function d(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class f extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,e){this._validate(t,e)&&(this.images[t]=e)}_validate(e,i){let n=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),n=!1),n}_validateStretch(t,e){if(!t)return!0;let i=0;for(const n of t){if(n[0]<i||n[1]<n[0]||e<n[1])return!1;i=n[1]}return!0}_validateContent(t,e){return!(t&&(4!==t.length||t[0]<0||e.data.width<t[0]||t[1]<0||e.data.height<t[1]||t[2]<0||e.data.width<t[2]||t[3]<0||e.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,e){e.version=this.images[t].version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,e){let i=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e})}_notify(e,i){const n={};for(const i of e){this.images[i]||this.fire(new t.Event("styleimagemissing",{id:i}));const e=this.images[i];e?n[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.warnOnce(`Image "${i}" 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.`)}i(null,n)}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(e){const i=this.patterns[e],n=this.getImage(e);if(!n)return null;if(i&&i.position.version===n.version)return i.position;if(i)i.position.version=n.version;else{const i={w:n.data.width+2,h:n.data.height+2,x:0,y:0},r=new t.ImagePosition(i,n);this.patterns[e]={bin:i,position:r}}return this._updatePatternAtlas(),this.patterns[e].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new p(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:n}=t.potpack(e),r=this.atlasImage;r.resize({width:i||1,height:n||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],n=i.x+1,o=i.y+1,a=this.images[e].data,s=a.width,l=a.height;t.RGBAImage.copy(a,r,{x:0,y:0},{x:n,y:o},{width:s,height:l}),t.RGBAImage.copy(a,r,{x:0,y:l-1},{x:n,y:o-1},{width:s,height:1}),t.RGBAImage.copy(a,r,{x:0,y:0},{x:n,y:o+l},{width:s,height:1}),t.RGBAImage.copy(a,r,{x:s-1,y:0},{x:n-1,y:o},{width:1,height:l}),t.RGBAImage.copy(a,r,{x:0,y:0},{x:n+s,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const e of t){if(this.callbackDispatchedThisFrame[e])continue;this.callbackDispatchedThisFrame[e]=!0;const t=this.images[e];d(t)&&this.updateImage(e,t)}}}const m=1e20;function g(t,e,i,n,r,o,a,s,l){for(let u=e;u<e+n;u++)_(t,i*o+u,o,r,a,s,l);for(let u=i;u<i+r;u++)_(t,u*o+e,1,n,a,s,l)}function _(t,e,i,n,r,o,a){o[0]=0,a[0]=-m,a[1]=m,r[0]=t[e];for(let s=1,l=0,u=0;s<n;s++){r[s]=t[e+s*i];const n=s*s;do{const t=o[l];u=(r[s]-r[t]+n-t*t)/(s-t)/2}while(u<=a[l]&&--l>-1);l++,o[l]=s,a[l]=u,a[l+1]=m}for(let s=0,l=0;s<n;s++){for(;a[l+1]<s;)l++;const n=o[l],u=s-n;t[e+s*i]=r[n]+u*u}}class y{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(e,i){const n=[];for(const t in e)for(const i of e[t])n.push({stack:t,id:i});t.asyncAll(n,({stack:t,id:e},i)=>{let n=this.entries[t];n||(n=this.entries[t]={glyphs:{},requests:{},ranges:{}});let r=n.glyphs[e];if(void 0!==r)return void i(null,{stack:t,id:e,glyph:r});if(r=this._tinySDF(n,t,e),r)return n.glyphs[e]=r,void i(null,{stack:t,id:e,glyph:r});const o=Math.floor(e/256);if(256*o>65535)return void i(new Error("glyphs > 65535 not supported"));if(n.ranges[o])return void i(null,{stack:t,id:e,glyph:r});let a=n.requests[o];a||(a=n.requests[o]=[],y.loadGlyphRange(t,o,this.url,this.requestManager,(t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(n.glyphs[+t]=e[+t]);n.ranges[o]=!0}for(const i of a)i(t,e);delete n.requests[o]})),a.push((n,r)=>{n?i(n):r&&i(null,{stack:t,id:e,glyph:r[e]||null})})},(t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:n,glyph:r}of e)(t[i]||(t[i]={}))[n]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics};i(null,t)}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(t.unicodeBlockLookup["CJK Unified Ideographs"](e)||t.unicodeBlockLookup["Hangul Syllables"](e)||t.unicodeBlockLookup.Hiragana(e)||t.unicodeBlockLookup.Katakana(e))}_tinySDF(e,i,n){const r=this.localIdeographFontFamily;if(!r)return;if(!this._doesCharSupportLocalGlyph(n))return;let o=e.tinySDF;if(!o){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),o=e.tinySDF=new y.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:r,fontWeight:t})}const a=o.draw(String.fromCharCode(n));return{id:n,bitmap:new t.AlphaImage({width:a.width||30,height:a.height||30},a.data),metrics:{width:a.glyphWidth||24,height:a.glyphHeight||24,left:a.glyphLeft||0,top:a.glyphTop-27||-8,advance:a.glyphAdvance||24}}}}y.loadGlyphRange=function(e,i,n,r,o){const a=256*i,s=a+255,l=r.transformRequest(n.replace("{fontstack}",e).replace("{range}",`${a}-${s}`),t.ResourceType.Glyphs);t.getArrayBuffer(l,(e,i)=>{if(e)o(e);else if(i){const e={};for(const n of t.parseGlyphPBF(i))e[n.id]=n;o(null,e)}})},y.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:r="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const s=this.size=t+4*e,l=this._createCanvas(s),u=this.ctx=l.getContext("2d",{willReadFrequently:!0});u.font=`${a} ${o} ${t}px ${r}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:r,actualBoundingBoxRight:o}=this.ctx.measureText(t),a=Math.ceil(i),s=Math.min(this.size-this.buffer,Math.ceil(o-r)),l=Math.min(this.size-this.buffer,a+Math.ceil(n)),u=s+2*this.buffer,c=l+2*this.buffer,h=Math.max(u*c,0),p=new Uint8ClampedArray(h),d={data:p,width:u,height:c,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===s||0===l)return d;const{ctx:f,buffer:_,gridInner:y,gridOuter:x}=this;f.clearRect(_,_,s,l),f.fillText(t,_,_+a);const v=f.getImageData(_,_,s,l);x.fill(m,0,h),y.fill(0,0,h);for(let t=0;t<l;t++)for(let e=0;e<s;e++){const i=v.data[4*(t*s+e)+3]/255;if(0===i)continue;const n=(t+_)*u+e+_;if(1===i)x[n]=0,y[n]=m;else{const t=.5-i;x[n]=t>0?t*t:0,y[n]=t<0?t*t:0}}g(x,0,0,u,c,u,this.f,this.v,this.z),g(y,_,_,s,l,u,this.f,this.v,this.z);for(let t=0;t<h;t++){const e=Math.sqrt(x[t])-Math.sqrt(y[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return d}};const x=new t.Properties({anchor:new t.DataConstantProperty(t.spec.light.anchor),position:new class{constructor(){this.specification=t.spec.light.position}possiblyEvaluate(e,i){return t.sphericalToCartesian(e.expression.evaluate(i))}interpolate(e,i,n){return{x:t.number(e.x,i.x,n),y:t.number(e.y,i.y,n),z:t.number(e.z,i.z,n)}}},color:new t.DataConstantProperty(t.spec.light.color),intensity:new t.DataConstantProperty(t.spec.light.intensity)}),v="-transition";class b extends t.Evented{constructor(e){super(),this._transitionable=new t.Transitionable(x),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.validateLight,e,i))for(const t in e){const i=e[t];t.endsWith(v)?this._transitionable.setTransition(t.slice(0,-v.length),i):this._transitionable.setValue(t,i)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(e,i,n){return(!n||!1!==n.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.spec})))}}class w{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const i=t.join(",")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]}getDashRanges(t,e,i){const n=[];let r=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,a=!0;n.push({left:r,right:o,isDash:a,zeroLength:0===t[0]});let s=t[0];for(let e=1;e<t.length;e++){a=!a;const l=t[e];r=s*i,s+=l,o=s*i,n.push({left:r,right:o,isDash:a,zeroLength:0===l})}return n}addRoundDash(t,e,i){const n=e/2;for(let e=-i;e<=i;e++){const r=this.width*(this.nextRow+i+e);let o=0,a=t[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=t[++o]);const l=Math.abs(s-a.left),u=Math.abs(s-a.right),c=Math.min(l,u);let h;const p=e/i*(n+1);if(a.isDash){const t=n-Math.abs(p);h=Math.sqrt(c*c+t*t)}else h=n-Math.sqrt(c*c+p*p);this.data[r+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],n=t[e+1];i.zeroLength?t.splice(e,1):n&&n.isDash===i.isDash&&(n.left=i.left,t.splice(e,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const n=this.width*this.nextRow;let r=0,o=t[r];for(let e=0;e<this.width;e++){e/o.right>1&&(o=t[++r]);const i=Math.abs(e-o.left),a=Math.abs(e-o.right),s=Math.min(i,a);this.data[n+e]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(e,i){const n=i?7:0,r=2*n+1;if(this.nextRow+r>this.height)return t.warnOnce("LineAtlas out of space"),null;let o=0;for(let t=0;t<e.length;t++)o+=e[t];if(0!==o){const t=this.width/o,r=this.getDashRanges(e,this.width,t);i?this.addRoundDash(r,t,n):this.addRegularDash(r)}const a={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:o};return this.nextRow+=r,this.dirty=!0,a}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}class S{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t.uniqueId();const n=this.workerPool.acquire(this.id);for(let t=0;t<n.length;t++){const e=new S.Actor(n[t],i,this.id);e.name="Worker "+t,this.actors.push(e)}}broadcast(e,i,n){t.asyncAll(this.actors,(t,n)=>{t.send(e,i,n)},n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function T(e,i,n){const r=function(i,r){if(i)return n(i);if(r){const i=t.pick(t.extend(r,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);r.vector_layers&&(i.vectorLayers=r.vector_layers,i.vectorLayerIds=i.vectorLayers.map(t=>t.id)),n(null,i)}};return e.url?t.getJSON(i.transformRequest(e.url,t.ResourceType.Source),r):t.exported.frame(()=>r(null,e))}S.Actor=t.Actor;class E{constructor(e,i,n){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=n||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),n=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),r=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=n&&e.x<o&&e.y>=r&&e.y<a}}class A extends t.Evented{constructor(e,i,n,r){if(super(),this.id=e,this.dispatcher=n,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(i,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=T(this._options,this.map._requestManager,(e,i)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new E(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(n,t.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function o(n,r){return delete e.request,e.aborted?i(null):n&&404!==n.status?i(n):(r&&r.resourceTiming&&(e.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&e.setExpiryData(r),e.loadVectorData(r,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}r.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=i:e.request=e.actor.send("reloadTile",r,o.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",r,o.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class I extends t.Evented{constructor(e,i,n,r){super(),this.id=e,this.dispatcher=n,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=T(this._options,this.map._requestManager,(e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new E(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),(n,r,o)=>{if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(n)e.state="errored",i(n);else if(r){this.map._refreshExpiredTiles&&e.setExpiryData(o);const n=this.map.painter.context,a=n.gl;e.texture=this.map.painter.getTileTexture(r.width),e.texture?e.texture.update(r,{useMipmap:!0}):(e.texture=new p(n,r,a.RGBA,{useMipmap:!0}),e.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST),n.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(this.dispatcher),i(null)}})}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}let C;class P extends I{constructor(e,i,n,r){super(e,i,n,r),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function r(t,n){t&&(e.state="errored",i(t)),n&&(e.dem=n,e.needsHillshadePrepare=!0,e.state="loaded",i(null))}e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),function(n,o){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(n)e.state="errored",i(n);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;const i=t.isImageBitmap(o)&&(null==C&&(C="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),C)?o:t.exported.getImageData(o,1),n={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",n,r.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)}_getNeighboringTiles(e){const i=e.canonical,n=Math.pow(2,i.z),r=(i.x-1+n)%n,o=0===i.x?e.wrap-1:e.wrap,a=(i.x+1+n)%n,s=i.x+1===n?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1}),i.y+1<n&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,i.z,a,i.y+1).key]={backfilled:!1}),l}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class M extends t.Evented{constructor(e,i,n,r){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=n.getActor(),this.setEventedParent(r),this._data=i.data,this._options=t.extend({},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;const o=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*o,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*o,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.EXTENT,radius:(i.clusterRadius||50)*o,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,i,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},n),this}_updateWorkerData(e){const i=t.extend({},this.workerOptions),n=this._data;"string"==typeof n?(i.request=this.map._requestManager.transformRequest(t.exported.resolveURL(n),t.ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(n),this._pendingLoads++,this.fire(new t.Event("dataloading",{dataType:"source"})),this.actor.send(this.type+".loadData",i,(n,r)=>{if(this._pendingLoads--,this._removed||r&&r.abandoned)return;let o=null;if(r&&r.resourceTiming&&r.resourceTiming[this.id]&&(o=r.resourceTiming[this.id].slice(0)),this.actor.send(this.type+".coalesce",{source:i.source},null),n)return void this.fire(new t.ErrorEvent(n));const a={dataType:"source",sourceDataType:e};this._collectResourceTiming&&o&&o.length>0&&t.extend(a,{resourceTiming:o}),this.fire(new t.Event("data",a))})}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const n={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(i,n,(n,r)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):n?e(n):(t.loadVectorData(r,this.map.painter,"reloadTile"===i),e(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return t.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var k=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class z extends t.Evented{constructor(t,e,i,n){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=e}load(e,i){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(n,r)=>{this._loaded=!0,n?this.fire(new t.ErrorEvent(n)):r&&(this.image=r,e&&(this.coordinates=e),i&&i(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(e){this.coordinates=e;const i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),n=Math.min(n,t.y),r=Math.max(r,t.x),o=Math.max(o,t.y);const a=Math.max(r-i,o-n),s=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,s);return new t.CanonicalTileID(s,Math.floor((i+r)/2*l),Math.floor((n+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const n=i.map(t=>this.tileID.getTilePoint(t)._round());return this._boundsArray=new t.RasterBoundsArray,this._boundsArray.emplaceBack(n[0].x,n[0].y,0,0),this._boundsArray.emplaceBack(n[1].x,n[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(n[3].x,n[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(n[2].x,n[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("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.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,k.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new p(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class L extends z{constructor(t,e,i,n){super(t,e,i,n),this.roundZoom=!0,this.type="video",this.options=e}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,t.ResourceType.Source).url);t.getVideo(this.urls,(e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}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.ErrorEvent(new t.ValidationError("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}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,k.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),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 p(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class B extends z{constructor(e,i,n,r){super(e,i,n,r),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+e,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+e,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("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.ErrorEvent(new t.ValidationError("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.ErrorEvent(new t.ValidationError("sources."+e,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){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.ErrorEvent(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(t){this.map=t,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,n=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,k.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new p(i,this.canvas,n.RGBA,{premultiply:!0});for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const D={vector:A,raster:I,"raster-dem":P,geojson:M,video:L,image:z,canvas:B};function R(e,i){const n=t.create();return t.translate(n,n,[1,1,0]),t.scale(n,n,[.5*e.width,.5*e.height,1]),t.multiply(n,n,e.calculatePosMatrix(i.toUnwrapped()))}function O(t,e,i,n,r,o){const a=function(t,e,i){if(t)for(const n of t){const t=e[n];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const n=e[t];if(n.source===i&&"fill-extrusion"===n.type)return!0}return!1}(r&&r.layers,e,t.id),s=o.maxPitchScaleFactor(),l=t.tilesIn(n,s,a);l.sort(F);const u=[];for(const n of l)u.push({wrappedTileID:n.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(e,i,t._state,n.queryGeometry,n.cameraQueryGeometry,n.scale,r,o,s,R(t.transform,n.tileID))});const c=function(t){const e={},i={};for(const n of t){const t=n.queryResults,r=n.wrappedTileID,o=i[r]=i[r]||{};for(const i in t){const n=t[i],r=o[i]=o[i]||{},a=e[i]=e[i]||[];for(const t of n)r[t.featureIndex]||(r[t.featureIndex]=!0,a.push(t))}}return e}(u);for(const e in c)c[e].forEach(e=>{const i=e.feature,n=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=n});return c}function F(t,e){const i=t.tileID,n=e.tileID;return i.overscaledZ-n.overscaledZ||i.canonical.y-n.canonical.y||i.wrap-n.wrap||i.canonical.x-n.canonical.x}class U{constructor(e,i){this.tileID=e,this.uid=t.uniqueId(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<t.exported.now()||this.fadeEndTime&&i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}loadVectorData(e,i,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const n of t){const t=n.layerIds.map(t=>e.getLayer(t)).filter(Boolean);if(0!==t.length){n.layers=t,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(e=>t.filter(t=>t.id===e)[0]));for(const e of t)i[e.id]=n}}return i}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket){if(this.hasSymbolBuckets=!0,!n)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.SymbolBucket&&i.hasRTLText){this.hasRTLText=!0,t.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new p(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new p(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,n,r,o,a,s,l,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:r,scale:o,tileSize:this.tileSize,pixelPosMatrix:u,transform:s,params:a,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const r=n.loadVTLayers(),o=i?i.sourceLayer:"",a=r._geojsonTileLayer||r[o];if(!a)return;const s=t.createFilter(i&&i.filter),{z:l,x:u,y:c}=this.tileID.canonical,h={z:l,x:u,y:c};for(let i=0;i<a.length;i++){const r=a.feature(i);if(s.needGeometry){const e=t.toEvaluationFeature(r,!0);if(!s.filter(new t.EvaluationParameters(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.EvaluationParameters(this.tileID.overscaledZ),r))continue;const p=n.getId(r,o),d=new t.GeoJSONFeature(r,l,u,c,p);d.tile=h,e.push(d)}}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.parseCacheControl(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 t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else{const n=this.expirationTime-i;n?this.expirationTime=t+Math.max(n,3e4):e=!0}else e=!0;e?(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(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const n in this.buckets){if(!e.style.hasLayer(n))continue;const r=this.buckets[n],o=r.layers[0].sourceLayer||"_geojsonTileLayer",a=i[o],s=t[o];if(!a||!s||0===Object.keys(s).length)continue;r.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(n);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(r)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<t.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=t.exported.now()+e}setDependencies(t,e){const i={};for(const t of e)i[t]=!0;this.dependencies[t]=i}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return!0}return!1}}class j{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const n=t.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);const r={value:e,timeout:void 0};if(void 0!==i&&(r.timeout=setTimeout(()=>{this.remove(t,r)},i)),this.data[n].push(r),this.order.push(n),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,n=void 0===e?0:this.data[i].indexOf(e),r=this.data[i][n];return this.data[i].splice(n,1),r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(r.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const n of this.data[i])t(n.value)||e.push(n);for(const t of e)this.remove(t.value.tileID,t)}}class N{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,n){const r=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},t.extend(this.stateChanges[e][r],n),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==r&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][r]){this.deletedStates[e][r]={};for(const t in this.state[e][r])n[t]||(this.deletedStates[e][r][t]=null)}else for(const t in n)this.deletedStates[e]&&this.deletedStates[e][r]&&null===this.deletedStates[e][r][t]&&delete this.deletedStates[e][r][t]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const n=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][n])for(i in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][i]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}getState(e,i){const n=String(i),r=t.extend({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);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 r[e]}return r}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(e,i){const n={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const n in this.stateChanges[e])this.state[e][n]||(this.state[e][n]={}),t.extend(this.state[e][n],this.stateChanges[e][n]),i[n]=this.state[e][n];n[e]=i}for(const e in this.deletedStates){this.state[e]=this.state[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]}n[e]=n[e]||{},t.extend(n[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(const t in e)e[t].setFeatureState(n,i)}}class V extends t.Evented{constructor(e,i,n){super(),this.id=e,this.dispatcher=n,this.on("data",t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(e,i,n,r){const o=new D[i.type](e,i,n,r);if(o.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${o.id}`);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o}(e,i,n,this),this._tiles={},this._cache=new j(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new N}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,()=>{}),this._source.fire(new t.Event("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(G).map(t=>t.key)}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort((e,i)=>{const n=e.tileID,r=i.tileID,o=new t.pointGeometry(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),a=new t.pointGeometry(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-r.overscaledZ||a.y-o.y||a.x-o.x}).map(t=>t.tileID.key):i.map(t=>t.tileID).sort(G).map(t=>t.key)}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}}_reloadTile(t,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))}_tileLoaded(e,i,n,r){if(r)return e.state="errored",void(404!==r.status?this._source.fire(new t.ErrorEvent(r,{tile:e})):this.update(this.transform));e.timeAdded=t.exported.now(),"expired"===n&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let n=0;n<e.length;n++){const r=e[n];if(t.neighboringTiles&&t.neighboringTiles[r]){const e=this.getTileByID(r);i(t,e),i(e,t)}}function i(t,e){t.needsHillshadePrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const n=e.tileID.canonical.y-t.tileID.canonical.y,r=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===i&&0===n||Math.abs(n)>1||(Math.abs(i)>1&&(1===Math.abs(i+r)?i+=r:1===Math.abs(i-r)&&(i-=r)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,n),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,n){for(const r in this._tiles){let o=this._tiles[r];if(n[r]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)continue;let a=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(a=t)}let s=a;for(;s.overscaledZ>e;)if(s=s.scaledTo(s.overscaledZ-1),t[s.key]){n[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),n=this._getLoadedTile(e);if(n)return n}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(e*i*5),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(r)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}update(e){if(this.transform=e,!this._sourceLoaded||this._paused)return;let i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter(t=>this._source.hasTile(t)))):i=[];const n=e.coveringZoomLevel(this._source),r=Math.max(n-V.maxOverzooming,this._source.minzoom),o=Math.max(n+V.maxUnderzooming,this._source.minzoom),a=this._updateRetainedTiles(i,n);if(q(this._source.type)){const e={},i={},s=Object.keys(a);for(const n of s){const o=a[n],s=this._tiles[n];if(!s||s.fadeEndTime&&s.fadeEndTime<=t.exported.now())continue;const l=this.findLoadedParent(o,r);l&&(this._addTile(l.tileID),e[l.tileID.key]=l.tileID),i[n]=o}this._retainLoadedChildren(i,n,o,a);for(const t in e)a[t]||(this._coveredTiles[t]=!0,a[t]=e[t])}for(const t in a)this._tiles[t].clearFadeHold();const s=t.keysDifference(this._tiles,a);for(const t of s){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){const i={},n={},r=Math.max(e-V.maxOverzooming,this._source.minzoom),o=Math.max(e+V.maxUnderzooming,this._source.minzoom),a={};for(const n of t){const t=this._addTile(n);i[n.key]=n,t.hasData()||e<this._source.maxzoom&&(a[n.key]=n)}this._retainLoadedChildren(a,e,o,i);for(const o of t){let t=this._tiles[o.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=o.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else{const t=o.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let a=t.wasRequested();for(let e=o.overscaledZ-1;e>=r;--e){const r=o.scaledTo(e);if(n[r.key])break;if(n[r.key]=!0,t=this.getTile(r),!t&&a&&(t=this._addTile(r)),t&&(i[r.key]=r,a=t.wasRequested(),t.hasData()))break}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}e.push(n.key);const t=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;n=t}for(const t of e)this._loadedParentTiles[t]=i}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const n=i;return i||(i=new U(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i.uses++,this._tiles[e.key]=i,n||this._source.fire(new t.Event("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(e,i,n){const r=[],o=this.transform;if(!o)return r;const a=n?o.getCameraQueryGeometry(e):e,s=e.map(t=>o.pointCoordinate(t)),l=a.map(t=>o.pointCoordinate(t)),u=this.getIds();let c=1/0,h=1/0,p=-1/0,d=-1/0;for(const t of l)c=Math.min(c,t.x),h=Math.min(h,t.y),p=Math.max(p,t.x),d=Math.max(d,t.y);for(let e=0;e<u.length;e++){const n=this._tiles[u[e]];if(n.holdingForFade())continue;const a=n.tileID,f=Math.pow(2,o.zoom-n.tileID.overscaledZ),m=i*n.queryPadding*t.EXTENT/n.tileSize/f,g=[a.getTilePoint(new t.MercatorCoordinate(c,h)),a.getTilePoint(new t.MercatorCoordinate(p,d))];if(g[0].x-m<t.EXTENT&&g[0].y-m<t.EXTENT&&g[1].x+m>=0&&g[1].y+m>=0){const t=s.map(t=>a.getTilePoint(t)),e=l.map(t=>a.getTilePoint(t));r.push({tile:n,tileID:a,queryGeometry:t,cameraQueryGeometry:e,scale:f})}}return r}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map(t=>this._tiles[t].tileID);for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(q(this._source.type))for(const e in this._tiles){const i=this._tiles[e];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=t.exported.now())return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const n=this._tiles[t];n&&n.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter(i=>!i.hasDependency(t,e))}}function G(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function q(t){return"raster"===t||"image"===t||"video"===t}V.maxOverzooming=10,V.maxUnderzooming=3;const W="mapboxgl_preloaded_worker_pool";class Z{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Z.workerCount;)this.workers.push(new Worker(_r.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[W]}numActive(){return Object.keys(this.active).length}}const H=Math.floor(t.exported.hardwareConcurrency/2);let $;function X(){return $||($=new Z),$}function K(e,i){const n={};for(const t in e)"ref"!==t&&(n[t]=e[t]);return t.refProperties.forEach(t=>{t in i&&(n[t]=i[t])}),n}function J(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=K(t[i],e[t[i].ref]));return t}Z.workerCount=Math.max(Math.min(H,6),1);const Y={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Q(t,e,i){i.push({command:Y.addSource,args:[t,e[t]]})}function tt(t,e,i){e.push({command:Y.removeSource,args:[t]}),i[t]=!0}function et(t,e,i,n){tt(t,i,n),Q(t,e,i)}function it(t,e,i){let n;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!r(t[i][n],e[i][n]))return!1;for(n in e[i])if(Object.prototype.hasOwnProperty.call(e[i],n)&&"data"!==n&&!r(t[i][n],e[i][n]))return!1;return!0}function nt(t,e,i,n,o,a){let s;for(s in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,s)&&(r(t[s],e[s])||i.push({command:a,args:[n,s,e[s],o]}));for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(r(t[s],e[s])||i.push({command:a,args:[n,s,e[s],o]}))}function rt(t){return t.id}function ot(t,e){return t[e.id]=e,t}class at{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);let i=1,n=this._distances[i];const r=e*this.paddedLength+this.padding;for(;n<r&&i<this._distances.length;)n=this._distances[++i];const o=i-1,a=this._distances[o],s=n-a,l=s>0?(r-a)/s:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function st(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class lt{constructor(t,e,i){const n=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)n.push([]),r.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,n,r){this._forEachCell(e,i,n,r,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(r)}insertCircle(t,e,i,n){this._forEachCell(e-n,i-n,e+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(n)}_insertBoxCell(t,e,i,n,r,o){this.boxCells[r].push(o)}_insertCircleCell(t,e,i,n,r,o){this.circleCells[r].push(o)}_query(t,e,i,n,r,o,a){if(i<0||t>this.width||n<0||e>this.height)return[];const s=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=n){if(r)return[{key:null,x1:t,y1:e,x2:i,y2:n}];for(let t=0;t<this.boxKeys.length;t++)s.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],i=this.circles[3*t+1],n=this.circles[3*t+2];s.push({key:this.circleKeys[t],x1:e-n,y1:i-n,x2:e+n,y2:i+n})}}else this._forEachCell(t,e,i,n,this._queryCell,s,{hitTest:r,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(t,e,i,n){return this._query(t,e,i,n,!1,null)}hitTest(t,e,i,n,r,o){return this._query(t,e,i,n,!0,r,o).length>0}hitTestCircle(t,e,i,n,r){const o=t-i,a=t+i,s=e-i,l=e+i;if(a<0||o>this.width||l<0||s>this.height)return!1;const u=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,u,{hitTest:!0,overlapMode:n,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},r),u.length>0}_queryCell(t,e,i,n,r,o,a,s){const{seenUids:l,hitTest:u,overlapMode:c}=a,h=this.boxCells[r];if(null!==h){const r=this.bboxes;for(const a of h)if(!l.box[a]){l.box[a]=!0;const h=4*a,p=this.boxKeys[a];if(t<=r[h+2]&&e<=r[h+3]&&i>=r[h+0]&&n>=r[h+1]&&(!s||s(p))&&(!u||!st(c,p.overlapMode))&&(o.push({key:p,x1:r[h],y1:r[h+1],x2:r[h+2],y2:r[h+3]}),u))return!0}}const p=this.circleCells[r];if(null!==p){const r=this.circles;for(const a of p)if(!l.circle[a]){l.circle[a]=!0;const h=3*a,p=this.circleKeys[a];if(this._circleAndRectCollide(r[h],r[h+1],r[h+2],t,e,i,n)&&(!s||s(p))&&(!u||!st(c,p.overlapMode))){const t=r[h],e=r[h+1],i=r[h+2];if(o.push({key:p,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),u)return!0}}}return!1}_queryCellCircle(t,e,i,n,r,o,a,s){const{circle:l,seenUids:u,overlapMode:c}=a,h=this.boxCells[r];if(null!==h){const t=this.bboxes;for(const e of h)if(!u.box[e]){u.box[e]=!0;const i=4*e,n=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!s||s(n))&&!st(c,n.overlapMode))return o.push(!0),!0}}const p=this.circleCells[r];if(null!==p){const t=this.circles;for(const e of p)if(!u.circle[e]){u.circle[e]=!0;const i=3*e,n=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!s||s(n))&&!st(c,n.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,n,r,o,a,s){const l=this._convertToXCellCoord(t),u=this._convertToYCellCoord(e),c=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++)if(r.call(this,t,e,i,n,this.xCellCount*l+p,o,a,s))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,n,r,o){const a=n-t,s=r-e,l=i+o;return l*l>a*a+s*s}_circleAndRectCollide(t,e,i,n,r,o,a){const s=(o-n)/2,l=Math.abs(t-(n+s));if(l>s+i)return!1;const u=(a-r)/2,c=Math.abs(e-(r+u));if(c>u+i)return!1;if(l<=s||c<=u)return!0;const h=l-s,p=c-u;return h*h+p*p<=i*i}}function ut(e,i,n,r,o){const a=t.create();return i?(t.scale(a,a,[1/o,1/o,1]),n||t.rotateZ(a,a,r.angle)):t.multiply(a,r.labelPlaneMatrix,e),a}function ct(e,i,n,r,o){if(i){const i=t.clone(e);return t.scale(i,i,[o,o,1]),n||t.rotateZ(i,i,-r.angle),i}return r.glCoordMatrix}function ht(e,i){const n=[e.x,e.y,0,1];wt(n,n,i);const r=n[3];return{point:new t.pointGeometry(n[0]/r,n[1]/r),signedDistanceFromCamera:r}}function pt(t,e){return.5+t/e*.5}function dt(t,e){const i=t[0]/t[3],n=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&n>=-e[1]&&n<=e[1]}function ft(e,i,n,r,o,a,s,l,u){const c=r?e.textSizeData:e.iconSizeData,h=t.evaluateSizeForZoom(c,n.transform.zoom),p=[256/n.width*2+1,256/n.height*2+1],d=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;d.clear();const f=e.lineVertexArray,m=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=n.transform.width/n.transform.height;let _=!1;for(let r=0;r<m.length;r++){const y=m.get(r);if(y.hidden||y.writingMode===t.WritingMode.vertical&&!_){bt(y.numGlyphs,d);continue}_=!1;const x=[y.anchorX,y.anchorY,0,1];if(t.transformMat4(x,x,i),!dt(x,p)){bt(y.numGlyphs,d);continue}const v=pt(n.transform.cameraToCenterDistance,x[3]),b=t.evaluateSizeForFeature(c,h,y),w=s?b/v:b*v,S=new t.pointGeometry(y.anchorX,y.anchorY),T=ht(S,o).point,E={},A=_t(y,w,!1,l,i,o,a,e.glyphOffsetArray,f,d,T,S,E,g,u);_=A.useVertical,(A.notEnoughRoom||_||A.needsFlipping&&_t(y,w,!0,l,i,o,a,e.glyphOffsetArray,f,d,T,S,E,g,u).notEnoughRoom)&&bt(y.numGlyphs,d)}r?e.text.dynamicLayoutVertexBuffer.updateData(d):e.icon.dynamicLayoutVertexBuffer.updateData(d)}function mt(t,e,i,n,r,o,a,s,l,u,c,h){const p=s.glyphStartIndex+s.numGlyphs,d=s.lineStartIndex,f=s.lineStartIndex+s.lineLength,m=e.getoffsetX(s.glyphStartIndex),g=e.getoffsetX(p-1),_=xt(t*m,i,n,r,o,a,s.segment,d,f,l,u,c,h);if(!_)return null;const y=xt(t*g,i,n,r,o,a,s.segment,d,f,l,u,c,h);return y?{first:_,last:y}:null}function gt(e,i,n,r){return e===t.WritingMode.horizontal&&Math.abs(n.y-i.y)>Math.abs(n.x-i.x)*r?{useVertical:!0}:(e===t.WritingMode.vertical?i.y<n.y:i.x>n.x)?{needsFlipping:!0}:null}function _t(e,i,n,r,o,a,s,l,u,c,h,p,d,f,m){const g=i/24,_=e.lineOffsetX*g,y=e.lineOffsetY*g;let x;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,o=e.lineStartIndex+e.lineLength,c=mt(g,l,_,y,n,h,p,e,u,a,d,m);if(!c)return{notEnoughRoom:!0};const v=ht(c.first.point,s).point,b=ht(c.last.point,s).point;if(r&&!n){const t=gt(e.writingMode,v,b,f);if(t)return t}x=[c.first];for(let r=e.glyphStartIndex+1;r<t-1;r++)x.push(xt(g*l.getoffsetX(r),_,y,n,h,p,e.segment,i,o,u,a,d,m));x.push(c.last)}else{if(r&&!n){const i=ht(p,o).point,n=e.lineStartIndex+e.segment+1,r=new t.pointGeometry(u.getx(n),u.gety(n)),a=ht(r,o),s=a.signedDistanceFromCamera>0?a.point:yt(p,r,i,1,o),l=gt(e.writingMode,i,s,f);if(l)return l}const i=xt(g*l.getoffsetX(e.glyphStartIndex),_,y,n,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,a,d,m);if(!i)return{notEnoughRoom:!0};x=[i]}for(const e of x)t.addDynamicAttributes(c,e.point,e.angle);return{}}function yt(t,e,i,n,r){const o=ht(t.add(t.sub(e)._unit()),r).point,a=i.sub(o);return i.add(a._mult(n/a.mag()))}function xt(e,i,n,r,o,a,s,l,u,c,h,p,d){const f=r?e-i:e+i;let m=f>0?1:-1,g=0;r&&(m*=-1,g=Math.PI),m<0&&(g+=Math.PI);let _=m>0?l+s:l+s+1,y=o,x=o,v=0,b=0;const w=Math.abs(f),S=[];for(;v+b<=w;){if(_+=m,_<l||_>=u)return null;if(x=y,S.push(y),y=p[_],void 0===y){const e=new t.pointGeometry(c.getx(_),c.gety(_)),i=ht(e,h);if(i.signedDistanceFromCamera>0)y=p[_]=i.point;else{const i=_-m;y=yt(0===v?a:new t.pointGeometry(c.getx(i),c.gety(i)),e,x,w-v+1,h)}}v+=b,b=x.dist(y)}const T=(w-v)/b,E=y.sub(x),A=E.mult(T)._add(x);A._add(E._unit()._perp()._mult(n*m));const I=g+Math.atan2(y.y-x.y,y.x-x.x);return S.push(A),{point:A,angle:d?I:0,path:S}}const vt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function bt(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(vt,3*t)}}function wt(t,e,i){const n=e[0],r=e[1];return t[0]=i[0]*n+i[4]*r+i[12],t[1]=i[1]*n+i[5]*r+i[13],t[3]=i[3]*n+i[7]*r+i[15],t}const St=100;class Tt{constructor(t,e=new lt(t.width+200,t.height+200,25),i=new lt(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+St,this.screenBottomBoundary=t.height+St,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200}placeCollisionBox(t,e,i,n,r){const o=this.projectAndGetPerspectiveRatio(n,t.anchorPointX,t.anchorPointY),a=i*o.perspectiveRatio,s=t.x1*a+o.point.x,l=t.y1*a+o.point.y,u=t.x2*a+o.point.x,c=t.y2*a+o.point.y;return!this.isInsideGrid(s,l,u,c)||"always"!==e&&this.grid.hitTest(s,l,u,c,e,r)?{box:[],offscreen:!1}:{box:[s,l,u,c],offscreen:this.isOffscreen(s,l,u,c)}}placeCollisionCircles(e,i,n,r,o,a,s,l,u,c,h,p,d){const f=[],m=new t.pointGeometry(i.anchorX,i.anchorY),g=ht(m,a),_=pt(this.transform.cameraToCenterDistance,g.signedDistanceFromCamera),y=(c?o/_:o*_)/t.ONE_EM,x=ht(m,s).point,v=mt(y,r,i.lineOffsetX*y,i.lineOffsetY*y,!1,x,m,i,n,s,{},!1);let b=!1,w=!1,S=!0;if(v){const i=.5*p*_+d,n=new t.pointGeometry(-100,-100),r=new t.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),o=new at,a=v.first,s=v.last;let c=[];for(let t=a.path.length-1;t>=1;t--)c.push(a.path[t]);for(let t=1;t<s.path.length;t++)c.push(s.path[t]);const m=2.5*i;if(l){const t=c.map(t=>ht(t,l));c=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let g=[];if(c.length>0){const e=c[0].clone(),i=c[0].clone();for(let t=1;t<c.length;t++)e.x=Math.min(e.x,c[t].x),e.y=Math.min(e.y,c[t].y),i.x=Math.max(i.x,c[t].x),i.y=Math.max(i.y,c[t].y);g=e.x>=n.x&&i.x<=r.x&&e.y>=n.y&&i.y<=r.y?[c]:i.x<n.x||e.x>r.x||i.y<n.y||e.y>r.y?[]:t.clipLine([c],n.x,n.y,r.x,r.y)}for(const t of g){o.reset(t,.25*i);let n=0;n=o.length<=.5*i?1:Math.ceil(o.paddedLength/m)+1;for(let t=0;t<n;t++){const r=t/Math.max(n-1,1),a=o.lerp(r),s=a.x+St,l=a.y+St;f.push(s,l,i,0);const c=s-i,p=l-i,d=s+i,m=l+i;if(S=S&&this.isOffscreen(c,p,d,m),w=w||this.isInsideGrid(c,p,d,m),"always"!==e&&this.grid.hitTestCircle(s,l,i,e,h)&&(b=!0,!u))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!u&&b||!w?[]:f,offscreen:S,collisionDetected:b}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let n=1/0,r=1/0,o=-1/0,a=-1/0;for(const s of e){const e=new t.pointGeometry(s.x+St,s.y+St);n=Math.min(n,e.x),r=Math.min(r,e.y),o=Math.max(o,e.x),a=Math.max(a,e.y),i.push(e)}const s=this.grid.query(n,r,o,a).concat(this.ignoredGrid.query(n,r,o,a)),l={},u={};for(const e of s){const n=e.key;if(void 0===l[n.bucketInstanceId]&&(l[n.bucketInstanceId]={}),l[n.bucketInstanceId][n.featureIndex])continue;const r=[new t.pointGeometry(e.x1,e.y1),new t.pointGeometry(e.x2,e.y1),new t.pointGeometry(e.x2,e.y2),new t.pointGeometry(e.x1,e.y2)];t.polygonIntersectsPolygon(i,r)&&(l[n.bucketInstanceId][n.featureIndex]=!0,void 0===u[n.bucketInstanceId]&&(u[n.bucketInstanceId]=[]),u[n.bucketInstanceId].push(n.featureIndex))}return u}insertCollisionBox(t,e,i,n,r,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:r,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,n,r,o){const a=i?this.ignoredGrid:this.grid,s={bucketInstanceId:n,featureIndex:r,collisionGroupID:o,overlapMode:e};for(let e=0;e<t.length;e+=4)a.insertCircle(s,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(e,i,n){const r=[i,n,0,1];return wt(r,r,e),{point:new t.pointGeometry((r[0]/r[3]+1)/2*this.transform.width+St,(-r[1]/r[3]+1)/2*this.transform.height+St),perspectiveRatio:.5+this.transform.cameraToCenterDistance/r[3]*.5}}isOffscreen(t,e,i,n){return i<St||t>=this.screenRightBoundary||n<St||e>this.screenBottomBoundary}isInsideGrid(t,e,i,n){return i>=0&&t<this.gridRightBoundary&&n>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e}}function Et(e,i,n){return i*(t.EXTENT/(e.tileSize*Math.pow(2,n-e.tileID.overscaledZ)))}class At{constructor(t,e,i,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):n&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class It{constructor(t,e,i,n,r){this.text=new At(t?t.text:null,e,i,r),this.icon=new At(t?t.icon:null,e,n,r)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ct{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class Pt{constructor(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]}}class Mt{constructor(t,e,i,n,r){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=r}}class kt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function zt(e,i,n,r,o){const{horizontalAlign:a,verticalAlign:s}=t.getAnchorAlignment(e),l=-(a-.5)*i,u=-(s-.5)*n,c=t.evaluateVariableOffset(e,r);return new t.pointGeometry(l+c[0]*o,u+c[1]*o)}function Lt(e,i,n,r,o,a){const{x1:s,x2:l,y1:u,y2:c,anchorPointX:h,anchorPointY:p}=e,d=new t.pointGeometry(i,n);return r&&d._rotate(o?a:-a),{x1:s+d.x,y1:u+d.y,x2:l+d.x,y2:c+d.y,anchorPointX:h,anchorPointY:p}}class Bt{constructor(t,e,i,n){this.transform=t.clone(),this.collisionIndex=new Tt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new kt(i),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,i,n,r){const o=n.getBucket(i),a=n.latestFeatureIndex;if(!o||!a||i.id!==o.layerIds[0])return;const s=n.collisionBoxArray,l=o.layers[0].layout,u=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),c=n.tileSize/t.EXTENT,h=this.transform.calculatePosMatrix(n.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),d="map"===l.get("text-rotation-alignment"),f=Et(n,1,this.transform.zoom),m=ut(h,p,d,this.transform,f);let g=null;if(p){const e=ct(h,p,d,this.transform,f);g=t.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[o.bucketInstanceId]=new Mt(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID);const _={bucket:o,layout:l,posMatrix:h,textLabelPlaneMatrix:m,labelToScreenMatrix:g,scale:u,textPixelRatio:c,holdingForFade:n.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(r)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r}=t;e.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f){const m=[h.textOffset0,h.textOffset1],g=zt(t,i,n,m,r),_=this.collisionIndex.placeCollisionBox(Lt(e,g.x,g.y,o,a,this.transform.angle),c,s,l,u.predicate);if((!f||0!==this.collisionIndex.placeCollisionBox(Lt(f,g.x,g.y,o,a,this.transform.angle),c,s,l,u.predicate).box.length)&&_.box.length>0){let e;return this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(e=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:m,width:i,height:n,anchor:t,textBoxScale:r,prevAnchor:e},this.markUsedJustification(p,t,h,d),p.allowVerticalPlacement&&(this.markUsedOrientation(p,d,h),this.placedOrientations[h.crossTileID]=d),{shift:g,placedGlyphBoxes:_}}}placeLayerBucketPart(e,i,n){const{bucket:r,layout:o,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:u,holdingForFade:c,collisionBoxArray:h,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,f=o.get("text-optional"),m=o.get("icon-optional"),g=t.getOverlapMode(o,"text-overlap","text-allow-overlap"),_="always"===g,y=t.getOverlapMode(o,"icon-overlap","icon-allow-overlap"),x="always"===y,v="map"===o.get("text-rotation-alignment"),b="map"===o.get("text-pitch-alignment"),w="none"!==o.get("icon-text-fit"),S="viewport-y"===o.get("symbol-z-order"),T=_&&(x||!r.hasIconData()||m),E=x&&(_||!r.hasTextData()||f);!r.collisionArrays&&h&&r.deserializeCollisionBoxes(h);const A=(e,h)=>{if(i[e.crossTileID])return;if(c)return void(this.placements[e.crossTileID]=new Ct(!1,!1,!1));let x=!1,S=!1,A=!0,I=null,C={box:null,offscreen:null},P={box:null,offscreen:null},M=null,k=null,z=null,L=0,B=0,D=0;h.textFeatureIndex?L=h.textFeatureIndex:e.useRuntimeCollisionCircles&&(L=e.featureIndex),h.verticalTextFeatureIndex&&(B=h.verticalTextFeatureIndex);const R=h.textBox;if(R){const i=i=>{let n=t.WritingMode.horizontal;if(r.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,n=t,this.markUsedOrientation(r,n,e))}return n},n=(i,n)=>{if(r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&h.verticalTextBox){for(const e of r.writingModes)if(e===t.WritingMode.vertical?(C=n(),P=C):C=i(),C&&C.box&&C.box.length)break}else C=i()};if(o.get("text-variable-anchor")){let s=o.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){const t=this.prevPlacement.variableOffsets[e.crossTileID];s.indexOf(t.anchor)>0&&(s=s.filter(e=>e!==t.anchor),s.unshift(t.anchor))}const l=(t,i,n)=>{const o=t.x2-t.x1,l=t.y2-t.y1,c=e.textBoxScale,h=w&&"never"===y?i:null;let p={box:[],offscreen:!1};const f="never"!==g?2*s.length:s.length;for(let i=0;i<f;++i){const f=this.attemptAnchorPlacement(s[i%s.length],t,o,l,c,v,b,u,a,d,i>=s.length?g:"never",e,r,n,h);if(f&&(p=f.placedGlyphBoxes,p&&p.box&&p.box.length)){x=!0,I=f.shift;break}}return p};n(()=>l(R,h.iconBox,t.WritingMode.horizontal),()=>{const i=h.verticalTextBox;return r.allowVerticalPlacement&&!(C&&C.box&&C.box.length)&&e.numVerticalGlyphVertices>0&&i?l(i,h.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}}),C&&(x=C.box,A=C.offscreen);const c=i(C&&C.box);if(!x&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(r,t.anchor,e,c))}}else{const o=(t,i)=>{const n=this.collisionIndex.placeCollisionBox(t,g,u,a,d.predicate);return n&&n.box&&n.box.length&&(this.markUsedOrientation(r,i,e),this.placedOrientations[e.crossTileID]=i),n};n(()=>o(R,t.WritingMode.horizontal),()=>{const i=h.verticalTextBox;return r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?o(i,t.WritingMode.vertical):{box:null,offscreen:null}}),i(C&&C.box&&C.box.length)}}if(M=C,x=M&&M.box&&M.box.length>0,A=M&&M.offscreen,e.useRuntimeCollisionCircles){const i=r.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),u=t.evaluateSizeForFeature(r.textSizeData,p,i),c=o.get("text-padding");k=this.collisionIndex.placeCollisionCircles(g,i,r.lineVertexArray,r.glyphOffsetArray,u,a,s,l,n,b,d.predicate,e.collisionCircleDiameter,c),x=_||k.circles.length>0&&!k.collisionDetected,A=A&&k.offscreen}if(h.iconFeatureIndex&&(D=h.iconFeatureIndex),h.iconBox){const t=t=>{const e=w&&I?Lt(t,I.x,I.y,v,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,y,u,a,d.predicate)};P&&P.box&&P.box.length&&h.verticalIconBox?(z=t(h.verticalIconBox),S=z.box.length>0):(z=t(h.iconBox),S=z.box.length>0),A=A&&z.offscreen}const O=f||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,F=m||0===e.numIconVertices;if(O||F?F?O||(S=S&&x):x=S&&x:S=x=S&&x,x&&M&&M.box&&this.collisionIndex.insertCollisionBox(M.box,g,o.get("text-ignore-placement"),r.bucketInstanceId,P&&P.box&&B?B:L,d.ID),S&&z&&this.collisionIndex.insertCollisionBox(z.box,y,o.get("icon-ignore-placement"),r.bucketInstanceId,D,d.ID),k&&(x&&this.collisionIndex.insertCollisionCircles(k.circles,g,o.get("text-ignore-placement"),r.bucketInstanceId,L,d.ID),n)){const t=r.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new Pt);for(let t=0;t<k.circles.length;t+=4)e.circles.push(k.circles[t+0]),e.circles.push(k.circles[t+1]),e.circles.push(k.circles[t+2]),e.circles.push(k.collisionDetected?1:0)}this.placements[e.crossTileID]=new Ct(x||T,S||E,A||r.justReloaded),i[e.crossTileID]=!0};if(S){const t=r.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];A(r.symbolInstances.get(i),r.collisionArrays[i])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(r.symbolInstances.get(t),r.collisionArrays[t]);if(n&&r.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[r.bucketInstanceId];t.invert(e.invProjMatrix,a),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}r.justReloaded=!1}markUsedJustification(e,i,n,r){let o;o=r===t.WritingMode.vertical?n.verticalPlacedTextSymbolIndex:{left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];const a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(const t of a)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:n.crossTileID)}markUsedOrientation(e,i,n){const r=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,o=i===t.WritingMode.vertical?i:0,a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(const t of a)e.text.placedSymbolArray.get(t).placedOrientation=r;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const n=e?e.symbolFadeChange(t):1,r=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=r[t];o?(this.opacities[t]=new It(o,n,e.text,e.icon),i=i||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new It(null,n,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in r){const e=r[t];if(!this.opacities[t]){const r=new It(e,n,!1,!1);r.isHidden()||(this.opacities[t]=r,i=i||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in a)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=a[t]);i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const n of e){const e=n.getBucket(t);e&&n.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,n.collisionBoxArray)}}updateBucketOpacities(e,i,n){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const r=e.layers[0].layout,o=new It(null,0,!1,!1,!0),a=r.get("text-allow-overlap"),s=r.get("icon-allow-overlap"),l=r.get("text-variable-anchor"),u="map"===r.get("text-rotation-alignment"),c="map"===r.get("text-pitch-alignment"),h="none"!==r.get("icon-text-fit"),p=new It(null,0,a&&(s||!e.hasIconData()||r.get("icon-optional")),s&&(a||!e.hasTextData()||r.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);const d=(t,e,i)=>{for(let n=0;n<e/4;n++)t.opacityVertexArray.emplaceBack(i)};for(let n=0;n<e.symbolInstances.length;n++){const r=e.symbolInstances.get(n),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:s,crossTileID:f}=r;let m=this.opacities[f];i[f]?m=o:m||(m=p,this.opacities[f]=m),i[f]=!0;const g=r.numIconVertices>0,_=this.placedOrientations[r.crossTileID],y=_===t.WritingMode.vertical,x=_===t.WritingMode.horizontal||_===t.WritingMode.horizontalOnly;if(a>0||s>0){const t=Gt(m.text);d(e.text,a,y?qt:t),d(e.text,s,x?qt:t);const i=m.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach(t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||y?1:0)}),r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||x?1:0);const n=this.variableOffsets[r.crossTileID];n&&this.markUsedJustification(e,n.anchor,r,_);const o=this.placedOrientations[r.crossTileID];o&&(this.markUsedJustification(e,"left",r,o),this.markUsedOrientation(e,o,r))}if(g){const t=Gt(m.icon),i=!(h&&r.verticalPlacedIconSymbolIndex&&y);r.placedIconSymbolIndex>=0&&(d(e.icon,r.numIconVertices,i?t:qt),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=m.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,r.numVerticalIconVertices,i?qt:t),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[n];if(i){let n=new t.pointGeometry(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(l){const e=this.variableOffsets[f];e?(n=zt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),u&&n._rotate(c?this.transform.angle:-this.transform.angle)):t=!1}i.textBox&&Dt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||y,n.x,n.y),i.verticalTextBox&&Dt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||x,n.x,n.y)}const r=Boolean(!x&&i.verticalIconBox);i.iconBox&&Dt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,r,h?n.x:0,h?n.y:0),i.verticalIconBox&&Dt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!r,h?n.x:0,h?n.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function Dt(t,e,i,n,r){t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0)}const Rt=Math.pow(2,25),Ot=Math.pow(2,24),Ft=Math.pow(2,17),Ut=Math.pow(2,16),jt=Math.pow(2,9),Nt=Math.pow(2,8),Vt=Math.pow(2,1);function Gt(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Rt+e*Ot+i*Ft+e*Ut+i*jt+e*Nt+i*Vt+e}const qt=0;class Wt{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,n,r){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,n,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,r())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((t,e)=>t.sortKey-e.sortKey));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,r())return!0;return!1}}class Zt{constructor(t,e,i,n,r,o,a){this.placement=new Bt(t,r,o,a),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,i,n){const r=t.exported.now(),o=()=>{const e=t.exported.now()-r;return!this._forceFullPlacement&&e>2};for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=r)&&(!t.maxzoom||t.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new Wt(t)),this._inProgressLayer.continuePlacement(n[t.source],this.placement,this._showCollisionBoxes,t,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ht=512/t.EXTENT/2;class $t{constructor(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(let i=0;i<e.length;i++){const n=e.get(i),r=n.key;this.indexedSymbolInstances[r]||(this.indexedSymbolInstances[r]=[]),this.indexedSymbolInstances[r].push({crossTileID:n.crossTileID,coord:this.getScaledCoordinates(n,t)})}}getScaledCoordinates(e,i){const n=Ht/Math.pow(2,i.canonical.z-this.tileID.canonical.z);return{x:Math.floor((i.canonical.x*t.EXTENT+e.anchorX)*n),y:Math.floor((i.canonical.y*t.EXTENT+e.anchorY)*n)}}findMatches(t,e,i){const n=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let r=0;r<t.length;r++){const o=t.get(r);if(o.crossTileID)continue;const a=this.indexedSymbolInstances[o.key];if(!a)continue;const s=this.getScaledCoordinates(o,e);for(const t of a)if(Math.abs(t.coord.x-s.x)<=n&&Math.abs(t.coord.y-s.y)<=n&&!i[t.crossTileID]){i[t.crossTileID]=!0,o.crossTileID=t.crossTileID;break}}}}class Xt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Kt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],n={};for(const t in i){const r=i[t];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),n[r.tileID.key]=r}this.indexes[t]=n}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const n=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const r=this.indexes[i];if(Number(i)>t.overscaledZ)for(const i in r){const o=r[i];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,n)}else{const o=r[t.scaledTo(Number(i)).key];o&&o.findMatches(e.symbolInstances,t,n)}}for(let t=0;t<e.symbolInstances.length;t++){const r=e.symbolInstances.get(t);r.crossTileID||(r.crossTileID=i.generate(),n[r.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new $t(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i in e.indexedSymbolInstances)for(const n of e.indexedSymbolInstances[i])delete this.usedCrossTileIDs[t][n.crossTileID]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const n=this.indexes[i];for(const r in n)t[n[r].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[r]),delete n[r],e=!0)}return e}}class Jt{constructor(){this.layerIndexes={},this.crossTileIDs=new Xt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let n=this.layerIndexes[t.id];void 0===n&&(n=this.layerIndexes[t.id]=new Kt);let r=!1;const o={};n.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(i.tileID,e,this.crossTileIDs)&&(r=!0),o[e.bucketInstanceId]=!0)}return n.removeStaleBuckets(o)&&(r=!0),r}pruneUnusedLayers(t){const e={};t.forEach(t=>{e[t]=!0});for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const Yt=(e,i)=>t.emitValidationErrors(e,i&&i.filter(t=>"source.canvas"!==t.identifier)),Qt=t.pick(Y,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),te=t.pick(Y,["setCenter","setZoom","setBearing","setPitch"]),ee=function(){const e={},i=t.spec.$version;for(const n in t.spec.$root){const r=t.spec.$root[n];if(r.required){let t=null;t="version"===n?i:"array"===r.type?[]:{},null!=t&&(e[n]=t)}}return e}();class ie extends t.Evented{constructor(e,i={}){super(),this.map=e,this.dispatcher=new S(X(),this),this.imageManager=new f,this.imageManager.setEventedParent(this),this.glyphManager=new y(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new w(256,512),this.crossTileSymbolIndex=new Jt,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const n=this;this._rtlTextPluginCallback=ie.registerForPluginStateChange(e=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},(e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every(t=>t))for(const t in n.sourceCaches)n.sourceCaches[t].reload()})}),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e)}})}loadURL(e,i={}){this.fire(new t.Event("dataloading",{dataType:"style"}));const n="boolean"!=typeof i.validate||i.validate,r=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(r,(e,i)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):i&&this._load(i,n)})}loadJSON(e,i={}){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.exported.frame(()=>{this._request=null,this._load(e,!1!==i.validate)})}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(ee,!1)}_load(e,i){if(i&&Yt(this,t.validateStyle(e)))return;this._loaded=!0,this.stylesheet=e;for(const t in e.sources)this.addSource(t,e.sources[t],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);const n=J(this.stylesheet.layers);this._order=n.map(t=>t.id),this._layers={},this._serializedLayers={};for(let e of n)e=t.createStyleLayer(e),e.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=e,this._serializedLayers[e.id]=e.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new b(this.stylesheet.light),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}_loadSprite(e){this._spriteRequest=function(e,i,n,r){let o,a,s;const l=n>1?"@2x":"";let u=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,l,".json"),t.ResourceType.SpriteJSON),(t,e)=>{u=null,s||(s=t,o=e,h())}),c=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,l,".png"),t.ResourceType.SpriteImage),(t,e)=>{c=null,s||(s=t,a=e,h())});function h(){if(s)r(s);else if(o&&a){const e=t.exported.getImageData(a),i={};for(const n in o){const{width:r,height:a,x:s,y:l,sdf:u,pixelRatio:c,stretchX:h,stretchY:p,content:d}=o[n],f=new t.RGBAImage({width:r,height:a});t.RGBAImage.copy(e,f,{x:s,y:l},{x:0,y:0},{width:r,height:a}),i[n]={data:f,pixelRatio:c,sdf:u,stretchX:h,stretchY:p,content:d}}r(null,i)}}return{cancel(){u&&(u.cancel(),u=null),c&&(c.cancel(),c=null)}}}(e,this.map._requestManager,this.map.getPixelRatio(),(e,i)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(i)for(const t in i)this.imageManager.addImage(t,i[t]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))})}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const n=e.sourceLayer;if(!n)return;const r=i.getSource();("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${n}" does not exist on source "${r.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const e=[];for(const i of t){const t=this._layers[i];"custom"!==t.type&&e.push(t.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const t in this._updatedSources){const e=this._updatedSources[t];"reload"===e?this._reloadSource(t):"clear"===e&&this._clearSource(t)}this._updateTilesForChangedImages();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}const n={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];n[t]=e.used,e.used=!1}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const e in n){const i=this.sourceCaches[e];n[e]!==i.used&&i.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(e){if(this._checkLoaded(),Yt(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=J(e.layers);const i=function(t,e){if(!t)return[{command:Y.setStyle,args:[e]}];let i=[];try{if(!r(t.version,e.version))return[{command:Y.setStyle,args:[e]}];r(t.center,e.center)||i.push({command:Y.setCenter,args:[e.center]}),r(t.zoom,e.zoom)||i.push({command:Y.setZoom,args:[e.zoom]}),r(t.bearing,e.bearing)||i.push({command:Y.setBearing,args:[e.bearing]}),r(t.pitch,e.pitch)||i.push({command:Y.setPitch,args:[e.pitch]}),r(t.sprite,e.sprite)||i.push({command:Y.setSprite,args:[e.sprite]}),r(t.glyphs,e.glyphs)||i.push({command:Y.setGlyphs,args:[e.glyphs]}),r(t.transition,e.transition)||i.push({command:Y.setTransition,args:[e.transition]}),r(t.light,e.light)||i.push({command:Y.setLight,args:[e.light]});const n={},o=[];!function(t,e,i,n){let o;for(o in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,o)&&(Object.prototype.hasOwnProperty.call(e,o)||tt(o,i,n));for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Object.prototype.hasOwnProperty.call(t,o)?r(t[o],e[o])||("geojson"===t[o].type&&"geojson"===e[o].type&&it(t,e,o)?i.push({command:Y.setGeoJSONSourceData,args:[o,e[o].data]}):et(o,e,i,n)):Q(o,e,i))}(t.sources,e.sources,o,n);const a=[];t.layers&&t.layers.forEach(t=>{n[t.source]?i.push({command:Y.removeLayer,args:[t.id]}):a.push(t)}),i=i.concat(o),function(t,e,i){e=e||[];const n=(t=t||[]).map(rt),o=e.map(rt),a=t.reduce(ot,{}),s=e.reduce(ot,{}),l=n.slice(),u=Object.create(null);let c,h,p,d,f,m,g;for(c=0,h=0;c<n.length;c++)p=n[c],Object.prototype.hasOwnProperty.call(s,p)?h++:(i.push({command:Y.removeLayer,args:[p]}),l.splice(l.indexOf(p,h),1));for(c=0,h=0;c<o.length;c++)p=o[o.length-1-c],l[l.length-1-c]!==p&&(Object.prototype.hasOwnProperty.call(a,p)?(i.push({command:Y.removeLayer,args:[p]}),l.splice(l.lastIndexOf(p,l.length-h),1)):h++,m=l[l.length-c],i.push({command:Y.addLayer,args:[s[p],m]}),l.splice(l.length-c,0,p),u[p]=!0);for(c=0;c<o.length;c++)if(p=o[c],d=a[p],f=s[p],!u[p]&&!r(d,f))if(r(d.source,f.source)&&r(d["source-layer"],f["source-layer"])&&r(d.type,f.type)){for(g in nt(d.layout,f.layout,i,p,null,Y.setLayoutProperty),nt(d.paint,f.paint,i,p,null,Y.setPaintProperty),r(d.filter,f.filter)||i.push({command:Y.setFilter,args:[p,f.filter]}),r(d.minzoom,f.minzoom)&&r(d.maxzoom,f.maxzoom)||i.push({command:Y.setLayerZoomRange,args:[p,f.minzoom,f.maxzoom]}),d)Object.prototype.hasOwnProperty.call(d,g)&&"layout"!==g&&"paint"!==g&&"filter"!==g&&"metadata"!==g&&"minzoom"!==g&&"maxzoom"!==g&&(0===g.indexOf("paint.")?nt(d[g],f[g],i,p,g.slice(6),Y.setPaintProperty):r(d[g],f[g])||i.push({command:Y.setLayerProperty,args:[p,g,f[g]]}));for(g in f)Object.prototype.hasOwnProperty.call(f,g)&&!Object.prototype.hasOwnProperty.call(d,g)&&"layout"!==g&&"paint"!==g&&"filter"!==g&&"metadata"!==g&&"minzoom"!==g&&"maxzoom"!==g&&(0===g.indexOf("paint.")?nt(d[g],f[g],i,p,g.slice(6),Y.setPaintProperty):r(d[g],f[g])||i.push({command:Y.setLayerProperty,args:[p,g,f[g]]}))}else i.push({command:Y.removeLayer,args:[p]}),m=l[l.lastIndexOf(p)+1],i.push({command:Y.addLayer,args:[f,m]})}(a,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:Y.setStyle,args:[e]}]}return i}(this.serialize(),e).filter(t=>!(t.command in te));if(0===i.length)return!1;const n=i.filter(t=>!(t.command in Qt));if(n.length>0)throw new Error(`Unimplemented: ${n.map(t=>t.command).join(", ")}.`);return i.forEach(t=>{"setTransition"!==t.command&&this[t.command].apply(this,t.args)}),this.stylesheet=e,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,n={}){if(this._checkLoaded(),void 0!==this.sourceCaches[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"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const r=this.sourceCaches[e]=new V(e,i,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:r.serialize(),sourceId:e})),r.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(e,i,n={}){this._checkLoaded();const r=e.id;if(this.getLayer(r))return void this.fire(new t.ErrorEvent(new Error(`Layer "${r}" already exists on this map.`)));let o;if("custom"===e.type){if(Yt(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(r,e.source),e=t.clone$1(e),e=t.extend(e,{source:r})),this._validate(t.validateStyle.layer,"layers."+r,e,{arrayIndex:-1},n))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[o.id]=o.serialize()}const a=i?this._order.indexOf(i):this._order.length;if(i&&-1===a)this.fire(new t.ErrorEvent(new Error(`Cannot add layer "${r}" before non-existing layer "${i}".`)));else{if(this._order.splice(a,0,r),this._layerOrderChanged=!0,this._layers[r]=o,this._removedLayers[r]&&o.source&&"custom"!==o.type){const t=this._removedLayers[r];delete this._removedLayers[r],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[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.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const n=this._order.indexOf(e);this._order.splice(n,1);const r=i?this._order.indexOf(i):this._order.length;i&&-1===r?this.fire(new t.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(r,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,n){this._checkLoaded();const r=this.getLayer(e);r?r.minzoom===i&&r.maxzoom===n||(null!=i&&(r.minzoom=i),null!=n&&(r.maxzoom=n),this._updateLayer(r)):this.fire(new t.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,n={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!r(o.filter,i))return null==i?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(t.validateStyle.filter,`layers.${o.id}.filter`,i,null,n)||(o.filter=t.clone$1(i),this._updateLayer(o)))}else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,i,n,o={}){this._checkLoaded();const a=this.getLayer(e);a?r(a.getLayoutProperty(i),n)||(a.setLayoutProperty(i,n,o),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const n=this.getLayer(e);if(n)return n.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,n,o={}){this._checkLoaded();const a=this.getLayer(e);a?r(a.getPaintProperty(i),n)||(a.setPaintProperty(i,n,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const n=e.source,r=e.sourceLayer,o=this.sourceCaches[n];if(void 0===o)return void this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const a=o.getSource().type;"geojson"===a&&r?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||r?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.setFeatureState(r,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const n=e.source,r=this.sourceCaches[n];if(void 0===r)return void this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const o=r.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(a,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,n=e.sourceLayer,r=this.sourceCaches[i];if(void 0!==r)return"vector"!==r.getSource().type||n?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),r.getFeatureState(n,e.id)):void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},n=[];for(let r=this._order.length-1;r>=0;r--){const o=this._order[r];if(e(o)){i[o]=r;for(const e of t){const t=e[o];if(t)for(const e of t)n.push(e)}}}n.sort((t,e)=>e.intersectionZ-t.intersectionZ);const r=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(e(a))for(let t=n.length-1;t>=0;t--){const e=n[t].feature;if(i[e.layer.id]<o)break;r.push(e),n.pop()}else for(const e of t){const t=e[a];if(t)for(const e of t)r.push(e.feature)}}return r}queryRenderedFeatures(e,i,n){i&&i.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",i.filter,null,i);const r={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];r[i.source]=!0}}const o=[];i.availableImages=this._availableImages;for(const t in this.sourceCaches)i.layers&&!r[t]||o.push(O(this.sourceCaches[t],this._layers,this._serializedLayers,e,i,n));return this.placement&&o.push(function(t,e,i,n,r,o,a){const s={},l=o.queryRenderedSymbols(n),u=[];for(const t of Object.keys(l).map(Number))u.push(a[t]);u.sort(F);for(const i of u){const n=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,r.filter,r.layers,r.availableImages,t);for(const t in n){const e=s[t]=s[t]||[],r=n[t];r.sort((t,e)=>{const n=i.featureSortOrder;if(n){const i=n.indexOf(t.featureIndex);return n.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex});for(const t of r)e.push(t)}}for(const e in s)s[e].forEach(n=>{const r=n.feature,o=i[t[e].source].getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=o});return s}(this._layers,this._serializedLayers,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);const n=this.sourceCaches[e];return n?function(t,e){const i=t.getRenderableIds().map(e=>t.getTileByID(e)),n=[],r={};for(let t=0;t<i.length;t++){const o=i[t],a=o.tileID.canonical.key;r[a]||(r[a]=!0,o.querySourceFeatures(n,e))}return n}(n,i):[]}addSourceType(t,e,i){return ie.getSourceType(t)?i(new Error(`A source type called "${t}" already exists.`)):(ie.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const n=this.light.getLight();let o=!1;for(const t in e)if(!r(e[t],n[t])){o=!0;break}if(!o)return;const a={now:t.exported.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(a)}_validate(e,i,n,r,o={}){return(!o||!1!==o.validate)&&Yt(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:n,styleSpec:t.spec},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(e,i,n,r,o=!1){let a=!1,s=!1;const l={};for(const t of this._order){const i=this._layers[t];if("symbol"!==i.type)continue;if(!l[i.source]){const t=this.sourceCaches[i.source];l[i.source]=t.getRenderableIds(!0).map(e=>t.getTileByID(e)).sort((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1))}const n=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);a=a||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===n)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.exported.now(),e.zoom))&&(this.pauseablePlacement=new Zt(e,this._order,o,i,n,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.exported.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const n=this.sourceCaches[e.source];n&&n.setDependencies(e.tileID.key,e.type,e.icons)}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i)}getResource(e,i,n){return t.makeRequest(i,n)}}ie.getSourceType=function(t){return D[t]},ie.setSourceType=function(t,e){D[t]=e},ie.registerForPluginStateChange=t.registerForPluginStateChange;var ne=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),re={prelude:oe("#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","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}"),background:oe("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:oe("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:oe("varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:oe("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:oe("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:oe("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:oe("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:oe("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:oe("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),fill:oe("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),fillOutline:oe("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:oe("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillPattern:oe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:oe("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying 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;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:oe("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;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;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:oe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:oe("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:oe("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),lineGradient:oe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),linePattern:oe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:oe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:oe("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:oe("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),symbolSDF:oe("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:oe("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}")};function oe(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/attribute ([\w]+) ([\w]+)/g),r=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(r):r,s={};return{fragmentSource:t=t.replace(i,(t,e,i,n,r)=>(s[r]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nvarying ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = u_${r};\n#endif\n`)),vertexSource:e=e.replace(i,(t,e,i,n,r)=>{const o="float"===n?"vec2":"vec4",a=r.match(/color/)?"color":o;return s[r]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${i} ${o} a_${r};\nvarying ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${i} ${o} a_${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`}),staticAttributes:n,staticUniforms:a}}class ae{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,n,r,o,a,s){this.context=t;let l=this.boundPaintVertexBuffers.length!==n.length;for(let t=0;!l&&t<n.length;t++)this.boundPaintVertexBuffers[t]!==n[t]&&(l=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===e&&this.boundLayoutVertexBuffer===i&&!l&&this.boundIndexBuffer===r&&this.boundVertexOffset===o&&this.boundDynamicVertexBuffer===a&&this.boundDynamicVertexBuffer2===s?(t.bindVertexArrayOES.set(this.vao),a&&a.bind(),r&&r.dynamicDraw&&r.bind(),s&&s.bind()):this.freshBind(e,i,n,r,o,a,s)}freshBind(t,e,i,n,r,o,a){let s;const l=t.numAttributes,u=this.context,c=u.gl;if(u.extVertexArrayObject)this.vao&&this.destroy(),this.vao=u.extVertexArrayObject.createVertexArrayOES(),u.bindVertexArrayOES.set(this.vao),s=0,this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=r,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a;else{s=u.currentNumAttributes||0;for(let t=l;t<s;t++)c.disableVertexAttribArray(t)}e.enableAttributes(c,t);for(const e of i)e.enableAttributes(c,t);o&&o.enableAttributes(c,t),a&&a.enableAttributes(c,t),e.bind(),e.setVertexAttribPointers(c,t,r);for(const e of i)e.bind(),e.setVertexAttribPointers(c,t,r);o&&(o.bind(),o.setVertexAttribPointers(c,t,r)),n&&n.bind(),a&&(a.bind(),a.setVertexAttribPointers(c,t,r)),u.currentNumAttributes=l}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function se(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const n=t[i].split(" ");e.push(n.pop())}return e}class le{constructor(t,e,i,n,r,o){const a=t.gl;this.program=a.createProgram();const s=se(i.staticAttributes),l=n?n.getBinderAttributes():[],u=s.concat(l),c=i.staticUniforms?se(i.staticUniforms):[],h=n?n.getBinderUniforms():[],p=c.concat(h),d=[];for(const t of p)d.indexOf(t)<0&&d.push(t);const f=n?n.defines():[];o&&f.push("#define OVERDRAW_INSPECTOR;");const m=f.concat(re.prelude.fragmentSource,i.fragmentSource).join("\n"),g=f.concat(re.prelude.vertexSource,i.vertexSource).join("\n"),_=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(_,m),a.compileShader(_),a.attachShader(this.program,_);const y=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(y,g),a.compileShader(y),a.attachShader(this.program,y),this.attributes={};const x={};this.numAttributes=u.length;for(let t=0;t<this.numAttributes;t++)u[t]&&(a.bindAttribLocation(this.program,t,u[t]),this.attributes[u[t]]=t);a.linkProgram(this.program),a.deleteShader(y),a.deleteShader(_);for(let t=0;t<d.length;t++){const e=d[t];if(e&&!x[e]){const t=a.getUniformLocation(this.program,e);t&&(x[e]=t)}}this.fixedUniforms=r(t,x),this.binderUniforms=n?n.getUniforms(t,x):[]}draw(t,e,i,n,r,o,a,s,l,u,c,h,p,d,f,m){const g=t.gl;if(this.failedToCreate)return;t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(n),t.setColorMode(r),t.setCullFace(o);for(const t in this.fixedUniforms)this.fixedUniforms[t].set(a[t]);d&&d.setUniforms(t,this.binderUniforms,h,{zoom:p});const _={[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[e];for(const i of c.get()){const n=i.vaos||(i.vaos={});(n[s]||(n[s]=new ae)).bind(t,this,l,d?d.getPaintVertexBuffers():[],u,i.vertexOffset,f,m),g.drawElements(e,i.primitiveLength*_,g.UNSIGNED_SHORT,i.primitiveOffset*_*2)}}}function ue(t,e,i){const n=1/Et(i,1,e.transform.tileZoom),r=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/r,a=o*(i.tileID.canonical.x+i.tileID.wrap*r),s=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}const ce=(e,i,n,r)=>{const o=i.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=function(){var e=new t.ARRAY_TYPE(9);return t.ARRAY_TYPE!=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}();"viewport"===o.properties.get("anchor")&&function(t,e){var i=Math.sin(e),n=Math.cos(e);t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(l,-i.transform.angle),function(t,e,i){var n=e[0],r=e[1],o=e[2];t[0]=n*i[0]+r*i[3]+o*i[6],t[1]=n*i[1]+r*i[4]+o*i[7],t[2]=n*i[2]+r*i[5]+o*i[8]}(s,s,l);const u=o.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+n,u_opacity:r}},he=(e,i,n,r,o,a,s)=>t.extend(ce(e,i,n,r),ue(a,i,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),pe=t=>({u_matrix:t}),de=(e,i,n,r)=>t.extend(pe(e),ue(n,i,r)),fe=(t,e)=>({u_matrix:t,u_world:e}),me=(e,i,n,r,o)=>t.extend(de(e,i,n,r),{u_world:o}),ge=(t,e,i,n)=>{const r=t.transform;let o,a;if("map"===n.paint.get("circle-pitch-alignment")){const t=Et(i,1,r.zoom);o=!0,a=[t,t]}else o=!1,a=r.pixelsToGLUnits;return{u_camera_to_center_distance:r.cameraToCenterDistance,u_scale_with_map:+("map"===n.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,n.paint.get("circle-translate"),n.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:a}},_e=(t,e,i)=>{const n=Et(i,1,e.zoom),r=Math.pow(2,e.zoom-i.tileID.overscaledZ),o=i.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[e.pixelsToGLUnits[0]/(n*r),e.pixelsToGLUnits[1]/(n*r)],u_overscale_factor:o}},ye=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),xe=t=>({u_matrix:t}),ve=(t,e,i,n)=>({u_matrix:t,u_extrude_scale:Et(e,1,i),u_intensity:n});function be(e,i){const n=Math.pow(2,i.canonical.z),r=i.canonical.y;return[new t.MercatorCoordinate(0,r/n).toLngLat().lat,new t.MercatorCoordinate(0,(r+1)/n).toLngLat().lat]}const we=(t,e,i)=>{const n=t.transform;return{u_matrix:Ie(t,e,i),u_ratio:1/Et(e,1,n.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},Se=(e,i,n,r)=>t.extend(we(e,i,n),{u_image:0,u_image_height:r}),Te=(t,e,i,n)=>{const r=t.transform,o=Ae(e,r);return{u_matrix:Ie(t,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Et(e,1,r.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[o,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]]}},Ee=(e,i,n,r,o)=>{const a=e.lineAtlas,s=Ae(i,e.transform),l="round"===n.layout.get("line-cap"),u=a.getDash(r.from,l),c=a.getDash(r.to,l),h=u.width*o.fromScale,p=c.width*o.toScale;return t.extend(we(e,i,n),{u_patternscale_a:[s/h,-u.height/2],u_patternscale_b:[s/p,-c.height/2],u_sdfgamma:a.width/(256*Math.min(h,p)*e.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:c.y,u_mix:o.t})};function Ae(t,e){return 1/Et(t,1,e.tileZoom)}function Ie(t,e,i){return t.translatePosMatrix(e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Ce=(t,e,i,n,r)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.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:(a=r.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Pe(r.paint.get("raster-hue-rotate"))};var o,a};function Pe(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Me=(t,e,i,n,r,o,a,s,l,u)=>{const c=r.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:c.width/c.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+n,u_texsize:u,u_texture:0}},ke=(e,i,n,r,o,a,s,l,u,c,h)=>{const p=o.transform;return t.extend(Me(e,i,n,r,o,a,s,l,u,c),{u_gamma_scale:r?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+h})},ze=(e,i,n,r,o,a,s,l,u,c)=>t.extend(ke(e,i,n,r,o,a,s,l,!0,u,!0),{u_texsize_icon:c,u_texture_icon:1}),Le=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Be=(e,i,n,r,o,a)=>t.extend(function(t,e,i,n){const r=i.imageManager.getPattern(t.from.toString()),o=i.imageManager.getPattern(t.to.toString()),{width:a,height:s}=i.imageManager.getPixelSize(),l=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,i.transform.tileZoom)/l,c=u*(n.tileID.canonical.x+n.tileID.wrap*l),h=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:e.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/Et(n,1,i.transform.tileZoom),u_pixel_coord_upper:[c>>16,h>>16],u_pixel_coord_lower:[65535&c,65535&h]}}(r,a,n,o),{u_matrix:e,u_opacity:i}),De={fillExtrusion:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)})};class Re{constructor(t,e,i){this.context=t;const n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Oe={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Fe{constructor(t,e,i,n){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;const r=t.gl;this.buffer=r.createBuffer(),t.bindVertexBuffer.set(this.buffer),r.bufferData(r.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i<this.attributes.length;i++){const n=e.attributes[this.attributes[i].name];void 0!==n&&t.enableVertexAttribArray(n)}}setVertexAttribPointers(t,e,i){for(let n=0;n<this.attributes.length;n++){const r=this.attributes[n],o=e.attributes[r.name];void 0!==o&&t.vertexAttribPointer(o,r.components,t[Oe[r.type]],!1,this.itemSize,r.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ue{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class je extends Ue{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ne extends Ue{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ve extends Ue{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Ge extends Ue{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class qe extends Ue{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class We extends Ue{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Ze extends Ue{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class He extends Ue{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class $e extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class Xe extends Ue{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ke extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class Je extends Ue{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Ye extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class Qe extends Ue{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class ti extends Ue{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ei extends Ue{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class ii extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class ni extends Ue{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class ri extends Ue{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class oi extends Ue{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class ai extends Ue{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class si extends Ue{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class li extends Ue{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class ui extends Ue{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ci extends Ue{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class hi extends Ue{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class pi extends Ue{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class di extends Ue{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class fi extends Ue{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class mi extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class gi extends Ue{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class _i extends Ue{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class yi extends _i{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class xi extends _i{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class vi{constructor(t,e,i,n){this.context=t,this.width=e,this.height=i;const r=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new yi(t,r),n&&(this.depthAttachment=new xi(t,r))}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class bi{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}bi.Replace=[1,0],bi.disabled=new bi(bi.Replace,t.Color.transparent,[!1,!1,!1,!1]),bi.unblended=new bi(bi.Replace,t.Color.transparent,[!0,!0,!0,!0]),bi.alphaBlended=new bi([1,771],t.Color.transparent,[!0,!0,!0,!0]);class wi{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new je(this),this.clearDepth=new Ne(this),this.clearStencil=new Ve(this),this.colorMask=new Ge(this),this.depthMask=new qe(this),this.stencilMask=new We(this),this.stencilFunc=new Ze(this),this.stencilOp=new He(this),this.stencilTest=new $e(this),this.depthRange=new Xe(this),this.depthTest=new Ke(this),this.depthFunc=new Je(this),this.blend=new Ye(this),this.blendFunc=new Qe(this),this.blendColor=new ti(this),this.blendEquation=new ei(this),this.cullFace=new ii(this),this.cullFaceSide=new ni(this),this.frontFace=new ri(this),this.program=new oi(this),this.activeTexture=new ai(this),this.viewport=new si(this),this.bindFramebuffer=new li(this),this.bindRenderbuffer=new ui(this),this.bindTexture=new ci(this),this.bindVertexBuffer=new hi(this),this.bindElementBuffer=new pi(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new di(this),this.pixelStoreUnpack=new fi(this),this.pixelStoreUnpackPremultiplyAlpha=new mi(this),this.pixelStoreUnpackFlipY=new gi(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Re(this,t,e)}createVertexBuffer(t,e,i){return new Fe(this,t,e,i)}createRenderbuffer(t,e,i){const n=this.gl,r=n.createRenderbuffer();return this.bindRenderbuffer.set(r),n.renderbufferStorage(n.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),r}createFramebuffer(t,e,i){return new vi(this,t,e,i)}clear({color:t,depth:e}){const i=this.gl;let n=0;t&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),i.clear(n)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){r(t.blendFunction,bi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Si{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}Si.ReadOnly=!1,Si.ReadWrite=!0,Si.disabled=new Si(519,Si.ReadOnly,[0,1]);class Ti{constructor(t,e,i,n,r,o){this.test=t,this.ref=e,this.mask=i,this.fail=n,this.depthFail=r,this.pass=o}}Ti.disabled=new Ti({func:519,mask:0},0,0,7680,7680,7680);class Ei{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}let Ai;function Ii(e,i,n,r,o,a,s){const l=e.context,u=l.gl,c=e.useProgram("collisionBox"),h=[];let p=0,d=0;for(let f=0;f<r.length;f++){const m=r[f],g=i.getTile(m),_=g.getBucket(n);if(!_)continue;let y=m.posMatrix;0===o[0]&&0===o[1]||(y=e.translatePosMatrix(m.posMatrix,g,o,a));const x=s?_.textCollisionBox:_.iconCollisionBox,v=_.collisionCircleArray;if(v.length>0){const i=t.create(),n=y;t.mul(i,_.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(i,i,_.placementViewportMatrix),h.push({circleArray:v,circleOffset:d,transform:n,invTransform:i}),p+=v.length/4,d=p}x&&c.draw(l,u.LINES,Si.disabled,Ti.disabled,e.colorModeForRenderPass(),Ei.disabled,_e(y,e.transform,g),n.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,e.transform.zoom,null,null,x.collisionVertexBuffer)}if(!s||!h.length)return;const f=e.useProgram("collisionCircle"),m=new t.CollisionCircleLayoutArray;m.resize(4*p),m._trim();let g=0;for(const t of h)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,n=t.circleArray[i+0],r=t.circleArray[i+1],o=t.circleArray[i+2],a=t.circleArray[i+3];m.emplace(g++,n,r,o,a,0),m.emplace(g++,n,r,o,a,1),m.emplace(g++,n,r,o,a,2),m.emplace(g++,n,r,o,a,3)}(!Ai||Ai.length<2*p)&&(Ai=function(e){const i=2*e,n=new t.QuadTriangleArray;n.resize(i),n._trim();for(let t=0;t<i;t++){const e=6*t;n.uint16[e+0]=4*t+0,n.uint16[e+1]=4*t+1,n.uint16[e+2]=4*t+2,n.uint16[e+3]=4*t+2,n.uint16[e+4]=4*t+3,n.uint16[e+5]=4*t+0}return n}(p));const _=l.createIndexBuffer(Ai,!0),y=l.createVertexBuffer(m,t.collisionCircleLayout.members,!0);for(const i of h){const r={u_matrix:i.transform,u_inv_matrix:i.invTransform,u_camera_to_center_distance:(x=e.transform).cameraToCenterDistance,u_viewport_size:[x.width,x.height]};f.draw(l,u.TRIANGLES,Si.disabled,Ti.disabled,e.colorModeForRenderPass(),Ei.disabled,r,n.id,y,_,t.SegmentVector.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}var x;y.destroy(),_.destroy()}Ei.disabled=new Ei(!1,1029,2305),Ei.backCCW=new Ei(!0,1029,2305);const Ci=t.identity(new Float32Array(16));function Pi(e,i,n,r,o,a){const{horizontalAlign:s,verticalAlign:l}=t.getAnchorAlignment(e),u=-(s-.5)*i,c=-(l-.5)*n,h=t.evaluateVariableOffset(e,r);return new t.pointGeometry((u/o+h[0])*a,(c/o+h[1])*a)}function Mi(e,i,n,r,o,a,s,l,u,c){const h=e.text.placedSymbolArray,p=e.text.dynamicLayoutVertexArray,d=e.icon.dynamicLayoutVertexArray,f={};p.clear();for(let d=0;d<h.length;d++){const m=h.get(d),g=e.allowVerticalPlacement&&!m.placedOrientation,_=m.hidden||!m.crossTileID||g?null:r[m.crossTileID];if(_){const r=new t.pointGeometry(m.anchorX,m.anchorY),h=ht(r,n?s:a),d=pt(o.cameraToCenterDistance,h.signedDistanceFromCamera);let g=t.evaluateSizeForFeature(e.textSizeData,u,m)*d/t.ONE_EM;n&&(g*=e.tilePixelRatio/l);const{width:y,height:x,anchor:v,textOffset:b,textBoxScale:w}=_,S=Pi(v,y,x,b,w,g),T=n?ht(r.add(S),a).point:h.point.add(i?S.rotate(-o.angle):S),E=e.allowVerticalPlacement&&m.placedOrientation===t.WritingMode.vertical?Math.PI/2:0;for(let e=0;e<m.numGlyphs;e++)t.addDynamicAttributes(p,T,E);c&&m.associatedIconIndex>=0&&(f[m.associatedIconIndex]={shiftedAnchor:T,angle:E})}else bt(m.numGlyphs,p)}if(c){d.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const n=i.get(e);if(n.hidden)bt(n.numGlyphs,d);else{const i=f[e];if(i)for(let e=0;e<n.numGlyphs;e++)t.addDynamicAttributes(d,i.shiftedAnchor,i.angle);else bt(n.numGlyphs,d)}}e.icon.dynamicLayoutVertexBuffer.updateData(d)}e.text.dynamicLayoutVertexBuffer.updateData(p)}function ki(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function zi(e,i,n,r,o,a,s,l,u,c,h,p){const d=e.context,f=d.gl,m=e.transform,g="map"===l,_="map"===u,y="viewport"!==l&&"point"!==n.layout.get("symbol-placement"),x=g&&!_&&!y,v=!n.layout.get("symbol-sort-key").isConstant();let b=!1;const w=e.depthModeForSublayer(0,Si.ReadOnly),S=n.layout.get("text-variable-anchor"),T=[];for(const l of r){const r=i.getTile(l),u=r.getBucket(n);if(!u)continue;const h=o?u.text:u.icon;if(!h||!h.segments.get().length)continue;const p=h.programConfigurations.get(n.id),d=o||u.sdfIcons,w=o?u.textSizeData:u.iconSizeData,E=_||0!==m.pitch,A=e.useProgram(ki(d,o,u),p),I=t.evaluateSizeForZoom(w,m.zoom);let C,P,M,k,z=[0,0],L=null;if(o){if(P=r.glyphAtlasTexture,M=f.LINEAR,C=r.glyphAtlasTexture.size,u.iconsInText){z=r.imageAtlasTexture.size,L=r.imageAtlasTexture;const t="composite"===w.kind||"camera"===w.kind;k=E||e.options.rotating||e.options.zooming||t?f.LINEAR:f.NEAREST}}else{const t=1!==n.layout.get("icon-size").constantOr(0)||u.iconsNeedLinear;P=r.imageAtlasTexture,M=d||e.options.rotating||e.options.zooming||t||E?f.LINEAR:f.NEAREST,C=r.imageAtlasTexture.size}const B=Et(r,1,e.transform.zoom),D=ut(l.posMatrix,_,g,e.transform,B),R=ct(l.posMatrix,_,g,e.transform,B),O=S&&u.hasTextData(),F="none"!==n.layout.get("icon-text-fit")&&O&&u.hasIconData();if(y){const t="map"===n.layout.get("text-rotation-alignment");ft(u,l.posMatrix,e,o,D,R,_,c,t)}const U=e.translatePosMatrix(l.posMatrix,r,a,s),j=y||o&&S||F?Ci:D,N=e.translatePosMatrix(R,r,a,s,!0),V=d&&0!==n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let G;G=d?u.iconsInText?ze(w.kind,I,x,_,e,U,j,N,C,z):ke(w.kind,I,x,_,e,U,j,N,o,C,!0):Me(w.kind,I,x,_,e,U,j,N,o,C);const q={program:A,buffers:h,uniformValues:G,atlasTexture:P,atlasTextureIcon:L,atlasInterpolation:M,atlasInterpolationIcon:k,isSDF:d,hasHalo:V};if(v&&u.canOverlap){b=!0;const e=h.segments.get();for(const i of e)T.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:q})}else T.push({segments:h.segments,sortKey:0,state:q})}b&&T.sort((t,e)=>t.sortKey-e.sortKey);for(const t of T){const i=t.state;if(d.activeTexture.set(f.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,f.CLAMP_TO_EDGE),i.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),i.isSDF){const r=i.uniformValues;i.hasHalo&&(r.u_is_halo=1,Li(i.buffers,t.segments,n,e,i.program,w,h,p,r)),r.u_is_halo=0}Li(i.buffers,t.segments,n,e,i.program,w,h,p,i.uniformValues)}}function Li(t,e,i,n,r,o,a,s,l){const u=n.context;r.draw(u,u.gl.TRIANGLES,o,a,s,Ei.disabled,l,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,n.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Bi(t,e,i,n,r,o,a){const s=t.context.gl,l=i.paint.get("fill-pattern"),u=l&&l.constantOr(1),c=i.getCrossfadeParameters();let h,p,d,f,m;a?(p=u&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=s.LINES):(p=u?"fillPattern":"fill",h=s.TRIANGLES);for(const g of n){const n=e.getTile(g);if(u&&!n.patternsLoaded())continue;const _=n.getBucket(i);if(!_)continue;const y=_.programConfigurations.get(i.id),x=t.useProgram(p,y);u&&(t.context.activeTexture.set(s.TEXTURE0),n.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),y.updatePaintBuffers(c));const v=l.constantOr(null);if(v&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[v.to.toString()],i=t.patternPositions[v.from.toString()];e&&i&&y.setConstantPatternPositions(e,i)}const b=t.translatePosMatrix(g.posMatrix,n,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(a){f=_.indexBuffer2,m=_.segments2;const e=[s.drawingBufferWidth,s.drawingBufferHeight];d="fillOutlinePattern"===p&&u?me(b,t,c,n,e):fe(b,e)}else f=_.indexBuffer,m=_.segments,d=u?de(b,t,c,n):pe(b);x.draw(t.context,h,r,t.stencilModeForClipping(g),o,Ei.disabled,d,i.id,_.layoutVertexBuffer,f,m,i.paint,t.transform.zoom,y)}}function Di(t,e,i,n,r,o,a){const s=t.context,l=s.gl,u=i.paint.get("fill-extrusion-pattern"),c=u.constantOr(1),h=i.getCrossfadeParameters(),p=i.paint.get("fill-extrusion-opacity");for(const d of n){const n=e.getTile(d),f=n.getBucket(i);if(!f)continue;const m=f.programConfigurations.get(i.id),g=t.useProgram(c?"fillExtrusionPattern":"fillExtrusion",m);c&&(t.context.activeTexture.set(l.TEXTURE0),n.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),m.updatePaintBuffers(h));const _=u.constantOr(null);if(_&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[_.to.toString()],i=t.patternPositions[_.from.toString()];e&&i&&m.setConstantPatternPositions(e,i)}const y=t.translatePosMatrix(d.posMatrix,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),x=i.paint.get("fill-extrusion-vertical-gradient"),v=c?he(y,t,x,p,d,h,n):ce(y,t,x,p);g.draw(s,s.gl.TRIANGLES,r,o,a,Ei.backCCW,v,i.id,f.layoutVertexBuffer,f.indexBuffer,f.segments,i.paint,t.transform.zoom,m)}}function Ri(t,e,i,n,r,o){const a=t.context,s=a.gl,l=e.fbo;if(!l)return;const u=t.useProgram("hillshade");a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,l.colorAttachment.get());const c=((t,e,i)=>{const n=i.paint.get("hillshade-shadow-color"),r=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a-=t.transform.angle);const s=!t.options.moving;return{u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),s),u_image:0,u_latrange:be(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:n,u_highlight:r,u_accent:o}})(t,e,i);u.draw(a,s.TRIANGLES,n,r,o,Ei.disabled,c,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function Oi(e,i,n,r,o,a){const s=e.context,l=s.gl,u=i.dem;if(u&&u.data){const c=u.dim,h=u.stride,d=u.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(h),i.demTexture){const t=i.demTexture;t.update(d,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new p(s,d,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let f=i.fbo;if(!f){const t=new p(s,{width:c,height:c,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),f=i.fbo=s.createFramebuffer(c,c,!0),f.colorAttachment.set(t.texture)}s.bindFramebuffer.set(f.framebuffer),s.viewport.set([0,0,c,c]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,r,o,a,Ei.disabled,((e,i)=>{const n=i.stride,r=t.create();return t.ortho(r,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(r,r,[0,-t.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[n,n],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,u),n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function Fi(e,i,n,r,o){const a=r.paint.get("raster-fade-duration");if(a>0){const r=t.exported.now(),s=(r-e.timeAdded)/a,l=i?(r-i.timeAdded)/a:-1,u=n.getSource(),c=o.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-c)>Math.abs(e.tileID.overscaledZ-c),p=h&&e.refreshedUponExpiration?1:t.clamp(h?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}const Ui=new t.Color(1,0,0,1),ji=new t.Color(0,1,0,1),Ni=new t.Color(0,0,1,1),Vi=new t.Color(1,0,1,1),Gi=new t.Color(0,1,1,1);function qi(t,e,i,n){Zi(t,0,e+i/2,t.transform.width,i,n)}function Wi(t,e,i,n){Zi(t,e-i/2,0,i,t.transform.height,n)}function Zi(t,e,i,n,r,o){const a=t.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*t.pixelRatio,i*t.pixelRatio,n*t.pixelRatio,r*t.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function Hi(e,i,n){const r=e.context,o=r.gl,a=n.posMatrix,s=e.useProgram("debug"),l=Si.disabled,u=Ti.disabled,c=e.colorModeForRenderPass(),h="$debug";r.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.draw(r,o.LINE_STRIP,l,u,c,Ei.disabled,ye(a,t.Color.red),h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);const p=i.getTileByID(n.key).latestRawTileData,d=Math.floor((p&&p.byteLength||0)/1024),f=i.getTile(n).tileSize,m=512/Math.min(f,512)*(n.overscaledZ/e.transform.zoom)*.5;let g=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(g+=" => "+n.overscaledZ),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,n=t.context.gl,r=t.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,i.width,i.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(e,5,5),r.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,`${g} ${d}kb`),s.draw(r,o.TRIANGLES,l,u,bi.alphaBlended,Ei.disabled,ye(a,t.Color.transparent,m),h,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}const $i={symbol:function(e,i,n,r,o){if("translucent"!==e.renderPass)return;const a=Ti.disabled,s=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,i,n,r,o,a,s){const l=i.transform,u="map"===o,c="map"===a;for(const o of e){const e=r.getTile(o),a=e.getBucket(n);if(!a||!a.text||!a.text.segments.get().length)continue;const h=t.evaluateSizeForZoom(a.textSizeData,l.zoom),p=Et(e,1,i.transform.zoom),d=ut(o.posMatrix,c,u,i.transform,p),f="none"!==n.layout.get("icon-text-fit")&&a.hasIconData();if(h){const t=Math.pow(2,l.zoom-e.tileID.overscaledZ);Mi(a,u,c,s,l,d,o.posMatrix,t,h,f)}}}(r,e,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),o),0!==n.paint.get("icon-opacity").constantOr(1)&&zi(e,i,n,r,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),a,s),0!==n.paint.get("text-opacity").constantOr(1)&&zi(e,i,n,r,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),a,s),i.map.showCollisionBoxes&&(Ii(e,i,n,r,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Ii(e,i,n,r,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(e,i,n,r){if("translucent"!==e.renderPass)return;const o=n.paint.get("circle-opacity"),a=n.paint.get("circle-stroke-width"),s=n.paint.get("circle-stroke-opacity"),l=!n.layout.get("circle-sort-key").isConstant();if(0===o.constantOr(1)&&(0===a.constantOr(1)||0===s.constantOr(1)))return;const u=e.context,c=u.gl,h=e.depthModeForSublayer(0,Si.ReadOnly),p=Ti.disabled,d=e.colorModeForRenderPass(),f=[];for(let o=0;o<r.length;o++){const a=r[o],s=i.getTile(a),u=s.getBucket(n);if(!u)continue;const c=u.programConfigurations.get(n.id),h={programConfiguration:c,program:e.useProgram("circle",c),layoutVertexBuffer:u.layoutVertexBuffer,indexBuffer:u.indexBuffer,uniformValues:ge(e,a,s,n)};if(l){const e=u.segments.get();for(const i of e)f.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:h})}else f.push({segments:u.segments,sortKey:0,state:h})}l&&f.sort((t,e)=>t.sortKey-e.sortKey);for(const t of f){const{programConfiguration:i,program:r,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s}=t.state;r.draw(u,c.TRIANGLES,h,p,d,Ei.disabled,s,n.id,o,a,t.segments,n.paint,e.transform.zoom,i)}},heatmap:function(e,i,n,r){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const o=e.context,a=o.gl,s=Ti.disabled,l=new bi([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){const n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let r=i.heatmapFbo;if(r)n.bindTexture(n.TEXTURE_2D,r.colorAttachment.get()),t.bindFramebuffer.set(r.framebuffer);else{const o=n.createTexture();n.bindTexture(n.TEXTURE_2D,o),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),r=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,i,n){const r=t.gl;r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e.width/4,e.height/4,0,r.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:r.UNSIGNED_BYTE,null),n.colorAttachment.set(i)}(t,e,o,r)}}(o,e,n),o.clear({color:t.Color.transparent});for(let t=0;t<r.length;t++){const u=r[t];if(i.hasRenderableParent(u))continue;const c=i.getTile(u),h=c.getBucket(n);if(!h)continue;const p=h.programConfigurations.get(n.id),d=e.useProgram("heatmap",p),{zoom:f}=e.transform;d.draw(o,a.TRIANGLES,Si.disabled,s,l,Ei.disabled,ve(u.posMatrix,c,f,n.paint.get("heatmap-intensity")),n.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,n.paint,e.transform.zoom,p)}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){const n=e.context,r=n.gl,o=i.heatmapFbo;if(!o)return;n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,o.colorAttachment.get()),n.activeTexture.set(r.TEXTURE1);let a=i.colorRampTexture;a||(a=i.colorRampTexture=new p(n,i.colorRamp,r.RGBA)),a.bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(n,r.TRIANGLES,Si.disabled,Ti.disabled,e.colorModeForRenderPass(),Ei.disabled,((e,i,n,r)=>{const o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);const a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}})(e,i),i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom)}(e,n))},line:function(e,i,n,r){if("translucent"!==e.renderPass)return;const o=n.paint.get("line-opacity"),a=n.paint.get("line-width");if(0===o.constantOr(1)||0===a.constantOr(1))return;const s=e.depthModeForSublayer(0,Si.ReadOnly),l=e.colorModeForRenderPass(),u=n.paint.get("line-dasharray"),c=n.paint.get("line-pattern"),h=c.constantOr(1),d=n.paint.get("line-gradient"),f=n.getCrossfadeParameters(),m=h?"linePattern":u?"lineSDF":d?"lineGradient":"line",g=e.context,_=g.gl;let y=!0;for(const o of r){const r=i.getTile(o);if(h&&!r.patternsLoaded())continue;const a=r.getBucket(n);if(!a)continue;const x=a.programConfigurations.get(n.id),v=e.context.program.get(),b=e.useProgram(m,x),w=y||b.program!==v,S=c.constantOr(null);if(S&&r.imageAtlas){const t=r.imageAtlas,e=t.patternPositions[S.to.toString()],i=t.patternPositions[S.from.toString()];e&&i&&x.setConstantPatternPositions(e,i)}const T=h?Te(e,r,n,f):u?Ee(e,r,n,u,f):d?Se(e,r,n,a.lineClipsArray.length):we(e,r,n);if(h)g.activeTexture.set(_.TEXTURE0),r.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),x.updatePaintBuffers(f);else if(u&&(w||e.lineAtlas.dirty))g.activeTexture.set(_.TEXTURE0),e.lineAtlas.bind(g);else if(d){const r=a.gradients[n.id];let s=r.texture;if(n.gradientVersion!==r.version){let l=256;if(n.stepInterpolant){const n=i.getSource().maxzoom,r=o.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;l=t.clamp(t.nextPowerOfTwo(a.maxLineLength/t.EXTENT*1024*r),256,g.maxTextureSize)}r.gradient=t.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:r.gradient||void 0,clips:a.lineClipsArray}),r.texture?r.texture.update(r.gradient):r.texture=new p(g,r.gradient,_.RGBA),r.version=n.gradientVersion,s=r.texture}g.activeTexture.set(_.TEXTURE0),s.bind(n.stepInterpolant?_.NEAREST:_.LINEAR,_.CLAMP_TO_EDGE)}b.draw(g,_.TRIANGLES,s,e.stencilModeForClipping(o),l,Ei.disabled,T,n.id,a.layoutVertexBuffer,a.indexBuffer,a.segments,n.paint,e.transform.zoom,x,a.layoutVertexBuffer2),y=!1}},fill:function(e,i,n,r){const o=n.paint.get("fill-color"),a=n.paint.get("fill-opacity");if(0===a.constantOr(1))return;const s=e.colorModeForRenderPass(),l=n.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(e.renderPass===u){const t=e.depthModeForSublayer(1,"opaque"===e.renderPass?Si.ReadWrite:Si.ReadOnly);Bi(e,i,n,r,t,s,!1)}if("translucent"===e.renderPass&&n.paint.get("fill-antialias")){const t=e.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Si.ReadOnly);Bi(e,i,n,r,t,s,!0)}},"fill-extrusion":function(t,e,i,n){const r=i.paint.get("fill-extrusion-opacity");if(0!==r&&"translucent"===t.renderPass){const o=new Si(t.context.gl.LEQUAL,Si.ReadWrite,t.depthRangeFor3D);if(1!==r||i.paint.get("fill-extrusion-pattern").constantOr(1))Di(t,e,i,n,o,Ti.disabled,bi.disabled),Di(t,e,i,n,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{const r=t.colorModeForRenderPass();Di(t,e,i,n,o,Ti.disabled,r)}}},hillshade:function(t,e,i,n){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const r=t.context,o=t.depthModeForSublayer(0,Si.ReadOnly),a=t.colorModeForRenderPass(),[s,l]="translucent"===t.renderPass?t.stencilConfigForOverlap(n):[{},n];for(const n of l){const r=e.getTile(n);r.needsHillshadePrepare&&"offscreen"===t.renderPass?Oi(t,r,i,o,Ti.disabled,a):"translucent"===t.renderPass&&Ri(t,r,i,o,s[n.overscaledZ],a)}r.viewport.set([0,0,t.width,t.height])},raster:function(t,e,i,n){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!n.length)return;const r=t.context,o=r.gl,a=e.getSource(),s=t.useProgram("raster"),l=t.colorModeForRenderPass(),[u,c]=a instanceof z?[{},n]:t.stencilConfigForOverlap(n),h=c[c.length-1].overscaledZ,p=!t.options.moving;for(const n of c){const c=t.depthModeForSublayer(n.overscaledZ-h,1===i.paint.get("raster-opacity")?Si.ReadWrite:Si.ReadOnly,o.LESS),d=e.getTile(n),f=t.transform.calculatePosMatrix(n.toUnwrapped(),p);d.registerFadeDuration(i.paint.get("raster-fade-duration"));const m=e.findLoadedParent(n,0),g=Fi(d,m,e,i,t.transform);let _,y;const x="nearest"===i.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;r.activeTexture.set(o.TEXTURE0),d.texture.bind(x,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),r.activeTexture.set(o.TEXTURE1),m?(m.texture.bind(x,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),_=Math.pow(2,m.tileID.overscaledZ-d.tileID.overscaledZ),y=[d.tileID.canonical.x*_%1,d.tileID.canonical.y*_%1]):d.texture.bind(x,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);const v=Ce(f,y||[0,0],_||1,g,i);a instanceof z?s.draw(r,o.TRIANGLES,c,Ti.disabled,l,Ei.disabled,v,i.id,a.boundsBuffer,t.quadTriangleIndexBuffer,a.boundsSegments):s.draw(r,o.TRIANGLES,c,u[n.overscaledZ],l,Ei.disabled,v,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,i){const n=i.paint.get("background-color"),r=i.paint.get("background-opacity");if(0===r)return;const o=t.context,a=o.gl,s=t.transform,l=s.tileSize,u=i.paint.get("background-pattern");if(t.isPatternMissing(u))return;const c=!u&&1===n.a&&1===r&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==c)return;const h=Ti.disabled,p=t.depthModeForSublayer(0,"opaque"===c?Si.ReadWrite:Si.ReadOnly),d=t.colorModeForRenderPass(),f=t.useProgram(u?"backgroundPattern":"background"),m=s.coveringTiles({tileSize:l});u&&(o.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));const g=i.getCrossfadeParameters();for(const e of m){const s=t.transform.calculatePosMatrix(e.toUnwrapped()),c=u?Be(s,r,t,u,{tileID:e,tileSize:l},g):Le(s,r,n);f.draw(o,a.TRIANGLES,p,h,d,Ei.disabled,c,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}},debug:function(t,e,i){for(let n=0;n<i.length;n++)Hi(t,e,i[n])},custom:function(t,e,i){const n=t.context,r=i.implementation;if("offscreen"===t.renderPass){const e=r.prerender;e&&(t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),e.call(r,n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),n.setStencilMode(Ti.disabled);const e="3d"===r.renderingMode?new Si(t.context.gl.LEQUAL,Si.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Si.ReadOnly);n.setDepthMode(e),r.render(n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState(),n.bindFramebuffer.set(null)}}};class Xi{constructor(t,e){this.context=new wi(t),this.transform=e,this._tileTextures={},this.setup(),this.numSublayers=V.maxUnderzooming+V.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jt,this.gpuTimers={}}resize(t,e,i){if(this.width=t*i,this.height=e*i,this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const e=this.context,i=new t.PosArray;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,ne.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);const n=new t.PosArray;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(n,ne.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);const r=new t.RasterBoundsArray;r.emplaceBack(0,0,0,0),r.emplaceBack(t.EXTENT,0,t.EXTENT,0),r.emplaceBack(0,t.EXTENT,0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(r,k.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);const o=new t.PosArray;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,ne.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);const a=new t.LineStripIndexArray;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);const s=new t.TriangleIndexArray;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s),this.emptyTexture=new p(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);const l=this.context.gl;this.stencilClearMode=new Ti({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const n=t.create();t.ortho(n,0,this.width,this.height,0,0,1),t.scale(n,n,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,i.TRIANGLES,Si.disabled,this.stencilClearMode,bi.disabled,Ei.disabled,xe(n),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const i=this.context,n=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(bi.disabled),i.setDepthMode(Si.disabled);const r=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++;r.draw(i,n.TRIANGLES,Si.disabled,new Ti({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),bi.disabled,Ei.disabled,xe(t.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Ti({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ti({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort((t,e)=>e.overscaledZ-t.overscaledZ),n=i[i.length-1].overscaledZ,r=i[0].overscaledZ-n+1;if(r>1){this.currentStencilSource=void 0,this.nextStencilID+r>256&&this.clearStencil();const t={};for(let i=0;i<r;i++)t[i+n]=new Ti({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=r,[t,i]}return[{[n]:Ti.disabled},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new bi([e.CONSTANT_COLOR,e.ONE],new t.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?bi.unblended:bi.alphaBlended}depthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return Si.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Si(i||this.context.gl.LEQUAL,e,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.exported.now()),this.imageManager.beginFrame();const n=this.style._order,r=this.style.sourceCaches;for(const t in r){const e=r[t];e.used&&e.prepare(this.context)}const o={},a={},s={};for(const t in r){const e=r[t];o[t]=e.getVisibleCoordinates(),a[t]=o[t].slice().reverse(),s[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<n.length;t++)if(this.style._layers[n[t]].is3D()){this.opaquePassCutoff=t;break}this.renderPass="offscreen";for(const t of n){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=a[e.source];("custom"===e.type||i.length)&&this.renderLayer(this,r[e.source],e,i)}for(this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[n[this.currentLayer]],e=r[t.source],i=o[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){const t=this.style._layers[n[this.currentLayer]],e=r[t.source],i=("symbol"===t.type?s:a)[t.source];this._renderTileClippingMasks(t,o[t.source]),this.renderLayer(this,e,t,i)}if(this.options.showTileBoundaries){let t,e;Object.values(this.style._layers).forEach(i=>{i.source&&!i.isHidden(this.transform.zoom)&&(i.source!==(e&&e.id)&&(e=this.style.sourceCaches[i.source]),(!t||t.getSource().maxzoom<e.getSource().maxzoom)&&(t=e))}),t&&$i.debug(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;qi(t,t.transform.height-(e.top||0),3,Ui),qi(t,e.bottom||0,3,ji),Wi(t,e.left||0,3,Ni),Wi(t,t.transform.width-(e.right||0),3,Vi);const i=t.transform.centerPoint;!function(t,e,i,n){Zi(t,e-1,i-10,2,20,n),Zi(t,e-10,i-1,20,2,n)}(t,i.x,t.transform.height-i.y,Gi)}(this),this.context.setDefault()}renderLayer(t,e,i,n){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||n.length)&&(this.id=i.id,this.gpuTimingStart(i),$i[i.type](t,e,i,n,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const e=this.context.extTimerQuery;let i=this.gpuTimers[t.id];i||(i=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),i.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,i.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const e={};for(const i in t){const n=t[i],r=this.context.extTimerQuery,o=r.getQueryObjectEXT(n.query,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(n.query),e[i]=o}return e}translatePosMatrix(e,i,n,r,o){if(!n[0]&&!n[1])return e;const a=o?"map"===r?this.transform.angle:0:"viewport"===r?-this.transform.angle:0;if(a){const t=Math.sin(a),e=Math.cos(a);n=[n[0]*e-n[1]*t,n[0]*t+n[1]*e]}const s=[o?n[0]:Et(i,n[0],this.transform.zoom),o?n[1]:Et(i,n[1],this.transform.zoom),0],l=new Float32Array(16);return t.translate(l,e,s),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e){this.cache=this.cache||{};const i=`${t}${e?e.cacheKey:""}${this._showOverdrawInspector?"/overdraw":""}`;return this.cache[i]||(this.cache[i]=new le(this.context,t,re[t],e,De[t],this._showOverdrawInspector)),this.cache[i]}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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new p(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Ki{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(e,i,n){const r=Math.pow(2,n),o=[[-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(i=>t.transformMat4([],i,e)).map(e=>t.scale$1([],e,1/e[3]/i*r)),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(t=>{const e=function(t,e){var i=e[0],n=e[1],r=e[2],o=i*i+n*n+r*r;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}([],function(t,e,i){var n=e[0],r=e[1],o=e[2],a=i[0],s=i[1],l=i[2];return t[0]=r*l-o*s,t[1]=o*a-n*l,t[2]=n*s-r*a,t}([],c([],o[t[0]],o[t[1]]),c([],o[t[2]],o[t[1]]))),i=-((n=e)[0]*(r=o[t[1]])[0]+n[1]*r[1]+n[2]*r[2]);var n,r;return e.concat(i)});return new Ki(o,a)}}class Ji{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],i=l(this.min),n=l(this.max);for(let t=0;t<e.length;t++)i[t]=e[t]?this.min[t]:this.center[t],n[t]=e[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new Ji(i,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(e){const i=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]];let n=!0;for(let r=0;r<e.planes.length;r++){const o=e.planes[r];let a=0;for(let e=0;e<i.length;e++)t.dot(o,i[e])>=0&&a++;if(0===a)return 0;a!==i.length&&(n=!1)}if(n)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let r=0;r<e.points.length;r++){const o=e.points[r][t]-this.min[t];i=Math.min(i,o),n=Math.max(n,o)}if(n<0||i>this.max[t]-this.min[t])return 0}return 1}}class Yi{constructor(t=0,e=0,i=0,n=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=n}interpolate(e,i,n){return null!=i.top&&null!=e.top&&(this.top=t.number(e.top,i.top,n)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,i.bottom,n)),null!=i.left&&null!=e.left&&(this.left=t.number(e.left,i.left,n)),null!=i.right&&null!=e.right&&(this.right=t.number(e.right,i.right,n)),this}getCenter(e,i){const n=t.clamp((this.left+e-this.right)/2,0,e),r=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.pointGeometry(n,r)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Yi(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Qi{constructor(e,i,n,r,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||!!o,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==r?60:r,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Yi,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new Qi(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}(),function(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);t[0]=n*l+o*s,t[1]=r*l+a*s,t[2]=n*-s+o*l,t[3]=r*-s+a*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies){const n=this.pointCoordinate(new t.pointGeometry(0,0)),r=this.pointCoordinate(new t.pointGeometry(this.width,0)),o=this.pointCoordinate(new t.pointGeometry(this.width,this.height)),a=this.pointCoordinate(new t.pointGeometry(0,this.height)),s=Math.floor(Math.min(n.x,r.x,o.x,a.x)),l=Math.floor(Math.max(n.x,r.x,o.x,a.x)),u=1;for(let n=s-u;n<=l+u;n++)0!==n&&i.push(new t.UnwrappedTileID(n,e))}return i}coveringTiles(e){let i=this.coveringZoomLevel(e);const n=i;if(void 0!==e.minzoom&&i<e.minzoom)return[];void 0!==e.maxzoom&&i>e.maxzoom&&(i=e.maxzoom);const r=t.MercatorCoordinate.fromLngLat(this.center),o=Math.pow(2,i),a=[o*r.x,o*r.y,0],s=Ki.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i);let l=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(l=i);const u=t=>({aabb:new Ji([t*o,0,0],[(t+1)*o,o,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),c=[],p=[],d=i,f=e.reparseOverscaled?n:i;if(this._renderWorldCopies)for(let t=1;t<=3;t++)c.push(u(-t)),c.push(u(t));for(c.push(u(0));c.length>0;){const e=c.pop(),i=e.x,n=e.y;let r=e.fullyVisible;if(!r){const t=e.aabb.intersects(s);if(0===t)continue;r=2===t}const o=e.aabb.distanceX(a),u=e.aabb.distanceY(a),m=Math.max(Math.abs(o),Math.abs(u)),g=3+(1<<d-e.zoom)-2;if(e.zoom===d||m>g&&e.zoom>=l)p.push({tileID:new t.OverscaledTileID(e.zoom===d?f:e.zoom,e.wrap,e.zoom,i,n),distanceSq:h([a[0]-.5-i,a[1]-.5-n])});else for(let t=0;t<4;t++){const o=(i<<1)+t%2,a=(n<<1)+(t>>1);c.push({aabb:e.aabb.quadrant(t),zoom:e.zoom+1,x:o,y:a,wrap:e.wrap,fullyVisible:r})}}return p.sort((t,e)=>t.distanceSq-e.distanceSq).map(t=>t.tileID)}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.pointGeometry(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}setLocationAtPoint(e,i){const n=this.pointCoordinate(i),r=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(n.x-r.x),o.y-(n.y-r.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t){return this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}locationCoordinate(e){return t.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t.toLngLat()}pointCoordinate(e){const i=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(i,i,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);const r=i[3],o=n[3],a=i[1]/r,s=n[1]/o,l=i[2]/r,u=n[2]/o,c=l===u?0:(0-l)/(u-l);return new t.MercatorCoordinate(t.number(i[0]/r,n[0]/o,c)/this.worldSize,t.number(a,s,c)/this.worldSize)}coordinatePoint(e){const i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix),new t.pointGeometry(i[0]/i[3],i[1]/i[3])}getBounds(){return(new t.LngLatBounds).extend(this.pointLocation(new t.pointGeometry(0,0))).extend(this.pointLocation(new t.pointGeometry(this.width,0))).extend(this.pointLocation(new t.pointGeometry(this.width,this.height))).extend(this.pointLocation(new t.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,i=!1){const n=e.key,r=i?this._alignedPosMatrixCache:this._posMatrixCache;if(r[n])return r[n];const o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*a,o.y*a,0]),t.scale(l,l,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),r[n]=new Float32Array(l),r[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,i,n,r,o=-90,a=90,s=-180,l=180;const u=this.size,c=this._unmodified;if(this.latRange){const i=this.latRange;o=t.mercatorYfromLat(i[1])*this.worldSize,a=t.mercatorYfromLat(i[0])*this.worldSize,e=a-o<u.y?u.y/(a-o):0}if(this.lngRange){const e=this.lngRange;s=t.mercatorXfromLng(e[0])*this.worldSize,l=t.mercatorXfromLng(e[1])*this.worldSize,i=l-s<u.x?u.x/(l-s):0}const h=this.point,p=Math.max(i||0,e||0);if(p)return this.center=this.unproject(new t.pointGeometry(i?(l+s)/2:h.x,e?(a+o)/2:h.y)),this.zoom+=this.scaleZoom(p),this._unmodified=c,void(this._constraining=!1);if(this.latRange){const t=h.y,e=u.y/2;t-e<o&&(r=o+e),t+e>a&&(r=a-e)}if(this.lngRange){const t=h.x,e=u.x/2;t-e<s&&(n=s+e),t+e>l&&(n=l-e)}void 0===n&&void 0===r||(this.center=this.unproject(new t.pointGeometry(void 0!==n?n:h.x,void 0!==r?r:h.y))),this._unmodified=c,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;const i=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),r=Math.sin(n)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-i-n,.01,Math.PI-.01)),o=this.point,a=o.x,s=o.y,l=1.01*(Math.cos(Math.PI/2-this._pitch)*r+this.cameraToCenterDistance),u=this.height/50;let c=new Float64Array(16);t.perspective(c,this._fov,this.width/this.height,u,l),c[8]=2*-e.x/this.width,c[9]=2*e.y/this.height,t.scale(c,c,[1,-1,1]),t.translate(c,c,[0,0,-this.cameraToCenterDistance]),t.rotateX(c,c,this._pitch),t.rotateZ(c,c,this.angle),t.translate(c,c,[-a,-s,0]),this.mercatorMatrix=t.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),t.scale(c,c,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize]),this.projMatrix=c,this.invProjMatrix=t.invert([],this.projMatrix);const h=this.width%2/2,p=this.height%2/2,d=Math.cos(this.angle),f=Math.sin(this.angle),m=a-Math.round(a)+d*h+f*p,g=s-Math.round(s)+d*p+f*h,_=new Float64Array(c);if(t.translate(_,_,[m>.5?m-1:m,g>.5?g-1:g,0]),this.alignedProjMatrix=_,c=t.create(),t.scale(c,c,[this.width/2,-this.height/2,1]),t.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=t.create(),t.scale(c,c,[1,-1,1]),t.translate(c,c,[-1,-1,0]),t.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),c=t.invert(new Float64Array(16),this.pixelMatrix),!c)throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.pointGeometry(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.pointGeometry(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return[e[0],i];{let n=i.x,r=i.y,o=i.x,a=i.y;for(const t of e)n=Math.min(n,t.x),r=Math.min(r,t.y),o=Math.max(o,t.x),a=Math.max(a,t.y);return[new t.pointGeometry(n,r),new t.pointGeometry(o,r),new t.pointGeometry(o,a),new t.pointGeometry(n,a),new t.pointGeometry(n,r)]}}}class tn{constructor(e){this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(t,e){let i=!1,n=null;const r=()=>{n=null,i&&(t(),n=setTimeout(r,300),i=!1)};return()=>(i=!0,n||r(),n)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,n),o=Math.round(e.lng*r)/r,a=Math.round(e.lat*r)/r,s=this._map.getBearing(),l=this._map.getPitch();let u="";if(u+=t?`/${o}/${a}/${i}`:`${i}/${a}/${o}`,(s||l)&&(u+="/"+Math.round(10*s)/10),l&&(u+="/"+Math.round(l)),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map(i=>{const n=i.split("=")[0];return n===t?(e=!0,`${n}=${u}`):i}).filter(t=>t);return e||i.push(`${t}=${u}`),"#"+i.join("&")}return"#"+u}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map(t=>t.split("=")).forEach(t=>{t[0]===this._hashName&&(e=t)}),(e&&e[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(t=>isNaN(t))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(t){}}}const en={linearity:.3,easing:t.bezier(0,0,.3,1)},nn=t.extend({deceleration:2500,maxSpeed:1400},en),rn=t.extend({deceleration:20,maxSpeed:1400},en),on=t.extend({deceleration:1e3,maxSpeed:360},en),an=t.extend({deceleration:1e3,maxSpeed:90},en);class sn{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.exported.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.exported.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(i.pan.mag()){const o=un(i.pan.mag(),n,t.extend({},nn,e||{}));r.offset=i.pan.mult(o.amount/i.pan.mag()),r.center=this._map.transform.center,ln(r,o)}if(i.zoom){const t=un(i.zoom,n,rn);r.zoom=this._map.transform.zoom+t.amount,ln(r,t)}if(i.bearing){const e=un(i.bearing,n,on);r.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),ln(r,e)}if(i.pitch){const t=un(i.pitch,n,an);r.pitch=this._map.transform.pitch+t.amount,ln(r,t)}if(r.zoom||r.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;r.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.extend(r,{noMoveStart:!0})}}function ln(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function un(e,i,n){const{maxSpeed:r,linearity:o,deceleration:a}=n,s=t.clamp(e*o/(i/1e3),-r,r),l=Math.abs(s)/(a*o);return{easing:n.easing,duration:1e3*l,amount:s*(l/2)}}class cn extends t.Event{constructor(e,i,n,r={}){const a=o.mousePos(i.getCanvasContainer(),n),s=i.unproject(a);super(e,t.extend({point:a,lngLat:s,originalEvent:n},r)),this._defaultPrevented=!1,this.target=i}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class hn extends t.Event{constructor(e,i,n){const r="touchend"===e?n.changedTouches:n.touches,a=o.touchPos(i.getCanvasContainer(),r),s=a.map(t=>i.unproject(t)),l=a.reduce((t,e,i,n)=>t.add(e.div(n.length)),new t.pointGeometry(0,0));super(e,{points:a,point:l,lngLats:s,lngLat:i.unproject(l),originalEvent:n}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class pn extends t.Event{constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class dn{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new pn(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new cn(t.type,this._map,t))}mouseup(t){this._map.fire(new cn(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new cn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new cn(t.type,this._map,t))}mouseover(t){this._map.fire(new cn(t.type,this._map,t))}mouseout(t){this._map.fire(new cn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new hn(t.type,this._map,t))}touchmove(t){this._map.fire(new hn(t.type,this._map,t))}touchend(t){this._map.fire(new hn(t.type,this._map,t))}touchcancel(t){this._map.fire(new hn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fn{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(t){this._map.fire(new cn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new cn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new cn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class mn{constructor(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(o.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;const n=this._startPos;this._lastPos=i,this._box||(this._box=o.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const r=Math.min(n.x,i.x),a=Math.max(n.x,i.x),s=Math.min(n.y,i.y),l=Math.max(n.y,i.y);o.setTransform(this._box,`translate(${r}px,${s}px)`),this._box.style.width=a-r+"px",this._box.style.height=l-s+"px"}mouseupWindow(e,i){if(!this._active)return;if(0!==e.button)return;const n=this._startPos,r=i;if(this.reset(),o.suppressClick(),n.x!==r.x||n.y!==r.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:t=>t.fitScreenCoordinates(n,r,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(o.remove(this._box),this._box=null),o.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function gn(t,e){const i={};for(let n=0;n<t.length;n++)i[t[n].identifier]=e[n];return i}class _n{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){const i=new t.pointGeometry(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=gn(n,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const n=gn(i,e);for(const t in this.touches){const e=this.touches[t],i=n[t];(!i||i.dist(e)>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class yn{constructor(t){this.singleTap=new _n(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const n=this.singleTap.touchend(t,e,i);if(n){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class xn{constructor(){this._zoomIn=new yn({numTouches:1,numTaps:2}),this._zoomOut=new yn({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const n=this._zoomIn.touchend(t,e,i),r=this._zoomOut.touchend(t,e,i);return n?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(n)},{originalEvent:t})}):r?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(r)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const vn={0:1,2:2};class bn{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,e){return!1}_move(t,e){return{}}mousedown(t,e){if(this._lastPoint)return;const i=o.mouseButton(t);this._correctButton(t,i)&&(this._lastPoint=e,this._eventButton=i)}mousemoveWindow(t,e){const i=this._lastPoint;if(i)if(t.preventDefault(),function(t,e){const i=vn[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=e,this._move(i,e)}mouseupWindow(t){this._lastPoint&&o.mouseButton(t)===this._eventButton&&(this._moved&&o.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class wn extends bn{mousedown(t,e){super.mousedown(t,e),this._lastPoint&&(this._active=!0)}_correctButton(t,e){return 0===e&&!t.ctrlKey}_move(t,e){return{around:e,panDelta:e.sub(t)}}}class Sn extends bn{_correctButton(t,e){return 0===e&&t.ctrlKey||2===e}_move(t,e){const i=.8*(e.x-t.x);if(i)return this._active=!0,{bearingDelta:i}}contextmenu(t){t.preventDefault()}}class Tn extends bn{_correctButton(t,e){return 0===e&&t.ctrlKey||2===e}_move(t,e){const i=-.5*(e.y-t.y);if(i)return this._active=!0,{pitchDelta:i}}contextmenu(t){t.preventDefault()}}class En{constructor(t){this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.pointGeometry(0,0)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._active&&!(i.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,i)}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,n){n.length>0&&(this._active=!0);const r=gn(n,i),o=new t.pointGeometry(0,0),a=new t.pointGeometry(0,0);let s=0;for(const t in r){const e=r[t],i=this._touches[t];i&&(o._add(e),a._add(e.sub(i)),s++,r[t]=e)}if(this._touches=r,s<this._minTouches||!a.mag())return;const l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class An{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,e,i){return{}}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[n,r]=this._firstTwoTouches,o=In(i,e,n),a=In(i,e,r);if(!o||!a)return;const s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}touchend(t,e,i){if(!this._firstTwoTouches)return;const[n,r]=this._firstTwoTouches,a=In(i,e,n),s=In(i,e,r);a&&s||(this._active&&o.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function In(t,e,i){for(let n=0;n<t.length;n++)if(t[n].identifier===i)return e[n]}function Cn(t,e){return Math.log(t/e)/Math.LN2}class Pn extends An{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Cn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cn(this._distance,i),pinchAround:e}}}function Mn(t,e){return 180*t.angleWith(e)/Math.PI}class kn extends An{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Mn(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=Mn(t,this._startVector);return Math.abs(i)<e}}function zn(t){return Math.abs(t.y)>Math.abs(t.x)}class Ln extends An{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(t){this._lastPoints=t,zn(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){const n=t[0].sub(this._lastPoints[0]),r=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(n,r,i.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+r.y)/2*-.5}}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const n=t.mag()>=2,r=e.mag()>=2;if(!n&&!r)return;if(!n||!r)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return zn(t)&&zn(e)&&o}}const Bn={panStep:100,bearingStep:15,pitchStep:10};class Dn{constructor(){const t=Bn;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,n=0,r=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),r=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),r=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:a=>{const s=a.getZoom();a.easeTo({duration:300,easeId:"keyboardHandler",easing:Rn,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:a.getBearing()+i*this._bearingStep,pitch:a.getPitch()+n*this._pitchStep,offset:[-r*this._panStep,-o*this._panStep],center:a.getCenter()},{originalEvent:t})}}}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 Rn(t){return t*(2-t)}const On=4.000244140625;class Fn{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const n=t.exported.now(),r=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%On==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=o.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(i)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._map.transform;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>On?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const n="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(n*i))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,n=this._startZoom,r=this._easing;let o,a=!1;if("wheel"===this._type&&n&&r){const e=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),s=r(e);o=t.number(n,i,s),e<1?this._frameId||(this._frameId=!0):a=!0}else o=i,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.ease;if(this._prevEase){const e=this._prevEase,n=(t.exported.now()-e.start)/e.duration,r=e.easing(n+.01)-e.easing(n),o=.27/Math.sqrt(r*r+1e-4)*.01,a=Math.sqrt(.0729-o*o);i=t.bezier(o,a,.25,1)}return this._prevEase={start:t.exported.now(),duration:e,easing:i},i}reset(){this._active=!1}}class Un{constructor(t,e){this._clickZoom=t,this._tapZoom=e}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 jn{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(t.shiftKey?-1:1),around:i.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nn{constructor(){this._tap=new yn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i))}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const n=e[0],r=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vn{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Gn{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class qn{constructor(t,e,i,n){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Wn=t=>t.zoom||t.drag||t.pitch||t.rotate;class Zn extends t.Event{}function Hn(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class $n{constructor(e,i){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new sn(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i),t.bindAll(["handleEvent","handleWindowEvent"],this);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,i]of this._listeners)o.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[t,e,i]of this._listeners)o.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){const e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new dn(e,t));const n=e.boxZoom=new mn(e,t);this._add("boxZoom",n);const r=new xn,o=new jn;e.doubleClickZoom=new Un(o,r),this._add("tapZoom",r),this._add("clickZoom",o);const a=new Nn;this._add("tapDragZoom",a);const s=e.touchPitch=new Ln;this._add("touchPitch",s);const l=new Sn(t),u=new Tn(t);e.dragRotate=new Gn(t,l,u),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);const c=new wn(t),h=new En(t);e.dragPan=new Vn(i,c,h),this._add("mousePan",c),this._add("touchPan",h,["touchZoom","touchRotate"]);const p=new kn,d=new Pn;e.touchZoomRotate=new qn(i,d,p,a),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",d,["touchPan","touchRotate"]);const f=e.scrollZoom=new Fn(e,this);this._add("scrollZoom",f,["mousePan"]);const m=e.keyboard=new Dn;this._add("keyboard",m),this._add("blockableMapEvent",new fn(e));for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[i]&&e[i].enable(t[i])}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Wn(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const n in t)if(n!==i&&(!e||e.indexOf(n)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,t.type+"Window")}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}handleEvent(t,e){if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},r={},a={},s=t.touches,l=s?this._getMapTouches(s):void 0,u=l?o.touchPos(this._el,l):o.mousePos(this._el,t);for(const{handlerName:o,handler:s,allowed:c}of this._handlers){if(!s.isEnabled())continue;let h;this._blockedByActive(a,c,o)?s.reset():s[e||t.type]&&(h=s[e||t.type](t,u,l),this.mergeHandlerResult(n,r,h,o,i),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||s.isActive())&&(a[o]=s)}const c={};for(const t in this._previousActiveHandlers)a[t]||(c[t]=i);this._previousActiveHandlers=a,(Object.keys(c).length||Hn(n))&&(this._changes.push([n,r,c]),this._triggerRenderFrame()),(Object.keys(a).length||Hn(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=n;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))}mergeHandlerResult(e,i,n,r,o){if(!n)return;t.extend(e,n);const a={handlerName:r,originalEvent:n.originalEvent||o};void 0!==n.zoomDelta&&(i.zoom=a),void 0!==n.panDelta&&(i.drag=a),void 0!==n.pitchDelta&&(i.pitch=a),void 0!==n.bearingDelta&&(i.rotate=a)}_applyChanges(){const e={},i={},n={};for(const[r,o,a]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new t.pointGeometry(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(e.around=r.around),void 0!==r.pinchAround&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),t.extend(i,o),t.extend(n,a);this._updateMapTransform(e,i,n),this._changes=[]}_updateMapTransform(t,e,i){const n=this._map,r=n.transform;if(!Hn(t))return this._fireEvents(e,i,!0);let{panDelta:o,zoomDelta:a,bearingDelta:s,pitchDelta:l,around:u,pinchAround:c}=t;void 0!==c&&(u=c),n._stop(!0),u=u||n.transform.centerPoint;const h=r.pointLocation(o?u.sub(o):u);s&&(r.bearing+=s),l&&(r.pitch+=l),a&&(r.zoom+=a),r.setLocationAtPoint(h,u),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(e,i,n){const r=Wn(this._eventsInProgress),o=Wn(e),a={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(a[t+"start"]=i),this._eventsInProgress[t]=e[t]}!r&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const s={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:n}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||n,s[t+"end"]=l)}for(const t in s)this._fireEvent(t,s[t]);const u=Wn(this._eventsInProgress);if(n&&(r||o)&&!u){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;e?(i(e.bearing||this._map.getBearing())&&(e.bearing=0),this._map.easeTo(e,{originalEvent:l})):(this._map.fire(new t.Event("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Zn("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Xn={extend:(e,...i)=>t.extend(e,...i),run(t){t()},logToElement(t,e=!1,i="log"){const n=window.document.getElementById(i);n&&(e&&(n.innerHTML=""),n.innerHTML+="<br>"+t)}};class Kn extends t.Evented{constructor(e,i){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,n){return e=t.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),n)}panTo(e,i,n){return this.easeTo(t.extend({center:e},i),n)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,n){return this.easeTo(t.extend({zoom:e},i),n)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,i,n){return this.easeTo(t.extend({bearing:e},i),n)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}cameraForBounds(e,i){e=t.LngLatBounds.convert(e);const n=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),n,i)}_cameraForBoxAndBearing(e,i,n,r){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(r=t.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){const t=r.padding;r.padding={top:t,bottom:t,right:t,left:t}}r.padding=t.extend(o,r.padding);const a=this.transform,s=a.padding,l=a.project(t.LngLat.convert(e)),u=a.project(t.LngLat.convert(i)),c=l.rotate(-n*Math.PI/180),h=u.rotate(-n*Math.PI/180),p=new t.pointGeometry(Math.max(c.x,h.x),Math.max(c.y,h.y)),d=new t.pointGeometry(Math.min(c.x,h.x),Math.min(c.y,h.y)),f=p.sub(d),m=(a.width-(s.left+s.right+r.padding.left+r.padding.right))/f.x,g=(a.height-(s.top+s.bottom+r.padding.top+r.padding.bottom))/f.y;if(g<0||m<0)return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const _=Math.min(a.scaleZoom(a.scale*Math.min(m,g)),r.maxZoom),y=t.pointGeometry.convert(r.offset),x=new t.pointGeometry((r.padding.left-r.padding.right)/2,(r.padding.top-r.padding.bottom)/2).rotate(n*Math.PI/180),v=y.add(x).mult(a.scale/a.zoomScale(_));return{center:a.unproject(l.add(u).div(2).sub(v)),zoom:_,bearing:n}}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(e,i,n,r,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.pointGeometry.convert(e)),this.transform.pointLocation(t.pointGeometry.convert(i)),n,r),r,o)}_fitInternal(e,i,n){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(e,i){this.stop();const n=this.transform;let r=!1,o=!1,a=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(r=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=t.LngLat.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(o=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(a=!0,n.pitch=+e.pitch),null==e.padding||n.isPaddingEqual(e.padding)||(n.padding=e.padding),this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),r&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),o&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),a&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i))}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.exported.prefersReducedMotion)&&(e.duration=0);const n=this.transform,r=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in e?+e.zoom:r,u="bearing"in e?this._normalizeBearing(e.bearing,o):o,c="pitch"in e?+e.pitch:a,h="padding"in e?e.padding:n.padding,p=t.pointGeometry.convert(e.offset);let d=n.centerPoint.add(p);const f=n.pointLocation(d),m=t.LngLat.convert(e.center||f);this._normalizeCenter(m);const g=n.project(f),_=n.project(m).sub(g),y=n.zoomScale(l-r);let x,v;e.around&&(x=t.LngLat.convert(e.around),v=n.locationPoint(x));const b={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==r,this._rotating=this._rotating||o!==u,this._pitching=this._pitching||c!==a,this._padding=!n.isPaddingEqual(h),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,b),this._ease(e=>{if(this._zooming&&(n.zoom=t.number(r,l,e)),this._rotating&&(n.bearing=t.number(o,u,e)),this._pitching&&(n.pitch=t.number(a,c,e)),this._padding&&(n.interpolatePadding(s,h,e),d=n.centerPoint.add(p)),x)n.setLocationAtPoint(x,v);else{const t=n.zoomScale(n.zoom-r),i=l>r?Math.min(2,y):Math.max(.5,y),o=Math.pow(i,1-e),a=n.unproject(g.add(_.mult(e*o)).mult(t));n.setLocationAtPoint(n.renderWorldCopies?a.wrap():a,d)}this._fireMoveEvents(i)},t=>{this._afterEase(i,t)},e),this}_prepareEase(e,i,n={}){this._moving=!0,i||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const n=this._zooming,r=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),r&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}flyTo(e,i){if(!e.essential&&t.exported.prefersReducedMotion){const n=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);const n=this.transform,r=this.getZoom(),o=this.getBearing(),a=this.getPitch(),s=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,n.minZoom,n.maxZoom):r,u="bearing"in e?this._normalizeBearing(e.bearing,o):o,c="pitch"in e?+e.pitch:a,h="padding"in e?e.padding:n.padding,p=n.zoomScale(l-r),d=t.pointGeometry.convert(e.offset);let f=n.centerPoint.add(d);const m=n.pointLocation(f),g=t.LngLat.convert(e.center||m);this._normalizeCenter(g);const _=n.project(m),y=n.project(g).sub(_);let x=e.curve;const v=Math.max(n.width,n.height),b=v/p,w=y.mag();if("minZoom"in e){const i=t.clamp(Math.min(e.minZoom,r,l),n.minZoom,n.maxZoom),o=v/n.zoomScale(i-r);x=Math.sqrt(o/w*2)}const S=x*x;function T(t){const e=(b*b-v*v+(t?-1:1)*S*S*w*w)/(2*(t?b:v)*S*w);return Math.log(Math.sqrt(e*e+1)-e)}function E(t){return(Math.exp(t)-Math.exp(-t))/2}function A(t){return(Math.exp(t)+Math.exp(-t))/2}const I=T(0);let C=function(t){return A(I)/A(I+x*t)},P=function(t){return v*((A(I)*(E(e=I+x*t)/A(e))-E(I))/S)/w;var e},M=(T(1)-I)/x;if(Math.abs(w)<1e-6||!isFinite(M)){if(Math.abs(v-b)<1e-6)return this.easeTo(e,i);const t=b<v?-1:1;M=Math.abs(Math.log(b/v))/x,P=function(){return 0},C=function(e){return Math.exp(t*x*e)}}return e.duration="duration"in e?+e.duration:1e3*M/("screenSpeed"in e?+e.screenSpeed/x:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==u,this._pitching=c!==a,this._padding=!n.isPaddingEqual(h),this._prepareEase(i,!1),this._ease(e=>{const p=e*M,m=1/C(p);n.zoom=1===e?l:r+n.scaleZoom(m),this._rotating&&(n.bearing=t.number(o,u,e)),this._pitching&&(n.pitch=t.number(a,c,e)),this._padding&&(n.interpolatePadding(s,h,e),f=n.centerPoint.add(d));const x=1===e?g:n.unproject(_.add(y.mult(P(p))).mult(m));n.setLocationAtPoint(n.renderWorldCopies?x.wrap():x,f),this._fireMoveEvents(i)},()=>this._afterEase(i),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,i,n){!1===n.animate||0===n.duration?(e(1),i()):(this._easeStart=t.exported.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const e=Math.min((t.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(e,i){e=t.wrap(e,-180,180);const n=Math.abs(e-i);return Math.abs(e-360-i)<n&&(e-=360),Math.abs(e+360-i)<n&&(e+=360),e}_normalizeCenter(t){const e=this.transform;if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}}class Jn{constructor(e={}){this.options=e,t.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=o.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=o.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){o.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",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(t,e){const i=this._map._getUIString("AttributionControl."+e);t.title=i,t.setAttribute("aria-label",i)}_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","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"!=typeof t?"":t)):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const n=e[i];if(n.used){const e=n.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter(t=>String(t).trim()),t.sort((t,e)=>t.length-e.length),t=t.filter((e,i)=>{for(let n=i+1;n<t.length;n++)if(t[n].indexOf(e)>=0)return!1;return!0});const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_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","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Yn{constructor(e={}){this.options=e,t.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=o.create("div","maplibregl-ctrl mapboxgl-ctrl");const e=o.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){o.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact","mapboxgl-compact"):e.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Qn{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const tr={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},er={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},ir={showCompass:!0,showZoom:!0,visualizePitch:!1};class nr{constructor(e,i,n=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new Sn({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,n&&(this.mousePitch=new Tn({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener(i,"mousedown",this.mousedown),o.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),o.addEventListener(i,"touchmove",this.touchmove),o.addEventListener(i,"touchend",this.touchend),o.addEventListener(i,"touchcancel",this.reset)}down(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),o.disableDrag()}move(t,e){const i=this.map,n=this.mouseRotate.mousemoveWindow(t,e);if(n&&n.bearingDelta&&i.setBearing(i.getBearing()+n.bearingDelta),this.mousePitch){const n=this.mousePitch.mousemoveWindow(t,e);n&&n.pitchDelta&&i.setPitch(i.getPitch()+n.pitchDelta)}}off(){const t=this.element;o.removeEventListener(t,"mousedown",this.mousedown),o.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(t,"touchmove",this.touchmove),o.removeEventListener(t,"touchend",this.touchend),o.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){o.enableDrag(),o.removeEventListener(window,"mousemove",this.mousemove),o.removeEventListener(window,"mouseup",this.mouseup)}mousedown(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),o.mousePos(this.element,e)),o.addEventListener(window,"mousemove",this.mousemove),o.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,o.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function rr(e,i,n){if(e=new t.LngLat(e.lng,e.lat),i){const r=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=n.locationPoint(e).distSqr(i);n.locationPoint(r).distSqr(i)<a?e=r:n.locationPoint(o).distSqr(i)<a&&(e=o)}for(;Math.abs(e.lng-n.center.lng)>180;){const t=n.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=n.width&&t.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}const or={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 ar(t,e,i){const n=t.classList;for(const t in or)n.remove(`maplibregl-${i}-anchor-${t}`,`mapboxgl-${i}-anchor-${t}`);n.add(`maplibregl-${i}-anchor-${e}`,`mapboxgl-${i}-anchor-${e}`)}class sr extends t.Evented{constructor(e,i){if(super(),(e instanceof HTMLElement||i)&&(e=t.extend({element:e},i)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.pointGeometry.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=o.create("div"),this._element.setAttribute("aria-label","Map marker");const i=o.createNS("http://www.w3.org/2000/svg","svg"),n=41,r=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",n+"px"),i.setAttributeNS(null,"width",r+"px"),i.setAttributeNS(null,"viewBox",`0 0 ${r} ${n}`);const a=o.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");const s=o.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");const l=o.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const u=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of u){const e=o.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const c=o.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);const h=o.createNS("http://www.w3.org/2000/svg","path");h.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(h);const p=o.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=o.createNS("http://www.w3.org/2000/svg","path");d.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"),p.appendChild(d);const f=o.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=o.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=o.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 _=o.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),s.appendChild(l),s.appendChild(c),s.appendChild(p),s.appendChild(f),s.appendChild(m),i.appendChild(s),i.setAttributeNS(null,"height",n*this._scale+"px"),i.setAttributeNS(null,"width",r*this._scale+"px"),this._element.appendChild(i),this._offset=t.pointGeometry.convert(e&&e.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),ar(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),o.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,n=Math.sqrt(Math.pow(i,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[n,-1*(e-i+n)],"bottom-right":[-n,-1*(e-i+n)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()}_onMapClick(t){const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=rr(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(e=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),o.setTransform(this._element,`${or[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${e}`)}getOffset(){return this._offset}setOffset(e){return this._offset=t.pointGeometry.convert(e),this._update(),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.Event("dragstart"))),this.fire(new t.Event("drag")))}_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.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const lr={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ur,cr=0,hr=!1;const pr={maxWidth:100,unit:"metric"};function dr(t,e,i){const n=i&&i.maxWidth||100,r=t._container.clientHeight/2,o=t.unproject([0,r]),a=t.unproject([n,r]),s=o.distanceTo(a);if(i&&"imperial"===i.unit){const i=3.2808*s;i>5280?fr(e,n,i/5280,t._getUIString("ScaleControl.Miles")):fr(e,n,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?fr(e,n,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?fr(e,n,s/1e3,t._getUIString("ScaleControl.Kilometers")):fr(e,n,s,t._getUIString("ScaleControl.Meters"))}function fr(t,e,i,n){const r=function(t){const e=Math.pow(10,(""+Math.floor(t)).length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(r/i)+"px",t.innerHTML=`${r}&nbsp;${n}`}const mr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},gr=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");const _r={supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:class extends Kn{constructor(e){var i;if(t.PerformanceUtils.mark(t.PerformanceMarkers.create),null!=(e=t.extend({},er,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Qi(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new Qn,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},tr,e.locale),this._clickTolerance=e.clickTolerance,this._pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:devicePixelRatio,this._requestManager=new a(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),"undefined"!=typeof window&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new $n(this,e),this._hash=e.hash&&new tn("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Jn({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new Yn,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",e=>{this._update("style"===e.dataType),this.fire(new t.Event(e.dataType+"data",e))}),this.on("dataloading",e=>{this.fire(new t.Event(e.dataType+"dataloading",e))}),this.on("dataabort",e=>{this.fire(new t.Event("sourcedataabort",e))})}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=e.onAdd(this);this._controls.push(e);const r=this._controlPositions[i];return-1!==i.indexOf("bottom")?r.insertBefore(n,r.firstChild):r.appendChild(n),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(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(t){return this._controls.indexOf(t)>-1}resize(e){const i=this._containerDimensions(),n=i[0],r=i[1];this._resizeCanvas(n,r,this.getPixelRatio()),this.transform.resize(n,r),this.painter.resize(n,r,this.getPixelRatio());const o=!this._moving;return o&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),o&&this.fire(new t.Event("moveend",e)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(t){const[e,i]=this._containerDimensions();this._pixelRatio=t,this._resizeCanvas(e,i,t),this.painter.resize(e,i,t)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(e){return this.transform.locationPoint(t.LngLat.convert(e))}unproject(e){return this.transform.pointLocation(t.pointGeometry.convert(e))}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let n=!1;const r=r=>{const o=this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[];o.length?n||(n=!0,i.call(this,new cn(t,this,r.originalEvent,{features:o}))):n=!1};return{layer:e,listener:i,delegates:{mousemove:r,mouseout:()=>{n=!1}}}}if("mouseleave"===t||"mouseout"===t){let n=!1;const r=r=>{(this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[]).length?n=!0:n&&(n=!1,i.call(this,new cn(t,this,r.originalEvent)))},o=e=>{n&&(n=!1,i.call(this,new cn(t,this,e.originalEvent)))};return{layer:e,listener:i,delegates:{mousemove:r,mouseout:o}}}{const n=t=>{const n=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,i.call(this,t),delete t.features)};return{layer:e,listener:i,delegates:{[t]:n}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const n=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(n);for(const t in n.delegates)this.on(t,n.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const n=this._createDelegatedListener(t,e,i);for(const t in n.delegates)this.once(t,n.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(n=>{const r=this._delegatedListeners[t];for(let t=0;t<r.length;t++){const n=r[t];if(n.layer===e&&n.listener===i){for(const t in n.delegates)this.off(t,n.delegates[t]);return r.splice(t,1),this}}})(),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let n;if(void 0!==i||void 0===e||e instanceof t.pointGeometry||Array.isArray(e)||(i=e,e=void 0),i=i||{},(e=e||[[0,0],[this.transform.width,this.transform.height]])instanceof t.pointGeometry||"number"==typeof e[0])n=[t.pointGeometry.convert(e)];else{const i=t.pointGeometry.convert(e[0]),r=t.pointGeometry.convert(e[1]);n=[i,new t.pointGeometry(r.x,i.y),r,new t.pointGeometry(i.x,r.y),i]}return this.style.queryRenderedFeatures(n,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(e,i){return!1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),t?(this.style=new ie(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t):this.style.loadJSON(t),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ie(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const n=this._requestManager.transformRequest(e,t.ResourceType.Style);t.getJSON(n,(e,n)=>{e?this.fire(new t.ErrorEvent(e)):n&&this._updateDiff(n,i)})}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e)&&this._update(!0)}catch(n){t.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)))}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i,{pixelRatio:n=1,sdf:r=!1,stretchX:o,stretchY:a,content:s}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||t.isImageBitmap(i)){const{width:l,height:u,data:c}=t.exported.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:l,height:u},c),pixelRatio:n,stretchX:o,stretchY:a,content:s,sdf:r,version:0})}else{if(void 0===i.width||void 0===i.height)return this.fire(new t.ErrorEvent(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:l,height:u,data:c}=i,h=i;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:u},new Uint8Array(c)),pixelRatio:n,stretchX:o,stretchY:a,content:s,sdf:r,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e)}}}updateImage(e,i){const n=this.style.getImage(e);if(!n)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=i instanceof HTMLImageElement||t.isImageBitmap(i)?t.exported.getImageData(i):i,{width:o,height:a,data:s}=r;if(void 0===o||void 0===a)return this.fire(new t.ErrorEvent(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!==n.data.width||a!==n.data.height)return this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(i instanceof HTMLImageElement||t.isImageBitmap(i));n.data.replace(s,l),this.style.updateImage(e,n)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(e,i){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),i)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,n={}){return this.style.setPaintProperty(t,e,i,n),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,n={}){return this.style.setLayoutProperty(t,e,i,n),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map","mapboxgl-map");const e=this._canvasContainer=o.create("div","maplibregl-canvas-container mapboxgl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const i=this._containerDimensions();this._resizeCanvas(i[0],i[1],this.getPixelRatio());const n=this._controlContainer=o.create("div","maplibregl-control-container mapboxgl-control-container",t),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(t=>{r[t]=o.create("div",`maplibregl-ctrl-${t} mapboxgl-ctrl-${t}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,e,i){this._canvas.width=i*t,this._canvas.height=i*e,this._canvas.style.width=t+"px",this._canvas.style.height=e+"px"}_setupPainter(){const i=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",i)||this._canvas.getContext("experimental-webgl",i);n?(this.painter=new Xi(n,this.transform),t.exported$1.testSupport(n)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))}_onMapScroll(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(e){let i,n=0;const r=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=r.createQueryEXT(),r.beginQueryEXT(r.TIME_ELAPSED_EXT,i),n=t.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=t.exported.now();this.style.zoomHistory.update(e,i);const n=new t.EvaluationParameters(e,{now:i,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=n.crossFadingFactor();1===r&&r===this._crossFadingFactor||(o=!0,this._crossFadingFactor=r),this.style.update(n)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.load),this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const e=t.exported.now()-n;r.endQueryEXT(r.TIME_ELAPSED_EXT,i),setTimeout(()=>{const n=r.getQueryObjectEXT(i,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(i),this.fire(new t.Event("gpu-timing-frame",{cpuTime:e,gpuTime:n}))},50)}if(this.listens("gpu-timing-layer")){const e=this.painter.collectGpuTimers();setTimeout(()=>{const i=this.painter.queryGpuTimers(e);this.fire(new t.Event("gpu-timing-layer",{layerTimes:i}))},50)}const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),o.remove(this._canvasContainer),o.remove(this._controlContainer),this._container.classList.remove("maplibregl-map","mapboxgl-map"),t.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new t.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.exported.frame(e=>{t.PerformanceUtils.frame(e),this._frame=null,this._render(e)}))}_onWindowOnline(){this._update()}_onWindowResize(t){this._trackResize&&this.resize({originalEvent:t})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}_setCacheLimits(e,i){t.setCacheLimits(e,i)}},NavigationControl:class{constructor(e){this.options=t.extend({},ir,e),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new nr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){o.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const i=o.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}_setButtonTitle(t,e){const i=this._map._getUIString("NavigationControl."+e);t.title=i,t.setAttribute("aria-label",i)}},GeolocateControl:class extends t.Evented{constructor(e){super(),this.options=t.extend({},lr,e),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(t){var e;return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),e=this._setupUI,void 0!==ur?e(ur):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then(t=>{ur="denied"!==t.state,e(ur)}):(ur=!!window.navigator.geolocation,e(ur)),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(),o.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,cr=0,hr=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background")}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","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}}_updateCamera(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,r=this._map.getBearing(),o=t.extend({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(n),o,{geolocateSource:!0})}_updateMarker(e){if(e){const i=new t.LngLat(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.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),i=this._map.unproject([1,t]),n=e.distanceTo(i),r=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=r+"px",this._circleElement.style.height=r+"px"}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&hr)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(e){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=o.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.warnOnce("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 t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new sr(this._dotElement),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new sr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return t.warnOnce("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.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":cr--,hr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),cr++,cr>1?(t={maximumAge:6e5,timeout:0},hr=!0):(t=this.options.positionOptions,hr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Jn,LogoControl:Yn,ScaleControl:class{constructor(e){this.options=t.extend({},pr,e),t.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){dr(this._map,this._container,this.options)}onAdd(t){return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){o.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(t){this.options.unit=t,dr(this._map,this._container,this.options)}},FullscreenControl:class{constructor(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"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=o.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){o.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const t=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends t.Evented{constructor(e){super(),this.options=t.extend(Object.create(mr),e),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&o.remove(this._content),this._container&&(o.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let n;for(i.innerHTML=t;n=i.firstChild,n;)e.appendChild(n);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(t){this._update(t.point)}_onMouseMove(t){this._update(t.point)}_onDrag(t){this._update(t.point)}_update(e){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=o.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=o.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(t=>this._container.classList.add(t)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=rr(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!e)return;const i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);let n=this.options.anchor;const r=function e(i){if(i){if("number"==typeof i){const e=Math.round(Math.sqrt(.5*Math.pow(i,2)));return{center:new t.pointGeometry(0,0),top:new t.pointGeometry(0,i),"top-left":new t.pointGeometry(e,e),"top-right":new t.pointGeometry(-e,e),bottom:new t.pointGeometry(0,-i),"bottom-left":new t.pointGeometry(e,-e),"bottom-right":new t.pointGeometry(-e,-e),left:new t.pointGeometry(i,0),right:new t.pointGeometry(-i,0)}}if(i instanceof t.pointGeometry||Array.isArray(i)){const e=t.pointGeometry.convert(i);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:t.pointGeometry.convert(i.center||[0,0]),top:t.pointGeometry.convert(i.top||[0,0]),"top-left":t.pointGeometry.convert(i["top-left"]||[0,0]),"top-right":t.pointGeometry.convert(i["top-right"]||[0,0]),bottom:t.pointGeometry.convert(i.bottom||[0,0]),"bottom-left":t.pointGeometry.convert(i["bottom-left"]||[0,0]),"bottom-right":t.pointGeometry.convert(i["bottom-right"]||[0,0]),left:t.pointGeometry.convert(i.left||[0,0]),right:t.pointGeometry.convert(i.right||[0,0])}}return e(new t.pointGeometry(0,0))}(this.options.offset);if(!n){const t=this._container.offsetWidth,e=this._container.offsetHeight;let o;o=i.y+r.bottom.y<e?["top"]:i.y>this._map.transform.height-e?["bottom"]:[],i.x<t/2?o.push("left"):i.x>this._map.transform.width-t/2&&o.push("right"),n=0===o.length?"bottom":o.join("-")}const a=i.add(r[n]).round();o.setTransform(this._container,`${or[n]} translate(${a.x}px,${a.y}px)`),ar(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(gr);t&&t.focus()}_onClose(){this.remove()}},Marker:sr,Style:ie,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.pointGeometry,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,AJAXError:t.AJAXError,config:t.config,CanvasSource:B,GeoJSONSource:M,ImageSource:z,RasterDEMTileSource:P,RasterTileSource:I,VectorTileSource:A,VideoSource:L,prewarm:function(){X().acquire(W)},clearPrewarmedResources:function(){const t=$;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(W),$=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()"))},get workerCount(){return Z.workerCount},set workerCount(t){Z.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage(e){t.clearTileCache(e)},workerUrl:"",addProtocol(e,i){t.config.REGISTERED_PROTOCOLS[e]=i},removeProtocol(e){delete t.config.REGISTERED_PROTOCOLS[e]}};return Xn.extend(_r,{isSafari:t.isSafari,getPerformanceMetrics:t.PerformanceUtils.getPerformanceMetrics}),_r})),i}()},function(t,e){var i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){var n=i(65),r=("string"==typeof n&&(n=[[t.i,n,""]]),{});r.transform=void 0,i(9)(n,r),n.locals&&(t.exports=n.locals)},function(t,e,i){var n=i(17);(t.exports=i(8)(!1)).push([t.i,".maplibregl-ctrl-floors.hide,\n.mapxus-floor-selector-layout.hide{\n display: none;\n}\n.mapxus-floor-selector-layout {\n -moz-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.5);\n -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.5);\n box-shadow: 0 1px 1px 0 rgba(0,0,0,0.5);\n width: 30px;\n visibility: visible;\n}\n.mapxus-floor-selector-outer {\n position: relative;\n width: 30px;\n z-index: 100;\n overflow: hidden;\n}\n.mapxus-floor-selector-inner {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: -20px;\n overflow-y: auto;\n overflow-x: hidden\n}\n.mapxus-floor-selector-inner > .floor {\n outline: none;\n font-family: Helvetica, Arial, sans-serif;\n cursor: pointer;\n width: 30px;\n border: 0;\n background: #fff;\n font-weight: bold;\n font-size: 12px;\n padding: inherit;\n height: 34px;\n overflow-x: auto;\n overflow-y: hidden\n}\n.mapxus-floor-selector-inner > .floor:not(:disabled):hover {\n background-color: rgba(0,0,0,.05) !important;\n}\n.mapxus-floor-selector-inner > .floor::-webkit-scrollbar {\n height: 4px;\n}\n.mapxus-floor-selector-inner > .floor::-webkit-scrollbar-track {\n background-color: white;\n -webkit-border-radius: 2em;\n -moz-border-radius: 2em;\n border-radius:2em;\n}\n.mapxus-floor-selector-inner > .floor::-webkit-scrollbar-thumb {\n background-color: rgb(83, 177, 207);\n -webkit-border-radius: 2em;\n -moz-border-radius: 2em;\n border-radius:2em;\n}\n.mapxus-floor-selector-up {\n margin-top: -4px;\n z-index: 102;\n position: absolute;\n width: 30px;\n height: 26px;\n cursor: pointer;\n background-size: 38px;\n background-position-x: center;\n background-repeat: no-repeat;\n background-image:url("+n(i(66))+");\n}\n.mapxus-floor-selector-up.hide {\n visibility: hidden;\n}\n.mapxus-floor-selector-down {\n z-index: 101;\n position: absolute;\n width: 30px;\n height: 26px;\n cursor: pointer;\n background-size: 38px;\n background-position-x: center;\n background-repeat: no-repeat;\n background-image:url("+n(i(67))+");\n}\n.mapxus-floor-selector-down.hide {\n visibility: hidden;\n}\n",""])},function(t,e){t.exports="\"data:image/svg+xml,%3C?xml version='1.0' encoding='utf-8'?%3E %3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='41.409260218957115' width='51.409260218957115'%3E %3Cdefs%3E %3Crect id='rect-0' opacity='1' x='4.704630109478558' y='4.704630109478558' width='42' height='32'/%3E %3ClinearGradient id='linearGradient-1' x1='0.5' y1='0' x2='0.5' y2='1'%3E %3Cstop offset='0' stop-color='rgb(255,255,255)' stop-opacity='0'/%3E %3Cstop offset='0.41' stop-color='rgb(255,255,255)' stop-opacity='0.8'/%3E %3Cstop offset='1' stop-color='rgb(200,200,200)' stop-opacity='1'/%3E %3C/linearGradient%3E %3Cpath id='path-2' opacity='1' fill-rule='evenodd' d='M18.02605868090714,23.704630109478558 L25.70463010947857,30.704630109478558 L33.38320153805,23.704630109478558 '/%3E %3C/defs%3E %3Cg transform='translate(25.704630109478558, 20.704630109478558) rotate(180.00006436155007) translate(-25.704630109478558, -20.704630109478558)' opacity='1'%3E %3Cg opacity='1'%3E %3Cuse xlink:href='%23rect-0' fill='url(%23linearGradient-1)'/%3E %3C/g%3E %3Cg opacity='1'%3E %3Cuse xlink:href='%23path-2' fill-opacity='0' stroke='rgb(187,187,189)' stroke-opacity='1' stroke-width='2'/%3E %3C/g%3E %3C/g%3E %3C/svg%3E\""},function(t,e){t.exports="\"data:image/svg+xml,%3C?xml version='1.0' encoding='utf-8'?%3E %3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='41.409260218957115' width='51.409260218957115'%3E %3Cdefs%3E %3Crect id='rect-0' opacity='1' x='4.704630109478558' y='4.704630109478558' width='42' height='32'/%3E %3ClinearGradient id='linearGradient-1' x1='0.5' y1='0' x2='0.5' y2='1'%3E %3Cstop offset='0' stop-color='rgb(255,255,255)' stop-opacity='0'/%3E %3Cstop offset='0.41' stop-color='rgb(255,255,255)' stop-opacity='0.8'/%3E %3Cstop offset='1' stop-color='rgb(200,200,200)' stop-opacity='1'/%3E %3C/linearGradient%3E %3Cpath id='path-2' opacity='1' fill-rule='evenodd' d='M18.02605868090714,23.704630109478558 L25.70463010947857,30.704630109478558 L33.38320153805,23.704630109478558 '/%3E %3C/defs%3E %3Cg opacity='1'%3E %3Cg opacity='1'%3E %3Cuse xlink:href='%23rect-0' fill='url(%23linearGradient-1)'/%3E %3C/g%3E %3Cg opacity='1'%3E %3Cuse xlink:href='%23path-2' fill-opacity='0' stroke='rgb(187,187,189)' stroke-opacity='1' stroke-width='2'/%3E %3C/g%3E %3C/g%3E %3C/svg%3E\""},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var i=e.protocol+"//"+e.host,n=i+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){return e=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e})),/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(e)?t:(t=0===e.indexOf("//")?e:0===e.indexOf("/")?i+e:n+e.replace(/^\.\//,""),"url("+JSON.stringify(t)+")")}))}},function(t,e,i){var n=i(70),r=("string"==typeof n&&(n=[[t.i,n,""]]),{});r.transform=void 0,i(9)(n,r),n.locals&&(t.exports=n.locals)},function(t,e,i){var n=i(17);(t.exports=i(8)(!1)).push([t.i,".maplibregl-ctrl-building-filter.hide {\n display: none;\n}\n.mapxus-building-filter-icon {\n width: 30px;\n height: 30px;\n background-image: url("+n(i(71))+");\n background-size: 30px;\n background-color: white;\n border-radius: 4px;\n -moz-box-shadow: 0 0 2px rgba(0,0,0,0.1);\n -webkit-box-shadow: 0 0 2px rgba(0,0,0,0.1);\n box-shadow: 0 0 0 2px rgba(0,0,0,0.1);\n cursor: pointer;\n}\n.mapxus-building-name-layout {\n width: 125px;\n right: 45px;\n margin-top: -30px;\n position: absolute;\n overflow: hidden;\n}\n.mapxus-building-name-list {\n width: 140px;\n position: absolute;\n overflow-y: auto;\n}\n.mapxus-building-name {\n width: 115px;\n color: white;\n background: red;\n border-radius: 3px;\n padding: 2px 4px;\n margin: 2px;\n cursor: pointer;\n word-wrap: break-word;\n}\n.mapxus-building-name.active {\n background: cornflowerblue;\n}\n.mapxus-building-name:hover {\n background: rgba(0,0,0,0.5);\n}\n",""])},function(t,e){t.exports="\"data:image/svg+xml,%3C?xml version='1.0' encoding='utf-8'?%3E %3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E %3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0' y='0' width='15' height='15' viewBox='0, 0, 15, 15'%3E %3Cg%3E %3Cpath d='M13.639 4H12V1.361A.361.361 0 0 0 11.639 1h-.278a.361.361 0 0 0-.361.361V4H9.361A.361.361 0 0 0 9 4.361V10H5.363a.363.363 0 0 0-.363.363v3.275a.363.363 0 0 0 .363.362h8.276a.361.361 0 0 0 .361-.361V4.361A.361.361 0 0 0 13.639 4zM7 12H6v-1h1zm2 0H8v-1h1zm2 0h-1v-1h1zm0-2h-1V9h1zm0-2h-1V7h1zm0-2h-1V5h1zm2 6h-1v-1h1zm0-2h-1V9h1zm0-2h-1V7h1zm0-2h-1V5h1zM8 1.361A.361.361 0 0 0 7.639 1H5.361A.361.361 0 0 0 5 1.361V3H3.361A.361.361 0 0 0 3 3.361V4H1.361A.361.361 0 0 0 1 4.361v9.278a.361.361 0 0 0 .361.361H4V9h4zM3 12H2v-1h1zm0-2H2V9h1zm0-2H2V7h1zm0-2H2V5h1zm2 2H4V7h1zm0-2H4V5h1zm2 2H6V7h1zm0-2H6V5h1zm0-2H6V3h1z'%3E%3C/path%3E %3C/g%3E %3C/svg%3E\""},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.outdoorConfig=void 0;var n=i(29);e.outdoorConfig=function(){return{url:n.mapxusTheme_v2}}},function(t,e,i){!function(e,i){"use strict";"function"==typeof window.define&&window.define.amd?window.define(i):t.exports?t.exports=i():e.exports?e.exports=i():e.Fingerprint2=i()}(this,(function(){"use strict";function t(e){if(!(this instanceof t))return new t(e);this.options=this.extend(e,{swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",detectScreenOrientation:!0,sortPluginsFor:[/palemoon/i],userDefinedFonts:[],excludeDoNotTrack:!0,excludePixelRatio:!0}),this.nativeForEach=Array.prototype.forEach,this.nativeMap=Array.prototype.map}return t.prototype={extend:function(t,e){if(null==t)return e;for(var i in t)null!=t[i]&&e[i]!==t[i]&&(e[i]=t[i]);return e},get:function(t){var e=this,i={data:[],addPreprocessedComponent:function(t){var n=t.value;"function"==typeof e.options.preprocessor&&(n=e.options.preprocessor(t.key,n)),i.data.push({key:t.key,value:n})}};i=this.userAgentKey(i);i=this.languageKey(i),i=this.colorDepthKey(i),i=this.deviceMemoryKey(i),i=this.pixelRatioKey(i),i=this.hardwareConcurrencyKey(i),i=this.screenResolutionKey(i),i=this.availableScreenResolutionKey(i),i=this.timezoneOffsetKey(i),i=this.sessionStorageKey(i),i=this.localStorageKey(i),i=this.indexedDbKey(i),i=this.addBehaviorKey(i),i=this.openDatabaseKey(i),i=this.cpuClassKey(i),i=this.platformKey(i),i=this.doNotTrackKey(i),i=this.pluginsKey(i),i=this.canvasKey(i),i=this.webglKey(i),i=this.webglVendorAndRendererKey(i),i=this.adBlockKey(i),i=this.hasLiedLanguagesKey(i),i=this.hasLiedResolutionKey(i),i=this.hasLiedOsKey(i),i=this.hasLiedBrowserKey(i),i=this.touchSupportKey(i),i=this.customEntropyFunction(i),this.fontsKey(i,(function(i){e.audioKey(i,(function(i){var n=[],r=(e.each(i.data,(function(t){(t=t.value)&&"function"==typeof t.join?n.push(t.join(";")):n.push(t)})),e.x64hash128(n.join("~~~"),31));return t(r,i.data)}))}))},audioKey:function(t,e){if(this.options.excludeAudioFP)return e(t);var i=window.OfflineAudioContext||window.webkitOfflineAudioContext;if(null==i)return t.addPreprocessedComponent({key:"audio_fp",value:null}),e(t);var n=new i(1,44100,44100),r=n.createOscillator(),o=(r.type="triangle",r.frequency.setValueAtTime(1e4,n.currentTime),n.createDynamicsCompressor());this.each([["threshold",-50],["knee",40],["ratio",12],["reduction",-20],["attack",0],["release",.25]],(function(t){void 0!==o[t[0]]&&"function"==typeof o[t[0]].setValueAtTime&&o[t[0]].setValueAtTime(t[1],n.currentTime)})),n.oncomplete=function(i){return i=i.renderedBuffer.getChannelData(0).slice(4500,5e3).reduce((function(t,e){return t+Math.abs(e)}),0).toString(),r.disconnect(),o.disconnect(),t.addPreprocessedComponent({key:"audio_fp",value:i}),e(t)},r.connect(o),o.connect(n.destination),r.start(0),n.startRendering()},customEntropyFunction:function(t){return"function"==typeof this.options.customFunction&&t.addPreprocessedComponent({key:"custom",value:this.options.customFunction()}),t},userAgentKey:function(t){return this.options.excludeUserAgent||t.addPreprocessedComponent({key:"user_agent",value:this.getUserAgent()}),t},getUserAgent:function(){return navigator.userAgent},languageKey:function(t){return this.options.excludeLanguage||t.addPreprocessedComponent({key:"language",value:navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage||""}),t},colorDepthKey:function(t){return this.options.excludeColorDepth||t.addPreprocessedComponent({key:"color_depth",value:window.screen.colorDepth||-1}),t},deviceMemoryKey:function(t){return this.options.excludeDeviceMemory||t.addPreprocessedComponent({key:"device_memory",value:this.getDeviceMemory()}),t},getDeviceMemory:function(){return navigator.deviceMemory||-1},pixelRatioKey:function(t){return this.options.excludePixelRatio||t.addPreprocessedComponent({key:"pixel_ratio",value:this.getPixelRatio()}),t},getPixelRatio:function(){return window.devicePixelRatio||""},screenResolutionKey:function(t){return this.options.excludeScreenResolution?t:this.getScreenResolution(t)},getScreenResolution:function(t){var e=this.options.detectScreenOrientation&&window.screen.height>window.screen.width?[window.screen.height,window.screen.width]:[window.screen.width,window.screen.height];return t.addPreprocessedComponent({key:"resolution",value:e}),t},availableScreenResolutionKey:function(t){return this.options.excludeAvailableScreenResolution?t:this.getAvailableScreenResolution(t)},getAvailableScreenResolution:function(t){var e;return void 0!==(e=window.screen.availWidth&&window.screen.availHeight?!this.options.detectScreenOrientation||window.screen.availHeight>window.screen.availWidth?[window.screen.availHeight,window.screen.availWidth]:[window.screen.availWidth,window.screen.availHeight]:e)&&t.addPreprocessedComponent({key:"available_resolution",value:e}),t},timezoneOffsetKey:function(t){return this.options.excludeTimezoneOffset||t.addPreprocessedComponent({key:"timezone_offset",value:(new Date).getTimezoneOffset()}),t},sessionStorageKey:function(t){return!this.options.excludeSessionStorage&&this.hasSessionStorage()&&t.addPreprocessedComponent({key:"session_storage",value:1}),t},localStorageKey:function(t){return!this.options.excludeSessionStorage&&this.hasLocalStorage()&&t.addPreprocessedComponent({key:"local_storage",value:1}),t},indexedDbKey:function(t){return!this.options.excludeIndexedDB&&this.hasIndexedDB()&&t.addPreprocessedComponent({key:"indexed_db",value:1}),t},addBehaviorKey:function(t){return!this.options.excludeAddBehavior&&document.body&&document.body.addBehavior&&t.addPreprocessedComponent({key:"add_behavior",value:1}),t},openDatabaseKey:function(t){return!this.options.excludeOpenDatabase&&window.openDatabase&&t.addPreprocessedComponent({key:"open_database",value:1}),t},cpuClassKey:function(t){return this.options.excludeCpuClass||t.addPreprocessedComponent({key:"cpu_class",value:this.getNavigatorCpuClass()}),t},platformKey:function(t){return this.options.excludePlatform||t.addPreprocessedComponent({key:"navigator_platform",value:this.getNavigatorPlatform()}),t},doNotTrackKey:function(t){return this.options.excludeDoNotTrack||t.addPreprocessedComponent({key:"do_not_track",value:this.getDoNotTrack()}),t},canvasKey:function(t){return!this.options.excludeCanvas&&this.isCanvasSupported()&&t.addPreprocessedComponent({key:"canvas",value:this.getCanvasFp()}),t},webglKey:function(t){return!this.options.excludeWebGL&&this.isWebGlSupported()&&t.addPreprocessedComponent({key:"webgl",value:this.getWebglFp()}),t},webglVendorAndRendererKey:function(t){return!this.options.excludeWebGLVendorAndRenderer&&this.isWebGlSupported()&&t.addPreprocessedComponent({key:"webgl_vendor",value:this.getWebglVendorAndRenderer()}),t},adBlockKey:function(t){return this.options.excludeAdBlock||t.addPreprocessedComponent({key:"adblock",value:this.getAdBlock()}),t},hasLiedLanguagesKey:function(t){return this.options.excludeHasLiedLanguages||t.addPreprocessedComponent({key:"has_lied_languages",value:this.getHasLiedLanguages()}),t},hasLiedResolutionKey:function(t){return this.options.excludeHasLiedResolution||t.addPreprocessedComponent({key:"has_lied_resolution",value:this.getHasLiedResolution()}),t},hasLiedOsKey:function(t){return this.options.excludeHasLiedOs||t.addPreprocessedComponent({key:"has_lied_os",value:this.getHasLiedOs()}),t},hasLiedBrowserKey:function(t){return this.options.excludeHasLiedBrowser||t.addPreprocessedComponent({key:"has_lied_browser",value:this.getHasLiedBrowser()}),t},fontsKey:function(t,e){return this.options.excludeJsFonts?this.flashFontsKey(t,e):this.jsFontsKey(t,e)},flashFontsKey:function(t,e){return!this.options.excludeFlashFonts&&this.hasSwfObjectLoaded()&&this.hasMinFlashInstalled()&&void 0!==this.options.swfPath?void this.loadSwfAndDetectFonts((function(i){t.addPreprocessedComponent({key:"swf_fonts",value:i.join(";")}),e(t)})):e(t)},jsFontsKey:function(t,e){var i=this;return setTimeout((function(){function n(){var t=document.createElement("span");return t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="72px",t.style.fontStyle="normal",t.style.fontWeight="normal",t.style.letterSpacing="normal",t.style.lineBreak="auto",t.style.lineHeight="normal",t.style.textTransform="none",t.style.textAlign="left",t.style.textDecoration="none",t.style.textShadow="none",t.style.whiteSpace="normal",t.style.wordBreak="normal",t.style.wordSpacing="normal",t.innerHTML="mmmmmmmmmmlli",t}var r=["monospace","sans-serif","serif"],o=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"],a=(o=(o=(o=i.options.extendedJsFonts?o.concat(["Abadi MT Condensed Light","Academy Engraved LET","ADOBE CASLON PRO","Adobe Garamond","ADOBE GARAMOND PRO","Agency FB","Aharoni","Albertus Extra Bold","Albertus Medium","Algerian","Amazone BT","American Typewriter","American Typewriter Condensed","AmerType Md BT","Andalus","Angsana New","AngsanaUPC","Antique Olive","Aparajita","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arabic Typesetting","ARCHER","ARNO PRO","Arrus BT","Aurora Cn BT","AvantGarde Bk BT","AvantGarde Md BT","AVENIR","Ayuthaya","Bandy","Bangla Sangam MN","Bank Gothic","BankGothic Md BT","Baskerville","Baskerville Old Face","Batang","BatangChe","Bauer Bodoni","Bauhaus 93","Bazooka","Bell MT","Bembo","Benguiat Bk BT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BernhardFashion BT","BernhardMod BT","Big Caslon","BinnerD","Blackadder ITC","BlairMdITC TT","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bodoni MT","Bodoni MT Black","Bodoni MT Condensed","Bodoni MT Poster Compressed","Bookshelf Symbol 7","Boulder","Bradley Hand","Bradley Hand ITC","Bremen Bd BT","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script MT","Californian FB","Calisto MT","Calligrapher","Candara","CaslonOpnface BT","Castellar","Centaur","Cezanne","CG Omega","CG Times","Chalkboard","Chalkboard SE","Chalkduster","Charlesworth","Charter Bd BT","Charter BT","Chaucer","ChelthmITC Bk BT","Chiller","Clarendon","Clarendon Condensed","CloisterBlack BT","Cochin","Colonna MT","Constantia","Cooper Black","Copperplate","Copperplate Gothic","Copperplate Gothic Bold","Copperplate Gothic Light","CopperplGoth Bd BT","Corbel","Cordia New","CordiaUPC","Cornerstone","Coronet","Cuckoo","Curlz MT","DaunPenh","Dauphin","David","DB LCD Temp","DELICIOUS","Denmark","DFKai-SB","Didot","DilleniaUPC","DIN","DokChampa","Dotum","DotumChe","Ebrima","Edwardian Script ITC","Elephant","English 111 Vivace BT","Engravers MT","EngraversGothic BT","Eras Bold ITC","Eras Demi ITC","Eras Light ITC","Eras Medium ITC","EucrosiaUPC","Euphemia","Euphemia UCAS","EUROSTILE","Exotc350 Bd BT","FangSong","Felix Titling","Fixedsys","FONTIN","Footlight MT Light","Forte","FrankRuehl","Fransiscan","Freefrm721 Blk BT","FreesiaUPC","Freestyle Script","French Script MT","FrnkGothITC Bk BT","Fruitger","FRUTIGER","Futura","Futura Bk BT","Futura Lt BT","Futura Md BT","Futura ZBlk BT","FuturaBlack BT","Gabriola","Galliard BT","Gautami","Geeza Pro","Geometr231 BT","Geometr231 Hv BT","Geometr231 Lt BT","GeoSlab 703 Lt BT","GeoSlab 703 XBd BT","Gigi","Gill Sans","Gill Sans MT","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Gloucester MT Extra Condensed","GOTHAM","GOTHAM BOLD","Goudy Old Style","Goudy Stout","GoudyHandtooled BT","GoudyOLSt BT","Gujarati Sangam MN","Gulim","GulimChe","Gungsuh","GungsuhChe","Gurmukhi MN","Haettenschweiler","Harlow Solid Italic","Harrington","Heather","Heiti SC","Heiti TC","HELV","Herald","High Tower Text","Hiragino Kaku Gothic ProN","Hiragino Mincho ProN","Hoefler Text","Humanst 521 Cn BT","Humanst521 BT","Humanst521 Lt BT","Imprint MT Shadow","Incised901 Bd BT","Incised901 BT","Incised901 Lt BT","INCONSOLATA","Informal Roman","Informal011 BT","INTERSTATE","IrisUPC","Iskoola Pota","JasmineUPC","Jazz LET","Jenson","Jester","Jokerman","Juice ITC","Kabel Bk BT","Kabel Ult BT","Kailasa","KaiTi","Kalinga","Kannada Sangam MN","Kartika","Kaufmann Bd BT","Kaufmann BT","Khmer UI","KodchiangUPC","Kokila","Korinna BT","Kristen ITC","Krungthep","Kunstler Script","Lao UI","Latha","Leelawadee","Letter Gothic","Levenim MT","LilyUPC","Lithograph","Lithograph Light","Long Island","Lydian BT","Magneto","Maiandra GD","Malayalam Sangam MN","Malgun Gothic","Mangal","Marigold","Marion","Marker Felt","Market","Marlett","Matisse ITC","Matura MT Script Capitals","Meiryo","Meiryo UI","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","MingLiU-ExtB","Minion","Minion Pro","Miriam","Miriam Fixed","Mistral","Modern","Modern No. 20","Mona Lisa Solid ITC TT","Mongolian Baiti","MONO","MoolBoran","Mrs Eaves","MS LineDraw","MS Mincho","MS PMincho","MS Reference Specialty","MS UI Gothic","MT Extra","MUSEO","MV Boli","Nadeem","Narkisim","NEVIS","News Gothic","News GothicMT","NewsGoth BT","Niagara Engraved","Niagara Solid","Noteworthy","NSimSun","Nyala","OCR A Extended","Old Century","Old English Text MT","Onyx","Onyx BT","OPTIMA","Oriya Sangam MN","OSAKA","OzHandicraft BT","Palace Script MT","Papyrus","Parchment","Party LET","Pegasus","Perpetua","Perpetua Titling MT","PetitaBold","Pickwick","Plantagenet Cherokee","Playbill","PMingLiU","PMingLiU-ExtB","Poor Richard","Poster","PosterBodoni BT","PRINCETOWN LET","Pristina","PTBarnum BT","Pythagoras","Raavi","Rage Italic","Ravie","Ribbon131 Bd BT","Rockwell","Rockwell Condensed","Rockwell Extra Bold","Rod","Roman","Sakkal Majalla","Santa Fe LET","Savoye LET","Sceptre","Script","Script MT Bold","SCRIPTINA","Serifa","Serifa BT","Serifa Th BT","ShelleyVolante BT","Sherwood","Shonar Bangla","Showcard Gothic","Shruti","Signboard","SILKSCREEN","SimHei","Simplified Arabic","Simplified Arabic Fixed","SimSun","SimSun-ExtB","Sinhala Sangam MN","Sketch Rockwell","Skia","Small Fonts","Snap ITC","Snell Roundhand","Socket","Souvenir Lt BT","Staccato222 BT","Steamer","Stencil","Storybook","Styllo","Subway","Swis721 BlkEx BT","Swiss911 XCm BT","Sylfaen","Synchro LET","System","Tamil Sangam MN","Technical","Teletype","Telugu Sangam MN","Tempus Sans ITC","Terminal","Thonburi","Traditional Arabic","Trajan","TRAJAN PRO","Tristan","Tubular","Tunga","Tw Cen MT","Tw Cen MT Condensed","Tw Cen MT Condensed Extra Bold","TypoUpright BT","Unicorn","Univers","Univers CE 55 Medium","Univers Condensed","Utsaah","Vagabond","Vani","Vijaya","Viner Hand ITC","VisualUI","Vivaldi","Vladimir Script","Vrinda","Westminster","WHITNEY","Wide Latin","ZapfEllipt BT","ZapfHumnst BT","ZapfHumnst Dm BT","Zapfino","Zurich BlkEx BT","Zurich Ex BT","ZWAdobeF"]):o).concat(i.options.userDefinedFonts)).filter((function(t,e){return o.indexOf(t)===e})),document.getElementsByTagName("body")[0]),s=document.createElement("div"),l=document.createElement("div"),u={},c={},h=function(){for(var t=[],e=0,i=r.length;e<i;e++){var o=n();o.style.fontFamily=r[e],s.appendChild(o),t.push(o)}return t}();a.appendChild(s);for(var p=0,d=r.length;p<d;p++)u[r[p]]=h[p].offsetWidth,c[r[p]]=h[p].offsetHeight;var f=function(){for(var t,e,i={},a=0,s=o.length;a<s;a++){for(var u=[],c=0,h=r.length;c<h;c++){p=o[a],t=r[c],e=void 0,(e=n()).style.fontFamily="'"+p+"',"+t;var p=e;l.appendChild(p),u.push(p)}i[o[a]]=u}return i}();a.appendChild(l);for(var m=[],g=0,_=o.length;g<_;g++)!function(t){for(var e=!1,i=0;i<r.length;i++)if(e=t[i].offsetWidth!==u[r[i]]||t[i].offsetHeight!==c[r[i]])return e;return e}(f[o[g]])||m.push(o[g]);a.removeChild(l),a.removeChild(s),t.addPreprocessedComponent({key:"js_fonts",value:m}),e(t)}),1)},pluginsKey:function(t){return this.options.excludePlugins||(this.isIE()?this.options.excludeIEPlugins||t.addPreprocessedComponent({key:"ie_plugins",value:this.getIEPlugins()}):t.addPreprocessedComponent({key:"regular_plugins",value:this.getRegularPlugins()})),t},getRegularPlugins:function(){var t=[];if(navigator.plugins)for(var e=0,i=navigator.plugins.length;e<i;e++)navigator.plugins[e]&&t.push(navigator.plugins[e]);return this.pluginsShouldBeSorted()&&(t=t.sort((function(t,e){return t.name>e.name?1:t.name<e.name?-1:0}))),this.map(t,(function(t){var e=this.map(t,(function(t){return[t.type,t.suffixes].join("~")})).join(",");return[t.name,t.description,e].join("::")}),this)},getIEPlugins:function(){var t=[];return(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,"ActiveXObject")||"ActiveXObject"in window)&&(t=this.map(["AcroPDF.PDF","Adodb.Stream","AgControl.AgControl","DevalVRXCtrl.DevalVRXCtrl.1","MacromediaFlashPaper.MacromediaFlashPaper","Msxml2.DOMDocument","Msxml2.XMLHTTP","PDF.PdfCtrl","QuickTime.QuickTime","QuickTimeCheckObject.QuickTimeCheck.1","RealPlayer","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","Scripting.Dictionary","SWCtl.SWCtl","Shell.UIHelper","ShockwaveFlash.ShockwaveFlash","Skype.Detection","TDCCtl.TDCCtl","WMPlayer.OCX","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1"],(function(t){try{return new window.ActiveXObject(t),t}catch(t){return null}}))),navigator.plugins?t.concat(this.getRegularPlugins()):t},pluginsShouldBeSorted:function(){for(var t=!1,e=0,i=this.options.sortPluginsFor.length;e<i;e++){var n=this.options.sortPluginsFor[e];if(navigator.userAgent.match(n)){t=!0;break}}return t},touchSupportKey:function(t){return this.options.excludeTouchSupport||t.addPreprocessedComponent({key:"touch_support",value:this.getTouchSupport()}),t},hardwareConcurrencyKey:function(t){return this.options.excludeHardwareConcurrency||t.addPreprocessedComponent({key:"hardware_concurrency",value:this.getHardwareConcurrency()}),t},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(t){return!0}},hasLocalStorage:function(){try{return!!window.localStorage}catch(t){return!0}},hasIndexedDB:function(){try{return!!window.indexedDB}catch(t){return!0}},getHardwareConcurrency:function(){return navigator.hardwareConcurrency||"unknown"},getNavigatorCpuClass:function(){return navigator.cpuClass||"unknown"},getNavigatorPlatform:function(){return navigator.platform||"unknown"},getDoNotTrack:function(){return navigator.doNotTrack||navigator.msDoNotTrack||window.doNotTrack||"unknown"},getTouchSupport:function(){var t=0,e=!1;void 0!==navigator.maxTouchPoints?t=navigator.maxTouchPoints:void 0!==navigator.msMaxTouchPoints&&(t=navigator.msMaxTouchPoints);try{document.createEvent("TouchEvent"),e=!0}catch(t){}return[t,e,"ontouchstart"in window]},getCanvasFp:function(){var t=[],e=document.createElement("canvas"),i=(e.width=2e3,e.height=200,e.style.display="inline",e.getContext("2d"));return i.rect(0,0,10,10),i.rect(2,2,6,6),t.push("canvas winding:"+(!1===i.isPointInPath(5,5,"evenodd")?"yes":"no")),i.textBaseline="alphabetic",i.fillStyle="#f60",i.fillRect(125,1,62,20),i.fillStyle="#069",this.options.dontUseFakeFontInCanvas?i.font="11pt Arial":i.font="11pt no-real-font-123",i.fillText("Cwm fjordbank glyphs vext quiz, 😃",2,15),i.fillStyle="rgba(102, 204, 0, 0.2)",i.font="18pt Arial",i.fillText("Cwm fjordbank glyphs vext quiz, 😃",4,45),i.globalCompositeOperation="multiply",i.fillStyle="rgb(255,0,255)",i.beginPath(),i.arc(50,50,50,0,2*Math.PI,!0),i.closePath(),i.fill(),i.fillStyle="rgb(0,255,255)",i.beginPath(),i.arc(100,50,50,0,2*Math.PI,!0),i.closePath(),i.fill(),i.fillStyle="rgb(255,255,0)",i.beginPath(),i.arc(75,100,50,0,2*Math.PI,!0),i.closePath(),i.fill(),i.fillStyle="rgb(255,0,255)",i.arc(75,75,75,0,2*Math.PI,!0),i.arc(75,75,25,0,2*Math.PI,!0),i.fill("evenodd"),e.toDataURL&&t.push("canvas fp:"+e.toDataURL()),t.join("~")},getWebglFp:function(){function t(t){return e.clearColor(0,0,0,1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),"["+t[0]+", "+t[1]+"]"}var e;if(!(e=this.getWebglCanvas()))return null;var i=[],n=e.createBuffer(),r=(e.bindBuffer(e.ARRAY_BUFFER,n),new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0])),o=(r=(e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW),n.itemSize=3,n.numItems=3,e.createProgram()),e.createShader(e.VERTEX_SHADER)),a=(e.shaderSource(o,"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}"),e.compileShader(o),e.createShader(e.FRAGMENT_SHADER));e.shaderSource(a,"precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}"),e.compileShader(a),e.attachShader(r,o),e.attachShader(r,a),e.linkProgram(r),e.useProgram(r),r.vertexPosAttrib=e.getAttribLocation(r,"attrVertex"),r.offsetUniform=e.getUniformLocation(r,"uniformOffset"),e.enableVertexAttribArray(r.vertexPosArray),e.vertexAttribPointer(r.vertexPosAttrib,n.itemSize,e.FLOAT,!1,0,0),e.uniform2f(r.offsetUniform,1,1),e.drawArrays(e.TRIANGLE_STRIP,0,n.numItems);try{i.push(e.canvas.toDataURL())}catch(t){}i.push("extensions:"+(e.getSupportedExtensions()||[]).join(";")),i.push("webgl aliased line width range:"+t(e.getParameter(e.ALIASED_LINE_WIDTH_RANGE))),i.push("webgl aliased point size range:"+t(e.getParameter(e.ALIASED_POINT_SIZE_RANGE))),i.push("webgl alpha bits:"+e.getParameter(e.ALPHA_BITS)),i.push("webgl antialiasing:"+(e.getContextAttributes().antialias?"yes":"no")),i.push("webgl blue bits:"+e.getParameter(e.BLUE_BITS)),i.push("webgl depth bits:"+e.getParameter(e.DEPTH_BITS)),i.push("webgl green bits:"+e.getParameter(e.GREEN_BITS)),i.push("webgl max anisotropy:"+((a=(o=e).getExtension("EXT_texture_filter_anisotropic")||o.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||o.getExtension("MOZ_EXT_texture_filter_anisotropic"))?0===(o=o.getParameter(a.MAX_TEXTURE_MAX_ANISOTROPY_EXT))?2:o:null)),i.push("webgl max combined texture image units:"+e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),i.push("webgl max cube map texture size:"+e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE)),i.push("webgl max fragment uniform vectors:"+e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)),i.push("webgl max render buffer size:"+e.getParameter(e.MAX_RENDERBUFFER_SIZE)),i.push("webgl max texture image units:"+e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)),i.push("webgl max texture size:"+e.getParameter(e.MAX_TEXTURE_SIZE)),i.push("webgl max varying vectors:"+e.getParameter(e.MAX_VARYING_VECTORS)),i.push("webgl max vertex attribs:"+e.getParameter(e.MAX_VERTEX_ATTRIBS)),i.push("webgl max vertex texture image units:"+e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),i.push("webgl max vertex uniform vectors:"+e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS)),i.push("webgl max viewport dims:"+t(e.getParameter(e.MAX_VIEWPORT_DIMS))),i.push("webgl red bits:"+e.getParameter(e.RED_BITS)),i.push("webgl renderer:"+e.getParameter(e.RENDERER)),i.push("webgl shading language version:"+e.getParameter(e.SHADING_LANGUAGE_VERSION)),i.push("webgl stencil bits:"+e.getParameter(e.STENCIL_BITS)),i.push("webgl vendor:"+e.getParameter(e.VENDOR)),i.push("webgl version:"+e.getParameter(e.VERSION));try{var s=e.getExtension("WEBGL_debug_renderer_info");s&&(i.push("webgl unmasked vendor:"+e.getParameter(s.UNMASKED_VENDOR_WEBGL)),i.push("webgl unmasked renderer:"+e.getParameter(s.UNMASKED_RENDERER_WEBGL)))}catch(t){}if(!e.getShaderPrecisionFormat)return i.join("~");var l=this;return l.each(["FLOAT","INT"],(function(t){l.each(["VERTEX","FRAGMENT"],(function(n){l.each(["HIGH","MEDIUM","LOW"],(function(r){l.each(["precision","rangeMin","rangeMax"],(function(o){var a=e.getShaderPrecisionFormat(e[n+"_SHADER"],e[r+"_"+t])[o];"precision"!==o&&(o="precision "+o),o=["webgl ",n.toLowerCase()," shader ",r.toLowerCase()," ",t.toLowerCase()," ",o,":",a];i.push(o.join(""))}))}))}))})),i.join("~")},getWebglVendorAndRenderer:function(){try{var t=this.getWebglCanvas(),e=t.getExtension("WEBGL_debug_renderer_info");return t.getParameter(e.UNMASKED_VENDOR_WEBGL)+"~"+t.getParameter(e.UNMASKED_RENDERER_WEBGL)}catch(t){return null}},getAdBlock:function(){var t=document.createElement("div"),e=(t.innerHTML="&nbsp;",!(t.className="adsbox"));try{document.body.appendChild(t),e=0===document.getElementsByClassName("adsbox")[0].offsetHeight,document.body.removeChild(t)}catch(t){e=!1}return e},getHasLiedLanguages:function(){if(void 0!==navigator.languages)try{if(navigator.languages[0].substr(0,2)!==navigator.language.substr(0,2))return!0}catch(t){return!0}return!1},getHasLiedResolution:function(){return window.screen.width<window.screen.availWidth||window.screen.height<window.screen.availHeight},getHasLiedOs:function(){var t=navigator.userAgent.toLowerCase(),e=navigator.oscpu,i=navigator.platform.toLowerCase();t=0<=t.indexOf("windows phone")?"Windows Phone":0<=t.indexOf("win")?"Windows":0<=t.indexOf("android")?"Android":0<=t.indexOf("linux")?"Linux":0<=t.indexOf("iphone")||0<=t.indexOf("ipad")?"iOS":0<=t.indexOf("mac")?"Mac":"Other";if(("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints)&&"Windows Phone"!=t&&"Android"!=t&&"iOS"!=t&&"Other"!=t)return!0;if(void 0!==e){if(0<=(e=e.toLowerCase()).indexOf("win")&&"Windows"!=t&&"Windows Phone"!=t)return!0;if(0<=e.indexOf("linux")&&"Linux"!=t&&"Android"!=t)return!0;if(0<=e.indexOf("mac")&&"Mac"!=t&&"iOS"!=t)return!0;if((-1===e.indexOf("win")&&-1===e.indexOf("linux")&&-1===e.indexOf("mac"))!=("Other"==t))return!0}return 0<=i.indexOf("win")&&"Windows"!=t&&"Windows Phone"!=t||(0<=i.indexOf("linux")||0<=i.indexOf("android")||0<=i.indexOf("pike"))&&"Linux"!=t&&"Android"!=t||(0<=i.indexOf("mac")||0<=i.indexOf("ipad")||0<=i.indexOf("ipod")||0<=i.indexOf("iphone"))&&"Mac"!=t&&"iOS"!=t||(-1===i.indexOf("win")&&-1===i.indexOf("linux")&&-1===i.indexOf("mac"))!=("Other"==t)||void 0===navigator.plugins&&"Windows"!=t&&"Windows Phone"!=t},getHasLiedBrowser:function(){var t,e,i=navigator.userAgent.toLowerCase(),n=navigator.productSub;if(("Chrome"==(t=0<=i.indexOf("firefox")?"Firefox":0<=i.indexOf("opera")||0<=i.indexOf("opr")?"Opera":0<=i.indexOf("chrome")?"Chrome":0<=i.indexOf("safari")?"Safari":0<=i.indexOf("trident")?"Internet Explorer":"Other")||"Safari"==t||"Opera"==t)&&"20030107"!==n)return!0;if(37===(i=eval.toString().length)&&"Safari"!=t&&"Firefox"!=t&&"Other"!=t)return!0;if(39===i&&"Internet Explorer"!=t&&"Other"!=t)return!0;if(33===i&&"Chrome"!=t&&"Opera"!=t&&"Other"!=t)return!0;try{throw"a"}catch(t){try{t.toSource(),e=!0}catch(t){e=!1}}return!(!e||"Firefox"==t||"Other"==t)},isCanvasSupported:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},isWebGlSupported:function(){if(!this.isCanvasSupported())return!1;var t=this.getWebglCanvas();return!!window.WebGLRenderingContext&&!!t},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},hasSwfObjectLoaded:function(){return void 0!==window.swfobject},hasMinFlashInstalled:function(){return window.swfobject.hasFlashPlayerVersion("9.0.0")},addFlashDivNode:function(){var t=document.createElement("div");t.setAttribute("id",this.options.swfContainerId),document.body.appendChild(t)},loadSwfAndDetectFonts:function(t){var e="___fp_swf_loaded",i=(window[e]=function(e){t(e)},this.options.swfContainerId);this.addFlashDivNode(),e={onReady:e};window.swfobject.embedSWF(this.options.swfPath,i,"1","1","9.0.0",!1,e,{allowScriptAccess:"always",menu:"false"},{})},getWebglCanvas:function(){var t=document.createElement("canvas"),e=null;try{e=t.getContext("webgl")||t.getContext("experimental-webgl")}catch(t){}return e||null},each:function(t,e,i){if(null!==t)if(this.nativeForEach&&t.forEach===this.nativeForEach)t.forEach(e,i);else if(t.length===+t.length){for(var n=0,r=t.length;n<r;n++)if(e.call(i,t[n],n,t)==={})return}else for(var o in t)if(t.hasOwnProperty(o)&&e.call(i,t[o],o,t)==={})return},map:function(t,e,i){var n=[];return null==t?n:this.nativeMap&&t.map===this.nativeMap?t.map(e,i):(this.each(t,(function(t,r,o){n[n.length]=e.call(i,t,r,o)})),n)},x64Add:function(t,e){t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]],e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]];var i=[0,0,0,0];return i[3]+=t[3]+e[3],i[2]+=i[3]>>>16,i[3]&=65535,i[2]+=t[2]+e[2],i[1]+=i[2]>>>16,i[2]&=65535,i[1]+=t[1]+e[1],i[0]+=i[1]>>>16,i[1]&=65535,i[0]+=t[0]+e[0],i[0]&=65535,[i[0]<<16|i[1],i[2]<<16|i[3]]},x64Multiply:function(t,e){t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]],e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]];var i=[0,0,0,0];return i[3]+=t[3]*e[3],i[2]+=i[3]>>>16,i[3]&=65535,i[2]+=t[2]*e[3],i[1]+=i[2]>>>16,i[2]&=65535,i[2]+=t[3]*e[2],i[1]+=i[2]>>>16,i[2]&=65535,i[1]+=t[1]*e[3],i[0]+=i[1]>>>16,i[1]&=65535,i[1]+=t[2]*e[2],i[0]+=i[1]>>>16,i[1]&=65535,i[1]+=t[3]*e[1],i[0]+=i[1]>>>16,i[1]&=65535,i[0]+=t[0]*e[3]+t[1]*e[2]+t[2]*e[1]+t[3]*e[0],i[0]&=65535,[i[0]<<16|i[1],i[2]<<16|i[3]]},x64Rotl:function(t,e){return 32==(e%=64)?[t[1],t[0]]:e<32?[t[0]<<e|t[1]>>>32-e,t[1]<<e|t[0]>>>32-e]:[t[1]<<(e-=32)|t[0]>>>32-e,t[0]<<e|t[1]>>>32-e]},x64LeftShift:function(t,e){return 0==(e%=64)?t:e<32?[t[0]<<e|t[1]>>>32-e,t[1]<<e]:[t[1]<<e-32,0]},x64Xor:function(t,e){return[t[0]^e[0],t[1]^e[1]]},x64Fmix:function(t){return t=this.x64Xor(t,[0,t[0]>>>1]),t=this.x64Multiply(t,[4283543511,3981806797]),t=this.x64Xor(t,[0,t[0]>>>1]),t=this.x64Multiply(t,[3301882366,444984403]),this.x64Xor(t,[0,t[0]>>>1])},x64hash128:function(t,e){for(var i=(t=t||"").length%16,n=t.length-i,r=[0,e=e||0],o=[0,e],a=[0,0],s=[0,0],l=[2277735313,289559509],u=[1291169091,658871167],c=0;c<n;c+=16)a=[255&t.charCodeAt(c+4)|(255&t.charCodeAt(c+5))<<8|(255&t.charCodeAt(c+6))<<16|(255&t.charCodeAt(c+7))<<24,255&t.charCodeAt(c)|(255&t.charCodeAt(c+1))<<8|(255&t.charCodeAt(c+2))<<16|(255&t.charCodeAt(c+3))<<24],s=[255&t.charCodeAt(c+12)|(255&t.charCodeAt(c+13))<<8|(255&t.charCodeAt(c+14))<<16|(255&t.charCodeAt(c+15))<<24,255&t.charCodeAt(c+8)|(255&t.charCodeAt(c+9))<<8|(255&t.charCodeAt(c+10))<<16|(255&t.charCodeAt(c+11))<<24],a=this.x64Multiply(a,l),a=this.x64Rotl(a,31),a=this.x64Multiply(a,u),r=this.x64Xor(r,a),r=this.x64Rotl(r,27),r=this.x64Add(r,o),r=this.x64Add(this.x64Multiply(r,[0,5]),[0,1390208809]),s=this.x64Multiply(s,u),s=this.x64Rotl(s,33),s=this.x64Multiply(s,l),o=this.x64Xor(o,s),o=this.x64Rotl(o,31),o=this.x64Add(o,r),o=this.x64Add(this.x64Multiply(o,[0,5]),[0,944331445]);switch(a=[0,0],s=[0,0],i){case 15:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+14)],48));case 14:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+13)],40));case 13:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+12)],32));case 12:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+11)],24));case 11:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+10)],16));case 10:s=this.x64Xor(s,this.x64LeftShift([0,t.charCodeAt(c+9)],8));case 9:s=this.x64Xor(s,[0,t.charCodeAt(c+8)]),s=this.x64Multiply(s,u),s=this.x64Rotl(s,33),s=this.x64Multiply(s,l),o=this.x64Xor(o,s);case 8:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+7)],56));case 7:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+6)],48));case 6:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+5)],40));case 5:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+4)],32));case 4:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+3)],24));case 3:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+2)],16));case 2:a=this.x64Xor(a,this.x64LeftShift([0,t.charCodeAt(c+1)],8));case 1:a=this.x64Xor(a,[0,t.charCodeAt(c)]),a=this.x64Multiply(a,l),a=this.x64Rotl(a,31),a=this.x64Multiply(a,u),r=this.x64Xor(r,a)}return r=this.x64Xor(r,[0,t.length]),o=this.x64Xor(o,[0,t.length]),r=this.x64Add(r,o),o=this.x64Add(o,r),r=this.x64Fmix(r),o=this.x64Fmix(o),r=this.x64Add(r,o),o=this.x64Add(o,r),("00000000"+(r[0]>>>0).toString(16)).slice(-8)+("00000000"+(r[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)}},t.VERSION="1.8.0",t}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LogoControl=void 0,i(75);var n=i(10);function r(){}r.prototype.onAdd=function(t){return this._container=n.domCreate("div","maplibregl-ctrl mapxus-ctrl-logo",t.getContainer()),(t=n.domCreate("a","mapxus-logo",this._container)).target="_blank",t.href="http://www.mapxus.com/",t.setAttribute("aria-label","Mapxus logo"),t.setAttribute("rel","noopener"),this._container.appendChild(t),this._container},r.prototype.onRemove=function(){n.domRemove(this._container)},r.prototype.getDefaultPosition=function(){return"bottom-left"},e.LogoControl=r},function(t,e,i){var n=i(76),r=("string"==typeof n&&(n=[[t.i,n,""]]),{});r.transform=void 0,i(9)(n,r),n.locals&&(t.exports=n.locals)},function(t,e,i){var n=i(17);(t.exports=i(8)(!1)).push([t.i,".mapxus-logo {\n width: 106.4px;\n height: 28.4px;\n margin: 0 0 -3px 3px;\n display: block;\n background-repeat: no-repeat;\n cursor: pointer;\n background-image: url("+n(i(77))+");\n background-size: contain;\n}",""])},function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATAAAABRCAYAAABVJPq4AAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABzbSURBVHgB7Z0HnBfVtcfPLrANdqVlETCWZU0MVqyAaDAosHRUSIzl2RJLorHHgorl2RKNSl7UlzxFDSriY4WVsjSJYqE9xYI+UcEGAoKULWyBze+3O//N/z87d+bOv8Bfc76fz+zM/ufOnZk7954599xzz4goiqIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoiqIoivJvQIb8m1NSUpJdXV2dm5eXl5OVlZVTX1/fMSMjo8vOnTu7tGrVKq+hoeEl8LkoipJ2tJbvOcOGDcvD6iAIo7137dpVCOHUFf93hmAqxLoblg4FBQUd8H8+hFZ77G/F45A+ksU5WHqLoihpx/daA4Pw2hcCaRE2fygJAOF2ArSwRaIoSlph1MDGjx+f+cYbb7SH1pIzd+7cdfipQSwoLi7OLioq2guCoyA7O7s9fuqAPL6AAPhQdjO4hhslQeHlMAqLCjBFSTOMGtjQoUPPhwD4z8zMzErYhfrNnDnza690Q4YMGYnu1lhs7u0s+dBYcnBsLrZzsLTG/1/j/75lZWWrZTcB7esgnHM5NvMkcVbl5OQcOWXKlApRFCVtyDTtQONvh2VvCJ/u0iSYPIHw+j1Wv8TyMyw9sfwQx/0A63biaHjMB4LwCNlNUHvkSpIjvEgPGPp7iqIoaYVRgEFwbXA2W0P4ZImZH4gFMJAPkN3EsmXLDsXqVEkeLKefi6IoaYWfBrbD2aQW5anJlJSUFIilloP8+shuAue6BksbSSLIb0SfPn1yRVGUtCHTZ9+W5kSZmR29ErRu3bqT2HfT9oVdqrOkGNjk2FUdJkkGAmy/wsLCXqIoStrgp4FVRrY5EumVBvavvaTJUB8I8uPI5GGSQnr27JkFYUubXHtJMuhSt0E5/EIURUkbjAIMNqu65kSZmZ52rrq6ug7iEmBo6JVeaSkAIMCOkxRSVFTUF+cYK6njGFEUJW0wCjBoG1uitj1tP45XezRV+O01MZNSAYBz3yb+3eJEOfDUU0/dTxRFSQuMjT0rK6s2sg3BYOqSud0rOGfwLUNaCsKUTcmBfW0gVv0ktXSqra09TRRFSQuMAgzdxqrINrp/BV5pINj2cf1Eh9VXxQA1Noxc9pDkk8GRR0mt9hUh6QMEiqLEh7HBt2nTplmAOV71LfDoQm6AsFuJ9bdiACOXx0qSGTVq1JE478myG8A9H787RlMVRQnGKMCmTJlSG/WvZ4OF0Ojm+n/TUUcd9Rk214uZpAqw/v3756BreidVMNk90Kl3tCiKsscJ6nJFvPGzDftjupCQIRvHjx+/C5tGQz7SJNVO1a5du8EQnANDHGI1Kd0P3MOpENRJdZRVFCU8vgIMDbXWWZu6TDFGfGhCjV1HCJRlhvRMc6AkiTFjxnC+5pVib/ui8HpEEuf4rkAURdmjBDX8b/gHAqmFDQxdN07WjvHChzDZzDXsXEtNGdKhdciQIUlxRdixY8cJWJ0Y4pAPcG23SNNoaSLk4z5+Koqi7FF8I7JGnFKxbuFGga7bPh7p13JdXV29GoMAX3qMUjbSqlWrvlh9JgkAAcprvyLMMbie+0pLSzfBCP86tveVxGC39Wn5DoJBj/a1tbX7c3vnzp3ry8vLGSopdNea+eD47ljYnf722GOP/cIxISQVPuu8vLwicV6YGCHf8SlYuXJlrewBaHfF9ewbuR7cfwXK8GNRQuEMhnVHr6zRfp2dnV0FpeSzWbNm1djmERRSejv/oLG3mAsJIbQPThybWevWjQKsT58+W5YvX87RSE8BhuOOxOpZSQBUII469rdND+G6HHarp6dPn877mYSfEp0WdCIqcvuFCxdukT3IoEGDuuLBz/Tah3K+56WXXprM7REjRhyGMrgUmwPQ4IojIbO5xr4K7HsZgmES1jNRRttN5xs9evSPcPzlSMd8DorkQfDMd6BSvoHyfQ77p+Lc30ic0DxQU1NDl5Wxjo2zbfT+Hj161BcXF8/HNfwPzjcD52ocNR86dOgIXM9t4l0eFyHdkujfhg8fTufqRyKhxKPAaRtuKSsre4n/UIjm5+efgXRn4veTpGkwRyL3j/vein0vY9+TkK0zg4TryJEjS5F2f699uKfSGTNm3O53PIVoQUHBc9hs0ZtBvmyYp0fH38N93oPrG+SRdsP27dtHoh7vEAtQvmfhfq/22ofyHRnw/YgM1LX+SHcWroXht/bnj5H6U19fTxmyC9f6NvY/hXSlQd+j8BVgyGQLbpCbWYyxFf12ReYtbEBbt25tFGBMh4ugId/TuI6G0ofzFuN9g7Iy4abvkKhKFACv+8bI9aOCLMPxHKAolPjZNzc393Cs/yF7EDyjbDwjz1hr+L0rKgwDTN6DhTHb2hvS0RwwHM90ONZvojHej4ozVZrKrZGBAwcWQlDehUo2Bv8WGC6HgSzZuE/C+lqc+7aPP/74+ZDPOQN1ZwS0eI4sH+KTjoEyByHNQCzv4Jir0GAXYLubqTy8ghIgbVscc5RTz90U8w/KYwiOvR5pjsPiWedoGsFqFKOWQLguKSoquqGiomIRBEO9V3rUwXKkfcRwnUU45yt4BgvFAHpAl+F5jfAafacQRd10N/wfG8qF2jenA1oJMJyu2FS+uB6Wr6fAwfPpjWPH8cWHtd/8aZq16BZ1JNJdh+P+kJOT89iUKVOqTYmN4IKaVbnFixe3c+12h2qucmkjK8QALu4QvD07SJzgTXgWVkeHOKQcD3Rh5B9Gl0XhzJYEQTc5rSd3oyH8hJoVNql52U5wZ0V7Fg3oAScwJN+6RRBe1FwuELPwcsOKPhEN+UG+rGwOgNaVhfNSe3o+QHg14zTgw3Gu6ajsv5bkQo3hOpxiKr+LIHYvTJYZZ5wsQD292ZQI9fGvWM0y7C7AOf9KDd9rJ7TgQxgu3SC8PoHwvxoNfqekCdTacF2zsQwVy+APDnTT+hPu5wUndFcLbN0oBFLQ7TbQxZSW4GLXiAG+rbD/AIkDdi1w7O9CHLIL6R90+bWRlyRBkG8JVXlJX9igj5LwtMYzunzp0qVnDxgwoBO2nxeProoFrXDsxRBiV0nwB2Qyqqqq7sF6nNhr1v86OCODXcwJWCdNiCGvc/CM7xKzG5Hfsbzf6yEAz/faTwGDvC8W84BSMQTgNV476urqLhLvF1IN8rxq/vz5myRNwIDdoSiKPzsaalzg2CHoMd3r5brkK8BQGHVR2/mufd1cJ1kb/T9U5LVIs07MxOUPBmn8C5wrTHjqN9atW/ey+0dolzOwsjYWesHuClT57+sn1zKgwU2ArfFZdrEkftiWx0Oz8o2lBu1pKNL91kurCAEFX9JitjldpVYSP1l8eUJ78Byxduw712IxaUtXDx48OCYEFQTi8Sii8wzppx1zzDEJv5iTCQTPXYkIrwjI46KuXbue4v7dV4ChAm+MbMP2kePKMMYHDA/qi+j/jzvuuE1I866YL+gECQm7GKzkIQ6px3WNg3G5zr2DRl/ktUQSgCGCUEbfiVDTzsvoPaxfwPI07r0c/68JOIwvrVM8fl+F5X+xTKQB3fnfD2owE/D8PIUBhBu/u/CYRRRdmijm4vofx0IjOO+nXnYTuD5q8+9jeQ4vwIn46RUsQdpOPgzTTzluRy1Az4blaBrQyoGZ4il0wRrNLdRA2C0X14AGwe9f4ppuSMUocLzgudLn0zR3eAvK81IsB+K+WqGM+K1WmmRMLlh8t93mrkNBbhQVkRdidFBD52OxbhU2RgNzDPlvisGQDw4Na8h3tK9DbdMj7UKMsBg/h8aRMqxCC1JXHsNRqL9NJ5uDB6ugEV+M8ns9erSJhnk0oItwD7eKhabhaNTXY3khMupH6E6Bbs1ICHMapU3zZo/C+WnXWuGxj7a1bj6n3sSuHO7heeTxdcQwzu47NOCf4fjrHRtVqqBQWITzj+OXriL3Thvha6+9tjfsg9c5XVdTyPF9cZ202z7q3sF6g/b0RxzPhu7VLTwc5Up3oVu7d+/O0d9ijzQ1SDMOo8efSnphCiPP8rwQ10vhLfQMkKYXweSTTz55NupkuSF2YE8oUowC3WyuCupCNn9GDBlGdyHz3CF2+Ok09/Eo1LfFnHdnGPKt7WB8g+GcvxN7r3te872mUSCCwpgjidMdtpuUBmpMBJTzR6gQvWfNmrXAPVQ+Z86cDRxZxOaFFvlsRndgEBrvU9HCi7z44otbMOz/JDbHUksxZEEtrMT9o+PP9xsxU4tzj8I5H8A9fBn9PHk/+H0mhOcwRyNKFc+hrgzEPb4afe98Sc+dO3ctfrsCdZ32sm2mDPx6Djj+HVz/jWLmcigDw5D/dV478Xs5hMBTkmZ4BHuIUIGXged0w3nz5m3F6hrDcXl41jGuWUFTiTZHbTe/XXDyHBSae0j6K/fxeKh+wQ05vG/9oY+99trrTKyOtE1PX6Rp06bN80uDBrES6V6XxDld0pMqPIMz8ZbfbEpADaCsrGyi4xtnBMLrQpTnu35p6DOFZ3qfT5IWz48alJjdWXagYY8J+io6nuM22Oouw7kTMgkYmAbhcFaQcyXK5gWsLhOzQ/DBsF8VG/Y1wHb1mDR1y72gslAm3uW0Hu3xbEnCHN9kg7pn8pHMxz6j7biiooI9t8uxXOle6CAfnbZ1wAXscJziMqMFFjLpiP/d04haGOxLS0s34M1Bh1bPbyriGLpCTJQA0NVpi4p8l9hTi2u/1yYh8p2D6+grCUDfH6yukvRjCRrfMpuE0DD+jjIba7BD7aqtrZ1vkw/K8ynkw4bcwk6D37007kGmvFDHymiUhuYjQfCjwyNHjrwJ558myfseKO/nBpSJlXCAIJkMW84Z2BxsSMJpb54e+9TmBg0adBnaVl8fzaUFKKM7KMAlDUF5/L9hTIb2rCfpMgON6tny8vIY2eFo2RPEAl8NDJWaBdNoo8IbuLlS4KG6I7HuwAWZCtHPH8xqdAtdoHOw6ij2zD/iiCPesUmICsO3XrUkAO69Bz3iJf14yzYhGt47uA+TB/4nto2ksrJyNfIxxYNr8cJE2p8Y0rKeTQpjlIYWtACrDyVJoH6+C+3POj9qabifx33y8x09Z0PG8f8l9tc3DyPs/y1pSufOnalJrTXspq/b/TBhvAsl52kMVPwHbKn7mwZ6TAR1Iak2Nxqno6OyomK5Da47IG09uyk47hUxc3SQkyMHDHC+a8UeGjTvtK340BLfw+ptSRAI2TGSZkR9nDgQRuBFetOAyhqxxLGzWU0hcnzounjtQ93bhDoVtkvIUcJXJUmgTGbbal8RcM0fmPYZDPAxoBt+N85ZKsF8npWVdaHXCHu6MHHiRPbgaN80DtRhP43yZ6GsJ6LsVnEuJNr8kxBqJf369Qt0dvcVYMiQmkmkgJpD6uBk7jmOVRAynpUWadmFMU1TaG1hyD8PD9Ta2I8CgU35xTckBLj2WZIgnAeWbjHCUBZW00MsCDXCanve3NzcLK9AAU4e22tqauLRjFdLkogEJwiD8zGcKq99GYbIxu4s0F2nOcI4x5YDJeC2qVOnJhQQYXcADXYa7aKW7i7U0LvTgRjrme3bt18MQXZnSUmJ0ZHYV4ChW8FRyMYTI9NoTSlGMnK00tTFwAjdKuw3hpiGkDQ6HjpTKcLYlujbdUfYtya6x9OinXbjpK/GCAsHug+ZRJJLQs7JiYK6V59oXcrPz6dPpV/XtQZ19jX5btAAIXYzyoT+ku+HOZA+YljdBDm0wu3QG8G38uANWRd5GFhHfxuyU0wmmZlfmfJwhkVXmvbjQRg98vEgf4ObKBJ7JkMFXykhgSGRxsb3JDFyUA4jRLEGNla6SHhqKzRZdOjQIZ4pRYlM0HdjO++zGQhl2nY8nVYttRDGubtJfD5BiHxyoYE9wml18h0BAzFTUS59cN2MoPwkFna1be2bP0Z3ee6QIUNa2BB9BRhGdrY6djCJnkGe4QqvEzBliOmNAQ5Nhnz0gxlv6VKxp4Kx8SWO4WQaX51JzwmBPNLVnSItOfroo2kj8fRkZx3Di2V/CY+1q00q8kKPgi9cT0M07unLoONhzGZ7uEYCHIuR10kQdDdI4jDWmvV8Xryk455axTBNEGTl0MjORTn1hvJCgXYr6sBC7K7wOxZpCnHuxxy/wX9dT9BJqRI7GURsFRwXzXcl8zUWczjVZ/cRXoZ83Bx9W/y8s2Pg9BgUTtyeyCicuZI4hw0cOPCHoljBgRaUu7GrhLo3WEKANzRHx619Cy04IQ67plELR2P1nXIVFSYqX+y4gpOlLdOaDOlt8Qy6iD2BAxE20OQEW/USxj2DQDsJ2vgRnFrEkV/TMbjOXgUFBTEuWUEBDSkYaJwvRuaN6jQaaB5HDlz+HV/55eHMiaRh10vS58CQ33vlypXNo5Uw2jFYYphoq/XoJ98nCQAhuxiV50vc2z4SPx3QhWBf/4+i2MLn/ivDvstRFyahsn8iFuD5XSKJxXhz07Fbt25XYaTPyqcQBueDUX/ONO0PCuGExnkeI5yIPXm4579L0wR23+4Y8t1o8MniwAJ7DiskgBEjRnRpaArmaEMGnl3njJaBIimItrlnczjPmFPRHoEWeirStHDq5dxjLP2x2ewiZWNAjfgGNfqBQd3kBOYYIz6Eja9qjNGkjwMM+TGqOh7KuWL4lJsXKKTHIM3XSALgTfAtrnGmJAjyGCKKNag7bNSmUctOeDE948y99WXUqFFs+OMk+YxHQwyMOOJofww7ZLKbrUej/T/T8TBS78/IFV778DuDZm40HHoYyofzMIOiePhpupdAOAX2dnAd54rB7cUN8ivEs/sAbXmde4H8mOrnPkV7mRgcfnGtMT0cGwFW6awbBQoqXIuJ3Mj0a78MaMhHmo9M+xmhNbLNONnOnEcrkJaz2v8iSYAFK4nTjzMHRLGCYafRMBb4JDkWz2Uy3/5eOzmhGvsGowvCuZip+DJ7DhriNGhXp4lBSHCKEK7xRTHMOCEM6Gfax24qzvGweM8goCvHr3D8TabjUf/vhgA9XHxw5h6aRmg7If8nTGUsTVFyR2J9i1gCOUHFx/P7sDjXgAMOOMD4MR6n/Zgc12PuIbALKY4/iiO4WBAd8bDaxV5Pw3qLfOiVa/qSTy+GPqaRDw/j9xJC+8J1PYRGEHrk0Qvc26s4/zdhzu+GU3EwYsL5fWWiWIG38u14jowm4Wn7Qf1ipIalaETzaPDF8jGOaQwFje7dyfj/xIzgUDyJwG7p04z4ivPMwbW+zWl2WP8I//dmGJiIicXANgioO0w7nSgTQ732MQoH6vcqdKu+wTnPMHTh2mPfwxiVHGQKvdyuXbv3q6url/tMmxvIgSzcI+PsL0L5foqeE7uotE1ReHGxDuzILiLy4vxQL6HXGtfLqUTjPv3000nREWkcTfBmj7nWjbi9BWzeWFXOgR2dtVtKV/h1DyNAOPhNyD2A05MYuliaooha4cRAelSShNMvTzggHMpIv9wdgmnTpi2W4Dmx7Dqcxzl0DBKAZ09Bcjd+G5Bi4RWBtiI2coa+oSBd5EwbYn31E158wd8DE4enHY8hjRqaPraS6XHg2xipbYybTxNHbW0t7cKe3W1cy/GO+4UnjEiMNA+JP5zWxZDe/FjKagjd951J/mMljqi0EH5P+ETo6MZRxR49evDF9AyWh7HMQPq3Gpoi1XrB9hnjLRAowGj8i2w7fifdXfs3R1wt/IBWQslp9MgHvXBDDCli7XvDYHqMby/JhQIs0dhew23jwCtNoAvIDz4k49NkaRPQz4HBrjwFB7u/OTk5D2DT5Ot4U/SUuNmzZzPszp0GfzK25Qtgr+thyEu2b9/Oa0mGmcQK2qXRRunqYfL144uHDqqcAM8AALQfGwdhkNez6KXF9PYCBRjnyEW2KysrKcDcE7k3rV69ujIon6qqKgpC42gSJD6/mhMmuulmCL0HJMngrTHfK7JGSDr79fGVlnBYHXVgJCp1IuGN5uN4qxFDG5zQQImE6FkErekS94hbhCVLlvwcAslU58tyc3PL3T+iDd6L+mmyGe6NNjHB9PLkPFW0Q2p7VoEOPGAbDjVNr6ysjPZpRpYIlBEBLONLzv1joABDATergAyjg8KL0cAYhcImquqcOXN4A2/6JOEnvcJ4Fj9SWlr6kSQZBudDxU3UK58qpTq1hoTx2Rx71zMSTgumRjLR6bp/LkmCLzI0Gl4PDfRhNDtGZ3mInz1zh4qJQEdtvCz/hHRedmgObHh+WYihZpzgh6auWUlRUdH5hn0yf/789TgnR2x9Y6y5YZvAC2Y4u+4SEggxRsz9NZZ45m5ygj7Dh5d49bZsbGDN9q26ujpOvo1R8fD/V2IJ0vrFpgozglQBdTiVvlZWsa/8QCU7JRLLXLGHth6GT3L8qQI1BTRGCr0LMJJ3gd8HeeMFQnXj2rVrx6In8kucJ8gfjbNAlqOhj8a1XMF7MSXEdf9BDC4JOM+fabg3HYt8l2P1F5+876ZPmmk/rm0t2s8pOA/974KcvzmIN4EDJRAgiyVOcD98KR2P5VYfu5gbfvPg7IqKirGmjyTbjEI227egVezt4ehpPWMfx7+JhytJ4LZUfhEbb91SXCvjxCcy14x2DU4LmScpZOPGjV916dLF0/kRQtQ6lhU0z60YATod9+41EhjqC9toQJchn84ev1tVXEfzmAz7z5QVK1b0xIuT98coBY1ft0Ed3AqBwnr3WnZ29ptMjwreeCzumdrSGq98YYd9U+KAIWuwTIaQnNq1a1eGD++D8++H62jrXA+7VvSF/AeuI9AhlKAdUIA94f6dgQigmQV2oyHkb4fRfi7y8ewu4vp8PQOcsEd/g137CYxO8ruavXEMPwrMOk+N9htcywcFBQUvT5o0Kfq5PY5zepZj27ZtfW2YKBsqO7ejHO/GyGs/PCsGNKVJqgMjHDrzrjm1jP5iL/fq1ev9oLBYgZ+wghbRNyo0NLtF90vUNwKp6jJeuVhAoyUqAi/Q9iOrLaA/GW7uBEZ7lRSCN9hCMbt9WIGyeRxlc4EoaQu6cv1Rp0zzYK9E9+dBUdKWwG4bhEWzfQsPmm+dmOHUMDGTKE05NCwJgOMfTbXwIrjXhP24IPh/mm4xwhTl+4TNKGRz9wHCg744ua79FRKOpRInTtSLF2X3kHCMMJZXYWHhgaIoSkoIFGA1NTXsDzdqYWiQ7DrGTHeArSOUfYQOgBI/E6DSJy3iph+wuzCoXFw2kyiyYEvTuZGKkiJsw+lEvPGL3F7PplDSJtq0aROvD8oqGBST5nUfhPOBhmQ4/Z0miqKkhEABhhEHal8RRzx3rCsGEaySEGC063MxeOb6AWHy8DPPPBM4ZSmZQHtidIpEPbttRnoVRYmDQAGWm5u7C8IjYsh3R2LdhKHpsB9eoCE/rHfzhxgu3+2fj3IcZeP1xOYwdRnK7gxRFCUlBAowdPlqTI5nDExWWVkZz5djQhnyoeU9xsmosgeAAJou4VmNMrsQI5Cjpk+fnoz5fYqieBDYvdm4cWNDfn6+p/DgRO6FCxeG/goMBN9STtEXCz808HVeXt7fZA8Bze/+6urqbs40le4ByRlihVNI7uLcvohzpaIoqSFQgNFjd9iwYR+hAR/tsZsjiqE/ogGtbUHbtm2/aggO30xD+nn8bLzsIRzN77IxY8ZcjRHZsbhmBluMKQu6W0Aos4t714wZM0J/S1DZc+C5bcYLZ6Fhd9Ln2irJxUYDktGjR3eqr6/vh4banN4J6PaKaaZ9EBCK9I862C8N8l8DgbAi7HceUwnDG+Peh+La+Mk3hgJZg/+v69Wr1wLbr4EripIcrASY0hJ+QaagoKBw27ZtGxghQBRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFURRFSQX/BO3KWsJPj46IAAAAAElFTkSuQmCC"},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AttributionControl=void 0,i(79);var n=i(10);function r(t){this._theme=t.theme||"default"}r.prototype.onAdd=function(t){return this._container=n.domCreate("div","maplibregl-ctrl mapxus-ctrl-attribution",t.getContainer()),this._anchor=n.domCreate("a","mapxus-attribution",this._container),this._anchor.target="_blank",this._setCopyrightInfo(this._theme),this._anchor.setAttribute("aria-label","Mapxus attribution"),this._anchor.setAttribute("rel","noopener"),this._container.appendChild(this._anchor),this._container},r.prototype.onRemove=function(){n.domRemove(this._container)},r.prototype.getDefaultPosition=function(){return"bottom-right"},r.prototype.changeTheme=function(t){this._setCopyrightInfo(t)},r.prototype._setCopyrightInfo=function(t){this._anchor.innerText="landsD"===t?"© The Government of the Hong Kong SAR":"© OpenStreetMap contributors",this._anchor.href="landsD"===t?"https://www.map.gov.hk/gm/":"https://www.openstreetmap.org/copyright/"},e.AttributionControl=r},function(t,e,i){var n=i(80),r=("string"==typeof n&&(n=[[t.i,n,""]]),{});r.transform=void 0,i(9)(n,r),n.locals&&(t.exports=n.locals)},function(t,e,i){(t.exports=i(8)(!1)).push([t.i,".mapxus-ctrl-attribution {\n margin: 0 10px 5px 0 !important;\n}\n.mapxus-attribution {\n text-decoration: none;\n color: #404040;\n}",""])},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DistanceSearchType=void 0,(e=e.DistanceSearchType||(e.DistanceSearchType={})).POINT="Point",e.POLYGON="Polygon"},function(t,e,i){"use strict";function n(t){return-1<t.id.indexOf("mapxus-poi-restroom")}function r(t){var e=-1<t.id.indexOf("mapxus-poi-stairs"),i=-1<t.id.indexOf("mapxus-poi-escalator"),n=-1<t.id.indexOf("mapxus-poi-elevator");t=-1<t.id.indexOf("mapxus-poi-ramp");return e||i||n||t}function o(t){return/en/.test(t)}function a(t){return"zh-Hans"===t||"zh"===t||"zh-CN"===t}function s(t){return"zh-Hant"===t||"zh-TW"===t||"zh-HK"===t}Object.defineProperty(e,"__esModule",{value:!0}),e.isTraditionalChinese=e.isSimplifiedChinese=e.isEnglish=e.isConnectorPoi=e.isToiletPoi=e.getTextFieldCoalesceList=void 0,e.getTextFieldCoalesceList=function(t,e){return t.map((function(t){var i=[];i=o(e)?["coalesce",["get","name:en"],["get","name"]]:a(e)?["coalesce",["get","name:zh-Hans"],["get","name"]]:s(e)?["coalesce",["get","name:zh-Hant"],["get","name"]]:"ja"===e?["coalesce",["get","name:ja"],["get","name"]]:"ko"===e?["coalesce",["get","name:ko"],["get","name"]]:["coalesce",["get","name"]];return(n(t)||r(t))&&(i=""),{layerId:t.id,coalesce:i}}))},e.isToiletPoi=n,e.isConnectorPoi=r,e.isEnglish=o,e.isSimplifiedChinese=a,e.isTraditionalChinese=s},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ThemeType=void 0,(e=e.ThemeType||(e.ThemeType={})).CHRISTMAS="christmas",e.HALLOWEEN="halloween",e.MAPPY_BEE="mappyBee",e.MAPXUS="mapxus",e.LANDS_D="landsD",e.COMMON="common",e.MAPXUS_V2="mapxus_v2"},function(t,e,i){"use strict";var n,r,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.Marker=void 0,i=i(5),o(a,r=i.Evented),a.prototype.onEventListener=function(t,e){this._map.on(t,this._layerId,e)},a.prototype.addTo=function(t){return this._map=t.getMap(),this._indoor=t.getIndoor(),this},a.prototype.create=function(t,e,i){var n=this;return this._coordinates=t,this._floor=e||"",this._buildingId=i||"",this._map.hasImage(this._imageName)?this._createData():this._loadImage((function(t){n._map.addImage(n._imageName,t),n._createData()})),this},a.prototype.remove=function(){return this._map.getLayer(this._layerId)&&(this._map.removeLayer(this._layerId),this._map.removeSource(this._sourceId)),this},a.prototype.switch=function(t,e){return this._map.getLayer(this._layerId)&&this._map.setFilter(this._layerId,["any",["all",["==","floor",t],["==","buildingId",e]],["==","buildingId",""],["==","floor",""]]),this},Object.defineProperty(a.prototype,"layerId",{get:function(){return this._layerId},enumerable:!1,configurable:!0}),a.prototype.setImageUrl=function(t){return this._imageUrl=t,this._imageName=this._imageName+"_"+t,this},a.prototype.setImageScale=function(t){return this._imageScale=t,this},a.prototype._createData=function(){var t=this;this._addSource()._addLayer(),this._indoor.currentFloor===this._floor&&this._indoor.buildingId===this._buildingId||this.switch(this._indoor.currentFloor||"",this._indoor.buildingId||""),this._indoor.on("switchFloor",(function(e){e=e.target,t.switch(e.currentFloor,e.buildingId)})),this._indoor.on("selectBuilding",(function(e){e.feature||t.switch("","")}))},a.prototype._loadImage=function(t){this._map.loadImage(this._imageUrl,(function(e,i){if(e)throw e;t(i)}))},a.prototype._addSource=function(){return this._map.getSource(this._sourceId)||this._map.addSource(this._sourceId,{type:"geojson",data:{type:"Feature",geometry:{type:this._isMultiArray()?"MultiPoint":"Point",coordinates:this._coordinates},properties:{floor:this._floor,buildingId:this._buildingId}}}),this},a.prototype._addLayer=function(){return this._map.getLayer(this._layerId)||this._map.addLayer({id:this._layerId,type:"symbol",source:this._sourceId,layout:{"icon-image":this._imageName,"icon-size":this._imageScale}}),this},a.prototype._isMultiArray=function(){for(var t=0,e=this._coordinates;t<e.length;t++)if(e[t]instanceof Array)return!0;return!1},i=a;function a(t){var e=r.call(this)||this,i=(t=(t&&e.addTo(t),Math.floor(1e3*Math.random())),"mapxus_marker");return e._sourceId=i+"_source_"+t,e._layerId=i+"_layer_"+t,e._imageName="poi-01",e._imageUrl="https://map-service.mapxus.co.jp/bssww/assets/origin-marker.png",e._imageScale=.65,e}e.Marker=i},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RouteService=void 0;var n=i(7),r=i(86);function o(){this._api="/api/v1/route",this._request=new n.Request}o.prototype.search=function(t,e,i,n,o,a,s,l,u){if(void 0===s&&(s=r.WayFindingVehicleType.FOOT),!t.length||!e.length)throw new Error("Coord cannot be empty.");if(2!==t.length||2!==e.length)throw new Error("Coord cannot less than 2.");return t=[this._api+"?fromLon="+t[0],"fromLat="+t[1],"toLon="+e[0],"toLat="+e[1],"fromBuilding="+o,"toBuilding="+a,"fromFloor="+i,"toFloor="+n,"vehicle="+s],l&&t.push("locale="+l),u&&t.push("toDoor="+u),this._request.get(t.join("&"))},e.RouteService=o},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WayFindingVehicleType=void 0,(e=e.WayFindingVehicleType||(e.WayFindingVehicleType={})).FOOT="foot",e.WHEELCHAIR="wheelchair",e.ESCALATOR="escalator"},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.version=void 0,e.version="5.0.1-jp"}],i={},t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:n})},t.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},t.t=function(e,i){if(1&i&&(e=t(e)),8&i)return e;if(4&i&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&i&&"string"!=typeof e)for(var r in e)t.d(n,r,function(t){return e[t]}.bind(null,r));return n},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},t.p="",t(t.s=18);function t(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var e,i}));