1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2634],{6158:function(i,r,n){var a=n(83454);i.exports=function(){"use strict";var i,r,n;function o(a,o){if(i){if(r){var s="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+i+")(sharedChunk); ("+r+")(sharedChunk); self.onerror = null;",l={};i(l),n=o(l),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(n.workerUrl=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"})))}else r=o}else i=o}return o(["exports"],function(i){let r,n,o,s,l,h,u;var c,p="undefined"!=typeof self?self:{};function d(i,r,n,a){this.cx=3*i,this.bx=3*(n-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(a-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=a,this.p2x=n,this.p2y=a}d.prototype.sampleCurveX=function(i){return((this.ax*i+this.bx)*i+this.cx)*i},d.prototype.sampleCurveY=function(i){return((this.ay*i+this.by)*i+this.cy)*i},d.prototype.sampleCurveDerivativeX=function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},d.prototype.solveCurveX=function(i,r){var n,a,o,s,l;for(void 0===r&&(r=1e-6),o=i,l=0;l<8;l++){if(Math.abs(s=this.sampleCurveX(o)-i)<r)return o;var h=this.sampleCurveDerivativeX(o);if(1e-6>Math.abs(h))break;o-=s/h}if((o=i)<(n=0))return n;if(o>(a=1))return a;for(;n<a&&!(Math.abs((s=this.sampleCurveX(o))-i)<r);)i>s?n=o:a=o,o=.5*(a-n)+n;return o},d.prototype.solve=function(i,r){return this.sampleCurveY(this.solveCurveX(i,r))};var f=m;function m(i,r){this.x=i,this.y=r}m.prototype={clone:function(){return new m(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,r){return this.clone()._rotateAround(i,r)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var r=i.x-this.x,n=i.y-this.y;return r*r+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,r){return Math.atan2(this.x*r-this.y*i,this.x*i+this.y*r)},_matMult:function(i){var r=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=r,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var r=Math.cos(i),n=Math.sin(i),a=n*this.x+r*this.y;return this.x=r*this.x-n*this.y,this.y=a,this},_rotateAround:function(i,r){var n=Math.cos(i),a=Math.sin(i),o=r.y+a*(this.x-r.x)+n*(this.y-r.y);return this.x=r.x+n*(this.x-r.x)-a*(this.y-r.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},m.convert=function(i){return i instanceof m?i:Array.isArray(i)?new m(i[0],i[1]):i};let _=Math.PI/180,g=180/Math.PI,y=[[0,0],[1,0],[1,1],[0,1]];function x(i){if(i<=0)return 0;if(i>=1)return 1;let r=i*i,n=r*i;return 4*(i<.5?n:3*(i-r)+n-.75)}function v(i,r,n,a){let o=new d(i,r,n,a);return function(i){return o.solve(i)}}let b=v(.25,.1,.25,1);
1function w(i,r,n){return Math.min(n,Math.max(r,i))}function T(i,r,n){return(n=w((n-i)/(r-i),0,1))*n*(3-2*n)}function E(i,r,n){let a=n-r,o=((i-r)%a+a)%a+r;return o===r?n:o}function S(i,r,n){if(!i.length)return n(null,[]);let a=i.length,o=Array(i.length),s=null;i.forEach((i,l)=>{r(i,(i,r)=>{i&&(s=i),o[l]=r,0==--a&&n(s,o)})})}function I(i){let r=[];for(let n in i)r.push(i[n]);return r}function A(i,...r){for(let n of r)for(let r in n)i[r]=n[r];return i}let M=1;function C(){return M++}function z(){return function i(r){return r?(r^Math.random()*(16>>r/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()}function P(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function k(i){return!!i&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i)}function D(i,r){i.forEach(i=>{r[i]&&(r[i]=r[i].bind(r))})}function L(i,r){return -1!==i.indexOf(r,i.length-r.length)}function B(i,r,n){let a={};for(let o in i)a[o]=r.call(n||this,i[o],o,i);return a}function R(i,r,n){let a={};for(let o in i)r.call(n||this,i[o],o,i)&&(a[o]=i[o]);return a}function F(i){return Array.isArray(i)?i.map(F):"object"==typeof i&&i?B(i,F):i}let O={};function U(i){O[i]||("undefined"!=typeof console&&console.warn(i),O[i]=!0)}function V(i,r,n){return(n.y-i.y)*(r.x-i.x)>(r.y-i.y)*(n.x-i.x)}function j(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function N(i){let r={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,a,o)=>{let s=a||o;return r[n]=!s||s.toLowerCase(),""}),r["max-age"]){let i=parseInt(r["max-age"],10);isNaN(i)?delete r["max-age"]:r["max-age"]=i}return r}let G=null;function Z(i){if(null==G){let r=i.navigator?i.navigator.userAgent:null;G=!!i.safari||!(!r||!(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return G}function $(i){try{let r=p[i];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch(i){return!1}}function q(i,r){return[i[4*r],i[4*r+1],i[4*r+2],i[4*r+3]]}let X=p.performance;function W(i){let r=i?i.url.toString():void 0;return X.getEntriesByName(r)}var H="2.10.0";let Y={now:()=>void 0!==o?o:p.performance.now(),setNow(i){o=i},restoreNow(){o=void 0},frame(i){let r=p.requestAnimationFrame(i);return{cancel:()=>p.cancelAnimationFrame(r)}},getImageData(i,r=0){let{width:n,height:a}=i;s||(s=p.document.createElement("canvas"));let o=s.getContext("2d");if(!o)throw Error("failed to create canvas 2d context");return(n>s.width||a>s.height)&&(s.width=n,s.height=a),o.clearRect(-r,-r,n+2*r,a+2*r),o.drawImage(i,0,0,n,a),o.getImageData(-r,-r,n+2*r,a+2*r)},resolveURL:i=>(r||(r=p.document.createElement("a")),r.href=i,r.href),get devicePixelRatio(){return p.devicePixelRatio},get prefersReducedMotion(){return!!p.matchMedia&&(null==n&&(n=p.matchMedia("(prefers-reduced-motion: reduce)")),n.matches)}},K={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==l){let i=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{l=null!=a.env.API_URL_REGEX?RegExp(a.env.API_URL_REGEX):i}catch(r){l=i}}return l},get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},J={supported:!1,testSupport:function(i){!et&&ee&&(ei?er(i):Q=i)}},Q,ee,et=!1,ei=!1;function er(i){let r=i.createTexture();i.bindTexture(i.TEXTURE_2D,r);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,ee),i.isContextLost())return;J.supported=!0}
1catch(i){}i.deleteTexture(r),et=!0}p.document&&((ee=p.document.createElement("img")).onload=function(){Q&&er(Q),Q=null,ei=!0},ee.onerror=function(){et=!0,Q=null},ee.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let en="NO_ACCESS_TOKEN";function ea(i){return 0===i.indexOf("mapbox:")}function eo(i){return K.API_URL_REGEX.test(i)}let es=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function el(i){let r=i.match(es);if(!r)throw Error("Unable to parse URL object");return{protocol:r[1],authority:r[2],path:r[3]||"/",params:r[4]?r[4].split("&"):[]}}function eh(i){let r=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${r}`}function eu(i){if(!i)return null;let r=i.split(".");if(!r||3!==r.length)return null;try{return JSON.parse(decodeURIComponent(p.atob(r[1]).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(i){return null}}class ec{constructor(i){this.type=i,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(i){let r=eu(K.ACCESS_TOKEN),n="";return n=r&&r.u?p.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(i,r)=>String.fromCharCode(Number("0x"+r)))):K.ACCESS_TOKEN||"",i?`mapbox.eventData.${i}:${n}`:`mapbox.eventData:${n}`}fetchEventData(){let i=$("localStorage"),r=this.getStorageKey(),n=this.getStorageKey("uuid");if(i)try{let i=p.localStorage.getItem(r);i&&(this.eventData=JSON.parse(i));let a=p.localStorage.getItem(n);a&&(this.anonId=a)}catch(i){U("Unable to read from LocalStorage")}}saveEventData(){let i=$("localStorage"),r=this.getStorageKey(),n=this.getStorageKey("uuid");if(i)try{p.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&p.localStorage.setItem(r,JSON.stringify(this.eventData))}catch(i){U("Unable to write to LocalStorage")}}processRequests(i){}postEvent(i,r,n,a){if(!K.EVENTS_URL)return;let o=el(K.EVENTS_URL);o.params.push(`access_token=${a||K.ACCESS_TOKEN||""}`);let s={event:this.type,created:new Date(i).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:H,skuId:"01",userId:this.anonId},l=r?A(s,r):s,h={url:eh(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([l])};this.pendingRequest=eL(h,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(a)})}queueRequest(i,r){this.queue.push(i),this.processRequests(r)}}let ep=new class extends ec{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(i,r){K.EVENTS_URL&&K.ACCESS_TOKEN&&Array.isArray(i)&&i.some(i=>ea(i)||eo(i))&&this.queueRequest(Date.now(),r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let r=eu(K.ACCESS_TOKEN),n=r?r.u:K.ACCESS_TOKEN,a=n!==this.eventData.tokenU;k(this.anonId)||(this.anonId=z(),a=!0);let o=this.queue.shift();if(this.eventData.lastSuccess){let i=new Date(this.eventData.lastSuccess),r=new Date(o),n=(o-this.eventData.lastSuccess)/864e5;a=a||n>=1||n<-1||i.getDate()!==r.getDate()}else a=!0;a?this.postEvent(o,{"enabled.telemetry":!1},i=>{i||(this.eventData.lastSuccess=o,this.eventData.tokenU=n)},i):this.processRequests()}},ed=ep.postTurnstileEvent.bind(ep),ef=new class extends ec{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,r,n,a){this.skuToken=r,this.errorCb=a,K.EVENTS_URL&&(n||K.A
1CCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},n):this.errorCb(Error(en)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),k(this.anonId)||(this.anonId=z()),this.postEvent(n,{skuToken:this.skuToken},i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i))}},em=ef.postMapLoadEvent.bind(ef),e_=new class extends ec{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,r,n,a){if(!K.API_URL||!K.SESSION_PATH)return;let o=el(K.API_URL+K.SESSION_PATH);o.params.push(`sku=${r||""}`),o.params.push(`access_token=${a||K.ACCESS_TOKEN||""}`);let s={url:eh(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=eB(s,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(a)})}getSessionAPI(i,r,n,a){this.skuToken=r,this.errorCb=a,K.SESSION_PATH&&K.API_URL&&(n||K.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},n):this.errorCb(Error(en)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||this.getSession(n,this.skuToken,i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i)}},eg=e_.getSessionAPI.bind(e_),ey=new Set,ex,ev=500,eb=50,ew={};function eT(i){let r,n;let a=eI(i);a&&a.forEach(i=>{let a=i.split("=");"language"===a[0]?r=a[1]:"worldview"===a[0]&&(n=a[1])});let o="mapbox-tiles";return r&&(o+=`-${r}`),n&&(o+=`-${n}`),o}function eE(){try{return p.caches}catch(i){}}function eS(i){let r=eE();r&&!ew[i]&&(ew[i]=r.open(i))}function eI(i){let r=i.indexOf("?");return r>0?i.slice(r+1).split("&"):[]}function eA(i){let r=i.indexOf("?");if(r<0)return i;let n=eI(i).filter(i=>{let r=i.split("=");return"language"===r[0]||"worldview"===r[0]});return n.length?`${i.slice(0,r)}?${n.join("&")}`:i.slice(0,r)}let eM=1/0,eC={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(eC);class ez extends Error{constructor(i,r,n){401===r&&eo(n)&&(i+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(i),this.status=r,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}let eP=j()?()=>self.worker&&self.worker.referrer:()=>("blob:"===p.location.protocol?p.parent:p).location.href,ek=function(i,r){var n;if(!(/^file:/.test(n=i.url)||/^file:/.test(eP())&&!/^\w+:/.test(n))){if(p.fetch&&p.Request&&p.AbortController&&p.Request.prototype.hasOwnProperty("signal"))return function(i,r){var n;let a=new p.AbortController,o=new p.Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:eP(),signal:a.signal}),s=!1,l=!1,h=(n=o.url).indexOf("sku=")>0&&eo(n);"json"===i.type&&o.headers.set("Accept","application/json");let u=(n,a,s)=>{if(l)return;if(n&&"SecurityError"!==n.message&&U(n),a&&s)return c(a);let u=Date.now();p.fetch(o).then(n=>{if(n.ok){let i=h?n.clone():null;return c(n,i,u)}return r(new ez(n.statusText,n.status,i.url))}).catch(i=>{20!==i.code&&r(Error(i.message))})},c=(n,a,h)=>{("arrayBuffer"===i.type?n.arrayBuffer():"json"===i.type?n.json():n.text()).then(i=>{l||(a&&h&&function(i,r,n){let a=eT(i.url);if(eS(a),!ew[a])return;let o={status:r.status,statusText:r.statusText,headers:new p.Headers};r.headers.forEach((i,r)=>o.headers.set(r,i));let s=N(r.headers.get("Cache-Control")||"");if(s["no-store"])return;s["max-age"]&&o.headers.set("Expires",new Date(n+1e3*s["max-age"]).toUTCString());let l=o.headers.get("Expires");l&&(new Date(l).getTime()-n<42e4||function(i,r){if(void 0===ex)try{new Response(new ReadableStream),ex=!0}catch(i){ex=!1}ex?r(i.body):i.blob().then(r)}(r,r=>{let n=new p.Response(r,o);eS(a),ew[a]&&ew[a].then(r=>r.put(eA(i.url),n)).catch(i=>U(i.message))}))}(o,a,h),s=!0,r(null,i,n.headers.get("Cache-Control"),n.headers.get("Expires")))}).catch(i=>{l||r(Error(i.message))})};return h?function(i,r){let n=eT(i.url);if(eS(n),!ew[n])return r(null);let a=eA(i.url);ew[n].then(i=>{i.match(a).then(n=>{let o=function(i){if(!i)return!1;let r=new Date(i.headers.get("Expires")||0),n=N(i.headers.get("Cache-Control")||"");return r>
1Date.now()&&!n["no-cache"]}(n);i.delete(a),o&&i.put(a,n.clone()),r(null,n,o)}).catch(r)}).catch(r)}(o,u):u(null,null),{cancel:()=>{l=!0,s||a.abort()}}}(i,r);if(j()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,r,void 0,!0)}return function(i,r){let n=new p.XMLHttpRequest;for(let r in n.open(i.method||"GET",i.url,!0),"arrayBuffer"===i.type&&(n.responseType="arraybuffer"),i.headers)n.setRequestHeader(r,i.headers[r]);return"json"===i.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===i.credentials,n.onerror=()=>{r(Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let a=n.response;if("json"===i.type)try{a=JSON.parse(n.response)}catch(i){return r(i)}r(null,a,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else r(new ez(n.statusText,n.status,i.url))},n.send(i.body),{cancel:()=>n.abort()}}(i,r)},eD=function(i,r){return ek(A(i,{type:"arrayBuffer"}),r)},eL=function(i,r){return ek(A(i,{method:"POST"}),r)},eB=function(i,r){return ek(A(i,{method:"GET"}),r)},eR="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";h=[],u=0;let eF=function(i,r){if(J.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),u>=K.MAX_PARALLEL_IMAGE_REQUESTS){let n={requestParameters:i,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return h.push(n),n}u++;let n=!1,a=()=>{if(!n)for(n=!0,u--;h.length&&u<K.MAX_PARALLEL_IMAGE_REQUESTS;){let i=h.shift(),{requestParameters:r,callback:n,cancelled:a}=i;a||(i.cancel=eF(r,n).cancel)}},o=eD(i,(i,n,o,s)=>{a(),i?r(i):n&&(p.createImageBitmap?function(i,r){let n=new p.Blob([new Uint8Array(i)],{type:"image/png"});p.createImageBitmap(n).then(i=>{r(null,i)}).catch(i=>{r(Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(n,(i,n)=>r(i,n,o,s)):function(i,r){let n=new p.Image,a=p.URL;n.onload=()=>{r(null,n),a.revokeObjectURL(n.src),n.onload=null,p.requestAnimationFrame(()=>{n.src=eR})},n.onerror=()=>r(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let o=new p.Blob([new Uint8Array(i)],{type:"image/png"});n.src=i.byteLength?a.createObjectURL(o):eR}(n,(i,n)=>r(i,n,o,s)))});return{cancel:()=>{o.cancel(),a()}}};
1function eO(i,r,n){n[i]&&-1!==n[i].indexOf(r)||(n[i]=n[i]||[],n[i].push(r))}function eU(i,r,n){if(n&&n[i]){let a=n[i].indexOf(r);-1!==a&&n[i].splice(a,1)}}class eV{constructor(i,r={}){A(this,r),this.type=i}}class ej extends eV{constructor(i,r={}){super("error",A({error:i},r))}}class eN{on(i,r){return this._listeners=this._listeners||{},eO(i,r,this._listeners),this}off(i,r){return eU(i,r,this._listeners),eU(i,r,this._oneTimeListeners),this}once(i,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},eO(i,r,this._oneTimeListeners),this):new Promise(r=>this.once(i,r))}fire(i,r){"string"==typeof i&&(i=new eV(i,r||{}));let n=i.type;if(this.listens(n)){i.target=this;let r=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let n of r)n.call(this,i);let a=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let r of a)eU(n,r,this._oneTimeListeners),r.call(this,i);let o=this._eventedParent;o&&(A(i,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),o.fire(i))}else i instanceof ej&&console.error(i.error);return this}listens(i){return!!(this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i))}setEventedParent(i,r){return this._eventedParent=i,this._eventedParentData=r,this}}var eG=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"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":true,"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":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"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":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"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_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"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"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1
vendor: 17,950 bytes, line 1
1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"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":true,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"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":true,"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":false,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"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":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"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_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"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":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}
vendor: 1,871 bytes, line 1
1,"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"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"}}}');function eZ(i,...r){for(let n of r)for(let r in n)i[r]=n[r];return i}function e$(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function eq(i){if(Array.isArray(i))return i.map(eq);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let r={};for(let n in i)r[n]=eq(i[n]);return r}return e$(i)}
1var eX=class extends Error{constructor(i,r){super(r),this.message=r,this.key=i}};class eW{constructor(i,r=[]){for(let[n,a]of(this.parent=i,this.bindings={},r))this.bindings[n]=a}concat(i){return new eW(this,i)}get(i){if(this.bindings[i])return this.bindings[i];if(this.parent)return this.parent.get(i);throw Error(`${i} not found in scope.`)}has(i){return!!this.bindings[i]||!!this.parent&&this.parent.has(i)}}let eH={kind:"null"},eY={kind:"number"},eK={kind:"string"},eJ={kind:"boolean"},eQ={kind:"color"},e0={kind:"object"},e1={kind:"value"},e2={kind:"collator"},e3={kind:"formatted"},e5={kind:"resolvedImage"};function e4(i,r){return{kind:"array",itemType:i,N:r}}function e6(i){if("array"===i.kind){let r=e6(i.itemType);return"number"==typeof i.N?`array<${r}, ${i.N}>`:"value"===i.itemType.kind?"array":`array<${r}>`}return i.kind}let e8=[eH,eY,eK,eJ,eQ,e3,e0,e4(e1),e5];function e9(i,r){if("error"===r.kind)return null;if("array"===i.kind){if("array"===r.kind&&(0===r.N&&"value"===r.itemType.kind||!e9(i.itemType,r.itemType))&&("number"!=typeof i.N||i.N===r.N))return null}else{if(i.kind===r.kind)return null;if("value"===i.kind){for(let i of e8)if(!e9(i,r))return null}}return`Expected ${e6(i)} but found ${e6(r)} instead.`}function e7(i,r){return r.some(r=>r.kind===i.kind)}function te(i,r){return r.some(r=>"null"===r?null===i:"array"===r?Array.isArray(i):"object"===r?i&&!Array.isArray(i)&&"object"==typeof i:r===typeof i)}function tt(i){var r={exports:{}};return i(r,r.exports),r.exports}var ti=tt(function(i,r){var n={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 a(i){return(i=Math.round(i))<0?0:i>255?255:i}function o(i){return a("%"===i[i.length-1]?parseFloat(i)/100*255:parseInt(i))}function s(i){var r;return(r="%"===i[i.length-1]?parseFloat(i)/100:parseFloat(i))<0?0:r>1?1:r}function l(i,r,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?i+(r-i)*n*6:2*n<1?r:3*n<2?i+(r-i)*(2/3-n)*6:i}try{r.parseCSSColor=function(i){var r,h=i.replace(/ /g,"").toLowerCase();if(h in n)return n[h].slice();if("#"===h[0])return 4===h.length?(r=parseInt(h.substr(1),16))>=0&&r<=4095?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null:7===h.length&&(r=parseInt(h.substr(1),16))>=0&&r<=16777215?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null;var u=h.indexOf("("),c=h.indexOf(")");if(-1!==u&&c+1===h.length){var p=h.substr(0,u),d=h.substr(u+1,c-(u+1)).split(","),f=1;switch(p){case"rgba":if(4!==d.length)break;f=s(d.pop());case"rgb":return 3!==d.length?null:[o(d[0]),o(d[1]),o(d[2]),f];case"hsla":if(4!==d.length)break;f=s(d.pop());case"hsl":if(3!==d.length)break;var m=(parseFloat(d[0])%360+360)%360/360,_=s(d[1]),g=s(d[2]),y=g<=.5?g*(_+1):g+_-g*_,x=2*g-y;return[a(255*l(x,y,m+1/3)),a(255*l(x,y,m)),a(255*l(x,y,m-1/3)),f]}}return null}}catch(i){}});class tr{constructor(i,r,n,a=1){this.r=i,this.g=r,this.b=n,this.a=a}static parse(i){if(!i)return;if(i instanceof tr)return i;if("string"!=typeof i)return;let r=ti.parseCSSColor(i);return r?new tr(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){let[i,r,n,a]=this.toArray();return`rgba(${Math.round(i)},${Math.round(r)},${Math.round(n)},${a})`}toArray(){let{r:i,g:r,b:n,a:a}=this;return 0===a?[0,0,0,0]:[255*i/a,255*r/a,255*n/a,a]}toArray01(){let{r:i,g:r,b:n,a:a}=this;return 0===a?[0,0,0,0]:[i/a,r/a,n/a,a]}toArray01PremultipliedAlpha(){let{r:i,g:r,b:n,a:a}=this;return[i,r,n,a]}}tr.black=new tr(0,0,0,1),tr.white=new tr(1,1,1,1),tr.transparent=new tr(0,0,0,0),tr.red=new tr(1,0,0,1),tr.blue=new tr(0,0,1,1);class tn{constructor(i,r,n){this.sensitivity=i?r?"variant":"case":r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,r){return this.collator.compare(i,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ta{constructor(i,r,n,a,o){this.text=i.normalize?i.normalize():i,this.image=r,this.scale=n,this.fontStack=a,this.textColor=o}}class to{constructor(i){this.sections=i}static fromString(i){return new to([new ta(i,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(i=>0!==i.text.length||i.image&&0!==i.image.name.length)}static factory(i){return i instanceof to?i:to.fromString(i)}toString(){return 0===this.sections.length?"":this.sections.map(i=>i.text).join("")}serialize(){let i=["format"];for(let r of this.sections){if(r.image){i.push(["image",r.image.name]);continue}i.push(r.text);let n={};r.fontStack&&(n["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(n["font-scale"]=r.scale),r.textColor&&(n["text-color"]=["rgba"].concat(r.textColor.toArray())),i.push(n)}return i}}class ts{constructor(i){this.name=i.name,this.available=i.available}toString(){return this.name}static fromString(i){return i?new ts({name:i,available:!1}):null}serialize(){return["image",this.name]}}function tl(i,r,n,a){return"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[i,r,n,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[i,r,n,a]:[i,r,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function th(i){if(null===i||"string"==typeof i||"boolean"==typeof i||"number"==typeof i||i instanceof tr||i instanceof tn||i instanceof to||i instanceof ts)return!0;
1if(Array.isArray(i)){for(let r of i)if(!th(r))return!1;return!0}if("object"==typeof i){for(let r in i)if(!th(i[r]))return!1;return!0}return!1}function tu(i){if(null===i)return eH;if("string"==typeof i)return eK;if("boolean"==typeof i)return eJ;if("number"==typeof i)return eY;if(i instanceof tr)return eQ;if(i instanceof tn)return e2;if(i instanceof to)return e3;if(i instanceof ts)return e5;if(Array.isArray(i)){let r;let n=i.length;for(let n of i){let i=tu(n);if(r){if(r===i)continue;r=e1;break}r=i}return e4(r||e1,n)}return e0}function tc(i){let r=typeof i;return null===i?"":"string"===r||"number"===r||"boolean"===r?String(i):i instanceof tr||i instanceof to||i instanceof ts?i.toString():JSON.stringify(i)}class tp{constructor(i,r){this.type=i,this.value=r}static parse(i,r){if(2!==i.length)return r.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!th(i[1]))return r.error("invalid value");let n=i[1],a=tu(n),o=r.expectedType;return"array"===a.kind&&0===a.N&&o&&"array"===o.kind&&("number"!=typeof o.N||0===o.N)&&(a=o),new tp(a,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof tr?["rgba"].concat(this.value.toArray()):this.value instanceof to?this.value.serialize():this.value}}var td=class{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}};let tf={string:eK,number:eY,boolean:eJ,object:e0};class tm{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let n,a=1,o=i[0];if("array"===o){let o,s;if(i.length>2){let n=i[1];if("string"!=typeof n||!(n in tf)||"object"===n)return r.error('The item type argument of "array" must be one of string, number, boolean',1);o=tf[n],a++}else o=e1;if(i.length>3){if(null!==i[2]&&("number"!=typeof i[2]||i[2]<0||i[2]!==Math.floor(i[2])))return r.error('The length argument to "array" must be a positive integer literal',2);s=i[2],a++}n=e4(o,s)}else n=tf[o];let s=[];for(;a<i.length;a++){let n=r.parse(i[a],a,e1);if(!n)return null;s.push(n)}return new tm(n,s)}evaluate(i){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(i);if(!e9(this.type,tu(n)))return n;if(r===this.args.length-1)throw new td(`Expected value to be of type ${e6(this.type)}, but found ${e6(tu(n))} instead.`)}return null}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){let i=this.type,r=[i.kind];if("array"===i.kind){let n=i.itemType;if("string"===n.kind||"number"===n.kind||"boolean"===n.kind){r.push(n.kind);let a=i.N;("number"==typeof a||this.args.length>1)&&r.push(a)}}return r.concat(this.args.map(i=>i.serialize()))}}class t_{constructor(i){this.type=e3,this.sections=i}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let n=i[1];if(!Array.isArray(n)&&"object"==typeof n)return r.error("First argument must be an image or text section.");let a=[],o=!1;for(let n=1;n<=i.length-1;++n){let s=i[n];if(o&&"object"==typeof s&&!Array.isArray(s)){o=!1;let i=null;if(s["font-scale"]&&!(i=r.parse(s["font-scale"],1,eY)))return null;let n=null;if(s["text-font"]&&!(n=r.parse(s["text-font"],1,e4(eK))))return null;let l=null;if(s["text-color"]&&!(l=r.parse(s["text-color"],1,eQ)))return null;let h=a[a.length-1];h.scale=i,h.font=n,h.textColor=l}else{let s=r.parse(i[n],1,e1);if(!s)return null;let l=s.type.kind;if("string"!==l&&"value"!==l&&"null"!==l&&"resolvedImage"!==l)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,a.push({content:s,scale:null,font:null,textColor:null})}}return new t_(a)}evaluate(i){return new to(this.sections.map(r=>{let n=r.content.evaluate(i);return tu(n)===e5?new ta("",n,null,null,null):new ta(tc(n),null,r.scale?r.scale.evaluate(i):null,r.font?r.font.evaluate(i).join(","):null,r.textColor?r.textColor.evaluate(i):null)}))}eachChild(i){for(let r of this.sections)i(r.content),r.scale&&i(r.scale),r.font&&i(r.font),r.textColor&&i(r.textColor)}outputDefined(){return!1}serialize(){let i=["format"];for(let r of this.sections){i.push(r.content.serialize());let n={};r.scale&&(n["font-scale"]=r.scale.serialize()),r.font&&(n["text-font"]=r.font.serialize()),r.textColor&&(n["text-color"]=r.textColor.serialize()),i.push(n)}return i}}class tg{constructor(i){this.type=e5,this.input=i}static parse(i,r){if(2!==i.length)return r.error("Expected two arguments.");let n=r.parse(i[1],1,eK);return n?new tg(n):r.error("No image name provided.")}evaluate(i){let r=this.input.evaluate(i),n=ts.fromString(r);return n&&i.availableImages&&(n.available=i.availableImages.indexOf(r)>-1),n}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}let ty={"to-boolean":eJ,"to-color":eQ,"to-number":eY,"to-string":eK};class tx{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let n=i[0];if(("to-boolean"===n||"to-string"===n)&&2!==i.length)return r.error("Expected one argument.");let a=ty[n],o=[];for(let n=1;n<i.length;n++){let a=r.parse(i[n],n,e1);if(!a)return null;o.push(a)}return new tx(a,o)}evaluate(i){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(i));if("color"===this.type.kind){let r,n;for(let a of this.args){if(r=a.evaluate(i),n=null,r instanceof tr)return r;if("string"==typeof r){let n=i.parseColor(r);if(n)return n}else if(Array.isArray(r)&&!(n=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:tl(r[0],r[1],r[2],r[3])))return new tr(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new td(n||`Could not parse color from value '${"string"==typeof r?r:String(JSON.stringify(r))}'`)}if("number"===this.type.kind){let r=null;for(let n of this.args){if(null===(r=n.evaluate(i)))return 0;let a=Number(r);
1if(!isNaN(a))return a}throw new td(`Could not convert ${JSON.stringify(r)} to number.`)}return"formatted"===this.type.kind?to.fromString(tc(this.args[0].evaluate(i))):"resolvedImage"===this.type.kind?ts.fromString(tc(this.args[0].evaluate(i))):tc(this.args[0].evaluate(i))}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){if("formatted"===this.type.kind)return new t_([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new tg(this.args[0]).serialize();let i=[`to-${this.type.kind}`];return this.eachChild(r=>{i.push(r.serialize())}),i}}let tv=["Unknown","Point","LineString","Polygon"];var tb=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?tv[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||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){let i=this.featureDistanceData.center,r=this.featureDistanceData.scale,{x:n,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*r-i[0])+this.featureDistanceData.bearing[1]*(a*r-i[1])}return 0}parseColor(i){let r=this._parseColorCache[i];return r||(r=this._parseColorCache[i]=tr.parse(i)),r}};class tw{constructor(i,r,n,a){this.name=i,this.type=r,this._evaluate=n,this.args=a}evaluate(i){return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(i=>i.serialize()))}static parse(i,r){let n=i[0],a=tw.definitions[n];if(!a)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(a)?a[0]:a.type,s=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,l=s.filter(([r])=>!Array.isArray(r)||r.length===i.length-1),h=null;for(let[a,s]of l){h=new tV(r.registry,r.path,null,r.scope);let l=[],u=!1;for(let r=1;r<i.length;r++){let n=i[r],o=Array.isArray(a)?a[r-1]:a.type,s=h.parse(n,1+l.length,o);if(!s){u=!0;break}l.push(s)}if(!u){if(Array.isArray(a)&&a.length!==l.length)h.error(`Expected ${a.length} arguments, but found ${l.length} instead.`);else{for(let i=0;i<l.length;i++){let r=Array.isArray(a)?a[i]:a.type,n=l[i];h.concat(i+1).checkSubtype(r,n.type)}if(0===h.errors.length)return new tw(n,o,s,l)}}}if(1===l.length)r.errors.push(...h.errors);else{let n=(l.length?l:s).map(([i])=>Array.isArray(i)?`(${i.map(e6).join(", ")})`:`(${e6(i.type)}...)`).join(" | "),a=[];for(let n=1;n<i.length;n++){let o=r.parse(i[n],1+a.length);if(!o)return null;a.push(e6(o.type))}r.error(`Expected arguments of type ${n}, but found (${a.join(", ")}) instead.`)}return null}static register(i,r){for(let n in tw.definitions=r,r)i[n]=tw}}class tT{constructor(i,r,n){this.type=e2,this.locale=n,this.caseSensitive=i,this.diacriticSensitive=r}static parse(i,r){if(2!==i.length)return r.error("Expected one argument.");let n=i[1];if("object"!=typeof n||Array.isArray(n))return r.error("Collator options argument must be an object.");let a=r.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,eJ);if(!a)return null;let o=r.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,eJ);if(!o)return null;let s=null;return!n.locale||(s=r.parse(n.locale,1,eK))?new tT(a,o,s):null}evaluate(i){return new tn(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}serialize(){let i={};return i["case-sensitive"]=this.caseSensitive.serialize(),i["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(i.locale=this.locale.serialize()),["collator",i]}}function tE(i,r){i[0]=Math.min(i[0],r[0]),i[1]=Math.min(i[1],r[1]),i[2]=Math.max(i[2],r[0]),i[3]=Math.max(i[3],r[1])}function tS(i,r){return!(i[0]<=r[0]||i[2]>=r[2]||i[1]<=r[1]||i[3]>=r[3])}function tI(i,r){var n,a;let o=!1;for(let s=0,l=r.length;s<l;s++){let l=r[s];for(let r=0,s=l.length;r<s-1;r++){if(function(i,r,n){let a=i[0]-r[0],o=i[1]-r[1],s=i[0]-n[0],l=i[1]-n[1];return a*l-s*o==0&&a*s<=0&&o*l<=0}(i,l[r],l[r+1]))return!1;(n=l[r])[1]>i[1]!=(a=l[r+1])[1]>i[1]&&i[0]<(a[0]-n[0])*(i[1]-n[1])/(a[1]-n[1])+n[0]&&(o=!o)}}return o}function tA(i,r,n,a){let o=a[0]-n[0],s=a[1]-n[1],l=(i[0]-n[0])*s-o*(i[1]-n[1]),h=(r[0]-n[0])*s-o*(r[1]-n[1]);return l>0&&h<0||l<0&&h>0}function tM(i,r){for(let n=0;n<i.length;++n)if(!tI(i[n],r))return!1;for(let n=0;n<i.length-1;++n)if(function(i,r,n){var a,o,s,l;for(let h of n)for(let n=0;n<h.length-1;++n)if(0!=(s=[(o=h[n+1])[0]-(a=h[n])[0],o[1]-a[1]])[0]*(l=[r[0]-i[0],r[1]-i[1]])[1]-s[1]*l[0]&&tA(i,r,a,o)&&tA(a,o,i,r))return!0;return!1}(i[n],i[n+1],r))return!1;return!0}function tC(i,r,n){let a=[];for(let o=0;o<i.length;o++){let s=[];for(let a=0;a<i[o].length;a++){let l=function(i,r){let n=(180+i[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,o=Math.pow(2,r.z);return[Math.round(n*o*8192),Math.round(a*o*8192)]}(i[o][a],n);tE(r,l),s.push(l)}a.push(s)}return a}function tz(i,r,n){let a=[];for(let o=0;o<i.length;o++){let s=tC(i[o],r,n);a.push(s)}return a}function tP(i,r,n,a){if(i[0]<n[0]||i[0]>n[2]){let r=.5*a,o=i[0]-n[0]>r?-a:n[0]-i[0]>r?a:0;0===o&&(o=i[0]-n[2]>r?-a:n[2]-i[0]>r?a:0),i[0]+=o}tE(r,i)}function tk(i,r,n,a){let o=8192*Math.pow(2,a.z),s=[8192*a.x,8192*a.y],l=[];
1if(!i)return l;for(let a of i)for(let i of a){let a=[i.x+s[0],i.y+s[1]];tP(a,r,n,o),l.push(a)}return l}function tD(i,r,n,a){var o;let s=8192*Math.pow(2,a.z),l=[8192*a.x,8192*a.y],h=[];if(!i)return h;for(let n of i){let i=[];for(let a of n){let n=[a.x+l[0],a.y+l[1]];tE(r,n),i.push(n)}h.push(i)}if(r[2]-r[0]<=s/2)for(let i of((o=r)[0]=o[1]=1/0,o[2]=o[3]=-1/0,h))for(let a of i)tP(a,r,n,s);return h}class tL{constructor(i,r){this.type=eJ,this.geojson=i,this.geometries=r}static parse(i,r){if(2!==i.length)return r.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(th(i[1])){let r=i[1];if("FeatureCollection"===r.type)for(let i=0;i<r.features.length;++i){let n=r.features[i].geometry.type;if("Polygon"===n||"MultiPolygon"===n)return new tL(r,r.features[i].geometry)}else if("Feature"===r.type){let i=r.geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new tL(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new tL(r,r)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(null!=i.geometry()&&null!=i.canonicalID()){if("Point"===i.geometryType())return function(i,r){let n=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],o=i.canonicalID();if(!o)return!1;if("Polygon"===r.type){let s=tC(r.coordinates,a,o),l=tk(i.geometry(),n,a,o);if(!tS(n,a))return!1;for(let i of l)if(!tI(i,s))return!1}if("MultiPolygon"===r.type){let s=tz(r.coordinates,a,o),l=tk(i.geometry(),n,a,o);if(!tS(n,a))return!1;for(let i of l)if(!function(i,r){for(let n=0;n<r.length;n++)if(tI(i,r[n]))return!0;return!1}(i,s))return!1}return!0}(i,this.geometries);if("LineString"===i.geometryType())return function(i,r){let n=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],o=i.canonicalID();if(!o)return!1;if("Polygon"===r.type){let s=tC(r.coordinates,a,o),l=tD(i.geometry(),n,a,o);if(!tS(n,a))return!1;for(let i of l)if(!tM(i,s))return!1}if("MultiPolygon"===r.type){let s=tz(r.coordinates,a,o),l=tD(i.geometry(),n,a,o);if(!tS(n,a))return!1;for(let i of l)if(!function(i,r){for(let n=0;n<r.length;n++)if(tM(i,r[n]))return!0;return!1}(i,s))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function tB(i){if(i instanceof tw&&("get"===i.name&&1===i.args.length||"feature-state"===i.name||"has"===i.name&&1===i.args.length||"properties"===i.name||"geometry-type"===i.name||"id"===i.name||/^filter-/.test(i.name))||i instanceof tL)return!1;let r=!0;return i.eachChild(i=>{r&&!tB(i)&&(r=!1)}),r}function tR(i){if(i instanceof tw&&"feature-state"===i.name)return!1;let r=!0;return i.eachChild(i=>{r&&!tR(i)&&(r=!1)}),r}function tF(i,r){if(i instanceof tw&&r.indexOf(i.name)>=0)return!1;let n=!0;return i.eachChild(i=>{n&&!tF(i,r)&&(n=!1)}),n}class tO{constructor(i,r){this.type=r.type,this.name=i,this.boundExpression=r}static parse(i,r){if(2!==i.length||"string"!=typeof i[1])return r.error("'var' expression requires exactly one string literal argument.");let n=i[1];return r.scope.has(n)?new tO(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class tU{constructor(i,r=[],n,a=new eW,o=[]){this.registry=i,this.path=r,this.key=r.map(i=>`[${i}]`).join(""),this.scope=a,this.errors=o,this.expectedType=n}parse(i,r,n,a,o={}){return r?this.concat(r,n,a)._parse(i,o):this._parse(i,o)}_parse(i,r){function n(i,r,n){return"assert"===n?new tm(r,[i]):"coerce"===n?new tx(r,[i]):i}if(null!==i&&"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i||(i=["literal",i]),Array.isArray(i)){if(0===i.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let a=i[0];if("string"!=typeof a)return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let o=this.registry[a];if(o){let a=o.parse(i,this);if(!a)return null;if(this.expectedType){let i=this.expectedType,o=a.type;if("string"!==i.kind&&"number"!==i.kind&&"boolean"!==i.kind&&"object"!==i.kind&&"array"!==i.kind||"value"!==o.kind){if("color"!==i.kind&&"formatted"!==i.kind&&"resolvedImage"!==i.kind||"value"!==o.kind&&"string"!==o.kind){if(this.checkSubtype(i,o))return null}else a=n(a,i,r.typeAnnotation||"coerce")}else a=n(a,i,r.typeAnnotation||"assert")}if(!(a instanceof tp)&&"resolvedImage"!==a.type.kind&&function i(r){if(r instanceof tO)return i(r.boundExpression);if(r instanceof tw&&"error"===r.name||r instanceof tT||r instanceof tL)return!1;let n=r instanceof tx||r instanceof tm,a=!0;return r.eachChild(r=>{a=n?a&&i(r):a&&r instanceof tp}),!!a&&tB(r)&&tF(r,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}(a)){let i=new tb;try{a=new tp(a.type,a.evaluate(i))}catch(i){return this.error(i.message),null}}return a}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===i?"'undefined' value invalid. Use null instead.":"object"==typeof i?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,r,n){let a="number"==typeof i?this.path.concat(i):this.path,o=n?this.scope.concat(n):this.scope;return new tU(this.registry,a,r||null,o,this.errors)}error(i,...r){let n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new eX(n,i))}checkSubtype(i,r){let n=e9(i,r);return n&&this.error(n),n}}var tV=tU;function tj(i,r){let n=i.length-1,a,o,s=0,l=n,h=0;for(;s<=l;)if(a=i[h=Math.floor((s+l)/2)],o=i[h+1],a<=r){if(h===n||r<o)return h;s=h+1}else{if(!(a>r))throw new td("Input is not a number.");l=h-1}return 0}
1class tN{constructor(i,r,n){for(let[a,o]of(this.type=i,this.input=r,this.labels=[],this.outputs=[],n))this.labels.push(a),this.outputs.push(o)}static parse(i,r){if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");let n=r.parse(i[1],1,eY);if(!n)return null;let a=[],o=null;r.expectedType&&"value"!==r.expectedType.kind&&(o=r.expectedType);for(let n=1;n<i.length;n+=2){let s=1===n?-1/0:i[n],l=i[n+1],h=n,u=n+1;if("number"!=typeof s)return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',h);if(a.length&&a[a.length-1][0]>=s)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',h);let c=r.parse(l,u,o);if(!c)return null;o=o||c.type,a.push([s,c])}return new tN(o,n,a)}evaluate(i){let r=this.labels,n=this.outputs;if(1===r.length)return n[0].evaluate(i);let a=this.input.evaluate(i);if(a<=r[0])return n[0].evaluate(i);let o=r.length;return a>=r[o-1]?n[o-1].evaluate(i):n[tj(r,a)].evaluate(i)}eachChild(i){for(let r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i=["step",this.input.serialize()];for(let r=0;r<this.labels.length;r++)r>0&&i.push(this.labels[r]),i.push(this.outputs[r].serialize());return i}}function tG(i,r,n){return i*(1-n)+r*n}function tZ(i,r,n){return i.map((i,a)=>tG(i,r[a],n))}var t$=Object.freeze({__proto__:null,number:tG,color:function(i,r,n){return new tr(tG(i.r,r.r,n),tG(i.g,r.g,n),tG(i.b,r.b,n),tG(i.a,r.a,n))},array:tZ});let tq=4/29,tX=6/29,tW=3*tX*tX,tH=Math.PI/180,tY=180/Math.PI;function tK(i){return i>.008856451679035631?Math.pow(i,1/3):i/tW+tq}function tJ(i){return i>tX?i*i*i:tW*(i-tq)}function tQ(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function t0(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function t1(i){let r=t0(i.r),n=t0(i.g),a=t0(i.b),o=tK((.4124564*r+.3575761*n+.1804375*a)/.95047),s=tK((.2126729*r+.7151522*n+.072175*a)/1);return{l:116*s-16,a:500*(o-s),b:200*(s-tK((.0193339*r+.119192*n+.9503041*a)/1.08883)),alpha:i.a}}function t2(i){let r=(i.l+16)/116,n=isNaN(i.a)?r:r+i.a/500,a=isNaN(i.b)?r:r-i.b/200;return r=1*tJ(r),n=.95047*tJ(n),a=1.08883*tJ(a),new tr(tQ(3.2404542*n-1.5371385*r-.4985314*a),tQ(-.969266*n+1.8760108*r+.041556*a),tQ(.0556434*n-.2040259*r+1.0572252*a),i.alpha)}let t3={forward:t1,reverse:t2,interpolate:function(i,r,n){return{l:tG(i.l,r.l,n),a:tG(i.a,r.a,n),b:tG(i.b,r.b,n),alpha:tG(i.alpha,r.alpha,n)}}},t5={forward:function(i){let{l:r,a:n,b:a}=t1(i),o=Math.atan2(a,n)*tY;return{h:o<0?o+360:o,c:Math.sqrt(n*n+a*a),l:r,alpha:i.a}},reverse:function(i){let r=i.h*tH,n=i.c;return t2({l:i.l,a:Math.cos(r)*n,b:Math.sin(r)*n,alpha:i.alpha})},interpolate:function(i,r,n){return{h:function(i,r,n){let a=r-i;return i+n*(a>180||a<-180?a-360*Math.round(a/360):a)}(i.h,r.h,n),c:tG(i.c,r.c,n),l:tG(i.l,r.l,n),alpha:tG(i.alpha,r.alpha,n)}}};var t4=Object.freeze({__proto__:null,lab:t3,hcl:t5});class t6{constructor(i,r,n,a,o){for(let[s,l]of(this.type=i,this.operator=r,this.interpolation=n,this.input=a,this.labels=[],this.outputs=[],o))this.labels.push(s),this.outputs.push(l)}static interpolationFactor(i,r,n,a){let o=0;if("exponential"===i.name)o=t8(r,i.base,n,a);else if("linear"===i.name)o=t8(r,1,n,a);else if("cubic-bezier"===i.name){let s=i.controlPoints;o=new d(s[0],s[1],s[2],s[3]).solve(t8(r,1,n,a))}return o}static parse(i,r){let[n,a,o,...s]=i;if(!Array.isArray(a)||0===a.length)return r.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){let i=a[1];if("number"!=typeof i)return r.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:i}}else{if("cubic-bezier"!==a[0])return r.error(`Unknown interpolation type ${String(a[0])}`,1,0);{let i=a.slice(1);if(4!==i.length||i.some(i=>"number"!=typeof i||i<0||i>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:i}}}if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(!(o=r.parse(o,2,eY)))return null;let l=[],h=null;"interpolate-hcl"===n||"interpolate-lab"===n?h=eQ:r.expectedType&&"value"!==r.expectedType.kind&&(h=r.expectedType);for(let i=0;i<s.length;i+=2){let n=s[i],a=s[i+1],o=i+3,u=i+4;if("number"!=typeof n)return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',o);if(l.length&&l[l.length-1][0]>=n)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);let c=r.parse(a,u,h);if(!c)return null;h=h||c.type,l.push([n,c])}return"number"===h.kind||"color"===h.kind||"array"===h.kind&&"number"===h.itemType.kind&&"number"==typeof h.N?new t6(h,n,a,o,l):r.error(`Type ${e6(h)} is not interpolatable.`)}evaluate(i){let r=this.labels,n=this.outputs;if(1===r.length)return n[0].evaluate(i);let a=this.input.evaluate(i);if(a<=r[0])return n[0].evaluate(i);let o=r.length;if(a>=r[o-1])return n[o-1].evaluate(i);let s=tj(r,a),l=t6.interpolationFactor(this.interpolation,a,r[s],r[s+1]),h=n[s].evaluate(i),u=n[s+1].evaluate(i);return"interpolate"===this.operator?t$[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?t5.reverse(t5.interpolate(t5.forward(h),t5.forward(u),l)):t3.reverse(t3.interpolate(t3.forward(h),t3.forward(u),l))}eachChild(i){for(let r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i;i="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);let r=[this.operator,i,this.input.serialize()];for(let i=0;i<this.labels.length;i++)r.push(this.labels[i],this.outputs[i].serialize());return r}}function t8(i,r,n,a){let o=a-n,s=i-n;return 0===o?0:1===r?s/o:(Math.pow(r,s)-1)/(Math.pow(r,o)-1)}class t9{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expectected at least one argument.");let n=null,a=r.expectedType;a&&"value"!==a.kind&&(n=a);let o=[];for(let a of i.slice(1)){let i=r.parse(a,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!i)return null;n=n||i.type,o.push(i)}let s=a&&o.some(i=>e9(a,i.type));return new t9(s?e1:n,o)}evaluate(i){let r,n=null,a=0;for(let o of this.args){if(a++,(n=o.evaluate(i))&&n instanceof ts&&!n.available&&(r||(r=n),n=null,a===this.args.length))return r;if(null!==n)break}return n}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){let i=["coalesce"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class t7{constructor(i,r){this.type=r.type,this.bindings=[].concat(i),this.result=r}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(let r of this.bindings)i(r[1]);i(this.result)}static parse(i,r){if(i.length<4)return r.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);let n=[];for(let a=1;a<i.length-1;a+=2){let o=i[a];if("string"!=typeof o)return r.error(`Expected string, but found ${typeof o} instead.`,a);if(/[^a-zA-Z0-9_]/.test(o))return r.error("Variable names must contain only alphanumeric characters or '_'.",a);let s=r.parse(i[a+1],a+1);if(!s)return null;n.push([o,s])}let a=r.parse(i[i.length-1],i.length-1,r.expectedType,n);return a?new t7(n,a):null}outputDefined(){return this.result.outputDefined()}serialize(){let i=["let"];for(let[r,n]of this.bindings)i.push(r,n.serialize());return i.push(this.result.serialize()),i}}class ie{constructor(i,r,n){this.type=i,this.index=r,this.input=n}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let n=r.parse(i[1],1,eY),a=r.parse(i[2],2,e4(r.expectedType||e1));return n&&a?new ie(a.type.itemType,n,a):null}evaluate(i){let r=this.index.evaluate(i),n=this.input.evaluate(i);if(r<0)throw new td(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new td(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new td(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class it{constructor(i,r){this.type=eJ,this.needle=i,this.haystack=r}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let n=r.parse(i[1],1,e1),a=r.parse(i[2],2,e1);return n&&a?e7(n.type,[eJ,eK,eY,eH,e1])?new it(n,a):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${e6(n.type)} instead`):null}evaluate(i){let r=this.needle.evaluate(i),n=this.haystack.evaluate(i);if(null==n)return!1;if(!te(r,["boolean","string","number","null"]))throw new td(`Expected first argument to be of type boolean, string, number or null, but found ${e6(tu(r))} instead.`);if(!te(n,["string","array"]))throw new td(`Expected second argument to be of type array or string, but found ${e6(tu(n))} instead.`);return n.indexOf(r)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class ii{constructor(i,r,n){this.type=eY,this.needle=i,this.haystack=r,this.fromIndex=n}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);let n=r.parse(i[1],1,e1),a=r.parse(i[2],2,e1);if(!n||!a)return null;if(!e7(n.type,[eJ,eK,eY,eH,e1]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${e6(n.type)} instead`);if(4===i.length){let o=r.parse(i[3],3,eY);return o?new ii(n,a,o):null}return new ii(n,a)}evaluate(i){let r=this.needle.evaluate(i),n=this.haystack.evaluate(i);if(!te(r,["boolean","string","number","null"]))throw new td(`Expected first argument to be of type boolean, string, number or null, but found ${e6(tu(r))} instead.`);if(!te(n,["string","array"]))throw new td(`Expected second argument to be of type array or string, but found ${e6(tu(n))} instead.`);if(this.fromIndex){let a=this.fromIndex.evaluate(i);return n.indexOf(r,a)}return n.indexOf(r)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){let i=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),i]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class ir{constructor(i,r,n,a,o,s){this.inputType=i,this.type=r,this.input=n,this.cases=a,this.outputs=o,this.otherwise=s}static parse(i,r){let n,a;if(i.length<5)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return r.error("Expected an even number of arguments.");r.expectedType&&"value"!==r.expectedType.kind&&(a=r.expectedType);let o={},s=[];for(let l=2;l<i.length-1;l+=2){let h=i[l],u=i[l+1];Array.isArray(h)||(h=[h]);let c=r.concat(l);
1if(0===h.length)return c.error("Expected at least one branch label.");for(let i of h){if("number"!=typeof i&&"string"!=typeof i)return c.error("Branch labels must be numbers or strings.");if("number"==typeof i&&Math.abs(i)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof i&&Math.floor(i)!==i)return c.error("Numeric branch labels must be integer values.");if(n){if(c.checkSubtype(n,tu(i)))return null}else n=tu(i);if(void 0!==o[String(i)])return c.error("Branch labels must be unique.");o[String(i)]=s.length}let p=r.parse(u,l,a);if(!p)return null;a=a||p.type,s.push(p)}let l=r.parse(i[1],1,e1);if(!l)return null;let h=r.parse(i[i.length-1],i.length-1,a);return h?"value"!==l.type.kind&&r.concat(1).checkSubtype(n,l.type)?null:new ir(n,a,l,o,s,h):null}evaluate(i){let r=this.input.evaluate(i);return(tu(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){let i=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),n=[],a={};for(let i of r){let r=a[this.cases[i]];void 0===r?(a[this.cases[i]]=n.length,n.push([this.cases[i],[i]])):n[r][1].push(i)}let o=i=>"number"===this.inputType.kind?Number(i):i;for(let[r,a]of n)i.push(1===a.length?o(a[0]):a.map(o)),i.push(this.outputs[r].serialize());return i.push(this.otherwise.serialize()),i}}class ia{constructor(i,r,n){this.type=i,this.branches=r,this.otherwise=n}static parse(i,r){let n;if(i.length<4)return r.error(`Expected at least 3 arguments, but found only ${i.length-1}.`);if(i.length%2!=0)return r.error("Expected an odd number of arguments.");r.expectedType&&"value"!==r.expectedType.kind&&(n=r.expectedType);let a=[];for(let o=1;o<i.length-1;o+=2){let s=r.parse(i[o],o,eJ);if(!s)return null;let l=r.parse(i[o+1],o+1,n);if(!l)return null;a.push([s,l]),n=n||l.type}let o=r.parse(i[i.length-1],i.length-1,n);return o?new ia(n,a,o):null}evaluate(i){for(let[r,n]of this.branches)if(r.evaluate(i))return n.evaluate(i);return this.otherwise.evaluate(i)}eachChild(i){for(let[r,n]of this.branches)i(r),i(n);i(this.otherwise)}outputDefined(){return this.branches.every(([i,r])=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){let i=["case"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class io{constructor(i,r,n,a){this.type=i,this.input=r,this.beginIndex=n,this.endIndex=a}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`);let n=r.parse(i[1],1,e1),a=r.parse(i[2],2,eY);if(!n||!a)return null;if(!e7(n.type,[e4(e1),eK,e1]))return r.error(`Expected first argument to be of type array or string, but found ${e6(n.type)} instead`);if(4===i.length){let o=r.parse(i[3],3,eY);return o?new io(n.type,n,a,o):null}return new io(n.type,n,a)}evaluate(i){let r=this.input.evaluate(i),n=this.beginIndex.evaluate(i);if(!te(r,["string","array"]))throw new td(`Expected first argument to be of type array or string, but found ${e6(tu(r))} instead.`);if(this.endIndex){let a=this.endIndex.evaluate(i);return r.slice(n,a)}return r.slice(n)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){let i=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),i]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function is(i,r){return"=="===i||"!="===i?"boolean"===r.kind||"string"===r.kind||"number"===r.kind||"null"===r.kind||"value"===r.kind:"string"===r.kind||"number"===r.kind||"value"===r.kind}function il(i,r,n,a){return 0===a.compare(r,n)}function ih(i,r,n){let a="=="!==i&&"!="!==i;return class o{constructor(i,r,n){this.type=eJ,this.lhs=i,this.rhs=r,this.collator=n,this.hasUntypedArgument="value"===i.type.kind||"value"===r.type.kind}static parse(i,r){if(3!==i.length&&4!==i.length)return r.error("Expected two or three arguments.");let n=i[0],s=r.parse(i[1],1,e1);if(!s)return null;if(!is(n,s.type))return r.concat(1).error(`"${n}" comparisons are not supported for type '${e6(s.type)}'.`);let l=r.parse(i[2],2,e1);if(!l)return null;if(!is(n,l.type))return r.concat(2).error(`"${n}" comparisons are not supported for type '${e6(l.type)}'.`);if(s.type.kind!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error(`Cannot compare types '${e6(s.type)}' and '${e6(l.type)}'.`);a&&("value"===s.type.kind&&"value"!==l.type.kind?s=new tm(l.type,[s]):"value"!==s.type.kind&&"value"===l.type.kind&&(l=new tm(s.type,[l])));let h=null;if(4===i.length){if("string"!==s.type.kind&&"string"!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error("Cannot use collator to compare non-string types.");if(!(h=r.parse(i[3],3,e2)))return null}return new o(s,l,h)}evaluate(o){let s=this.lhs.evaluate(o),l=this.rhs.evaluate(o);if(a&&this.hasUntypedArgument){let r=tu(s),n=tu(l);if(r.kind!==n.kind||"string"!==r.kind&&"number"!==r.kind)throw new td(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${r.kind}, ${n.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let i=tu(s),n=tu(l);if("string"!==i.kind||"string"!==n.kind)return r(o,s,l)}return this.collator?n(o,s,l,this.collator.evaluate(o)):r(o,s,l)}eachChild(i){i(this.lhs),i(this.rhs),this.collator&&i(this.collator)}outputDefined(){return!0}serialize(){let r=[i];return this.eachChild(i=>{r.push(i.serialize())}),r}}}let iu=ih("==",function(i,r,n){return r===n},il),ic=ih("!=",function(i,r,n){return r!==n},function(i,r,n,a){return!il(0,r,n,a)}),ip=ih("<",function(i,r,n){return r<n},function(i,r,n,a){return 0>a.compare(r,n)}),id=ih(">",function(i,r,n){return r>n},function(i,r,n,a){return a.compare(r,n)>0}
1),im=ih("<=",function(i,r,n){return r<=n},function(i,r,n,a){return 0>=a.compare(r,n)}),i_=ih(">=",function(i,r,n){return r>=n},function(i,r,n,a){return a.compare(r,n)>=0});class ig{constructor(i,r,n,a,o,s){this.type=eK,this.number=i,this.locale=r,this.currency=n,this.unit=a,this.minFractionDigits=o,this.maxFractionDigits=s}static parse(i,r){if(3!==i.length)return r.error("Expected two arguments.");let n=r.parse(i[1],1,eY);if(!n)return null;let a=i[2];if("object"!=typeof a||Array.isArray(a))return r.error("NumberFormat options argument must be an object.");let o=null;if(a.locale&&!(o=r.parse(a.locale,1,eK)))return null;let s=null;if(a.currency&&!(s=r.parse(a.currency,1,eK)))return null;let l=null;if(a.unit&&!(l=r.parse(a.unit,1,eK)))return null;let h=null;if(a["min-fraction-digits"]&&!(h=r.parse(a["min-fraction-digits"],1,eY)))return null;let u=null;return!a["max-fraction-digits"]||(u=r.parse(a["max-fraction-digits"],1,eY))?new ig(n,o,s,l,h,u):null}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(i):void 0,unit:this.unit?this.unit.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.unit&&i(this.unit),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let i={};return this.locale&&(i.locale=this.locale.serialize()),this.currency&&(i.currency=this.currency.serialize()),this.unit&&(i.unit=this.unit.serialize()),this.minFractionDigits&&(i["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(i["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),i]}}class iy{constructor(i){this.type=eY,this.input=i}static parse(i,r){if(2!==i.length)return r.error(`Expected 1 argument, but found ${i.length-1} instead.`);let n=r.parse(i[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?r.error(`Expected argument of type string or array, but found ${e6(n.type)} instead.`):new iy(n):null}evaluate(i){let r=this.input.evaluate(i);if("string"==typeof r||Array.isArray(r))return r.length;throw new td(`Expected value to be of type string or array, but found ${e6(tu(r))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){let i=["length"];return this.eachChild(r=>{i.push(r.serialize())}),i}}let ix={"==":iu,"!=":ic,">":id,"<":ip,">=":i_,"<=":im,array:tm,at:ie,boolean:tm,case:ia,coalesce:t9,collator:tT,format:t_,image:tg,in:it,"index-of":ii,interpolate:t6,"interpolate-hcl":t6,"interpolate-lab":t6,length:iy,let:t7,literal:tp,match:ir,number:tm,"number-format":ig,object:tm,slice:io,step:tN,string:tm,"to-boolean":tx,"to-color":tx,"to-number":tx,"to-string":tx,var:tO,within:tL};function iv(i,[r,n,a,o]){r=r.evaluate(i),n=n.evaluate(i),a=a.evaluate(i);let s=o?o.evaluate(i):1,l=tl(r,n,a,s);if(l)throw new td(l);return new tr(r/255*s,n/255*s,a/255*s,s)}function ib(i,r){let n=r[i];return void 0===n?null:n}function iw(i){return{type:i}}function iT(i){return{result:"success",value:i}}function iE(i){return{result:"error",value:i}}function iS(i){return"data-driven"===i["property-type"]||"cross-faded-data-driven"===i["property-type"]}function iI(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function iA(i){return!!i.expression&&i.expression.interpolated}function iM(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":null===i?"null":typeof i}function iC(i){return"object"==typeof i&&null!==i&&!Array.isArray(i)}function iz(i){return i}function iP(i,r,n){return void 0!==i?i:void 0!==r?r:void 0!==n?n:void 0}function ik(i,r,n,a,o){return iP(typeof n===o?a[n]:void 0,i.default,r.default)}function iD(i,r,n){if("number"!==iM(n))return iP(i.default,r.default);let a=i.stops.length;if(1===a||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[a-1][0])return i.stops[a-1][1];let o=tj(i.stops.map(i=>i[0]),n);return i.stops[o][1]}function iL(i,r,n){let a=void 0!==i.base?i.base:1;if("number"!==iM(n))return iP(i.default,r.default);let o=i.stops.length;if(1===o||n<=i.stops[0][0])return i.stops[0][1];if(n>=i.stops[o-1][0])return i.stops[o-1][1];let s=tj(i.stops.map(i=>i[0]),n),l=function(i,r,n,a){let o=a-n,s=i-n;return 0===o?0:1===r?s/o:(Math.pow(r,s)-1)/(Math.pow(r,o)-1)}(n,a,i.stops[s][0],i.stops[s+1][0]),h=i.stops[s][1],u=i.stops[s+1][1],c=t$[r.type]||iz;
1if(i.colorSpace&&"rgb"!==i.colorSpace){let r=t4[i.colorSpace];c=(i,n)=>r.reverse(r.interpolate(r.forward(i),r.forward(n),l))}return"function"==typeof h.evaluate?{evaluate(...i){let r=h.evaluate.apply(void 0,i),n=u.evaluate.apply(void 0,i);if(void 0!==r&&void 0!==n)return c(r,n,l)}}:c(h,u,l)}function iB(i,r,n){return"color"===r.type?n=tr.parse(n):"formatted"===r.type?n=to.fromString(n.toString()):"resolvedImage"===r.type?n=ts.fromString(n.toString()):iM(n)===r.type||"enum"===r.type&&r.values[n]||(n=void 0),iP(n,i.default,r.default)}tw.register(ix,{error:[{kind:"error"},[eK],(i,[r])=>{throw new td(r.evaluate(i))}],typeof:[eK,[e1],(i,[r])=>e6(tu(r.evaluate(i)))],"to-rgba":[e4(eY,4),[eQ],(i,[r])=>r.evaluate(i).toArray()],rgb:[eQ,[eY,eY,eY],iv],rgba:[eQ,[eY,eY,eY,eY],iv],has:{type:eJ,overloads:[[[eK],(i,[r])=>r.evaluate(i) in i.properties()],[[eK,e0],(i,[r,n])=>r.evaluate(i) in n.evaluate(i)]]},get:{type:e1,overloads:[[[eK],(i,[r])=>ib(r.evaluate(i),i.properties())],[[eK,e0],(i,[r,n])=>ib(r.evaluate(i),n.evaluate(i))]]},"feature-state":[e1,[eK],(i,[r])=>ib(r.evaluate(i),i.featureState||{})],properties:[e0,[],i=>i.properties()],"geometry-type":[eK,[],i=>i.geometryType()],id:[e1,[],i=>i.id()],zoom:[eY,[],i=>i.globals.zoom],pitch:[eY,[],i=>i.globals.pitch||0],"distance-from-center":[eY,[],i=>i.distanceFromCenter()],"heatmap-density":[eY,[],i=>i.globals.heatmapDensity||0],"line-progress":[eY,[],i=>i.globals.lineProgress||0],"sky-radial-progress":[eY,[],i=>i.globals.skyRadialProgress||0],accumulated:[e1,[],i=>void 0===i.globals.accumulated?null:i.globals.accumulated],"+":[eY,iw(eY),(i,r)=>{let n=0;for(let a of r)n+=a.evaluate(i);return n}],"*":[eY,iw(eY),(i,r)=>{let n=1;for(let a of r)n*=a.evaluate(i);return n}],"-":{type:eY,overloads:[[[eY,eY],(i,[r,n])=>r.evaluate(i)-n.evaluate(i)],[[eY],(i,[r])=>-r.evaluate(i)]]},"/":[eY,[eY,eY],(i,[r,n])=>r.evaluate(i)/n.evaluate(i)],"%":[eY,[eY,eY],(i,[r,n])=>r.evaluate(i)%n.evaluate(i)],ln2:[eY,[],()=>Math.LN2],pi:[eY,[],()=>Math.PI],e:[eY,[],()=>Math.E],"^":[eY,[eY,eY],(i,[r,n])=>Math.pow(r.evaluate(i),n.evaluate(i))],sqrt:[eY,[eY],(i,[r])=>Math.sqrt(r.evaluate(i))],log10:[eY,[eY],(i,[r])=>Math.log(r.evaluate(i))/Math.LN10],ln:[eY,[eY],(i,[r])=>Math.log(r.evaluate(i))],log2:[eY,[eY],(i,[r])=>Math.log(r.evaluate(i))/Math.LN2],sin:[eY,[eY],(i,[r])=>Math.sin(r.evaluate(i))],cos:[eY,[eY],(i,[r])=>Math.cos(r.evaluate(i))],tan:[eY,[eY],(i,[r])=>Math.tan(r.evaluate(i))],asin:[eY,[eY],(i,[r])=>Math.asin(r.evaluate(i))],acos:[eY,[eY],(i,[r])=>Math.acos(r.evaluate(i))],atan:[eY,[eY],(i,[r])=>Math.atan(r.evaluate(i))],min:[eY,iw(eY),(i,r)=>Math.min(...r.map(r=>r.evaluate(i)))],max:[eY,iw(eY),(i,r)=>Math.max(...r.map(r=>r.evaluate(i)))],abs:[eY,[eY],(i,[r])=>Math.abs(r.evaluate(i))],round:[eY,[eY],(i,[r])=>{let n=r.evaluate(i);return n<0?-Math.round(-n):Math.round(n)}],floor:[eY,[eY],(i,[r])=>Math.floor(r.evaluate(i))],ceil:[eY,[eY],(i,[r])=>Math.ceil(r.evaluate(i))],"filter-==":[eJ,[eK,e1],(i,[r,n])=>i.properties()[r.value]===n.value],"filter-id-==":[eJ,[e1],(i,[r])=>i.id()===r.value],"filter-type-==":[eJ,[eK],(i,[r])=>i.geometryType()===r.value],"filter-<":[eJ,[eK,e1],(i,[r,n])=>{let a=i.properties()[r.value],o=n.value;return typeof a==typeof o&&a<o}],"filter-id-<":[eJ,[e1],(i,[r])=>{let n=i.id(),a=r.value;return typeof n==typeof a&&n<a}],"filter->":[eJ,[eK,e1],(i,[r,n])=>{let a=i.properties()[r.value],o=n.value;return typeof a==typeof o&&a>o}],"filter-id->":[eJ,[e1],(i,[r])=>{let n=i.id(),a=r.value;return typeof n==typeof a&&n>a}],"filter-<=":[eJ,[eK,e1],(i,[r,n])=>{let a=i.properties()[r.value],o=n.value;return typeof a==typeof o&&a<=o}],"filter-id-<=":[eJ,[e1],(i,[r])=>{let n=i.id(),a=r.value;return typeof n==typeof a&&n<=a}],"filter->=":[eJ,[eK,e1],(i,[r,n])=>{let a=i.properties()[r.value],o=n.value;return typeof a==typeof o&&a>=o}],"filter-id->=":[eJ,[e1],(i,[r])=>{let n=i.id(),a=r.value;return typeof n==typeof a&&n>=a}],"filter-has":[eJ,[e1],(i,[r])=>r.value in i.properties()],"filter-has-id":[eJ,[],i=>null!==i.id()&&void 0!==i.id()],"filter-type-in":[eJ,[e4(eK)],(i,[r])=>r.value.indexOf(i.geometryType())>=0],"filter-id-in":[eJ,[e4(e1)],(i,[r])=>r.value.indexOf(i.id())>=0],"filter-in-small":[eJ,[eK,e4(e1)],(i,[r,n])=>n.value.indexOf(i.properties()[r.value])>=0],"filter-in-large":[eJ,[eK,e4(e1)],(i,[r,n])=>(function(i,r,n,a){for(;n<=a;){let o=n+a>>1;if(r[o]===i)return!0;r[o]>i?a=o-1:n=o+1}return!1})(i.properties()[r.value],n.value,0,n.value.length-1)],all:{type:eJ,overloads:[[[eJ,eJ],(i,[r,n])=>r.evaluate(i)&&n.evaluate(i)],[iw(eJ),(i,r)=>{for(let n of r)if(!n.evaluate(i))return!1;return!0}]]},any:{type:eJ,overloads:[[[eJ,eJ],(i,[r,n])=>r.evaluate(i)||n.evaluate(i)],[iw(eJ),(i,r)=>{for(let n of r)if(n.evaluate(i))return!0;return!1}]]},"!":[eJ,[eJ],(i,[r])=>!r.evaluate(i)],"is-supported-script":[eJ,[eK],(i,[r])=>{let n=i.globals&&i.globals.isSupportedScript;return!n||n(r.evaluate(i))}],upcase:[eK,[eK],(i,[r])=>r.evaluate(i).toUpperCase()],downcase:[eK,[eK],(i,[r])=>r.evaluate(i).toLowerCase()],concat:[eK,iw(e1),(i,r)=>r.map(r=>tc(r.evaluate(i))).join("")],"resolved-locale":[eK,[e2],(i,[r])=>r.evaluate(i).resolvedLocale()]});class iR{constructor(i,r){this.expression=i,this._warningHistory={},this._evaluator=new tb,this._defaultValue=r?"color"===r.type&&(iC(r.default)||Array.isArray(r.default))?new tr(0,0,0,0):"color"===r.type?tr.parse(r.default)||null:void 0===r.default?null:r.default:null,this._enumValues=r&&"enum"===r.type?r.values:null}evaluateWithoutErrorHandling(i,r,n,a,o,s,l,h){return this._evaluator.globals=i,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=a||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null,this.expression.evaluate(this._evaluator)}evaluate(i,r,n,a,o,s,l,h){this._evaluator.globals=i,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null;try{let i=this.expression.evaluate(this._evaluator);if(null==i||"number"==typeof i&&i!=i)return this._defaultValue;if(this._enumValues&&!(i in this._enumValues))throw new td(`Expected value to be one of ${Object.keys(this._enumValues).map(i=>JSON.stringify(i)).join(", ")}, but found ${JSON.stringify(i)} instead.`);return i}catch(i){return this._warningHistory[i.message]||(this._warningHistory[i.message]=!0,"undefined"!=typeof console&&console.warn(i.message)),this._defaultValue}}}function iF(i){return Array.isArray(i)&&i.length>0&&"string"==typeof i[0]&&i[0]in ix}function iO(i,r){let n=new tV(ix,[],r?function(i){let r={color:eQ,string:eK,number:eY,enum:eK,boolean:eJ,formatted:e3,resolvedImage:e5};
1return"array"===i.type?e4(r[i.value]||e1,i.length):r[i.type]}(r):void 0),a=n.parse(i,void 0,void 0,void 0,r&&"string"===r.type?{typeAnnotation:"coerce"}:void 0);return a?iT(new iR(a,r)):iE(n.errors)}class iU{constructor(i,r){this.kind=i,this._styleExpression=r,this.isStateDependent="constant"!==i&&!tR(r.expression)}evaluateWithoutErrorHandling(i,r,n,a,o,s){return this._styleExpression.evaluateWithoutErrorHandling(i,r,n,a,o,s)}evaluate(i,r,n,a,o,s){return this._styleExpression.evaluate(i,r,n,a,o,s)}}class iV{constructor(i,r,n,a){this.kind=i,this.zoomStops=n,this._styleExpression=r,this.isStateDependent="camera"!==i&&!tR(r.expression),this.interpolationType=a}evaluateWithoutErrorHandling(i,r,n,a,o,s){return this._styleExpression.evaluateWithoutErrorHandling(i,r,n,a,o,s)}evaluate(i,r,n,a,o,s){return this._styleExpression.evaluate(i,r,n,a,o,s)}interpolationFactor(i,r,n){return this.interpolationType?t6.interpolationFactor(this.interpolationType,i,r,n):0}}function ij(i,r){if("error"===(i=iO(i,r)).result)return i;let n=i.value.expression,a=tB(n);if(!a&&!iS(r))return iE([new eX("","data expressions not supported")]);let o=tF(n,["zoom","pitch","distance-from-center"]);if(!o&&!iI(r))return iE([new eX("","zoom expressions not supported")]);let s=function i(r){let n=null;if(r instanceof t7)n=i(r.result);else if(r instanceof t9){for(let a of r.args)if(n=i(a))break}else(r instanceof tN||r instanceof t6)&&r.input instanceof tw&&"zoom"===r.input.name&&(n=r);return n instanceof eX||r.eachChild(r=>{let a=i(r);a instanceof eX?n=a:!n&&a?n=new eX("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&a&&n!==a&&(n=new eX("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}(n);return s||o?s instanceof eX?iE([s]):s instanceof t6&&!iA(r)?iE([new eX("",'"interpolate" expressions cannot be used with this property')]):iT(s?new iV(a?"camera":"composite",i.value,s.labels,s instanceof t6?s.interpolation:void 0):new iU(a?"constant":"source",i.value)):iE([new eX("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class iN{constructor(i,r){this._parameters=i,this._specification=r,eZ(this,function i(r,n){let a,o,s;let l="color"===n.type,h=r.stops&&"object"==typeof r.stops[0][0],u=h||!(h||void 0!==r.property),c=r.type||(iA(n)?"exponential":"interval");if(l&&((r=eZ({},r)).stops&&(r.stops=r.stops.map(i=>[i[0],tr.parse(i[1])])),r.default=tr.parse(r.default?r.default:n.default)),r.colorSpace&&"rgb"!==r.colorSpace&&!t4[r.colorSpace])throw Error(`Unknown color space: ${r.colorSpace}`);if("exponential"===c)a=iL;else if("interval"===c)a=iD;else if("categorical"===c){for(let i of(a=ik,o=Object.create(null),r.stops))o[i[0]]=i[1];s=typeof r.stops[0][0]}else{if("identity"!==c)throw Error(`Unknown function type "${c}"`);a=iB}if(h){let a={},o=[];for(let i=0;i<r.stops.length;i++){let n=r.stops[i],s=n[0].zoom;void 0===a[s]&&(a[s]={zoom:s,type:r.type,property:r.property,default:r.default,stops:[]},o.push(s)),a[s].stops.push([n[0].value,n[1]])}let s=[];for(let r of o)s.push([a[r].zoom,i(a[r],n)]);let l={name:"linear"};return{kind:"composite",interpolationType:l,interpolationFactor:t6.interpolationFactor.bind(void 0,l),zoomStops:s.map(i=>i[0]),evaluate:({zoom:i},a)=>iL({stops:s,base:r.base},n,i).evaluate(i,a)}}if(u){let i="exponential"===c?{name:"exponential",base:void 0!==r.base?r.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:t6.interpolationFactor.bind(void 0,i),zoomStops:r.stops.map(i=>i[0]),evaluate:({zoom:i})=>a(r,n,i,o,s)}}return{kind:"source",evaluate(i,l){let h=l&&l.properties?l.properties[r.property]:void 0;return void 0===h?iP(r.default,n.default):a(r,n,h,o,s)}}}(this._parameters,this._specification))}static deserialize(i){return new iN(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}class iG{constructor(i,r,n,a){this.message=(i?`${i}: `:"")+n,a&&(this.identifier=a),null!=r&&r.__line__&&(this.line=r.__line__)}}function iZ(i){let r=i.key,n=i.value,a=i.valueSpec||{},o=i.objectElementValidators||{},s=i.style,l=i.styleSpec,h=[],u=iM(n);if("object"!==u)return[new iG(r,n,`object expected, ${u}
1 found`)];for(let i in n){let u;let c=i.split(".")[0],p=a[c]||a["*"];o[c]?u=o[c]:a[c]?u=rs:o["*"]?u=o["*"]:a["*"]&&(u=rs),u?h=h.concat(u({key:(r?`${r}.`:r)+i,value:n[i],valueSpec:p,style:s,styleSpec:l,object:n,objectKey:i},n)):h.push(new iG(r,n[i],`unknown property "${i}"`))}for(let i in a)o[i]||a[i].required&&void 0===a[i].default&&void 0===n[i]&&h.push(new iG(r,n,`missing required property "${i}"`));return h}function i$(i){let r=i.value,n=i.valueSpec,a=i.style,o=i.styleSpec,s=i.key,l=i.arrayElementValidator||rs;if("array"!==iM(r))return[new iG(s,r,`array expected, ${iM(r)} found`)];if(n.length&&r.length!==n.length)return[new iG(s,r,`array length ${n.length} expected, length ${r.length} found`)];if(n["min-length"]&&r.length<n["min-length"])return[new iG(s,r,`array length at least ${n["min-length"]} expected, length ${r.length} found`)];let h={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};o.$version<7&&(h.function=n.function),"object"===iM(n.value)&&(h=n.value);let u=[];for(let i=0;i<r.length;i++)u=u.concat(l({array:r,arrayIndex:i,value:r[i],valueSpec:h,style:a,styleSpec:o,key:`${s}[${i}]`}));return u}function iq(i){let r=i.key,n=i.value,a=i.valueSpec,o=iM(n);if("number"===o&&n!=n&&(o="NaN"),"number"!==o)return[new iG(r,n,`number expected, ${o} found`)];if("minimum"in a){let o=a.minimum;if("array"===iM(a.minimum)&&(o=a.minimum[i.arrayIndex]),n<o)return[new iG(r,n,`${n} is less than the minimum value ${o}`)]}if("maximum"in a){let o=a.maximum;if("array"===iM(a.maximum)&&(o=a.maximum[i.arrayIndex]),n>o)return[new iG(r,n,`${n} is greater than the maximum value ${o}`)]}return[]}function iX(i){let r=i.valueSpec,n=e$(i.value.type),a,o,s,l={},h="categorical"!==n&&void 0===i.value.property,u="array"===iM(i.value.stops)&&"array"===iM(i.value.stops[0])&&"object"===iM(i.value.stops[0][0]),c=iZ({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(i){if("identity"===n)return[new iG(i.key,i.value,'identity function may not have a "stops" property')];let r=[],a=i.value;return r=r.concat(i$({key:i.key,value:a,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:p})),"array"===iM(a)&&0===a.length&&r.push(new iG(i.key,a,"array must have at least one stop")),r},default:function(i){return rs({key:i.key,value:i.value,valueSpec:r,style:i.style,styleSpec:i.styleSpec})}}});return"identity"===n&&h&&c.push(new iG(i.key,i.value,'missing required property "property"')),"identity"===n||i.value.stops||c.push(new iG(i.key,i.value,'missing required property "stops"')),"exponential"===n&&i.valueSpec.expression&&!iA(i.valueSpec)&&c.push(new iG(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(h||iS(i.valueSpec)?h&&!iI(i.valueSpec)&&c.push(new iG(i.key,i.value,"zoom functions not supported")):c.push(new iG(i.key,i.value,"property functions not supported"))),("categorical"===n||u)&&void 0===i.value.property&&c.push(new iG(i.key,i.value,'"property" property is required')),c;function p(i){let n=[],a=i.value,h=i.key;if("array"!==iM(a))return[new iG(h,a,`array expected, ${iM(a)} found`)];if(2!==a.length)return[new iG(h,a,`array length 2 expected, length ${a.length} found`)];if(u){if("object"!==iM(a[0]))return[new iG(h,a,`object expected, ${iM(a[0])} found`)];if(void 0===a[0].zoom)return[new iG(h,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new iG(h,a,"object stop key must have value")];let r=e$(a[0].zoom);if("number"!=typeof r)return[new iG(h,a[0].zoom,"stop zoom values must be numbers")];if(s&&s>r)return[new iG(h,a[0].zoom,"stop zoom values must appear in ascending order")];r!==s&&(s=r,o=void 0,l={}),n=n.concat(iZ({key:`${h}[0]`,value:a[0],valueSpec:{zoom:{}},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{zoom:iq,value:d}}))}else n=n.concat(d({key:`${h}[0]`,value:a[0],valueSpec:{},style:i.style,styleSpec:i.styleSpec},a));return iF(eq(a[1]))?n.concat([new iG(`${h}[1]`,a[1],"expressions are not allowed in function stops.")]):n.concat(rs({key:`${h}[1]`,value:a[1],valueSpec:r,style:i.style,styleSpec:i.styleSpec}))}
1function d(i,s){let h=iM(i.value),u=e$(i.value),c=null!==i.value?i.value:s;if(a){if(h!==a)return[new iG(i.key,c,`${h} stop domain type must match previous stop domain type ${a}`)]}else a=h;if("number"!==h&&"string"!==h&&"boolean"!==h&&"number"!=typeof u&&"string"!=typeof u&&"boolean"!=typeof u)return[new iG(i.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==h&&"categorical"!==n){let a=`number expected, ${h} found`;return iS(r)&&void 0===n&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new iG(i.key,c,a)]}return"categorical"!==n||"number"!==h||"number"==typeof u&&isFinite(u)&&Math.floor(u)===u?"categorical"!==n&&"number"===h&&"number"==typeof u&&"number"==typeof o&&void 0!==o&&u<o?[new iG(i.key,c,"stop domain values must appear in ascending order")]:(o=u,"categorical"===n&&u in l?[new iG(i.key,c,"stop domain values must be unique")]:(l[u]=!0,[])):[new iG(i.key,c,`integer expected, found ${String(u)}`)]}}function iW(i){let r=("property"===i.expressionContext?ij:iO)(eq(i.value),i.valueSpec);if("error"===r.result)return r.value.map(r=>new iG(`${i.key}${r.key}`,i.value,r.message));let n=r.value.expression||r.value._styleExpression.expression;if("property"===i.expressionContext&&"text-font"===i.propertyKey&&!n.outputDefined())return[new iG(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===i.expressionContext&&"layout"===i.propertyType&&!tR(n))return[new iG(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===i.expressionContext)return function i(r,n){let a=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(n.valueSpec&&n.valueSpec.expression)for(let i of n.valueSpec.expression.parameters)a.delete(i);if(0===a.size)return[];let o=[];return r instanceof tw&&a.has(r.name)?[new iG(n.key,n.value,`["${r.name}"] expression is not supported in a filter for a ${n.object.type} layer with id: ${n.object.id}`)]:(r.eachChild(r=>{o.push(...i(r,n))}),o)}(n,i);if(i.expressionContext&&0===i.expressionContext.indexOf("cluster")){if(!tF(n,["zoom","feature-state"]))return[new iG(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===i.expressionContext&&!tB(n))return[new iG(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function iH(i){let r=i.key,n=i.value,a=i.valueSpec,o=[];return Array.isArray(a.values)?-1===a.values.indexOf(e$(n))&&o.push(new iG(r,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(a.values).indexOf(e$(n))&&o.push(new iG(r,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),o}function iY(i){if(!0===i||!1===i)return!0;if(!Array.isArray(i)||0===i.length)return!1;switch(i[0]){case"has":return i.length>=2&&"$id"!==i[1]&&"$type"!==i[1];case"in":return i.length>=3&&("string"!=typeof i[1]||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==i.length||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let r of i.slice(1))if(!iY(r)&&"boolean"!=typeof r)return!1;return!0;default:return!0}}function iK(i,r="fill"){if(null==i)return{filter:()=>!0,needGeometry:!1,needFeature:!1};iY(i)||(i=function i(r){if(!r)return!0;let n=r[0];return r.length<=1?"any"!==n:"=="===n?i1(r[1],r[2],"=="):"!="===n?i5(i1(r[1],r[2],"==")):"<"===n||">"===n||"<="===n||">="===n?i1(r[1],r[2],n):"any"===n?["any"].concat(r.slice(1).map(i)):"all"===n?["all"].concat(r.slice(1).map(i)):"none"===n?["all"].concat(r.slice(1).map(i).map(i5)):"in"===n?i2(r[1],r.slice(2)):"!in"===n?i5(i2(r[1],r.slice(2))):"has"===n?i3(r[1]):"!has"===n?i5(i3(r[1])):"within"!==n||r}(i));let n=i,a=!0;try{a=function(i){if(!iJ(i))return i;let r=eq(i);return function i(r){let n=!1,a=[];if("case"===r[0]){for(let i=1;i<r.length-1;i+=2)n=n||iJ(r[i]),a.push(r[i+1]);a.push(r[r.length-1])}else if("match"===r[0]){n=n||iJ(r[1]);for(let i=2;i<r.length-1;i+=2)a.push(r[i+1]);a.push(r[r.length-1])}else if("step"===r[0]){n=n||iJ(r[1]);for(let i=1;i<r.length-1;i+=2)a.push(r[i+1])}n&&(r.length=0,r.push("any",...a));for(let n=1;n<r.length;n++)i(r[n])}(r),r=function i(r){if(!Array.isArray(r))return r;let n=function(i){if(iQ.has(i[0])){for(let r=1;r<i.length;r++)if(iJ(i[r]))return!0}return i}(r);return!0===n?n:n.map(r=>i(r))}(r)}(n)}catch(i){console.warn(`Failed to extract static filter. Filter will c
1ontinue working, but at higher memory usage and slower framerate. 2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 3and paste the contents of this message in the report. 4Thank you! 5Filter Expression: 6${JSON.stringify(n,null,2)} 7 `)}let o=eG[`filter_${r}`],s=iO(a,o),l=null;if("error"===s.result)throw Error(s.value.map(i=>`${i.key}: ${i.message}`).join(", "));l=(i,r,n)=>s.value.evaluate(i,r,{},n);let h=null,u=null;if(a!==n){let i=iO(n,o);if("error"===i.result)throw Error(i.value.map(i=>`${i.key}: ${i.message}`).join(", "));h=(r,n,a,o,s)=>i.value.evaluate(r,n,{},a,void 0,void 0,o,s),u=!tB(i.value.expression)}return{filter:l,dynamicFilter:h||void 0,needGeometry:function i(r){if(!Array.isArray(r))return!1;if("within"===r[0])return!0;for(let n=1;n<r.length;n++)if(i(r[n]))return!0;return!1}(a),needFeature:!!u}}function iJ(i){var r;if(!Array.isArray(i))return!1;if("pitch"===(r=i[0])||"distance-from-center"===r)return!0;for(let r=1;r<i.length;r++)if(iJ(i[r]))return!0;return!1}let iQ=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function i0(i,r){return i<r?-1:i>r?1:0}function i1(i,r,n){switch(i){case"$type":return[`filter-type-${n}`,r];case"$id":return[`filter-id-${n}`,r];default:return[`filter-${n}`,i,r]}}function i2(i,r){if(0===r.length)return!1;switch(i){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(i=>typeof i!=typeof r[0])?["filter-in-large",i,["literal",r.sort(i0)]]:["filter-in-small",i,["literal",r]]}}function i3(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function i5(i){return["!",i]}function i4(i){return iY(eq(i.value))?iW(eZ({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${i.layerType||"fill"}`]})):function i(r){let n=r.value,a=r.key;if("array"!==iM(n))return[new iG(a,n,`array expected, ${iM(n)} found`)];let o=r.styleSpec,s,l=[];if(n.length<1)return[new iG(a,n,"filter array must have at least 1 element")];switch(l=l.concat(iH({key:`${a}[0]`,value:n[0],valueSpec:o.filter_operator,style:r.style,styleSpec:r.styleSpec})),e$(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===e$(n[1])&&l.push(new iG(a,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":3!==n.length&&l.push(new iG(a,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&"string"!==(s=iM(n[1]))&&l.push(new iG(`${a}[1]`,n[1],`string expected, ${s} found`));for(let i=2;i<n.length;i++)s=iM(n[i]),"$type"===e$(n[1])?l=l.concat(iH({key:`${a}[${i}]`,value:n[i],valueSpec:o.geometry_type,style:r.style,styleSpec:r.styleSpec})):"string"!==s&&"number"!==s&&"boolean"!==s&&l.push(new iG(`${a}[${i}]`,n[i],`string, number, or boolean expected, ${s} found`));break;case"any":case"all":case"none":for(let o=1;o<n.length;o++)l=l.concat(i({key:`${a}[${o}]`,value:n[o],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":s=iM(n[1]),2!==n.length?l.push(new iG(a,n,`filter array for "${n[0]}" operator must have 2 elements`)):"string"!==s&&l.push(new iG(`${a}[1]`,n[1],`string expected, ${s} found`));break;case"within":s=iM(n[1]),2!==n.length?l.push(new iG(a,n,`filter array for "${n[0]}" operator must have 2 elements`)):"object"!==s&&l.push(new iG(`${a}[1]`,n[1],`object expected, ${s} found`))}return l}(i)}function i6(i,r){let n;let a=i.key,o=i.style,s=i.styleSpec,l=i.value,h=i.objectKey,u=s[`${r}_${i.layerType}`];if(!u)return[];let c=h.match(/^(.*)-transition$/);if("paint"===r&&c&&u[c[1]]&&u[c[1]].transition)return rs({key:a,value:l,valueSpec:s.transition,style:o,styleSpec:s});let p=i.valueSpec||u[h];if(!p)return[new iG(a,l,`unknown property "${h}"`)];if("string"===iM(l)&&iS(p)&&!p.tokens&&(n=/^{([^}]+)}$/.exec(l)))return[new iG(a,l,`"${h}" does not support interpolation syntax 8Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(n[1])} }\`.`)];let d=[];return"symbol"===i.layerType&&("text-field"===h&&o&&!o.glyphs&&d.push(new iG(a,l,'use of "text-field" requires a style "glyphs" property')),"text-font"===h&&iC(eq(l))&&"identity"===e$(l.type)&&d.push(new iG(a,l,'"text-font" does not support identity functions'))),d.concat(rs({key:i.key,value:l,valueSpec:p,style:o,styleSpec:s,expressionContext:"property",propertyType:r,propertyKey:h}))}function i8(i){return i6(i,"paint")}function i9(i){return i6(i,"layout")}function i7(i){let r=[],n=i.value,a=i.key,o=i.style,s=i.styleSpec;n.type||n.ref||r.push(new iG(a,n,'either "type" or "ref" is required'));let l=e$(n.type),h=e$(n.ref);
8if(n.id){let s=e$(n.id);for(let l=0;l<i.arrayIndex;l++){let i=o.layers[l];e$(i.id)===s&&r.push(new iG(a,n.id,`duplicate layer id "${n.id}", previously used at line ${i.id.__line__}`))}}if("ref"in n){let i;["type","source","source-layer","filter","layout"].forEach(i=>{i in n&&r.push(new iG(a,n[i],`"${i}" is prohibited for ref layers`))}),o.layers.forEach(r=>{e$(r.id)===h&&(i=r)}),i?i.ref?r.push(new iG(a,n.ref,"ref cannot reference another ref layer")):l=e$(i.type):"string"==typeof h&&r.push(new iG(a,n.ref,`ref layer "${h}" not found`))}else if("background"!==l&&"sky"!==l){if(n.source){let i=o.sources&&o.sources[n.source],s=i&&e$(i.type);i?"vector"===s&&"raster"===l?r.push(new iG(a,n.source,`layer "${n.id}" requires a raster source`)):"raster"===s&&"raster"!==l?r.push(new iG(a,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==s||n["source-layer"]?"raster-dem"===s&&"hillshade"!==l?r.push(new iG(a,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===l&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&("geojson"!==s||!i.lineMetrics)&&r.push(new iG(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new iG(a,n,`layer "${n.id}" must specify a "source-layer"`)):r.push(new iG(a,n.source,`source "${n.source}" not found`))}else r.push(new iG(a,n,'missing required property "source"'))}return r=r.concat(iZ({key:a,value:n,valueSpec:s.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>rs({key:`${a}.type`,value:n.type,valueSpec:s.layer.type,style:i.style,styleSpec:i.styleSpec,object:n,objectKey:"type"}),filter:i=>i4(eZ({layerType:l},i)),layout:i=>iZ({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>i9(eZ({layerType:l},i))}}),paint:i=>iZ({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>i8(eZ({layerType:l},i))}})}}))}function re(i){let r=i.value,n=i.key,a=iM(r);return"string"!==a?[new iG(n,r,`string expected, ${a} found`)]:[]}let rt={promoteId:function({key:i,value:r}){if("string"===iM(r))return re({key:i,value:r});{let n=[];for(let a in r)n.push(...re({key:`${i}.${a}`,value:r[a]}));return n}}};function ri(i){let r;let n=i.value,a=i.key,o=i.styleSpec,s=i.style;if(!n.type)return[new iG(a,n,'"type" is required')];let l=e$(n.type);switch(l){case"vector":case"raster":case"raster-dem":return iZ({key:a,value:n,valueSpec:o[`source_${l.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:rt});case"geojson":if(r=iZ({key:a,value:n,valueSpec:o.source_geojson,style:s,styleSpec:o,objectElementValidators:rt}),n.cluster)for(let i in n.clusterProperties){let[o,s]=n.clusterProperties[i],l="string"==typeof o?[o,["accumulated"],["get",i]]:o;r.push(...iW({key:`${a}.${i}.map`,value:s,expressionContext:"cluster-map"})),r.push(...iW({key:`${a}.${i}.reduce`,value:l,expressionContext:"cluster-reduce"}))}return r;case"video":return iZ({key:a,value:n,valueSpec:o.source_video,style:s,styleSpec:o});case"image":return iZ({key:a,value:n,valueSpec:o.source_image,style:s,styleSpec:o});case"canvas":return[new iG(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return iH({key:`${a}.type`,value:n.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:s,styleSpec:o})}}function rr(i){let r=i.value,n=i.styleSpec,a=n.light,o=i.style,s=[],l=iM(r);if(void 0===r)return s;if("object"!==l)return s.concat([new iG("light",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/);s=s.concat(l&&a[l[1]]&&a[l[1]].transition?rs({key:i,value:r[i],valueSpec:n.transition,style:o,styleSpec:n}):a[i]?rs({key:i,value:r[i],valueSpec:a[i],style:o,styleSpec:n}):[new iG(i,r[i],`unknown property "${i}"`)])}return s}function rn(i){let r=i.value,n=i.key,a=i.style,o=i.styleSpec,s=o.terrain,l=[],h=iM(r);if(void 0===r)return l;if("object"!==h)return l.concat([new iG("terrain",r,`object expected, ${h} found`)]);for(let i in r){let n=i.match(/^(.*)-transition$/);l=l.concat(n&&s[n[1]]&&s[n[1]].transition?rs({key:i,value:r[i],valueSpec:o.transition,style:a,styleSpec:o}):s[i]?rs({key:i,value:r[i],valueSpec:s[i],style:a,styleSpec:o}):[new iG(i,r[i],`unknown property "${i}"`)])}if(r.source){let i=a.sources&&a.sources[r.source],o=i&&e$(i.type);i?"raster-dem"!==o&&l.push(new iG(n,r.source,`terrain cannot be used with a source of type ${String(o)}, it only be used with a "raster-dem" source type`)):l.push(new iG(n,r.source,`source "${r.source}" not found`))}else l.push(new iG(n,r,'terrain is missing required property "source"'));return l}
vendor: 4,463 bytes, line 8
8function ra(i){let r=i.value,n=i.style,a=i.styleSpec,o=a.fog,s=[],l=iM(r);if(void 0===r)return s;if("object"!==l)return s.concat([new iG("fog",r,`object expected, ${l} found`)]);for(let i in r){let l=i.match(/^(.*)-transition$/);s=s.concat(l&&o[l[1]]&&o[l[1]].transition?rs({key:i,value:r[i],valueSpec:a.transition,style:n,styleSpec:a}):o[i]?rs({key:i,value:r[i],valueSpec:o[i],style:n,styleSpec:a}):[new iG(i,r[i],`unknown property "${i}"`)])}return s}let ro={"*":()=>[],array:i$,boolean:function(i){let r=i.value,n=i.key,a=iM(r);return"boolean"!==a?[new iG(n,r,`boolean expected, ${a} found`)]:[]},number:iq,color:function(i){let r=i.key,n=i.value,a=iM(n);return"string"!==a?[new iG(r,n,`color expected, ${a} found`)]:null===ti.parseCSSColor(n)?[new iG(r,n,`color expected, "${n}" found`)]:[]},enum:iH,filter:i4,function:iX,layer:i7,object:iZ,source:ri,light:rr,terrain:rn,fog:ra,string:re,formatted:function(i){return 0===re(i).length?[]:iW(i)},resolvedImage:function(i){return 0===re(i).length?[]:iW(i)},projection:function(i){let r=i.value,n=i.styleSpec,a=n.projection,o=i.style,s=[],l=iM(r);if("object"===l)for(let i in r)s=s.concat(rs({key:i,value:r[i],valueSpec:a[i],style:o,styleSpec:n}));else"string"!==l&&(s=s.concat([new iG("projection",r,`object or string expected, ${l} found`)]));return s}};function rs(i){let r=i.value,n=i.valueSpec,a=i.styleSpec;return n.expression&&iC(e$(r))?iX(i):n.expression&&iF(eq(r))?iW(i):n.type&&ro[n.type]?ro[n.type](i):iZ(eZ({},i,{valueSpec:n.type?a[n.type]:n}))}function rl(i){let r=i.value,n=i.key,a=re(i);return a.length||(-1===r.indexOf("{fontstack}")&&a.push(new iG(n,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&a.push(new iG(n,r,'"glyphs" url must include a "{range}" token'))),a}function rh(i,r=eG){return rp(rs({key:"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:rl,"*":()=>[]}}))}let ru=i=>rp(i8(i)),rc=i=>rp(i9(i));function rp(i){return i.slice().sort((i,r)=>i.line&&r.line?i.line-r.line:0)}function rd(i,r){let n=!1;if(r&&r.length)for(let a of r)i.fire(new ej(Error(a.message))),n=!0;return n}var rf=rm;function rm(i,r,n){var a=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var o=new Int32Array(this.arrayBuffer);i=o[0],this.d=(r=o[1])+2*(n=o[2]);for(var s=0;s<this.d*this.d;s++){var l=o[3+s],h=o[3+s+1];a.push(l===h?null:o.subarray(l,h))}var u=o[3+a.length+1];this.keys=o.subarray(o[3+a.length],u),this.bboxes=o.subarray(u),this.insert=this._insertReadonly}else{this.d=r+2*n;for(var c=0;c<this.d*this.d;c++)a.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=i,this.padding=n,this.scale=r/i,this.uid=0;var p=n/r*i;this.min=-p,this.max=i+p}rm.prototype.insert=function(i,r,n,a,o){this._forEachCell(r,n,a,o,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(o)},rm.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},rm.prototype._insertCell=function(i,r,n,a,o,s){this.cells[o].push(s)},rm.prototype.query=function(i,r,n,a,o){var s=this.min,l=this.max;if(i<=s&&r<=s&&l<=n&&l<=a&&!o)return Array.prototype.slice.call(this.keys);var h=[];return this._forEachCell(i,r,n,a,this._queryCell,h,{},o),h},rm.prototype._queryCell=function(i,r,n,a,o,s,l,h){var u=this.cells[o];if(null!==u)for(var c=this.keys,p=this.bboxes,d=0;d<u.length;d++){var f=u[d];if(void 0===l[f]){var m=4*f;(h?h(p[m+0],p[m+1],p[m+2],p[m+3]):i<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&a>=p[m+1])?(l[f]=!0,s.push(c[f])):l[f]=!1}}},rm.prototype._forEachCell=function(i,r,n,a,o,s,l,h){for(var u=this._convertToCellCoord(i),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),d=this._convertToCellCoord(a),f=u;f<=p;f++)for(var m=c;m<=d;m++){var _=this.d*m+f;if((!h||h(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&o.call(this,i,r,n,a,_,s,l,h))return}},rm.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},rm.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},rm.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,r=3+this.cells.length+1+1,n=0,a=0;a<this.cells.length;a++)n+=this.cells[a].length;var o=new Int32Array(r+n+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;
8for(var s=r,l=0;l<i.length;l++){var h=i[l];o[3+l]=s,o.set(h,s),s+=h.length}return o[3+i.length]=s,o.set(this.keys,s),o[3+i.length+1]=s+=this.keys.length,o.set(this.bboxes,s),s+=this.bboxes.length,o.buffer};let r_={};function rg(i,r,n={}){Object.defineProperty(i,"_classRegistryKey",{value:r,writeable:!1}),r_[r]={klass:i,omit:n.omit||[]}}for(let i in rg(Object,"Object"),rf.serialize=function(i,r){let n=i.toArrayBuffer();return r&&r.push(n),{buffer:n}},rf.deserialize=function(i){return new rf(i.buffer)},Object.defineProperty(rf,"name",{value:"Grid"}),rg(rf,"Grid"),rg(tr,"Color"),rg(Error,"Error"),rg(ez,"AJAXError"),rg(ts,"ResolvedImage"),rg(iN,"StylePropertyFunction"),rg(iR,"StyleExpression",{omit:["_evaluator"]}),rg(iV,"ZoomDependentExpression"),rg(iU,"ZoomConstantExpression"),rg(tw,"CompoundExpression",{omit:["_evaluate"]}),ix)r_[ix[i]._classRegistryKey]||rg(ix[i],`Expression${i}`);function ry(i){return i&&"undefined"!=typeof ArrayBuffer&&(i instanceof ArrayBuffer||i.constructor&&"ArrayBuffer"===i.constructor.name)}function rx(i){return p.ImageBitmap&&i instanceof p.ImageBitmap}function rv(i,r){if(null==i||"boolean"==typeof i||"number"==typeof i||"string"==typeof i||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp)return i;if(ry(i)||rx(i))return r&&r.push(i),i;if(ArrayBuffer.isView(i))return r&&r.push(i.buffer),i;if(i instanceof p.ImageData)return r&&r.push(i.data.buffer),i;if(Array.isArray(i)){let n=[];for(let a of i)n.push(rv(a,r));return n}if("object"==typeof i){let n=i.constructor,a=n._classRegistryKey;if(!a)throw Error(`can't serialize object of unregistered class ${a}`);let o=n.serialize?n.serialize(i,r):{};if(!n.serialize){for(let n in i)i.hasOwnProperty(n)&&(r_[a].omit.indexOf(n)>=0||(o[n]=rv(i[n],r)));i instanceof Error&&(o.message=i.message)}if(o.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(o.$name=a),o}throw Error("can't serialize object of type "+typeof i)}function rb(i){if(null==i||"boolean"==typeof i||"number"==typeof i||"string"==typeof i||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||ry(i)||rx(i)||ArrayBuffer.isView(i)||i instanceof p.ImageData)return i;if(Array.isArray(i))return i.map(rb);if("object"==typeof i){let r=i.$name||"Object",{klass:n}=r_[r];if(!n)throw Error(`can't deserialize unregistered class ${r}`);if(n.deserialize)return n.deserialize(i);let a=Object.create(n.prototype);for(let r of Object.keys(i))"$name"!==r&&(a[r]=rb(i[r]));return a}throw Error("can't deserialize object of type "+typeof i)}class rw{constructor(){this.first=!0}update(i,r){let n=Math.floor(i);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=i,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),i!==this.lastZoom&&(this.lastZoom=i,this.lastFloorZoom=n,!0))}}let rT=i=>i>=1536&&i<=1791,rE=i=>i>=1872&&i<=1919,rS=i=>i>=2208&&i<=2303,rI=i=>i>=11904&&i<=12031,rA=i=>i>=12032&&i<=12255,rM=i=>i>=12272&&i<=12287,rC=i=>i>=12288&&i<=12351,rz=i=>i>=12352&&i<=12447,rP=i=>i>=12448&&i<=12543,rk=i=>i>=12544&&i<=12591,rD=i=>i>=12704&&i<=12735,rL=i=>i>=12736&&i<=12783,rB=i=>i>=12784&&i<=12799,rR=i=>i>=12800&&i<=13055,rF=i=>i>=13056&&i<=13311,rO=i=>i>=13312&&i<=19903,rU=i=>i>=19968&&i<=40959,rV=i=>i>=40960&&i<=42127,rj=i=>i>=42128&&i<=42191,rN=i=>i>=44032&&i<=55215,rG=i=>i>=63744&&i<=64255,rZ=i=>i>=64336&&i<=65023,r$=i=>i>=65040&&i<=65055,rq=i=>i>=65072&&i<=65103,rX=i=>i>=65104&&i<=65135,rW=i=>i>=65136&&i<=65279,rH=i=>i>=65280&&i<=65519;function rY(i){for(let r of i)if(rK(r.charCodeAt(0)))return!0;return!1}function rK(i){return!(746!==i&&747!==i&&(i<4352||!(rD(i)||rk(i)||rq(i)&&!(i>=65097&&i<=65103)||rG(i)||rF(i)||rI(i)||rL(i)||!(!rC(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||12336===i)||rO(i)||rU(i)||rR(i)||i>=12592&&i<=12687||i>=43360&&i<=43391||i>=55216&&i<=55295||i>=4352&&i<=4607||rN(i)||rz(i)||rM(i)||i>
8=12688&&i<=12703||rA(i)||rB(i)||rP(i)&&12540!==i||!(!rH(i)||65288===i||65289===i||65293===i||i>=65306&&i<=65310||65339===i||65341===i||65343===i||i>=65371&&i<=65503||65507===i||i>=65512&&i<=65519)||!(!rX(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||i>=5120&&i<=5759||i>=6320&&i<=6399||r$(i)||i>=19904&&i<=19967||rV(i)||rj(i))))}function rJ(i){return!(rK(i)||i>=128&&i<=255&&(167===i||169===i||174===i||177===i||188===i||189===i||190===i||215===i||247===i)||i>=8192&&i<=8303&&(8214===i||8224===i||8225===i||8240===i||8241===i||8251===i||8252===i||8258===i||8263===i||8264===i||8265===i||8273===i)||i>=8448&&i<=8527||i>=8528&&i<=8591||i>=8960&&i<=9215&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||9003===i||i>=9085&&i<=9114||i>=9150&&i<=9165||9167===i||i>=9169&&i<=9179||i>=9186&&i<=9215)||i>=9216&&i<=9279&&9251!==i||i>=9280&&i<=9311||i>=9312&&i<=9471||i>=9632&&i<=9727||i>=9728&&i<=9983&&!(i>=9754&&i<=9759)||i>=11008&&i<=11263&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||rC(i)||rP(i)||i>=57344&&i<=63743||rq(i)||rX(i)||rH(i)||8734===i||8756===i||8757===i||i>=9984&&i<=10087||i>=10102&&i<=10131||65532===i||65533===i)}function rQ(i){return i>=1424&&i<=2303||rZ(i)||rW(i)}let r0="deferred",r1="loading",r2="loaded",r3=null,r5="unavailable",r4=null,r6=function(i){i&&"string"==typeof i&&i.indexOf("NetworkError")>-1&&(r5="error"),r3&&r3(i)};function r8(){r9.fire(new eV("pluginStateChange",{pluginStatus:r5,pluginURL:r4}))}let r9=new eN,r7=function(){return r5},ne=function(){if(r5!==r0||!r4)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");r5=r1,r8(),r4&&eD({url:r4},i=>{i?r6(i):(r5=r2,r8())})},nt={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>r5===r2||null!=nt.applyArabicShaping,isLoading:()=>r5===r1,setState(i){r5=i.pluginStatus,r4=i.pluginURL},isParsed:()=>null!=nt.applyArabicShaping&&null!=nt.processBidirectionalText&&null!=nt.processStyledBidirectionalText,getPluginURL:()=>r4};class ni{constructor(i,r){this.zoom=i,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition,this.pitch=r.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new rw,this.transition={},this.pitch=0)}isSupportedScript(i){return function(i,r){for(let a of i){var n;if(n=a.charCodeAt(0),!r&&rQ(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||n>=6016&&n<=6143)return!1}return!0}(i,nt.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let i=this.zoom,r=i-Math.floor(i),n=this.crossFadingFactor();return i>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class nr{constructor(i,r){this.property=i,this.value=r,this.expression=function(i,r){if(iC(i))return new iN(i,r);if(iF(i)){let n=ij(i,r);if("error"===n.result)throw Error(n.value.map(i=>`${i.key}: ${i.message}`).join(", "));return n.value}{let n=i;return"string"==typeof i&&"color"===r.type&&(n=tr.parse(i)),{kind:"constant",evaluate:()=>n}}}(void 0===r?i.specification.default:r,i.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(i,r,n){return this.property.possiblyEvaluate(this,i,r,n)}}class nn{constructor(i){this.property=i,this.value=new nr(i,void 0)}transitioned(i,r){return new no(this.property,this.value,r,A({},i.transition,this.transition),i.now)}untransitioned(){return new no(this.property,this.value,null,{},0)}}class na{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return F(this._values[i].value.value)}setValue(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nn(this._values[i].property)),this._values[i].value=new nr(this._values[i].property,null===r?void 0:F(r))}getTransition(i){return F(this._values[i].transition)}setTransition(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nn(this._values[i].property)),this._values[i].transition=F(r)||void 0}serialize(){let i={};for(let r of Object.keys(this._values)){let n=this.getValue(r);void 0!==n&&(i[r]=n);let a=this.getTransition(r);void 0!==a&&(i[`${r}-transition`]=a)}return i}transitioned(i,r){let n=new ns(this._properties);for(let a of Object.keys(this._values))n._values[a]=this._values[a].transitioned(i,r._values[a]);return n}untransitioned(){let i=new ns(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].untransitioned();return i}}class no{constructor(i,r,n,a,o){let s=a.delay||0,l=a.duration||0;o=o||0,this.property=i,this.value=r,this.begin=o+s,this.end=this.begin+l,i.specification.transition&&(a.delay||a.duration)&&(this.prior=n)}possiblyEvaluate(i,r,n){let a=i.now||0,o=this.value.possiblyEvaluate(i,r,n),s=this.prior;if(s){if(a>this.end||this.value.isDataDriven())return this.prior=null,o;if(a<this.begin)return s.possiblyEvaluate(i,r,n);{let l=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(i,r,n),o,x(l))}}return o}}class ns{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,r,n){let a=new nu(this._properties);for(let o of Object.keys(this._values))a._values[o]=this._values[o].possiblyEvaluate(i,r,n);return a}hasTransition(){for(let i of Object.keys(this._values))if(this._values[i].prior)return!0;return!1}}class nl{constructor(i){this._properties=i,this._values=Object.create(i.defaultPropertyValues)}getValue(i){return F(this._values[i].value)}setValue(i,r){this._values[i]=new nr(this._values[i].property,null===r?void 0:F(r))}serialize(){let i={};for(let r of Object.keys(this._values)){let n=this.getValue(r);void 0!==n&&(i[r]=n)}return i}possiblyEvaluate(i,r,n){let a=new nu(this._properties);for(let o of Object.keys(this._values))a._values[o]=this._values[o].possiblyEvaluate(i,r,n);return a}}class nh{constructor(i,r,n){this.property=i,this.value=r,this.parameters=n}isConstant(){return"constant"===this.value.kind}constantOr(i){return"constant"===this.value.kind?this.value.value:i}evaluate(i,r,n,a){return this.property.evaluate(this.value,this.parameters,i,r,n,a)}}class nu{constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class nc{constructor(i){this.specification=i}possiblyEvaluate(i,r){return i.expression.evaluate(r)}interpolate(i,r,n){let a=t$[this.specification.type];return a?a(i,r,n):i}}class np{constructor(i,r){this.specification=i,this.overrides=r}possiblyEvaluate(i,r,n,a){return new nh(this,"constant"===i.expression.kind||"camera"===i.expression.kind?{kind:"constant",value:i.expression.evaluate(r,null,{},n,a)}:i.expression,r)}interpolate(i,r,n){if("constant"!==i.value.kind||"constant"!==r.value.kind)return i;if(void 0===i.value.value||void 0===r.value.value)return new nh(this,{kind:"constant",value:void 0},i.parameters);let a=t$[this.specification.type];return a?new nh(this,{kind:"constant",value:a(i.value.value,r.value.value,n)},i.parameters):i}evaluate(i,r,n,a,o,s){return"constant"===i.kind?i.value:i.evaluate(r,n,a,o,s)}}class nd extends np{possiblyEvaluate(i,r,n,a){if(void 0===i.value)return new nh(this,{kind:"constant",value:void 0},r);if("constant"===i.expression.kind){let o=i.expression.evaluate(r,null,{},n,a),s="resolvedImage"===i.property.specification.type&&"string"!=typeof o?o.name:o,l=this._calculate(s,s,s,r);return new nh(this,{kind:"constant",value:l},r)}if("camera"===i.expression.kind){let n=this._calculate(i.expression.evaluate({zoom:r.zoom-1}),i.expression.evaluate({zoom:r.zoom}),i.expression.evaluate({zoom:r.zoom+1}),r);return new nh(this,{kind:"constant",value:n},r)}return new nh(this,i.expression,r)}
8evaluate(i,r,n,a,o,s){if("source"===i.kind){let l=i.evaluate(r,n,a,o,s);return this._calculate(l,l,l,r)}return"composite"===i.kind?this._calculate(i.evaluate({zoom:Math.floor(r.zoom)-1},n,a),i.evaluate({zoom:Math.floor(r.zoom)},n,a),i.evaluate({zoom:Math.floor(r.zoom)+1},n,a),r):i.value}_calculate(i,r,n,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:i,to:r,other:n}:{from:n,to:r,other:i}}interpolate(i){return i}}class nf{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,a){if(void 0!==i.value){if("constant"===i.expression.kind){let o=i.expression.evaluate(r,null,{},n,a);return this._calculate(o,o,o,r)}return this._calculate(i.expression.evaluate(new ni(Math.floor(r.zoom-1),r)),i.expression.evaluate(new ni(Math.floor(r.zoom),r)),i.expression.evaluate(new ni(Math.floor(r.zoom+1),r)),r)}}_calculate(i,r,n,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:i,to:r}:{from:n,to:r}}interpolate(i){return i}}class nm{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,a){return!!i.expression.evaluate(r,null,{},n,a)}interpolate(){return!1}}class n_{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];let r=new ni(0,{});for(let n in i){let a=i[n];a.specification.overridable&&this.overridableProperties.push(n);let o=this.defaultPropertyValues[n]=new nr(a,void 0),s=this.defaultTransitionablePropertyValues[n]=new nn(a);this.defaultTransitioningPropertyValues[n]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=o.possiblyEvaluate(r)}}}function ng(i,r){return 256*(i=w(Math.floor(i),0,255))+w(Math.floor(r),0,255)}rg(np,"DataDrivenProperty"),rg(nc,"DataConstantProperty"),rg(nd,"CrossFadedDataDrivenProperty"),rg(nf,"CrossFadedProperty"),rg(nm,"ColorRampProperty");let ny={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};
vendor: 14,980 bytes, line 8
8class nx{constructor(i,r){this._structArray=i,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class nv{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(i,r){return i._trim(),r&&(i.isTransferred=!0,r.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){let r=Object.create(this.prototype);return r.arrayBuffer=i.arrayBuffer,r.length=i.length,r.capacity=i.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function nb(i,r=1){let n=0,a=0;return{members:i.map(i=>{let o=ny[i.type].BYTES_PER_ELEMENT,s=n=nw(n,Math.max(r,o)),l=i.components||1;return a=Math.max(a,o),n+=o*l,{name:i.name,type:i.type,components:l,offset:s}}),size:nw(n,Math.max(a,r)),alignment:r}}function nw(i,r){return Math.ceil(i/r)*r}class nT extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r){let n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){let a=2*i;return this.int16[a+0]=r,this.int16[a+1]=n,i}}nT.prototype.bytesPerElement=4,rg(nT,"StructArrayLayout2i4");class nE extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n){let a=this.length;return this.resize(a+1),this.emplace(a,i,r,n)}emplace(i,r,n,a){let o=3*i;return this.int16[o+0]=r,this.int16[o+1]=n,this.int16[o+2]=a,i}}nE.prototype.bytesPerElement=6,rg(nE,"StructArrayLayout3i6");class nS extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,n,a)}emplace(i,r,n,a,o){let s=4*i;return this.int16[s+0]=r,this.int16[s+1]=n,this.int16[s+2]=a,this.int16[s+3]=o,i}}nS.prototype.bytesPerElement=8,rg(nS,"StructArrayLayout4i8");class nI extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,n,a,o,s,l)}emplace(i,r,n,a,o,s,l,h){let u=6*i,c=12*i;return this.int16[u+0]=r,this.int16[u+1]=n,this.uint8[c+4]=a,this.uint8[c+5]=o,this.uint8[c+6]=s,this.uint8[c+7]=l,this.float32[3*i+2]=h,i}}nI.prototype.bytesPerElement=12,rg(nI,"StructArrayLayout2i4ub1f12");class nA extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,n,a)}emplace(i,r,n,a,o){let s=4*i;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=a,this.float32[s+3]=o,i}}nA.prototype.bytesPerElement=16,rg(nA,"StructArrayLayout4f16");class nM extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l,h,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,i,r,n,a,o,s,l,h,u,c)}emplace(i,r,n,a,o,s,l,h,u,c,p){let d=10*i;return this.uint16[d+0]=r,this.uint16[d+1]=n,this.uint16[d+2]=a,this.uint16[d+3]=o,this.uint16[d+4]=s,this.uint16[d+5]=l,this.uint16[d+6]=h,this.uint16[d+7]=u,this.uint16[d+8]=c,this.uint16[d+9]=p,i}}nM.prototype.bytesPerElement=20,rg(nM,"StructArrayLayout10ui20");class nC extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l,h){let u=this.length;return this.resize(u+1),this.emplace(u,i,r,n,a,o,s,l,h)}emplace(i,r,n,a,o,s,l,h,u){let c=8*i;return this.uint16[c+0]=r,this.uint16[c+1]=n,this.uint16[c+2]=a,this.uint16[c+3]=o,this.uint16[c+4]=s,this.uint16[c+5]=l,this.uint16[c+6]=h,this.uint16[c+7]=u,i}}nC.prototype.bytesPerElement=16,rg(nC,"StructArrayLayout8ui16");class nz extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,n,a,o,s)}emplace(i,r,n,a,o,s,l){let h=6*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.int16[h+2]=a,this.int16[h+3]=o,this.int16[h+4]=s,this.int16[h+5]=l,i}}nz.prototype.bytesPerElement=12,rg(nz,"StructArrayLayout6i12");class nP extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l,h,u,c,p,d){let f=this.length;return this.resize(f+1),this.emplace(f,i,r,n,a,o,s,l,h,u,c,p,d)}emplace(i,r,n,a,o,s,l,h,u,c,p,d,f){let m=12*i;return this.int16[m+0]=r,this.int16[m+1]=n,this.int16[m+2]=a,this.int16[m+3]=o,this.uint16[m+4]=s,this.uint16[m+5]=l,this.uint16[m+6]=h,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=p,this.int16[m+10]=d,this.int16[m+11]=f,i}}nP.prototype.bytesPerElement=24,rg(nP,"StructArrayLayout4i4ui4i24");class nk extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,n,a,o,s)}emplace(i,r,n,a,o,s,l){let h=10*i,u=5*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.int16[h+2]=a,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,i}}nk.prototype.bytesPerElement=20,rg(nk,"StructArrayLayout3i3f20");class nD extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint32[1*i+0]=r,i}}nD.prototype.bytesPerElement=4,rg(nD,"StructArrayLayout1ul4");class nL extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l,h,u,c,p,d,f){let m=this.length;return this.resize(m+1),this.emplace(m,i,r,n,a,o,s,l,h,u,c,p,d,f)}emplace(i,r,n,a,o,s,l,h,u,c,p,d,f,m){let _=20*i,g=10*i;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=a,this.int16[_+3]=o,this.int16[_+4]=s,this.float32[g+3]=l,this.float32[g+4]=h,this.float32[g+5]=u,this.float32[g+6]=c,this.int16[_+14]=p,this.uint32[g+8]=d,this.uint16[_+18]=f,this.uint16[_+19]=m,i}}nL.prototype.bytesPerElement=40,rg(nL,"StructArrayLayout5i4f1i1ul2ui40");class nB extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,n,a,o,s,l)}emplace(i,r,n,a,o,s,l,h){let u=8*i;return this.int16[u+0]=r,this.int16[u+1]=n,this.int16[u+2]=a,this.int16[u+4]=o,this.int16[u+5]=s,this.int16[u+6]=l,this.int16[u+7]=h,i}}nB.prototype.bytesPerElement=16,rg(nB,"StructArrayLayout3i2i2i16");class nR extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,a,o)}emplace(i,r,n,a,o,s){let l=4*i,h=8*i;return this.float32[l+0]=r,this.float32[l+1]=n,this.float32[l+2]=a,this.int16[h+6]=o,this.int16[h+7]=s,i}}nR.prototype.bytesPerElement=16,rg(nR,"StructArrayLayout2f1f2i16");class nF extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,n,a)}emplace(i,r,n,a,o){let s=12*i,l=3*i;return this.uint8[s+0]=r,this.uint8[s+1]=n,this.float32[l+1]=a,this.float32[l+2]=o,i}}nF.prototype.bytesPerElement=12,rg(nF,"StructArrayLayout2ub2f12");class nO extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n){let a=this.length;return this.resize(a+1),this.emplace(a,i,r,n)}emplace(i,r,n,a){let o=3*i;return this.float32[o+0]=r,this.float32[o+1]=n,this.float32[o+2]=a,i}}nO.prototype.bytesPerElement=12,rg(nO,"StructArrayLayout3f12");class nU extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n){let a=this.length;return this.resize(a+1),this.emplace(a,i,r,n)}emplace(i,r,n,a){let o=3*i;return this.uint16[o+0]=r,this.uint16[o+1]=n,this.uint16[o+2]=a,i}}nU.prototype.bytesPerElement=6,rg(nU,"StructArrayLayout3ui6");class nV extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x,v,b,w){let T=this.length;return this.resize(T+1),this.emplace(T,i,r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x,v,b,w)}emplace(i,r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x,v,b,w,T){let E=30*i,S=15*i,I=60*i;return this.int16[E+0]=r,this.int16[E+1]=n,this.int16[E+2]=a,this.float32[S+2]=o,this.float32[S+3]=s,this.uint16[E+8]=l,this.uint16[E+9]=h,this.uint32[S+5]=u,this.uint32[S+6]=c,this.uint32[S+7]=p,this.uint16[E+16]=d,this.uint16[E+17]=f,this.uint16[E+18]=m,this.float32[S+10]=_,this.float32[S+11]=g,this.uint8[I+48]=y,this.uint8[I+49]=x,this.uint8[I+50]=v,this.uint32[S+13]=b,this.int16[E+28]=w,this.uint8[I+58]=T,i}}nV.prototype.bytesPerElement=60,rg(nV,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class nj extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x,v,b,w,T,E,S,I,A,M,C,z,P){let k=this.length;return this.resize(k+1),this.emplace(k,i,r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x,v,b,w,T,E,S,I,A,M,C,z,P)}emplace(i,r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x,v,b,w,T,E,S,I,A,M,C,z,P,k){let D=38*i,L=19*i;return this.int16[D+0]=r,this.int16[D+1]=n,this.int16[D+2]=a,this.float32[L+2]=o,this.float32[L+3]=s,this.int16[D+8]=l,this.int16[D+9]=h,this.int16[D+10]=u,this.int16[D+11]=c,this.int16[D+12]=p,this.int16[D+13]=d,this.uint16[D+14]=f,this.uint16[D+15]=m,this.uint16[D+16]=_,this.uint16[D+17]=g,this.uint16[D+18]=y,this.uint16[D+19]=x,this.uint16[D+20]=v,this.uint16[D+21]=b,this.uint16[D+22]=w,this.uint16[D+23]=T,this.uint16[D+24]=E,this.uint16[D+25]=S,this.uint16[D+26]=I,this.uint16[D+27]=A,this.uint16[D+28]=M,this.uint32[L+15]=C,this.float32[L+16]=z,this.float32[L+17]=P,this.float32[L+18]=k,i}}nj.prototype.bytesPerElement=76,rg(nj,"StructArrayLayout3i2f6i15ui1ul3f76");class nN extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.float32[1*i+0]=r,i}}nN.prototype.bytesPerElement=4,rg(nN,"StructArrayLayout1f4");class nG extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,a,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,a,o)}emplace(i,r,n,a,o,s){let l=5*i;return this.float32[l+0]=r,this.float32[l+1]=n,this.float32[l+2]=a,this.float32[l+3]=o,this.float32[l+4]=s,i}}nG.prototype.bytesPerElement=20,rg(nG,"StructArrayLayout5f20");class nZ extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,n,a)}emplace(i,r,n,a,o){let s=6*i;return this.uint32[3*i+0]=r,this.uint16[s+2]=n,this.uint16[s+3]=a,this.uint16[s+4]=o,i}}nZ.prototype.bytesPerElement=12,rg(nZ,"StructArrayLayout1ul3ui12");class n$ extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r){let n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){let a=2*i;return this.uint16[a+0]=r,this.uint16[a+1]=n,i}}n$.prototype.bytesPerElement=4,rg(n$,"StructArrayLayout2ui4");class nq extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint16[1*i+0]=r,i}}nq.prototype.bytesPerElement=2,rg(nq,"StructArrayLayout1ui2");class nX extends nv{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r){let n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){let a=2*i;return this.float32[a+0]=r,this.float32[a+1]=n,i}}nX.prototype.bytesPerElement=8,rg(nX,"StructArrayLayout2f8");class nW extends nx{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}nW.prototype.size=12;class nH extends nz{get(i){return new nW(this,i)}}rg(nH,"FillExtrusionExtArray");class nY extends nx{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}nY.prototype.size=40;
vendor: 6,032 bytes, line 8
8class nK extends nL{get(i){return new nY(this,i)}}rg(nK,"CollisionBoxArray");class nJ extends nx{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(i){this._structArray.uint8[this._pos1+49]=i}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(i){this._structArray.uint8[this._pos1+50]=i}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(i){this._structArray.uint32[this._pos4+13]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(i){this._structArray.uint8[this._pos1+58]=i}}nJ.prototype.size=60;class nQ extends nV{get(i){return new nJ(this,i)}}rg(nQ,"PlacedSymbolArray");class n0 extends nx{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(i){this._structArray.uint32[this._pos4+15]=i}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}n0.prototype.size=76;class n1 extends nj{get(i){return new n0(this,i)}}rg(n1,"SymbolInstanceArray");class n2 extends nN{getoffsetX(i){return this.float32[1*i+0]}}rg(n2,"GlyphOffsetArray");class n3 extends nE{getx(i){return this.int16[3*i+0]}gety(i){return this.int16[3*i+1]}gettileUnitDistanceFromAnchor(i){return this.int16[3*i+2]}}rg(n3,"SymbolLineVertexArray");class n5 extends nx{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}n5.prototype.size=12;class n4 extends nZ{get(i){return new n5(this,i)}}rg(n4,"FeatureIndexArray");class n6 extends nx{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}n6.prototype.size=4;class n8 extends n${get(i){return new n6(this,i)}}rg(n8,"FillExtrusionCentroidArray");class n9 extends nx{get a_pos_30(){return this._structArray.int16[this._pos2+0]}get a_pos_31(){return this._structArray.int16[this._pos2+1]}get a_pos_32(){return this._structArray.int16[this._pos2+2]}get a_pos_normal_30(){return this._structArray.int16[this._pos2+3]}get a_pos_normal_31(){return this._structArray.int16[this._pos2+4]}get a_pos_normal_32(){return this._structArray.int16[this._pos2+5]}}n9.prototype.size=12;class n7 extends nz{get(i){return new n9(this,i)}}rg(n7,"CircleGlobeExtArray");let ae=nb([{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"}]),at=nb([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"}]);var ai=tt(function(i){i.exports=function(i,r){var n,a,o,s,l,h;for(a=i.length-(n=3&i.length),o=r,h=0;h<a;
8)l=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24,++h,o=27492+(65535&(s=5*(65535&(o=(o^=l=(65535&(l=(l=(65535&l)*3432918353+(((l>>>16)*3432918353&65535)<<16)&4294967295)<<15|l>>>17))*461845907+(((l>>>16)*461845907&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&i.charCodeAt(h+2))<<16;case 2:l^=(255&i.charCodeAt(h+1))<<8;case 1:o^=l=(65535&(l=(l=(65535&(l^=255&i.charCodeAt(h)))*3432918353+(((l>>>16)*3432918353&65535)<<16)&4294967295)<<15|l>>>17))*461845907+(((l>>>16)*461845907&65535)<<16)&4294967295}return o^=i.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0}}),ar=tt(function(i){i.exports=function(i,r){for(var n,a=i.length,o=r^a,s=0;a>=4;)n=1540483477*(65535&(n=255&i.charCodeAt(s)|(255&i.charCodeAt(++s))<<8|(255&i.charCodeAt(++s))<<16|(255&i.charCodeAt(++s))<<24))+((1540483477*(n>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),a-=4,++s;switch(a){case 3:o^=(255&i.charCodeAt(s+2))<<16;case 2:o^=(255&i.charCodeAt(s+1))<<8;case 1:o=1540483477*(65535&(o^=255&i.charCodeAt(s)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0}}),an=ai;an.murmur3=ai,an.murmur2=ar;class aa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,r,n,a){this.ids.push(ao(i)),this.positions.push(r,n,a)}getPositions(i){let r=ao(i),n=0,a=this.ids.length-1;for(;n<a;){let i=n+a>>1;this.ids[i]>=r?a=i:n=i+1}let o=[];for(;this.ids[n]===r;)o.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return o}static serialize(i,r){let n=new Float64Array(i.ids),a=new Uint32Array(i.positions);return function i(r,n,a,o){for(;a<o;){let s=r[a+o>>1],l=a-1,h=o+1;for(;;){do l++;while(r[l]<s);do h--;while(r[h]>s);if(l>=h)break;as(r,l,h),as(n,3*l,3*h),as(n,3*l+1,3*h+1),as(n,3*l+2,3*h+2)}h-a<o-h?(i(r,n,a,h),a=h+1):(i(r,n,h+1,o),o=h)}}(n,a,0,n.length-1),r&&r.push(n.buffer,a.buffer),{ids:n,positions:a}}static deserialize(i){let r=new aa;return r.ids=i.ids,r.positions=i.positions,r.indexed=!0,r}}function ao(i){let r=+i;return!isNaN(r)&&Number.MIN_SAFE_INTEGER<=r&&r<=Number.MAX_SAFE_INTEGER?r:an(String(i))}function as(i,r,n){let a=i[r];i[r]=i[n],i[n]=a}rg(aa,"FeaturePositionMap");class al{constructor(i){this.gl=i.gl,this.initialized=!1}fetchUniformLocation(i,r){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(i,r),this.initialized=!0),!!this.location}}class ah extends al{constructor(i){super(i),this.current=0}set(i,r,n){this.fetchUniformLocation(i,r)&&this.current!==n&&(this.current=n,this.gl.uniform1f(this.location,n))}}class au extends al{constructor(i){super(i),this.current=[0,0,0,0]}set(i,r,n){this.fetchUniformLocation(i,r)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4f(this.location,n[0],n[1],n[2],n[3])))}}class ac extends al{constructor(i){super(i),this.current=tr.transparent}set(i,r,n){this.fetchUniformLocation(i,r)&&(n.r===this.current.r&&n.g===this.current.g&&n.b===this.current.b&&n.a===this.current.a||(this.current=n,this.gl.uniform4f(this.location,n.r,n.g,n.b,n.a)))}}let ap=new Float32Array(16),ad=new Float32Array(9),af=new Float32Array(4);function am(i){return[ng(255*i.r,255*i.g),ng(255*i.b,255*i.a)]}class a_{constructor(i,r,n){this.value=i,this.uniformNames=r.map(i=>`u_${i}`),this.type=n}setUniform(i,r,n,a,o){r.set(i,o,a.constantOr(this.value))}getBinding(i,r){return"color"===this.type?new ac(i):new ah(i)}}class ag{constructor(i,r){this.uniformNames=r.map(i=>`u_${i}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(i,r){this.pixelRatioFrom=r.pixelRatio||1,this.pixelRatioTo=i.pixelRatio||1,this.patternFrom=r.tl.concat(r.br),this.patternTo=i.tl.concat(i.br)}setUniform(i,r,n,a,o){let s="u_pattern_to"===o||"u_dash_to"===o?this.patternTo:"u_pattern_from"===o||"u_dash_from"===o?this.patternFrom:"u_pixel_ratio_to"===o?this.pixelRatioTo:"u_pixel_ratio_from"===o?this.pixelRatioFrom:null;s&&r.set(i,o,s)}getBinding(i,r){return"u_pattern_from"===r||"u_pattern_to"===r||"u_dash_from"===r||"u_dash_to"===r?new au(i):new ah(i)}}class ay{constructor(i,r,n,a){this.expression=i,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(i,r,n,a,o,s){let l=this.paintVertexArray.length,h=this.expression.evaluate(new ni(0),r,{},o,a,s);this.paintVertexArray.resize(i),this._setPaintValue(l,i,h)}updatePaintArray(i,r,n,a,o){let s=this.expression.evaluate({zoom:0},n,a,void 0,o);this._setPaintValue(i,r,s)}_setPaintValue(i,r,n){if("color"===this.type){let a=am(n);for(let n=i;n<r;n++)this.paintVertexArray.emplace(n,a[0],a[1])}else{for(let a=i;a<r;a++)this.paintVertexArray.emplace(a,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class ax{constructor(i,r,n,a,o,s){this.expression=i,this.uniformNames=r.map(i=>`u_${i}_t`),this.type=n,this.useIntegerZoom=a,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(i,r,n,a,o,s){let l=this.expression.evaluate(new ni(this.zoom),r,{},o,a,s),h=this.expression.evaluate(new ni(this.zoom+1),r,{},o,a,s),u=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(u,i,l,h)}updatePaintArray(i,r,n,a,o){let s=this.expression.evaluate({zoom:this.zoom},n,a,void 0,o),l=this.expression.evaluate({zoom:this.zoom+1},n,a,void 0,o);this._setPaintValue(i,r,s,l)}_setPaintValue(i,r,n,a){if("color"===this.type){let o=am(n),s=am(a);for(let n=i;n<r;n++)this.paintVertexArray.emplace(n,o[0],o[1],s[0],s[1])}else{for(let o=i;o<r;o++)this.paintVertexArray.emplace(o,n,a);
8this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(a))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(i,r,n,a,o){let s=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,l=w(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);r.set(i,o,l)}getBinding(i,r){return new ah(i)}}class av{constructor(i,r,n,a,o,s,l){this.expression=i,this.type=n,this.useIntegerZoom=a,this.zoom=o,this.layerId=l,this.paintVertexAttributes=("array"===n?at:ae).members;for(let i=0;i<r.length;++i);this.zoomInPaintVertexArray=new s,this.zoomOutPaintVertexArray=new s}populatePaintArray(i,r,n){let a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(i),this.zoomOutPaintVertexArray.resize(i),this._setPaintValues(a,i,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(i,r,n,a,o,s){this._setPaintValues(i,r,n.patterns&&n.patterns[this.layerId],s)}_setPaintValues(i,r,n,a){if(!a||!n)return;let{min:o,mid:s,max:l}=n,h=a[o],u=a[s],c=a[l];if(h&&u&&c)for(let n=i;n<r;n++)this._setPaintValue(this.zoomInPaintVertexArray,n,u,h),this._setPaintValue(this.zoomOutPaintVertexArray,n,u,c)}_setPaintValue(i,r,n,a){i.emplace(r,n.tl[0],n.tl[1],n.br[0],n.br[1],a.tl[0],a.tl[1],a.br[0],a.br[1],n.pixelRatio,a.pixelRatio)}upload(i){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=i.createVertexBuffer(this.zoomInPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=i.createVertexBuffer(this.zoomOutPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ab{constructor(i,r,n=()=>!0){this.binders={},this._buffers=[];let a=[];for(let l in i.paint._values){var o,s;if(!n(l))continue;let h=i.paint.get(l);if(!(h instanceof nh&&iS(h.property.specification)))continue;let u=(o=l,s=i.type,aT[o]||[o.replace(`${s}-`,"").replace(/-/g,"_")]),c=h.value,p=h.property.specification.type,d=h.property.useIntegerZoom,f=h.property.specification["property-type"],m="cross-faded"===f||"cross-faded-data-driven"===f,_="line-dasharray"===String(l)&&"constant"!==i.layout.get("line-cap").value.kind;if("constant"!==c.kind||_){if("source"===c.kind||_||m){let n=aI(l,p,"source");this.binders[l]=m?new av(c,u,p,d,r,n,i.id):new ay(c,u,p,n),a.push(`/a_${l}`)}else{let i=aI(l,p,"composite");this.binders[l]=new ax(c,u,p,d,r,i),a.push(`/z_${l}`)}}else this.binders[l]=m?new ag(c.value,u):new a_(c.value,u,p),a.push(`/u_${l}`)}this.cacheKey=a.sort().join("")}getMaxValue(i){let r=this.binders[i];return r instanceof ay||r instanceof ax?r.maxValue:0}populatePaintArrays(i,r,n,a,o,s){for(let l in this.binders){let h=this.binders[l];(h instanceof ay||h instanceof ax||h instanceof av)&&h.populatePaintArray(i,r,n,a,o,s)}}setConstantPatternPositions(i,r){for(let n in this.binders){let a=this.binders[n];a instanceof ag&&a.setConstantPatternPositions(i,r)}}updatePaintArrays(i,r,n,a,o,s){let l=!1;for(let h in i){let u=r.getPositions(h);for(let r of u){let u=n.feature(r.index);for(let n in this.binders){let c=this.binders[n];if((c instanceof ay||c instanceof ax||c instanceof av)&&!0===c.expression.isStateDependent){let p=a.paint.get(n);c.expression=p.value,c.updatePaintArray(r.start,r.end,u,i[h],o,s),l=!0}}}}return l}defines(){let i=[];for(let r in this.binders){let n=this.binders[r];(n instanceof a_||n instanceof ag)&&i.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return i}getBinderAttributes(){let i=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof ay||n instanceof ax||n instanceof av)for(let r=0;r<n.paintVertexAttributes.length;r++)i.push(n.paintVertexAttributes[r].name)}return i}getBinderUniforms(){let i=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof a_||n instanceof ag||n instanceof ax)for(let r of n.uniformNames)i.push(r)}return i}getPaintVertexBuffers(){return this._buffers}getUniforms(i){let r=[];for(let n in this.binders){let a=this.binders[n];if(a instanceof a_||a instanceof ag||a instanceof ax)for(let o of a.uniformNames)r.push({name:o,property:n,binding:a.getBinding(i,o)})}return r}setUniforms(i,r,n,a,o){for(let{name:r,property:s,binding:l}of n)this.binders[s].setUniform(i,l,o,a.get(s),r)}updatePaintBuffers(i){for(let r in this._buffers=[],this.binders){let n=this.binders[r];if(i&&n instanceof av){let r=2===i.fromScale?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(n instanceof ay||n instanceof ax)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(i){for(let r in this.binders){let n=this.binders[r];(n instanceof ay||n instanceof ax||n instanceof av)&&n.upload(i)}this.updatePaintBuffers()}destroy(){for(let i in this.binders){let r=this.binders[i];(r instanceof ay||r instanceof ax||r instanceof av)&&r.destroy()}}}class aw{constructor(i,r,n=()=>!0){for(let a of(this.programConfigurations={},i))this.programConfigurations[a.id]=new ab(a,r,n);this.needsUpload=!1,this._featureMap=new aa,this._bufferOffset=0}populatePaintArrays(i,r,n,a,o,s,l){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(i,r,a,o,s,l);void 0!==r.id&&this._featureMap.add(r.id,n,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,r,n,a,o){for(let s of n)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(i,this._featureMap,r,s,a,o)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(i);this.needsUpload=!1}}destroy(){for(let i in this.programConfigurations)this.programConfigurations[i].destroy()}}let aT={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
8pwidth"],"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"],"line-dasharray":["dash_to","dash_from"]},aE={"line-pattern":{source:nM,composite:nM},"fill-pattern":{source:nM,composite:nM},"fill-extrusion-pattern":{source:nM,composite:nM},"line-dasharray":{source:nC,composite:nC}},aS={color:{source:nX,composite:nA},number:{source:nN,composite:nX}};function aI(i,r,n){let a=aE[i];return a&&a[n]||aS[r][n]}rg(a_,"ConstantBinder"),rg(ag,"CrossFadedConstantBinder"),rg(ay,"SourceExpressionBinder"),rg(av,"CrossFadedCompositeBinder"),rg(ax,"CompositeExpressionBinder"),rg(ab,"ProgramConfiguration",{omit:["_buffers"]}),rg(aw,"ProgramConfigurationSet");let aA="-transition";class aM extends eN{constructor(i,r){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==i.type&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,"background"!==i.type&&"sky"!==i.type&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),r.layout&&(this._unevaluatedLayout=new nl(r.layout)),r.paint)){for(let n in this._transitionablePaint=new na(r.paint),i.paint)this.setPaintProperty(n,i.paint[n],{validate:!1});for(let r in i.layout)this.setLayoutProperty(r,i.layout[r],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new nu(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(i){return"visibility"===i?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,r,n={}){null!=r&&this._validate(rc,`layers.${this.id}.layout.${i}`,i,r,n)||("visibility"!==i?this._unevaluatedLayout.setValue(i,r):this.visibility=r)}getPaintProperty(i){return L(i,aA)?this._transitionablePaint.getTransition(i.slice(0,-aA.length)):this._transitionablePaint.getValue(i)}setPaintProperty(i,r,n={}){if(null!=r&&this._validate(ru,`layers.${this.id}.paint.${i}`,i,r,n))return!1;if(L(i,aA))return this._transitionablePaint.setTransition(i.slice(0,-aA.length),r||void 0),!1;{let n=this._transitionablePaint._values[i],a="cross-faded-data-driven"===n.property.specification["property-type"],o=n.value.isDataDriven(),s=n.value;this._transitionablePaint.setValue(i,r),this._handleSpecialPaintPropertyUpdate(i);let l=this._transitionablePaint._values[i].value;return l.isDataDriven()||o||a||this._handleOverridablePaintPropertyUpdate(i,s,l)}}_handleSpecialPaintPropertyUpdate(i){}getProgramIds(){return null}getProgramConfiguration(i){return null}_handleOverridablePaintPropertyUpdate(i,r,n){return!1}isHidden(i){return!!(this.minzoom&&i<this.minzoom)||!!(this.maxzoom&&i>=this.maxzoom)||"none"===this.visibility}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,r){i.getCrossfadeParameters&&(this._crossfadeParameters=i.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,r)}
8serialize(){let i={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),R(i,(i,r)=>!(void 0===i||"layout"===r&&!Object.keys(i).length||"paint"===r&&!Object.keys(i).length))}_validate(i,r,n,a,o={}){return(!o||!1!==o.validate)&&rd(this,i.call(rh,{key:r,layerType:this.type,objectKey:n,value:a,styleSpec:eG,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let i in this.paint._values){let r=this.paint.get(i);if(r instanceof nh&&iS(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=iK(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}let aC=nb([{name:"a_pos",components:2,type:"Int16"}],4),az=nb([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class aP{constructor(i=[]){this.segments=i}prepareSegment(i,r,n,a){let o=this.segments[this.segments.length-1];return i>aP.MAX_VERTEX_ARRAY_LENGTH&&U(`Max vertices per segment is ${aP.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!o||o.vertexLength+i>aP.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==a)&&(o={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==a&&(o.sortKey=a),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let i of this.segments)for(let r in i.vaos)i.vaos[r].destroy()}static simpleSegment(i,r,n,a){return new aP([{vertexOffset:i,primitiveOffset:r,vertexLength:n,primitiveLength:a,vaos:{},sortKey:0}])}}aP.MAX_VERTEX_ARRAY_LENGTH=65535,rg(aP,"SegmentVector");class ak{constructor(i,r){i&&(r?this.setSouthWest(i).setNorthEast(r):4===i.length?this.setSouthWest([i[0],i[1]]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1]))}setNorthEast(i){return this._ne=i instanceof aD?new aD(i.lng,i.lat):aD.convert(i),this}setSouthWest(i){return this._sw=i instanceof aD?new aD(i.lng,i.lat):aD.convert(i),this}extend(i){let r,n;let a=this._sw,o=this._ne;if(i instanceof aD)r=i,n=i;else{if(!(i instanceof ak))return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(ak.convert(i)):this.extend(aD.convert(i)):this;if(r=i._sw,n=i._ne,!r||!n)return this}return a||o?(a.lng=Math.min(r.lng,a.lng),a.lat=Math.min(r.lat,a.lat),o.lng=Math.max(n.lng,o.lng),o.lat=Math.max(n.lat,o.lat)):(this._sw=new aD(r.lng,r.lat),this._ne=new aD(n.lng,n.lat)),this}getCenter(){return new aD((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 aD(this.getWest(),this.getNorth())}getSouthEast(){return new aD(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(i){let{lng:r,lat:n}=aD.convert(i),a=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&a}static convert(i){return!i||i instanceof ak?i:new ak(i)}}class aD{constructor(i,r){if(isNaN(i)||isNaN(r))throw Error(`Invalid LngLat object: (${i}, ${r})`);if(this.lng=+i,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new aD(E(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){let r=Math.PI/180,n=this.lat*r,a=i.lat*r,o=Math.sin(n)*Math.sin(a)+Math.cos(n)*Math.cos(a)*Math.cos((i.lng-this.lng)*r);return 6371008.8*Math.acos(Math.min(o,1))}toBounds(i=0){let r=360*i/40075017,n=r/Math.cos(Math.PI/180*this.lat);return new ak(new aD(this.lng-n,this.lat-r),new aD(this.lng+n,this.lat+r))}static convert(i){if(i instanceof aD)return i;if(Array.isArray(i)&&(2===i.length||3===i.length))return new aD(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&"object"==typeof i&&null!==i)return new aD(Number("lng"in i?i.lng:i.lon),Number(i.lat));throw 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>]")}}let aL=2*Math.PI*6371008.8;function aB(i){return aL*Math.cos(i*Math.PI/180)}function aR(i){return(180+i)/360}function aF(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function aO(i){return 360*i-180}function aU(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180)
8)-90}function aV(i){return 1/Math.cos(i*Math.PI/180)}class aj{constructor(i,r,n=0){this.x=+i,this.y=+r,this.z=+n}static fromLngLat(i,r=0){let n=aD.convert(i);return new aj(aR(n.lng),aF(n.lat),r/aB(n.lat))}toLngLat(){return new aD(aO(this.x),aU(this.y))}toAltitude(){return this.z*aB(aU(this.y))}meterInMercatorCoordinateUnits(){return 1/aL*aV(aU(this.y))}}function aN(i,r,n){let a=i[0],o=a.x,s=a.y;r(a);let l=[a];for(let h=1;h<i.length;h++){let u=i[h],{x:c,y:p}=u;r(u),function i(r,n,a,o,s,l,h,u,c){let p=(n+o)/2,d=(a+s)/2,m=new f(p,d);u(m),function(i,r,n,a,o,s){let l=n-o,h=a-s;return Math.abs((a-r)*l-(n-i)*h)/Math.hypot(l,h)}(m.x,m.y,l.x,l.y,h.x,h.y)>=c?(i(r,n,a,p,d,l,m,u,c),i(r,p,d,o,s,m,h,u,c)):r.push(h)}(l,o,s,c,p,a,u,r,n),o=c,s=p,a=u}return l}let aG=-16383-1;function aZ(i,r,n){let a=i.loadGeometry(),o=i.extent,s=8192/o;if(r&&n&&n.projection.isReprojectedInTileSpace){let s=1<<r.z,{scale:l,x:h,y:u,projection:c}=n,p=i=>{let n=aO((r.x+i.x/o)/s),a=aU((r.y+i.y/o)/s),p=c.project(n,a);i.x=(p.x*l-h)*o,i.y=(p.y*l-u)*o};for(let r=0;r<a.length;r++)if(1!==i.type)a[r]=aN(a[r],p,1);else{let i=[];for(let n of a[r])n.x<0||n.x>=o||n.y<0||n.y>=o||(p(n),i.push(n));a[r]=i}}for(let i of a)for(let r of i)!function(i,r){let n=Math.round(i.x*r),a=Math.round(i.y*r);i.x=w(n,aG,16383),i.y=w(a,aG,16383),(n<i.x||n>i.x+1||a<i.y||a>i.y+1)&&U("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(r,s);return a}function a$(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?aZ(i):[]}}function aq(i,r,n,a,o){i.emplaceBack(2*r+(a+1)/2,2*n+(o+1)/2)}function aX(i,r,n){i.emplaceBack(r.x,r.y,r.z,16384*n[0],16384*n[1],16384*n[2])}class aW{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.projection=i.projection,this.layoutVertexArray=new nT,this.indexArray=new nU,this.segments=new aP,this.programConfigurations=new aw(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,a){let o=this.layers[0],s=[],l=null;for(let{feature:r,id:h,index:u,sourceLayerIndex:c}of("circle"===o.type&&(l=o.layout.get("circle-sort-key")),i)){let i=this.layers[0]._featureFilter.needGeometry,o=a$(r,i);if(!this.layers[0]._featureFilter.filter(new ni(this.zoom),o,n))continue;let p=l?l.evaluate(o,{},n):void 0,d={id:h,properties:r.properties,type:r.type,sourceLayerIndex:c,index:u,geometry:i?o.geometry:aZ(r,n,a),patterns:{},sortKey:p};s.push(d)}l&&s.sort((i,r)=>i.sortKey-r.sortKey);let h=null;for(let o of("globe"===a.projection.name&&(this.globeExtVertexArray=new n7,h=a.projection),s)){let{geometry:a,index:s,sourceLayerIndex:l}=o,u=i[s].feature;this.addFeature(o,a,s,r.availableImages,n,h),r.featureIndex.insert(u,a,s,l,this.index)}}update(i,r,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,a)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,aC.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,az.members))),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(i,r,n,a,o,s){for(let n of r)for(let r of n){let n=r.x,a=r.y;if(n<0||n>=8192||a<0||a>=8192)continue;if(s){let i=s.projectTilePoint(n,a,o),r=s.upVector(o,n,a),l=this.globeExtVertexArray;aX(l,i,r),aX(l,i,r),aX(l,i,r),aX(l,i,r)}let l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),h=l.vertexLength;aq(this.layoutVertexArray,n,a,-1,-1),aq(this.layoutVertexArray,n,a,1,-1),aq(this.layoutVertexArray,n,a,1,1),aq(this.layoutVertexArray,n,a,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+2,h+3),l.vertexLength+=4,l.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,{},a,o)}}function aH(i,r){for(let n=0;n<i.length;
8n++)if(a1(r,i[n]))return!0;for(let n=0;n<r.length;n++)if(a1(i,r[n]))return!0;return!!aK(i,r)}function aY(i,r){if(1===i.length)return a0(r,i[0]);for(let n=0;n<r.length;n++){let a=r[n];for(let r=0;r<a.length;r++)if(a1(i,a[r]))return!0}for(let n=0;n<i.length;n++)if(a0(r,i[n]))return!0;for(let n=0;n<r.length;n++)if(aK(i,r[n]))return!0;return!1}function aK(i,r){if(0===i.length||0===r.length)return!1;for(let o=0;o<i.length-1;o++){let s=i[o],l=i[o+1];for(let i=0;i<r.length-1;i++){var n,a;if(V(s,n=r[i],a=r[i+1])!==V(l,n,a)&&V(s,l,n)!==V(s,l,a))return!0}}return!1}function aJ(i,r,n){let a=n*n;if(1===r.length)return i.distSqr(r[0])<a;for(let n=1;n<r.length;n++)if(aQ(i,r[n-1],r[n])<a)return!0;return!1}function aQ(i,r,n){let a=r.distSqr(n);if(0===a)return i.distSqr(r);let o=((i.x-r.x)*(n.x-r.x)+(i.y-r.y)*(n.y-r.y))/a;return i.distSqr(o<0?r:o>1?n:n.sub(r)._mult(o)._add(r))}function a0(i,r){let n,a,o,s=!1;for(let l=0;l<i.length;l++){n=i[l];for(let i=0,l=n.length-1;i<n.length;l=i++)a=n[i],o=n[l],a.y>r.y!=o.y>r.y&&r.x<(o.x-a.x)*(r.y-a.y)/(o.y-a.y)+a.x&&(s=!s)}return s}function a1(i,r){let n=!1;for(let a=0,o=i.length-1;a<i.length;o=a++){let s=i[a],l=i[o];s.y>r.y!=l.y>r.y&&r.x<(l.x-s.x)*(r.y-s.y)/(l.y-s.y)+s.x&&(n=!n)}return n}function a2(i,r,n,a,o){for(let s of i)if(r<=s.x&&n<=s.y&&a>=s.x&&o>=s.y)return!0;let s=[new f(r,n),new f(r,o),new f(a,o),new f(a,n)];if(i.length>2){for(let r of s)if(a1(i,r))return!0}for(let r=0;r<i.length-1;r++)if(function(i,r,n){let a=n[0],o=n[2];if(i.x<a.x&&r.x<a.x||i.x>o.x&&r.x>o.x||i.y<a.y&&r.y<a.y||i.y>o.y&&r.y>o.y)return!1;let s=V(i,r,n[0]);return s!==V(i,r,n[1])||s!==V(i,r,n[2])||s!==V(i,r,n[3])}(i[r],i[r+1],s))return!0;return!1}function a3(i,r,n){let a=r.paint.get(i).value;return"constant"===a.kind?a.value:n.programConfigurations.get(r.id).getMaxValue(i)}function a5(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function a4(i,r,n,a,o){if(!r[0]&&!r[1])return i;let s=f.convert(r)._mult(o);"viewport"===n&&s._rotate(-a);let l=[];for(let r=0;r<i.length;r++)l.push(i[r].sub(s));return l}function a6(i,r,n,a){let o=f.convert(i)._mult(a);return"viewport"===r&&o._rotate(-n),o}rg(aW,"CircleBucket",{omit:["layers"]});let a8=new n_({"circle-sort-key":new np(eG.layout_circle["circle-sort-key"])});var a9={paint:new n_({"circle-radius":new np(eG.paint_circle["circle-radius"]),"circle-color":new np(eG.paint_circle["circle-color"]),"circle-blur":new np(eG.paint_circle["circle-blur"]),"circle-opacity":new np(eG.paint_circle["circle-opacity"]),"circle-translate":new nc(eG.paint_circle["circle-translate"]),"circle-translate-anchor":new nc(eG.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new nc(eG.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new nc(eG.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new np(eG.paint_circle["circle-stroke-width"]),"circle-stroke-color":new np(eG.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new np(eG.paint_circle["circle-stroke-opacity"])}),layout:a8},a7="undefined"!=typeof Float32Array?Float32Array:Array;function oe(){var i=new a7(9);return a7!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function ot(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function oi(i,r){var n=r[0],a=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],p=r[8],d=r[9],f=r[10],m=r[11],_=r[12],g=r[13],y=r[14],x=r[15],v=n*h-a*l,b=n*u-o*l,w=n*c-s*l,T=a*u-o*h,E=a*c-s*h,S=o*c-s*u,I=p*g-d*_,A=p*y-f*_,M=p*x-m*_,C=d*y-f*g,z=d*x-m*g,P=f*x-m*y,k=v*P-b*z+w*C+T*M-E*A+S*I;return k?(i[0]=(h*P-u*z+c*C)*(k=1/k),i[1]=(o*z-a*P-s*C)*k,i[2]=(g*S-y*E+x*T)*k,i[3]=(f*E-d*S-m*T)*k,i[4]=(u*M-l*P-c*A)*k,i[5]=(n*P-o*M+s*A)*k,i[6]=(y*w-_*S-x*b)*k,i[7]=(p*S-f*w+m*b)*k,i[8]=(l*z-h*M+c*I)*k,i[9]=(a*M-n*z-s*I)*k,i[10]=(_*E-g*w+x*v)*k,i[11]=(d*w-p*E-m*v)*k,i[12]=(h*A-l*C-u*I)*k,i[13]=(n*C-a*A+o*I)*k,i[14]=(g*b-_*T-y*v)*k,i[15]=(p*T-d*b+f*v)*k,i):null}function or(i,r,n){var a=r[0],o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],p=r[7],d=r[8],f=r[9],m=r[10],_=r[11],g=r[12],y=r[13],x=r[14],v=r[15],b=n[0],w=n[1],T=n[2],E=n[3];return i[0]=b*a+w*h+T*d+E*g,i[1]=b*o+w*u+T*f+E*y,i[2]=b*s+w*c+T*m+E*x,i[3]=b*l+w*p+T*_+E*v,i[4]=(b=n[4])*a+(w=n[5])*h+(T=n[6])*d+(E=n[7])*g,i[5]=b*o+w*u+T*f+E*y,i[6]=b*s+w*c+T*m+E*x,i[7]=b*l+w*p+T*_+E*v,i[8]=(b=n[8])*a+(w=n[9])*h+(T=n[10])*d+(E=n[11])*g,i[9]=b*o+w*u+T*f+E*y,i[10]=b*s+w*c+T*m+E*x,i[11]=b*l+w*p+T*_+E*v,i[12]=(b=n[12])*a+(w=n[13])*h+(T=n[14])*d+(E=n[15])*g,i[13]=b*o+w*u+T*f+E*y,i[14]=b*s+w*c+T*m+E*x,i[15]=b*l+w*p+T*_+E*v,i}function on(i,r,n){var a,o,s,l,h,u,c,p,d,f,m,_,g=n[0],y=n[1],x=n[2];return r===i?(i[12]=r[0]*g+r[4]*y+r[8]*x+r[12],i[13]=r[1]*g+r[5]*y+r[9]*x+r[13],i[14]=r[2]*g+r[6]*y+r[10]*x+r[14],i[15]=r[3]*g+r[7]*y+r[11]*x+r[15]):(o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],p=r[7],d=r[8],f=r[9],m=r[10],_=r[11],i[0]=a=r[0],i[1]=o,i[2]=s,i[3]=l,i[4]=h,i[5]=u,i[6]=c,i[7]=p,i[8]=d,i[9]=f,i[10]=m,i[11]=_,i[12]=a*g+h*y+d*x+r[12],i[13]=o*g+u*y+f*x+r[13],i[14]=s*g+c*y+m*x+r[14],i[15]=l*g+p*y+_*x+r[15]),i}function oa(i,r,n){var a=n[0],o=n[1],s=n[2];return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i[3]=r[3]*a,i[4]=r[4]*o,i[5]=r[5]*o,i[6]=r[6]*o,i[7]=r[7]*o,i[8]=r[8]*s,i[9]=r[9]*s,i[10]=r[10]*s,i[11]=r[11]*s,i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i}function oo(i,r,n){var a=Math.sin(n),o=Math.cos(n),s=r[4],l=r[5],h=r[6],u=r[7],c=r[8],p=r[9],d=r[10],f=r[11];return r!==i&&(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[4]=s*o+c*a,i[5]=l*o+p*a,i[6]=h*o+d*a,i[7]=u*o+f*a,i[8]=c*o-s*a,i[9]=p*o-l*a,i[10]=d*o-h*a,i[11]=f*o-u*a,i}function os(i,r,n){var a=Math.sin(n),o=Math.cos(n),s=r[0],l=r[1],h=r[2],u=r[3],c=r[8],p=r[9],d=r[10],f=r[11];return r!==i&&(i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=s*o-c*a,i[1]=l*o-p*a,i[2]=h*o-d*a,i[3]=u*o-f*a,i[8]=s*a+c*o,i[9]=l*a+p*o,i[10]=h*
vendor: 1,705 bytes, line 8
8a+d*o,i[11]=u*a+f*o,i}function ol(i,r){return i[0]=r[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=r[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function oh(i,r,n){var a,o,s,l=n[0],h=n[1],u=n[2],c=Math.hypot(l,h,u);return c<1e-6?null:(l*=c=1/c,h*=c,u*=c,a=Math.sin(r),o=Math.cos(r),i[0]=l*l*(s=1-o)+o,i[1]=h*l*s+u*a,i[2]=u*l*s-h*a,i[3]=0,i[4]=l*h*s-u*a,i[5]=h*h*s+o,i[6]=u*h*s+l*a,i[7]=0,i[8]=l*u*s+h*a,i[9]=h*u*s-l*a,i[10]=u*u*s+o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i)}function ou(){var i=new a7(3);return a7!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function oc(i){var r=new a7(3);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r}function op(i){return Math.hypot(i[0],i[1],i[2])}function od(i,r,n){var a=new a7(3);return a[0]=i,a[1]=r,a[2]=n,a}function of(i,r,n){return i[0]=r[0]+n[0],i[1]=r[1]+n[1],i[2]=r[2]+n[2],i}function om(i,r,n){return i[0]=r[0]-n[0],i[1]=r[1]-n[1],i[2]=r[2]-n[2],i}function o_(i,r,n){return i[0]=r[0]*n[0],i[1]=r[1]*n[1],i[2]=r[2]*n[2],i}function og(i,r,n){return i[0]=Math.min(r[0],n[0]),i[1]=Math.min(r[1],n[1]),i[2]=Math.min(r[2],n[2]),i}function oy(i,r,n){return i[0]=Math.max(r[0],n[0]),i[1]=Math.max(r[1],n[1]),i[2]=Math.max(r[2],n[2]),i}function ox(i,r,n){return i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i}function ov(i,r,n,a){return i[0]=r[0]+n[0]*a,i[1]=r[1]+n[1]*a,i[2]=r[2]+n[2]*a,i}function ob(i,r){var n=r[0],a=r[1],o=r[2],s=n*n+a*a+o*o;return s>0&&(s=1/Math.sqrt(s)),i[0]=r[0]*s,i[1]=r[1]*s,i[2]=r[2]*s,i}function ow(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]}function oT(i,r,n){var a=r[0],o=r[1],s=r[2],l=n[0],h=n[1],u=n[2];return i[0]=o*u-s*h,i[1]=s*l-a*u,i[2]=a*h-o*l,i}function oE(i,r,n){var a=r[0],o=r[1],s=r[2],l=n[3]*a+n[7]*o+n[11]*s+n[15];
8return i[0]=(n[0]*a+n[4]*o+n[8]*s+n[12])/(l=l||1),i[1]=(n[1]*a+n[5]*o+n[9]*s+n[13])/l,i[2]=(n[2]*a+n[6]*o+n[10]*s+n[14])/l,i}function oS(i,r,n){var a=n[0],o=n[1],s=n[2],l=r[0],h=r[1],u=r[2],c=o*u-s*h,p=s*l-a*u,d=a*h-o*l,f=o*d-s*p,m=s*c-a*d,_=a*p-o*c,g=2*n[3];return p*=g,d*=g,m*=2,_*=2,i[0]=l+(c*=g)+(f*=2),i[1]=h+p+m,i[2]=u+d+_,i}function oI(i,r,n){return i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i[3]=r[3]*n,i}function oA(i,r,n){var a=r[0],o=r[1],s=r[2],l=r[3];return i[0]=n[0]*a+n[4]*o+n[8]*s+n[12]*l,i[1]=n[1]*a+n[5]*o+n[9]*s+n[13]*l,i[2]=n[2]*a+n[6]*o+n[10]*s+n[14]*l,i[3]=n[3]*a+n[7]*o+n[11]*s+n[15]*l,i}function oM(){var i=new a7(4);return a7!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function oC(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function oz(i,r,n){n*=.5;var a=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(n),u=Math.cos(n);return i[0]=a*u+l*h,i[1]=o*u+s*h,i[2]=s*u-o*h,i[3]=l*u-a*h,i}function oP(i,r,n){n*=.5;var a=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(n),u=Math.cos(n);return i[0]=a*u-s*h,i[1]=o*u+l*h,i[2]=s*u+a*h,i[3]=l*u-o*h,i}Math.hypot||(Math.hypot=function(){for(var i=0,r=arguments.length;r--;)i+=arguments[r]*arguments[r];return Math.sqrt(i)}),ou(),c=new a7(4),a7!=Float32Array&&(c[0]=0,c[1]=0,c[2]=0,c[3]=0),ou(),od(1,0,0),od(0,1,0),oM(),oM(),oe();class ok{constructor(i,r){this.pos=i,this.dir=r}intersectsPlane(i,r,n){let a=ow(r,this.dir);if(1e-6>Math.abs(a))return!1;let o=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1]+(i[2]-this.pos[2])*r[2])/a;return n[0]=this.pos[0]+this.dir[0]*o,n[1]=this.pos[1]+this.dir[1]*o,n[2]=this.pos[2]+this.dir[2]*o,!0}closestPointOnSphere(i,r,n){var a,o,s,l,h,u,c;if(o=(a=this.pos)[0],s=a[1],l=a[2],h=i[0],u=i[1],c=i[2],Math.abs(o-h)<=1e-6*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-u)<=1e-6*Math.max(1,Math.abs(s),Math.abs(u))&&Math.abs(l-c)<=1e-6*Math.max(1,Math.abs(l),Math.abs(c))||0===r)return n[0]=n[1]=n[2]=0,!1;let[p,d,f]=this.dir,m=this.pos[0]-i[0],_=this.pos[1]-i[1],g=this.pos[2]-i[2],y=p*p+d*d+f*f,x=2*(m*p+_*d+g*f),v=x*x-4*y*(m*m+_*_+g*g-r*r);if(v<0){let i=Math.max(-x/2,0),a=m+p*i,o=_+d*i,s=g+f*i,l=Math.hypot(a,o,s);return n[0]=a*r/l,n[1]=o*r/l,n[2]=s*r/l,!1}{let i=(-x-Math.sqrt(v))/(2*y);if(i<0){let i=Math.hypot(m,_,g);return n[0]=m*r/i,n[1]=_*r/i,n[2]=g*r/i,!1}return n[0]=m+p*i,n[1]=_+d*i,n[2]=g+f*i,!0}}}class oD{constructor(i,r,n,a,o){this.TL=i,this.TR=r,this.BR=n,this.BL=a,this.horizon=o}static fromInvProjectionMatrix(i,r,n){let a=[-1,1,1],o=[1,1,1],s=[1,-1,1],l=[-1,-1,1],h=oE(a,a,i),u=oE(o,o,i),c=oE(s,s,i),p=oE(l,l,i);return new oD(h,u,c,p,r/n)}}class oL{constructor(i,r){this.points=i,this.planes=r}static fromInvProjectionMatrix(i,r,n,a){let o=Math.pow(2,n),s=[[-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(n=>{var s,l;let h=oA([],n,i),u=1/h[3]/r*o;return s=h,l=[u,u,a?1/h[3]:u,u],s[0]=h[0]*l[0],s[1]=h[1]*l[1],s[2]=h[2]*l[2],s[3]=h[3]*l[3],s}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(i=>{let r=ob([],oT([],om([],s[i[0]],s[i[1]]),om([],s[i[2]],s[i[1]]))),n=-ow(r,s[i[1]]);return r.concat(n)});return new oL(s,l)}}class oB{static fromPoints(i){let r=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],n=[Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE];for(let a of i)r[0]=Math.min(r[0],a[0]),r[1]=Math.min(r[1],a[1]),r[2]=Math.min(r[2],a[2]),n[0]=Math.max(n[0],a[0]),n[1]=Math.max(n[1],a[1]),n[2]=Math.max(n[2],a[2]);return new oB(r,n)}constructor(i,r){this.min=i,this.max=r,this.center=ox([],of([],this.min,this.max),.5)}quadrant(i){let r=[i%2==0,i<2],n=oc(this.min),a=oc(this.max);for(let i=0;i<r.length;i++)n[i]=r[i]?this.min[i]:this.center[i],a[i]=r[i]?this.center[i]:this.max[i];return a[2]=this.max[2],new oB(n,a)}distanceX(i){return Math.max(Math.min(this.max[0],i[0]),this.min[0])-i[0]}distanceY(i){return Math.max(Math.min(this.max[1],i[1]),this.min[1])-i[1]}distanceZ(i){return Math.max(Math.min(this.max[2],i[2]),this.min[2])-i[2]}getCorners(){let i=this.min,r=this.max;return[[i[0],i[1],i[2]],[r[0],i[1],i[2]],[r[0],r[1],i[2]],[i[0],r[1],i[2]],[i[0],i[1],r[2]],[r[0],i[1],r[2]],[r[0],r[1],r[2]],[i[0],r[1],r[2]]]}intersects(i){let r=this.getCorners(),n=!0;for(let a=0;a<i.planes.length;a++){let o=i.planes[a],s=0;for(let i=0;i<r.length;i++)s+=ow(o,r[i])+o[3]>=0;if(0===s)return 0;s!==r.length&&(n=!1)}if(n)return 2;for(let r=0;r<3;r++){let n=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let o=0;o<i.points.length;o++){let s=i.points[o][r]-this.min[r];n=Math.min(n,s),a=Math.max(a,s)}if(a<0||n>this.max[r]-this.min[r])return 0}return 1}}function oR(i,r,n,a,o,s,l,h,u){if(s&&i.queryGeometry.isAboveHorizon)return!1;s&&(u*=i.pixelToTileUnitsFactor);let c=i.tileID.canonical,p=n.projection.upVectorScale(c,n.center.lat,n.worldSize).metersToTile;for(let m of r)for(let r of m){var d;let m=r.add(h),_=o&&n.elevation?n.elevation.exaggeration()*o.getElevationAt(m.x,m.y,!0):0,g=n.projection.projectTilePoint(m.x,m.y,c);if(_>0){let i=n.projection.upVector(c,m.x,m.y);g.x+=i[0]*p*_,g.y+=i[1]*p*_,g.z+=i[2]*p*_}let y=s?m:function(i,r,n,a){let o=oA([],[i,r,n,1],a);return new f(o[0]/o[3],o[1]/o[3])}(g.x,g.y,g.z,a),x=s?i.tilespaceRays.map(i=>(function(i,r){let n=ou();return oF[2]=r,i.intersectsPlane(oF,oO,n),new f(n[0],n[1])})(i,_)):i.queryGeometry.screenGeometry,v=oA([],[g.x,g.y,g.z,1],a);if(!l&&s?u*=v[3]/n.cameraToCenterDistance:l&&!s&&(u*=n.cameraToCenterDistance/v[3]),s){let i=aU((r.y/8192+c.y)/(1<<c.z));u/=n.projection.pixelsPerMeter(i,1)/(1/aB(i))}if(d=u,a1(x,y)||aJ(y,x,d))return!0}return!1}let oF=od(0,0,0),oO=od(0,0,1);class oU extends aW{}function oV(i,{width:r,height:n},a,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==r*n*a)throw RangeError("mismatched image size")}else o=new Uint8Array(r*n*a);return i.width=r,i.height=n,i.data=o,i}function oj(i,r,n){let{width:a,height:o}=r;a===i.width&&o===i.height||(oN(i,r,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,a),height:Math.min(i.height,o)},n),i.width=a,i.height=o,i.data=r.data)}
8function oN(i,r,n,a,o,s){if(0===o.width||0===o.height)return r;if(o.width>i.width||o.height>i.height||n.x>i.width-o.width||n.y>i.height-o.height)throw RangeError("out of range source coordinates for image copy");if(o.width>r.width||o.height>r.height||a.x>r.width-o.width||a.y>r.height-o.height)throw RangeError("out of range destination coordinates for image copy");let l=i.data,h=r.data;for(let u=0;u<o.height;u++){let c=((n.y+u)*i.width+n.x)*s,p=((a.y+u)*r.width+a.x)*s;for(let i=0;i<o.width*s;i++)h[p+i]=l[c+i]}return r}rg(oU,"HeatmapBucket",{omit:["layers"]});class oG{constructor(i,r){oV(this,i,1,r)}resize(i){oj(this,new oG(i),1)}clone(){return new oG({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,n,a,o){oN(i,r,n,a,o,1)}}class oZ{constructor(i,r){oV(this,i,4,r)}resize(i){oj(this,new oZ(i),4)}replace(i,r){r?this.data.set(i):this.data=i instanceof Uint8ClampedArray?new Uint8Array(i.buffer):i}clone(){return new oZ({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,n,a,o){oN(i,r,n,a,o,4)}}rg(oG,"AlphaImage"),rg(oZ,"RGBAImage");var o$={paint:new n_({"heatmap-radius":new np(eG.paint_heatmap["heatmap-radius"]),"heatmap-weight":new np(eG.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new nc(eG.paint_heatmap["heatmap-intensity"]),"heatmap-color":new nm(eG.paint_heatmap["heatmap-color"]),"heatmap-opacity":new nc(eG.paint_heatmap["heatmap-opacity"])})};function oq(i){let r={},n=i.resolution||256,a=i.clips?i.clips.length:1,o=i.image||new oZ({width:n,height:a}),s=(n,a,s)=>{r[i.evaluationKey]=s;let l=i.expression.evaluate(r);o.data[n+a+0]=Math.floor(255*l.r/l.a),o.data[n+a+1]=Math.floor(255*l.g/l.a),o.data[n+a+2]=Math.floor(255*l.b/l.a),o.data[n+a+3]=Math.floor(255*l.a)};if(i.clips)for(let r=0,o=0;r<a;++r,o+=4*n)for(let a=0,l=0;a<n;a++,l+=4){let h=a/(n-1),{start:u,end:c}=i.clips[r];s(o,l,u*(1-h)+c*h)}else for(let i=0,r=0;i<n;i++,r+=4)s(0,r,i/(n-1));return o}var oX={paint:new n_({"hillshade-illumination-direction":new nc(eG.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new nc(eG.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new nc(eG.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new nc(eG.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new nc(eG.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new nc(eG.paint_hillshade["hillshade-accent-color"])})};let oW=nb([{name:"a_pos",components:2,type:"Int16"}],4),{members:oH}=oW;var oY=oK;function oK(i,r,n){n=n||2;var a,o,s,l,h,u,c,p=r&&r.length,d=p?r[0]*n:i.length,f=oJ(i,0,d,n,!0),m=[];if(!f||f.next===f.prev)return m;if(p&&(f=function(i,r,n,a){var o,s,l,h=[];for(o=0,s=r.length;o<s;o++)(l=oJ(i,r[o]*a,o<s-1?r[o+1]*a:i.length,a,!1))===l.next&&(l.steiner=!0),h.push(function(i){var r=i,n=i;do(r.x<n.x||r.x===n.x&&r.y<n.y)&&(n=r),r=r.next;while(r!==i);return n}(l));for(h.sort(o0),o=0;o<h.length;o++)n=function(i,r){var n=function(i,r){var n,a,o,s=r,l=i.x,h=i.y,u=-1/0;do{if(h<=s.y&&h>=s.next.y&&s.next.y!==s.y){var c=s.x+(h-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(c<=l&&c>u&&(u=c,o=s.x<s.next.x?s:s.next,c===l))return o}s=s.next}while(s!==r);if(!o)return null;var p,d=o,f=o.x,m=o.y,_=1/0;s=o;do l>=s.x&&s.x>=f&&l!==s.x&&o2(h<m?l:u,h,f,m,h<m?u:l,h,s.x,s.y)&&(p=Math.abs(h-s.y)/(l-s.x),o9(s,i)&&(p<_||p===_&&(s.x>o.x||s.x===o.x&&(n=o,a=s,0>o3(n.prev,n,a.prev)&&0>o3(a.next,n,n.next))))&&(o=s,_=p)),s=s.next;while(s!==d);return o}(i,r);if(!n)return r;var a=o7(n,i);return oQ(a,a.next),oQ(n,n.next)}(h[o],n);return n}(i,r,f,n)),i.length>80*n){a=s=i[0],o=l=i[1];for(var _=n;_<d;_+=n)(h=i[_])<a&&(a=h),(u=i[_+1])<o&&(o=u),h>s&&(s=h),u>l&&(l=u);c=0!==(c=Math.max(s-a,l-o))?32767/c:0}return function i(r,n,a,o,s,l,h){if(r){!h&&l&&function(i,r,n,a){var o=i;do 0===o.z&&(o.z=o1(o.x,o.y,r,n,a)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==i);o.prevZ.nextZ=null,o.prevZ=null,function(i){var r,n,a,o,s,l,h,u,c=1;do{for(n=i,i=null,s=null,l=0;n;){for(l++,a=n,h=0,r=0;r<c&&(h++,a=a.nextZ);r++);for(u=c;h>0||u>0&&a;)0!==h&&(0===u||!a||n.z<=a.z)?(o=n,n=n.nextZ,h--):(o=a,a=a.nextZ,u--),s?s.nextZ=o:i=o,o.prevZ=s,s=o;n=a}s.nextZ=null,c*=2}while(l>1)}(o)}(r,o,s,l);for(var u,c,p=r;r.prev!==r.next;)if(u=r.prev,c=r.next,l?function(i,r,n,a){var o=i.prev,s=i.next;if(o3(o,i,s)>=0)return!1;for(var l=o.x,h=i.x,u=s.x,c=o.y,p=i.y,d=s.y,f=l<h?l<u?l:u:h<u?h:u,m=c<p?c<d?c:d:p<d?p:d,_=l>h?l>u?l:u:h>u?h:u,g=c>p?c>d?c:d:p>d?p:d,y=o1(f,m,r,n,a),x=o1(_,g,r,n,a),v=i.prevZ,b=i.nextZ;v&&v.z>=y&&b&&b.z<=x;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==o&&v!==s&&o2(l,c,h,p,u,d,v.x,v.y)&&o3(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&o2(l,c,h,p,u,d,b.x,b.y)&&o3(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==o&&v!==s&&o2(l,c,h,p,u,d,v.x,v.y)&&o3(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&o2(l,c,h,p,u,d,b.x,b.y)&&o3(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(r,o,s,l):function(i){var r=i.prev,n=i.next;if(o3(r,i,n)>=0)return!1;for(var a=r.x,o=i.x,s=n.x,l=r.y,h=i.y,u=n.y,c=a<o?a<s?a:s:o<s?o:s,p=l<h?l<u?l:u:h<u?h:u,d=a>o?a>s?a:s:o>s?o:s,f=l>h?l>u?l:u:h>u?h:u,m=n.next;m!==r;){if(m.x>=c&&m.x<=d&&m.y>=p&&m.y<=f&&o2(a,l,o,h,s,u,m.x,m.y)&&o3(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}(r))n.push(u.i/a|0),n.push(r.i/a|0),n.push(c.i/a|0),st(r),r=c.next,p=c.next;else if((r=c)===p){h?1===h?i(r=function(i,r,n){var a=i;do{var o=a.prev,s=a.next.next;
8!o5(o,s)&&o4(o,a,a.next,s)&&o9(o,s)&&o9(s,o)&&(r.push(o.i/n|0),r.push(a.i/n|0),r.push(s.i/n|0),st(a),st(a.next),a=i=s),a=a.next}while(a!==i);return oQ(a)}(oQ(r),n,a),n,a,o,s,l,2):2===h&&function(r,n,a,o,s,l){var h=r;do{for(var u,c,p=h.next.next;p!==h.prev;){if(h.i!==p.i&&(u=h,c=p,u.next.i!==c.i&&u.prev.i!==c.i&&!function(i,r){var n=i;do{if(n.i!==i.i&&n.next.i!==i.i&&n.i!==r.i&&n.next.i!==r.i&&o4(n,n.next,i,r))return!0;n=n.next}while(n!==i);return!1}(u,c)&&(o9(u,c)&&o9(c,u)&&function(i,r){var n=i,a=!1,o=(i.x+r.x)/2,s=(i.y+r.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&o<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(a=!a),n=n.next;while(n!==i);return a}(u,c)&&(o3(u.prev,u,c.prev)||o3(u,c.prev,c))||o5(u,c)&&o3(u.prev,u,u.next)>0&&o3(c.prev,c,c.next)>0))){var d=o7(h,p);return h=oQ(h,h.next),d=oQ(d,d.next),i(h,n,a,o,s,l,0),void i(d,n,a,o,s,l,0)}p=p.next}h=h.next}while(h!==r)}(r,n,a,o,s,l):i(oQ(r),n,a,o,s,l,1);break}}}(f,m,n,a,o,c,0),m}function oJ(i,r,n,a,o){var s,l;if(o===sr(i,r,n,a)>0)for(s=r;s<n;s+=a)l=se(s,i[s],i[s+1],l);else for(s=n-a;s>=r;s-=a)l=se(s,i[s],i[s+1],l);return l&&o5(l,l.next)&&(st(l),l=l.next),l}function oQ(i,r){if(!i)return i;r||(r=i);var n,a=i;do if(n=!1,a.steiner||!o5(a,a.next)&&0!==o3(a.prev,a,a.next))a=a.next;else{if(st(a),(a=r=a.prev)===a.next)break;n=!0}while(n||a!==r);return r}function o0(i,r){return i.x-r.x}function o1(i,r,n,a,o){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-n)*o|0)|i<<8))|i<<4))|i<<2))|i<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-a)*o|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function o2(i,r,n,a,o,s,l,h){return(o-l)*(r-h)>=(i-l)*(s-h)&&(i-l)*(a-h)>=(n-l)*(r-h)&&(n-l)*(s-h)>=(o-l)*(a-h)}function o3(i,r,n){return(r.y-i.y)*(n.x-r.x)-(r.x-i.x)*(n.y-r.y)}function o5(i,r){return i.x===r.x&&i.y===r.y}function o4(i,r,n,a){var o=o8(o3(i,r,n)),s=o8(o3(i,r,a)),l=o8(o3(n,a,i)),h=o8(o3(n,a,r));return o!==s&&l!==h||!(0!==o||!o6(i,n,r))||!(0!==s||!o6(i,a,r))||!(0!==l||!o6(n,i,a))||!(0!==h||!o6(n,r,a))}function o6(i,r,n){return r.x<=Math.max(i.x,n.x)&&r.x>=Math.min(i.x,n.x)&&r.y<=Math.max(i.y,n.y)&&r.y>=Math.min(i.y,n.y)}function o8(i){return i>0?1:i<0?-1:0}function o9(i,r){return 0>o3(i.prev,i,i.next)?o3(i,r,i.next)>=0&&o3(i,i.prev,r)>=0:0>o3(i,r,i.prev)||0>o3(i,i.next,r)}function o7(i,r){var n=new si(i.i,i.x,i.y),a=new si(r.i,r.x,r.y),o=i.next,s=r.prev;return i.next=r,r.prev=i,n.next=o,o.prev=n,a.next=n,n.prev=a,s.next=a,a.prev=s,a}function se(i,r,n,a){var o=new si(i,r,n);return a?(o.next=a.next,o.prev=a,a.next.prev=o,a.next=o):(o.prev=o,o.next=o),o}function st(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function si(i,r,n){this.i=i,this.x=r,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sr(i,r,n,a){for(var o=0,s=r,l=n-a;s<n;s+=a)o+=(i[l]-i[s])*(i[s+1]+i[l+1]),l=s;return o}function sn(i,r,n){var a=i[r];i[r]=i[n],i[n]=a}function sa(i,r){return i<r?-1:i>r?1:0}function so(i,r){let n,a;let o=i.length;if(o<=1)return[i];let s=[];for(let r=0;r<o;r++){let o=function(i){let r=0;for(let n,a,o=0,s=i.length,l=s-1;o<s;l=o++)n=i[o],r+=((a=i[l]).x-n.x)*(n.y+a.y);return r}(i[r]);0!==o&&(i[r].area=Math.abs(o),void 0===a&&(a=o<0),a===o<0?(n&&s.push(n),n=[i[r]]):n.push(i[r]))}if(n&&s.push(n),r>1)for(let i=0;i<s.length;i++){var l,h;s[i].length<=r||(l=s[i],h=s[i].length-1,function i(r,n,a,o,s){for(;o>a;){if(o-a>600){var l=o-a+1,h=n-a+1,u=Math.log(l),c=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);i(r,n,Math.max(a,Math.floor(n-h*c/l+p)),Math.min(o,Math.floor(n+(l-h)*c/l+p)),s)}var d=r[n],f=a,m=o;for(sn(r,a,n),s(r[o],d)>0&&sn(r,a,o);f<m;){for(sn(r,f,m),f++,m--;0>s(r[f],d);)f++;for(;s(r[m],d)>0;)m--}0===s(r[a],d)?sn(r,a,m):sn(r,++m,o),m<=n&&(a=m+1),n<=m&&(o=m-1)}}(l,r,1,h||l.length-1,ss||sa),s[i]=s[i].slice(0,r))}return s}function ss(i,r){return r.area-i.area}function sl(i,r,n){let a=n.patternDependencies,o=!1;for(let n of r){let r=n.paint.get(`${i}-pattern`);r.isConstant()||(o=!0);let s=r.constantOr(null);s&&(o=!0,a[s.to]=!0,a[s.from]=!0)}return o}function sh(i,r,n,a,o){let s=o.patternDependencies;for(let l of r){let r=l.paint.get(`${i}-pattern`).value;if("constant"!==r.kind){let i=r.evaluate({zoom:a-1}
8,n,{},o.availableImages),h=r.evaluate({zoom:a},n,{},o.availableImages),u=r.evaluate({zoom:a+1},n,{},o.availableImages);i=i&&i.name?i.name:i,h=h&&h.name?h.name:h,u=u&&u.name?u.name:u,s[i]=!0,s[h]=!0,s[u]=!0,n.patterns[l.id]={min:i,mid:h,max:u}}}return n}oK.deviation=function(i,r,n,a){var o=r&&r.length,s=Math.abs(sr(i,0,o?r[0]*n:i.length,n));if(o)for(var l=0,h=r.length;l<h;l++)s-=Math.abs(sr(i,r[l]*n,l<h-1?r[l+1]*n:i.length,n));var u=0;for(l=0;l<a.length;l+=3){var c=a[l]*n,p=a[l+1]*n,d=a[l+2]*n;u+=Math.abs((i[c]-i[d])*(i[p+1]-i[c+1])-(i[c]-i[p])*(i[d+1]-i[c+1]))}return 0===s&&0===u?0:Math.abs((u-s)/s)},oK.flatten=function(i){for(var r=i[0][0].length,n={vertices:[],holes:[],dimensions:r},a=0,o=0;o<i.length;o++){for(var s=0;s<i[o].length;s++)for(var l=0;l<r;l++)n.vertices.push(i[o][s][l]);o>0&&n.holes.push(a+=i[o-1].length)}return n},oY.default=oK;class su{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new nT,this.indexArray=new nU,this.indexArray2=new n$,this.programConfigurations=new aw(i.layers,i.zoom),this.segments=new aP,this.segments2=new aP,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=i.projection}populate(i,r,n,a){this.hasPattern=sl("fill",this.layers,r);let o=this.layers[0].layout.get("fill-sort-key"),s=[];for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of i){let i=this.layers[0]._featureFilter.needGeometry,p=a$(l,i);if(!this.layers[0]._featureFilter.filter(new ni(this.zoom),p,n))continue;let d=o?o.evaluate(p,{},n,r.availableImages):void 0,f={id:h,properties:l.properties,type:l.type,sourceLayerIndex:c,index:u,geometry:i?p.geometry:aZ(l,n,a),patterns:{},sortKey:d};s.push(f)}for(let a of(o&&s.sort((i,r)=>i.sortKey-r.sortKey),s)){let{geometry:o,index:s,sourceLayerIndex:l}=a;if(this.hasPattern){let i=sh("fill",this.layers,a,this.zoom,r);this.patternFeatures.push(i)}else this.addFeature(a,o,s,n,{},r.availableImages);r.featureIndex.insert(i[s].feature,o,s,l,this.index)}}update(i,r,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,a)}addFeatures(i,r,n,a,o){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,a)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,oH),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),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(i,r,n,a,o,s=[]){for(let i of so(r,500)){let r=0;for(let n of i)r+=n.length;let n=this.segments.prepareSegment(r,this.layoutVertexArray,this.indexArray),a=n.vertexLength,o=[],s=[];for(let r of i){if(0===r.length)continue;r!==i[0]&&s.push(o.length/2);let n=this.segments2.prepareSegment(r.length,this.layoutVertexArray,this.indexArray2),a=n.vertexLength;this.layoutVertexArray.emplaceBack(r[0].x,r[0].y),this.indexArray2.emplaceBack(a+r.length-1,a),o.push(r[0].x),o.push(r[0].y);for(let i=1;i<r.length;i++)this.layoutVertexArray.emplaceBack(r[i].x,r[i].y),this.indexArray2.emplaceBack(a+i-1,a+i),o.push(r[i].x),o.push(r[i].y);n.vertexLength+=r.length,n.primitiveLength+=r.length}let l=oY(o,s);for(let i=0;i<l.length;i+=3)this.indexArray.emplaceBack(a+l[i],a+l[i+1],a+l[i+2]);n.vertexLength+=r,n.primitiveLength+=l.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,o,s,a)}}rg(su,"FillBucket",{omit:["layers","patternFeatures"]});let sc=new n_({"fill-sort-key":new np(eG.layout_fill["fill-sort-key"])});var sp={paint:new n_({"fill-antialias":new nc(eG.paint_fill["fill-antialias"]),"fill-opacity":new np(eG.paint_fill["fill-opacity"]),"fill-color":new np(eG.paint_fill["fill-color"]),"fill-outline-color":new np(eG.paint_fill["fill-outline-color"]),"fill-translate":new nc(eG.paint_fill["fill-translate"]),"fill-translate-anchor":new nc(eG.paint_fill["fill-translate-anchor"]),"fill-pattern":new nd(eG.paint_fill["fill-pattern"])}),layout:sc};let sd=nb([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),sf=nb([{name:"a_centroid_pos",components:2,type:"Uint16"}]),sm=nb([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:s_}=sd;function sg(i,r,n,a,o){this.properties={},this.extent=n,this.type=0,this._pbf=i,this._geometry=-1,this._keys=a,this._values=o,i.readFields(sy,this,r)}function sy(i,r,n){1==i?r.id=n.readVarint():2==i?function(i,r){for(var n=i.readVarint()+i.pos;i.pos<n;){var a=r._keys[i.readVarint()],o=r._values[i.readVarint()];r.properties[a]=o}}(n,r):3==i?r.type=n.readVarint():4==i&&(r._geometry=n.pos)}function sx(i,r){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(sv,this,r),this.length=this._features.length}function sv(i,r,n){15===i?r.version=n.readVarint():1===i?r.name=n.readString():5===i?r.extent=n.readVarint():2===i?r._features.push(n.pos):3===i?r._keys.push(n.readString()):4===i&&r._values.push(function(i){for(var r=null,n=i.readVarint()+i.pos;i.pos<n;){var a=i.readVarint()>>3;r=1===a?i.readString():2===a?i.readFloat():3===a?i.readDouble():4===a?i.readVarint64():5===a?i.readVarint():6===a?i.readSVarint():7===a?i.readBoolean():null}return r}(n))}
8function sb(i,r,n){if(3===i){var a=new sx(n,n.readVarint()+n.pos);a.length&&(r[a.name]=a)}}sg.types=["Unknown","Point","LineString","Polygon"],sg.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var r,n=i.readVarint()+i.pos,a=1,o=0,s=0,l=0,h=[];i.pos<n;){if(o<=0){var u=i.readVarint();a=7&u,o=u>>3}if(o--,1===a||2===a)s+=i.readSVarint(),l+=i.readSVarint(),1===a&&(r&&h.push(r),r=[]),r.push(new f(s,l));else{if(7!==a)throw Error("unknown command "+a);r&&r.push(r[0].clone())}}return r&&h.push(r),h},sg.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var r=i.readVarint()+i.pos,n=1,a=0,o=0,s=0,l=1/0,h=-1/0,u=1/0,c=-1/0;i.pos<r;){if(a<=0){var p=i.readVarint();n=7&p,a=p>>3}if(a--,1===n||2===n)(o+=i.readSVarint())<l&&(l=o),o>h&&(h=o),(s+=i.readSVarint())<u&&(u=s),s>c&&(c=s);else if(7!==n)throw Error("unknown command "+n)}return[l,u,h,c]},sg.prototype.toGeoJSON=function(i,r,n){var a,o,s=this.extent*Math.pow(2,n),l=this.extent*i,h=this.extent*r,u=this.loadGeometry(),c=sg.types[this.type];function p(i){for(var r=0;r<i.length;r++){var n=i[r];i[r]=[360*(n.x+l)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(n.y+h)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var d=[];for(a=0;a<u.length;a++)d[a]=u[a][0];p(u=d);break;case 2:for(a=0;a<u.length;a++)p(u[a]);break;case 3:for(u=function(i){var r=i.length;if(r<=1)return[i];for(var n,a,o=[],s=0;s<r;s++){var l=function(i){for(var r,n,a=0,o=0,s=i.length,l=s-1;o<s;l=o++)a+=((n=i[l]).x-(r=i[o]).x)*(r.y+n.y);return a}(i[s]);0!==l&&(void 0===a&&(a=l<0),a===l<0?(n&&o.push(n),n=[i[s]]):n.push(i[s]))}return n&&o.push(n),o}(u),a=0;a<u.length;a++)for(o=0;o<u[a].length;o++)p(u[a][o])}1===u.length?u=u[0]:c="Multi"+c;var f={type:"Feature",geometry:{type:c,coordinates:u},properties:this.properties};return"id"in this&&(f.id=this.id),f},sx.prototype.feature=function(i){if(i<0||i>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new sg(this._pbf,r,this.extent,this._keys,this._values)};var sw={VectorTile:function(i,r){this.layers=i.readFields(sb,{},r)},VectorTileFeature:sg,VectorTileLayer:sx};function sT(i,r,n,a){let o=[],s=0===a?(i,r,n,a,o,s)=>{i.push(new f(s,n+(s-r)/(a-r)*(o-n)))}:(i,r,n,a,o,s)=>{i.push(new f(r+(s-n)/(o-n)*(a-r),s))};for(let l of i){let i=[];for(let o of l){if(o.length<=2)continue;let l=[];for(let i=0;i<o.length-1;i++){let h=o[i].x,u=o[i].y,c=o[i+1].x,p=o[i+1].y,d=0===a?h:u,f=0===a?c:p;d<r?f>r&&s(l,h,u,c,p,r):d>n?f<n&&s(l,h,u,c,p,n):l.push(o[i]),f<r&&d>=r&&s(l,h,u,c,p,r),f>n&&d<=n&&s(l,h,u,c,p,n)}let h=o[o.length-1],u=0===a?h.x:h.y;u>=r&&u<=n&&l.push(h),l.length&&(h=l[l.length-1],l[0].x===h.x&&l[0].y===h.y||l.push(l[0]),i.push(l))}i.length&&o.push(i)}return o}let sE=sw.VectorTileFeature.types;function sS(i,r,n,a,o,s,l,h){i.emplaceBack((r<<1)+l,(n<<1)+s,(Math.floor(8192*a)<<1)+o,Math.round(h))}function sI(i,r,n){i.emplaceBack(r.x,r.y,r.z,16384*n[0],16384*n[1],16384*n[2])}class sA{constructor(){this.acc=new f(0,0),this.polyCount=[]}startRing(i){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new f(i.x,i.y),this.max=new f(i.x,i.y))}append(i,r){this.currentPolyCount.edges++,this.acc._add(i);let n=this.min,a=this.max;i.x<n.x?n.x=i.x:i.x>a.x&&(a.x=i.x),i.y<n.y?n.y=i.y:i.y>a.y&&(a.y=i.y),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),r.x<0!=i.x<0&&this.addBorderIntersection(0,tG(r.y,i.y,(0-r.x)/(i.x-r.x))),r.x>8192!=i.x>8192&&this.addBorderIntersection(1,tG(r.y,i.y,(8192-r.x)/(i.x-r.x))),r.y<0!=i.y<0&&this.addBorderIntersection(2,tG(r.x,i.x,(0-r.y)/(i.y-r.y))),r.y>8192!=i.y>8192&&this.addBorderIntersection(3,tG(r.x,i.x,(8192-r.y)/(i.y-r.y)))}addBorderIntersection(i,r){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);let n=this.borders[i];r<n[0]&&(n[0]=r),r>n[1]&&(n[1]=r)}processBorderOverlap(i,r){if(i.x===r.x){if(i.y===r.y)return;let n=0===i.x?0:1;this.addBorderIntersection(n,r.y),this.addBorderIntersection(n,i.y)}else{let n=0===i.y?2:3;this.addBorderIntersection(n,r.x),this.addBorderIntersection(n,i.x)}}centroid(){let i=this.polyCount.reduce((i,r)=>i+r.edges,0);return 0!==i?this.acc.div(i)._round():new f(0,0)}span(){return new f(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((i,r)=>i+ +(r[0]!==Number.MAX_VALUE),0)}}class sM{constructor(i){this.zoom=i.zoom,this.canonical=i.canonical,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=i.projection,this.layoutVertexArray=new nS,this.centroidVertexArray=new n8,this.indexArray=new nU,this.programConfigurations=new aw(i.layers,i.zoom),this.segments=new aP,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.enableTerrain=i.enableTerrain}populate(i,r,n,a){for(let{feature:o,id:s,index:l,sourceLayerIndex:h}of(this.features=[],this.hasPattern=sl("fill-extrusion",this.layers,r),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(i){let r=Math.exp(Math.PI*(1-i.y/(1<<i.z)*2));return 80150034*r/(r*r+1)/8192/(1<<i.z)}(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,i)){let i=this.layers[0]._featureFilter.needGeometry,u=a$(o,i);if(!this.layers[0]._featureFilter.filter(new ni(this.zoom),u,n))continue;let c={id:s,sourceLayerIndex:h,index:l,geometry:i?u.geometry:aZ(o,n,a),properties:o.properties,type:o.type,patterns:{}},p=this.layoutVertexArray.length;this.hasPattern?this.features.push(sh("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,l,n,{},r.availableImages,a),r.featureIndex.insert(o,c.geometry,l,h,this.index,p)}this.sortBorders()}addFeatures(i,r,n,a,o){for(let i of this.features){let{geometry:s}=i;this.addFeature(i,s,i.index,r,n,a,o)}this.sortBorders()}update(i,r,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,a)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,s_),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=i.createVertexBuffer(this.layoutVertexExtArray,sm.members,!0))),this.programConfigurations.upload(i),this.uploaded=!0}uploadCentroid(i){0!==this.centroidVertexArray.length&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=i.createVertexBuffer(this.centroidVertexArray,sf.members,!0),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,r,n,a,o,s,l){var h;let u;let c=[new f(0,0),new f(8192,8192)],p=l.projection,d="globe"===p.name,m=this.enableTerrain&&!d?new sA:null,_="Polygon"===sE[i.type];d&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new nH);let g=so(r,500);for(let i=g.length-1;i>=0;i--){let r=g[i];(0===r.length||(h=r[0]).every(i=>i.x<=0)||h.every(i=>i.x>=8192)||h.every(i=>i.y<=0)||h.every(i=>i.y>=8192))&&g.splice(i,1)}if(d)u=sB(g,c,a);else for(let i of(u=[],g))u.push({polygon:i,bounds:c});let y=_?this.edgeRadius:0;for(let{polygon:i,bounds:r}of u){let n=0,o=0;for(let r of i)_&&!r[0].equals(r[r.length-1])&&r.push(r[0]),o+=_?r.length-1:r.length;let s=this.segments.prepareSegment((_?5:4)*o,this.layoutVertexArray,this.indexArray);if(_){let r=[],o=[];for(let l of(n=s.vertexLength,i)){let n,h;l.length&&l!==i[0]&&o.push(r.length/2),n=l[1].sub(l[0])._perp()._unit();for(let i=1;i<l.length;i++){let o=l[i],u=l[i===l.length-1?1:i+1],{x:c,y:f}=o;
8if(y){h=u.sub(o)._perp()._unit();let i=n.add(h)._unit(),r=y*Math.min(4,1/(n.x*i.x+n.y*i.y));c+=r*i.x,f+=r*i.y,n=h}sS(this.layoutVertexArray,c,f,0,0,1,1,0),s.vertexLength++,r.push(o.x,o.y),d&&sI(this.layoutVertexExtArray,p.projectTilePoint(c,f,a),p.upVector(a,c,f))}}let l=oY(r,o);for(let i=0;i<l.length;i+=3)this.indexArray.emplaceBack(n+l[i],n+l[i+2],n+l[i+1]),s.primitiveLength++}for(let o of i){m&&o.length&&m.startRing(o[0]);let i,l,h,u=o.length>4&&sk(o[o.length-2],o[0],o[1]),c=y?function(i,r,n,a){let o=r.sub(i)._perp()._unit(),s=n.sub(r)._perp()._unit();return sz(i,r,n,sC(o,s),a)}(o[o.length-2],o[0],o[1],y):0;l=o[1].sub(o[0])._perp()._unit();for(let f=1,g=0;f<o.length;f++){let x=o[f-1],v=o[f],b=o[f===o.length-1?1:f+1];if(m&&_&&m.currentPolyCount.top++,sP(v,x,r)){y&&(l=b.sub(v)._perp()._unit());continue}m&&m.append(v,x);let w=v.sub(x)._perp(),T=w.x/(Math.abs(w.x)+Math.abs(w.y)),E=w.y>0?1:0,S=x.dist(v);if(g+S>32768&&(g=0),y){h=b.sub(v)._perp()._unit();let i=sz(x,v,b,sC(l,h),y);isNaN(i)&&(i=0);let r=v.sub(x)._unit();x=x.add(r.mult(c))._round(),v=v.add(r.mult(-i))._round(),c=i,l=h}let I=s.vertexLength,A=o.length>4&&sk(x,v,b),M=sD(g,u,!0);if(sS(this.layoutVertexArray,x.x,x.y,T,E,0,0,M),sS(this.layoutVertexArray,x.x,x.y,T,E,0,1,M),g+=S,M=sD(g,A,!1),u=A,sS(this.layoutVertexArray,v.x,v.y,T,E,0,0,M),sS(this.layoutVertexArray,v.x,v.y,T,E,0,1,M),s.vertexLength+=4,this.indexArray.emplaceBack(I+0,I+1,I+2),this.indexArray.emplaceBack(I+1,I+3,I+2),s.primitiveLength+=2,y){let a=n+(1===f?o.length-2:f-2),l=1===f?n:a+1;if(this.indexArray.emplaceBack(I+1,a,I+3),this.indexArray.emplaceBack(a,l,I+3),s.primitiveLength+=2,void 0===i&&(i=I),!sP(b,o[f],r)){let r=f===o.length-1?i:s.vertexLength;this.indexArray.emplaceBack(I+2,I+3,r),this.indexArray.emplaceBack(I+3,r+1,r),this.indexArray.emplaceBack(I+3,l,r+1),s.primitiveLength+=3}}if(d){let i=this.layoutVertexExtArray,r=p.projectTilePoint(x.x,x.y,a),n=p.projectTilePoint(v.x,v.y,a),o=p.upVector(a,x.x,x.y),s=p.upVector(a,v.x,v.y);sI(i,r,o),sI(i,r,o),sI(i,n,s),sI(i,n,s)}}_&&(n+=o.length-1)}}if(m&&m.polyCount.length>0){if(m.borders){m.vertexArrayOffset=this.centroidVertexArray.length;let i=m.borders,r=this.featuresOnBorder.push(m)-1;for(let n=0;n<4;n++)i[n][0]!==Number.MAX_VALUE&&this.borders[n].push(r)}this.encodeCentroid(m.borders?void 0:m.centroid(),m)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,o,s,a)}sortBorders(){for(let i=0;i<4;i++)this.borders[i].sort((r,n)=>this.featuresOnBorder[r].borders[i][0]-this.featuresOnBorder[n].borders[i][0])}encodeCentroid(i,r,n=!0){let a,o;if(i){if(0!==i.y){let n=r.span()._mult(this.tileToMeter);a=(Math.max(i.x,1)<<3)+Math.min(7,Math.round(n.x/10)),o=(Math.max(i.y,1)<<3)+Math.min(7,Math.round(n.y/10))}else a=Math.ceil(7*(i.x+450)),o=0}else a=0,o=+n;let s=n?this.centroidVertexArray.length:r.vertexArrayOffset;for(let i of r.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*i.edges+i.top);for(let r=0;r<i.top;r++)this.centroidVertexArray.emplace(s++,a,o);for(let r=0;r<2*i.edges;r++)this.centroidVertexArray.emplace(s++,0,o),this.centroidVertexArray.emplace(s++,a,o)}}}function sC(i,r){let n=i.add(r)._unit();return i.x*n.x+i.y*n.y}function sz(i,r,n,a,o){let s=Math.sqrt(1-a*a);return Math.min(i.dist(r)/3,r.dist(n)/3,o*s/a)}function sP(i,r,n){return i.x<n[0].x&&r.x<n[0].x||i.x>n[1].x&&r.x>n[1].x||i.y<n[0].y&&r.y<n[0].y||i.y>n[1].y&&r.y>n[1].y}function sk(i,r,n){if(i.x<0||i.x>=8192||r.x<0||r.x>=8192||n.x<0||n.x>=8192)return!1;let a=n.sub(r),o=a.perp(),s=i.sub(r);return(a.x*s.x+a.y*s.y)/Math.sqrt((a.x*a.x+a.y*a.y)*(s.x*s.x+s.y*s.y))>-.866&&o.x*s.x+o.y*s.y<0}function sD(i,r,n){let a=r?2|i:-3&i;return n?1|a:-2&a}function sL(){let i=Math.PI/32,r=Math.tan(i);return 6371008.8*Math.sqrt(1+2*r*r)-6371008.8}function sB(i,r,n){let a=1<<n.z,o=aO(n.x/a),s=aO((n.x+1)/a),l=aU(n.y/a),h=aU((n.y+1)/a);return function(i,r,n,a,o=0,s){let l=[];if(!i.length||!n||!a)return l;let h=(i,r)=>{for(let n of i)l.push({polygon:n,bounds:r})},u=Math.ceil(Math.log2(n)),c=Math.ceil(Math.log2(a)),p=u-c,d=[];for(let i=0;i<Math.abs(p);i++)d.push(p>0?0:1);for(let i=0;i<Math.min(u,c);i++)d.push(0),d.push(1);let m=i;if(m=sT(m,r[0].y-o,r[1].y+o,1),!(m=sT(m,r[0].x-o,r[1].x+o,0)).length)return l;let _=[];for(d.length?_.push({polygons:m,bounds:r,depth:0}):h(m,r);_.length;){let i=_.pop(),r=i.depth,n=d[r],a=i.bounds[0],l=i.bounds[1],u=0===n?a.x:a.y,c=0===n?l.x:l.y,p=s?s(n,u,c):.5*(u+c),m=sT(i.polygons,u-o,p+o,n),g=sT(i.polygons,p-o,c+o,n);if(m.length){let i=[a,new f(0===n?p:l.x,1===n?p:l.y)];d.length>r+1?_.push({polygons:m,bounds:i,depth:r+1}):h(m,i)}if(g.length){let i=[new f(0===n?p:a.x,1===n?p:a.y),l];d.length>
8r+1?_.push({polygons:g,bounds:i,depth:r+1}):h(g,i)}}return l}(i,r,Math.ceil((s-o)/11.25),Math.ceil((l-h)/11.25),1,(i,r,o)=>{if(0===i)return .5*(r+o);{let i=aU((n.y+r/8192)/a);return(aF(.5*(aU((n.y+o/8192)/a)+i))*a-n.y)*8192}})}rg(sM,"FillExtrusionBucket",{omit:["layers","features"]}),rg(sA,"PartMetadata");let sR=new n_({"fill-extrusion-edge-radius":new nc(eG["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var sF={paint:new n_({"fill-extrusion-opacity":new nc(eG["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new np(eG["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new nc(eG["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new nc(eG["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new nd(eG["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new np(eG["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new np(eG["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new nc(eG["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new nc(eG["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new nc(eG["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:sR};function sO(i,r,n){var a=2*Math.PI*6378137/256/Math.pow(2,n);return[i*a-2*Math.PI*6378137/2,r*a-2*Math.PI*6378137/2]}class sU{constructor(i,r,n){this.z=i,this.x=r,this.y=n,this.key=sN(0,i,i,r,n)}equals(i){return this.z===i.z&&this.x===i.x&&this.y===i.y}url(i,r){var n,a,o,s,l;let h=(n=this.x,a=this.y,s=sO(256*n,256*(a=Math.pow(2,o=this.z)-a-1),o),l=sO(256*(n+1),256*(a+1),o),s[0]+","+s[1]+","+l[0]+","+l[1]),u=function(i,r,n){let a,o="";for(let s=i;s>0;s--)o+=(r&(a=1<<s-1)?1:0)+(n&a?2:0);return o}(this.z,this.x,this.y);return i[(this.x+this.y)%i.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",u).replace("{bbox-epsg-3857}",h)}toString(){return`${this.z}/${this.x}/${this.y}`}}class sV{constructor(i,r){this.wrap=i,this.canonical=r,this.key=sN(i,r.z,r.z,r.x,r.y)}}class sj{constructor(i,r,n,a,o){this.overscaledZ=i,this.wrap=r,this.canonical=new sU(n,+a,+o),this.key=0===r&&i===n?this.canonical.key:sN(r,i,n,a,o)}equals(i){return this.overscaledZ===i.overscaledZ&&this.wrap===i.wrap&&this.canonical.equals(i.canonical)}scaledTo(i){let r=this.canonical.z-i;return i>this.canonical.z?new sj(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sj(i,this.wrap,i,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(i,r=!0){if(this.overscaledZ===i&&r)return this.key;if(i>this.canonical.z)return sN(this.wrap*+r,i,this.canonical.z,this.canonical.x,this.canonical.y);{let n=this.canonical.z-i;return sN(this.wrap*+r,i,i,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(i){if(i.wrap!==this.wrap)return!1;let r=this.canonical.z-i.canonical.z;return 0===i.overscaledZ||i.overscaledZ<this.overscaledZ&&i.canonical.x===this.canonical.x>>r&&i.canonical.y===this.canonical.y>>r}children(i){if(this.overscaledZ>=i)return[new sj(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=2*this.canonical.x,a=2*this.canonical.y;return[new sj(r,this.wrap,r,n,a),new sj(r,this.wrap,r,n+1,a),new sj(r,this.wrap,r,n,a+1),new sj(r,this.wrap,r,n+1,a+1)]}isLessThan(i){return this.wrap<i.wrap||!(this.wrap>i.wrap)&&(this.overscaledZ<i.overscaledZ||!(this.overscaledZ>i.overscaledZ)&&(this.canonical.x<i.canonical.x||!(this.canonical.x>i.canonical.x)&&this.canonical.y<i.canonical.y))}wrapped(){return new sj(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(i){return new sj(this.overscaledZ,i,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new sV(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function sN(i,r,n,a,o){let s=1<<Math.min(n,22),l=s*(o%s)+a%s;return i&&n<22&&(l+=s*s*((i<0?-2*i-1:2*i)%(1<<2*(22-n)))),16*(32*l+n)+(r-n)}function sG(i,r){return i.x*r.x+i.y*r.y}function sZ(i,r){if(1===i.length){let n,a=0,o=r[a++];for(;!n||o.equals(n);)if(!(n=r[a++]))return 1/0;for(;a<r.length;
8a++){let s=r[a],l=i[0],h=n.sub(o),u=s.sub(o),c=l.sub(o),p=sG(h,h),d=sG(h,u),f=sG(u,u),m=sG(c,h),_=sG(c,u),g=p*f-d*d,y=(f*m-d*_)/g,x=(p*_-d*m)/g,v=o.z*(1-y-x)+n.z*y+s.z*x;if(isFinite(v))return v}return 1/0}{let i=1/0;for(let n of r)i=Math.min(i,n.z);return i}}function s$(i){let r=new f(i[0],i[1]);return r.z=i[2],r}function sq(i,r,n,a,o,s,l,h){let u=l*o.getElevationAt(i,r,!0,!0),c=0!==s[0],p=c?0===s[1]?l*(s[0]/7-450):l*function(i,r,n){var a,o;let s=Math.floor(r[0]/8),l=Math.floor(r[1]/8),h=10*(r[0]-8*s),u=10*(r[1]-8*l),c=i.getElevationAt(s,l,!0,!0),p=i.getMeterToDEM(n),d=Math.floor(.5*(h*p-1)),f=Math.floor(.5*(u*p-1)),m=i.tileCoordToPixel(s,l),_=2*d+1,g=2*f+1,y=(a=m.x-d,o=m.y-f,[i.getElevationAtPixel(a,o,!0),i.getElevationAtPixel(a+g,o,!0),i.getElevationAtPixel(a,o+g,!0),i.getElevationAtPixel(a+_,o+g,!0)]),x=Math.abs(y[0]-y[1]),v=Math.abs(y[2]-y[3]),b=Math.abs(y[0]-y[2])+Math.abs(y[1]-y[3]),w=Math.min(.25,.5*p*(x+v)/_),T=Math.min(.25,.5*p*b/g);return c+Math.max(w*h,T*u)}(o,s,h):u;return{base:u+(0===n)?-1:n,top:c?Math.max(p+a,u+n+2):u+a}}rg(sU,"CanonicalTileID"),rg(sj,"OverscaledTileID",{omit:["projMatrix"]});let sX=nb([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:sW}=sX,sH=nb([{name:"a_packed",components:4,type:"Float32"}]),{members:sY}=sH,sK=sw.VectorTileFeature.types,sJ=Math.cos(Math.PI/180*37.5);class sQ{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.projection=i.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new nI,this.layoutVertexArray2=new nA,this.indexArray=new nU,this.programConfigurations=new aw(i.layers,i.zoom),this.segments=new aP,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,a){this.hasPattern=sl("line",this.layers,r);let o=this.layers[0].layout.get("line-sort-key"),s=[];for(let{feature:r,id:l,index:h,sourceLayerIndex:u}of i){let i=this.layers[0]._featureFilter.needGeometry,c=a$(r,i);if(!this.layers[0]._featureFilter.filter(new ni(this.zoom),c,n))continue;let p=o?o.evaluate(c,{},n):void 0,d={id:l,properties:r.properties,type:r.type,sourceLayerIndex:u,index:h,geometry:i?c.geometry:aZ(r,n,a),patterns:{},sortKey:p};s.push(d)}o&&s.sort((i,r)=>i.sortKey-r.sortKey);let{lineAtlas:l,featureIndex:h}=r,u=this.addConstantDashes(l);for(let a of s){let{geometry:o,index:s,sourceLayerIndex:c}=a;if(u&&this.addFeatureDashes(a,l),this.hasPattern){let i=sh("line",this.layers,a,this.zoom,r);this.patternFeatures.push(i)}else this.addFeature(a,o,s,n,l.positions,r.availableImages);h.insert(i[s].feature,o,s,c,this.index)}}addConstantDashes(i){let r=!1;for(let n of this.layers){let a=n.paint.get("line-dasharray").value,o=n.layout.get("line-cap").value;if("constant"!==a.kind||"constant"!==o.kind)r=!0;else{let r=o.value,n=a.value;if(!n)continue;i.addDash(n.from,r),i.addDash(n.to,r),n.other&&i.addDash(n.other,r)}}return r}addFeatureDashes(i,r){let n=this.zoom;for(let a of this.layers){let o,s,l,h,u,c;let p=a.paint.get("line-dasharray").value,d=a.layout.get("line-cap").value;if("constant"===p.kind&&"constant"===d.kind)continue;if("constant"===p.kind){let i=p.value;if(!i)continue;o=i.other||i.to,s=i.to,l=i.from}else o=p.evaluate({zoom:n-1},i),s=p.evaluate({zoom:n},i),l=p.evaluate({zoom:n+1},i);"constant"===d.kind?h=u=c=d.value:(h=d.evaluate({zoom:n-1},i),u=d.evaluate({zoom:n},i),c=d.evaluate({zoom:n+1},i)),r.addDash(o,h),r.addDash(s,u),r.addDash(l,c);let f=r.getKey(o,h),m=r.getKey(s,u),_=r.getKey(l,c);i.patterns[a.id]={min:f,mid:m,max:_}}}update(i,r,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,a)}addFeatures(i,r,n,a,o){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,a)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,sY)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,sW),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&i.properties.hasOwnProperty("mapbox_clip_start")&&i.properties.hasOwnProperty("mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,r,n,a,o,s){let l=this.layers[0].layout,h=l.get("line-join").evaluate(i,{}),u=l.get("line-cap").evaluate(i,{}),c=l.get("line-miter-limit"),p=l.get("line-round-limit");for(let n of(this.lineClips=this.lineFeatureClips(i),r))this.addLine(n,i,h,u,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,o,s,a)}
8addLine(i,r,n,a,o,s){let l,h,u,c,p;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let r=0;r<i.length-1;r++)this.totalDistance+=i[r].dist(i[r+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let d="Polygon"===sK[r.type],f=i.length;for(;f>=2&&i[f-1].equals(i[f-2]);)f--;let m=0;for(;m<f-1&&i[m].equals(i[m+1]);)m++;if(f<(d?3:2))return;"bevel"===n&&(o=1.05);let _=this.overscaling<=16?122880/(512*this.overscaling):0,g=this.segments.prepareSegment(10*f,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,d&&(l=i[f-2],p=i[m].sub(l)._unit()._perp());for(let r=m;r<f;r++){if((u=r===f-1?d?i[m+1]:void 0:i[r+1])&&i[r].equals(u))continue;p&&(c=p),l&&(h=l),l=i[r],p=u?u.sub(l)._unit()._perp():c;let y=(c=c||p).add(p);0===y.x&&0===y.y||y._unit();let x=c.x*p.x+c.y*p.y,v=y.x*p.x+y.y*p.y,b=0!==v?1/v:1/0,w=2*Math.sqrt(2-2*v),T=v<sJ&&h&&u,E=c.x*p.y-c.y*p.x>0;if(T&&r>m){let i=l.dist(h);if(i>2*_){let r=l.sub(l.sub(h)._mult(_/i)._round());this.updateDistance(h,r),this.addCurrentVertex(r,c,0,0,g),h=r}}let S=h&&u,I=S?n:d?"butt":a;if(S&&"round"===I&&(b<s?I="miter":b<=2&&(I="fakeround")),"miter"===I&&b>o&&(I="bevel"),"bevel"===I&&(b>2&&(I="flipbevel"),b<o&&(I="miter")),h&&this.updateDistance(h,l),"miter"===I)y._mult(b),this.addCurrentVertex(l,y,0,0,g);else if("flipbevel"===I){if(b>100)y=p.mult(-1);else{let i=b*c.add(p).mag()/c.sub(p).mag();y._perp()._mult(i*(E?-1:1))}this.addCurrentVertex(l,y,0,0,g),this.addCurrentVertex(l,y.mult(-1),0,0,g)}else if("bevel"===I||"fakeround"===I){let i=-Math.sqrt(b*b-1),r=E?i:0,n=E?0:i;if(h&&this.addCurrentVertex(l,c,r,n,g),"fakeround"===I){let i=Math.round(180*w/Math.PI/20);for(let r=1;r<i;r++){let n=r/i;if(.5!==n){let i=n-.5;n+=n*i*(n-1)*((1.0904+x*(x*(3.55645-1.43519*x)-3.2452))*i*i+(.848013+x*(.215638*x-1.06021)))}let a=p.sub(c)._mult(n)._add(c)._unit()._mult(E?-1:1);this.addHalfVertex(l,a.x,a.y,!1,E,0,g)}}u&&this.addCurrentVertex(l,p,-r,-n,g)}else if("butt"===I)this.addCurrentVertex(l,y,0,0,g);else if("square"===I){let i=h?1:-1;h||this.addCurrentVertex(l,y,i,i,g),this.addCurrentVertex(l,y,0,0,g),h&&this.addCurrentVertex(l,y,i,i,g)}else"round"===I&&(h&&(this.addCurrentVertex(l,c,0,0,g),this.addCurrentVertex(l,c,1,1,g,!0)),u&&(this.addCurrentVertex(l,p,-1,-1,g,!0),this.addCurrentVertex(l,p,0,0,g)));if(T&&r<f-1){let i=l.dist(u);if(i>2*_){let r=l.add(u.sub(l)._mult(_/i)._round());this.updateDistance(l,r),this.addCurrentVertex(r,p,0,0,g),l=r}}}}addCurrentVertex(i,r,n,a,o,s=!1){let l=r.y*a-r.x,h=-r.y-r.x*a;this.addHalfVertex(i,r.x+r.y*n,r.y-r.x*n,s,!1,n,o),this.addHalfVertex(i,l,h,s,!0,-a,o)}addHalfVertex({x:i,y:r},n,a,o,s,l,h){this.layoutVertexArray.emplaceBack((i<<1)+(o?1:0),(r<<1)+(s?1:0),Math.round(63*n)+128,Math.round(63*a)+128,1+(0===l?0:l<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);let u=h.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),h.primitiveLength++),s?this.e2=u:this.e1=u}updateScaledDistance(){if(this.lineClips){let i=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=i*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(i,r){this.distance+=i.dist(r),this.updateScaledDistance()}}rg(sQ,"LineBucket",{omit:["layers","patternFeatures"]});let s0=new n_({"line-cap":new np(eG.layout_line["line-cap"]),"line-join":new np(eG.layout_line["line-join"]),"line-miter-limit":new nc(eG.layout_line["line-miter-limit"]),"line-round-limit":new nc(eG.layout_line["line-round-limit"]),"line-sort-key":new np(eG.layout_line["line-sort-key"])});var s1={paint:new n_({"line-opacity":new np(eG.paint_line["line-opacity"]),"line-color":new np(eG.paint_line["line-color"]),"line-translate":new nc(eG.paint_line["line-translate"]),"line-translate-anchor":new nc(eG.paint_line["line-translate-anchor"]),"line-width":new np(eG.paint_line["line-width"]),"line-gap-width":new np(eG.paint_line["line-gap-width"]),"line-offset":new np(eG.paint_line["line-offset"]),"line-blur"
8:new np(eG.paint_line["line-blur"]),"line-dasharray":new nd(eG.paint_line["line-dasharray"]),"line-pattern":new nd(eG.paint_line["line-pattern"]),"line-gradient":new nm(eG.paint_line["line-gradient"]),"line-trim-offset":new nc(eG.paint_line["line-trim-offset"])}),layout:s0};let s2=new class extends np{possiblyEvaluate(i,r){return r=new ni(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(i,r)}evaluate(i,r,n,a){return r=A({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,n,a)}}(s1.paint.properties["line-width"].specification);s2.useIntegerZoom=!0;let s3=nb([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),s5=nb([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),s4=nb([{name:"a_projected_pos",components:4,type:"Float32"}],4);nb([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let s6=nb([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),s8=nb([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);nb([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let s9=nb([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),s7=nb([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function le(i,r){let{expression:n}=r;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new ni(i+1))};if("source"===n.kind)return{kind:"source"};{let{zoomStops:r,interpolationType:a}=n,o=0;for(;o<r.length&&r[o]<=i;)o++;let s=o=Math.max(0,o-1);for(;s<r.length&&r[s]<i+1;)s++;s=Math.min(r.length-1,s);let l=r[o],h=r[s];return"composite"===n.kind?{kind:"composite",minZoom:l,maxZoom:h,interpolationType:a}:{kind:"camera",minZoom:l,maxZoom:h,minSize:n.evaluate(new ni(l)),maxSize:n.evaluate(new ni(h)),interpolationType:a}}}function lt(i,{uSize:r,uSizeT:n},{lowerSize:a,upperSize:o}){return"source"===i.kind?a/128:"composite"===i.kind?tG(a/128,o/128,n):r}function li(i,r){let n=0,a=0;if("constant"===i.kind)a=i.layoutSize;else if("source"!==i.kind){let{interpolationType:o,minZoom:s,maxZoom:l}=i,h=o?w(t6.interpolationFactor(o,r,s,l),0,1):0;"camera"===i.kind?a=tG(i.minSize,i.maxSize,h):n=h}return{uSizeT:n,uSize:a}}nb([{name:"triangle",components:3,type:"Uint16"}]),nb([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"},{type:"Uint8",name:"flipState"}]),nb([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),nb([{type:"Float32",name:"offsetX"}]),nb([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var lr=Object.freeze({__proto__:null,getSizeData:le,evaluateSizeForFeature:lt,evaluateSizeForZoom:li,SIZE_PACK_FACTOR:128});let ln={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","\xa2":"ï¿ ","\xa3":"ï¿¡","\xa5":"ï¿¥","\xa6":"¦","\xac":"ï¿¢","\xaf":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"};var la=function(i,r,n,a,o){var s,l,h=8*o-a-1,u=(1<<h)-1,c=u>>1,p=-7,d=n?o-1:0,f=n?-1:1,m=i[r+d];for(d+=f,s=m&(1<<-p)-1,m>>=-p,p+=h;p>0;s=256*s+i[r+d],d+=f,p-=8);for(l=s&(1<<-p)-1,s>>=-p,p+=a;p>0;l=256*l+i[r+d],d+=f,p-=8);if(0===s)s=1-c;else{if(s===u)return l?NaN:1/0*(m?-1:1);l+=Math.pow(2,a),s-=c}return(m?-1:1)*l*Math.pow(2,s-a)},lo=function(i,r,n,a,o,s){var l,h,u,c=8*s-o-1,p=(1<<c)-1,d=p>>1,f=23===o?5960464477539062e-23:0,m=a?0:s-1,_=a?1:-1,g=r<0||0===r&&1/r<0?1:0;for(isNaN(r=Math.abs(r))||r===1/0?(h=isNaN(r)?1:0,l=p):(l=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-l))<1&&(l--,u*=2),(r+=l+d>=1?f/u:f*Math.pow(2,1-d))*u>=2&&(l++,u/=2),l+d>=p?(h=0,l=p):l+d>=1?(h=(r*u-1)*Math.pow(2,o),l+=d):(h=r*Math.pow(2,d-1)*Math.pow(2,o),l=0));o>=8;i[n+m]=255&h,m+=_,h/=256,o-=8);for(l=l<<o|h,c+=o;c>0;i[n+m]=255&l,m+=_,l/=256,c-=8);i[n+m-_]|=128*g};function ls(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}ls.Varint=0,ls.Fixed64=1,ls.Bytes=2,ls.Fixed32=5;var ll="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function lh(i){return i.type===ls.Bytes?i.readVarint()+i.pos:i.pos+1}function lu(i,r,n){var a=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));n.realloc(a);for(var o=n.pos-1;o>=i;o--)n.buf[o+a]=n.buf[o]}function lc(i,r){for(var n=0;n<i.length;n++)r.writeVarint(i[n])}function lp(i,r){for(var n=0;n<i.length;n++)r.writeSVarint(i[n])}function ld(i,r){for(var n=0;n<i.length;n++)r.writeFloat(i[n])}function lf(i,r){for(var n=0;n<i.length;n++)r.writeDouble(i[n])}function lm(i,r){for(var n=0;n<i.length;n++)r.writeBoolean(i[n])}function l_(i,r){for(var n=0;n<i.length;n++)r.writeFixed32(i[n])}function lg(i,r){for(var n=0;n<i.length;n++)r.writeSFixed32(i[n])}function ly(i,r){for(var n=0;n<i.length;
8n++)r.writeFixed64(i[n])}function lx(i,r){for(var n=0;n<i.length;n++)r.writeSFixed64(i[n])}function lv(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16)+16777216*i[r+3]}function lb(i,r,n){i[n]=r,i[n+1]=r>>>8,i[n+2]=r>>>16,i[n+3]=r>>>24}function lw(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16)+(i[r+3]<<24)}function lT(i,r,n){r.glyphs=[],1===i&&n.readMessage(lE,r)}function lE(i,r,n){if(3===i){let{id:i,bitmap:a,width:o,height:s,left:l,top:h,advance:u}=n.readMessage(lS,{});r.glyphs.push({id:i,bitmap:new oG({width:o+6,height:s+6},a),metrics:{width:o,height:s,left:l,top:h,advance:u}})}else 4===i?r.ascender=n.readSVarint():5===i&&(r.descender=n.readSVarint())}function lS(i,r,n){1===i?r.id=n.readVarint():2===i?r.bitmap=n.readBytes():3===i?r.width=n.readVarint():4===i?r.height=n.readVarint():5===i?r.left=n.readSVarint():6===i?r.top=n.readSVarint():7===i&&(r.advance=n.readVarint())}function lI(i){let r=0,n=0;for(let a of i)r+=a.w*a.h,n=Math.max(n,a.w);i.sort((i,r)=>r.h-i.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),n),h:1/0}],o=0,s=0;for(let r of i)for(let i=a.length-1;i>=0;i--){let n=a[i];if(!(r.w>n.w||r.h>n.h)){if(r.x=n.x,r.y=n.y,s=Math.max(s,r.y+r.h),o=Math.max(o,r.x+r.w),r.w===n.w&&r.h===n.h){let r=a.pop();i<a.length&&(a[i]=r)}else r.h===n.h?(n.x+=r.w,n.w-=r.w):r.w===n.w?(n.y+=r.h,n.h-=r.h):(a.push({x:n.x+r.w,y:n.y,w:n.w-r.w,h:r.h}),n.y+=r.h,n.h-=r.h);break}}return{w:o,h:s,fill:r/(o*s)||0}}ls.prototype={destroy:function(){this.buf=null},readFields:function(i,r,n){for(n=n||this.length;this.pos<n;){var a=this.readVarint(),o=a>>3,s=this.pos;this.type=7&a,i(o,r,this),this.pos===s&&this.skip(a)}return r},readMessage:function(i,r){return this.readFields(i,r,this.readVarint()+this.pos)},readFixed32:function(){var i=lv(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=lw(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=lv(this.buf,this.pos)+4294967296*lv(this.buf,this.pos+4);return this.pos+=8,i},readSFixed64:function(){var i=lv(this.buf,this.pos)+4294967296*lw(this.buf,this.pos+4);return this.pos+=8,i},readFloat:function(){var i=la(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=la(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var r,n,a=this.buf;return r=127&(n=a[this.pos++]),n<128?r:(r|=(127&(n=a[this.pos++]))<<7,n<128?r:(r|=(127&(n=a[this.pos++]))<<14,n<128?r:(r|=(127&(n=a[this.pos++]))<<21,n<128?r:function(i,r,n){var a,o,s,l=n.buf;if(o=(112&(s=l[n.pos++]))>>4,s<128||(o|=(127&(s=l[n.pos++]))<<3,s<128)||(o|=(127&(s=l[n.pos++]))<<10,s<128)||(o|=(127&(s=l[n.pos++]))<<17,s<128)||(o|=(127&(s=l[n.pos++]))<<24,s<128)||(o|=(1&(s=l[n.pos++]))<<31,s<128))return a=o,r?4294967296*a+(i>>>0):4294967296*(a>>>0)+(i>>>0);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(n=a[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?-((i+1)/2):i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i,r=this.readVarint()+this.pos,n=this.pos;return this.pos=r,r-n>=12&&ll?(i=this.buf,ll.decode(i.subarray(n,r))):function(i,r,n){for(var a="",o=r;o<n;){var s,l,h,u=i[o],c=null,p=u>239?4:u>223?3:u>191?2:1;if(o+p>n)break;1===p?u<128&&(c=u):2===p?128==(192&(s=i[o+1]))&&(c=(31&u)<<6|63&s)<=127&&(c=null):3===p?(l=i[o+2],128==(192&(s=i[o+1]))&&128==(192&l)&&((c=(15&u)<<12|(63&s)<<6|63&l)<=2047||c>=55296&&c<=57343)&&(c=null)):4===p&&(l=i[o+2],h=i[o+3],128==(192&(s=i[o+1]))&&128==(192&l)&&128==(192&h)&&((c=(15&u)<<18|(63&s)<<12|(63&l)<<6|63&h)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,p=1):c>65535&&(c-=65536,a+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),a+=String.fromCharCode(c),o+=p}return a}(this.buf,n,r)},readBytes:function(){var i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r},readPackedVarint:function(i,r){if(this.type!==ls.Bytes)return i.push(this.readVarint(r));var n=lh(this);for(i=i||[];this.pos<n;)i.push(this.readVarint(r));return i},readPackedSVarint:function(i){if(this.type!==ls.Bytes)return i.push(this.readSVarint());var r=lh(this);for(i=i||[];this.pos<r;)i.push(this.readSVarint());return i}
vendor: 5,315 bytes, line 8
8,readPackedBoolean:function(i){if(this.type!==ls.Bytes)return i.push(this.readBoolean());var r=lh(this);for(i=i||[];this.pos<r;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==ls.Bytes)return i.push(this.readFloat());var r=lh(this);for(i=i||[];this.pos<r;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==ls.Bytes)return i.push(this.readDouble());var r=lh(this);for(i=i||[];this.pos<r;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==ls.Bytes)return i.push(this.readFixed32());var r=lh(this);for(i=i||[];this.pos<r;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==ls.Bytes)return i.push(this.readSFixed32());var r=lh(this);for(i=i||[];this.pos<r;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==ls.Bytes)return i.push(this.readFixed64());var r=lh(this);for(i=i||[];this.pos<r;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==ls.Bytes)return i.push(this.readSFixed64());var r=lh(this);for(i=i||[];this.pos<r;)i.push(this.readSFixed64());return i},skip:function(i){var r=7&i;if(r===ls.Varint)for(;this.buf[this.pos++]>127;);else if(r===ls.Bytes)this.pos=this.readVarint()+this.pos;else if(r===ls.Fixed32)this.pos+=4;else{if(r!==ls.Fixed64)throw Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(i,r){this.writeVarint(i<<3|r)},realloc:function(i){for(var r=this.length||16;r<this.pos+i;)r*=2;if(r!==this.length){var n=new Uint8Array(r);n.set(this.buf),this.buf=n,this.length=r}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),lb(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),lb(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),lb(this.buf,-1&i,this.pos),lb(this.buf,Math.floor(23283064365386963e-26*i),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),lb(this.buf,-1&i,this.pos),lb(this.buf,Math.floor(23283064365386963e-26*i),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(i,r){var n,a,o,s,l,h,u;if(i>=0?(n=i%4294967296|0,a=i/4294967296|0):(a=~(-i/4294967296),4294967295^(n=~(-i%4294967296))?n=n+1|0:(n=0,a=a+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");r.realloc(10),o=n,(s=r).buf[s.pos++]=127&o|128,o>>>=7,s.buf[s.pos++]=127&o|128,o>>>=7,s.buf[s.pos++]=127&o|128,o>>>=7,s.buf[s.pos++]=127&o|128,s.buf[s.pos]=127&(o>>>=7),l=a,h=r,u=(7&l)<<4,h.buf[h.pos++]|=u|((l>>>=3)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l|((l>>>=7)?128:0),l&&(h.buf[h.pos++]=127&l)))))}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?-(2*i)-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var r=this.pos;this.pos=function(i,r,n){for(var a,o,s=0;s<r.length;s++){if((a=r.charCodeAt(s))>55295&&a<57344){if(!o){a>56319||s+1===r.length?(i[n++]=239,i[n++]=191,i[n++]=189):o=a;continue}if(a<56320){i[n++]=239,i[n++]=191,i[n++]=189,o=a;continue}a=o-55296<<10|a-56320|65536,o=null}else o&&(i[n++]=239,i[n++]=191,i[n++]=189,o=null);a<128?i[n++]=a:(a<2048?i[n++]=a>>6|192:(a<65536?i[n++]=a>>12|224:(i[n++]=a>>18|240,i[n++]=a>>12&63|128),i[n++]=a>>6&63|128),i[n++]=63&a|128)}return n}(this.buf,i,this.pos);var n=this.pos-r;n>=128&&lu(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeFloat:function(i){this.realloc(4),lo(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),lo(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var r=i.length;this.writeVarint(r),this.realloc(r);for(var n=0;n<r;n++)this.buf[this.pos++]=i[n]},writeRawMessage:function(i,r){this.pos++;var n=this.pos;i(r,this);var a=this.pos-n;a>=128&&lu(n,a,this),this.pos=n-1,this.writeVarint(a),this.pos+=a},writeMessage:function(i,r,n){this.writeTag(i,ls.Bytes),this.writeRawMessage(r,n)},writePackedVarint:function(i,r){r.length&&this.writeMessage(i,lc,r)},writePackedSVarint:function(i,r){r.length&&this.writeMessage(i,lp,r)},writePackedBoolean:function(i,r){r.length&&this.writeMessage(i,lm,r)},writePackedFloat:function(i,r){r.length&&this.writeMessage(i,ld,r)},writePackedDouble:function(i,r){r.length&&this.writeMessage(i,lf,r)},writePackedFixed32:function(i,r){r.length&&this.writeMessage(i,l_,r)},writePackedSFixed32:function(i,r){r.length&&this.writeMessage(i,lg,r)},writePackedFixed64:function(i,r){r.length&&this.writeMessage(i,ly,r)},writePackedSFixed64:function(i,r){r.length&&this.writeMessage(i,lx,r)},writeBytesField:function(i,r){this.writeTag(i,ls.Bytes),this.writeBytes(r)},writeFixed32Field:function(i,r){this.writeTag(i,ls.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(i,r){this.writeTag(i,ls.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(i,r){this.writeTag(i,ls.Fixed64),this.writeFixed64
8(r)},writeSFixed64Field:function(i,r){this.writeTag(i,ls.Fixed64),this.writeSFixed64(r)},writeVarintField:function(i,r){this.writeTag(i,ls.Varint),this.writeVarint(r)},writeSVarintField:function(i,r){this.writeTag(i,ls.Varint),this.writeSVarint(r)},writeStringField:function(i,r){this.writeTag(i,ls.Bytes),this.writeString(r)},writeFloatField:function(i,r){this.writeTag(i,ls.Fixed32),this.writeFloat(r)},writeDoubleField:function(i,r){this.writeTag(i,ls.Fixed64),this.writeDouble(r)},writeBooleanField:function(i,r){this.writeVarintField(i,Boolean(r))}};class lA{constructor(i,{pixelRatio:r,version:n,stretchX:a,stretchY:o,content:s}){this.paddedRect=i,this.pixelRatio=r,this.stretchX=a,this.stretchY=o,this.content=s,this.version=n}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 displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class lM{constructor(i,r){let n={},a={};this.haveRenderCallbacks=[];let o=[];this.addImages(i,n,o),this.addImages(r,a,o);let{w:s,h:l}=lI(o),h=new oZ({width:s||1,height:l||1});for(let r in i){let a=i[r],o=n[r].paddedRect;oZ.copy(a.data,h,{x:0,y:0},{x:o.x+1,y:o.y+1},a.data)}for(let i in r){let n=r[i],o=a[i].paddedRect,s=o.x+1,l=o.y+1,u=n.data.width,c=n.data.height;oZ.copy(n.data,h,{x:0,y:0},{x:s,y:l},n.data),oZ.copy(n.data,h,{x:0,y:c-1},{x:s,y:l-1},{width:u,height:1}),oZ.copy(n.data,h,{x:0,y:0},{x:s,y:l+c},{width:u,height:1}),oZ.copy(n.data,h,{x:u-1,y:0},{x:s-1,y:l},{width:1,height:c}),oZ.copy(n.data,h,{x:0,y:0},{x:s+u,y:l},{width:1,height:c})}this.image=h,this.iconPositions=n,this.patternPositions=a}addImages(i,r,n){for(let a in i){let o=i[a],s={x:0,y:0,w:o.data.width+2,h:o.data.height+2};n.push(s),r[a]=new lA(s,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(i,r){for(let n in this.haveRenderCallbacks=this.haveRenderCallbacks.filter(r=>i.hasImage(r)),i.dispatchRenderCallbacks(this.haveRenderCallbacks),i.updatedImages)this.patchUpdatedImage(this.iconPositions[n],i.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],i.getImage(n),r)}patchUpdatedImage(i,r,n){if(!i||!r||i.version===r.version)return;i.version=r.version;let[a,o]=i.tl;n.update(r.data,void 0,{x:a,y:o})}}rg(lA,"ImagePosition"),rg(lM,"ImageAtlas");let lC={horizontal:1,vertical:2,horizontalOnly:3};class lz{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(i,r){let n=new lz;return n.scale=i||1,n.fontStack=r,n}static forImage(i){let r=new lz;return r.imageName=i,r}}class lP{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,r){let n=new lP;for(let a=0;a<i.sections.length;a++){let o=i.sections[a];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(i){return this.sections[this.sectionIndex[i]]}getSections(){return this.sections}getSectionIndex(i){return this.sectionIndex[i]}getCharCode(i){return this.text.charCodeAt(i)}verticalizePunctuation(i){this.text=function(i,r){let n="";for(let a=0;a<i.length;a++){let o=i.charCodeAt(a+1)||null,s=i.charCodeAt(a-1)||null;n+=!r&&(o&&rJ(o)&&!ln[i[a+1]]||s&&rJ(s)&&!ln[i[a-1]])||!ln[i[a]]?i[a]:ln[i[a]]}return n}(this.text,i)}trim(){let i=0;for(let r=0;r<this.text.length&&lD[this.text.charCodeAt(r)];r++)i++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=i&&lD[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(i,r),this.sectionIndex=this.sectionIndex.slice(i,r)}substring(i,r){let n=new lP;return n.text=this.text.substring(i,r),n.sectionIndex=this.sectionIndex.slice(i,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,r)=>Math.max(i,this.sections[r].scale),0)}addTextSection(i,r){this.text+=i.text,this.sections.push(lz.forText(i.scale,i.fontStack||r));let n=this.sections.length-1;for(let r=0;r<i.text.length;++r)this.sectionIndex.push(n)}addImageSection(i){let r=i.image?i.image.name:"";if(0===r.length)return void U("Can't add FormattedSection with an empty image.");let n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push(lz.forImage(r)),this.sectionIndex.push(this.sections.length-1)):U("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function lk(i,r,n,a,o,s,l,h,u,c,p,d,f,m,_,g){let y;let x=lP.fromFeature(i,o);d===lC.vertical&&x.verticalizePunctuation(f);let{processBidirectionalText:v,processStyledBidirectionalText:b}=nt;if(v&&1===x.sections.length){y=[];let i=v(x.toString(),lO(x,c,s,r,a,m,_));for(let r of i){let i=new lP;i.text=r,i.sections=x.sections;for(let n=0;n<r.length;n++)i.sectionIndex.push(0);y.push(i)}}else if(b){y=[];let i=b(x.text,x.sectionIndex,lO(x,c,s,r,a,m,_));for(let r of i){let i=new lP;i.text=r[0],i.sectionIndex=r[1],i.sections=x.sections,y.push(i)}}else y=function(i,r){let n=[],a=i.text,o=0;for(let a of r)n.push(i.substring(o,a)),o=a;return o<a.length&&n.push(i.substring(o,a.length)),n}
8(x,lO(x,c,s,r,a,m,_));let w=[],T={positionedLines:w,text:x.toString(),top:p[1],bottom:p[1],left:p[0],right:p[0],writingMode:d,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(i,r,n,a,o,s,l,h,u,c,p,d){let f=0,m=0,_=0,g="right"===h?1:"left"===h?0:.5,y=!1;for(let i of o){let n=i.getSections();for(let i of n){if(i.imageName)continue;let n=r[i.fontStack];if(n&&!(y=void 0!==n.ascender&&void 0!==n.descender))break}if(!y)break}let x=0;for(let l of o){l.trim();let o=l.getMaxScale(),h=(o-1)*24,v={positionedGlyphs:[],lineOffset:0};i.positionedLines[x]=v;let b=v.positionedGlyphs,w=0;if(!l.length()){m+=s,++x;continue}let T=0,E=0;for(let s=0;s<l.length();s++){let h=l.getSection(s),_=l.getSectionIndex(s),g=l.getCharCode(s),x=h.scale,v=null,S=null,I=null,A=24,M=0,C=!(u===lC.horizontal||!p&&!rK(g)||p&&(lD[g]||rT(g)||rE(g)||rS(g)||rZ(g)||rW(g)));if(h.imageName){let r=a[h.imageName];if(!r)continue;I=h.imageName,i.iconsInText=i.iconsInText||!0,S=r.paddedRect;let n=r.displaySize;x=24*x/d,v={width:n[0],height:n[1],left:1,top:-3,advance:C?n[1]:n[0],localGlyph:!1},M=y?-v.height*x:24*o-17-n[1]*x,A=v.advance;let s=(C?n[0]:n[1])*x-24*o;s>0&&s>w&&(w=s)}else{let i=n[h.fontStack];if(!i)continue;i[g]&&(S=i[g]);let a=r[h.fontStack];if(!a)continue;let s=a.glyphs[g];if(!s)continue;if(v=s.metrics,A=8203!==g?24:0,y){let i=void 0!==a.ascender?Math.abs(a.ascender):0,r=void 0!==a.descender?Math.abs(a.descender):0,n=(i+r)*x;T<n&&(T=n,E=(i-r)/2*x),M=-i*x}else M=(o-x)*24-17}C?(i.verticalizable=!0,b.push({glyph:g,imageName:I,x:f,y:m+M,vertical:C,scale:x,localGlyph:v.localGlyph,fontStack:h.fontStack,sectionIndex:_,metrics:v,rect:S}),f+=A*x+c):(b.push({glyph:g,imageName:I,x:f,y:m+M,vertical:C,scale:x,localGlyph:v.localGlyph,fontStack:h.fontStack,sectionIndex:_,metrics:v,rect:S}),f+=v.advance*x+c)}0!==b.length&&(_=Math.max(f-c,_),y?lV(b,g,w,E,s*o/2):lV(b,g,w,0,s/2)),f=0;let S=s*o+w;v.lineOffset=Math.max(w,h),m+=S,++x}let v=m,{horizontalAlign:b,verticalAlign:w}=lU(l);(function(i,r,n,a,o,s){let l=(r-n)*o,h=-s*a;for(let r of i)for(let i of r.positionedGlyphs)i.x+=l,i.y+=h})(i.positionedLines,g,b,w,_,v),i.top+=-w*v,i.bottom=i.top+v,i.left+=-b*_,i.right=i.left+_,i.hasBaseline=y}(T,r,n,a,y,l,h,u,d,c,f,g),!function(i){for(let r of i)if(0!==r.positionedGlyphs.length)return!1;return!0}(w)&&T}let lD={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},lL={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 lB(i,r,n,a,o,s){if(r.imageName){let i=a[r.imageName];return i?i.displaySize[0]*r.scale*24/s+o:0}{let a=n[r.fontStack],s=a&&a.glyphs[i];return s?s.metrics.advance*r.scale+o:0}}function lR(i,r,n,a){let o=Math.pow(i-r,2);return a?i<r?o/2:2*o:o+Math.abs(n)*n}
8function lF(i,r,n,a,o,s){let l=null,h=lR(r,n,o,s);for(let i of a){let a=lR(r-i.x,n,o,s)+i.badness;a<=h&&(l=i,h=a)}return{index:i,x:r,priorBreak:l,badness:h}}function lO(i,r,n,a,o,s,l){if("point"!==s||!i)return[];let h=[],u=function(i,r,n,a,o,s){let l=0;for(let n=0;n<i.length();n++){let h=i.getSection(n);l+=lB(i.getCharCode(n),h,a,o,r,s)}return l/Math.max(1,Math.ceil(l/n))}(i,r,n,a,o,l),c=i.text.indexOf("â")>=0,p=0;for(let n=0;n<i.length();n++){let s=i.getSection(n),d=i.getCharCode(n);if(lD[d]||(p+=lB(d,s,a,o,r,l)),n<i.length()-1){let r=!(d<11904||!(rD(d)||rk(d)||rq(d)||rG(d)||rF(d)||rI(d)||rL(d)||rC(d)||rO(d)||rU(d)||rR(d)||rH(d)||rz(d)||rM(d)||rA(d)||rB(d)||rP(d)||r$(d)||rj(d)||rV(d)));(lL[d]||r||s.imageName)&&h.push(lF(n+1,p,u,h,function(i,r,n){let a=0;return 10===i&&(a-=1e4),n&&(a+=150),40!==i&&65288!==i||(a+=50),41!==r&&65289!==r||(a+=50),a}(d,i.getCharCode(n+1),r&&c),!1))}}return function i(r){return r?i(r.priorBreak).concat(r.index):[]}(lF(i.length(),p,u,h,0,!0))}function lU(i){let r=.5,n=.5;switch(i){case"right":case"top-right":case"bottom-right":r=1;break;case"left":case"top-left":case"bottom-left":r=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:r,verticalAlign:n}}function lV(i,r,n,a,o){if(!(r||n||a||o))return;let s=i.length-1,l=i[s],h=(l.x+l.metrics.advance*l.scale)*r;for(let r=0;r<=s;r++)i[r].x-=h,i[r].y+=n+a+o}function lj(i,r,n,a,o,s){let l,h,u,c,p;let d=i.image;if(d.content){let i=d.content,r=d.pixelRatio||1;l=[i[0]/r,i[1]/r,d.displaySize[0]-i[2]/r,d.displaySize[1]-i[3]/r]}let f=r.left*s,m=r.right*s;"width"===n||"both"===n?(p=o[0]+f-a[3],u=o[0]+m+a[1]):u=(p=o[0]+(f+m-d.displaySize[0])/2)+d.displaySize[0];let _=r.top*s,g=r.bottom*s;return"height"===n||"both"===n?(h=o[1]+_-a[0],c=o[1]+g+a[2]):c=(h=o[1]+(_+g-d.displaySize[1])/2)+d.displaySize[1],{image:d,top:h,right:u,bottom:c,left:p,collisionPadding:l}}class lN extends f{constructor(i,r,n,a,o){super(i,r),this.angle=a,this.z=n,void 0!==o&&(this.segment=o)}clone(){return new lN(this.x,this.y,this.z,this.angle,this.segment)}}function lG(i,r,n,a,o){if(void 0===r.segment)return!0;let s=r,l=r.segment+1,h=0;for(;h>-n/2;){if(--l<0)return!1;h-=i[l].dist(s),s=i[l]}h+=i[l].dist(i[l+1]),l++;let u=[],c=0;for(;h<n/2;){let r=i[l],n=i[l+1];if(!n)return!1;let s=i[l-1].angleTo(r)-r.angleTo(n);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:h,angleDelta:s}),c+=s;h-u[0].distance>a;)c-=u.shift().angleDelta;if(c>o)return!1;l++,h+=r.dist(n)}return!0}function lZ(i){let r=0;for(let n=0;n<i.length-1;n++)r+=i[n].dist(i[n+1]);return r}function l$(i,r){return Math.max(i?i.right-i.left:0,r?r.right-r.left:0)}function lq(i,r,n,a,o){let s=[];for(let l=0;l<i.length;l++){let h;let u=i[l];for(let i=0;i<u.length-1;i++){let l=u[i],c=u[i+1];l.x<r&&c.x<r||(l.x<r?l=new f(r,l.y+(r-l.x)/(c.x-l.x)*(c.y-l.y))._round():c.x<r&&(c=new f(r,l.y+(r-l.x)/(c.x-l.x)*(c.y-l.y))._round()),l.y<n&&c.y<n||(l.y<n?l=new f(l.x+(n-l.y)/(c.y-l.y)*(c.x-l.x),n)._round():c.y<n&&(c=new f(l.x+(n-l.y)/(c.y-l.y)*(c.x-l.x),n)._round()),l.x>=a&&c.x>=a||(l.x>=a?l=new f(a,l.y+(a-l.x)/(c.x-l.x)*(c.y-l.y))._round():c.x>=a&&(c=new f(a,l.y+(a-l.x)/(c.x-l.x)*(c.y-l.y))._round()),l.y>=o&&c.y>=o||(l.y>=o?l=new f(l.x+(o-l.y)/(c.y-l.y)*(c.x-l.x),o)._round():c.y>=o&&(c=new f(l.x+(o-l.y)/(c.y-l.y)*(c.x-l.x),o)._round()),h&&l.equals(h[h.length-1])||(h=[l],s.push(h)),h.push(c)))))}}return s}function lX(i,r,n,a,o,s,l,h,u){for(let c=r;c<r+a;c++)lW(i,n*s+c,s,o,l,h,u);for(let c=n;c<n+o;c++)lW(i,c*s+r,1,a,l,h,u)}function lW(i,r,n,a,o,s,l){s[0]=0,l[0]=-1e20,l[1]=1e20,o[0]=i[r];for(let h=1,u=0,c=0;h<a;h++){o[h]=i[r+h*n];let a=h*h;do{let i=s[u];c=(o[h]-o[i]+a-i*i)/(h-i)/2}while(c<=l[u]&&--u>-1);s[++u]=h,l[u]=c,l[u+1]=1e20}for(let h=0,u=0;h<a;h++){for(;l[u+1]<h;)u++;let a=s[u],c=h-a;i[r+h*n]=o[a]+c*c}}rg(lN,"Anchor");let lH={none:0,ideographs:1,all:2};class lY{constructor(i,r,n){this.requestManager=i,this.localGlyphMode=r,this.localFontFamily=n,this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(i){this.url=i}getGlyphs(i,r){let n=[];for(let r in i)for(let a of i[r])n.push({stack:r,id:a});S(n,({stack:i,id:r},n)=>{let a=this.entries[i];a||(a=this.entries[i]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let o=a.glyphs[r];if(void 0!==o)return void n(null,{stack:i,id:r,glyph:o});if(o=this._tinySDF(a,i,r))return a.glyphs[r]=o,void n(null,{stack:i,id:r,glyph:o});let s=Math.floor(r/256);if(256*s>65535)return void n(Error("glyphs > 65535 not supported"));if(a.ranges[s])return void n(null,{stack:i,id:r,glyph:o});let l=a.requests[s];l||(l=a.requests[s]=[],lY.loadGlyphRange(i,s,this.url,this.requestManager,(i,r)=>{if(r){for(let i in a.ascender=r.ascender,a.descender=r.descender,r.glyphs)this._doesCharSupportLocalGlyph(+i)||(a.glyphs[+i]=r.glyphs[+i]);a.ranges[s]=!0}for(let n of l)n(i,r);delete a.requests[s]})),l.push((a,o)=>{a?n(a):o&&n(null,{stack:i,id:r,glyph:o.glyphs[r]||null})})},(i,n)=>{if(i)r(i);else if(n){let i={};for(let{stack:r,id:a,glyph:o}of n)void 0===i[r]&&(i[r]={}),void 0===i[r].glyphs&&(i[r].glyphs={}),i[r].glyphs[a]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics},i[r].ascender=this.entries[r].ascender,i[r].descender=this.entries[r].descender;r(null,i)}})}_doesCharSupportLocalGlyph(i){return this.localGlyphMode!==lH.none&&(this.localGlyphMode===lH.all?!!this.localFontFamily:!!this.localFontFamily&&
8(rU(i)||rN(i)||rz(i)||rP(i)||rC(i)))}_tinySDF(i,r,n){let a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(n))return;let o=i.tinySDF;if(!o){let n="400";/bold/i.test(r)?n="900":/medium/i.test(r)?n="500":/light/i.test(r)&&(n="200"),(o=i.tinySDF=new lY.TinySDF({fontFamily:a,fontWeight:n,fontSize:48,buffer:6,radius:16})).fontWeight=n}if(this.localGlyphs[o.fontWeight][n])return this.localGlyphs[o.fontWeight][n];let s=String.fromCharCode(n),{data:l,width:h,height:u,glyphWidth:c,glyphHeight:p,glyphLeft:d,glyphTop:f,glyphAdvance:m}=o.draw(s);return this.localGlyphs[o.fontWeight][n]={id:n,bitmap:new oG({width:h,height:u},l),metrics:{width:c/2,height:p/2,left:d/2,top:f/2-27,advance:m/2,localGlyph:!0}}}}function lK(i,r,n,a){let o=[],s=i.image,l=s.pixelRatio,h=s.paddedRect.w-2,u=s.paddedRect.h-2,c=i.right-i.left,p=i.bottom-i.top,d=s.stretchX||[[0,h]],m=s.stretchY||[[0,u]],_=(i,r)=>i+r[1]-r[0],g=d.reduce(_,0),y=m.reduce(_,0),x=h-g,v=u-y,b=0,w=g,T=0,E=y,S=0,I=x,A=0,M=v;if(s.content&&a){let i=s.content;b=lJ(d,0,i[0]),T=lJ(m,0,i[1]),w=lJ(d,i[0],i[2]),E=lJ(m,i[1],i[3]),S=i[0]-b,A=i[1]-T,I=i[2]-i[0]-w,M=i[3]-i[1]-E}let C=(a,o,h,u)=>{var d,m,_,x,v,C,z,P,k,D,L,B;let R=(a.stretch-b)/w*c+i.left,F=(_=a.fixed-S,_-I*a.stretch/g),O=(o.stretch-T)/E*p+i.top,U=(C=o.fixed-A,C-M*o.stretch/y),V=(h.stretch-b)/w*c+i.left,j=(k=h.fixed-S,k-I*h.stretch/g),N=(u.stretch-T)/E*p+i.top,G=(B=u.fixed-A,B-M*u.stretch/y),Z=new f(R,O),$=new f(V,O),q=new f(V,N),X=new f(R,N),W=new f(F/l,U/l),H=new f(j/l,G/l),Y=r*Math.PI/180;if(Y){let i=Math.sin(Y),r=Math.cos(Y),n=[r,-i,i,r];Z._matMult(n),$._matMult(n),X._matMult(n),q._matMult(n)}let K=a.stretch+a.fixed,J=o.stretch+o.fixed;return{tl:Z,tr:$,bl:X,br:q,tex:{x:s.paddedRect.x+1+K,y:s.paddedRect.y+1+J,w:h.stretch+h.fixed-K,h:u.stretch+u.fixed-J},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:W,pixelOffsetBR:H,minFontScaleX:I/l/c,minFontScaleY:M/l/p,isSDF:n}};if(a&&(s.stretchX||s.stretchY)){let i=lQ(d,x,g),r=lQ(m,v,y);for(let n=0;n<i.length-1;n++){let a=i[n],s=i[n+1];for(let i=0;i<r.length-1;i++)o.push(C(a,r[i],s,r[i+1]))}}else o.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:h+1},{fixed:0,stretch:u+1}));return o}function lJ(i,r,n){let a=0;for(let o of i)a+=Math.max(r,Math.min(n,o[1]))-Math.max(r,Math.min(n,o[0]));return a}function lQ(i,r,n){let a=[{fixed:-1,stretch:0}];for(let[r,n]of i){let i=a[a.length-1];a.push({fixed:r-i.stretch,stretch:i.stretch}),a.push({fixed:r-i.stretch,stretch:i.stretch+(n-r)})}return a.push({fixed:r+1,stretch:n}),a}lY.loadGlyphRange=function(i,r,n,a,o){let s=256*r,l=a.transformRequest(a.normalizeGlyphsURL(n).replace("{fontstack}",i).replace("{range}",`${s}-${s+255}`),eC.Glyphs);eD(l,(i,r)=>{if(i)o(i);else if(r){let i={},n=new ls(r).readFields(lT,{});for(let r of n.glyphs)i[r.id]=r;o(null,{glyphs:i,ascender:n.ascender,descender:n.descender})}})},lY.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:n=8,cutoff:a=.25,fontFamily:o="sans-serif",fontWeight:s="normal",fontStyle:l="normal"}={}){this.buffer=r,this.cutoff=a,this.radius=n;let h=this.size=i+4*r,u=this._createCanvas(h),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${l} ${s} ${i}px ${o}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(h*h),this.gridInner=new Float64Array(h*h),this.f=new Float64Array(h),this.z=new Float64Array(h+1),this.v=new Uint16Array(h)}_createCanvas(i){let r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){let{width:r,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:o,actualBoundingBoxRight:s}=this.ctx.measureText(i),l=Math.ceil(n),h=Math.min(this.size-this.buffer,Math.ceil(s-o)),u=Math.min(this.size-this.buffer,l+Math.ceil(a)),c=h+2*this.buffer,p=u+2*this.buffer,d=Math.max(c*p,0),f=new Uint8ClampedArray(d),m={data:f,width:c,height:p,glyphWidth:h,glyphHeight:u,glyphTop:l,glyphLeft:0,glyphAdvance:r};if(0===h||0===u)return m;let{ctx:_,buffer:g,gridInner:y,gridOuter:x}=this;_.clearRect(g,g,h,u),_.fillText(i,g,g+l);let v=_.getImageData(g,g,h,u);x.fill(1e20,0,d),y.fill(0,0,d);for(let i=0;i<u;i++)for(let r=0;r<h;r++){let n=v.data[4*(i*h+r)+3]/255;if(0===n)continue;let a=(i+g)*c+r+g;if(1===n)x[a]=0,y[a]=1e20;else{let i=.5-n;x[a]=i>0?i*i:0,y[a]=i<0?i*i:0}}lX(x,0,0,c,p,c,this.f,this.v,this.z),lX(y,g,g,h,u,c,this.f,this.v,this.z);for(let i=0;i<d;i++){let r=Math.sqrt(x[i])-Math.sqrt(y[i]);f[i]=Math.round(255-255*(r/this.radius+this.cutoff))}return m}};
8class l0{constructor(i=[],r=l1){if(this.data=i,this.length=this.data.length,this.compare=r,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;let i=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:r,compare:n}=this,a=r[i];for(;i>0;){let o=i-1>>1,s=r[o];if(n(a,s)>=0)break;r[i]=s,i=o}r[i]=a}_down(i){let{data:r,compare:n}=this,a=this.length>>1,o=r[i];for(;i<a;){let a=1+(i<<1),s=r[a],l=a+1;if(l<this.length&&0>n(r[l],s)&&(a=l,s=r[l]),n(s,o)>=0)break;r[i]=s,i=a}r[i]=o}}function l1(i,r){return i<r?-1:i>r?1:0}function l2(i,r){return r.max-i.max}function l3(i,r,n,a){this.p=new f(i,r),this.h=n,this.d=function(i,r){let n=!1,a=1/0;for(let o=0;o<r.length;o++){let s=r[o];for(let r=0,o=s.length,l=o-1;r<o;l=r++){let o=s[r],h=s[l];o.y>i.y!=h.y>i.y&&i.x<(h.x-o.x)*(i.y-o.y)/(h.y-o.y)+o.x&&(n=!n),a=Math.min(a,aQ(i,o,h))}}return(n?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}let l5=Number.POSITIVE_INFINITY,l4=Math.sqrt(2);function l6(i,r){return r[1]!==l5?function(i,r,n){let a=0,o=0;switch(r=Math.abs(r),n=Math.abs(n),i){case"top-right":case"top-left":case"top":o=n-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-n}switch(i){case"top-right":case"bottom-right":case"right":a=-r;break;case"top-left":case"bottom-left":case"left":a=r}return[a,o]}(i,r[0],r[1]):function(i,r){let n=0,a=0;r<0&&(r=0);let o=r/l4;switch(i){case"top-right":case"top-left":a=o-7;break;case"bottom-right":case"bottom-left":a=7-o;break;case"bottom":a=7-r;break;case"top":a=r-7}switch(i){case"top-right":case"bottom-right":n=-o;break;case"top-left":case"bottom-left":n=o;break;case"left":n=r;break;case"right":n=-r}return[n,a]}(i,r[0])}function l8(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function l9(i,r,n,a,o,s,l,h,u,c,p,d,m,_,g,y,x){let v=function(i,r,n,a,o,s,l,h){let u=[];if(0===r.positionedLines.length)return u;let c=a.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,p=function(i){let r=i[0],n=i[1],a=r*n;return a>0?[r,-n]:a<0?[-r,n]:0===r?[n,r]:[n,-r]}(n),d=Math.abs(r.top-r.bottom);for(let i of r.positionedLines)d-=i.lineOffset;let m=r.positionedLines.length,_=d/m,g=r.top-n[1];for(let i=0;i<m;++i){let a=r.positionedLines[i];for(let s of(g=function(i,r,n,a){let o=r+i.positionedLines[a].lineOffset;return 0===a?n+o/2:n+(o+(r+i.positionedLines[a-1].lineOffset))/2}(r,_,g,i),a.positionedGlyphs)){let i,a,d,m;if(!s.rect)continue;let _=s.rect||{},y=4,x=!0,v=1,b=0;if(s.imageName){let i=l[s.imageName];if(!i)continue;if(i.sdf){U("SDF images are not supported in formatted text and will be ignored.");continue}x=!1,y=1/(v=i.pixelRatio)}let w=(o||h)&&s.vertical,T=s.metrics.advance*s.scale/2,E=s.metrics,S=s.rect;if(null===S)continue;h&&r.verticalizable&&(b=s.imageName?T-s.metrics.width*s.scale/2:0);let I=o?[s.x+T,s.y]:[0,0],A=[0,0],M=[0,0],C=!1;o||(w?(M=[s.x+T+p[0],s.y+p[1]-b],C=!0):A=[s.x+T+n[0],s.y+n[1]-b]);let z=S.w*s.scale/(v*(s.localGlyph?2:1)),P=S.h*s.scale/(v*(s.localGlyph?2:1));if(w){let r=s.y-g,n=new f(-T,T-r),o=-Math.PI/2,l=new f(...M);(i=new f(-T+A[0],A[1]))._rotateAround(o,n)._add(l),i.x+=-r+T,i.y-=(E.left-y)*s.scale;let h=s.imageName?E.advance*s.scale:24*s.scale,u=String.fromCharCode(s.glyph);"︶"===u||"ï¹"===u||"︸"===u||"ï¹"===u||"ï¹"===u||"︾"===u||"︼"===u||"︺"===u||"ï¸"===u||"ï¹"===u||"ï¸"===u||"ï¸"===u||"ï¸"===u||"ï½"===u||"ï¿£"===u||"ï¸"===u||"ï¸"===u?i.x+=(1-y)*s.scale:"︵"===u||"ï¹"===u||"︷"===u||"ï¹"===u||"ï¹"===u||"︽"===u||"︻"===u||"︹"===u||"ï¸"===u||"︿"===u?i.x+=h-E.height*s.scale+(-y-1)*s.scale:i.x+=s.imageName||E.width+2*y===S.w&&E.height+2*y===S.h?(h-P)/2:(h-(E.height+2*y)*s.scale)/2,a=new f(i.x,i.y-z),d=new f(i.x+P,i.y),m=new f(i.x+P,i.y-z)}else{let r=(E.left-y)*s.scale-T+A[0],n=(-E.top-y)*s.scale+A[1],o=r+z,l=n+P;i=new f(r,n),a=new f(o,n),d=new f(r,l),m=new f(o,l)}if(c){let r;r=o?new f(0,0):C?new f(p[0],p[1]):new f(n[0],n[1]),i._rotateAroun
8d(c,r),a._rotateAround(c,r),d._rotateAround(c,r),m._rotateAround(c,r)}let k=new f(0,0),D=new f(0,0);u.push({tl:i,tr:a,bl:d,br:m,tex:_,writingMode:r.writingMode,glyphOffset:I,sectionIndex:s.sectionIndex,isSDF:x,pixelOffsetTL:k,pixelOffsetBR:D,minFontScaleX:0,minFontScaleY:0})}}return u}(0,a,u,s,l,h,o,i.allowVerticalPlacement),b=i.textSizeData,w=null;for(let a of("source"===b.kind?(w=[128*s.layout.get("text-size").evaluate(h,{},x)])[0]>32640&&U(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===b.kind&&((w=[128*g.compositeTextSizes[0].evaluate(h,{},x),128*g.compositeTextSizes[1].evaluate(h,{},x)])[0]>32640||w[1]>32640)&&U(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),i.addSymbols(i.text,v,w,u,l,h,p,r,n,c.lineStartIndex,c.lineLength,_,y,x),d))m[a]=i.text.placedSymbolArray.length-1;return 4*v.length}function l7(i){for(let r in i)return i[r];return null}function he(i,r,n,a,o,s,l,h,u,c){let p=l.top,d=l.bottom,m=l.left,g=l.right,y=l.collisionPadding;if(y&&(m-=y[0],p-=y[1],g+=y[2],d+=y[3]),u){let i=new f(m,p),r=new f(g,p),n=new f(m,d),a=new f(g,d),o=u*_,s=new f(0,0);c&&(s=new f(c[0],c[1])),i._rotateAround(o,s),r._rotateAround(o,s),n._rotateAround(o,s),a._rotateAround(o,s),m=Math.min(i.x,r.x,n.x,a.x),g=Math.max(i.x,r.x,n.x,a.x),p=Math.min(i.y,r.y,n.y,a.y),d=Math.max(i.y,r.y,n.y,a.y)}return i.emplaceBack(r.x,r.y,r.z,n.x,n.y,m,p,g,d,h,a,o,s),i.length-1}function ht(i){i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);let r=i.bottom-i.top;return r>0?Math.max(10,r):null}let hi=nb([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:hr}=hi,hn=nb([{name:"a_pos_3",components:3,type:"Int16"}]);var ha=nb([{name:"a_pos",type:"Int16",components:2}]);let ho=8192/Math.PI/2,hs=2*(1/aB(0))*ho*Math.PI,hl=[64,32,16],hh=-ho,hu=[new oB([hh,hh,hh],[ho,ho,ho]),new oB([hh,hh,hh],[0,0,ho]),new oB([0,hh,hh],[ho,0,ho]),new oB([hh,0,hh],[0,ho,ho]),new oB([0,0,hh],[ho,ho,ho])];function hc(i,r,n,a=!0){let o=ox([],i._camera.position,i.worldSize),s=[r,n,1,1];oA(s,s,i.pixelMatrixInverse),oI(s,s,1/s[3]);let l=ob([],om([],s,o)),h=i.globeMatrix,u=[h[12],h[13],h[14]],c=om([],u,o),p=op(c),d=ob([],c),f=i.worldSize/(2*Math.PI),m=ow(d,l),_=Math.asin(f/p);if(_<Math.acos(m)){if(!a)return null;let i=[],r=[];ox(i,l,p/m),ob(r,om(r,i,c)),ob(l,of(l,c,ox(l,r,Math.tan(_)*p)))}let y=[];new ok(o,l).closestPointOnSphere(u,f,y);let x=ob([],q(h,0)),v=ob([],q(h,1)),b=ob([],q(h,2)),T=ow(x,y),E=ow(v,y),S=ow(b,y),I=Math.asin(-E/f)*g,A=Math.atan2(T,S)*g;A=i.center.lng+function(i,r){let n=(r-i+180)%360-180;return n<-180?n+360:n}(i.center.lng,A);let M=aR(A),C=w(aF(I),0,1);return new aj(M,C)}class hp{constructor(i,r,n){this.a=om([],i,n),this.b=om([],r,n),this.center=n;let a=ob([],this.a),o=ob([],this.b);this.angle=Math.acos(ow(a,o))}}function hd(i,r){let n;return 0===i.angle?null:(n=0===i.a[r]?1/i.angle*.5*Math.PI:1/i.angle*Math.atan(i.b[r]/i.a[r]/Math.sin(i.angle)-1/Math.tan(i.angle)))<0||n>1?null:function(i,r,n,a){let o=Math.sin(n);return i*(Math.sin((1-a)*n)/o)+r*(Math.sin(a*n)/o)}(i.a[r],i.b[r],i.angle,w(n,0,1))+i.center[r]}function hf(i){if(i.z<=1)return hu[i.z+2*i.y+i.x];let r=hy(hg(i));return oB.fromPoints(r)}function hm(i,r){let n=hA(r.zoom);if(0===n)return hf(i);let a=hg(i),o=hy(a),s=aR(a.getWest())*r.worldSize,l=aR(a.getEast())*r.worldSize,h=aF(a.getNorth())*r.worldSize,u=aF(a.getSouth())*r.worldSize,c=[s,h,0],p=[l,h,0],d=[s,u,0],f=[l,u,0],m=oi([],r.globeMatrix);return oE(c,c,m),oE(p,p,m),oE(d,d,m),oE(f,f,m),o[0]=tZ(o[0],d,n),o[1]=tZ(o[1],f,n),o[2]=tZ(o[2],p,n),o[3]=tZ(o[3],c,n),oB.fromPoints(o)}function h_(i,r,n,a,o){for(let s of n)oE(s,s,a),ox(s,s,o),og(i,i,s),oy(r,r,s)}function hg({x:i,y:r,z:n}
8){let a=1/(1<<n),o=new aD(aO(i*a),aU((r+1)*a)),s=new aD(aO((i+1)*a),aU(r*a));return new ak(o,s)}function hy(i){let r=i.getNorth()*_,n=i.getSouth()*_,a=Math.cos(r),o=Math.cos(n),s=Math.sin(r),l=Math.sin(n),h=i.getWest(),u=i.getEast();return[hx(o,l,h),hx(o,l,u),hx(a,s,u),hx(a,s,h)]}function hx(i,r,n,a=ho){return[i*Math.sin(n*=_)*a,-r*a,i*Math.cos(n)*a]}function hv(i,r,n){return hx(Math.cos(i*_),Math.sin(i*_),r,n)}function hb(i,r,n,a){let o=1<<n.z,s=(i/8192+n.x)/o;return hv(aU((r/8192+n.y)/o),aO(s),a)}function hw({min:i,max:r}){return 16383/Math.max(r[0]-i[0],r[1]-i[1],r[2]-i[2])}let hT=new Float64Array(16);function hE(i){var r,n;let a=hw(i),o=ol(hT,[a,a,a]);return on(o,o,((r=[])[0]=-(n=i.min)[0],r[1]=-n[1],r[2]=-n[2],r))}function hS(i){var r,n;let a=(n=i.min,(r=hT)[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=n[0],r[13]=n[1],r[14]=n[2],r[15]=1,r),o=1/hw(i);return oa(a,a,[o,o,o])}function hI(i,r,n,a,o){let s=function(i){let r=8192/(2*Math.PI);return i/(2*Math.PI)/r}(n),l=[i,r,-n/(2*Math.PI)],h=ot(new Float64Array(16));return on(h,h,l),oa(h,h,[s,s,s]),oo(h,h,-o*_),os(h,h,-a*_),h}function hA(i){return T(5,6,i)}function hM(i,r){var n,a,o,s,l,h,u,c;let p=hv(r.lat,r.lng);return a=(n=om([],function(i){let r=hv(i._center.lat,i._center.lng),n=oT([],od(0,1,0),r),a=oh([],-i.angle,r);n=oE(n,n,a),oh(a,-i._pitch,n);let o=ob([],r);return ox(o,o,i.cameraToCenterDistance/i.pixelsPerMeter*hs),oE(o,o,a),of([],r,o)}(i),p))[0],o=n[1],s=n[2],Math.acos(Math.min(Math.max((c=Math.sqrt(a*a+o*o+s*s)*Math.sqrt((l=p[0])*l+(h=p[1])*h+(u=p[2])*u))&&ow(n,p)/c,-1),1))}let hC=85*_,hz=Math.cos(hC),hP=Math.sin(hC);function hk(i,r){let n=i.fovAboveCenter,a=i.elevation?i.elevation.getMinElevationBelowMSL()*r:0,o=(i._camera.position[2]*i.worldSize-a)/Math.cos(i._pitch),s=Math.sin(n)*o/Math.sin(Math.max(Math.PI/2-i._pitch-n,.01)),l=Math.sin(i._pitch)*s+o;return Math.min(1.01*l,o*(1/i._horizonShift))}function hD(i,r){if(!r.isReprojectedInTileSpace)return{scale:1<<i.z,x:i.x,y:i.y,x2:i.x+1,y2:i.y+1,projection:r};let n=Math.pow(2,-i.z),a=i.x*n,o=(i.x+1)*n,s=i.y*n,l=(i.y+1)*n,h=aO(a),u=aO(o),c=aU(s),p=aU(l),d=r.project(h,c),f=r.project(u,c),m=r.project(u,p),_=r.project(h,p),g=Math.min(d.x,f.x,m.x,_.x),y=Math.min(d.y,f.y,m.y,_.y),x=Math.max(d.x,f.x,m.x,_.x),v=Math.max(d.y,f.y,m.y,_.y),b=n/16;function w(i,n,a,o,s,l){let h=(a+s)/2,u=(o+l)/2,c=r.project(aO(h),aU(u)),p=Math.max(0,g-c.x,y-c.y,c.x-x,c.y-v);g=Math.min(g,c.x),x=Math.max(x,c.x),y=Math.min(y,c.y),v=Math.max(v,c.y),p>b&&(w(i,c,a,o,h,u),w(c,n,h,u,s,l))}w(d,f,a,s,o,s),w(f,m,o,s,o,l),w(m,_,o,l,a,l),w(_,d,a,l,a,s),g-=b,y-=b,x+=b,v+=b;let T=1/Math.max(x-g,v-y);return{scale:T,x:g*T,y:y*T,x2:x*T,y2:v*T,projection:r}}let hL=ot(new Float32Array(16));class hB{constructor(i){this.spec=i,this.name=i.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(i,r){return{x:0,y:0,z:0}}unproject(i,r){return new aD(0,0)}projectTilePoint(i,r,n){return{x:i,y:r,z:0}}locationPoint(i,r,n=!0){return i._coordinatePoint(i.locationCoordinate(r),n)}pixelsPerMeter(i,r){return 1/aB(i)*r}pixelSpaceConversion(i,r,n){return 1}farthestPixelDistance(i){return hk(i,i.pixelsPerMeter)}pointCoordinate(i,r,n,a){let o=i.horizonLineFromTop(!1),s=new f(r,Math.max(o,n));return i.rayIntersectionCoordinate(i.pointRayIntersection(s,a))}pointCoordinate3D(i,r,n){let a=new f(r,n);if(i.elevation)return i.elevation.pointCoordinate(a);{let r=this.pointCoordinate(i,a.x,a.y,0);return[r.x,r.y,r.z]}}isPointAboveHorizon(i,r){if(i.elevation)return!this.pointCoordinate3D(i,r.x,r.y);let n=i.horizonLineFromTop();return r.y<n}createInversionMatrix(i,r){return hL}createTileMatrix(i,r,n){let a,o,s;let l=n.canonical,h=ot(new Float64Array(16));if(this.isReprojectedInTileSpace){let u=hD(l,this);a=1,o=u.x+n.wrap*u.scale,s=u.y,oa(h,h,[a/u.scale,a/u.scale,i.pixelsPerMeter/r])}else a=r/i.zoomScale(l.z),o=(l.x+Math.pow(2,l.z)*n.wrap)*a,s=l.y*a;return on(h,h,[o,s,0]),oa(h,h,[a/8192,a/8192,1]),h}upVector(i,r,n){return[0,0,1]}upVectorScale(i,r,n){return{metersToTile:1}}}class hR extends hB{constructor(i){super(i),this.range=[4,7],this.center=i.center||[-96,37.5];let[r,n]=this.parallels=i.parallels||[29.5,45.5],a=Math.sin(r*_);this.n=(a+Math.sin(n*_))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(i,r){let{n:n,c:a,r0:o}=this,s=(i-this.center[0])*_,l=Math.sqrt(a-2*n*Math.sin(r*_))/n;return{x:l*Math.sin(s*n),y:l*Math.cos(s*n)-o,z:0}}unproject(i,r){let{n:n,c:a,r0:o}=this,s=o+r,l=Math.atan2(i,Math.abs(s))*Math.sign(s);s*n<0&&(l-=Math.PI*Math.sign(i)*Math.sign(s));let h=this.center[0]*_*n;l=E(l,-Math.PI-h,Math.PI-h);let u=l/n*g+this.center[0],c=Math.asin(w((a-(i*i+s*s)*n*n)/(2*n),-1,1)),p=w(c*g,-85.051129,85.051129);return new aD(u,p)}}let hF=Math.sqrt(3)/2;class hO extends hB{project(i,r){r=r/180*Math.PI,i=i/180*Math.PI;let n=Math.asin(hF*Math.sin(r)),a=n*n,o=a*a*a;return{x:.5*(i*Math.cos(n)/(hF*(1.340264+-.24331799999999998*a+o*(.0062510000000000005+.034164*a)))/M
8ath.PI+.5),y:1-.5*(n*(1.340264+-.081106*a+o*(893e-6+.003796*a))/Math.PI+1),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,a=n*n,o=a*a*a;for(let i,s,l=0;l<12&&(s=n*(1.340264+-.081106*a+o*(893e-6+.003796*a))-r,o=(a=(n=w(n-(i=s/(1.340264+-.24331799999999998*a+o*(.0062510000000000005+.034164*a))),-Math.PI/3,Math.PI/3))*n)*a*a,!(1e-12>Math.abs(i)));++l);let s=hF*i*(1.340264+-.24331799999999998*a+o*(.0062510000000000005+.034164*a))/Math.cos(n),l=Math.asin(Math.sin(n)/hF),h=w(180*s/Math.PI,-180,180),u=w(180*l/Math.PI,-85.051129,85.051129);return new aD(h,u)}}class hU extends hB{constructor(i){super(i),this.wrap=!0,this.supportsWorldCopies=!0}project(i,r){return{x:.5+i/360,y:.5-r/360,z:0}}unproject(i,r){let n=w(360*(.5-r),-85.051129,85.051129);return new aD(360*(i-.5),n)}}let hV=Math.PI/2;function hj(i){return Math.tan((hV+i)/2)}class hN extends hB{constructor(i){super(i),this.center=i.center||[0,30];let[r,n]=this.parallels=i.parallels||[30,30],a=r*_,o=n*_,s=Math.cos(a);this.n=a===o?Math.sin(a):Math.log(s/Math.cos(o))/Math.log(hj(o)/hj(a)),this.f=s*Math.pow(hj(a),this.n)/this.n}project(i,r){r*=_,i=(i-this.center[0])*_;let{n:n,f:a}=this;a>0?r<-hV+1e-6&&(r=-hV+1e-6):r>hV-1e-6&&(r=hV-1e-6);let o=a/Math.pow(hj(r),n),s=o*Math.sin(n*i),l=a-o*Math.cos(n*i);return{x:.5*(s/Math.PI+.5),y:1-.5*(l/Math.PI+.5),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI,r=(2*(1-r)-.5)*Math.PI;let{n:n,f:a}=this,o=a-r,s=Math.sign(o),l=Math.sign(n)*Math.sqrt(i*i+o*o),h=Math.atan2(i,Math.abs(o))*s;o*n<0&&(h-=Math.PI*Math.sign(i)*s);let u=w(h/n*g+this.center[0],-180,180),c=w((2*Math.atan(Math.pow(a/l,1/n))-hV)*g,-85.051129,85.051129);return new aD(u,c)}}class hG extends hB{constructor(i){super(i),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(i,r){return{x:aR(i),y:aF(r),z:0}}unproject(i,r){let n=aO(i),a=aU(r);return new aD(n,a)}}let hZ=85.051129*_;class h$ extends hB{project(i,r){let n=(r*=_)*r,a=n*n;return{x:.5*((i*=_)*(.8707-.131979*n+a*(a*(.003971*n-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(r*(1.007226+n*(.015085+a*(.028874*n-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,a=25,o=0,s=n*n;do{s=n*n;let i=s*s;o=(n*(1.007226+s*(.015085+i*(.028874*s-.044475-.005916*i)))-r)/(1.007226+s*(.045255+i*(.259866*s-.311325-.005916*11*i))),n=w(n-o,-hZ,hZ)}while(Math.abs(o)>1e-6&&--a>0);s=n*n;let l=w(i/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))*g,-180,180),h=n*g;return new aD(l,h)}}let hq=85.051129*_;class hX extends hB{project(i,r){r*=_,i*=_;let n=Math.cos(r),a=2/Math.PI,o=Math.acos(n*Math.cos(i/2)),s=Math.sin(o)/o,l=.5*(i*a+2*n*Math.sin(i/2)/s)||0,h=.5*(r+Math.sin(r)/s)||0;return{x:.5*(l/Math.PI+.5),y:1-.5*(h/Math.PI+1),z:0}}unproject(i,r){let n=i=(2*i-.5)*Math.PI,a=r=(2*(1-r)-1)*Math.PI,o=25,s=0,l=0;do{let o=Math.cos(a),h=Math.sin(a),u=2*h*o,c=h*h,p=o*o,d=Math.cos(n/2),f=Math.sin(n/2),m=2*d*f,_=f*f,g=1-p*d*d,y=g?1/g:0,x=g?Math.acos(o*d)*Math.sqrt(1/g):0,v=.5*(2*x*o*f+2*n/Math.PI)-i,b=.5*(x*h+a)-r,T=.5*y*(p*_+x*o*d*c)+1/Math.PI,E=y*(m*u/4-x*h*f),S=.125*y*(u*f-x*h*p*m),I=.5*y*(c*d+x*_*o)+.5,A=E*S-I*T;s=(b*E-v*I)/A,l=(v*S-b*T)/A,n=w(n-s,-Math.PI,Math.PI),a=w(a-l,-hq,hq)}while((Math.abs(s)>1e-6||Math.abs(l)>1e-6)&&--o>0);return new aD(n*g,a*g)}}class hW extends hB{constructor(i){super(i),this.center=i.center||[0,0],this.parallels=i.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(this.parallels[0]*_)),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(i,r){let{scale:n,cosPhi:a}=this;return{x:i*_*a*n+.5,y:-Math.sin(r*_)/a*n+.5,z:0}}unproject(i,r){let{scale:n,cosPhi:a}=this,o=w((i-.5)/n*g/a,-180,180),s=Math.asin(w(-(r-.5)/n*a,-1,1)),l=w(s*g,-85.051129,85.051129);return new aD(o,l)}}class hH extends hG{constructor(i){super(i),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug","custom"],this.range=[3,5]}projectTilePoint(i,r,n){let a=hb(i,r,n);return oE(a,a,hE(hf(n))),{x:a[0],y:a[1],z:a[2]}}locationPoint(i,r){let n=hv(r.lat,r.lng),a=ob([],n),o=i.elevation?i.elevation.getAtPointOrZero(i.locationCoordinate(r),i._centerAltitude):i._centerAltitude;ov(n,n,a,1/aB(0)*8192*o);let s=ot(new Float64Array(16));return or(s,i.pixelMatrix,i.globeMatrix),oE(n,n,s),new f(n[0],n[1])}pixelsPerMeter(i,r){return 1/aB(0)*r}pixelSpaceConversion(i,r,n){let a=tG(1/aB(45)*r,1/aB(i)*r,n);return this.pixelsPerMeter(i,r)/a}createTileMatrix(i,r,n){let a=hS(hf(n.canonical));return or(new Float64Array(16),i.globeMatrix,a)}createInversionMatrix(i,r){let{center:n}=i,a=hE(hf(r));return os(a,a,n.lng*_),oo(a,a,n.lat*_),oa(a,a,[i._pixelsPerMercatorPixel,i._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(i,r,n,a){return hc(i,r,n,!0)||new aj(0,0)}pointCoordinate3D(i,r,n){let a=this.pointCoordinate(i,r,n,0);return[a.x,a.y,a.z]}isPointAboveHorizon(i,r){return!hc(i,r.x,r.y,!1)}farthestPixelDistance(i){let r=function(i,r){let n;let a=i.cameraToCenterDistance,o=i._centerAltitude*r,s=i._camera,l=i._camera.forward(),h=of([],ox([],l,-a),[0,0,o]),u=i.worldSize/(2*Math.PI),c=[0,0,-u],p=i.width/i.height,d=Math.tan(i.fovAboveCenter),f=ox([],s.up(),d),m=ox([],s.right(),d*p),_=ob([],of([],of([],l,f),m)),g=[];
8if(new ok(h,_).closestPointOnSphere(c,u,g)){let r=of([],g,c),a=om([],r,h);n=Math.cos(i.fovAboveCenter)*op(a)}else{let i=om([],h,c),r=om([],c,h);ob(r,r);let a=op(i)-u;n=Math.sqrt(a*(a+2*u));let o=Math.acos(n/(u+a))-Math.acos(ow(l,r));n*=Math.cos(o)}return 1.01*n}(i,this.pixelsPerMeter(i.center.lat,i.worldSize)),n=hA(i.zoom);if(n>0){let a=hk(i,1/aB(i.center.lat)*i.worldSize),o=i.worldSize/(2*Math.PI),s=Math.max(i.width,i.height)/i.worldSize*Math.PI;return tG(r,a+o*(1-Math.cos(s)),Math.pow(n,10))}return r}upVector(i,r,n){return hb(r,n,i,1)}upVectorScale(i){return{metersToTile:hs*hw(hf(i))}}}function hY(i){let r=i.parallels,n=!!r&&.01>Math.abs(r[0]+r[1]);switch(i.name){case"mercator":return new hG(i);case"equirectangular":return new hU(i);case"naturalEarth":return new h$(i);case"equalEarth":return new hO(i);case"winkelTripel":return new hX(i);case"albers":return n?new hW(i):new hR(i);case"lambertConformalConic":return n?new hW(i):new hN(i);case"globe":return new hH(i)}throw Error(`Invalid projection name: ${i.name}`)}let hK=sw.VectorTileFeature.types,hJ=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function hQ(i,r,n,a,o,s,l,h,u,c,p,d,f){let m=h?Math.min(32640,Math.round(h[0])):0,_=h?Math.min(32640,Math.round(h[1])):0;i.emplaceBack(r,n,Math.round(32*a),Math.round(32*o),s,l,(m<<1)+(u?1:0),_,16*c,16*p,256*d,256*f)}function h0(i,r,n,a,o,s,l){i.emplaceBack(r,n,a,o,s,l)}function h1(i,r,n,a,o){i.emplaceBack(r,n,a,o),i.emplaceBack(r,n,a,o),i.emplaceBack(r,n,a,o),i.emplaceBack(r,n,a,o)}class h2{constructor(i){this.layoutVertexArray=new nP,this.indexArray=new nU,this.programConfigurations=i,this.segments=new aP,this.dynamicLayoutVertexArray=new nA,this.opacityVertexArray=new nD,this.placedSymbolArray=new nQ,this.globeExtVertexArray=new nk}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(i,r,n,a){this.isEmpty()||(n&&(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,s3.members),this.indexBuffer=i.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=i.createVertexBuffer(this.dynamicLayoutVertexArray,s4.members,!0),this.opacityVertexBuffer=i.createVertexBuffer(this.opacityVertexArray,hJ,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,s5.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||a)&&this.programConfigurations.upload(i))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}rg(h2,"SymbolBuffers");class h3{constructor(i,r,n){this.layoutVertexArray=new i,this.layoutAttributes=r,this.indexArray=new n,this.segments=new aP,this.collisionVertexArray=new nF,this.collisionVertexArrayExt=new nO}upload(i){this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=i.createVertexBuffer(this.collisionVertexArray,s6.members,!0),this.collisionVertexBufferExt=i.createVertexBuffer(this.collisionVertexArrayExt,s8.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
8stroy())}}rg(h3,"CollisionBuffers");class h5{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ot([]),this.placementViewportMatrix=ot([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=le(this.zoom,r["text-size"]),this.iconSizeData=le(this.zoom,r["icon-size"]);let n=this.layers[0].layout,a=n.get("symbol-sort-key"),o=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&void 0!==a.constantOr(1),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(i=>lC[i]),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.sourceID=i.sourceID,this.projection=i.projection}createArrays(){this.text=new h2(new aw(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new h2(new aw(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new n2,this.lineVertexArray=new n3,this.symbolInstances=new n1}calculateGlyphDependencies(i,r,n,a,o){for(let n=0;n<i.length;n++)if(r[i.charCodeAt(n)]=!0,a&&o){let a=ln[i.charAt(n)];a&&(r[a.charCodeAt(0)]=!0)}}populate(i,r,n,a){let o=this.layers[0],s=o.layout,l="globe"===this.projection.name,h=s.get("text-font"),u=s.get("text-field"),c=s.get("icon-image"),p=("constant"!==u.value.kind||u.value.value instanceof to&&!u.value.value.isEmpty()||u.value.value.toString().length>0)&&("constant"!==h.value.kind||h.value.value.length>0),d="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,f=s.get("symbol-sort-key");if(this.features=[],!p&&!d)return;let m=r.iconDependencies,_=r.glyphDependencies,g=r.availableImages,y=new ni(this.zoom);for(let{feature:r,id:u,index:c,sourceLayerIndex:x}of i){let i,v;let b=o._featureFilter.needGeometry,w=a$(r,b);if(!o._featureFilter.filter(y,w,n))continue;if(b||(w.geometry=aZ(r,n,a)),l&&1!==r.type&&n.z<=5){let i=w.geometry;for(let r=0;r<i.length;r++)i[r]=function(i,r,n){let a=i[0];r(a);let o=[a];for(let s=1;s<i.length;s++){let l=i[s];r(l),function i(r,n,a,o,s){if(s(n,a)){let l=n.add(a).mult(.5);o(l),i(r,n,l,o,s),i(r,l,a,o,s)}else r.push(a)}(o,a,l,r,n),a=l}return o}(i[r],i=>i,(i,r)=>.98078528056>ow(hb(i.x,i.y,n,1),hb(r.x,r.y,n,1)))}if(p){let r=o.getValueAndResolveTokens("text-field",w,n,g),a=to.factory(r);(function(i){for(let r of i.sections)if(function(i){for(let r of i)if(rQ(r.charCodeAt(0)))return!0;return!1}(r.text))return!0;return!1})(a)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===r7()||this.hasRTLText&&nt.isParsed())&&(i=function(i,r,n){return i.sections.forEach(i=>{i.text=function(i,r,n){let a=r.layout.get("text-transform").evaluate(n,{});return"uppercase"===a?i=i.toLocaleUpperCase():"lowercase"===a&&(i=i.toLocaleLowerCase()),nt.applyArabicShaping&&(i=nt.applyArabicShaping(i)),i}(i.text,r,n)}),i}(a,o,w))}if(d){let i=o.getValueAndResolveTokens("icon-image",w,n,g);v=i instanceof ts?i:ts.fromString(i)}if(!i&&!v)continue;let T=this.sortFeaturesByKey?f.evaluate(w,{},n):void 0;if(this.features.push({id:u,text:i,icon:v,index:c,sourceLayerIndex:x,geometry:w.geometry,properties:r.properties,type:hK[r.type],sortKey:T}),v&&(m[v.name]=!0),i){let r=h.evaluate(w,{},n).join(","),a="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");for(let n of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(lC.vertical)>=0,i.sections))if(n.image)m[n.image.name]=!0;else{let o=rY(i.toString()),s=n.fontStack||r,l=_[s]=_[s]||{};this.calculateGlyphDependencies(n.text,l,a,this.allowVerticalPlacement,o)}}}"line"===s.get("symbol-placement")&&(this.features=function(i){let r={},n={},a=[],o=0;function s(r){a.push(i[r]),o++}function l(i,r,o){let s=n[i];return delete n[i],n[r]=s,a[s].geometry[0].pop(),a[s].geometry[0]=a[s].geometry[0].concat(o[0]),s}function h(i,n,o){let s=r[n];return delete r[n],r[i]=s,a[s].geometry[0].shift(),a[s].geometry[0]=o[0].concat(a[s].geometry[0]),s}function u(i,r,n){let a=n?r[0][r[0].length-1]:r[0][0];return`${i}:${a.x}:${a.y}`}for(let c=0;c<i.length;c++){let p=i[c],d=p.geometry,f=p.text?p.text.toString():null;if(!f){s(c);continue}let m=u(f,d),_=u(f,d,!0);if(m in n&&_ in r&&n[m]!==r[_]){let i=h(m,_,d),o=l(m,_,a[i].geometry);delete r[m],delete n[_],n[u(f,a[o].geometry,!0)]=o,a[i].geometry=null}else m in n?l(m,_,d):_ in r?h(m,_,d):(s(c),r[m]=o-1,n[_]=o-1)}return a.filter(i=>i.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((i,r)=>i.sortKey-r.sortKey)}update(i,r,n,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,r,this.layers,n,a),this.icon.programConfigurations.updatePaintArrays(i,r,this.layers,n,a))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=hY(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(i,r){let n=this.lineVertexArray.length,a=i.segment;if(void 0!==a){let n=i.dist(r[a+1]),o=i.dist(r[a]),s={};for(let i=a+1;i<r.length;i++)s[i]={x:r[i].x,y:r[i].y,tileUnitDistanceFromAnchor:n},i<r.length-1&&(n+=r[i+1].dist(r[i]));for(let i=a||0;i>=0;i--)s[i]={x:r[i].x,y:r[i].y,tileUnitDistanceFromAnchor:o},i>0&&(o+=r[i-1].dist(r[i]));for(let i=0;i<r.length;i++){let r=s[i];this.lineVertexArray.emplaceBack(r.x,r.y,r.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(i,r,n,a,o,s,l,h,u,c,p,d,f,m){let _=i.indexArray,g=i.layoutVertexArray,y=i.globeExtVertexArray,x=i.segments.prepareSegment(4*r.length,g,_,this.canOverlap?s.sortKey:void 0),v=this.glyphOffsetArray.length,b=x.vertexLength,w=this.allowVerticalPlacement&&l===lC.vertical?Math.PI/2:0,T=s.text&&s.text.sections;for(let a=0;a<r.length;a++){let{tl:o,tr:l,bl:c,br:p,tex:d,pixelOffsetTL:v,pixelOffsetBR:b,minFontScaleX:E,minFontScaleY:S,glyphOffset:I,isSDF:A,sectionIndex:M}=r[a],C=x.vertexLength,z=I[1];if(hQ(g,u.x,u.y,o.x,z+o.y,d.x,d.y,n,A,v.x,v.y,E,S),hQ(g,u.x,u.y,l.x,z+l.y,d.x+d.w,d.y,n,A,b.x,v.y,E,S),hQ(g,u.x,u.y,c.x,z+c.y,d.x,d.y+d.h,n,A,v.x,b.y,E,S),hQ(g,u.x,u.y,p.x,z+p.y,d.x+d.w,d.y+d.h,n,A,b.x,b.y,E,S),h){let r=h.anchor,
vendor: 7,266 bytes, line 8
8n=h.up;h0(y,r.x,r.y,r.z,n[0],n[1],n[2]),h0(y,r.x,r.y,r.z,n[0],n[1],n[2]),h0(y,r.x,r.y,r.z,n[0],n[1],n[2]),h0(y,r.x,r.y,r.z,n[0],n[1],n[2]),h1(i.dynamicLayoutVertexArray,r.x,r.y,r.z,w)}else h1(i.dynamicLayoutVertexArray,u.x,u.y,u.z,w);_.emplaceBack(C,C+1,C+2),_.emplaceBack(C+1,C+2,C+3),x.vertexLength+=4,x.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(I[0]),a!==r.length-1&&M===r[a+1].sectionIndex||i.programConfigurations.populatePaintArrays(g.length,s,s.index,{},f,m,T&&T[M])}let E=h?h.anchor:u;i.placedSymbolArray.emplaceBack(E.x,E.y,E.z,u.x,u.y,v,this.glyphOffsetArray.length-v,b,c,p,u.segment,n?n[0]:0,n?n[1]:0,a[0],a[1],l,0,!1,0,d,0)}_commitLayoutVertex(i,r,n,a,o,s,l){i.emplaceBack(r,n,a,o,s,Math.round(l.x),Math.round(l.y))}_addCollisionDebugVertices(i,r,n,a,o,s,l){let h=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),u=h.vertexLength,c=l.tileAnchorX,p=l.tileAnchorY;for(let i=0;i<4;i++)n.collisionVertexArray.emplaceBack(0,0,0,0);n.collisionVertexArrayExt.emplaceBack(r,-i.padding,-i.padding),n.collisionVertexArrayExt.emplaceBack(r,i.padding,-i.padding),n.collisionVertexArrayExt.emplaceBack(r,i.padding,i.padding),n.collisionVertexArrayExt.emplaceBack(r,-i.padding,i.padding),this._commitLayoutVertex(n.layoutVertexArray,a,o,s,c,p,new f(i.x1,i.y1)),this._commitLayoutVertex(n.layoutVertexArray,a,o,s,c,p,new f(i.x2,i.y1)),this._commitLayoutVertex(n.layoutVertexArray,a,o,s,c,p,new f(i.x2,i.y2)),this._commitLayoutVertex(n.layoutVertexArray,a,o,s,c,p,new f(i.x1,i.y2)),h.vertexLength+=4;let d=n.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),h.primitiveLength+=4}_addTextDebugCollisionBoxes(i,r,n,a,o,s){for(let l=a;l<o;l++){let a=n.get(l),o=this.getSymbolInstanceTextSize(i,s,r,l);this._addCollisionDebugVertices(a,o,this.textCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(i,r,n,a,o,s){for(let l=a;l<o;l++){let a=n.get(l),o=this.getSymbolInstanceIconSize(i,r,l);this._addCollisionDebugVertices(a,o,this.iconCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,s)}}generateCollisionDebugBuffers(i,r){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new h3(nB,s9.members,n$),this.iconCollisionBox=new h3(nB,s9.members,n$);let n=li(this.iconSizeData,i),a=li(this.textSizeData,i);for(let o=0;o<this.symbolInstances.length;o++){let s=this.symbolInstances.get(o);this._addTextDebugCollisionBoxes(a,i,r,s.textBoxStartIndex,s.textBoxEndIndex,s),this._addTextDebugCollisionBoxes(a,i,r,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,i,r,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,i,r,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s)}}getSymbolInstanceTextSize(i,r,n,a){let o=this.text.placedSymbolArray.get(r.rightJustifiedTextSymbolIndex>=0?r.rightJustifiedTextSymbolIndex:r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.leftJustifiedTextSymbolIndex>=0?r.leftJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex>=0?r.verticalPlacedTextSymbolIndex:a),s=lt(this.textSizeData,i,o)/24;return this.tilePixelRatio*s}getSymbolInstanceIconSize(i,r,n){let a=this.icon.placedSymbolArray.get(n),o=lt(this.iconSizeData,i,a);return this.tilePixelRatio*o}_commitDebugCollisionVertexUpdate(i,r,n){i.emplaceBack(r,-n,-n),i.emplaceBack(r,n,-n),i.emplaceBack(r,n,n),i.emplaceBack(r,-n,n)}_updateTextDebugCollisionBoxes(i,r,n,a,o,s){for(let l=a;l<o;l++){let a=n.get(l),o=this.getSymbolInstanceTextSize(i,s,r,l);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,o,a.padding)}}_updateIconDebugCollisionBoxes(i,r,n,a,o){for(let s=a;s<o;s++){let a=n.get(s),o=this.getSymbolInstanceIconSize(i,r,s);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,o,a.padding)}}updateCollisionDebugBuffers(i,r){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();let n=li(this.iconSizeData,i),a=li(this.textSizeData,i);for(let o=0;o<this.symbolInstances.length;o++){let s=this.symbolInstances.get(o);this._updateTextDebugCollisionBoxes(a,i,r,s.textBoxStartIndex,s.textBoxEndIndex,s),this._updateTextDebugCollisionBoxes(a,i,r,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._updateIconDebugCollisionBoxes(n,i,r,s.iconBoxStartIndex,s.iconBoxEndIndex),this._updateIconDebugCollisionBoxes(n,i,r,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(i,r,n,a,o,s,l,h,u){let c={};for(let a=r;a<n;a++){let r=i.get(a);c.textBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,padding:r.padding,projectedAnchorX:r.projectedAnchorX,projectedAnchorY:r.projectedAnchorY,projectedAnchorZ:r.projectedAnchorZ,tileAnchorX:r.tileAnchorX,tileAnchorY:r.tileAnchorY},c.textFeatureIndex=r.featureIndex;break}for(let r=a;r<o;r++){let n=i.get(r);c.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,padding:n.padding,projectedAnchorX:n.projectedAnchorX,projectedAnchorY:n.projectedAnchorY,projectedAnchorZ:n.projectedAnchorZ,tileAnchorX:n.tileAnchorX,tileAnchorY:n.tileAnchorY},c.verticalTextFeatureIndex=n.featureIndex;break}for(let r=s;r<l;r++){let n=i.get(r);c.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,padding:n.padding,projectedAnchorX:n.projectedAnchorX,projectedAnchorY:n.projectedAnchorY,projectedAnchorZ:n.projectedAnchorZ,tileAnchorX:n.tileAnchorX,tileAnchorY:n.tileAnchorY},c.iconFeatureIndex=n.featureIndex;break}for(let r=h;r<u;r++){let n=i.get(r);c.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,padding:n.padding,projectedAnchorX:n.projectedAnchorX,projectedAnchorY:n.projectedAnchorY,projectedAnchorZ:n.projectedAnchorZ,tileAnchorX:n.tileAnchorX,tileAnchorY:n.tileAnchorY},c.verticalIconFeatureIndex=n.featureIndex;break}return c}deserializeCollisionBoxes(i){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(i,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(i,r){let n=i.placedSymbolArray.get(r),a=n.vertexStartIndex+4*n.numGlyphs;for(let r=n.vertexStartIndex;r<a;r+=4)i.indexArray.emplaceBack(r,r+1,r+2),i.indexArray.emplaceBack(r+1,r+2,r+3)}
8getSortedSymbolIndexes(i){if(this.sortedAngle===i&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let r=Math.sin(i),n=Math.cos(i),a=[],o=[],s=[];for(let i=0;i<this.symbolInstances.length;++i){s.push(i);let l=this.symbolInstances.get(i);a.push(0|Math.round(r*l.tileAnchorX+n*l.tileAnchorY)),o.push(l.featureIndex)}return s.sort((i,r)=>a[i]-a[r]||o[r]-o[i]),s}addToSortKeyRanges(i,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(let r of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let i=this.symbolInstances.get(r);this.featureSortOrder.push(i.featureIndex),[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((i,r,n)=>{i>=0&&n.indexOf(i)===r&&this.addIndicesForPlacedSymbol(this.text,i)}),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}rg(h5,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),h5.MAX_GLYPHS=65535,h5.addDynamicAttributes=h1;let h4=new n_({"symbol-placement":new nc(eG.layout_symbol["symbol-placement"]),"symbol-spacing":new nc(eG.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new nc(eG.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new np(eG.layout_symbol["symbol-sort-key"]),"symbol-z-order":new nc(eG.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new nc(eG.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new nc(eG.layout_symbol["icon-ignore-placement"]),"icon-optional":new nc(eG.layout_symbol["icon-optional"]),"icon-rotation-alignment":new nc(eG.layout_symbol["icon-rotation-alignment"]),"icon-size":new np(eG.layout_symbol["icon-size"]),"icon-text-fit":new nc(eG.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new nc(eG.layout_symbol["icon-text-fit-padding"]),"icon-image":new np(eG.layout_symbol["icon-image"]),"icon-rotate":new np(eG.layout_symbol["icon-rotate"]),"icon-padding":new nc(eG.layout_symbol["icon-padding"]),"icon-keep-upright":new nc(eG.layout_symbol["icon-keep-upright"]),"icon-offset":new np(eG.layout_symbol["icon-offset"]),"icon-anchor":new np(eG.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new nc(eG.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new nc(eG.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new nc(eG.layout_symbol["text-rotation-alignment"]),"text-field":new np(eG.layout_symbol["text-field"]),"text-font":new np(eG.layout_symbol["text-font"]),"text-size":new np(eG.layout_symbol["text-size"]),"text-max-width":new np(eG.layout_symbol["text-max-width"]),"text-line-height":new np(eG.layout_symbol["text-line-height"]),"text-letter-spacing":new np(eG.layout_symbol["text-letter-spacing"]),"text-justify":new np(eG.layout_symbol["text-justify"]),"text-radial-offset":new np(eG.layout_symbol["text-radial-offset"]),"text-variable-anchor":new nc(eG.layout_symbol["text-variable-anchor"]),"text-anchor":new np(eG.layout_symbol["text-anchor"]),"text-max-angle":new nc(eG.layout_symbol["text-max-angle"]),"text-writing-mode":new nc(eG.layout_symbol["text-writing-mode"]),"text-rotate":new np(eG.layout_symbol["text-rotate"]),"text-padding":new nc(eG.layout_symbol["text-padding"]),"text-keep-upright":new nc(eG.layout_symbol["text-keep-upright"]),"text-transform":new np(eG.layout_symbol["text-transform"]),"text-offset":new np(eG.layout_symbol["text-offset"]),"text-allow-overlap":new nc(eG.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new nc(eG.layout_symbol["text-ignore-placement"]),"text-optional":new nc(eG.layout_symbol["text-optional"])});var h6={paint:new n_({"icon-opacity":new np(eG.paint_symbol["icon-opacity"]),"icon-color":new np(eG.paint_symbol["icon-color"]),"icon-halo-color":new np(eG.paint_symbol["icon-halo-color"]),"icon-halo-width":new np(eG.paint_symbol["icon-halo-width"]),"icon-halo-blur":new np(eG.paint_symbol["icon-halo-blur"]),"icon-translate":new nc(eG.paint_symbol["icon-translate"]),"icon-translate-anchor":new nc(eG.paint_symbol["icon-translate-anchor"]),"text-opacity":new np(eG.paint_symbol["text-opacity"]),"text-color":new np(eG.paint_symbol["text-color"],{runtimeType:eQ,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new np(eG.paint_symbol["text-halo-color"]),"text-halo-width":new np(eG.paint_symbol["text-halo-width"]),"text-halo-blur":new np(eG.paint_symbol["text-halo-blur"]),"text-translate":new nc(eG.paint_symbol["text-translate"]),"text-translate-anchor":new nc(eG.paint_symbol["text-translate-anchor"])}),layout:h4};class h8{constructor(i){this.type=i.property.overrides?i.property.overrides.runtimeType:eH,this.defaultValue=i}evaluate(i){if(i.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(i.formattedSection))return r.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}rg(h8,"FormatSectionOverride",{omit:["defaultValue"]});class h9 extends aM{constructor(i){super(i,h6)}recalculate(i,r){super.recalculate(i,r),"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"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));let n=this.layout.get("text-writing-mode");if(n){let i=[];for(let r of n)0>
8i.indexOf(r)&&i.push(r);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(i,r,n,a){var o;let s=this.layout.get(i).evaluate(r,{},n,a),l=this._unevaluatedLayout._values[i];return l.isDataDriven()||iF(l.value)||!s?s:(o=r.properties,s.replace(/{([^{}]+)}/g,(i,r)=>r in o?String(o[r]):""))}createBucket(i){return new h5(i)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let i of h6.paint.overridableProperties){if(!h9.hasPaintOverride(this.layout,i))continue;let r=this.paint.get(i),n=new h8(r),a=new iR(n,r.property.specification),o=null;o="constant"===r.value.kind||"source"===r.value.kind?new iU("source",a):new iV("composite",a,r.value.zoomStops,r.value._interpolationType),this.paint._values[i]=new nh(r.property,o,r.parameters)}}_handleOverridablePaintPropertyUpdate(i,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&h9.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,r){let n=i.get("text-field"),a=h6.paint.properties[r],o=!1,s=i=>{for(let r of i)if(a.overrides&&a.overrides.hasOverride(r))return void(o=!0)};if("constant"===n.value.kind&&n.value.value instanceof to)s(n.value.value.sections);else if("source"===n.value.kind){let i=r=>{o||(r instanceof tp&&tu(r.value)===e3?s(r.value.sections):r instanceof t_?s(r.sections):r.eachChild(i))},r=n.value;r._styleExpression&&i(r._styleExpression.expression)}return o}getProgramConfiguration(i){return new ab(this,i)}}var h7={paint:new n_({"background-color":new nc(eG.paint_background["background-color"]),"background-pattern":new nf(eG.paint_background["background-pattern"]),"background-opacity":new nc(eG.paint_background["background-opacity"])})},ue={paint:new n_({"raster-opacity":new nc(eG.paint_raster["raster-opacity"]),"raster-hue-rotate":new nc(eG.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new nc(eG.paint_raster["raster-brightness-min"]),"raster-brightness-max":new nc(eG.paint_raster["raster-brightness-max"]),"raster-saturation":new nc(eG.paint_raster["raster-saturation"]),"raster-contrast":new nc(eG.paint_raster["raster-contrast"]),"raster-resampling":new nc(eG.paint_raster["raster-resampling"]),"raster-fade-duration":new nc(eG.paint_raster["raster-fade-duration"])})};class ut extends aM{constructor(i){super(i,{}),this.implementation=i}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(i){this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)}onRemove(i){this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)}}var ui={paint:new n_({"sky-type":new nc(eG.paint_sky["sky-type"]),"sky-atmosphere-sun":new nc(eG.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new nc(eG.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new nc(eG.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new nc(eG.paint_sky["sky-gradient-radius"]),"sky-gradient":new nm(eG.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new nc(eG.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new nc(eG.paint_sky["sky-atmosphere-color"]),"sky-opacity":new nc(eG.paint_sky["sky-opacity"])})};function ur(i,r,n){let a=[0,0,1],o=oC([]);return oP(o,o,n?-(i*_)+Math.PI:i*_),oz(o,o,-(r*_)),oS(a,a,o),ob(a,a)}let un={circle:class extends aM{constructor(i){super(i,a9)}createBucket(i){return new aW(i)}queryRadius(i){return a3("circle-radius",this,i)+a3("circle-stroke-width",this,i)+a5(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,n,a,o,s,l,h){let u=a6(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(r,n)+this.paint.get("circle-stroke-width").evaluate(r,n);return oR(i,a,s,l,h,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),u,c)}getProgramIds(){return["circle"]}getProgramConfiguration(i){return new ab(this,i)}},heatmap:class extends aM{createBucket(i){return new oU(i)}constructor(i){super(i,o$),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"heatmap-color"===i&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=oq({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(i){return a3("heatmap-radius",this,i)}queryIntersectsFeature(i,r,n,a,o,s,l,h){let u=this.paint.get("heatmap-radius").evaluate(r,n);return oR(i,a,s,l,h,!0,!0,new f(0,0),u)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(i){return new ab(this,i)}},hillshade:class extends aM{constructor(i){super(i,oX)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends aM{constructor(i){super(i,sp)}getProgramIds(){let i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),n=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getProgramConfiguration(i){return new ab(this,i)}recalculate(i,r){super.recalculate(i,r);let n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new su(i)}queryRadius(){return a5(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,n,a,o,s){return!i.queryGeometry.isAboveHorizon&&aY(a4(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),a)}isTileClipped(){return!0}},"fill-extrusion":class extends aM{constructor(i){super(i,sF)}createBucket(i){return new sM(i)}queryRadius(){return a5(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(i){return new ab(this,i)}queryIntersectsFeature(i,r,n,a,o,s,l,h,u){var c,p,d,m;let _=a6(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),g=this.paint.get("fill-extrusion-height").evaluate(r,n),y=this.paint.get("fill-extrusion-base").evaluate(r,n),x=[0,0],v=h&&s.elevation,b=s.elevation?s.elevation.exaggeration():1,w=i.tile.getBucket(this);if(v&&w instanceof sM){let i=w.centroidVertexArray,r=u+1;if(r<i.length){let n=i.get(r);x[0]=n.a_centroid_pos0,x[1]=n.a_centroid_pos1}}if(0===x[0]&&1===x[1])return!1;"globe"===s.projection.name&&(a=sB([a],[new f(0,0),new f(8192,8192)],i.tileID.canonical).map(i=>i.polygon).flat());let T=(c=a,p=v?h:null,d=s.center.lat,m=i.tileID.canonical,"globe"===s.projection.name?function(i,r,n,a,o,s,l,h,u,c,p){let d=[],f=[],m=i.projection.upVectorScale(p,i.center.lat,i.worldSize).metersToTile,_=[0,0,0,1],g=[0,0,0,1],y=(i,r,n,a)=>{i[0]=r,i[1]=n,i[2]=a,i[3]=1},x=sL();for(let v of(n>0&&(n+=x),a+=x,r)){let r=[],x=[];for(let d of v){let f=d.x+o.x,v=d.y+o.y,b=i.projection.projectTilePoint(f,v,p),w=i.projection.upVector(p,d.x,d.y),T=n,E=a;if(l){let i=sq(f,v,n,a,l,h,u,c);T+=i.base,E+=i.top}0!==n?y(_,b.x+w[0]*m*T,b.y+w[1]*m*T,b.z+w[2]*m*T):y(_,b.x,b.y,b.z),y(g,b.x+w[0]*m*E,b.y+w[1]*m*E,b.z+w[2]*m*E),oE(_,_,s),oE(g,g,s),r.push(s$(_)),x.push(s$(g))}d.push(r),f.push(x)}return[d,f]}(s,c,y,g,_,l,p,x,b,d,m):p?function(i,r,n,a,o,s,l,h,u){let c=[],p=[],d=[0,0,0,1];for(let f of i){let i=[],m=[];for(let c of f){let p=c.x+a.x,f=c.y+a.y,_=sq(p,f,r,n,s,l,h,u);d[0]=p,d[1]=f,d[2]=_.base,d[3]=1,oA(d,d,o),d[3]=Math.max(d[3],1e-5);let g=s$([d[0]/d[3],d[1]/d[3],d[2]/d[3]]);d[0]=p,d[1]=f,d[2]=_.top,d[3]=1,oA(d,d,o),d[3]=Math.max(d[3],1e-5);let y=s$([d[0]/d[3],d[1]/d[3],d[2]/d[3]]);i.push(g),m.push(y)}c.push(i),p.push(m)}return[c,p]}(c,y,g,_,l,p,x,b,d):function(i,r,n,a,o){let s=[],l=[],h=o[8]*r,u=o[9]*r,c=o[10]*r,p=o[11]*r,d=o[8]*n,m=o[9]*n,_=o[
810]*n,g=o[11]*n;for(let r of i){let i=[],n=[];for(let s of r){let r=s.x+a.x,l=s.y+a.y,y=o[0]*r+o[4]*l+o[12],x=o[1]*r+o[5]*l+o[13],v=o[2]*r+o[6]*l+o[14],b=o[3]*r+o[7]*l+o[15],w=y+h,T=x+u,E=v+c,S=Math.max(b+p,1e-5),I=y+d,A=x+m,M=v+_,C=Math.max(b+g,1e-5),z=new f(w/S,T/S);z.z=E/S,i.push(z);let P=new f(I/C,A/C);P.z=M/C,n.push(P)}s.push(i),l.push(n)}return[s,l]}(c,y,g,_,l)),E=i.queryGeometry;return function(i,r,n){let a=1/0;aY(n,r)&&(a=sZ(n,r[0]));for(let o=0;o<r.length;o++){let s=r[o],l=i[o];for(let i=0;i<s.length-1;i++){let r=s[i],o=[r,s[i+1],l[i+1],l[i],r];aH(n,o)&&(a=Math.min(a,sZ(n,o)))}}return a!==1/0&&a}(T[0],T[1],E.isPointQuery()?E.screenBounds:E.screenGeometry)}},line:class extends aM{constructor(i){super(i,s1),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){if("line-gradient"===i){let i=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=i._styleExpression&&i._styleExpression.expression instanceof tN,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,r){super.recalculate(i,r),this.paint._values["line-floorwidth"]=s2.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new sQ(i)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getProgramConfiguration(i){return new ab(this,i)}queryRadius(i){var r,n;let a=(r=a3("line-width",this,i),(n=a3("line-gap-width",this,i))>0?n+2*r:r),o=a3("line-offset",this,i);return a/2+Math.abs(o)+a5(this.paint.get("line-translate"))}queryIntersectsFeature(i,r,n,a,o,s){var l,h;if(i.queryGeometry.isAboveHorizon)return!1;let u=a4(i.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),c=i.pixelToTileUnitsFactor/2*(l=this.paint.get("line-width").evaluate(r,n),(h=this.paint.get("line-gap-width").evaluate(r,n))>0?h+2*l:l),p=this.paint.get("line-offset").evaluate(r,n);return p&&(a=function(i,r){let n=[],a=new f(0,0);for(let o=0;o<i.length;o++){let s=i[o],l=[];for(let i=0;i<s.length;i++){let n=s[i-1],o=s[i],h=s[i+1],u=0===i?a:o.sub(n)._unit()._perp(),c=i===s.length-1?a:h.sub(o)._unit()._perp(),p=u._add(c)._unit();p._mult(1/(p.x*c.x+p.y*c.y)),l.push(p._mult(r)._add(o))}n.push(l)}return n}(a,p*i.pixelToTileUnitsFactor)),function(i,r,n){for(let a=0;a<r.length;a++){let o=r[a];if(i.length>=3){for(let r=0;r<o.length;r++)if(a1(i,o[r]))return!0}if(function(i,r,n){if(i.length>1){if(aK(i,r))return!0;for(let a=0;a<r.length;a++)if(aJ(r[a],i,n))return!0}for(let a=0;a<i.length;a++)if(aJ(i[a],r,n))return!0;return!1}(i,o,n))return!0}return!1}(u,a,c)}isTileClipped(){return!0}},symbol:h9,background:class extends aM{constructor(i){super(i,h7)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class extends aM{constructor(i){super(i,ue)}getProgramIds(){return["raster"]}},sky:class extends aM{constructor(i){super(i,ui),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"sky-gradient"===i?this._updateColorRamp():"sky-atmosphere-sun"!==i&&"sky-atmosphere-halo-color"!==i&&"sky-atmosphere-color"!==i&&"sky-atmosphere-sun-intensity"!==i||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=oq({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(i){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){let r=i.style.light.properties.get("position");return this._lightPosition.azimuthal!==r.azimuthal||this._lightPosition.polar!==r.polar}return!1}getCenter(i,r){if("atmosphere"===this.paint.get("sky-type")){let n=this.paint.get("sky-atmosphere-sun"),a=!n,o=i.style.light,s=o.properties.get("position");return a&&"viewport"===o.properties.get("anchor")&&U("The sun direction is attached to a light with viewport anchor, lighting may behave unex
8pectedly."),a?ur(s.azimuthal,90-s.polar,r):ur(n[0],90-n[1],r)}let n=this.paint.get("sky-gradient-center");return ur(n[0],90-n[1],r)}is3D(){return!1}isSky(){return!0}markSkyboxValid(i){this._skyboxInvalidated=!1,this._lightPosition=i.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){let i=this.paint.get("sky-type");return"atmosphere"===i?["skyboxCapture","skybox"]:"gradient"===i?["skyboxGradient"]:null}}};class ua{constructor(i,r,n,a){this.context=i,this.format=n,this.texture=i.gl.createTexture(),this.update(r,a)}update(i,r,n){let{width:a,height:o}=i,{context:s}=this,{gl:l}=s,{HTMLImageElement:h,HTMLCanvasElement:u,HTMLVideoElement:c,ImageData:d,ImageBitmap:f}=p;if(l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!r||!1!==r.premultiply)),n||this.size&&this.size[0]===a&&this.size[1]===o){let{x:r,y:s}=n||{x:0,y:0};i instanceof h||i instanceof u||i instanceof c||i instanceof d||f&&i instanceof f?l.texSubImage2D(l.TEXTURE_2D,0,r,s,l.RGBA,l.UNSIGNED_BYTE,i):l.texSubImage2D(l.TEXTURE_2D,0,r,s,a,o,l.RGBA,l.UNSIGNED_BYTE,i.data)}else this.size=[a,o],i instanceof h||i instanceof u||i instanceof c||i instanceof d||f&&i instanceof f?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,i):l.texImage2D(l.TEXTURE_2D,0,this.format,a,o,0,this.format,l.UNSIGNED_BYTE,i.data);this.useMipmap=Boolean(r&&r.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&l.generateMipmap(l.TEXTURE_2D)}bind(i,r){let{context:n}=this,{gl:a}=n;a.bindTexture(a.TEXTURE_2D,this.texture),i!==this.filter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,this.useMipmap?i===a.NEAREST?a.NEAREST_MIPMAP_NEAREST:a.LINEAR_MIPMAP_NEAREST:i),this.filter=i),r!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,r),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}}class uo{constructor(i,r){this.width=i,this.height=r,this.nextRow=0,this.image=new oG({width:i,height:r}),this.positions={},this.uploaded=!1}getDash(i,r){let n=this.getKey(i,r);return this.positions[n]}trim(){let i=this.width,r=this.height=P(this.nextRow);this.image.resize({width:i,height:r})}getKey(i,r){return i.join(",")+r}getDashRanges(i,r,n){let a=[],o=i.length%2==1?-i[i.length-1]*n:0,s=i[0]*n,l=!0;a.push({left:o,right:s,isDash:l,zeroLength:0===i[0]});let h=i[0];for(let r=1;r<i.length;r++){l=!l;let u=i[r];o=h*n,h+=u,s=h*n,a.push({left:o,right:s,isDash:l,zeroLength:0===u})}return a}addRoundDash(i,r,n){let a=r/2;for(let r=-n;r<=n;r++){let o=this.width*(this.nextRow+n+r),s=0,l=i[0];for(let h=0;h<this.width;h++){let u;h/l.right>1&&(l=i[++s]);let c=Math.abs(h-l.left),p=Math.abs(h-l.right),d=Math.min(c,p),f=r/n*(a+1);if(l.isDash){let i=a-Math.abs(f);u=Math.sqrt(d*d+i*i)}else u=a-Math.sqrt(d*d+f*f);this.image.data[o+h]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(i,r){for(let r=i.length-1;r>=0;--r){let n=i[r],a=i[r+1];n.zeroLength?i.splice(r,1):a&&a.isDash===n.isDash&&(a.left=n.left,i.splice(r,1))}let n=i[0],a=i[i.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);let o=this.width*this.nextRow,s=0,l=i[0];for(let n=0;n<this.width;n++){n/l.right>1&&(l=i[++s]);let a=Math.abs(n-l.left),h=Math.abs(n-l.right),u=Math.min(a,h);this.image.data[o+n]=Math.max(0,Math.min(255,(l.isDash?u:-u)+r+128))}}addDash(i,r){let n=this.getKey(i,r);if(this.positions[n])return this.positions[n];let a="round"===r,o=a?7:0,s=2*o+1;if(this.nextRow+s>this.height)return U("LineAtlas out of space"),null;0===i.length&&i.push(1);let l=0;for(let r=0;r<i.length;r++)i[r]<0&&(U("Negative value is found in line dasharray, replacing values with 0"),i[r]=0),l+=i[r];if(0!==l){let n=this.width/l,s=this.getDashRanges(i,this.width,n);a?this.addRoundDash(s,n,o):this.addRegularDash(s,"square"===r?.5*n:0)}let h=this.nextRow+o;this.nextRow+=s;let u={tl:[h,o],br:[l,0]};return this.positions[n]=u,u}}rg(uo,"LineAtlas");class us{constructor(i){this._callback=i,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(){this._channel=void 0,this._callback=()=>{}}}class ul{constructor(){this.tasks={},this.taskQueue=[],D(["process"],this),this.invoker=new us(this.process),this.nextId=0}add(i,r){let n=this.nextId++,a=function({type:i,isSymbolTile:r,zoom:n}){return n=n||0,"message"===i?0:"maybePrepare"!==i||r?"parseTile"!==i||r?"parseTile"===i&&r?300-n:"maybePrepare"===i&&r?400-n:500:200-n:100-n}(r);return 0===a?(j(),i(),{cancel:()=>{}}):(this.tasks[n]={fn:i,metadata:r,priority:a,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}})}process(){j();{if(this.taskQueue=this.taskQueue.filter(i=>!!this.tasks[i]),!this.taskQueue.length)return;let i=this.pick();if(null===i)return;let r=this.tasks[i];if(delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),!r)return;r.fn()}}pick(){let i=null,r=1/0;for(let n=0;n<this.taskQueue.length;n++){let a=this.tasks[this.taskQueue[n]];a.priority<r&&(r=a.priority,i=n)}if(null===i)return null;let n=this.taskQueue[i];return this.taskQueue.splice(i,1),n}remove(){this.invoker.remove()}}class uh{constructor(i){this._stringToNumber={},this._numberToString=[];for(let r=0;r<i.length;r++){let n=i[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(i){return this._stringToNumber[i]}decode(i){return this._numberToString[i]}}let uu=["tile","layer","source","sourceLayer","state"];class uc{constructor(i,r,n,a,o){this.type="Feature",this._vectorTileFeature=i,this._z=r,this._x=n,this._y=a,this.properties=i.properties,this.id=o}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(i){this._geometry=i}toJSON(){let i={type:"Feature",geometry:this.geometry,properties:this.properties};for(let r of(void 0!==this.id&&(i.id=this.id),uu))void 0!==this[r]&&(i[r]=this[r]);return i}}let up=new Uint16Array(8184);for(let i=0;i<2046;i++){let r=i+2,n=0,a=0,o=0,s=0,l=0,h=0;for(1&r?o=s=l=32:n=a=h=32;(r>>=1)>1;){let i=n+o>>1,u=a+s>>1;1&r?(o=n,s=a,n=l,a=h):(n=o,a=s,o=l,s=h),l=i,h=u}let u=4*i;up[u+0]=n,up[u+1]=a,up[u+2]=o,up[u+3]=s}let ud=new Uint16Array(2178),uf=new Uint8Array(1089),um=new Uint16Array(1089);function u_(i){return 0===i?-.03125:32===i?.03125:0}var ug=nb([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);let uy={type:2,extent:8192,loadGeometry:()=>[[new f(0,0),new f(8193,0),new f(8193,8193),new f(0,8193),new f(0,0)]]};class ux{constructor(i,r,n,a,o){this.tileID=i,this.uid=C(),this.uses=0,this.tileSize=r,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,this.expiredRequestCount=0,this.state="loading",a&&a.transform&&(this.projection=a.transform.projection)}registerFadeDuration(i){let r=i+this.timeAdded;r<Y.now()||this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=hD(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(i,r,n){if(this.unloadVectorData(),this.state="loaded",i){for(let a in i.featureIndex&&(this.latestFeatureIndex=i.featureIndex,i.rawTileData?(this.latestRawTileData=i.rawTileData,this.latestFeatureIndex.rawTileData=i.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=i.collisionBoxArray,this.buckets=function(i,r){let n={};if(!r)return n;for(let a of i){let i=a.layerIds.map(i=>
8r.getLayer(i)).filter(Boolean);if(0!==i.length)for(let r of(a.layers=i,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(r=>i.filter(i=>i.id===r)[0])),i))n[r.id]=a}return n}(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){let i=this.buckets[a];if(i instanceof h5){if(this.hasSymbolBuckets=!0,!n)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let r=this.buckets[i];if(r instanceof h5&&r.hasRTLText){this.hasRTLText=!0,nt.isLoading()||nt.isLoaded()||"deferred"!==r7()||ne();break}}for(let i in this.queryPadding=0,this.buckets){let n=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(i).queryRadius(n))}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas)}else this.collisionBoxArray=new nK}unloadVectorData(){if(this.hasData()){for(let i in this.buckets)this.buckets[i].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(i){return this.buckets[i.id]}upload(i){for(let r in this.buckets){let n=this.buckets[r];n.uploadPending()&&n.upload(i)}let r=i.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new ua(i,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new ua(i,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new ua(i,this.lineAtlas.image,r.ALPHA),this.lineAtlas.uploaded=!0)}prepare(i){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture)}queryRenderedFeatures(i,r,n,a,o,s,l,h){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:a,pixelPosMatrix:l,transform:s,params:o,tileTransform:this.tileTransform},i,r,n):{}}querySourceFeatures(i,r){let n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;let a=n.loadVTLayers(),o=r?r.sourceLayer:"",s=a._geojsonTileLayer||a[o];if(!s)return;let l=iK(r&&r.filter),{z:h,x:u,y:c}=this.tileID.canonical,p={z:h,x:u,y:c};for(let r=0;r<s.length;r++){let a=s.feature(r);if(l.needGeometry){let i=a$(a,!0);if(!l.filter(new ni(this.tileID.overscaledZ),i,this.tileID.canonical))continue}else if(!l.filter(new ni(this.tileID.overscaledZ),a))continue;let d=n.getId(a,o),f=new uc(a,h,u,c,d);f.tile=p,i.push(f)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(i){let r=this.expirationTime;if(i.cacheControl){let r=N(i.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else i.expires&&(this.expirationTime=new Date(i.expires).getTime());if(this.expirationTime){let i=Date.now(),n=!1;if(this.expirationTime>i)n=!1;else if(r){if(this.expirationTime<r)n=!0;else{let a=this.expirationTime-r;a?this.expirationTime=i+Math.max(a,3e4):n=!0}}else n=!0;n?(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(),2147483647)}setFeatureState(i,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(i).length||!r)return;let n=this.latestFeatureIndex.loadVTLayers(),a=r.style.listImages();for(let o in this.buckets){if(!r.style.hasLayer(o))continue;let s=this.buckets[o],l=s.layers[0].sourceLayer||"_geojsonTileLayer",h=n[l],u=i[l];if(!h||!u||0===Object.keys(u).length)continue;if(s.update(u,h,a,this.imageAtlas&&this.imageAtlas.patternPositions||{}),s instanceof sQ||s instanceof su){let i=r.style._getSourceCache(s.layers[0].source);r._terrain&&r._terrain.enabled&&i&&s.programConfigurations.needsUpload&&r._terrain._clearRenderCacheForTile(i.id,this.tileID)}let c=r&&r.style&&r.style.getLayer(o);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(s)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Y.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(i){this.symbolFadeHoldUntil=Y.now()+i}setTexture(i,r){let n=r.context,a=n.gl;this.texture=r.getTileTexture(i.width),this.texture?this.texture.update(i,{useMipmap:!0}):(this.texture=new ua(n,i,a.RGBA,{useMipmap:!0}),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),n.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax))}
8setDependencies(i,r){let n={};for(let i of r)n[i]=!0;this.dependencies[i]=n}hasDependency(i,r){for(let n of i){let i=this.dependencies[n];if(i){for(let n of r)if(i[n])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(i,r){if(!r||"mercator"===r.name||this._tileDebugBuffer)return;let n=aZ(uy,this.tileID.canonical,this.tileTransform)[0],a=new nT,o=new nq;for(let i=0;i<n.length;i++){let{x:r,y:s}=n[i];a.emplaceBack(r,s),o.emplaceBack(i)}o.emplaceBack(0),this._tileDebugIndexBuffer=i.createIndexBuffer(o),this._tileDebugBuffer=i.createVertexBuffer(a,ha.members),this._tileDebugSegments=aP.simpleSegment(0,0,a.length,o.length)}_makeTileBoundsBuffers(i,r){let n,a;if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;let o=aZ(uy,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let i=function(i,r){let n=hD(i,r),a=Math.pow(2,i.z);for(let o=0;o<33;o++)for(let s=0;s<33;s++){let l=aO((i.x+(s+u_(s))/32)/a),h=aU((i.y+(o+u_(o))/32)/a),u=r.project(l,h),c=33*o+s;ud[2*c+0]=Math.round((u.x*n.scale-n.x)*8192),ud[2*c+1]=Math.round((u.y*n.scale-n.y)*8192)}uf.fill(0),um.fill(0);for(let i=2045;i>=0;i--){let r=4*i,n=up[r+0],a=up[r+1],o=up[r+2],s=up[r+3],l=n+o>>1,h=a+s>>1,u=l+h-a,c=h+n-l,p=33*a+n,d=33*s+o,f=33*h+l,m=Math.hypot((ud[2*p+0]+ud[2*d+0])/2-ud[2*f+0],(ud[2*p+1]+ud[2*d+1])/2-ud[2*f+1])>=16;if(uf[f]=uf[f]||(m?1:0),i<1022){let i=(a+c>>1)*33+(n+u>>1),r=(s+c>>1)*33+(o+u>>1);uf[f]=uf[f]||uf[i]||uf[r]}}let o=new nS,s=new nU,l=0;function h(i,r){let n=33*r+i;return 0===um[n]&&(o.emplaceBack(ud[2*n+0],ud[2*n+1],8192*i/32,8192*r/32),um[n]=++l),um[n]-1}function u(i,r,n,a,o,l){let c=i+n>>1,p=r+a>>1;if(Math.abs(i-o)+Math.abs(r-l)>1&&uf[33*p+c])u(o,l,i,r,c,p),u(n,a,o,l,c,p);else{let u=h(i,r),c=h(n,a),p=h(o,l);s.emplaceBack(u,c,p)}}return u(0,0,32,32,32,0),u(32,32,0,0,0,32),{vertices:o,indices:s}}(this.tileID.canonical,r);n=i.vertices,a=i.indices}else{for(let{x:i,y:r}of(n=new nS,a=new nU,o))n.emplaceBack(i,r,0,0);let i=oY(n.int16,void 0,4);for(let r=0;r<i.length;r+=3)a.emplaceBack(i[r],i[r+1],i[r+2])}this._tileBoundsBuffer=i.createVertexBuffer(n,ug.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(a),this._tileBoundsSegments=aP.simpleSegment(0,0,n.length,a.length)}_makeGlobeTileDebugBuffers(i,r){let n;let a=r.projection;if(!a||"globe"!==a.name||r.freezeTileCoverage)return;let o=this.tileID.canonical,s=hE(hm(o,r)),l=hA(r.zoom);l>0&&(n=oi(new Float64Array(16),r.globeMatrix));let h=(o.x+.5)/(1<<o.z)-aR(r.center.lng),u=0;h>.5?u=-1:h<-.5&&(u=1),this._makeGlobeTileDebugBorderBuffer(i,o,r,s,n,l,u),this._makeGlobeTileDebugTextBuffer(i,o,r,s,n,l,u)}_globePoint(i,r,n,a,o,s,l,h){let u=hb(i,r,n);if(s){let o=1<<n.z,c=[((i/8192+n.x)/o+h)*a,(r/8192+n.y)/o*a,0];oE(c,c,s),u=tZ(u,c,l)}return oE(u,u,o)}_makeGlobeTileDebugBorderBuffer(i,r,n,a,o,s,l){let h=new nT,u=new nq,c=new nE,p=(i,p,d,f,m)=>{let _=(d-i)/(m-1),g=(f-p)/(m-1),y=h.length;for(let d=0;d<m;d++){let f=i+d*_,m=p+d*g;h.emplaceBack(f,m);let x=this._globePoint(f,m,r,n.worldSize,a,o,s,l);c.emplaceBack(x[0],x[1],x[2]),u.emplaceBack(y+d)}};p(0,0,8192,0,16),p(8192,0,8192,8192,16),p(8192,8192,0,8192,16),p(0,8192,0,0,16),this._tileDebugIndexBuffer=i.createIndexBuffer(u),this._tileDebugBuffer=i.createVertexBuffer(h,ha.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(c,hn.members),this._tileDebugSegments=aP.simpleSegment(0,0,h.length,u.length)}_makeGlobeTileDebugTextBuffer(i,r,n,a,o,s,l){let h=new nT,u=new nU,c=new nE;u.reserve(32),h.reserve(25),c.reserve(25);for(let i=0;i<25;i++){let u=2048*i;for(let i=0;i<25;i++){let p=2048*i;h.emplaceBack(p,u);let d=this._globePoint(p,u,r,n.worldSize,a,o,s,l);c.emplaceBack(d[0],d[1],d[2])}}for(let i=0;i<4;i++)for(let r=0;r<4;r++){let n=25*i+r,a=25*i+(r+1),o=25*(i+1)+r,s=25*(i+1)+(r+1);u.emplaceBack(n,a,o),u.emplaceBack(o,a,s)}this._tileDebugTextIndexBuffer=i.createIndexBuffer(u),this._tileDebugTextBuffer=i.createVertexBuffer(h,ha.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(c,hn.members),this._tileDebugTextSegments=aP.simpleSegment(0,0,25,32)}}class uv{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,r,n){let a=String(r);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][a]=this.stateChanges[i][a]||{},A(this.stateChanges[i][a],n),null===this.deletedStates[i])for(let r in this.deletedStates[i]={},this.state[i])r!==a&&(this.deletedStates[i][r]=null);else if(this.deletedStates[i]&&null===this.deletedStates[i][a])for(let r in this.deletedStates[i][a]={},this.state[i][a])n[r]||(this.deletedStates[i][a][r]=null);else for(let r in n)this.deletedStates[i]&&this.deletedStates[i][a]&&null===this.deletedStates[i][a][r]&&delete this.deletedStates[i][a][r]}
8removeFeatureState(i,r,n){if(null===this.deletedStates[i])return;let a=String(r);if(this.deletedStates[i]=this.deletedStates[i]||{},n&&void 0!==r)null!==this.deletedStates[i][a]&&(this.deletedStates[i][a]=this.deletedStates[i][a]||{},this.deletedStates[i][a][n]=null);else if(void 0!==r){if(this.stateChanges[i]&&this.stateChanges[i][a])for(n in this.deletedStates[i][a]={},this.stateChanges[i][a])this.deletedStates[i][a][n]=null;else this.deletedStates[i][a]=null}else this.deletedStates[i]=null}getState(i,r){let n=String(r),a=A({},(this.state[i]||{})[n],(this.stateChanges[i]||{})[n]);if(null===this.deletedStates[i])return{};if(this.deletedStates[i]){let n=this.deletedStates[i][r];if(null===n)return{};for(let i in n)delete a[i]}return a}initializeTileState(i,r){i.setFeatureState(this.state,r)}coalesceChanges(i,r){let n={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let r={};for(let n in this.stateChanges[i])this.state[i][n]||(this.state[i][n]={}),A(this.state[i][n],this.stateChanges[i][n]),r[n]=this.state[i][n];n[i]=r}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let r={};if(null===this.deletedStates[i])for(let n in this.state[i])r[n]={},this.state[i][n]={};else for(let n in this.deletedStates[i]){if(null===this.deletedStates[i][n])this.state[i][n]={};else for(let r of Object.keys(this.deletedStates[i][n]))delete this.state[i][n][r];r[n]=this.state[i][n]}n[i]=n[i]||{},A(n[i],r)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(let a in i)i[a].setFeatureState(n,r)}}class ub{constructor(i){this.size=i,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(i,r){let n=this.toIdx(i,r);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(i,r){return this.leaves[this.toIdx(i,r)]}toIdx(i,r){return r*this.size+i}}function uw(i,r,n,a){let o=0,s=Number.MAX_VALUE;for(let l=0;l<3;l++)if(1e-15>Math.abs(a[l])){if(n[l]<i[l]||n[l]>r[l])return null}else{let h=1/a[l],u=(i[l]-n[l])*h,c=(r[l]-n[l])*h;if(u>c){let i=u;u=c,c=i}if(u>o&&(o=u),c<s&&(s=c),o>s)return null}return o}function uT(i,r,n,a,o,s,l,h,u,c,p){let d=a-i,f=o-r,m=s-n,_=l-i,g=h-r,y=u-n,x=p[1]*y-p[2]*g,v=p[2]*_-p[0]*y,b=p[0]*g-p[1]*_,w=d*x+f*v+m*b;if(1e-15>Math.abs(w))return null;let T=1/w,E=c[0]-i,S=c[1]-r,I=c[2]-n,A=(E*x+S*v+I*b)*T;if(A<0||A>1)return null;let M=S*m-I*f,C=I*d-E*m,z=E*f-S*d,P=(p[0]*M+p[1]*C+p[2]*z)*T;return P<0||A+P>1?null:(_*M+g*C+y*z)*T}function uE(i,r,n,a,o,s,l,h,u){let c=1<<n,p=s-a,d=l-o;h[0]=(i+0)/c*p+a,h[1]=(r+0)/c*d+o,u[0]=(i+1)/c*p+a,u[1]=(r+1)/c*d+o}class uS{constructor(i){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=i,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;let r=function(i){let r=Math.ceil(Math.log2(i.dim/8)),n=[],a=Math.ceil(Math.pow(2,r)),o=1/a,s=(i,r,n,a,o)=>{let s=a?1:0;o[0]=i*n,o[1]=r*n,o[2]=(i+1)*n-s,o[3]=(r+1)*n-s},l=new ub(a),h=[];for(let r=0;r<a*a;r++){s(r%a,Math.floor(r/a),o,!1,h);let n=uA(h[0],h[1],i),u=uA(h[2],h[1],i),c=uA(h[2],h[3],i),p=uA(h[0],h[3],i);l.minimums.push(Math.min(n,u,c,p)),l.maximums.push(Math.max(n,u,c,p)),l.leaves.push(1)}for(n.push(l),a/=2;a>=1;a/=2){let i=n[n.length-1];l=new ub(a);for(let r=0;r<a*a;r++){s(r%a,Math.floor(r/a),2,!0,h);let n=i.getElevation(h[0],h[1]),o=i.getElevation(h[2],h[1]),u=i.getElevation(h[2],h[3]),c=i.getElevation(h[0],h[3]),p=i.isLeaf(h[0],h[1]),d=i.isLeaf(h[2],h[1]),f=i.isLeaf(h[2],h[3]),m=i.isLeaf(h[0],h[3]),_=Math.min(n.min,o.min,u.min,c.min),g=Math.max(n.max,o.max,u.max,c.max),y=p&&d&&f&&m;l.maximums.push(g),l.minimums.push(_),l.leaves.push(g-_<=5&&y?1:0)}n.push(l)}return n}(this.dem),n=r.length-1,a=r[n];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(r,0,0,n,0)}raycastRoot(i,r,n,a,o,s,l=1){return uw([i,r,-100],[n,a,this.maximums[0]*l],o,s)}raycast(i,r,n,a,o,s,l=1){if(!this.nodeCount)return null;let h=this.raycastRoot(i,r,n,a,o,s,l);if(null==h)return null;let u=[],c=[],p=[],d=[],f=[{idx:0,t:h,nodex:0,nodey:0,depth:0}];for(;f.length>0;){let{idx:h,t:g,nodex:y,nodey:x,depth:v}=f.pop();if(this.leaves[h]){uE(y,x,v,i,r,n,a,p,d);let h=1<<v,u=(y+0)/h,c=(y+1)/h,f=(x+0)/h,b=(x+1)/h,w=uA(u,f,this.dem)*l,T=uA(c,f,this.dem)*l,E=uA(c,b,this.dem)*l,S=uA(u,b,this.dem)*l,I=uT(p[0],p[1],w,d[0],p[1],T,d[0],d[1],E,o,s),A=uT(d[0],d[1],E,p[0],d[1],S,p[0],p[1],w,o,s),M=Math.min(null!==I?I:Number.MAX_VALUE,null!==A?A:Number.MAX_VALUE);if(M!==Number.MAX_VALUE)return M;{var m,_;let i=ov([],o,s,g);if(uI(w,T,S,E,(i[0]-(m=p[0]))/(d[0]-m),(i[1]-(_=p[1]))/(d[1]-_))>=i[2])return g}continue}let b=0;for(let f=0;f<this._siblingOffset.length;f++){uE((y<<1)+this._siblingOffset[f][0],(x<<1)+this._siblingOffset[f][1],v+1,i,r,n,a,p,d),p[2]=-100,d[2]=this.maximums[this.childOffsets[h]+f]*l;let m=uw(p,d,o,s);if(null!=m){u[f]=m;let i=!1;for(let r=0;r<b&&!i;r++)m>=u[c[r]]&&(c.splice(r,0,f),i=!0);i||(c[b]=f),b++}}for(let i=0;i<b;i++){let r=c[i];f.push({idx:this.childOffsets[h]+r,t:u[r],nodex:(y<<1)+this._siblingOffset[r][0],nodey:(x<<1)+this._siblingOffset[r][1],depth:v+1})}}return null}_addNode(i,r,n){return this.minimums.push(i),this.maximums.push(r),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(i,r,n,a,o){if(1===i[a].isLeaf(r,n))return;
8this.childOffsets[o]||(this.childOffsets[o]=this.nodeCount);let s=a-1,l=i[s],h=0,u=0;for(let i=0;i<this._siblingOffset.length;i++){let a=2*r+this._siblingOffset[i][0],o=2*n+this._siblingOffset[i][1],s=l.getElevation(a,o),c=l.isLeaf(a,o),p=this._addNode(s.min,s.max,c);c&&(h|=1<<i),u||(u=p)}for(let a=0;a<this._siblingOffset.length;a++)h&1<<a||this._construct(i,2*r+this._siblingOffset[a][0],2*n+this._siblingOffset[a][1],s,u+a)}}function uI(i,r,n,a,o,s){return tG(tG(i,n,s),tG(r,a,s),o)}function uA(i,r,n){let a=n.dim,o=w(i*a-.5,0,a-1),s=w(r*a-.5,0,a-1),l=Math.floor(o),h=Math.floor(s),u=Math.min(l+1,a-1),c=Math.min(h+1,a-1);return uI(n.get(l,h),n.get(u,h),n.get(l,c),n.get(u,c),o-l,s-h)}let uM={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};class uC{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(i,r,n,a=!1,o=!1){if(this.uid=i,r.height!==r.width)throw RangeError("DEM tiles must be square");if(n&&"mapbox"!==n&&"terrarium"!==n)return U(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;let s=this.dim=r.height-2,l=new Uint32Array(r.data.buffer);if(this.pixels=new Uint8Array(r.data.buffer),this.encoding=n||"mapbox",this.borderReady=a,!a){for(let i=0;i<s;i++)l[this._idx(-1,i)]=l[this._idx(0,i)],l[this._idx(s,i)]=l[this._idx(s-1,i)],l[this._idx(i,-1)]=l[this._idx(i,0)],l[this._idx(i,s)]=l[this._idx(i,s-1)];l[this._idx(-1,-1)]=l[this._idx(0,0)],l[this._idx(s,-1)]=l[this._idx(s-1,0)],l[this._idx(-1,s)]=l[this._idx(0,s-1)],l[this._idx(s,s)]=l[this._idx(s-1,s-1)],o&&this._buildQuadTree()}}_buildQuadTree(){this._tree=new uS(this)}get(i,r,n=!1){n&&(i=w(i,-1,this.dim),r=w(r,-1,this.dim));let a=4*this._idx(i,r);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(this.pixels[a],this.pixels[a+1],this.pixels[a+2])}static getUnpackVector(i){return uM[i]}get unpackVector(){return uM[this.encoding]}_idx(i,r){if(i<-1||i>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(i+1)}_unpackMapbox(i,r,n){return(256*i*256+256*r+n)/10-1e4}_unpackTerrarium(i,r,n){return 256*i+r+n/256-32768}static pack(i,r){let n=[0,0,0,0],a=uC.getUnpackVector(r),o=Math.floor((i+a[3])/a[2]);return n[2]=o%256,o=Math.floor(o/256),n[1]=o%256,o=Math.floor(o/256),n[0]=o,n}getPixels(){return new oZ({width:this.stride,height:this.stride},this.pixels)}backfillBorder(i,r,n){if(this.dim!==i.dim)throw Error("dem dimension mismatch");let a=r*this.dim,o=r*this.dim+this.dim,s=n*this.dim,l=n*this.dim+this.dim;switch(r){case -1:a=o-1;break;case 1:o=a+1}switch(n){case -1:s=l-1;break;case 1:l=s+1}let h=-r*this.dim,u=-n*this.dim;for(let r=s;r<l;r++)for(let n=a;n<o;n++){let a=4*this._idx(n,r),o=4*this._idx(n+h,r+u);this.pixels[a+0]=i.pixels[o+0],this.pixels[a+1]=i.pixels[o+1],this.pixels[a+2]=i.pixels[o+2],this.pixels[a+3]=i.pixels[o+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}rg(uC,"DEMData"),rg(uS,"DemMinMaxQuadTree",{omit:["dem"]});class uz{constructor(i,r){this.max=i,this.onRemove=r,this.reset()}reset(){for(let i in this.data)for(let r of this.data[i])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(i,r,n){let a=i.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);let o={value:r,timeout:void 0};if(void 0!==n&&(o.timeout=setTimeout(()=>{this.remove(i,o)},n)),this.data[a].push(o),this.order.push(a),this.order.length>this.max){let i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){let r=this.data[i].shift();return r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),r.value}getByKey(i){let r=this.data[i];return r?r[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,r){if(!this.has(i))return this;let n=i.wrapped().key,a=void 0===r?0:this.data[n].indexOf(r),o=this.data[n][a];return this.data[n].splice(a,1),o.timeout&&clearTimeout(o.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(o.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){let i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(i){let r=[];for(let n in this.data)for(let a of this.data[n])i(a.value)||r.push(a);for(let i of r)this.remove(i.value.tileID,i)}}class uP{constructor(i,r,n){this.func=i,this.mask=r,this.range=n}}uP.ReadOnly=!1,uP.ReadWrite=!0,uP.disabled=new uP(519,uP.ReadOnly,[0,1]);class uk{constructor(i,r,n,a,o,s){this.test=i,this.ref=r,this.mask=n,this.fail=a,this.depthFail=o,this.pass=s}}uk.disabled=new uk({func:519,mask:0},0,0,7680,7680,7680);class uD{constructor(i,r,n){this.blendFunction=i,this.blendColor=r,this.mask=n}}uD.Replace=[1,0],uD.disabled=new uD(uD.Replace,tr.transparent,[!1,!1,!1,!1]),uD.unblended=new uD(uD.Replace,tr.transparent,[!0,!0,!0,!0]),uD.alphaBlended=new uD([1,771],tr.transparent,[!0,!0,!0,!0]);class uL{constructor(i,r,n){this.enable=i,this.mode=r,this.frontFace=n}}uL.disabled=new uL(!1,1029,2305),uL.backCCW=new uL(!0,1029,2305),uL.backCW=new uL(!0,1029,2304),uL.frontCW=new uL(!0,1028,2304),uL.frontCCW=new uL(!0,1028,2305);class uB extends eN{constructor(i,r,n){super(),this.id=i,this._onlySymbols=n,r.on("data",i=>{"source"===i.dataType&&"metadata"===i.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===i.dataType&&"content"===i.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new uz(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
8,this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new uv,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(i){this.map=i,this._minTileCacheSize=void 0===this._minTileCacheSize&&i?i._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&i?i._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let i in this._tiles){let r=this._tiles[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(i,r){return i.isSymbolTile=this._onlySymbols,this._source.loadTile(i,r)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i,()=>{})}_abortTile(i){if(this._source.abortTile)return this._source.abortTile(i,()=>{})}serialize(){return this._source.serialize()}prepare(i){if(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._source.prepareTile)for(let r in this._tiles){let n=this._tiles[r];this._source.prepareTile(n)&&this.map.painter.terrain&&this.map.painter.terrain._clearRenderCacheForTile(this.id,n.tileID),n.upload(i),n.prepare(this.map.style.imageManager)}else for(let r in this._tiles){let n=this._tiles[r];n.upload(i),n.prepare(this.map.style.imageManager)}}getIds(){return I(this._tiles).map(i=>i.tileID).sort(uR).map(i=>i.key)}getRenderableIds(i){let r=[];for(let n in this._tiles)this._isIdRenderable(+n,i)&&r.push(this._tiles[n]);return i?r.sort((i,r)=>{let n=i.tileID,a=r.tileID,o=new f(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),s=new f(a.canonical.x,a.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-a.overscaledZ||s.y-o.y||s.x-o.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(uR).map(i=>i.key)}hasRenderableParent(i){let r=this.findLoadedParent(i,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(i,r){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(r||!this._tiles[i].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(let i in this._cache.reset(),this._tiles)"errored"!==this._tiles[i].state&&this._reloadTile(+i,"reloading")}_reloadTile(i,r){let n=this._tiles[i];n&&("loading"!==n.state&&(n.state=r),this._loadTile(n,this._tileLoaded.bind(this,n,i,r)))}_tileLoaded(i,r,n,a){if(a){if(i.state="errored",404!==a.status)this._source.fire(new ej(a,{tile:i}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){let i=this.map.painter.terrain;this.update(this.transform,i.getScaledDemTileSize(),!0),i.resetTileLookupCache(this.id)}else this.update(this.transform)}else i.timeAdded=Y.now(),"expired"===n&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(r,i),"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new eV("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(i){let r=this.getRenderableIds();for(let a=0;a<r.length;a++){let o=r[a];if(i.neighboringTiles&&i.neighboringTiles[o]){let r=this.getTileByID(o);n(i,r),n(r,i)}}function n(i,r){if(!i.dem||i.dem.borderReady)return;i.needsHillshadePrepare=!0,i.needsDEMTextureUpload=!0;let n=r.tileID.canonical.x-i.tileID.canonical.x,a=r.tileID.canonical.y-i.tileID.canonical.y,o=Math.pow(2,i.tileID.canonical.z),s=r.tileID.key;0===n&&0===a||Math.abs(a)>1||(Math.abs(n)>1&&(1===Math.abs(n+o)?n+=o:1===Math.abs(n-o)&&(n-=o)),r.dem&&i.dem&&(i.dem.backfillBorder(r.dem,n,a),i.neighboringTiles&&i.neighboringTiles[s]&&(i.neighboringTiles[s].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,r,n,a){for(let o in this._tiles){let s=this._tiles[o];if(a[o]||!s.hasData()||s.tileID.overscaledZ<=r||s.tileID.overscaledZ>n)continue;let l=s.tileID;for(;s&&s.tileID.overscaledZ>
8r+1;){let i=s.tileID.scaledTo(s.tileID.overscaledZ-1);(s=this._tiles[i.key])&&s.hasData()&&(l=i)}let h=l;for(;h.overscaledZ>r;)if(i[(h=h.scaledTo(h.overscaledZ-1)).key]){a[l.key]=l;break}}}findLoadedParent(i,r){if(i.key in this._loadedParentTiles){let n=this._loadedParentTiles[i.key];return n&&n.tileID.overscaledZ>=r?n:null}for(let n=i.overscaledZ-1;n>=r;n--){let r=i.scaledTo(n),a=this._getLoadedTile(r);if(a)return a}}_getLoadedTile(i){let r=this._tiles[i.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,r){r=r||this._source.tileSize;let n=Math.ceil(i.width/r)+1,a=Math.ceil(i.height/r)+1,o=Math.floor(n*a*5),s="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,o):o,l="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(l)}handleWrapJump(i){let r=Math.round((i-(void 0===this._prevLng?i:this._prevLng))/360);if(this._prevLng=i,r){let i={};for(let n in this._tiles){let a=this._tiles[n];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+r),i[a.tileID.key]=a}for(let r in this._tiles=i,this._timers)clearTimeout(this._timers[r]),delete this._timers[r];for(let i in this._tiles)this._setTileReloadTimer(+i,this._tiles[i])}}update(i,r,n){let a;if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;this.updateCacheSize(i,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new sj(i.canonical.z,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y)):(a=i.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(a=a.filter(i=>this._source.hasTile(i)))):a=[];let o=this._updateRetainedTiles(a);if(uF(this._source.type)&&0!==a.length){let i={},r={},n=Object.keys(o);for(let a of n){let n=o[a],s=this._tiles[a];if(!s||s.fadeEndTime&&s.fadeEndTime<=Y.now())continue;let l=this.findLoadedParent(n,Math.max(n.overscaledZ-uB.maxOverzooming,this._source.minzoom));l&&(this._addTile(l.tileID),i[l.tileID.key]=l.tileID),r[a]=n}let s=a[a.length-1].overscaledZ;for(let i in this._tiles){let n=this._tiles[i];if(o[i]||!n.hasData())continue;let a=n.tileID;for(;a.overscaledZ>s;){a=a.scaledTo(a.overscaledZ-1);let s=this._tiles[a.key];if(s&&s.hasData()&&r[a.key]){o[i]=n.tileID;break}}}for(let r in i)o[r]||(this._coveredTiles[r]=!0,o[r]=i[r])}for(let i in o)this._tiles[i].clearFadeHold();let s=function(i,r){let n=[];for(let a in i)a in r||n.push(a);return n}(this._tiles,o);for(let i of s){let r=this._tiles[i];r.hasSymbolBuckets&&!r.holdingForFade()?r.setHoldDuration(this.map._fadeDuration):r.hasSymbolBuckets&&!r.symbolFadeFinished()||this._removeTile(+i)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(let i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){let r={};if(0===i.length)return r;let n={},a=i.reduce((i,r)=>Math.min(i,r.overscaledZ),1/0),o=i[0].overscaledZ,s=Math.max(o-uB.maxOverzooming,this._source.minzoom),l=Math.max(o+uB.maxUnderzooming,this._source.minzoom),h={};for(let n of i){let i=this._addTile(n);r[n.key]=n,i.hasData()||a<this._source.maxzoom&&(h[n.key]=n)}for(let o of(this._retainLoadedChildren(h,a,l,r),i)){let i=this._tiles[o.key];if(i.hasData())continue;if(o.canonical.z>=this._source.maxzoom){let i=o.children(this._source.maxzoom)[0],n=this.getTile(i);if(n&&n.hasData()){r[i.key]=i;continue}}else{let i=o.children(this._source.maxzoom);if(r[i[0].key]&&r[i[1].key]&&r[i[2].key]&&r[i[3].key])continue}let a=i.wasRequested();for(let l=o.overscaledZ-1;l>=s;--l){let s=o.scaledTo(l);if(n[s.key]||(n[s.key]=!0,(i=this.getTile(s))||!a||(i=this._addTile(s)),i&&(r[s.key]=s,a=i.wasRequested(),i.hasData())))break}}return r}_updateLoadedParentTileCache(){for(let i in this._loadedParentTiles={},this._tiles){let r=[],n,a=this._tiles[i].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){n=this._loadedParentTiles[a.key];break}r.push(a.key);let i=a.scaledTo(a.overscaledZ-1);if(n=this._getLoadedTile(i))break;a=i}for(let i of r)this._loadedParentTiles[i]=n}}_addTile(i){let r=this._tiles[i.key];if(r)return this._source.prepareTile&&this._source.prepareTile(r),r;(r=this._cache.getAndRemove(i))&&(this._setTileReloadTimer(i.key,r),r.tileID=i,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,r)));let n=Boolean(r);if(!n){let n=this.map?this.map.painter:null;r=new ux(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,n,this._isRaster),this._source.prepareTile&&this._source.prepareTile(r)||this._loadTile(r,this._tileLoaded.bind(this,r,i.key,r.state))}return r?(r.uses++,this._tiles[i.key]=r,n||this._source.fire(new eV("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(i,r){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);let n=r.getExpiryTimeout();n&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},n))}_removeTile(i){let r=this._tiles[i];r&&(r.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),r.uses>0||(r.hasData()&&"reloading"!==r.state?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){for(let i in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+i);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id
8)}tilesIn(i,r,n){let a=[],o=this.transform;if(!o)return a;let s="globe"===o.projection.name,l=aR(o.center.lng);for(let h in this._tiles){let u;let c=this._tiles[h];if(n&&c.clearQueryDebugViz(),!c.holdingForFade()){if(s){let i=c.tileID.canonical;if(0===i.z){let r=[Math.abs(w(l,...uO(i,-1))-l),Math.abs(w(l,...uO(i,1))-l)];u=[0,2*r.indexOf(Math.min(...r))-1]}else{let r=[Math.abs(w(l,...uO(i,-1))-l),Math.abs(w(l,...uO(i,0))-l),Math.abs(w(l,...uO(i,1))-l)];u=[r.indexOf(Math.min(...r))-1]}}else u=[0];for(let n of u){let s=i.containsTile(c,o,r,n);s&&a.push(s)}}}return a}getVisibleCoordinates(i){let r=this.getRenderableIds(i).map(i=>this._tiles[i].tileID);for(let i of r)i.projMatrix=this.transform.calculateProjMatrix(i.toUnwrapped());return r}hasTransition(){if(this._source.hasTransition())return!0;if(uF(this._source.type))for(let i in this._tiles){let r=this._tiles[i];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=Y.now())return!0}return!1}setFeatureState(i,r,n){this._state.updateState(i=i||"_geojsonTileLayer",r,n)}removeFeatureState(i,r,n){this._state.removeFeatureState(i=i||"_geojsonTileLayer",r,n)}getFeatureState(i,r){return this._state.getState(i=i||"_geojsonTileLayer",r)}setDependencies(i,r,n){let a=this._tiles[i];a&&a.setDependencies(r,n)}reloadTilesForDependencies(i,r){for(let n in this._tiles)this._tiles[n].hasDependency(i,r)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(i,r))}_preloadTiles(i,r){let n=new Map,a=Array.isArray(i)?i:[i],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize;for(let i of a){let r=i.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(let i of r)n.set(i.key,i);this.usedForTerrain&&i.updateElevation(!1)}S(Array.from(n.values()),(i,r)=>{let n=new ux(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(n,i=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),r(i,n)})},r)}}function uR(i,r){let n=Math.abs(2*i.wrap)-+(i.wrap<0),a=Math.abs(2*r.wrap)-+(r.wrap<0);return i.overscaledZ-r.overscaledZ||a-n||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function uF(i){return"raster"===i||"image"===i||"video"===i}function uO(i,r){let n=1<<i.z;return[i.x/n+r,(i.x+1)/n+r]}uB.maxOverzooming=10,uB.maxUnderzooming=3;class uU{constructor(i,r,n){this._demTile=i,this._dem=this._demTile.dem,this._scale=r,this._offset=n}static create(i,r,n){let a=n||i.findDEMTileFor(r);if(!a||!a.dem)return;let o=a.dem,s=a.tileID,l=1<<r.canonical.z-s.canonical.z;return new uU(a,a.tileSize/8192/l,[(r.canonical.x/l-s.canonical.x)*o.dim,(r.canonical.y/l-s.canonical.y)*o.dim])}tileCoordToPixel(i,r){let n=r*this._scale+this._offset[1],a=Math.floor(i*this._scale+this._offset[0]),o=Math.floor(n);return new f(a,o)}getElevationAt(i,r,n,a){let o=i*this._scale+this._offset[0],s=r*this._scale+this._offset[1],l=Math.floor(o),h=Math.floor(s),u=this._dem;return a=!!a,n?tG(tG(u.get(l,h,a),u.get(l,h+1,a),s-h),tG(u.get(l+1,h,a),u.get(l+1,h+1,a),s-h),o-l):u.get(l,h,a)}getElevationAtPixel(i,r,n){return this._dem.get(i,r,!!n)}getMeterToDEM(i){return(1<<this._demTile.tileID.canonical.z)*(1/aB(i))*this._dem.stride}}class uV{constructor(i,r){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new rf(8192,16,0),this.featureIndexArray=new n4,this.promoteId=r}insert(i,r,n,a,o,s=0){let l=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,a,o,s);let h=this.grid;for(let i=0;i<r.length;i++){let n=r[i],a=[1/0,1/0,-1/0,-1/0];for(let i=0;i<n.length;i++){let r=n[i];a[0]=Math.min(a[0],r.x),a[1]=Math.min(a[1],r.y),a[2]=Math.max(a[2],r.x),a[3]=Math.max(a[3],r.y)}a[0]<8192&&a[1]<8192&&a[2]>=0&&a[3]>=0&&h.insert(l,a[0],a[1],a[2],a[3])}}loadVTLayers(){if(!this.vtLayers)for(let i in this.vtLayers=new sw.VectorTile(new ls(this.rawTileData)).layers,this.sourceLayerCoder=new uh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[i]=[];return this.vtLayers}query(i,r,n,a){let o;this.loadVTLayers();let s=i.params||{},l=iK(s.filter),h=i.tileResult,u=i.transform,c=h.bufferedTilespaceBounds,p=this.grid.query(c.min.x,c.min.y,c.max.x,c.max.y,(i,r,n,a)=>a2(h.bufferedTilespaceGeometry,i,r,n,a));p.sort(uN);let d=null;u.elevation&&p.length>0&&(d=uU.create(u.elevation,this.tileID));let f={};for(let u=0;u<p.length;u++){let c=p[u];if(c===o)continue;o=c;let m=this.featureIndexArray.get(c),_=null;
8this.loadMatchingFeature(f,m,l,s.layers,s.availableImages,r,n,a,(r,n,a,o=0)=>(_||(_=aZ(r,this.tileID.canonical,i.tileTransform)),n.queryIntersectsFeature(h,r,a,_,this.z,i.transform,i.pixelPosMatrix,d,o)))}return f}loadMatchingFeature(i,r,n,a,o,s,l,h,u){let{featureIndex:c,bucketIndex:p,sourceLayerIndex:d,layoutVertexArrayOffset:f}=r,m=this.bucketLayerIDs[p];if(a&&!function(i,r){for(let n=0;n<i.length;n++)if(r.indexOf(i[n])>=0)return!0;return!1}(a,m))return;let _=this.sourceLayerCoder.decode(d),g=this.vtLayers[_].feature(c);if(n.needGeometry){let i=a$(g,!0);if(!n.filter(new ni(this.tileID.overscaledZ),i,this.tileID.canonical))return}else if(!n.filter(new ni(this.tileID.overscaledZ),g))return;let y=this.getId(g,_);for(let r=0;r<m.length;r++){let n=m[r];if(a&&0>a.indexOf(n))continue;let p=s[n];if(!p)continue;let d={};void 0!==y&&h&&(d=h.getState(p.sourceLayer||"_geojsonTileLayer",y));let _=A({},l[n]);_.paint=uj(_.paint,p.paint,g,d,o),_.layout=uj(_.layout,p.layout,g,d,o);let x=!u||u(g,p,d,f);if(!x)continue;let v=new uc(g,this.z,this.x,this.y,y);v.layer=_;let b=i[n];void 0===b&&(b=i[n]=[]),b.push({featureIndex:c,feature:v,intersectionZ:x})}}lookupSymbolFeatures(i,r,n,a,o,s,l,h){let u={};this.loadVTLayers();let c=iK(o);for(let o of i)this.loadMatchingFeature(u,{bucketIndex:n,sourceLayerIndex:a,featureIndex:o,layoutVertexArrayOffset:0},c,s,l,h,r);return u}loadFeature(i){let{featureIndex:r,sourceLayerIndex:n}=i;this.loadVTLayers();let a=this.sourceLayerCoder.decode(n),o=this.vtFeatures[a];if(o[r])return o[r];let s=this.vtLayers[a].feature(r);return o[r]=s,s}hasLayer(i){for(let r of this.bucketLayerIDs)for(let n of r)if(i===n)return!0;return!1}getId(i,r){let n=i.id;return this.promoteId&&"boolean"==typeof(n=i.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[r]])&&(n=Number(n)),n}}function uj(i,r,n,a,o){return B(i,(i,s)=>{let l=r instanceof nu?r.get(s):null;return l&&l.evaluate?l.evaluate(n,a,o):l})}function uN(i,r){return r-i}rg(uV,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class uG{constructor(i){let r={},n=[];for(let a in i){let o=i[a],s=r[a]={};for(let i in o.glyphs){let r=o.glyphs[+i];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;let a=r.metrics.localGlyph?2:1,l={x:0,y:0,w:r.bitmap.width+2*a,h:r.bitmap.height+2*a};n.push(l),s[i]=l}}let{w:a,h:o}=lI(n),s=new oG({width:a||1,height:o||1});for(let n in i){let a=i[n];for(let i in a.glyphs){let o=a.glyphs[+i];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;let l=r[n][i],h=o.metrics.localGlyph?2:1;oG.copy(o.bitmap,s,{x:0,y:0},{x:l.x+h,y:l.y+h},o.bitmap)}}this.image=s,this.positions=r}}rg(uG,"GlyphAtlas");class uZ{constructor(i){this.tileID=new sj(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.collectResourceTiming,this.returnDependencies=!!i.returnDependencies,this.promoteId=i.promoteId,this.enableTerrain=!!i.enableTerrain,this.isSymbolTile=i.isSymbolTile,this.tileTransform=hD(i.tileID.canonical,i.projection),this.projection=i.projection}parse(i,r,n,a,o){let s,l,h,u;this.status="parsing",this.data=i,this.collisionBoxArray=new nK;let c=new uh(Object.keys(i.layers).sort()),p=new uV(this.tileID,this.promoteId);p.bucketLayerIDs=[];let d={},m=new uo(256,256),g={featureIndex:p,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:m,availableImages:n},y=r.familiesBySource[this.source];for(let r in y){let a=i.layers[r];if(!a)continue;let o=!1,s=!1;for(let i of y[r])"symbol"===i[0].type?o=!0:s=!0;if(!0===this.isSymbolTile&&!o||!1===this.isSymbolTile&&!s)continue;1===a.version&&U(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let l=c.encode(r),h=[];for(let i=0;i<a.length;i++){let n=a.feature(i),o=p.getId(n,r);h.push({feature:n,id:o,index:i,sourceLayerIndex:l})}for(let i of y[r]){let r=i[0];void 0!==this.isSymbolTile&&"symbol"===r.type!==this.isSymbolTile||r.minzoom&&this.zoom<Math.floor(r.minzoom)||r.maxzoom&&this.zoom>=r.maxzoom||"none"!==r.visibility&&(u$(i,this.zoom,n),(d[r.id]=r.createBucket({index:
8p.bucketLayerIDs.length,layers:i,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:l,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:n})).populate(h,g,this.tileID.canonical,this.tileTransform),p.bucketLayerIDs.push(i.map(i=>i.id)))}}m.trim();let x={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},v=B(g.glyphDependencies,i=>Object.keys(i).map(Number));Object.keys(v).length?a.send("getGlyphs",{uid:this.uid,stacks:v},(i,r)=>{s||(s=i,l=r,T.call(this))},void 0,!1,x):l={};let b=Object.keys(g.iconDependencies);b.length?a.send("getImages",{icons:b,source:this.source,tileID:this.tileID,type:"icons"},(i,r)=>{s||(s=i,h=r,T.call(this))},void 0,!1,x):h={};let w=Object.keys(g.patternDependencies);function T(){if(s)return o(s);if(l&&h&&u){let i=new uG(l),r=new lM(h,u);for(let a in d){let o=d[a];o instanceof h5?(u$(o.layers,this.zoom,n),function(i,r,n,a,o,s,l,h,u,c){i.createArrays(),i.tilePixelRatio=8192/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;let p=i.layers[0].layout,d=i.layers[0]._unevaluatedLayout._values,m={};if("composite"===i.textSizeData.kind){let{minZoom:r,maxZoom:n}=i.textSizeData;m.compositeTextSizes=[d["text-size"].possiblyEvaluate(new ni(r),h),d["text-size"].possiblyEvaluate(new ni(n),h)]}if("composite"===i.iconSizeData.kind){let{minZoom:r,maxZoom:n}=i.iconSizeData;m.compositeIconSizes=[d["icon-size"].possiblyEvaluate(new ni(r),h),d["icon-size"].possiblyEvaluate(new ni(n),h)]}m.layoutTextSize=d["text-size"].possiblyEvaluate(new ni(u+1),h),m.layoutIconSize=d["icon-size"].possiblyEvaluate(new ni(u+1),h),m.textMaxSize=d["text-size"].possiblyEvaluate(new ni(18),h);let g="map"===p.get("text-rotation-alignment")&&"point"!==p.get("symbol-placement"),y=p.get("text-size");for(let s of i.features){let u=p.get("text-font").evaluate(s,{},h).join(","),d=y.evaluate(s,{},h),x=m.layoutTextSize.evaluate(s,{},h),v=(m.layoutIconSize.evaluate(s,{},h),{horizontal:{},vertical:void 0}),b=s.text,w,T=[0,0];if(b){let a=b.toString(),l=24*p.get("text-letter-spacing").evaluate(s,{},h),c=24*p.get("text-line-height").evaluate(s,{},h),f=!function(i){for(let n of i){var r;if(rT(r=n.charCodeAt(0))||rE(r)||rS(r)||rZ(r)||rW(r))return!1}return!0}(a)?0:l,m=p.get("text-anchor").evaluate(s,{},h),_=p.get("text-variable-anchor");if(!_){let i=p.get("text-radial-offset").evaluate(s,{},h);T=i?l6(m,[24*i,l5]):p.get("text-offset").evaluate(s,{},h).map(i=>24*i)}let y=g?"center":p.get("text-justify").evaluate(s,{},h),w=p.get("symbol-placement"),E="point"===w,S="point"===w?24*p.get("text-max-width").evaluate(s,{},h):0,I=s=>{i.allowVerticalPlacement&&rY(a)&&(v.vertical=lk(b,r,n,o,u,S,c,m,s,f,T,lC.vertical,!0,w,x,d))};if(!g&&_){let i="auto"===y?_.map(i=>l8(i)):[y],a=!1;for(let s=0;s<i.length;s++){let l=i[s];if(!v.horizontal[l]){if(a)v.horizontal[l]=v.horizontal[0];else{let i=lk(b,r,n,o,u,S,c,"center",l,f,T,lC.horizontal,!1,w,x,d);i&&(v.horizontal[l]=i,a=1===i.positionedLines.length)}}}I("left")}else{if("auto"===y&&(y=l8(m)),E||p.get("text-writing-mode").indexOf("horizontal")>=0||!rY(a)){let i=lk(b,r,n,o,u,S,c,m,y,f,T,lC.horizontal,!1,w,x,d);i&&(v.horizontal[y]=i)}I("point"===w?"left":y)}}let E=!1;if(s.icon&&s.icon.name){let r=a[s.icon.name];r&&(w=function(i,r,n){let{horizontalAlign:a,verticalAlign:o}=lU(n),s=r[0]-i.displaySize[0]*a,l=r[1]-i.displaySize[1]*o;return{image:i,top:l,bottom:l+i.displaySize[1],left:s,right:s+i.displaySize[0]}}(o[s.icon.name],p.get("icon-offset").evaluate(s,{},h),p.get("icon-anchor").evaluate(s,{},h)),E=r.sdf,void 0===i.sdfIcons?i.sdfIcons=r.sdf:i.sdfIcons!==r.sdf&&U("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(r.pixelRatio!==i.pixelRatio||0!==p.get("icon-rotate").constantOr(1))&&(i.iconsNeedLinear=!0))}let S=l7(v.horizontal)||v.vertical;i.iconsInText||(i.iconsInText=!!S&&S.iconsInText),(S||w)&&function(i,r,n,a,o,s,l,h,u,c,p,d,m){var g;let y,x=s.textMaxSize.evaluate(r,{},d);void 0===x&&(x=l);let v=i.layers[0].layout,b=v.get("icon-offset").evaluate(r,{},d),w=l7(n.horizontal)||n.vertical,T="globe"===m.name,E=l/24,S=i.tilePixelRatio*x/24,I=(g=i.overscaling,i.zoom>18&&g>2&&(g>>=1),Math.max(8192/(512*g),1)*v.get("symbol-spacing")),A=v.get("text-padding")*i.tilePixelRatio,M=v.get("icon-padding")*i.tilePixelRatio,C=v.get("text-max-angle")*_,z="map"===v.get("text-rotation-alignment")&&"point"!==v.get("symbol-placement"),P="map"===v.get("icon-rotation-alignment")&&"point"!==v.get("symbol-placement"),k=v.get("symbol-placement"),D=I/2,L=v.get("icon-text-fit");a&&"none"!==L&&(i.allowVerticalPlacement&&n.vertical&&(y=lj(a,n.vertical,L,v.get("icon-text-fit-padding"),b,E)),w&&(a=lj(a,w,L,v.get("icon-text-fit-padding"),b,E)));let B=(l,h,f)=>{if(h.x<0||h.x>=8192||h.y<0||h.y>=8192)return;let _=null;if(T){let{x:i,y:r,z:n}=m.projectTilePoint(h.x,h.y,f);_={anchor:new lN(i,r,n,0,void 0),up:m.upVector(f,h.x,h.y)}}!function(i,r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x,v,b,w,T,E,S,I){let A=i.addToLineVertexArray(r,a),M,C,z,P,k,D,L,B=0,R=0,F=0,O=0,V=-1,j=-1,N={},G=an(""),Z=n?n.anchor:r,$=0,q=0;if(void 0===u._unevaluatedLayout.getValue("text-radial-offset")?[$,q]=u.layout.get("text-offset").evaluate(w,{},I).map(i=>24*i):($=24*u.layout.get("text-radial-offset").evaluate(w,{},I),q=l5),i.allowVerticalPlacement&&o.vertical){let i=o.vertical;if(_)D=ht(i),h&&(L=ht(h));else{let n=u.layout.get("text-rotate").evaluate(w,{},I)+90;z=he(c,Z,r,p,d,f,i,m,n,g),h&&(P=he(c,Z,r,p,d,f,h,x,n))}}if(s){let a=u.layout.get("icon-rotate").evaluate(w,{},I),o="none"!==u.layout.get("icon-text-fit"),l=lK(s,a,E,o),m=h?lK(h,a,E,o):void 0;C=he(c,Z,r,p,d,f,s,x,a),B=4*l.length;let _=i.iconSizeData,g=null;"source"===_.kind?(g=[128*u.layout.get("icon-size").evaluate(w,{},I)])[0]>32640&&U(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===_.kind&&((g=[128*T.compositeIconSizes[0].evaluate(w,{},I),128*T.compositeIconSizes[1].evaluate(w,{},I)])[0]>32640||g[1]>32640)&&U(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),i.addSymbols(i.icon,l,g,b,v,w,!1,n,r,A.lineStartIndex,A.lineLength,-1,S,I),V=i.icon.placedSymbolArray.length-1,m&&(R=4*m.length,i.addSymbols(i.icon,m,g,b,v,w,lC.vertical,n,r,A.lineStartIndex,A.lineLength,-1,S,I),j=i.icon.placedSymbolArray.length-1)}for(let a in o.horizontal){let s=o.horizontal[a];M||(G=an(s.text),_?k=ht(s):M=he(c,Z,r,p,d,f,s,m,u.layout.get("text-rotate").evaluate(w,{},I),g));let h=1===s.positionedLines.length;
8if(F+=l9(i,n,r,s,l,u,_,w,g,A,o.vertical?lC.horizontal:lC.horizontalOnly,h?Object.keys(o.horizontal):[a],N,V,T,S,I),h)break}o.vertical&&(O+=l9(i,n,r,o.vertical,l,u,_,w,g,A,lC.vertical,["vertical"],N,j,T,S,I));let X=-1,W=(i,r)=>i?Math.max(i,r):r;X=W(k,X),X=W(D,X),X=W(L,X);let H=X>-1?1:0;i.glyphOffsetArray.length>=h5.MAX_GLYPHS&&U("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&i.addToSortKeyRanges(i.symbolInstances.length,w.sortKey),i.symbolInstances.emplaceBack(Z.x,Z.y,Z.z,r.x,r.y,N.right>=0?N.right:-1,N.center>=0?N.center:-1,N.left>=0?N.left:-1,N.vertical>=0?N.vertical:-1,V,j,G,void 0!==M?M:i.collisionBoxArray.length,void 0!==M?M+1:i.collisionBoxArray.length,void 0!==z?z:i.collisionBoxArray.length,void 0!==z?z+1:i.collisionBoxArray.length,void 0!==C?C:i.collisionBoxArray.length,void 0!==C?C+1:i.collisionBoxArray.length,P||i.collisionBoxArray.length,P?P+1:i.collisionBoxArray.length,p,F,O,B,R,H,0,$,q,X)}(i,h,_,l,n,a,o,y,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,A,z,u,0,M,P,b,r,s,c,p,d)};if("line"===k)for(let o of lq(r.geometry,0,0,8192,8192)){let r=function(i,r,n,a,o,s,l,h,u){let c=a?.6*s*l:0,p=l$(a,o),d=p*l,f=0===i[0].x||i[0].x===u||0===i[0].y||i[0].y===u;return r-d<r/4&&(r=d+r/4),function i(r,n,a,o,s,l,h,u,c){let p=l/2,d=lZ(r),f=0,m=n-a,_=[];for(let i=0;i<r.length-1;i++){let n=r[i],h=r[i+1],u=n.dist(h),g=h.angleTo(n);for(;m+a<f+u;){m+=a;let y=(m-f)/u,x=tG(n.x,h.x,y),v=tG(n.y,h.y,y);if(x>=0&&x<c&&v>=0&&v<c&&m-p>=0&&m+p<=d){let n=new lN(x,v,0,g,i);n._round(),o&&!lG(r,n,l,o,s)||_.push(n)}}f+=u}return u||_.length||h||(_=i(r,f/2,a,o,s,l,h,!0,c)),_}(i,f?r/2*h%r:(p/2+2*s)*l*h%r,r,c,n,d,f,!1,u)}(o,I,C,n.vertical||w,a,24,S,i.overscaling,8192);for(let n of r)w&&function(i,r,n,a){let o=i.compareText;if(r in o){let i=o[r];for(let r=i.length-1;r>=0;r--)if(a.dist(i[r])<n)return!0}else o[r]=[];return o[r].push(a),!1}(i,w.text,D,n)||B(o,n,d)}else if("line-center"===k){for(let i of r.geometry)if(i.length>1){let r=function(i,r,n,a,o,s){let l=n?.6*24*s:0,h=l$(n,a)*s,u=0,c=lZ(i)/2;for(let n=0;n<i.length-1;n++){let a=i[n],o=i[n+1],s=a.dist(o);if(u+s>c){let p=(c-u)/s,d=tG(a.x,o.x,p),f=tG(a.y,o.y,p),m=new lN(d,f,0,o.angleTo(a),n);return!l||lG(i,m,h,l,r)?m:void 0}u+=s}}(i,C,n.vertical||w,a,0,S);r&&B(i,r,d)}}else if("Polygon"===r.type)for(let i of so(r.geometry,0)){let r=function(i,r=1,n=!1){let a=1/0,o=1/0,s=-1/0,l=-1/0,h=i[0];for(let i=0;i<h.length;i++){let r=h[i];(!i||r.x<a)&&(a=r.x),(!i||r.y<o)&&(o=r.y),(!i||r.x>s)&&(s=r.x),(!i||r.y>l)&&(l=r.y)}let u=Math.min(s-a,l-o),c=u/2,p=new l0([],l2);if(0===u)return new f(a,o);for(let r=a;r<s;r+=u)for(let n=o;n<l;n+=u)p.push(new l3(r+c,n+c,c,i));let d=function(i){let r=0,n=0,a=0,o=i[0];for(let i=0,s=o.length,l=s-1;i<s;l=i++){let s=o[i],h=o[l],u=s.x*h.y-h.x*s.y;n+=(s.x+h.x)*u,a+=(s.y+h.y)*u,r+=3*u}return new l3(n/r,a/r,0,i)}(i),m=p.length;for(;p.length;){let a=p.pop();(a.d>d.d||!d.d)&&(d=a,n&&console.log("found best %d after %d probes",Math.round(1e4*a.d)/1e4,m)),a.max-d.d<=r||(c=a.h/2,p.push(new l3(a.p.x-c,a.p.y-c,c,i)),p.push(new l3(a.p.x+c,a.p.y-c,c,i)),p.push(new l3(a.p.x-c,a.p.y+c,c,i)),p.push(new l3(a.p.x+c,a.p.y+c,c,i)),m+=4)}return n&&(console.log(`num probes: ${m}`),console.log(`best distance: ${d.d}`)),d.p}(i,16);B(i[0],new lN(r.x,r.y,0,0,void 0),d)}else if("LineString"===r.type)for(let i of r.geometry)B(i,new lN(i[0].x,i[0].y,0,0,void 0),d);else if("Point"===r.type)for(let i of r.geometry)for(let r of i)B([r],new lN(r.x,r.y,0,0,void 0),d)}(i,s,v,w,a,m,x,0,T,E,l,h,c)}s&&i.generateCollisionDebugBuffers(u,i.collisionBoxArray)}(o,l,i.positions,h,r.iconPositions,this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection)):o.hasPattern&&(o instanceof sQ||o instanceof su||o instanceof sM)&&(u$(o.layers,this.zoom,n),o.addFeatures(g,this.tileID.canonical,r.patternPositions,n,this.tileTransform))}this.status="done",o(null,{buckets:I(d).filter(i=>!i.isEmpty()),featureIndex:p,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:m,imageAtlas:r,glyphMap:this.returnDependencies?l:null,iconMap:this.returnDependencies?h:null,glyphPositions:this.returnDependencies?i.positions:null})}}w.length?a.send("getImages",{icons:w,source:this.source,tileID:this.tileID,type:"patterns"},(i,r)=>{s||(s=i,u=r,T.call(this))},void 0,!1,x):u={},T.call(this)}}function u$(i,r,n){let a=new ni(r);for(let r of i)r.recalculate(a,n)}class uq{constructor(i){this.entries={}
8,this.scheduler=i}request(i,r,n,a){let o=this.entries[i]=this.entries[i]||{callbacks:[]};if(o.result){let[i,n]=o.result;return this.scheduler?this.scheduler.add(()=>{a(i,n)},r):a(i,n),()=>{}}return o.callbacks.push(a),o.cancel||(o.cancel=n((n,a)=>{for(let i of(o.result=[n,a],o.callbacks))this.scheduler?this.scheduler.add(()=>{i(n,a)},r):i(n,a);setTimeout(()=>delete this.entries[i],3e3)})),()=>{o.result||(o.callbacks=o.callbacks.filter(i=>i!==a),o.callbacks.length||(o.cancel(),delete this.entries[i]))}}}function uX(i,r,n){let a=JSON.stringify(i.request);return i.data&&(this.deduped.entries[a]={result:[null,i.data]}),this.deduped.request(a,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom},r=>{let a=eD(i.request,(i,a,o,s)=>{i?r(i):a&&r(null,{vectorTile:n?void 0:new sw.VectorTile(new ls(a)),rawData:a,cacheControl:o,expires:s})});return()=>{a.cancel(),r()}},r)}i.ARRAY_TYPE=a7,i.AUTH_ERR_MSG=en,i.Aabb=oB,i.Actor=class{constructor(i,r,n){this.target=i,this.parent=r,this.mapId=n,this.callbacks={},this.cancelCallbacks={},D(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=j()?i:p,this.scheduler=new ul}send(i,r,n,a,o=!1,s){let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=s,this.callbacks[l]=n);let h=Z(this.globalScope)?void 0:[];return this.target.postMessage({id:l,type:i,hasCallback:!!n,targetMapId:a,mustQueue:o,sourceMapId:this.mapId,data:rv(r,h)},h),{cancel:()=>{n&&delete this.callbacks[l],this.target.postMessage({id:l,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(i){let r=i.data,n=r.id;if(n&&(!r.targetMapId||this.mapId===r.targetMapId)){if("<cancel>"===r.type){let i=this.cancelCallbacks[n];delete this.cancelCallbacks[n],i&&i.cancel()}else if(r.mustQueue||j()){let i=this.callbacks[n];this.cancelCallbacks[n]=this.scheduler.add(()=>this.processTask(n,r),i&&i.metadata||{type:"message"})}else this.processTask(n,r)}}processTask(i,r){if("<response>"===r.type){let n=this.callbacks[i];delete this.callbacks[i],n&&(r.error?n(rb(r.error)):n(null,rb(r.data)))}else{let n=Z(this.globalScope)?void 0:[],a=r.hasCallback?(r,a)=>{delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:r?rv(r):null,data:rv(a,n)},n)}:i=>{},o=rb(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,o,a);else if(this.parent.getWorkerSource){let i=r.type.split(".");this.parent.getWorkerSource(r.sourceMapId,i[0],o.source)[i[1]](o,a)}else a(Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.CanonicalTileID=sU,i.Color=tr,i.ColorMode=uD,i.CullFaceMode=uL,i.DEMData=uC,i.DataConstantProperty=nc,i.DedupedRequest=uq,i.DepthMode=uP,i.EXTENT=8192,i.Elevation=class{isDataAvailableAtPoint(i){let r=this._source();if(!r||i.y<0||i.y>1)return!1;let n=r.getSource().maxzoom,a=1<<n,o=Math.floor(i.x),s=Math.floor((i.x-o)*a),l=Math.floor(i.y*a),h=this.findDEMTileFor(new sj(n,o,n,s,l));return!(!h||!h.dem)}
8getAtPointOrZero(i,r=0){return this.getAtPoint(i,r)||0}getAtPoint(i,r,n=!0){null==r&&(r=null);let a=this._source();if(!a||i.y<0||i.y>1)return r;let o=a.getSource().maxzoom,s=1<<o,l=Math.floor(i.x),h=i.x-l,u=new sj(o,l,o,Math.floor(h*s),Math.floor(i.y*s)),c=this.findDEMTileFor(u);if(!c||!c.dem)return r;let p=c.dem,d=1<<c.tileID.canonical.z,f=(h*d-c.tileID.canonical.x)*p.dim,m=(i.y*d-c.tileID.canonical.y)*p.dim,_=Math.floor(f),g=Math.floor(m);return(n?this.exaggeration():1)*tG(tG(p.get(_,g),p.get(_,g+1),m-g),tG(p.get(_+1,g),p.get(_+1,g+1),m-g),f-_)}getAtTileOffset(i,r,n){let a=1<<i.canonical.z;return this.getAtPointOrZero(new aj(i.wrap+(i.canonical.x+r/8192)/a,(i.canonical.y+n/8192)/a))}getAtTileOffsetFunc(i,r,n,a){return o=>{let s=this.getAtTileOffset(i,o.x,o.y),l=a.upVector(i.canonical,o.x,o.y);return ox(l,l,s*a.upVectorScale(i.canonical,r,n).metersToTile),l}}getForTilePoints(i,r,n,a){let o=uU.create(this,i,a);return!!o&&(r.forEach(i=>{i[2]=this.exaggeration()*o.getElevationAt(i[0],i[1],n)}),!0)}getMinMaxForTile(i){let r=this.findDEMTileFor(i);if(!r||!r.dem)return null;let n=r.dem.tree,a=r.tileID,o=1<<i.canonical.z-a.canonical.z,s=i.canonical.x/o-a.canonical.x,l=i.canonical.y/o-a.canonical.y,h=0;for(let r=0;r<i.canonical.z-a.canonical.z&&!n.leaves[h];r++){s*=2,l*=2;let i=2*Math.floor(l)+Math.floor(s);h=n.childOffsets[h]+i,s%=1,l%=1}return{min:this.exaggeration()*n.minimums[h],max:this.exaggeration()*n.maximums[h]}}getMinElevationBelowMSL(){throw Error("Pure virtual method called.")}raycast(i,r,n){throw Error("Pure virtual method called.")}pointCoordinate(i){throw Error("Pure virtual method called.")}_source(){throw Error("Pure virtual method called.")}exaggeration(){throw Error("Pure virtual method called.")}findDEMTileFor(i){throw Error("Pure virtual method called.")}get visibleDemTiles(){throw Error("Getter must be implemented in subclass.")}},i.ErrorEvent=ej,i.EvaluationParameters=ni,i.Event=eV,i.Evented=eN,i.FillExtrusionBucket=sM,i.Frustum=oL,i.FrustumCorners=oD,i.GLOBE_METERS_TO_ECEF=hs,i.GLOBE_RADIUS=ho,i.GLOBE_SCALE_MATCH_LATITUDE=45,i.GLOBE_ZOOM_THRESHOLD_MAX=6,i.GLOBE_ZOOM_THRESHOLD_MIN=5,i.GlobeSharedBuffers=class{constructor(i){this._createGrid(i),this._createPoles(i)}destroy(){for(let i of(this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy(),this._poleSegments))i.destroy();for(let i of this._gridSegments)i.destroy();if(this._wireframeIndexBuffer)for(let i of(this._wireframeIndexBuffer.destroy(),this._wireframeSegments))i.destroy()}_createGrid(i){let r=new nT,n=new nU;for(let i=0;i<65;i++)for(let n=0;n<65;n++)r.emplaceBack(n,i);this._gridSegments=[];for(let i=0,r=0;i<hl.length;i++){let a=hl[i];for(let i=0;i<a;i++)for(let r=0;r<64;r++){let a=65*i+r;n.emplaceBack(a+1,a,a+65),n.emplaceBack(a+65,a+65+1,a+1)}let o=64*a*2;this._gridSegments.push(aP.simpleSegment(0,r,(a+1)*65,o)),r+=o}this._gridBuffer=i.createVertexBuffer(r,ha.members),this._gridIndexBuffer=i.createIndexBuffer(n,!0)}_createPoles(i){let r=new nU;for(let i=0;i<=64;i++)r.emplaceBack(0,i+1,i+2);this._poleIndexBuffer=i.createIndexBuffer(r,!0);let n=new nG,a=new nG;this._poleSegments=[];for(let i=0,r=0;i<5;i++){let o=360/(1<<i);n.emplaceBack(0,-ho,0,.5,0),a.emplaceBack(0,-ho,0,.5,1);for(let i=0;i<=64;i++){let r=i/64,s=tG(0,o,r),[l,h,u]=hx(hz,hP,s,ho);n.emplaceBack(l,h,u,r,0),a.emplaceBack(l,h,u,r,1)}this._poleSegments.push(aP.simpleSegment(r,0,66,64)),r+=66}this._poleNorthVertexBuffer=i.createVertexBuffer(n,hr,!1),this._poleSouthVertexBuffer=i.createVertexBuffer(a,hr,!1)}getGridBuffers(i){return[this._gridBuffer,this._gridIndexBuffer,this._gridSegments[i]]}getPoleBuffers(i){return[this._poleNorthVertexBuffer,this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[i]]}getWirefameBuffers(i,r){if(!this._wireframeSegments){let r=new n$;this._wireframeSegments=[];for(let i=0,n=0;i<hl.length;i++){let a=hl[i];for(let i=0;i<a;i++)for(let n=0;n<64;n++){let a=65*i+n;r.emplaceBack(a,a+1),r.emplaceBack(a,a+65),r.emplaceBack(a,a+65+1)}let o=192*a;this._wireframeSegments.push(aP.simpleSegment(0,n,(a+1)*65,o)),n+=o}this._wireframeIndexBuffer=i.createIndexBuffer(r)}return[this._gridBuffer,this._wireframeIndexBuffer,this._wireframeSegments[r]]}},i.GlyphManager=lY,i.ImagePosition=lA,i.LineAtlas=uo,i.LngLat=aD,i.LngLatBounds=ak,i.LocalGlyphMode=lH,i.MAX_MERCATOR_LATITUDE=85.051129,i.MercatorCoordinate=aj,i.ONE_EM=24,i.OverscaledTileID=sj,i.Properties=n_,i.RGBAImage=oZ,i.Ray=ok,i.RequestManager=class{constructor(i,r,n){this._transformRequestFn=i,this._customAccessToken=r,this._silenceAuthErrors=!!n,this._createSkuToken()}_createSkuToken(){let i=function(){let i="";for(let r=0;r<10;r++)i+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",i].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}normalizeStyleURL(i,r){if(!ea(i))return i;let n=el(i);return n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!ea(i))return i;let n=el(i);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeSourceURL(i,r,n,a){if(!ea(i))return i;
8let o=el(i);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),n&&o.params.push(`language=${n}`),a&&o.params.push(`worldview=${a}`),this._makeAPIURL(o,this._customAccessToken||r)}normalizeSpriteURL(i,r,n,a){let o=el(i);return ea(i)?(o.path=`/styles/v1${o.path}/sprite${r}${n}`,this._makeAPIURL(o,this._customAccessToken||a)):(o.path+=`${r}${n}`,eh(o))}normalizeTileURL(i,r,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!ea(i))return i;let a=el(i);a.path=a.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||n&&"raster"!==a.authority&&512===n?"@2x":""}${J.supported?".webp":"$1"}`),"raster"===a.authority?a.path=`/${K.RASTER_URL_PREFIX}${a.path}`:(a.path=a.path.replace(/^.+\/v4\//,"/"),a.path=`/${K.TILE_URL_VERSION}${a.path}`);let o=this._customAccessToken||function(i){for(let r of i){let i=r.match(/^access_token=(.*)$/);if(i)return i[1]}return null}(a.params)||K.ACCESS_TOKEN;return K.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&a.params.push(`sku=${this._skuToken}`),this._makeAPIURL(a,o)}canonicalizeTileURL(i,r){let n=el(i);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return i;let a="mapbox://";n.path.match(/^\/raster\/v1\//)?a+=`raster/${n.path.replace(`/${K.RASTER_URL_PREFIX}/`,"")}`:a+=`tiles/${n.path.replace(`/${K.TILE_URL_VERSION}/`,"")}`;let o=n.params;return r&&(o=o.filter(i=>!i.match(/^access_token=/))),o.length&&(a+=`?${o.join("&")}`),a}canonicalizeTileset(i,r){let n=!!r&&ea(r),a=[];for(let r of i.tiles||[])eo(r)?a.push(this.canonicalizeTileURL(r,n)):a.push(r);return a}_makeAPIURL(i,r){let n="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",a=el(K.API_URL);if(i.protocol=a.protocol,i.authority=a.authority,"http"===i.protocol){let r=i.params.indexOf("secure");r>=0&&i.params.splice(r,1)}if("/"!==a.path&&(i.path=`${a.path}${i.path}`),!K.REQUIRE_ACCESS_TOKEN)return eh(i);if(r=r||K.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===r[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return i.params=i.params.filter(i=>-1===i.indexOf("access_token")),i.params.push(`access_token=${r||""}`),eh(i)}},i.ResourceType=eC,i.SegmentVector=aP,i.SourceCache=uB,i.StencilMode=uk,i.StructArrayLayout1ui2=nq,i.StructArrayLayout2f1f2i16=nR,i.StructArrayLayout2i4=nT,i.StructArrayLayout2ui4=n$,i.StructArrayLayout3f12=nO,i.StructArrayLayout3ui6=nU,i.StructArrayLayout4i8=nS,i.StructArrayLayout5f20=nG,i.Texture=ua,i.Tile=ux,i.Transitionable=na,i.Uniform1f=ah,i.Uniform1i=class extends al{constructor(i){super(i),this.current=0}set(i,r,n){this.fetchUniformLocation(i,r)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},i.Uniform2f=class extends al{constructor(i){super(i),this.current=[0,0]}set(i,r,n){this.fetchUniformLocation(i,r)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}},i.Uniform3f=class extends al{constructor(i){super(i),this.current=[0,0,0]}set(i,r,n){this.fetchUniformLocation(i,r)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}},i.Uniform4f=au,i.UniformColor=ac,i.UniformMatrix2f=class extends al{constructor(i){super(i),this.current=af}set(i,r,n){if(this.fetchUniformLocation(i,r)){for(let i=0;i<4;i++)if(n[i]!==this.current[i]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}}},i.UniformMatrix3f=class extends al{constructor(i){super(i),this.current=ad}set(i,r,n){if(this.fetchUniformLocation(i,r)){for(let i=0;i<9;i++)if(n[i]!==this.current[i]){this.current=n,this.gl.uniformMatrix3fv(this.location,!1,n);break}}}},i.UniformMatrix4f=class extends al{constructor(i){super(i),this.current=ap}set(i,r,n){if(this.fetchUniformLocation(i,r)){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let i=1;i<16;i++)if(n[i]!==this.current[i]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}},i.UnwrappedTileID=sV,i.ValidationError=iG,i.VectorTileWorkerSource=class extends eN{constructor(i,r,n,a,o){super(),this.actor=i,this.layerIndex=r,this.availableImages=n,this.loadVectorData=o||uX,this.loading={},this.loaded={},this.deduped=new uq(i.scheduler),this.isSpriteLoaded=a,this.scheduler
8=i.scheduler}loadTile(i,r){let n=i.uid,a=i&&i.request,o=a&&a.collectResourceTiming,s=this.loading[n]=new uZ(i);s.abort=this.loadVectorData(i,(l,h)=>{let u=!this.loading[n];if(delete this.loading[n],u||l||!h)return s.status="done",u||(this.loaded[n]=s),r(l);let c=h.rawData,p={};h.expires&&(p.expires=h.expires),h.cacheControl&&(p.cacheControl=h.cacheControl),s.vectorTile=h.vectorTile||new sw.VectorTile(new ls(c));let d=()=>{s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,(i,n)=>{if(i||!n)return r(i);let s={};if(o){let i=W(a);i.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(i)))}r(null,A({rawTileData:c.slice(0)},n,p,s))})};this.isSpriteLoaded?d():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(d,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):d()}),this.loaded=this.loaded||{},this.loaded[n]=s})}reloadTile(i,r){let n=this.loaded,a=i.uid,o=this;if(n&&n[a]){let s=n[a];s.showCollisionBoxes=i.showCollisionBoxes,s.enableTerrain=!!i.enableTerrain,s.projection=i.projection,s.tileTransform=hD(i.tileID.canonical,i.projection);let l=(i,n)=>{let a=s.reloadCallback;a&&(delete s.reloadCallback,s.parse(s.vectorTile,o.layerIndex,this.availableImages,o.actor,a)),r(i,n)};"parsing"===s.status?s.reloadCallback=l:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,l):l())}}abortTile(i,r){let n=i.uid,a=this.loading[n];a&&(a.abort&&a.abort(),delete this.loading[n]),r()}removeTile(i,r){let n=this.loaded,a=i.uid;n&&n[a]&&delete n[a],r()}},i.WritingMode=lC,i.ZoomHistory=rw,i.add=of,i.addDynamicAttributes=h1,i.adjoint=function(i,r){var n=r[0],a=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],p=r[8];return i[0]=l*p-h*c,i[1]=o*c-a*p,i[2]=a*h-o*l,i[3]=h*u-s*p,i[4]=n*p-o*u,i[5]=o*s-n*h,i[6]=s*c-l*u,i[7]=a*u-n*c,i[8]=n*l-a*s,i},i.asyncAll=S,i.bezier=v,i.bindAll=D,i.boundsAttributes=ug,i.bufferConvexPolygon=function(i,r){let n=[];for(let a=0;a<i.length;a++){let o=E(a-1,-1,i.length-1),s=E(a+1,-1,i.length-1),l=i[a],h=i[s],u=i[o].sub(l).unit(),c=h.sub(l).unit(),p=c.angleWithSep(u.x,u.y),d=u.add(c).unit().mult(-1*r/Math.sin(p/2));n.push(l.add(d))}return n},i.cacheEntryPossiblyAdded=function(i){++eM>eb&&(i.getActor().send("enforceCacheSizeLimit",ev),eM=0)},i.calculateGlobeLabelMatrix=function(i,r){let{x:n,y:a}=i.point,o=hI(n,a,i.worldSize/i._pixelsPerMercatorPixel,0,0);return or(o,o,hS(hf(r)))},i.calculateGlobeMatrix=function(i){let{x:r,y:n}=i.point,{lng:a,lat:o}=i._center;return hI(r,n,i.worldSize,a,o)},i.calculateGlobeMercatorMatrix=function(i){let r=i.pixelsPerMeter,n=r/(1/aB(i.center.lat)),a=ot(new Float64Array(16));return on(a,a,[i.point.x,i.point.y,0]),oa(a,a,[n,n,r]),Float32Array.from(a)},i.circumferenceAtLatitude=aB,i.clamp=w,i.clearTileCache=function(i){let r=eE(),n=[];for(let i in ew)r&&n.push(r.delete(i)),delete ew[i];i&&Promise.all(n).catch(i).then(()=>i())},i.clipLine=lq,i.clone=function(i){var r=new a7(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r},i.clone$1=F,i.collisionCircleLayout=s7,i.config=K,i.conjugate=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},i.create=function(){var i=new a7(16);return a7!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},i.create$1=oe,i.createExpression=iO,i.createLayout=nb,i.createStyleLayer=function(i){return"custom"===i.type?new ut(i):new un[i.type](i)},i.cross=oT,i.degToRad=function(i){return i*_},i.distance=function(i,r){return Math.hypot(r[0]-i[0],r[1]-i[1],r[2]-i[2])},i.div=function(i,r,n){return i[0]=r[0]/n[0],i[1]=r[1]/n[1],i[2]=r[2]/n[2],i},i.dot=ow,i.ease=b,i.easeCubicInOut=x,i.emitValidationErrors=rd,i.endsWith=L,i.enforceCacheSizeLimit=function(i){for(let r in ew)eS(r),ew[r].then(r=>{r.keys().then(n=>{for(let a=0;a<n.length-i;a++)r.delete(n[a])})})},i.evaluateSizeForFeature=lt,i.evaluateSizeForZoom=li,i.evaluateVariableOffset=l6,i.evented=r9,i.exactEquals=function(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]&&i[3]===r[3]},i.exactEquals$1=function(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]},i.exported=Y,i.exported$1=J,i.extend=A,i.extend$1=eZ,i.fillExtrusionHeightLift=sL,i.filterObject=R,i.fromMat4=function(i,r){return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[4],i[4]=r[5],i[5]=r[6],i[6]=r[8],i[7]=r[9],i[8]=r[10],i},i.fromQuat=function(i,r){var n=r[0],a=r[1],o=r[2],s=r[3],l=n+n,h=a+a,u=o+o,c=n*l,p=a*l,d=a*h,f=o*l,m=o*h,_=o*u,g=s*l,y=s*h,x=s*u;return i[0]=1-d-_,i[1]=p+x,i[2]=f-y,i[3]=0,i[4]=p-x,i[5]=1-c-_,i[6]=m+g,i[7]=0,i[8]=f+y,i[9]=m-g,i[10]=1-c-d,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},i.fromRotation=function(i,r){var n=Math.sin(r),a=Math.cos(r);return i[0]=a,i[1]=n,i[2]=0,i[3]=-n,i[4]=a,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},i.fromScaling=ol,i.furthestTileCorner=function(i){let r=Math.round((i+45+360)%360/90)%4;return y[r]},i.getAABBPointSquareDist=function(i,r,n){let a=0;for(let o=0;o<2;++o){let s=n?n[o]:0;i[o]>s&&(a+=(i[o]-s)*(i[o]-s)),r[o]<s&&(a+=(s-r[o])*(s-r[o]))}return a},i.getAnchorAlignment=lU,i.getAnchorJustification=l8,i.getBounds=function(i){let r=1/0,n=1/0,a=-1/0,o=-1/0;for(let s of i)r=Math.min(r,s.x),n=Math.min(n,s.y),a=Math.max(a,s.x),o=Math.max(o,s.y);return{min:new f(r,n),max:new f(a,o)}},i.getColumn=q,i.getGridMatrix=function(i,r,n){let a=r.getNorth(),o=r.getSouth(),s=r.getWest();return[0,(r.getEast()-s)*.015625,1<<i.z,(o-a)/hl[n],0,i.y,a,s,.015625]},i.getImage=eF,i.getJSON=function(i,r){return ek(A(i,{type:"json"}),r)},i.getLatitudinalLod=function(i){i=w(i,-80.051129,80.051129)/80.051129*90;let r=Math.pow(Math.abs(Math.sin(i*_)),3);return Math.round(r*(hl.length-1))},i.getMapSessionAPI=eg,i.getPerformanceMeasurement=W,i.getProjection=hY,i.getRTLTextPluginStatus=r7,i.getReferrer=eP,i.getTilePoint=function(i,{x:r,y:n},a=0){return new f(((r-a)*i.scale-i.x)*8192,(n*i.scale-i.y)*8192)},i.getTileVec3=function(i,r,n=0){return od(((r.x-n)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,r.z*aB(aU(r.y)))},i.getVideo=function(i,r){let n=p.document.createElement("video");n.muted=!0,n.onloadstart=function(){r(null,n)};for(let r=0;r<i.length;r++){let a=p.document.createElement("source");(function(i){let r=p.document.createElement("a");return r.href=i,r.protocol===p.document.location.protocol&&r.host===p.document.location.host})(i[r])||(n.crossOrigin="Anonymous"),a.src=i[r],n.appendChild(a)}return{cancel:()=>{}}}
8,i.globeCenterToScreenPoint=function(i){let r=[0,0,0],n=ot(new Float64Array(16));return or(n,i.pixelMatrix,i.globeMatrix),oE(r,r,n),new f(r[0],r[1])},i.globeDenormalizeECEF=hS,i.globeECEFOrigin=function(i,r){let n=[0,0,0];return oE(n,n,hE(hf(r.canonical))),oE(n,n,i),n},i.globeNormalizeECEF=hE,i.globePixelsToTileUnits=function(i,r){return 8192/(512*Math.pow(2,i))*hw(hf(r))},i.globePoleMatrixForTile=function(i,r,n){let a=ot(new Float64Array(16)),o=(r/(1<<i)-.5)*Math.PI*2;return os(a,n.globeMatrix,o),Float32Array.from(a)},i.globeTileBounds=hf,i.globeTiltAtLngLat=hM,i.globeToMercatorTransition=hA,i.globeUseCustomAntiAliasing=function(i,r,n){let a=hA(n.zoom),o=i.style.map._antialias,s=!!r.extStandardDerivatives,l=r.extStandardDerivativesForceOff||i.terrain&&i.terrain.exaggeration()>0;return 0===a&&!o&&!l&&s},i.identity=ot,i.identity$1=oC,i.invert=oi,i.isFullscreen=function(){return!!p.document.fullscreenElement||!!p.document.webkitFullscreenElement},i.isLngLatBehindGlobe=function(i,r){return hM(i,r)>Math.PI/2*1.01},i.isMapAuthenticated=function(i){return ey.has(i)},i.isMapboxURL=ea,i.isSafariWithAntialiasingBug=function(i){let r=i.navigator?i.navigator.userAgent:null;return!!Z(i)&&r&&(r.match("Version/15.4")||r.match("Version/15.5")||r.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},i.latFromMercatorY=aU,i.len=op,i.length=op,i.length$1=function(i){return Math.hypot(i[0],i[1],i[2],i[3])},i.loadVectorTile=uX,i.makeRequest=ek,i.mapValue=function(i,r,n,a,o){return w((i-r)/(n-r)*(o-a)+a,a,o)},i.mercatorScale=aV,i.mercatorXfromLng=aR,i.mercatorYfromLat=aF,i.mercatorZfromAltitude=function(i,r){return i/aB(r)},i.mul=or,i.mul$1=o_,i.multiply=or,i.multiply$1=function(i,r,n){var a=r[0],o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],p=r[7],d=r[8],f=n[0],m=n[1],_=n[2],g=n[3],y=n[4],x=n[5],v=n[6],b=n[7],w=n[8];return i[0]=f*a+m*l+_*c,i[1]=f*o+m*h+_*p,i[2]=f*s+m*u+_*d,i[3]=g*a+y*l+x*c,i[4]=g*o+y*h+x*p,i[5]=g*s+y*u+x*d,i[6]=v*a+b*l+w*c,i[7]=v*o+b*h+w*p,i[8]=v*s+b*u+w*d,i},i.multiply$2=o_,i.nextPowerOfTwo=P,i.normalize=ob,i.normalize$1=function(i,r){var n=r[0],a=r[1],o=r[2],s=r[3],l=n*n+a*a+o*o+s*s;return l>0&&(l=1/Math.sqrt(l)),i[0]=n*l,i[1]=a*l,i[2]=o*l,i[3]=s*l,i},i.number=tG,i.ortho=function(i,r,n,a,o,s,l){var h=1/(r-n),u=1/(a-o),c=1/(s-l);return i[0]=-2*h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*u,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*c,i[11]=0,i[12]=(r+n)*h,i[13]=(o+a)*u,i[14]=(l+s)*c,i[15]=1,i},i.pbf=ls,i.perspective=function(i,r,n,a,o){var s,l=1/Math.tan(r/2);return i[0]=l/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=l,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,null!=o&&o!==1/0?(i[10]=(o+a)*(s=1/(a-o)),i[14]=2*o*a*s):(i[10]=-1,i[14]=-2*a),i},i.pick=function(i,r){let n={};for(let a=0;a<r.length;a++){let o=r[a];o in i&&(n[o]=i[o])}return n},i.plugin=nt,i.pointGeometry=f,i.polygonContainsPoint=a1,i.polygonIntersectsBox=a2,i.polygonIntersectsPolygon=aH,i.polygonizeBounds=function(i,r,n=0,a=!0){let o=new f(n,n),s=i.sub(o),l=r.add(o),h=[s,new f(l.x,s.y),l,new f(s.x,l.y)];return a&&h.push(s.clone()),h},i.posAttributes=ha,i.postMapLoadEvent=em,i.postTurnstileEvent=ed,i.potpack=lI,i.prevPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.floor(Math.log(i)/Math.LN2))},i.radToDeg=function(i){return i*g},i.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],i.registerForPluginStateChange=function(i){return i({pluginStatus:r5,pluginURL:r4}),r9.on("pluginStateChange",i),i},i.removeAuthState=function(i){ey.delete(i)},i.renderColorRamp=oq,i.resample=aN,i.rotateX=oo,i.rotateX$1=oz,i.rotateY=os,i.rotateY$1=oP,i.rotateZ=function(i,r,n){var a=Math.sin(n),o=Math.cos(n),s=r[0],l=r[1],h=r[2],u=r[3],c=r[4],p=r[5],d=r[6],f=r[7];return r!==i&&(i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=s*o+c*a,i[1]=l*o+p*a,i[2]=h*o+d*a,i[3]=u*o+f*a,i[4]=c*o-s*a,i[5]=p*o-l*a,i[6]=d*o-h*a,i[7]=f*o-u*a,i},i.rotateZ$1=function(i,r,n){n*=.5;var a=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(n),u=Math.cos(n);return i[0]=a*u+o*h,i[1]=o*u-a*h,i[2]=s*u+l*h,i[3]=l*u-s*h,i},i.scale=oa,i.scale$1=oI,i.scale$2=ox,i.scaleAndAdd=ov,i.setCacheLimits=function(i,r){ev=i,eb=r},i.setColumn=function(i,r,n){i[4*r+0]=n[0],i[4*r+1]=n[1],i[4*r+2]=n[2],i[4*r+3]=n[3]},i.setRTLTextPlugin=function(i,r,n=!1){if(r5===r0||r5===r1||r5===r2)throw Error("setRTLTextPlugin cannot be called multiple times.");r4=Y.resolveURL(i),r5=r0,r3=r,r8(),n||ne()},i.smoothstep=T,i.spec=eG,i.storeAuthState=function(i,r){r?ey.add(i):ey.delete(i)},i.sub=om,i.subtract=om,i.symbolSize=lr,i.tileAABB=function(i,r,n,a,o,s,l,h,u){if("globe"===u.name)return function(i,r,n){let a=r/i.worldSize,o=Number.MAX_VALUE,s=[-o,-o,-o],l=[o,o,o],h=i.globeMatrix;if(n.z<=1)return h_(l,s,hf(n).getCorners(),h,a),new oB(l,s);let u=hg(n),c=hy(u);
8if(h_(l,s,c,h,a),u.contains(i.center)){s[2]=0;let r=i.point,n=[r.x*a,r.y*a,0];return og(l,l,n),oy(s,s,n),new oB(l,s)}let p=[h[12]*a,h[13]*a,h[14]*a],d=u.getCenter(),f=w(i.center.lat,-85.051129,85.051129),m=w(d.lat,-85.051129,85.051129),g=aR(i.center.lng),y=aF(f),x=g-aR(d.lng),v=y-aF(m);x>.5?x-=1:x<-.5&&(x+=1);let b=0;Math.abs(x)>Math.abs(v)?b=x>=0?1:3:(b=v>=0?0:2,ov(p,p,[h[4]*a,h[5]*a,h[6]*a],-Math.sin((v>=0?u.getSouth():u.getNorth())*_)*ho));let T=c[b],E=c[(b+1)%4],S=new hp(T,E,p),I=[hd(S,0)||T[0],hd(S,1)||T[1],hd(S,2)||T[2]];return l[2]=Math.min(T[2],E[2]),og(l,l,I),oy(s,s,I),new oB(l,s)}(i,r,new sU(n,a,o));let c=hD({z:n,x:a,y:o},u);return new oB([(s+c.x/c.scale)*r,r*(c.y/c.scale),l],[(s+c.x2/c.scale)*r,r*(c.y2/c.scale),h])},i.tileCornersToBounds=hg,i.tileTransform=hD,i.transformMat3=function(i,r,n){var a=r[0],o=r[1],s=r[2];return i[0]=a*n[0]+o*n[3]+s*n[6],i[1]=a*n[1]+o*n[4]+s*n[7],i[2]=a*n[2]+o*n[5]+s*n[8],i},i.transformMat4=oE,i.transformMat4$1=oA,i.transformQuat=oS,i.transitionTileAABBinECEF=hm,i.translate=on,i.transpose=function(i,r){if(i===r){var n=r[1],a=r[2],o=r[5];i[1]=r[3],i[2]=r[6],i[3]=n,i[5]=r[7],i[6]=a,i[7]=o}else i[0]=r[0],i[1]=r[3],i[2]=r[6],i[3]=r[1],i[4]=r[4],i[5]=r[7],i[6]=r[2],i[7]=r[5],i[8]=r[8];return i},i.triggerPluginCompletionEvent=r6,i.uniqueId=C,i.updateGlobeVertexNormal=function(i,r,n,a,o){let s=5*r+2;i.float32[s+0]=n,i.float32[s+1]=a,i.float32[s+2]=o},i.validateCustomStyleLayer=function(i){let r=[],n=i.id;return void 0===n&&r.push({message:`layers.${n}: missing required property "id"`}),void 0===i.render&&r.push({message:`layers.${n}: missing required method "render"`}),i.renderingMode&&"2d"!==i.renderingMode&&"3d"!==i.renderingMode&&r.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),r},i.validateFilter=i=>rp(i4(i)),i.validateFog=i=>rp(ra(i)),i.validateLayer=i=>rp(i7(i)),i.validateLight=i=>rp(rr(i)),i.validateSource=i=>rp(ri(i)),i.validateStyle=rh,i.validateTerrain=i=>rp(rn(i)),i.values=I,i.vectorTile=sw,i.version=H,i.warnOnce=U,i.window=p,i.wrap=E}),o(["./shared"],function(i){class r{constructor(i){this.keyCache={},i&&this.replace(i)}replace(i){this._layerConfigs={},this._layers={},this.update(i,[])}update(r,n){for(let n of r)this._layerConfigs[n.id]=n,(this._layers[n.id]=i.createStyleLayer(n)).compileFilter(),this.keyCache[n.id]&&delete this.keyCache[n.id];for(let i of n)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource={};let a=function(r,n){let a={};for(let o=0;o<r.length;o++){let s=n&&n[r[o].id]||function(r){let n="";for(let a of i.refProperties)n+=`/${function i(r){if("number"==typeof r||"boolean"==typeof r||"string"==typeof r||null==r)return JSON.stringify(r);if(Array.isArray(r)){let n="[";for(let a of r)n+=`${i(a)},`;return`${n}]`}let n="{";for(let a of Object.keys(r).sort())n+=`${a}:${i(r[a])},`;return`${n}}`}(r[a])}`;return n}(r[o]);n&&(n[r[o].id]=s);let l=a[s];l||(l=a[s]=[]),l.push(r[o])}let o=[];for(let i in a)o.push(a[i]);return o}(i.values(this._layerConfigs),this.keyCache);for(let i of a){let r=i.map(i=>this._layers[i.id]),n=r[0];if("none"===n.visibility)continue;let a=n.source||"",o=this.familiesBySource[a];o||(o=this.familiesBySource[a]={});let s=n.sourceLayer||"_geojsonTileLayer",l=o[s];l||(l=o[s]=[]),l.push(r)}}}class n{loadTile(r,n){let{uid:a,encoding:o,rawImageData:s,padding:l,buildQuadTree:h}=r,u=i.window.ImageBitmap&&s instanceof i.window.ImageBitmap?this.getImageData(s,l):s;n(null,new i.DEMData(a,u,o,l<1,h))}getImageData(i,r){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(i.width,i.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=i.width,this.offscreenCanvas.height=i.height,this.offscreenCanvasContext.drawImage(i,0,0,i.width,i.height);let n=this.offscreenCanvasContext.getImageData(-r,-r,i.width+2*r,i.height+2*r);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),n}}var a,o=function i(r,n){var a,o=r&&r.type;if("FeatureCollection"===o)for(a=0;a<r.features.length;a++)i(r.features[a],n);else if("GeometryCollection"===o)for(a=0;a<r.geometries.length;a++)i(r.geometries[a],n);else if("Feature"===o)i(r.geometry,n);else if("Polygon"===o)s(r.coordinates,n);else if("MultiPolygon"===o)for(a=0;a<r.coordinates.length;a++)s(r.coordinates[a],n);return r};function s(i,r){if(0!==i.length){l(i[0],r);for(var n=1;n<i.length;n++)l(i[n],!r)}}function l(i,r){for(var n=0,a=0,o=0,s=i.length,l=s-1;o<s;l=o++){var h=(i[o][0]-i[l][0])*(i[l][1]+i[o][1]),u=n+h;a+=Math.abs(n)>=Math.abs(h)?n-u+h:h-u+n,n=u}n+a>=0!=!!r&&i.reverse()}let h=i.vectorTile.VectorTileFeature.prototype.toGeoJSON;class u{constructor(r){this._feature=r,this.extent=i.EXTENT,this.type=r.type,this.properties=r.tags,"id"in r&&!isNaN(r.id)&&
8(this.id=parseInt(r.id,10))}loadGeometry(){if(1===this._feature.type){let r=[];for(let n of this._feature.geometry)r.push([new i.pointGeometry(n[0],n[1])]);return r}{let r=[];for(let n of this._feature.geometry){let a=[];for(let r of n)a.push(new i.pointGeometry(r[0],r[1]));r.push(a)}return r}}toGeoJSON(i,r,n){return h.call(this,i,r,n)}}class c{constructor(r){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=r.length,this._features=r}feature(i){return new u(this._features[i])}}var p=i.vectorTile.VectorTileFeature;function d(i,r){this.options=r||{},this.features=i,this.length=i.length}function f(i,r){this.id="number"==typeof i.id?i.id:void 0,this.type=i.type,this.rawGeometry=1===i.type?[i.geometry]:i.geometry,this.properties=i.tags,this.extent=r||4096}d.prototype.feature=function(i){return new f(this.features[i],this.options.extent)},f.prototype.loadGeometry=function(){var r=this.rawGeometry;this.geometry=[];for(var n=0;n<r.length;n++){for(var a=r[n],o=[],s=0;s<a.length;s++)o.push(new i.pointGeometry(a[s][0],a[s][1]));this.geometry.push(o)}return this.geometry},f.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var i=this.geometry,r=1/0,n=-1/0,a=1/0,o=-1/0,s=0;s<i.length;s++)for(var l=i[s],h=0;h<l.length;h++){var u=l[h];r=Math.min(r,u.x),n=Math.max(n,u.x),a=Math.min(a,u.y),o=Math.max(o,u.y)}return[r,a,n,o]},f.prototype.toGeoJSON=p.prototype.toGeoJSON;var m=_;function _(r){var n=new i.pbf;return function(i,r){for(var n in i.layers)r.writeMessage(3,g,i.layers[n])}(r,n),n.finish()}function g(i,r){r.writeVarintField(15,i.version||1),r.writeStringField(1,i.name||""),r.writeVarintField(5,i.extent||4096);var n,a={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<i.length;n++)a.feature=i.feature(n),r.writeMessage(2,y,a);var o=a.keys;for(n=0;n<o.length;n++)r.writeStringField(3,o[n]);var s=a.values;for(n=0;n<s.length;n++)r.writeMessage(4,b,s[n])}function y(i,r){var n=i.feature;void 0!==n.id&&r.writeVarintField(1,n.id),r.writeMessage(2,x,i),r.writeVarintField(3,n.type),r.writeMessage(4,v,n)}function x(i,r){var n=i.feature,a=i.keys,o=i.values,s=i.keycache,l=i.valuecache;for(var h in n.properties){var u=n.properties[h],c=s[h];if(null!==u){void 0===c&&(a.push(h),s[h]=c=a.length-1),r.writeVarint(c);var p=typeof u;"string"!==p&&"boolean"!==p&&"number"!==p&&(u=JSON.stringify(u));var d=p+":"+u,f=l[d];void 0===f&&(o.push(u),l[d]=f=o.length-1),r.writeVarint(f)}}}function v(i,r){for(var n=i.loadGeometry(),a=i.type,o=0,s=0,l=n.length,h=0;h<l;h++){var u=n[h],c=1;1===a&&(c=u.length),r.writeVarint((c<<3)+1);for(var p=3===a?u.length-1:u.length,d=0;d<p;d++){1===d&&1!==a&&r.writeVarint((p-1<<3)+2);var f=u[d].x-o,m=u[d].y-s;r.writeVarint(f<<1^f>>31),r.writeVarint(m<<1^m>>31),o+=f,s+=m}3===a&&r.writeVarint(15)}}function b(i,r){var n=typeof i;"string"===n?r.writeStringField(1,i):"boolean"===n?r.writeBooleanField(7,i):"number"===n&&(i%1!=0?r.writeDoubleField(3,i):i<0?r.writeSVarintField(6,i):r.writeVarintField(5,i))}function w(i,r,n,a){T(i,n,a),T(r,2*n,2*a),T(r,2*n+1,2*a+1)}function T(i,r,n){let a=i[r];i[r]=i[n],i[n]=a}function E(i,r,n,a){let o=i-n,s=r-a;return o*o+s*s}m.fromVectorTileJs=_,m.fromGeojsonVt=function(i,r){r=r||{};var n={};for(var a in i)n[a]=new d(i[a].features,r),n[a].name=a,n[a].version=r.version,n[a].extent=r.extent;return _({layers:n})},m.GeoJSONWrapper=d;let S=i=>i[0],I=i=>i[1];class A{constructor(i,r=S,n=I,a=64,o=Float64Array){this.nodeSize=a,this.points=i;let s=i.length<65536?Uint16Array:Uint32Array,l=this.ids=new s(i.length),h=this.coords=new o(2*i.length);for(let a=0;a<i.length;a++)l[a]=a,h[2*a]=r(i[a]),h[2*a+1]=n(i[a]);!function i(r,n,a,o,s,l){if(s-o<=a)return;let h=o+s>>1;(function i(r,n,a,o,s,l){for(;s>o;){if(s-o>600){let h=s-o+1,u=a-o+1,c=Math.log(h),p=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*p*(h-p)/h)*(u-h/2<0?-1:1);i(r,n,a,Math.max(o,Math.floor(a-u*p/h+d)),Math.min(s,Math.floor(a+(h-u)*p/h+d)),l)}let h=n[2*a+l],u=o,c=s;for(w(r,n,o,a),n[2*s+l]>h&&w(r,n,o,s);u<c;){for(w(r,n,u,c),u++,c--;n[2*u+l]<h;)u++;for(;n[2*c+l]>h;)c--}n[2*o+l]===h?w(r,n,o,c):w(r,n,++c,s),c<=a&&(o=c+1),a<=c&&(s=c-1)}}
8)(r,n,h,o,s,l%2),i(r,n,a,o,h-1,l+1),i(r,n,a,h+1,s,l+1)}(l,h,a,0,l.length-1,0)}range(i,r,n,a){return function(i,r,n,a,o,s,l){let h,u;let c=[0,i.length-1,0],p=[];for(;c.length;){let d=c.pop(),f=c.pop(),m=c.pop();if(f-m<=l){for(let l=m;l<=f;l++)h=r[2*l],u=r[2*l+1],h>=n&&h<=o&&u>=a&&u<=s&&p.push(i[l]);continue}let _=Math.floor((m+f)/2);h=r[2*_],u=r[2*_+1],h>=n&&h<=o&&u>=a&&u<=s&&p.push(i[_]);let g=(d+1)%2;(0===d?n<=h:a<=u)&&(c.push(m),c.push(_-1),c.push(g)),(0===d?o>=h:s>=u)&&(c.push(_+1),c.push(f),c.push(g))}return p}(this.ids,this.coords,i,r,n,a,this.nodeSize)}within(i,r,n){return function(i,r,n,a,o,s){let l=[0,i.length-1,0],h=[],u=o*o;for(;l.length;){let c=l.pop(),p=l.pop(),d=l.pop();if(p-d<=s){for(let o=d;o<=p;o++)E(r[2*o],r[2*o+1],n,a)<=u&&h.push(i[o]);continue}let f=Math.floor((d+p)/2),m=r[2*f],_=r[2*f+1];E(m,_,n,a)<=u&&h.push(i[f]);let g=(c+1)%2;(0===c?n-o<=m:a-o<=_)&&(l.push(d),l.push(f-1),l.push(g)),(0===c?n+o>=m:a+o>=_)&&(l.push(f+1),l.push(p),l.push(g))}return h}(this.ids,this.coords,i,r,n,this.nodeSize)}}let M={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:i=>i},C=Math.fround||(a=new Float32Array(1),i=>(a[0]=+i,a[0]));class z{constructor(i){this.options=B(Object.create(M),i),this.trees=Array(this.options.maxZoom+1)}load(i){let{log:r,minZoom:n,maxZoom:a,nodeSize:o}=this.options;r&&console.time("total time");let s=`prepare ${i.length} points`;r&&console.time(s),this.points=i;let l=[];for(let r=0;r<i.length;r++)i[r].geometry&&l.push(function(i,r){let[n,a]=i.geometry.coordinates;return{x:C(D(n)),y:C(L(a)),zoom:1/0,index:r,parentId:-1}}(i[r],r));this.trees[a+1]=new A(l,R,F,o,Float32Array),r&&console.timeEnd(s);for(let i=a;i>=n;i--){let n=+Date.now();l=this._cluster(l,i),this.trees[i]=new A(l,R,F,o,Float32Array),r&&console.log("z%d: %d clusters in %dms",i,l.length,+Date.now()-n)}return r&&console.timeEnd("total time"),this}getClusters(i,r){let n=((i[0]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,i[1])),o=180===i[2]?180:((i[2]+180)%360+360)%360-180,s=Math.max(-90,Math.min(90,i[3]));if(i[2]-i[0]>=360)n=-180,o=180;else if(n>o){let i=this.getClusters([n,a,180,s],r),l=this.getClusters([-180,a,o,s],r);return i.concat(l)}let l=this.trees[this._limitZoom(r)],h=l.range(D(n),L(s),D(o),L(a)),u=[];for(let i of h){let r=l.points[i];u.push(r.numPoints?P(r):this.points[r.index])}return u}getChildren(i){let r=this._getOriginId(i),n=this._getOriginZoom(i),a="No cluster with the specified id.",o=this.trees[n];if(!o)throw Error(a);let s=o.points[r];if(!s)throw Error(a);let l=this.options.radius/(this.options.extent*Math.pow(2,n-1)),h=o.within(s.x,s.y,l),u=[];for(let r of h){let n=o.points[r];n.parentId===i&&u.push(n.numPoints?P(n):this.points[n.index])}if(0===u.length)throw Error(a);return u}getLeaves(i,r,n){let a=[];return this._appendLeaves(a,i,r=r||10,n=n||0,0),a}getTile(i,r,n){let a=this.trees[this._limitZoom(i)],o=Math.pow(2,i),{extent:s,radius:l}=this.options,h=l/s,u=(n-h)/o,c=(n+1+h)/o,p={features:[]};return this._addTileFeatures(a.range((r-h)/o,u,(r+1+h)/o,c),a.points,r,n,o,p),0===r&&this._addTileFeatures(a.range(1-h/o,u,1,c),a.points,o,n,o,p),r===o-1&&this._addTileFeatures(a.range(0,u,h/o,c),a.points,-1,n,o,p),p.features.length?p:null}getClusterExpansionZoom(i){let r=this._getOriginZoom(i)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(i);if(r++,1!==n.length)break;i=n[0].properties.cluster_id}return r}_appendLeaves(i,r,n,a,o){let s=this.getChildren(r);for(let r of s){let s=r.properties;if(s&&s.cluster?o+s.point_count<=a?o+=s.point_count:o=this._appendLeaves(i,s.cluster_id,n,a,o):o<a?o++:i.push(r),i.length===n)break}return o}_addTileFeatures(i,r,n,a,o,s){for(let l of i){let i,h,u,c;let p=r[l],d=p.numPoints;if(d)i=k(p),h=p.x,u=p.y;else{let r=this.points[p.index];i=r.properties,h=D(r.geometry.coordinates[0]),u=L(r.geometry.coordinates[1])}let f={type:1,geometry:[[Math.round(this.options.extent*(h*o-n)),Math.round(this.options.extent*(u*o-a))]],tags:i};d?c=p.id:this.options.generateId?c=p.index:this.points[p.index].id&&(c=this.points[p.index].id),void 0!==c&&(f.id=c),s.features.push(f)}}_limitZoom(i){return Math.max(this.options.minZoom,Math.min(+i,this.options.maxZoom+1))}_cluster(i,r){let n=[],{radius:a,extent:o,reduce:s,minPoints:l}=this.options,h=a/(o*Math.pow(2,r));for(let a=0;a<i.length;a++){let o=i[a];if(o.zoom<=r)continue;o.zoom=r;let f=this.trees[r+1],m=f.within(o.x,o.y,h),_=o.numPoints||1,g=_;for(let i of m){let n=f.points[i];n.zoom>r&&(g+=n.numPoints||1)}if(g>_&&g>=l){var u,c,p,d;let i=o.x*_,l=o.y*_,h=s&&_>1?this._map(o,!0):null,y=(a<<5)+(r+1)+this.points.length;for(let n of m){let a=f.points[n];if(a.zoom<=r)continue;a.zoom=r;let u=a.numPoints||1;i+=a.x*u,l+=a.y*u,a.parentId=y,s&&(h||(h=this._map(o,!0)),s(h,this._map(a)))}o.parentId=y,n.push((u=i/g,c=l/g,p=g,d=h,{x:C(u),y:C(c),zoom:1/0,id:y,parentId:-1,numPoints:p,properties:d}))}else if(n.push(o),g>1)for(let i of m){let a=f.points[i];a.zoom<=r||(a.zoom=r,n.push(a))}}return n}_getOriginId(i){return i-this.points.length>>5}_getOriginZoom(i){return(i-this.points.length)%32}_map(i,r){if(i.numPoints)return r?B({},i.properties):i.properties;let n=this.points[i.index].properties,a=this.options.map(n);return r&&a===n?B({},a):a}}function P(i){return{type:"Feature",id:i.id,properties:k(i),geometry:{type:"Point",coordinates:[360*(i.x-.5),function(i){let r=(180-360*i)*Math.PI/180;return 360*Math.atan(Math.exp(r))/Math.PI-90}(i.y)]}}}function k(i){let r=i.numPoints,n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r;return B(B({},i.properties),{cluster:!0,cluster_id:i.id,point_count:r,point_count_abbreviated:n})}function D(i){return i/360+.5}function L(i){let r=Math.sin(i*Math.PI/180),n=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return n<0?0:n>1?1:n}function B(i,r){for(let n in r)i[n]=r[n];return i}function R(i){return i.x}
vendor: 10,310 bytes, line 8
8function F(i){return i.y}function O(i,r,n,a){var o={id:void 0===i?null:i,type:r,geometry:n,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(i){var r=i.geometry,n=i.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)U(i,r);else if("Polygon"===n||"MultiLineString"===n)for(var a=0;a<r.length;a++)U(i,r[a]);else if("MultiPolygon"===n)for(a=0;a<r.length;a++)for(var o=0;o<r[a].length;o++)U(i,r[a][o])}(o),o}function U(i,r){for(var n=0;n<r.length;n+=3)i.minX=Math.min(i.minX,r[n]),i.minY=Math.min(i.minY,r[n+1]),i.maxX=Math.max(i.maxX,r[n]),i.maxY=Math.max(i.maxY,r[n+1])}function V(i,r,n,a){if(r.geometry){var o=r.geometry.coordinates,s=r.geometry.type,l=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),h=[],u=r.id;if(n.promoteId?u=r.properties[n.promoteId]:n.generateId&&(u=a||0),"Point"===s)j(o,h);else if("MultiPoint"===s)for(var c=0;c<o.length;c++)j(o[c],h);else if("LineString"===s)N(o,h,l,!1);else if("MultiLineString"===s){if(n.lineMetrics){for(c=0;c<o.length;c++)N(o[c],h=[],l,!1),i.push(O(u,"LineString",h,r.properties));return}G(o,h,l,!1)}else if("Polygon"===s)G(o,h,l,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(c=0;c<r.geometry.geometries.length;c++)V(i,{id:u,geometry:r.geometry.geometries[c],properties:r.properties},n,a);return}throw Error("Input data is not a valid GeoJSON object.")}for(c=0;c<o.length;c++){var p=[];G(o[c],p,l,!0),h.push(p)}}i.push(O(u,s,h,r.properties))}}function j(i,r){var n;r.push(i[0]/360+.5),r.push(Z(i[1])),r.push(0)}function N(i,r,n,a){for(var o,s,l=0,h=0;h<i.length;h++){var u,c=i[h][0]/360+.5,p=Z(i[h][1]);r.push(c),r.push(p),r.push(0),h>0&&(l+=a?(o*p-c*s)/2:Math.sqrt(Math.pow(c-o,2)+Math.pow(p-s,2))),o=c,s=p}var d=r.length-3;r[2]=1,function i(r,n,a,o){for(var s,l=o,h=a-n>>1,u=a-n,c=r[n],p=r[n+1],d=r[a],f=r[a+1],m=n+3;m<a;m+=3){var _=function(i,r,n,a,o,s){var l=o-n,h=s-a;if(0!==l||0!==h){var u=((i-n)*l+(r-a)*h)/(l*l+h*h);u>1?(n=o,a=s):u>0&&(n+=l*u,a+=h*u)}return(l=i-n)*l+(h=r-a)*h}(r[m],r[m+1],c,p,d,f);if(_>l)s=m,l=_;else if(_===l){var g=Math.abs(m-h);g<u&&(s=m,u=g)}}l>o&&(s-n>3&&i(r,n,s,o),r[s+2]=l,a-s>3&&i(r,s,a,o))}(r,0,d,n),r[d+2]=1,r.size=Math.abs(l),r.start=0,r.end=r.size}function G(i,r,n,a){for(var o=0;o<i.length;o++){var s=[];N(i[o],s,n,a),r.push(s)}}function Z(i){var r=Math.sin(i*Math.PI/180),n=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return n<0?0:n>1?1:n}function $(i,r,n,a,o,s,l,h){if(a/=r,s>=(n/=r)&&l<a)return i;if(l<n||s>=a)return null;for(var u=[],c=0;c<i.length;c++){var p=i[c],d=p.geometry,f=p.type,m=0===o?p.minX:p.minY,_=0===o?p.maxX:p.maxY;if(m>=n&&_<a)u.push(p);else if(!(_<n||m>=a)){var g=[];if("Point"===f||"MultiPoint"===f)(function(i,r,n,a,o){for(var s=0;s<i.length;s+=3){var l=i[s+o];l>=n&&l<=a&&(r.push(i[s]),r.push(i[s+1]),r.push(i[s+2]))}})(d,g,n,a,o);else if("LineString"===f)q(d,g,n,a,o,!1,h.lineMetrics);else if("MultiLineString"===f)W(d,g,n,a,o,!1);else if("Polygon"===f)W(d,g,n,a,o,!0);else if("MultiPolygon"===f)for(var y=0;y<d.length;y++){var x=[];W(d[y],x,n,a,o,!0),x.length&&g.push(x)}if(g.length){if(h.lineMetrics&&"LineString"===f){for(y=0;y<g.length;y++)u.push(O(p.id,f,g[y],p.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===g.length?(f="LineString",g=g[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===g.length?"Point":"MultiPoint"),u.push(O(p.id,f,g,p.tags))}}}return u.length?u:null}function q(i,r,n,a,o,s,l){for(var h,u,c=X(i),p=0===o?Y:K,d=i.start,f=0;f<i.length-3;f+=3){var m=i[f],_=i[f+1],g=i[f+2],y=i[f+3],x=i[f+4],v=0===o?m:_,b=0===o?y:x,w=!1;l&&(h=Math.sqrt(Math.pow(m-y,2)+Math.pow(_-x,2))),v<n?b>n&&(u=p(c,m,_,y,x,n),l&&(c.start=d+h*u)):v>a?b<a&&(u=p(c,m,_,y,x,a),l&&(c.start=d+h*u)):H(c,m,_,g),b<n&&v>=n&&(u=p(c,m,_,y,x,n),w=!0),b>a&&v<=a&&(u=p(c,m,_,y,x,a),w=!0),!s&&w&&(l&&(c.end=d+h*u),r.push(c),c=X(i)),l&&(d+=h)}var T=i.length-3;m=i[T],_=i[T+1],g=i[T+2],(v=0===o?m:_)>=n&&v<=a&&H(c,m,_,g),T=c.length-3,s&&T>=3&&(c[T]!==c[0]||c[T+1]!==c[1])&&H(c,c[0],c[1],c[2]),c.length&&r.push(c)}function X(i){var r=[];return r.size=i.size,r.start=i.start,r.end=i.end,r}function W(i,r,n,a,o,s){for(var l=0;l<i.length;l++)q(i[l],r,n,a,o,s,!1)}function H(i,r,n,a){i.push(r),i.push(n),i.push(a)}function Y(i,r,n,a,o,s){var l=(s-r)/(a-r);return i.push(s),i.push(n+(o-n)*l),i.push(1),l}function K(i,r,n,a,o,s){var l=(s-n)/(o-n);return i.push(r+(a-r)*l),i.push(s),i.push(1),l}function J(i,r){for(var n=[],a=0;a<i.length;a++){var o,s=i[a],l=s.type;if("Point"===l||"MultiPoint"===l||"LineString"===l)o=Q(s.geometry,r);else if("MultiLineString"===l||"Polygon"===l){o=[];for(var h=0;h<s.geometry.length;h++)o.push(Q(s.geometry[h],r))}else if("MultiPolygon"===l)for(o=[],h=0;h<s.geometry.length;h++){for(var u=[],c=0;c<s.geometry[h].length;c++)u.push(Q(s.geometry[h][c],r));o.push(u)}n.push(O(s.id,l,o,s.tags))}return n}function Q(i,r){var n=[];n.size=i.size,void 0!==i.start&&(n.start=i.start,n.end=i.end);for(var a=0;a<i.length;a+=3)n.push(i[a]+r,i[a+1],i[a+2]);return n}function ee(i,r){if(i.transformed)return i;var n,a,o,s=1<<i.z,l=i.x,h=i.y;for(n=0;n<i.features.length;n++){var u=i.features[n],c=u.geometry,p=u.type;if(u.geometry=[],1===p)for(a=0;a<c.length;a+=2)u.geometry.push(et(c[a],c[a+1],r,s,l,h));else for(a=0;a<c.length;a++){var d=[];for(o=0;o<c[a].length;o+=2)d.push(et(c[a][o],c[a][o+1],r,s,l,h));u.geometry.push(d)}}return i.transformed=!0,i}function et(i,r,n,a,o,s){return[Math.round(n*(i*a-o)),Math.round(n*(r*a-s))]}function ei(i,r,n,a,o,s){var l=a*a;if(a>0&&r.size<(o?l:a))n.numPoints+=r.length/3;else{for(var h=[],u=0;u<r.length;u+=3)(0===a||r[u+2]>l)&&(n.numSimplified++,h.push(r[u]),h.push(r[u+1])),n.numPoints++;o&&function(i,r){for(var n=0,a=0,o=i.length,s=o-2;a<o;s=a,a+=2)n+=(i[a]-i[s])*(i[a+1]+i[s+1]);if(n>0===r)for(a=0,o=i.length;a<o/2;a+=2){var l=i[a],h=i[a+1];i[a]=i[o-2-a],i[a+1]=i[o-1-a],i[o-2-a]=l,i[o-1-a]=h}}(h,s),i.push(h)}}function er(i,r){var n,a,o,s,l,h,u=(r=this.options=function(i,r){for(var n in r)i[n]=r[n];return i}(Object.create(this.options),r)).debug;if(u&&console.time("preprocess data"),r.maxZoom<0||r.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw Error("promoteId and generateId cannot be used together.");var c=function(i,r){var n=[];if("FeatureCollection"===i.type)for(var a=0;a<i.features.length;a++)V(n,i.features[a],r,a);else V(n,"Feature"===i.type?i:{geometry:i},r);return n}(i,r);this.tiles={},this.tileCoords=[],u&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",r.indexMaxZoom,r.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=c,o=(a=r).buffer/a.extent,s=n,l=$(n,1,-1-o,o,0,-1,2,a),h=$(n,1,1-o,2+o,0,-1,2,a),(l||h)&&(s=$(n,1,-o,1+o,0,-1,2,a)||[],l&&(s=J(l,1).concat(s)),h&&(s=s.concat(J(h,-1)))),c=s).length&&this.splitTile(c,0,0,0),u&&(c.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 en(i,r,n){return 32*((1<<i)*n+r)+i}function ea(i,r){let n=i.tileID.canonical;if(!this._geoJSONIndex)return r(null,null);let a=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!a)return r(null,null);let o=new c(a.features),s=m(o);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),r(null,{vectorTile:o,rawData:s.buffer})}er.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},er.prototype.splitTile=function(i,r,n,a,o,s,l){for(var h=[i,r,n,a],u=this.options,c=u.debug;h.length;){a=h.pop(),n=h.pop(),r=h.pop(),i=h.pop();var p=1<<r,d=en(r,n,a),f=this.tiles[d];if(!f&&(c>1&&console.time("creation"),f=this.tiles[d]=function(i,r,n,a,o){for(var s=r===o.maxZoom?0:o.tolerance/((1<<r)*o.extent),l={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:a,z:r,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},h=0;h<i.length;h++){l.numFeatures++,function(i,r,n,a){var o=r.geometry,s=r.type,l=[];if("Point"===s||"MultiPoint"===s)for(var h=0;h<o.length;h+=3)l.push(o[h]),l.push(o[h+1]),i.numPoints++,i.numSimplified++;else if("LineString"===s)ei(l,o,i,n,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(h=0;h<o.length;h++)ei(l,o[h],i,n,"Polygon"===s,0===h);else if("MultiPolygon"===s)for(var u=0;u<o.length;u++){var c=o[u];for(h=0;h<c.length;h++)ei(l,c[h],i,n,!0,0===h)}if(l.length){var p=r.tags||null;if("LineString"===s&&a.lineMetrics){for(var d in p={},r.tags)p[d]=r.tags[d];p.mapbox_clip_start=o.start/o.size,p.mapbox_clip_end=o.end/o.size}var f={geometry:l,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:p};null!==r.id&&(f.id=r.id),i.features.push(f)}}(l,i[h],s,o);var u=i[h].minX,c=i[h].minY,p=i[h].maxX,d=i[h].maxY;u<l.minX&&(l.minX=u),c<l.minY&&(l.minY=c),p>l.maxX&&(l.maxX=p),d>l.maxY&&(l.maxY=d)}return l}(i,r,n,a,u),this.tileCoords.push({z:r,x:n,y:a}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,a,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var m="z"+r;this.stats[m]=(this.stats[m]||0)+1,this.total++}if(f.source=i,o){if(r===u.maxZoom||r===o)continue;var _=1<<o-r;if(n!==Math.floor(s/_)||a!==Math.floor(l/_))continue}else if(r===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue;if(f.source=null,0!==i.length){c>1&&console.time("clipping");var g,y,x,v,b,w,T=.5*u.buffer/u.extent,E=.5-T,S=.5+T,I=1+T;g=y=x=v=null,b=$(i,p,n-T,n+S,0,f.minX,f.maxX,u),w=$(i,p,n+E,n+I,0,f.minX,f.maxX,u),i=null,b&&(g=$(b,p,a-T,a+S,1,f.minY,f.maxY,u),y=$(b,p,a+E,a+I,1,f.minY,f.maxY,u),b=null),w&&(x=$(w,p,a-T,a+S,1,f.minY,f.maxY,u),v=$(w,p,a+E,a+I,1,f.minY,f.maxY,u),w=null),c>1&&console.timeEnd("clipping"),h.push(g||[],r+1,2*n,2*a),h.push(y||[],r+1,2*n,2*a+1),h.push(x||[],r+1,2*n+1,2*a),h.push(v||[],r+1,2*n+1,2*a+1)}}},er.prototype.getTile=function(i,r,n){var a=this.options,o=a.extent,s=a.debug;if(i<0||i>24)return null;var l=1<<i,h=en(i,r=(r%l+l)%l,n);if(this.tiles[h])return ee(this.tiles[h],o);s>1&&console.log("drilling down to z%d-%d-%d",i,r,n);for(var u,c=i,p=r,d=n;!u&&c>0;)c--,p=Math.floor(p/2),d=Math.floor(d/2),u=this.tiles[en(c,p,d)];return u&&u.source?(s>1&&console.log("found parent tile z%d-%d-%d",c,p,d),s>1&&console.time("drilling down"),this.splitTile(u.source,c,p,d,i,r,n
8),s>1&&console.timeEnd("drilling down"),this.tiles[h]?ee(this.tiles[h],o):null):null};class eo extends i.VectorTileWorkerSource{constructor(i,r,n,a,o){super(i,r,n,a,ea),o&&(this.loadGeoJSON=o)}loadData(r,n){let a=r&&r.request,s=a&&a.collectResourceTiming;this.loadGeoJSON(r,(l,h)=>{if(l||!h)return n(l);if("object"!=typeof h)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{o(h,!0);try{var u,c;if(r.filter){let n=i.createExpression(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===n.result)throw Error(n.value.map(i=>`${i.key}: ${i.message}`).join(", "));let a=h.features.filter(i=>n.value.evaluate({zoom:0},i));h={type:"FeatureCollection",features:a}}this._geoJSONIndex=r.cluster?new z(function({superclusterOptions:r,clusterProperties:n}){if(!n||!r)return r;let a={},o={},s={accumulated:null,zoom:0},l={properties:null},h=Object.keys(n);for(let r of h){let[s,l]=n[r],h=i.createExpression(l),u=i.createExpression("string"==typeof s?[s,["accumulated"],["get",r]]:s);a[r]=h.value,o[r]=u.value}return r.map=i=>{l.properties=i;let r={};for(let i of h)r[i]=a[i].evaluate(s,l);return r},r.reduce=(i,r)=>{for(let n of(l.properties=r,h))s.accumulated=i[n],i[n]=o[n].evaluate(s,l)},r}(r)).load(h.features):(u=h,c=r.geojsonVtOptions,new er(u,c))}catch(i){return n(i)}this.loaded={};let l={};if(s){let n=i.getPerformanceMeasurement(a);n&&(l.resourceTiming={},l.resourceTiming[r.source]=JSON.parse(JSON.stringify(n)))}n(null,l)}})}reloadTile(i,r){let n=this.loaded;return n&&n[i.uid]?super.reloadTile(i,r):this.loadTile(i,r)}loadGeoJSON(r,n){if(r.request)i.getJSON(r.request,n);else{if("string"!=typeof r.data)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));try{return n(null,JSON.parse(r.data))}catch(i){return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(i,r){try{r(null,this._geoJSONIndex.getClusterExpansionZoom(i.clusterId))}catch(i){r(i)}}getClusterChildren(i,r){try{r(null,this._geoJSONIndex.getChildren(i.clusterId))}catch(i){r(i)}}getClusterLeaves(i,r){try{r(null,this._geoJSONIndex.getLeaves(i.clusterId,i.limit,i.offset))}catch(i){r(i)}}}class es{constructor(r){this.self=r,this.actor=new i.Actor(r,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=i.getProjection({name:"mercator"}),this.workerSourceTypes={vector:i.VectorTileWorkerSource,geojson:eo},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(i,r)=>{if(this.workerSourceTypes[i])throw Error(`Worker source with name "${i}" already registered.`);this.workerSourceTypes[i]=r},this.self.registerRTLTextPlugin=r=>{if(i.plugin.isParsed())throw Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=r.applyArabicShaping,i.plugin.processBidirectionalText=r.processBidirectionalText,i.plugin.processStyledBidirectionalText=r.processStyledBidirectionalText}}clearCaches(i,r,n){delete this.layerIndexes[i],delete this.availableImages[i],delete this.workerSources[i],delete this.demWorkerSources[i],n()}checkIfReady(i,r,n){n()}setReferrer(i,r){this.referrer=r}spriteLoaded(r,n){for(let a in this.isSpriteLoaded[r]=n,this.workerSources[r]){let o=this.workerSources[r][a];for(let r in o)o[r]instanceof i.VectorTileWorkerSource&&(o[r].isSpriteLoaded=n,o[r].fire(new i.Event("isSpriteLoaded")))}}setImages(i,r,n){for(let n in this.availableImages[i]=r,this.workerSources[i]){let a=this.workerSources[i][n];for(let i in a)a[i].availableImages=r}n()}enableTerrain(i,r,n){this.terrain=r,n()}setProjection(r,n){this.projections[r]=i.getProjection(n)}setLayers(i,r,n){this.getLayerIndex(i).replace(r),n()}updateLayers(i,r,n){this.getLayerIndex(i).update(r.layers,r.removedIds),n()}loadTile(r,n,a){let o=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;o.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).loadTile(o,a)}loadDEMTile(r,n,a){let o=this.enableTerrain?i.extend({buildQuadTree:this.terrain},n):n;this.getDEMWorkerSource(r,n.source).loadTile(o,a)}reloadTile(r,n,a){let o=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;o.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).reloadTile(o,a)}abortTile(i,r,n){this.getWorkerSource(i,r.type,r.source).abortTile(r,n)}removeTile(i,r,n){this.getWorkerSource(i,r.type,r.source).removeTile(r,n)}
8removeSource(i,r,n){if(!this.workerSources[i]||!this.workerSources[i][r.type]||!this.workerSources[i][r.type][r.source])return;let a=this.workerSources[i][r.type][r.source];delete this.workerSources[i][r.type][r.source],void 0!==a.removeSource?a.removeSource(r,n):n()}loadWorkerSource(i,r,n){try{this.self.importScripts(r.url),n()}catch(i){n(i.toString())}}syncRTLPluginState(r,n,a){try{i.plugin.setState(n);let r=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&null!=r){this.self.importScripts(r);let n=i.plugin.isParsed();a(n?void 0:Error(`RTL Text Plugin failed to import scripts from ${r}`),n)}}catch(i){a(i.toString())}}getAvailableImages(i){let r=this.availableImages[i];return r||(r=[]),r}getLayerIndex(i){let n=this.layerIndexes[i];return n||(n=this.layerIndexes[i]=new r),n}getWorkerSource(i,r,n){return this.workerSources[i]||(this.workerSources[i]={}),this.workerSources[i][r]||(this.workerSources[i][r]={}),this.workerSources[i][r][n]||(this.workerSources[i][r][n]=new this.workerSourceTypes[r]({send:(r,n,a,o,s,l)=>{this.actor.send(r,n,a,i,s,l)},scheduler:this.actor.scheduler},this.getLayerIndex(i),this.getAvailableImages(i),this.isSpriteLoaded[i])),this.workerSources[i][r][n]}getDEMWorkerSource(i,r){return this.demWorkerSources[i]||(this.demWorkerSources[i]={}),this.demWorkerSources[i][r]||(this.demWorkerSources[i][r]=new n),this.demWorkerSources[i][r]}enforceCacheSizeLimit(r,n){i.enforceCacheSizeLimit(n)}getWorkerPerformanceMetrics(i,r,n){n(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new es(self)),es}),o(["./shared"],function(i){let r,n,a,o;function s(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let n=0;n<i.length;n++)if(!s(i[n],r[n]))return!1;return!0}if("object"==typeof i&&null!==i&&null!==r){if("object"!=typeof r||Object.keys(i).length!==Object.keys(r).length)return!1;for(let n in i)if(!s(i[n],r[n]))return!1;return!0}return i===r}function l(i){var r;return"undefined"!=typeof window&&"undefined"!=typeof document&&!!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 i,r,n=new Blob([""],{type:"text/javascript"}),a=URL.createObjectURL(n);try{r=new Worker(a),i=!0}catch(r){i=!1}return r&&r.terminate(),URL.revokeObjectURL(a),i}()&&"Uint8ClampedArray"in window&&!!ArrayBuffer.isView&&!!function(){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");if(!r)return!1;var n=r.getImageData(0,0,1,1);return n&&n.width===i.width}()&&(void 0===h[r=i&&i.failIfMajorPerformanceCaveat]&&(h[r]=function(i){var r,n,a,o=(r=document.createElement("canvas"),(n=Object.create(l.webGLContextAttributes)).failIfMajorPerformanceCaveat=i,r.getContext("webgl",n)||r.getContext("experimental-webgl",n));if(!o)return!1;try{a=o.createShader(o.VERTEX_SHADER)}catch(i){return!1}return!(!a||o.isContextLost())&&(o.shaderSource(a,"void main() {}"),o.compileShader(a),!0===o.getShaderParameter(a,o.COMPILE_STATUS))}(r)),!!h[r]&&!document.documentMode)}var h={};function u(r,n,a){let o=i.window.document.createElement(r);return void 0!==n&&(o.className=n),a&&a.appendChild(o),o}function c(r,n,a){let o=i.window.document.createElementNS("http://www.w3.org/2000/svg",r);for(let i of Object.keys(n))o.setAttributeNS(null,i,n[i]);return a&&a.appendChild(o),o}l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};let p=i.window.document&&i.window.document.documentElement.style,d=p&&void 0!==p.userSelect?"userSelect":"WebkitUserSelect";function f(){p&&d&&(r=p[d],p[d]="none")}function m(){p&&d&&(p[d]=r)}function _(r){r.preventDefault(),r.stopPropagation(),i.window.removeEventListener("click",_,!0)}function g(){i.window.addEventListener("click",_,!0),i.window.setTimeout(()=>{i.window.removeEventListener("click",_,!0)},0)}function y(i,r){let n=i.getBoundingClientRect();return b(i,n,r)}function x(i,r){let n=i.getBoundingClientRect(),a=[];for(let o=0;o<r.length;o++)a.push(b(i,n,r[o]));return a}function v(r){return void 0!==i.window.InstallTrigger&&2===r.button&&r.ctrlKey&&i.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:r.button}function b(r,n,a){let o=r.offsetWidth===n.width?1:r.offsetWidth/n.width;return new i.pointGeometry((a.clientX-n.left)*o,(a.clientY-n.top)*o)}function w(i,r){var n=r[0],a=r[1],o=r[2],s=r[3],l=n*s-o*a;return l?(i[0]=s*(l=1/l),i[1]=-a*l,i[2]=-o*l,i[3]=n*l,i):null}class T extends i.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(i){if(this.loaded!==i&&(this.loaded=i,i)){for(let{ids:i,callback:r}of this.requestors)this._notify(i,r);this.requestors=[]}}hasImage(i){return!!this.getImage(i)}getImage(i){return this.images[i]}
8addImage(i,r){this._validate(i,r)&&(this.images[i]=r)}_validate(r,n){let a=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "content" value`))),a=!1),a}_validateStretch(i,r){if(!i)return!0;let n=0;for(let a of i){if(a[0]<n||a[1]<a[0]||r<a[1])return!1;n=a[1]}return!0}_validateContent(i,r){return!(i&&(4!==i.length||i[0]<0||r.data.width<i[0]||i[1]<0||r.data.height<i[1]||i[2]<0||r.data.width<i[2]||i[3]<0||r.data.height<i[3]||i[2]<i[0]||i[3]<i[1]))}updateImage(i,r){r.version=this.images[i].version+1,this.images[i]=r,this.updatedImages[i]=!0}removeImage(i){let r=this.images[i];delete this.images[i],delete this.patterns[i],r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(i,r){let n=!0;if(!this.isLoaded())for(let r of i)this.images[r]||(n=!1);this.isLoaded()||n?this._notify(i,r):this.requestors.push({ids:i,callback:r})}_notify(r,n){let a={};for(let n of r){this.images[n]||this.fire(new i.Event("styleimagemissing",{id:n}));let r=this.images[n];r?a[n]={data:r.data.clone(),pixelRatio:r.pixelRatio,sdf:r.sdf,version:r.version,stretchX:r.stretchX,stretchY:r.stretchY,content:r.content,hasRenderCallback:Boolean(r.userImage&&r.userImage.render)}:i.warnOnce(`Image "${n}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,a)}getPixelSize(){let{width:i,height:r}=this.atlasImage;return{width:i,height:r}}getPattern(r){let n=this.patterns[r],a=this.getImage(r);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{let n={w:a.data.width+2,h:a.data.height+2,x:0,y:0},o=new i.ImagePosition(n,a);this.patterns[r]={bin:n,position:o}}return this._updatePatternAtlas(),this.patterns[r].position}bind(r){let n=r.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new i.Texture(r,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let r=[];for(let i in this.patterns)r.push(this.patterns[i].bin);let{w:n,h:a}=i.potpack(r),o=this.atlasImage;for(let r in o.resize({width:n||1,height:a||1}),this.patterns){let{bin:n}=this.patterns[r],a=n.x+1,s=n.y+1,l=this.images[r].data,h=l.width,u=l.height;i.RGBAImage.copy(l,o,{x:0,y:0},{x:a,y:s},{width:h,height:u}),i.RGBAImage.copy(l,o,{x:0,y:u-1},{x:a,y:s-1},{width:h,height:1}),i.RGBAImage.copy(l,o,{x:0,y:0},{x:a,y:s+u},{width:h,height:1}),i.RGBAImage.copy(l,o,{x:h-1,y:0},{x:a-1,y:s},{width:1,height:u}),i.RGBAImage.copy(l,o,{x:0,y:0},{x:a+h,y:s},{width:1,height:u})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(i){for(let r of i){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;let i=this.images[r];(function(i){let{userImage:r}=i;return!!(r&&r.render&&r.render())&&(i.data.replace(new Uint8Array(r.data.buffer)),!0)})(i)&&this.updateImage(r,i)}}}let E=new i.Properties({anchor:new i.DataConstantProperty(i.spec.light.anchor),position:new class{constructor(){this.specification=i.spec.light.position}possiblyEvaluate(r,n){return function([r,n,a]){let o=i.degToRad(n+90),s=i.degToRad(a);return{x:r*Math.cos(o)*Math.sin(s),y:r*Math.sin(o)*Math.sin(s),z:r*Math.cos(s),azimuthal:n,polar:a}}(r.expression.evaluate(n))}interpolate(r,n,a){return{x:i.number(r.x,n.x,a),y:i.number(r.y,n.y,a),z:i.number(r.z,n.z,a),azimuthal:i.number(r.azimuthal,n.azimuthal,a),polar:i.number(r.polar,n.polar,a)}}},color:new i.DataConstantProperty(i.spec.light.color),intensity:new i.DataConstantProperty(i.spec.light.intensity)}),S="-transition";class I extends i.Evented{constructor(r){super(),this._transitionable=new i.Transitionable(E),this.setLight(r),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(r,n={}
8){if(!this._validate(i.validateLight,r,n))for(let n in r){let a=r[n];i.endsWith(n,S)?this._transitionable.setTransition(n.slice(0,-S.length),a):this._transitionable.setValue(n,a)}}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,n,a){return(!a||!1!==a.validate)&&i.emitValidationErrors(this,r.call(i.validateStyle,i.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}let A=new i.Properties({source:new i.DataConstantProperty(i.spec.terrain.source),exaggeration:new i.DataConstantProperty(i.spec.terrain.exaggeration)}),M="-transition";class C extends i.Evented{constructor(r,n){super(),this._transitionable=new i.Transitionable(A),this.set(r),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=n}get(){return this._transitionable.serialize()}set(r){for(let n in r){let a=r[n];i.endsWith(n,M)?this._transitionable.setTransition(n.slice(0,-M.length),a):this._transitionable.setValue(n,a)}}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}}function z(r,n,a,o){let s=i.smoothstep(45,65,a),[l,h]=P(r,o),u=i.length(n),c=1-Math.min(1,Math.exp(-((u-l)/(h-l)*6)));return c*=c*c,(c=Math.min(1,1.00747*c))*s*r.alpha}function P(i,r){let n=.5/Math.tan(.5*r);return[i.range[0]+n,i.range[1]+n]}let k=new i.Properties({range:new i.DataConstantProperty(i.spec.fog.range),color:new i.DataConstantProperty(i.spec.fog.color),"high-color":new i.DataConstantProperty(i.spec.fog["high-color"]),"space-color":new i.DataConstantProperty(i.spec.fog["space-color"]),"horizon-blend":new i.DataConstantProperty(i.spec.fog["horizon-blend"]),"star-intensity":new i.DataConstantProperty(i.spec.fog["star-intensity"])}),D="-transition";class L extends i.Evented{constructor(r,n){super(),this._transitionable=new i.Transitionable(k),this.set(r),this._transitioning=this._transitionable.untransitioned(),this._transform=n}get state(){let r=this._transform,n="globe"===r.projection.name,a=i.globeToMercatorTransition(r.zoom),o=this.properties.get("range");return{range:n?[i.number(.5,o[0],a),i.number(3,o[1],a)]:o,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(r,n={}){if(!this._validate(i.validateFog,r,n)){for(let n of Object.keys(i.spec.fog))r&&void 0===r[n]&&(r[n]=i.spec.fog[n].default);for(let n in r){let a=r[n];i.endsWith(n,D)?this._transitionable.setTransition(n.slice(0,-D.length),a):this._transitionable.setValue(n,a)}}}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;let n=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:i.smoothstep(45,65,r))*n.a}getOpacityAtLatLng(r,n){return this._transform.projection.supportsFog?function(r,n,a){let o=i.MercatorCoordinate.fromLngLat(n),s=a.elevation?a.elevation.getAtPointOrZero(o):0,l=[o.x,o.y,s];return i.transformMat4(l,l,a.mercatorFogMatrix),z(r,l,a.pitch,a._fov)}(this.state,r,n):0}getFovAdjustedRange(i){return this._transform.projection.supportsFog?P(this.state,i):[0,1]}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,n,a){return(!a||!1!==a.validate)&&i.emitValidationErrors(this,r.call(i.validateStyle,i.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}class B{constructor(r,n){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=i.uniqueId();let a=this.workerPool.acquire(this.id);for(let i=0;i<a.length;i++){let r=new B.Actor(a[i],n,this.id);r.name=`Worker ${i}`,this.actors.push(r)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(r,n,a){i.asyncAll(this.actors,(i,a)=>{i.send(r,n,a)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}
8remove(){this.actors.forEach(i=>{i.remove()}),this.actors=[],this.workerPool.release(this.id)}}function R(r,n,a){return n*(i.EXTENT/(r.tileSize*Math.pow(2,a-r.tileID.overscaledZ)))}B.Actor=i.Actor;class F{constructor(i,r,n,a){this.screenBounds=i,this.cameraPoint=r,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=n,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,a)}static createFromScreenPoints(r,n){let a,o;if(r instanceof i.pointGeometry||"number"==typeof r[0]){let s=i.pointGeometry.convert(r);a=[i.pointGeometry.convert(r)],o=n.isPointAboveHorizon(s)}else{let s=i.pointGeometry.convert(r[0]),l=i.pointGeometry.convert(r[1]);a=[s,l],o=i.polygonizeBounds(s,l).every(i=>n.isPointAboveHorizon(i))}return new F(a,n.getCameraPoint(),o,n)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(r){return i.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){let n=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],o=i.polygonizeBounds(n,a,0,!1);return this.cameraPoint.y>a.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x<a.x?o.splice(3,0,this.cameraPoint):this.cameraPoint.x>=a.x?o[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(o[3]=this.cameraPoint)),i.bufferConvexPolygon(o,r)}bufferedCameraGeometryGlobe(r){let n=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],o=i.polygonizeBounds(n,a,r),s=this.cameraPoint.clone();switch(3*((s.y>n.y)+(s.y>a.y))+((s.x>n.x)+(s.x>a.x))){case 0:o[0]=s,o[4]=s.clone();break;case 1:o.splice(1,0,s);break;case 2:o[1]=s;break;case 3:o.splice(4,0,s);break;case 5:o.splice(2,0,s);break;case 6:o[3]=s;break;case 7:o.splice(3,0,s);break;case 8:o[2]=s}return o}containsTile(r,n,a,o=0){var s;let l=r.queryPadding/n._pixelsPerMercatorPixel+1,h=a?this._bufferedCameraMercator(l,n):this._bufferedScreenMercator(l,n),u=r.tileID.wrap+(h.unwrapped?o:0),c=h.polygon.map(n=>i.getTilePoint(r.tileTransform,n,u));if(!i.polygonIntersectsBox(c,0,0,i.EXTENT,i.EXTENT))return;u=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?o:0);let p=this.screenGeometryMercator.polygon.map(n=>i.getTileVec3(r.tileTransform,n,u)),d=p.map(r=>new i.pointGeometry(r[0],r[1])),f=n.getFreeCameraOptions().position||new i.MercatorCoordinate(0,0,0),m=i.getTileVec3(r.tileTransform,f,u),_=p.map(r=>{let n=i.sub(r,r,m);return i.normalize(n,n),new i.Ray(m,n)}),g=R(r,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:d,tilespaceRays:_,bufferedTilespaceGeometry:c,bufferedTilespaceBounds:((s=i.getBounds(c)).min.x=i.clamp(s.min.x,0,i.EXTENT),s.min.y=i.clamp(s.min.y,0,i.EXTENT),s.max.x=i.clamp(s.max.x,0,i.EXTENT),s.max.y=i.clamp(s.max.y,0,i.EXTENT),s),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:g}}_bufferedScreenMercator(i,r){let n=100*i|0;if(this._screenRaycastCache[n])return this._screenRaycastCache[n];{let a;return a="globe"===r.projection.name?this._projectAndResample(this.bufferedScreenGeometry(i),r):{polygon:this.bufferedScreenGeometry(i).map(i=>r.pointCoordinate3D(i)),unwrapped:!0},this._screenRaycastCache[n]=a,a}}_bufferedCameraMercator(i,r){let n=100*i|0;if(this._cameraRaycastCache[n])return this._cameraRaycastCache[n];{let a;return a="globe"===r.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(i),r):{polygon:this.bufferedCameraGeometry(i).map(i=>r.pointCoordinate3D(i)),unwrapped:!0},this._cameraRaycastCache[n]=a,a}}_projectAndResample(r,n){let a=function(r,n){let a=i.multiply([],n.pixelMatrix,n.globeMatrix),o=[0,-i.GLOBE_RADIUS,0,1],s=[0,i.GLOBE_RADIUS,0,1],l=[0,0,0,1];i.transformMat4$1(o,o,a),i.transformMat4$1(s,s,a),i.transformMat4$1(l,l,a);let h=new i.pointGeometry(o[0]/o[3],o[1]/o[3]),u=new i.pointGeometry(s[0]/s[3],s[1]/s[3]),c=i.polygonContainsPoint(r,h)&&o[3]<l[3],p=i.polygonContainsPoint(r,u)&&s[3]<l[3];if(!c&&!p)return null;let d=function(i,r,n){for(let a=1;a<i.length;a++){let o=U(r.pointCoordinate3D(i[a-1]).x),s=U(r.pointCoordinate3D(i[a]).x);if(n<0){if(o<s)return{idx:a,t:-o/(s-1-o)}}else if(s<o)return{idx:a,t:(1-o)/(s+1-o)}}return null}(r,n,c?-1:1);if(!d)return null;let{idx:f,t:m}=d,_=f>1?O(r.slice(0,f),n):[],g=f<r.length?O(r.slice(f),n):[];_=_.map(r=>new i.pointGeometry(U(r.x),r.y)),g=g.map(r=>new i.pointGeometry(U(r.x),r.y));let y=[..._];0===y.length&&y.push(g[g.length-1]);let x=i.number(y[y.length-1].y,(0===g.length?_[0]:g[0]).y,m);return y.push(...c?[new i.pointGeometry(0,x),new i.pointGeometry(0,0),new i.pointGeometry(1,0),new i.pointGeometry(1,x)]:[new i.pointGeometry(1,x),new i.pointGeometry(1,1),new i.pointGeometry(0,1),new i.pointGeometry(0,x)]),0===g.length?y.push(_[0]):y.push(...g),{polygon:y.map(r=>new i.MercatorCoordinate(r.x,r.y)),unwrapped:!1}}(r,n);if(a)return a;let o=function(r,n){let a=!1,o=-1/0,s=0;for(let i=0;i<r.length-1;i++)r[i].x>o&&(o=r[i].x,s=i);for(let i=0;i<r.length-1;i++){let n=(s+i)%(r.length-1),o=r[n],l=r[n+1];Math.abs(o.x-l.x)>.5&&(o.x<l.x?(o.x+=1,0===n&&(r[r.length-1].x+=1)):(l.x+=1,n+1===r.length-1&&(r[0].x+=1)),a=!0)}let l=i.mercatorXfromLng(n.center.lng);return a&&l<Math.abs(l-1)&&r.forEach(i=>
8{i.x-=1}),{polygon:r,unwrapped:a}}(O(r,n).map(r=>new i.pointGeometry(U(r.x),r.y)),n);return{polygon:o.polygon.map(r=>new i.MercatorCoordinate(r.x,r.y)),unwrapped:o.unwrapped}}}function O(r,n){return i.resample(r,i=>{let r=n.pointCoordinate3D(i);i.x=r.x,i.y=r.y},1/256)}function U(i){return i<0?1+i%1:i%1}function V(r,n,a,o,s){let l=function(a,o){if(a)return s(a);if(o){let a=i.pick(i.extend(o,r),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(a.vectorLayers=o.vector_layers,a.vectorLayerIds=a.vectorLayers.map(i=>i.id)),o.language_options&&(a.languageOptions=o.language_options),o.language&&o.language[o.id]&&(a.language=o.language[o.id]),o.worldview_options&&(a.worldviewOptions=o.worldview_options),o.worldview?a.worldview=o.worldview[o.id]:o.worldview_default&&(a.worldview=o.worldview_default),a.tiles=n.canonicalizeTileset(a,r.url),s(null,a)}};return r.url?i.getJSON(n.transformRequest(n.normalizeSourceURL(r.url,null,a,o),i.ResourceType.Source),l):i.exported.frame(()=>l(null,r))}class j{constructor(r,n,a){this.bounds=i.LngLatBounds.convert(this.validateBounds(r)),this.minzoom=n||0,this.maxzoom=a||24}
vendor: 4,938 bytes, line 8
8validateBounds(i){return Array.isArray(i)&&4===i.length?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}contains(r){let n=Math.pow(2,r.z),a=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*n),o=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*n),s=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*n),l=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*n);return r.x>=a&&r.x<s&&r.y>=o&&r.y<l}}class N{constructor(i,r,n){this.context=i;let a=i.gl;this.buffer=a.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||r.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){let r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let G={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Z{constructor(i,r,n,a){this.length=r.length,this.attributes=n,this.itemSize=r.bytesPerElement,this.dynamicDraw=a,this.context=i;let o=i.gl;this.buffer=o.createBuffer(),i.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||r.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){let r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,r){for(let n=0;n<this.attributes.length;n++){let a=r.attributes[this.attributes[n].name];void 0!==a&&i.enableVertexAttribArray(a)}}setVertexAttribPointers(i,r,n){for(let a=0;a<this.attributes.length;a++){let o=this.attributes[a],s=r.attributes[o.name];void 0!==s&&i.vertexAttribPointer(s,o.components,i[G[o.type]],!1,this.itemSize,o.offset+this.itemSize*(n||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ${constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class q extends ${getDefault(){return i.Color.transparent}set(i){let r=this.current;(i.r!==r.r||i.g!==r.g||i.b!==r.b||i.a!==r.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class X extends ${getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class W extends ${getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}class H extends ${getDefault(){return[!0,!0,!0,!0]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class Y extends ${getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class K extends ${getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class J extends ${getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){let r=this.current;(i.func!==r.func||i.ref!==r.ref||i.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class Q extends ${getDefault(){let i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class ee extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=i,this.dirty=!1}}class et extends ${getDefault(){return[0,1]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class ei extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=i,this.dirty=!1}}class er extends ${getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class en extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.BLEND):r.disable(r.BLEND),this.current=i,this.dirty=!1}}class ea extends ${getDefault(){let i=this.gl;return[i.ONE,i.ZERO]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||this.dirty)&&(this.gl.blendFunc(i[0],i[1]),this.current=i,this.dirty=!1)}}class eo extends ${getDefault(){return i.Color.transparent}set(i){let r=this.current;(i.r!==r.r||i.g!==r.g||i.b!==r.b||i.a!==r.a||this.dirty)&&(this.gl.blendColor
vendor: 7,850 bytes, line 8
8(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class es extends ${getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquation(i),this.current=i,this.dirty=!1)}}class el extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=i,this.dirty=!1}}class eh extends ${getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class eu extends ${getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}class ec extends ${getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}}class ep extends ${getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class ed extends ${getDefault(){let i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class ef extends ${getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class em extends ${getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class e_ extends ${getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class eg extends ${getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class ey extends ${getDefault(){return null}set(i){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class ex extends ${constructor(i){super(i),this.vao=i.extVertexArrayObject}getDefault(){return null}set(i){this.vao&&(i!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(i),this.current=i,this.dirty=!1)}}class ev extends ${getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class eb extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class ew extends ${getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class eT extends ${constructor(i,r){super(i),this.context=i,this.parent=r}getDefault(){return null}}class eE extends eT{setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class eS extends eT{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,this.attachment(),r.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class eI extends eS{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class eA{constructor(i,r,n,a){this.context=i,this.width=r,this.height=n;let o=this.framebuffer=i.gl.createFramebuffer();this.colorAttachment=new eE(i,o),a&&(this.depthAttachment=new eS(i,o))}destroy(){let i=this.context.gl,r=this.colorAttachment.get();if(r&&i.deleteTexture(r),this.depthAttachment){let r=this.depthAttachment.get();r&&i.deleteRenderbuffer(r)}i.deleteFramebuffer(this.framebuffer)}}class eM{constructor(i){this.gl=i,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new q(this),this.clearDepth=new X(this),this.clearStencil=new W(this),this.colorMask=new H(this),this.depthMask=new Y(this),this.stencilMask=new K(this),this.stencilFunc=new J(this),this.stencilOp=new Q(this),this.stencilTest=new ee(this),this.depthRange=new et(this),this.depthTest=new ei(this),this.depthFunc=new er(this),this.blend=new en(this),this.blendFunc=new ea(this),this.blendColor=new eo(this),this.blendEquation=new es(this),this.cullFace=new el(this),this.cullFaceSide=new eh(this),this.frontFace=new eu(this),this.program=new ec(this),this.activeTexture=new ep(this),this.viewport=new ed(this),this.bindFramebuffer=new ef(this),this.bindRenderbuffer=new em(this),this.bindTexture=new e_(this),this.bindVertexBuffer=new eg(this),this.bindElementBuffer=new ey(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new ex(this),this.pixelStoreUnpack=new ev(this),this.pixelStoreUnpackPremultiplyAlpha=new eb(this),this.pixelStoreUnpackFlipY=new ew(this),this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extStandardDerivativesForceOff=!1,this.extTextureHalfFloat=i.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(i.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=i.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=i.getExtension("OES_standard_derivatives"),this.extTimerQuery=i.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=i.getParameter(i.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(i,r){return new N(this,i,r)}createVertexBuffer(i,r,n){return new Z(this,i,r,n)}createRenderbuffer(i,r,n){let a=this.gl,o=a.createRenderbuffer();return this.bindRenderbuffer.set(o),a.renderbufferStorage(a.RENDERBUFFER,i,r,n),this.bindRenderbuffer.set(null),o}createFramebuffer(i,r,n){return new eA(this,i,r,n)}clear({color:i,depth:r,stencil:n}){let a=this.gl,o=0;
8i&&(o|=a.COLOR_BUFFER_BIT,this.clearColor.set(i),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(o|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),void 0!==n&&(o|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),a.clear(o)}setCullFace(i){!1===i.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(r){s(r.blendFunction,i.ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor)),this.colorMask.set(r.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class eC extends i.Evented{constructor(r,n,a,o){super(),this.id=r,this.dispatcher=a,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=i.extend({type:"raster"},n),i.extend(this,i.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=V(this._options,this.map._requestManager,null,null,(r,n)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(i.extend(this,n),n.bounds&&(this.tileBounds=new j(n.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(n.tiles),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(r,n){let a=i.exported.devicePixelRatio>=2,o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),a,this.tileSize);r.request=i.getImage(this.map._requestManager.transformRequest(o,i.ResourceType.Tile),(a,o,s,l)=>(delete r.request,r.aborted?(r.state="unloaded",n(null)):a?(r.state="errored",n(a)):o?(this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:s,expires:l}),r.setTexture(o,this.map.painter),r.state="loaded",i.cacheEntryPossiblyAdded(this.dispatcher),void n(null)):n(null)))}static loadTileData(i,r,n){i.setTexture(r,n)}static unloadTileData(i,r){i.texture&&r.saveTileTexture(i.texture)}abortTile(i,r){i.request&&(i.request.cancel(),delete i.request),r()}unloadTile(i,r){i.texture&&this.map.painter.saveTileTexture(i.texture),r()}hasTransition(){return!1}}function ez(r,n,a,o,s,l,h,u){let c=[r,a,s,n,o,l,1,1,1],p=[h,u,1],d=i.adjoint([],c),[f,m,_]=i.transformMat3(p,p,i.transpose(d,d));return i.multiply$1(c,[f,0,0,0,m,0,0,0,_],c)}class eP extends i.Evented{constructor(i,r,n,a){super(),this.id=i,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=r}load(r,n){this._loaded=n||!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),(n,a)=>{if(this._loaded=!0,n)this.fire(new i.ErrorEvent(n));else if(a){let{HTMLImageElement:n}=i.window;this.image=a instanceof n?i.exported.getImageData(a):a,this.width=this.image.width,this.height=this.image.height,r&&(this.coordinates=r),this._finishLoading()}})}loaded(){return this._loaded}updateImage(i){return this.image&&i.url&&(this.options.url=i.url,this.load(i.coordinates,this._loaded)),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}onRemove(){this.texture&&this.texture.destroy()}setCoordinates(r){this.coordinates=r,this._boundsArray=void 0;let n=r.map(i.MercatorCoordinate.fromLngLat);return this.tileID=function(r){let n=1/0,a=1/0,o=-1/0,s=-1/0;for(let i of r)n=Math.min(n,i.x),a=Math.min(a,i.y),o=Math.max(o,i.x),s=Math.max(s,i.y);let l=Math.max(o-n,s-a),h=Math.max(0,Math.floor(-Math.log(l)/Math.LN2)),u=Math.pow(2,h);return new i.CanonicalTileID(h,Math.floor((n+o)/2*u),Math.floor((a+s)/2*u))}(n),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(r){for(let i in this.tiles){let r=this.tiles[i];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}if(this._boundsArray)return;let n=i.tileTransform(this.tileID,this.map.transform.projection),[a,o,s,l]=this.coordinates.map(r=>{let a=n.projection.project(r[0],r[1]);return i.getTilePoint(n,a)._round()});this.perspectiveTransform=function(r,n,a,o,s,l,h,u,c,p){let d=ez(0,0,r,0,0,n,r,n),f=ez(a,o,s,l,h,u,c,p);return i.multiply$1(f,i.adjoint(d,d),f),[f[6]/f[8]*r/i.EXTENT,f[7]/f[8]*n/i.EXTENT]}(this.width,this.height,a.x,a.y,o.x,o.y,l.x,l.y,s.x,s.y);let h=this._boundsArray=new i.StructArrayLayout4i8;h.emplaceBack(a.x,a.y,0,0),h.emplaceBack(o.x,o.y,i.EXTENT,0),h.emplaceBack(l.x,l.y,0,i.EXTENT),h.emplaceBack(s.x,s.y,i.EXTENT,i.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=r.createVertexBuffer(h,i.boundsAttributes.members),this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let r=this.map.painter.context,n=r.gl;this.texture?this.texture.update(this.image):(this.texture=new i.Texture(r,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this._prepareData(r)}loadTile(i,r){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={},r(null)):(i.state="errored",r(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}let ek={vector:class extends i.Evented{constructor(r,n,a,o){if(super(),this.id=r,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(n,["url","scheme","tileSize","promoteId"])),this._options=i.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o),this._tileWorkers={},this._deduped=new i.DedupedRequest}load(r){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"}));let n=this.language||this.map._language,a=this.worldview||this.map._worldview;this._tileJSONRequest=V(this._options,this.map._requestManager,n,a,(o,s)=>{this._tileJSONRequest=null,this._loaded=!0,o?(n&&console.warn(`Ensure that your requested language string is a valid BCP-47 code. Found: ${n}`),a&&2!==a.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new i.ErrorEvent(o))):s&&(i.extend(this,s),s.bounds&&(this.tileBounds=new j(s.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(s.tiles,this.map._requestManager._customAccessToken),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))),r&&r(o)})}loaded(){return this._loaded}
8hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}setSourceProperty(i){this._tileJSONRequest&&this._tileJSONRequest.cancel(),i(),this.load(()=>{let i=this.map.style._getSourceCaches(this.id);for(let r of i)r.clearTiles()})}setTiles(i){return this.setSourceProperty(()=>{this._options.tiles=i}),this}setUrl(i){return this.setSourceProperty(()=>{this.url=i,this._options.url=i}),this}_setLanguage(i){return i===this.language||this.setSourceProperty(()=>{this.language=i}),this}_setWorldview(i){return i===this.worldview?this:this.worldviewOptions&&i&&!this.worldviewOptions[i]?(console.warn(`Vector tile source "${this.id}" does not support worldview "${i}".`),this):(this.setSourceProperty(()=>{this.worldview=i}),this)}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}loadTile(r,n){let a=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),o={request:this.map._requestManager.transformRequest(a,i.ResourceType.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile};if(o.request.collectResourceTiming=this._collectResourceTiming,r.actor&&"expired"!==r.state)"loading"===r.state?r.reloadCallback=n:r.request=r.actor.send("reloadTile",o,s.bind(this));else if(r.actor=this._tileWorkers[a]=this._tileWorkers[a]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",o,s.bind(this),void 0,!0);else{let n=i.loadVectorTile.call({deduped:this._deduped},o,(i,n)=>{i||!n?s.call(this,i):(o.data={cacheControl:n.cacheControl,expires:n.expires,rawData:n.rawData.slice(0)},r.actor&&r.actor.send("loadTile",o,s.bind(this),void 0,!0))},!0);r.request={cancel:n}}function s(a,o){return delete r.request,r.aborted?n(null):a&&404!==a.status?n(a):(o&&o.resourceTiming&&(r.resourceTiming=o.resourceTiming),this.map._refreshExpiredTiles&&o&&r.setExpiryData(o),r.loadVectorData(o,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.t
vendor: 4,102 bytes, line 8
8ype,source:this.id})}unloadTile(i){i.unloadVectorData(),i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:eC,"raster-dem":class extends eC{constructor(r,n,a,o){super(r,n,a,o),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(r,a){let o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function s(i,n){i&&(r.state="errored",a(i)),n&&(r.dem=n,r.dem.onDeserialize(),r.needsHillshadePrepare=!0,r.needsDEMTextureUpload=!0,r.state="loaded",a(null))}r.request=i.getImage(this.map._requestManager.transformRequest(o,i.ResourceType.Tile),(function(o,l,h,u){if(delete r.request,r.aborted)r.state="unloaded",a(null);else if(o)r.state="errored",a(o);else if(l){this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:h,expires:u});let a=i.window.ImageBitmap&&l instanceof i.window.ImageBitmap&&(null==n&&(n=i.window.OffscreenCanvas&&new i.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof i.window.createImageBitmap),n),o=1-(l.width-i.prevPowerOfTwo(l.width))/2;o<1||r.neighboringTiles||(r.neighboringTiles=this._getNeighboringTiles(r.tileID));let c=a?l:i.exported.getImageData(l,o),p={uid:r.uid,coord:r.tileID,source:this.id,rawImageData:c,encoding:this.encoding,padding:o};r.actor&&"expired"!==r.state||(r.actor=this.dispatcher.getActor(),r.actor.send("loadDEMTile",p,s.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(r){let n=r.canonical,a=Math.pow(2,n.z),o=(n.x-1+a)%a,s=0===n.x?r.wrap-1:r.wrap,l=(n.x+1+a)%a,h=n.x+1===a?r.wrap+1:r.wrap,u={};return u[new i.OverscaledTileID(r.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},u[new i.OverscaledTileID(r.overscaledZ,h,n.z,l,n.y).key]={backfilled:!1},n.y>0&&(u[new i.OverscaledTileID(r.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1},u[new i.OverscaledTileID(r.overscaledZ,r.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},u[new i.OverscaledTileID(r.overscaledZ,h,n.z,l,n.y-1).key]={backfilled:!1}),n.y+1<a&&(u[new i.OverscaledTileID(r.overscaledZ,s,n.z,o,n.y+1).key]={backfilled:!1},u[new i.OverscaledTileID(r.overscaledZ,r.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},u[new i.OverscaledTileID(r.overscaledZ,h,n.z,l,n.y+1).key]={backfilled:!1}),u}unloadTile(i){i.demTexture&&this.map.painter.saveTileTexture(i.demTexture),i.fbo&&(i.fbo.destroy(),delete i.fbo),i.dem&&delete i.dem,delete i.neighboringTiles,i.state="unloaded"}},geojson:class extends i.Evented{constructor(r,n,a,o){super(),this.id=r,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=a.getActor(),this.setEventedParent(o),this._data=n.data,this._options=i.extend({},n),this._collectResourceTiming=n.collectResourceTiming,void 0!==n.maxzoom&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;let s=i.EXTENT/this.tileSize;this.workerOptions=i.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(void 0!==n.buffer?n.buffer:128)*s,tolerance:(void 0!==n.tolerance?n.tolerance:.375)*s,extent:i.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:void 0!==n.clusterMaxZoom?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:i.EXTENT,radius:(void 0!==n.clusterRadius?n.clusterRadius:50)*s,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}onAdd(i){this.map=i,this.setData(this._data)}setData(i){return this._data=i,this._updateWorkerData(),this}getClusterExpansionZoom(i,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:i,source:this.id},r),this}getClusterChildren(i,r){return this.actor.send("geojson.getClusterChildren",{clusterId:i,source:this.id},r),this}getClusterLeaves(i,r,n,a){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:i,limit:r,offset:n},a),this}
8_updateWorkerData(){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new i.Event("dataloading",{dataType:"source"})),this._loaded=!1;let r=i.extend({},this.workerOptions),n=this._data;"string"==typeof n?(r.request=this.map._requestManager.transformRequest(i.exported.resolveURL(n),i.ResourceType.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,r,(r,n)=>{if(this._loaded=!0,this._pendingLoad=null,r)this.fire(new i.ErrorEvent(r));else{let r={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(r.resourceTiming=n.resourceTiming[this.id]),this.fire(new i.Event("data",r)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(r,n){let a=r.actor?"reloadTile":"loadTile";r.actor=this.actor,r.request=this.actor.send(a,{type:this.type,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(i,o)=>(delete r.request,r.unloadVectorData(),r.aborted?n(null):i?n(i):(r.loadVectorData(o,this.map.painter,"reloadTile"===a),n(null))),void 0,"loadTile"===a)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.aborted=!0}unloadTile(i){i.unloadVectorData(),this.actor.send("removeTile",{uid:i.uid,type:this.t
8ype,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return i.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends eP{constructor(i,r,n,a){super(i,r,n,a),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;let r=this.options;for(let n of(this.urls=[],r.urls))this.urls.push(this.map._requestManager.transformRequest(n,i.ResourceType.Source).url);i.getVideo(this.urls,(r,n)=>{this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(this.video=n,this.video.loop=!0,this.video.setAttribute("playsinline",""),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(r){if(this.video){let n=this.video.seekable;r<n.start(0)||r>n.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}
8onAdd(i){this.map||(this.map=i,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let r=this.map.painter.context,n=r.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture(r,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(r)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:eP,canvas:class extends eP{constructor(r,n,a,o){super(r,n,a,o),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(i=>!Array.isArray(i)||2!==i.length||i.some(i=>"number"!=typeof i))||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof i.window.HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,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 i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(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(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let n=this.map.painter.context;this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(n,this.canvas,n.gl.RGBA,{premultiply:!0}),this._prepareData(n)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let i of[this.canvas.width,this.canvas.height])if(isNaN(i)||i<=0)return!0;return!1}},custom:class extends i.Evented{constructor(r,n,a,o){super(),this.id=r,this.type="custom",this._dataType="raster",this._dispatcher=a,this._implementation=n,this.setEventedParent(o),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.ErrorEvent(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.ErrorEvent(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new j(this._implementation.bounds,this.minzoom,this.maxzoom)),n.update=this._update.bind(this),n.coveringTiles=this._coveringTiles.bind(this),i.extend(this,i.pick(n,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return i.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(r){this._map=r,this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(r),this.load()}onRemove(i){this._implementation.onRemove&&this._implementation.onRemove(i)}hasTile(i){if(this._implementation.hasTile){let{x:r,y:n,z:a}=i.canonical;return this._implementation.hasTile({x:r,y:n,z:a})}
8return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(r,n){let{x:a,y:o,z:s}=r.tileID.canonical,l=new i.window.AbortController,h=this._implementation.loadTile({x:a,y:o,z:s},{signal:l.signal});if(!h)return this.loadTileData(r,{width:this.tileSize,height:this.tileSize,data:null}),r.state="loaded",n(null);h.cancel=()=>l.abort(),r.request=h.then((function(a){return delete r.request,r.aborted?(r.state="unloaded",n(null)):a?a instanceof i.window.ImageData||a instanceof i.window.ImageBitmap||a instanceof i.window.HTMLCanvasElement?(this.loadTileData(r,a),r.state="loaded",void n(null)):(r.state="errored",n(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`))):(this.loadTileData(r,{width:this.tileSize,height:this.tileSize,data:null}),r.state="loaded",n(null))}).bind(this)).catch(i=>{20!==i.code&&(r.state="errored",n(i))})}loadTileData(i,r){eC.loadTileData(i,r,this._map.painter)}unloadTileData(i){eC.unloadTileData(i,this._map.painter)}prepareTile(i){if(!this._implementation.prepareTile)return null;let{x:r,y:n,z:a}=i.tileID.canonical,o=this._implementation.prepareTile({x:r,y:n,z:a});return o?(this.loadTileData(i,o),i.state="loaded",o):null}unloadTile(i,r){if(this.unloadTileData(i),this._implementation.unloadTile){let{x:r,y:n,z:a}=i.tileID.canonical;this._implementation.unloadTile({x:r,y:n,z:a})}r()}abortTile(i,r){i.request&&i.request.cancel&&(i.request.cancel(),delete i.request),r()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(i=>({x:i.canonical.x,y:i.canonical.y,z:i.canonical.z}))}_update(){this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))}}},eD=function(r,n,a,o){let s=new ek[n.type](r,n,a,o);if(s.id!==r)throw Error(`Expected Source id to be ${r} instead of ${s.id}`);return i.bindAll(["load","abort","unload","serialize","prepare"],s),s};function eL(i,r){let n=i.tileID,a=r.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}function eB(){return null!=ne.workerClass?new ne.workerClass:new i.window.Worker(ne.workerUrl)}let eR="mapboxgl_preloaded_worker_pool";class eF{constructor(){this.active={}}acquire(i){if(!this.workers)for(this.workers=[];this.workers.length<eF.workerCount;)this.workers.push(new eB);return this.active[i]=!0,this.workers.slice()}release(i){delete this.active[i],0===this.numActive()&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[eR]}numActive(){return Object.keys(this.active).length}}function eO(){return a||(a=new eF),a}function eU(r){r=r.slice();let n=Object.create(null);for(let i=0;i<r.length;i++)n[r[i].id]=r[i];for(let a=0;a<r.length;a++)"ref"in r[a]&&(r[a]=function(r,n){let a={};for(let i in r)"ref"!==i&&(a[i]=r[i]);return i.refProperties.forEach(i=>{i in n&&(a[i]=n[i])}),a}(r[a],n[r[a].ref]));return r}eF.workerCount=2;let eV={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",setTerrain:"setTerrain",setFog:"setFog",setProjection:"setProjection"};function ej(i,r,n){n.push({command:eV.addSource,args:[i,r[i]]})}function eN(i,r,n){r.push({command:eV.removeSource,args:[i]}),n[i]=!0}function eG(i,r,n,a,o,l){let h;for(h in r=r||{},i=i||{})i.hasOwnProperty(h)&&(s(i[h],r[h])||n.push({command:l,args:[a,h,r[h],o]}));for(h in r)r.hasOwnProperty(h)&&!i.hasOwnProperty(h)&&(s(i[h],r[h])||n.push({command:l,args:[a,h,r[h],o]}))}function eZ(i){return i.id}function e$(i,r){return i[r.id]=r,i}class eq{constructor(i,r){this.reset(i,r)}reset(i,r){this.points=i||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(r||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(1===this.points.length)return this.points[0];r=i.clamp(r,0,1);let n=1,a=this._distances[n],o=r*this.paddedLength+this.padding;
8for(;a<o&&n<this._distances.length;)a=this._distances[++n];let s=n-1,l=this._distances[s],h=a-l,u=h>0?(o-l)/h:0;return this.points[s].mult(1-u).add(this.points[n].mult(u))}}class eX{constructor(i,r,n){let a=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(i/n),this.yCellCount=Math.ceil(r/n);for(let i=0;i<this.xCellCount*this.yCellCount;i++)a.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=i,this.height=r,this.xScale=this.xCellCount/i,this.yScale=this.yCellCount/r,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(i,r,n,a,o){this._forEachCell(r,n,a,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(i),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(o)}insertCircle(i,r,n,a){this._forEachCell(r-a,n-a,r+a,n+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(i),this.circles.push(r),this.circles.push(n),this.circles.push(a)}_insertBoxCell(i,r,n,a,o,s){this.boxCells[o].push(s)}_insertCircleCell(i,r,n,a,o,s){this.circleCells[o].push(s)}_query(i,r,n,a,o,s){if(n<0||i>this.width||a<0||r>this.height)return!o&&[];let l=[];if(i<=0&&r<=0&&this.width<=n&&this.height<=a){if(o)return!0;for(let i=0;i<this.boxKeys.length;i++)l.push({key:this.boxKeys[i],x1:this.bboxes[4*i],y1:this.bboxes[4*i+1],x2:this.bboxes[4*i+2],y2:this.bboxes[4*i+3]});for(let i=0;i<this.circleKeys.length;i++){let r=this.circles[3*i],n=this.circles[3*i+1],a=this.circles[3*i+2];l.push({key:this.circleKeys[i],x1:r-a,y1:n-a,x2:r+a,y2:n+a})}return s?l.filter(s):l}return this._forEachCell(i,r,n,a,this._queryCell,l,{hitTest:o,seenUids:{box:{},circle:{}}},s),o?l.length>0:l}_queryCircle(i,r,n,a,o){let s=i-n,l=i+n,h=r-n,u=r+n;if(l<0||s>this.width||u<0||h>this.height)return!a&&[];let c=[];return this._forEachCell(s,h,l,u,this._queryCellCircle,c,{hitTest:a,circle:{x:i,y:r,radius:n},seenUids:{box:{},circle:{}}},o),a?c.length>0:c}query(i,r,n,a,o){return this._query(i,r,n,a,!1,o)}hitTest(i,r,n,a,o){return this._query(i,r,n,a,!0,o)}hitTestCircle(i,r,n,a){return this._queryCircle(i,r,n,!0,a)}_queryCell(i,r,n,a,o,s,l,h){let u=l.seenUids,c=this.boxCells[o];if(null!==c){let o=this.bboxes;for(let p of c)if(!u.box[p]){u.box[p]=!0;let c=4*p;if(i<=o[c+2]&&r<=o[c+3]&&n>=o[c+0]&&a>=o[c+1]&&(!h||h(this.boxKeys[p]))){if(l.hitTest)return s.push(!0),!0;s.push({key:this.boxKeys[p],x1:o[c],y1:o[c+1],x2:o[c+2],y2:o[c+3]})}}}let p=this.circleCells[o];if(null!==p){let o=this.circles;for(let c of p)if(!u.circle[c]){u.circle[c]=!0;let p=3*c;if(this._circleAndRectCollide(o[p],o[p+1],o[p+2],i,r,n,a)&&(!h||h(this.circleKeys[c]))){if(l.hitTest)return s.push(!0),!0;{let i=o[p],r=o[p+1],n=o[p+2];s.push({key:this.circleKeys[c],x1:i-n,y1:r-n,x2:i+n,y2:r+n})}}}}}_queryCellCircle(i,r,n,a,o,s,l,h){let u=l.circle,c=l.seenUids,p=this.boxCells[o];if(null!==p){let i=this.bboxes;for(let r of p)if(!c.box[r]){c.box[r]=!0;let n=4*r;if(this._circleAndRectCollide(u.x,u.y,u.radius,i[n+0],i[n+1],i[n+2],i[n+3])&&(!h||h(this.boxKeys[r])))return s.push(!0),!0}}let d=this.circleCells[o];if(null!==d){let i=this.circles;for(let r of d)if(!c.circle[r]){c.circle[r]=!0;let n=3*r;if(this._circlesCollide(i[n],i[n+1],i[n+2],u.x,u.y,u.radius)&&(!h||h(this.circleKeys[r])))return s.push(!0),!0}}}_forEachCell(i,r,n,a,o,s,l,h){let u=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r),p=this._convertToXCellCoord(n),d=this._convertToYCellCoord(a);for(let f=u;f<=p;f++)for(let u=c;u<=d;u++)if(o.call(this,i,r,n,a,this.xCellCount*u+f,s,l,h))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,r,n,a,o,s){let l=a-i,h=o-r,u=n+s;return u*u>l*l+h*h}_circleAndRectCollide(i,r,n,a,o,s,l){let h=(s-a)/2,u=Math.abs(i-(a+h));if(u>h+n)return!1;let c=(l-o)/2,p=Math.abs(r-(o+c));if(p>c+n)return!1;if(u<=h||p<=c)return!0;let d=u-h,f=p-c;return d*d+f*f<=n*n}}let eW=Math.tan(85*Math.PI/180);function eH(r,n,a,o,s,l,h){let u=i.create();if(a){if("globe"===l.name){let r=i.calculateGlobeLabelMatrix(s,n);i.multiply(u,u,r)}else{let r=w([],h);u[0]=r[0],u[1]=r[1],u[4]=r[2],u[5]=r[3],o||i.rotateZ(u,u,s.angle)}}
8else i.multiply(u,s.labelPlaneMatrix,r);return u}function eY(i,r,n,a,o,s,l){let h=eH(i,r,n,a,o,s,l);return"globe"===s.name&&n||(h[2]=h[6]=h[10]=h[14]=0),h}function eK(r,n,a,o,s,l,h){if(a){if("globe"===l.name){let u=eH(r,n,a,o,s,l,h);return i.invert(u,u),i.multiply(u,r,u),u}{let n=i.clone(r),a=i.identity([]);return a[0]=h[0],a[1]=h[1],a[4]=h[2],a[5]=h[3],i.multiply(n,n,a),o||i.rotateZ(n,n,-s.angle),n}}return s.glCoordMatrix}function eJ(r,n,a=0){let o=[r.x,r.y,a,1];a?i.transformMat4$1(o,o,n):e7(o,o,n);let s=o[3];return{point:[o[0]/s,o[1]/s,o[2]/s],signedDistanceFromCamera:s}}function eQ(r,n){let a=[r[0],r[1],r[2],1];i.transformMat4$1(a,a,n);let o=a[3];return{point:[a[0]/o,a[1]/o,a[2]/o],signedDistanceFromCamera:o}}function e0(i,r){return Math.min(.5+i/r*.5,1.5)}function e1(i,r,n,a,o,s,l,h,u,c,p,d,f,m,_,g){let y=h.glyphStartIndex+h.numGlyphs,x=h.lineStartIndex,v=h.lineStartIndex+h.lineLength,b=r.getoffsetX(h.glyphStartIndex),w=r.getoffsetX(y-1),T=e6(i*b,n,a,o,s,l,h.segment,x,v,u,c,p,d,f,!0,m,_,g);if(!T)return null;let E=e6(i*w,n,a,o,s,l,h.segment,x,v,u,c,p,d,f,!0,m,_,g);return E?{first:T,last:E}:null}function e2(r,n,a,o){return r.writingMode===i.WritingMode.horizontal&&Math.abs(a.y-n.y)>Math.abs(a.x-n.x)*o?{useVertical:!0}:r.writingMode===i.WritingMode.vertical?n.y<a.y?{needsFlipping:!0}:null:0!==r.flipState&&function(i,r,n){let a=(r.x-i.x)*n;return 0===a||Math.abs((r.y-i.y)/a)>eW}(n,a,o)?1===r.flipState?{needsFlipping:!0}:null:n.x>a.x?{needsFlipping:!0}:null}function e3(r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x,v,b){let w;let T=n/24,E=r.lineOffsetX*T,S=r.lineOffsetY*T;if(r.numGlyphs>1){let n=r.glyphStartIndex+r.numGlyphs,s=r.lineStartIndex,p=r.lineStartIndex+r.lineLength,d=e1(T,u,E,S,a,f,m,r,c,l,_,y,!1,x,v,b);if(!d)return{notEnoughRoom:!0};let I=eQ(d.first.point,h).point,A=eQ(d.last.point,h).point,M=new i.pointGeometry(I[0],I[1]),C=new i.pointGeometry(A[0],A[1]);if(o&&!a){let i=e2(r,M,C,g);if(r.flipState=i&&i.needsFlipping?1:2,i)return i}w=[d.first];for(let i=r.glyphStartIndex+1;i<n-1;i++)w.push(e6(T*u.getoffsetX(i),E,S,a,f,m,r.segment,s,p,c,l,_,y,!1,!1,x,v,b));w.push(d.last)}else{if(o&&!a){let n=eJ(m,s).point,a=r.lineStartIndex+r.segment+1,o=new i.pointGeometry(c.getx(a),c.gety(a)),l=eJ(o,s),h=l.signedDistanceFromCamera>0?l.point:e4(m,o,n,1,s,void 0,x,v.canonical),u=e2(r,new i.pointGeometry(n[0],n[1]),new i.pointGeometry(h[0],h[1]),g);if(r.flipState=u&&u.needsFlipping?1:2,u)return u}let n=e6(T*u.getoffsetX(r.glyphStartIndex),E,S,a,f,m,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,c,l,_,y,!1,!1,x,v,b);if(!n)return{notEnoughRoom:!0};w=[n]}if(d)for(let r of w)i.updateGlobeVertexNormal(d,p.length+0,r.up[0],r.up[1],r.up[2]),i.updateGlobeVertexNormal(d,p.length+1,r.up[0],r.up[1],r.up[2]),i.updateGlobeVertexNormal(d,p.length+2,r.up[0],r.up[1],r.up[2]),i.updateGlobeVertexNormal(d,p.length+3,r.up[0],r.up[1],r.up[2]),i.addDynamicAttributes(p,r.point[0],r.point[1],r.point[2],r.angle);else for(let r of w)i.addDynamicAttributes(p,r.point[0],r.point[1],r.point[2],r.angle);return{}}function e5(r,n,a,o,s){let l=o.projectTilePoint(r.x,r.y,n);if(!s)return eJ(l,a,l.z);let h=s(r);return eJ(new i.pointGeometry(l.x+h[0],l.y+h[1]),a,l.z+h[2])}function e4(r,n,a,o,s,l,h,u){let c=e5(r.add(r.sub(n)._unit()),u,s,h,l).point,p=i.sub([],a,c);return i.scaleAndAdd([],a,p,o/i.length(p))}function e6(r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x,v){let b=o?r-n:r+n,w=b>0?1:-1,T=0;o&&(w*=-1,T=Math.PI),w<0&&(T+=Math.PI);let E=w>0?u+h:u+h+1,S=s,I=s,A=0,M=0,C=Math.abs(b),z=[],P=[],k=l,D=()=>{let r=E-w;return 0===A?l:new i.pointGeometry(p.getx(r),p.gety(r))},L=()=>e4(D(),k,I,C-A+1,d,m,y,x.canonical);for(;A+M<=C;){if((E+=w)<u||E>=c)return null;if(I=S,z.push(S),_&&P.push(k||D()),void 0===(S=f[E])){k=new i.pointGeometry(p.getx(E),p.gety(E));let r=e5(k,x.canonical,d,y,m);S=r.signedDistanceFromCamera>0?f[E]=r.point:L()}else k=null;A+=M,M=i.distance(I,S)}k=k||new i.pointGeometry(p.getx(E),p.gety(E));let B=D();g&&m&&(f[E]=S=void 0===f[E]?S:L(),M=i.distance(I,S));let R=(C-A)/M,F=k.sub(B).mult(R)._add(B),O=i.sub([],S,I),U=i.scaleAndAdd([],I,O,R),V=[0,0,1],j=O[0],N=O[1];if(v&&(0!==(V=y.upVector(x.canonical,F.x,F.y))[0]||0!==V[1]||1!==V[2])){let r=[1,0,0],n=[0,1,0];r[0]=V[2],r[1]=0,r[2]=-V[0],i.cross(n,V,r),i.normalize(r,r),i.normalize(n,n),j=i.dot(O,r),N=i.dot(O,n)}if(a){let r=i.cross([],V,O);i.normalize(r,r),i.scaleAndAdd(U,U,r,a*w)}let G=T+Math.atan2(N,j);return z.push(U),_&&P.push(F),{point:U,angle:G,path:z,tilePath:P,up:V}}let e8=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function e9(i,r){for(let n=0;n<i;n++){let i=r.length;r.resize(i+4),r.float32.set(e8,4*i)}}function e7(i,r,n){let a=r[0],o=r[1];
8return i[0]=n[0]*a+n[4]*o+n[12],i[1]=n[1]*a+n[5]*o+n[13],i[3]=n[3]*a+n[7]*o+n[15],i}class te{constructor(i,r,n=new eX(i.width+200,i.height+200,25),a=new eX(i.width+200,i.height+200,25)){this.transform=i,this.grid=n,this.ignoredGrid=a,this.pitchfactor=Math.cos(i._pitch)*i.cameraToCenterDistance,this.screenRightBoundary=i.width+100,this.screenBottomBoundary=i.height+100,this.gridRightBoundary=i.width+200,this.gridBottomBoundary=i.height+200,this.fogState=r}placeCollisionBox(i,r,n,a,o,s,l,h){let u=n.projectedAnchorX,c=n.projectedAnchorY,p=n.projectedAnchorZ,d=n.elevation,f=n.tileID;if(d&&f){let r=i.getProjection().upVector(f.canonical,n.tileAnchorX,n.tileAnchorY),a=i.getProjection().upVectorScale(f.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;u+=r[0]*d*a,c+=r[1]*d*a,p+=r[2]*d*a}let m=this.projectAndGetPerspectiveRatio(l,[u,c,p],n.tileID,"globe"===i.projection.name||!!d||this.transform.pitch>0,i.getProjection()),_=s*m.perspectiveRatio,g=(n.x1*r+a.x-n.padding)*_+m.point.x,y=(n.y1*r+a.y-n.padding)*_+m.point.y,x=(n.x2*r+a.x+n.padding)*_+m.point.x,v=(n.y2*r+a.y+n.padding)*_+m.point.y,b=m.perspectiveRatio<=.55||m.occluded;return!this.isInsideGrid(g,y,x,v)||!o&&this.grid.hitTest(g,y,x,v,h)||b?{box:[],offscreen:!1,occluded:m.occluded}:{box:[g,y,x,v],offscreen:this.isOffscreen(g,y,x,v),occluded:!1}}placeCollisionCircles(r,n,a,o,s,l,h,u,c,p,d,f,m,_,g){let y=[],x=this.transform.elevation,v=x?x.getAtTileOffsetFunc(g,this.transform.center.lat,this.transform.worldSize,r.getProjection()):i=>[0,0,0],b=new i.pointGeometry(a.tileAnchorX,a.tileAnchorY),w=r.getProjection().projectTilePoint(a.tileAnchorX,a.tileAnchorY,g.canonical),T=v(b),E=[w.x+T[0],w.y+T[1],w.z+T[2]],S="globe"===r.projection.name,I=this.projectAndGetPerspectiveRatio(h,[E[0],E[1],E[2]],g,S||!!x||this.transform.pitch>0,r.getProjection()),{perspectiveRatio:A}=I,M=(d?l/A:l*A)/i.ONE_EM,C=eJ(new i.pointGeometry(E[0],E[1]),u,E[2]).point,z=I.signedDistanceFromCamera>0?e1(M,s,a.lineOffsetX*M,a.lineOffsetY*M,!1,C,b,a,o,u,{},x&&!d?v:null,d&&!!x,r.getProjection(),g,d):null,P=!1,k=!1,D=!0;if(z&&!I.occluded){let r=.5*m*A+_,a=new i.pointGeometry(-100,-100),o=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),s=new eq,l=z.first,h=z.last,u=[];for(let i=l.path.length-1;i>=1;i--)u.push(l.path[i]);for(let i=1;i<h.path.length;i++)u.push(h.path[i]);let d=2.5*r;if(c){let i=u.map(x&&!S?(i,r)=>{let n=v(r<l.path.length-1?l.tilePath[l.path.length-1-r]:h.tilePath[r-l.path.length+2]);return i[2]=n[2],eQ(i,c)}:i=>eQ(i,c));u=i.some(i=>i.signedDistanceFromCamera<=0)?[]:i.map(i=>i.point)}let g=[];if(u.length>0){let r=u.map(r=>new i.pointGeometry(r[0],r[1])),n=1/0,s=-1/0,l=1/0,h=-1/0;for(let i=0;i<r.length;i++)n=Math.min(n,r[i].x),l=Math.min(l,r[i].y),s=Math.max(s,r[i].x),h=Math.max(h,r[i].y);g=n>=a.x&&s<=o.x&&l>=a.y&&h<=o.y?[r]:s<a.x||n>o.x||h<a.y||l>o.y?[]:i.clipLine([r],a.x,a.y,o.x,o.y)}for(let i of g){s.reset(i,.25*r);let a=0;a=s.length<=.5*r?1:Math.ceil(s.paddedLength/d)+1;for(let i=0;i<a;i++){let o=i/Math.max(a-1,1),l=s.lerp(o),h=l.x+100,u=l.y+100;y.push(h,u,r,0);let c=h-r,d=u-r,m=h+r,_=u+r;if(D=D&&this.isOffscreen(c,d,m,_),k=k||this.isInsideGrid(c,d,m,_),!n&&this.grid.hitTestCircle(h,u,r,f)&&(P=!0,!p))return{circles:[],offscreen:!1,collisionDetected:P,occluded:!1}}}}return{circles:(p||!P)&&k?y:[],offscreen:D,collisionDetected:P,occluded:I.occluded}}queryRenderedSymbols(r){if(0===r.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let n=[],a=1/0,o=1/0,s=-1/0,l=-1/0;for(let h of r){let r=new i.pointGeometry(h.x+100,h.y+100);a=Math.min(a,r.x),o=Math.min(o,r.y),s=Math.max(s,r.x),l=Math.max(l,r.y),n.push(r)}let h=this.grid.query(a,o,s,l).concat(this.ignoredGrid.query(a,o,s,l)),u={},c={};for(let r of h){let a=r.key;if(void 0===u[a.bucketInstanceId]&&(u[a.bucketInstanceId]={}),u[a.bucketInstanceId][a.featureIndex])continue;let o=[new i.pointGeometry(r.x1,r.y1),new i.pointGeometry(r.x2,r.y1),new i.pointGeometry(r.x2,r.y2),new i.pointGeometry(r.x1,r.y2)];i.polygonIntersectsPolygon(n,o)&&(u[a.bucketInstanceId][a.featureIndex]=!0,void 0===c[a.bucketInstanceId]&&(c[a.bucketInstanceId]=[]),c[a.bucketInstanceId].push(a.featureIndex))}return c}insertCollisionBox(i,r,n,a,o){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:a,collisionGroupID:o},i[0],i[1],i[2],i[3])}insertCollisionCircles(i,r,n,a,o){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:n,featureIndex:a,collisionGroupID:o};for(let r=0;r<i.length;
8r+=4)s.insertCircle(l,i[r],i[r+1],i[r+2])}projectAndGetPerspectiveRatio(r,n,a,o,s){let l=[n[0],n[1],n[2],1],h=!1;if(n[2]||this.transform.pitch>0){i.transformMat4$1(l,l,r);let o="globe"===s.name;this.fogState&&a&&!o&&(h=function(r,n,a,o,s,l){let h=l.calculateFogTileMatrix(s),u=[n,a,o];return i.transformMat4(u,u,h),z(r,u,l.pitch,l._fov)}(this.fogState,n[0],n[1],n[2],a.toUnwrapped(),this.transform)>.9)}else e7(l,l,r);return{point:new i.pointGeometry((l[0]/l[3]+1)/2*this.transform.width+100,(-l[1]/l[3]+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(s)/l[3]*.5,1.5),signedDistanceFromCamera:l[3],occluded:o&&l[2]>l[3]||h}}isOffscreen(i,r,n,a){return n<100||i>=this.screenRightBoundary||a<100||r>this.screenBottomBoundary}isInsideGrid(i,r,n,a){return n>=0&&i<this.gridRightBoundary&&a>=0&&r<this.gridBottomBoundary}getViewportMatrix(){let r=i.identity([]);return i.translate(r,r,[-100,-100,0]),r}}function tt(r,n,a){let o=n.createTileMatrix(r,r.worldSize,a.toUnwrapped());return i.multiply(new Float32Array(16),r.projMatrix,o)}function ti(i,r,n){return r.name===n.projection.name?i.projMatrix:tt(n,r,i)}class tr{constructor(i,r,n,a){this.opacity=i?Math.max(0,Math.min(1,i.opacity+(i.placed?r:-r))):a&&n?1:0,this.placed=n}isHidden(){return 0===this.opacity&&!this.placed}}class tn{constructor(i,r,n,a,o,s=!1){this.text=new tr(i?i.text:null,r,n,o),this.icon=new tr(i?i.icon:null,r,a,o),this.clipped=s}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ta{constructor(i,r,n,a=!1){this.text=i,this.icon=r,this.skipFade=n,this.clipped=a}}class to{constructor(){this.invProjMatrix=i.create(),this.viewportMatrix=i.create(),this.circles=[]}}class ts{constructor(i,r,n,a,o){this.bucketInstanceId=i,this.featureIndex=r,this.sourceLayerIndex=n,this.bucketIndex=a,this.tileID=o}}class tl{constructor(i){this.crossSourceCollisions=i,this.maxGroupID=0,this.collisionGroups={}}get(i){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[i]){let r=++this.maxGroupID;this.collisionGroups[i]={ID:r,predicate:i=>i.collisionGroupID===r}}return this.collisionGroups[i]}}function th(r,n,a,o,s){let{horizontalAlign:l,verticalAlign:h}=i.getAnchorAlignment(r),u=i.evaluateVariableOffset(r,o);return new i.pointGeometry(-(l-.5)*n+u[0]*s,-(h-.5)*a+u[1]*s)}function tu(r,n,a,o,s){let l=new i.pointGeometry(r,n);return a&&l._rotate(o?s:-s),l}class tc{constructor(i,r,n,a,o){this.transform=i.clone(),this.projection=i.projection.name,this.collisionIndex=new te(this.transform,o),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new tl(n),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,n,a,o){var s,l,h;let u=a.getBucket(n),c=a.latestFeatureIndex;if(!u||!c||n.id!==u.layerIds[0])return;let p=u.layers[0].layout,d=a.collisionBoxArray,f=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),m=a.tileSize/i.EXTENT,_=a.tileID.toUnwrapped();this.transform.setProjection(u.projection);let g=(s=a.tileID,l=u.getProjection(),h=this.transform,l.name===this.projection?h.calculateProjMatrix(s.toUnwrapped()):tt(h,l,s)),y="map"===p.get("text-pitch-alignment"),x="map"===p.get("text-rotation-alignment");n.compileFilter();let v=n.dynamicFilter(),b=n.dynamicFilterNeedsFeature(),w=this.transform.calculatePixelsToTileUnitsMatrix(a),T=eY(g,a.tileID.canonical,y,x,this.transform,u.getProjection(),w),E=null;if(y){let r=eK(g,a.tileID.canonical,y,x,this.transform,u.getProjection(),w);E=i.multiply([],this.transform.labelPlaneMatrix,r)}let S=null;v&&a.latestFeatureIndex&&(S={unwrappedTileID:_,dynamicFilter:v,dynamicFilterNeedsFeature:b,featureIndex:a.latestFeatureIndex}),this.retainedQueryData[u.bucketInstanceId]=new ts(u.bucketInstanceId,c,u.sourceLayerIndex,u.index,a.tileID);let I={bucket:u,layout:p,posMatrix:g,textLabelPlaneMatrix:T,labelToScreenMatrix:E,clippingData:S,scale:f,textPixelRatio:m,holdingForFade:a.holdingForFade(),collisionBoxArray:d,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(u.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:i.evaluateSizeForZoom(u.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(u.sourceID)};if(o)for(let i of u.sortKeyRanges){let{sortKey:n,symbolInstanceStart:a,symbolInstanceEnd:o}=i;r.push({sortKey:n,symbolInstanceStart:a,symbolInstanceEnd:o,parameters:I})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:u.symbolInstances.length,parameters:I})}attemptAnchorPlacement(i,r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x){let v=[d.textOffset0,d.textOffset1],b=th(i,n,a,v,o),w=this.collisionIndex.placeCollisionBox(m,o,r,tu(b.x,b.y,s,l,this.transform.angle),p,h,u,c.predicate);if((!g||0!==this.collisionIndex.placeCollisionBox(m,m.getSymbolInstanceIconSize(x,this.transform.zoom,f),g,tu(b.x,b.y,s,l,this.transform.angle),p,h,u,c.predicate).box.length)&&w.box.length>0){let r;return this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID].text&&(r=this.prevPlacement.variableOffsets[d.crossTileID].anchor),this.variableOffsets[d.crossTileID]={textOffset:v,width:n,height:a,anchor:i,textScale:o,prevAnchor:r},this.markUsedJustification(m,i,d,_),m.allowVerticalPlacement&&(this.markUsedOrientation(m,_,d),this.placedOrientations[d.crossTileID]=_),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(r,n,a,o){let{bucket:s,layout:l,posMatrix:h,textLabelPlaneMatr
8ix:u,labelToScreenMatrix:c,clippingData:p,textPixelRatio:d,holdingForFade:f,collisionBoxArray:m,partiallyEvaluatedTextSize:_,partiallyEvaluatedIconSize:g,collisionGroup:y}=r.parameters,x=l.get("text-optional"),v=l.get("icon-optional"),b=l.get("text-allow-overlap"),w=l.get("icon-allow-overlap"),T="map"===l.get("text-rotation-alignment"),E="map"===l.get("text-pitch-alignment"),S="none"!==l.get("icon-text-fit"),I="viewport-y"===l.get("symbol-z-order");this.transform.setProjection(s.projection);let A=b&&(w||!s.hasIconData()||v),M=w&&(b||!s.hasTextData()||x);!s.collisionArrays&&m&&s.deserializeCollisionBoxes(m),a&&o&&s.updateCollisionDebugBuffers(this.transform.zoom,m);let C=(r,o,m)=>{if(p){let a={zoom:this.transform.zoom,pitch:this.transform.pitch},o=null;if(p.dynamicFilterNeedsFeature){let i=this.retainedQueryData[s.bucketInstanceId];o=p.featureIndex.loadFeature({featureIndex:r.featureIndex,bucketIndex:i.bucketIndex,sourceLayerIndex:i.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,p.dynamicFilter)(a,o,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new i.pointGeometry(r.tileAnchorX,r.tileAnchorY),this.transform.calculateDistanceTileData(p.unwrappedTileID)))return this.placements[r.crossTileID]=new ta(!1,!1,!1,!0),void(n[r.crossTileID]=!0)}if(n[r.crossTileID])return;if(f)return void(this.placements[r.crossTileID]=new ta(!1,!1,!1));let I=!1,C=!1,z=!0,P=!1,k=!1,D=null,L={box:null,offscreen:null,occluded:null},B={box:null,offscreen:null,occluded:null},R=null,F=null,O=null,U=0,V=0,j=0;m.textFeatureIndex?U=m.textFeatureIndex:r.useRuntimeCollisionCircles&&(U=r.featureIndex),m.verticalTextFeatureIndex&&(V=m.verticalTextFeatureIndex);let N=i=>{i.tileID=this.retainedQueryData[s.bucketInstanceId].tileID,(this.transform.elevation||i.elevation)&&(i.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[s.bucketInstanceId].tileID,i.tileAnchorX,i.tileAnchorY):0)},G=m.textBox;if(G){N(G);let n=n=>{let a=i.WritingMode.horizontal;if(s.allowVerticalPlacement&&!n&&this.prevPlacement){let i=this.prevPlacement.placedOrientations[r.crossTileID];i&&(this.placedOrientations[r.crossTileID]=i,a=i,this.markUsedOrientation(s,a,r))}return a},a=(n,a)=>
8{if(s.allowVerticalPlacement&&r.numVerticalGlyphVertices>0&&m.verticalTextBox){for(let r of s.writingModes)if(r===i.WritingMode.vertical?B=L=a():L=n(),L&&L.box&&L.box.length)break}else L=n()};if(l.get("text-variable-anchor")){let u=l.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[r.crossTileID]){let i=this.prevPlacement.variableOffsets[r.crossTileID];u.indexOf(i.anchor)>0&&(u=u.filter(r=>r!==i.anchor)).unshift(i.anchor)}let c=(i,n,a)=>{let l=s.getSymbolInstanceTextSize(_,r,this.transform.zoom,o),c=(i.x2-i.x1)*l+2*i.padding,p=(i.y2-i.y1)*l+2*i.padding,f=S&&!w?n:null;f&&N(f);let m={box:[],offscreen:!1,occluded:!1},x=b?2*u.length:u.length;for(let n=0;n<x;++n){let x=this.attemptAnchorPlacement(u[n%u.length],i,c,p,l,T,E,d,h,y,n>=u.length,r,o,s,a,f,_,g);if(x&&(m=x.placedGlyphBoxes)&&m.box&&m.box.length){I=!0,D=x.shift;break}}return m};a(()=>c(G,m.iconBox,i.WritingMode.horizontal),()=>{let n=m.verticalTextBox;return n&&N(n),s.allowVerticalPlacement&&!(L&&L.box&&L.box.length)&&r.numVerticalGlyphVertices>0&&n?c(n,m.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null,occluded:null}}),L&&(I=L.box,z=L.offscreen,P=L.occluded);let p=n(L&&L.box);if(!I&&this.prevPlacement){let i=this.prevPlacement.variableOffsets[r.crossTileID];i&&(this.variableOffsets[r.crossTileID]=i,this.markUsedJustification(s,i.anchor,r,p))}}else{let l=(n,a)=>{let l=s.getSymbolInstanceTextSize(_,r,this.transform.zoom,o),u=this.collisionIndex.placeCollisionBox(s,l,n,new i.pointGeometry(0,0),b,d,h,y.predicate);return u&&u.box&&u.box.length&&(this.markUsedOrientation(s,a,r),this.placedOrientations[r.crossTileID]=a),u};a(()=>l(G,i.WritingMode.horizontal),()=>{let n=m.verticalTextBox;return s.allowVerticalPlacement&&r.numVerticalGlyphVertices>0&&n?(N(n),l(n,i.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}}),n(L&&L.box&&L.box.length)}}if(I=(R=L)&&R.box&&R.box.length>0,z=R&&R.offscreen,P=R&&R.occluded,r.useRuntimeCollisionCircles){let n=s.text.placedSymbolArray.get(r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex),o=i.evaluateSizeForFeature(s.textSizeData,_,n),p=l.get("text-padding");F=this.collisionIndex.placeCollisionCircles(s,b,n,s.lineVertexArray,s.glyphOffsetArray,o,h,u,c,a,E,y.predicate,r.collisionCircleDiameter*o/i.ONE_EM,p,this.retainedQueryData[s.bucketInstanceId].tileID),I=b||F.circles.length>0&&!F.collisionDetected,z=z&&F.offscreen,P=F.occluded}if(m.iconFeatureIndex&&(j=m.iconFeatureIndex),m.iconBox){let r=r=>{N(r);let n=S&&D?tu(D.x,D.y,T,E,this.transform.angle):new i.pointGeometry(0,0),a=s.getSymbolInstanceIconSize(g,this.transform.zoom,o);return this.collisionIndex.placeCollisionBox(s,a,r,n,w,d,h,y.predicate)};C=B&&B.box&&B.box.length&&m.verticalIconBox?(O=r(m.verticalIconBox)).box.length>0:(O=r(m.iconBox)).box.length>0,z=z&&O.offscreen,k=O.occluded}let Z=x||0===r.numHorizontalGlyphVertices&&0===r.numVerticalGlyphVertices,$=v||0===r.numIconVertices;if(Z||$?$?Z||(C=C&&I):I=C&&I:C=I=C&&I,I&&R&&R.box&&this.collisionIndex.insertCollisionBox(R.box,l.get("text-ignore-placement"),s.bucketInstanceId,B&&B.box&&V?V:U,y.ID),C&&O&&this.collisionIndex.insertCollisionBox(O.box,l.get("icon-ignore-placement"),s.bucketInstanceId,j,y.ID),F&&(I&&this.collisionIndex.insertCollisionCircles(F.circles,l.get("text-ignore-placement"),s.bucketInstanceId,U,y.ID),a)){let i=s.bucketInstanceId,r=this.collisionCircleArrays[i];void 0===r&&(r=this.collisionCircleArrays[i]=new to);for(let i=0;i<F.circles.length;i+=4)r.circles.push(F.circles[i+0]),r.circles.push(F.circles[i+1]),r.circles.push(F.circles[i+2]),r.circles.push(F.collisionDetected?1:0)}let q="globe"!==s.projection.name;A=A&&(q||!P),M=M&&(q||!k),this.placements[r.crossTileID]=new ta(I||A,C||M,z||s.justReloaded),n[r.crossTileID]=!0};if(I){let i=s.getSortedSymbolIndexes(this.transform.angle);for(let r=i.length-1;r>=0;--r){let n=i[r];C(s.symbolInstances.get(n),n,s.collisionArrays[n])}}else for(let i=r.symbolInstanceStart;i<r.symbolInstanceEnd;i++)C(s.symbolInstances.get(i),i,s.collisionArrays[i]);if(a&&s.bucketInstanceId in this.collisionCircleArrays){let r=this.collisionCircleArrays[s.bucketInstanceId];
8i.invert(r.invProjMatrix,h),r.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}markUsedJustification(r,n,a,o){let s;s=o===i.WritingMode.vertical?a.verticalPlacedTextSymbolIndex:({left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex})[i.getAnchorJustification(n)];let l=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(let i of l)i>=0&&(r.text.placedSymbolArray.get(i).crossTileID=s>=0&&i!==s?0:a.crossTileID)}markUsedOrientation(r,n,a){let o=n===i.WritingMode.horizontal||n===i.WritingMode.horizontalOnly?n:0,s=n===i.WritingMode.vertical?n:0,l=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(let i of l)r.text.placedSymbolArray.get(i).placedOrientation=o;a.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=s)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;let r=this.prevPlacement,n=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;let a=r?r.symbolFadeChange(i):1,o=r?r.opacities:{},s=r?r.variableOffsets:{},l=r?r.placedOrientations:{};for(let i in this.placements){let r=this.placements[i],s=o[i];s?(this.opacities[i]=new tn(s,a,r.text,r.icon,null,r.clipped),n=n||r.text!==s.text.placed||r.icon!==s.icon.placed):(this.opacities[i]=new tn(null,a,r.text,r.icon,r.skipFade,r.clipped),n=n||r.text||r.icon)}for(let i in o){let r=o[i];if(!this.opacities[i]){let o=new tn(r,a,!1,!1);o.isHidden()||(this.opacities[i]=o,n=n||r.text.placed||r.icon.placed)}}for(let i in s)this.variableOffsets[i]||!this.opacities[i]||this.opacities[i].isHidden()||(this.variableOffsets[i]=s[i]);for(let i in l)this.placedOrientations[i]||!this.opacities[i]||this.opacities[i].isHidden()||(this.placedOrientations[i]=l[i]);n?this.lastPlacementChangeTime=i:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:i)}updateLayerOpacities(i,r){let n={};for(let a of r){let r=a.getBucket(i);r&&a.latestFeatureIndex&&i.id===r.layerIds[0]&&this.updateBucketOpacities(r,n,a.collisionBoxArray)}}updateBucketOpacities(r,n,a){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();let o=r.layers[0].layout,s=!!r.layers[0].dynamicFilter(),l=new tn(null,0,!1,!1,!0),h=o.get("text-allow-overlap"),u=o.get("icon-allow-overlap"),c=o.get("text-variable-anchor"),p="map"===o.get("text-rotation-alignment"),d="map"===o.get("text-pitch-alignment"),f="none"!==o.get("icon-text-fit"),m=new tn(null,0,h&&(u||!r.hasIconData()||o.get("icon-optional")),u&&(h||!r.hasTextData()||o.get("text-optional")),!0);!r.collisionArrays&&a&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(a);let _=(i,r,n)=>{for(let a=0;a<r/4;a++)i.opacityVertexArray.emplaceBack(n)},g=0;for(let a=0;a<r.symbolInstances.length;a++){let o=r.symbolInstances.get(a),{numHorizontalGlyphVertices:h,numVerticalGlyphVertices:u,crossTileID:y}=o,x=this.opacities[y];n[y]?x=l:x||(x=m,this.opacities[y]=x),n[y]=!0;let v=h>0||u>0,b=o.numIconVertices>0,w=this.placedOrientations[o.crossTileID],T=w===i.WritingMode.vertical,E=w===i.WritingMode.horizontal||w===i.WritingMode.horizontalOnly;if(!v&&!b||x.isHidden()||g++,v){let i=td(x.text);_(r.text,h,T?tf:i),_(r.text,u,E?tf:i);let n=x.text.isHidden();[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach(i=>{i>=0&&(r.text.placedSymbolArray.get(i).hidden=n||T?1:0)}),o.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).hidden=n||E?1:0);let a=this.variableOffsets[o.crossTileID];a&&this.markUsedJustification(r,a.anchor,o,w);let s=this.placedOrientations[o.crossTileID];s&&(this.markUsedJustification(r,"left",o,s),this.markUsedOrientation(r,s,o))}if(b){let i=td(x.icon);o.placedIconSymbolIndex>=0&&(_(r.icon,o.numIconVertices,T?tf:i),r.icon.placedSymbolArray.get(o.placedIconSymbolIndex).hidden=x.icon.isHidden()),o.verticalPlacedIconSymbolIndex>=0&&(_(r.icon,o.numVerticalIconVertices,E?tf:i),r.icon.placedSymbolArray.get(o.verticalPlacedIconSymbolIndex).hidden=x.icon.isHidden())}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){let n=r.collisionArrays[a];if(n){let a=new i.pointGeometry(0,0),o=!0;if(n.textBox||n.verticalTextBox){if(c){let i=this.variableOffsets[y];i?(a=th(i.anchor,i.width,i.height,i.textOffset,i.textScale),p&&a._rotate(d?this.transform.angle:-this.transform.angle)):o=!1}s&&(o=!x.clipped),n.textBox&&tp(r.textCollisionBox.collisionVertexArray,x.text.placed,!o||T,a.x,a.y),n.verticalTextBox&&tp(r.textCollisionBox.collisionVertexArray,x.text.placed,!o||E,a.x,a.y)}let l=o&&Boolean(!E&&n.verticalIconBox);n.iconBox&&tp(r.iconCollisionBox.collisionVertexArray,x.icon.placed,l,f?a.x:0,f?a.y:0),n.verticalIconBox&&tp(r.iconCollisionBox.collisionVertexArray,x.icon.placed,!l,f?a.x:0,f?a.y:0)}}}if(r.fullyClipped=0===g,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){let i=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=i.invProjMatrix,r.placementViewportMatrix=i.viewportMatrix,r.collisionCircleArray=i.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(i){return 0===this.fadeDuration?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return this.stale||i-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(i,r){let n=this.zoomAtLastRecencyCheck===r?1-this.zoomAdjustment(r):1;return this.zoomAtLastRecencyCheck=r,this.commitTime+this.fadeDuration*n>i}setStale(){this.stale=!0}}function tp(i,r,n,a,o){i.emplaceBack(r?1:0,n?1:0,a||0,o||0),i.emplaceBack(r?1:0,n?1:0,a||0,o||0),i.emplaceBack(r?1:0,n?1:0,a||0,o||0),i.emplaceBack(r?1:0,n?1:0,a||0,o||0)}function td(i){if(0===i.opacity&&!i.placed)return 0;if(1===i.opacity&&i.placed)return 4294967295;let r=i.placed?1:0,n=Math.floor(127*i.opacity);return 33554432*n+16777216*r+131072*n+65536*r+512*n+256*r+2*n+r}let tf=0;class tm{constructor(i){this._sortAcrossTiles="viewport-y"!==i.layout.get("symbol-z-order")&&void 0!==i.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(i,r,n,a,o){let s=this._bucketParts;for(;this._currentTileIndex<i.length;)if(r.getBucketParts(s,a,i[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,o())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort((i,r)=>i.sortKey-r.sortKey));this._currentPartIndex<s.length;){let i=s[this._currentPartIndex];if(r.placeLayerBucketPart(i,this._seenCrossTileIDs,n,0===i.symbolInstanceStart),this._currentPartIndex++,o())return!0}return!1}}class t_{constructor(i,r,n,a,o,s,l,h){this.placement=new tc(i,o,s,l,h),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(r,n,a){let o=i.exported.now(),s=()=>{let r=i.exported.now()-o;return!this._forceFullPlacement&&r>2};for(;this._currentPlacementIndex>=0;){let i=n[r[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===i.type&&(!i.minzoom||i.minzoom<=o)&&(!i.maxzoom||i.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new tm(i)),this._inProgressLayer.continuePlacement(a[i.source],this.placement,this._showCollisionBoxes,i,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(i){return this.placement.commit(i),this.placement}}let tg=512/i.EXTENT/2;class ty{constructor(i,r,n){this.tileID=i,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let n=0;n<r.length;n++){let a=r.get(n),o=a.key;
8this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:a.crossTileID,coord:this.getScaledCoordinates(a,i)})}}getScaledCoordinates(r,n){let a=tg/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*i.EXTENT+r.tileAnchorX)*a),y:Math.floor((n.canonical.y*i.EXTENT+r.tileAnchorY)*a)}}findMatches(i,r,n){let a=this.tileID.canonical.z<r.canonical.z?1:Math.pow(2,this.tileID.canonical.z-r.canonical.z);for(let o=0;o<i.length;o++){let s=i.get(o);if(s.crossTileID)continue;let l=this.indexedSymbolInstances[s.key];if(!l)continue;let h=this.getScaledCoordinates(s,r);for(let i of l)if(Math.abs(i.coord.x-h.x)<=a&&Math.abs(i.coord.y-h.y)<=a&&!n[i.crossTileID]){n[i.crossTileID]=!0,s.crossTileID=i.crossTileID;break}}}}class tx{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class tv{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(i){let r=Math.round((i-this.lng)/360);if(0!==r)for(let i in this.indexes){let n=this.indexes[i],a={};for(let i in n){let o=n[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+r),a[o.tileID.key]=o}this.indexes[i]=a}this.lng=i}addBucket(i,r,n){if(this.indexes[i.overscaledZ]&&this.indexes[i.overscaledZ][i.key]){if(this.indexes[i.overscaledZ][i.key].bucketInstanceId===r.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(i.overscaledZ,this.indexes[i.overscaledZ][i.key])}for(let i=0;i<r.symbolInstances.length;i++)r.symbolInstances.get(i).crossTileID=0;this.usedCrossTileIDs[i.overscaledZ]||(this.usedCrossTileIDs[i.overscaledZ]={});let a=this.usedCrossTileIDs[i.overscaledZ];for(let n in this.indexes){let o=this.indexes[n];if(Number(n)>i.overscaledZ)for(let n in o){let s=o[n];s.tileID.isChildOf(i)&&s.findMatches(r.symbolInstances,i,a)}else{let s=o[i.scaledTo(Number(n)).key];s&&s.findMatches(r.symbolInstances,i,a)}}for(let i=0;i<r.symbolInstances.length;i++){let o=r.symbolInstances.get(i);o.crossTileID||(o.crossTileID=n.generate(),a[o.crossTileID]=!0)}return void 0===this.indexes[i.overscaledZ]&&(this.indexes[i.overscaledZ]={}),this.indexes[i.overscaledZ][i.key]=new ty(i,r.symbolInstances,r.bucketInstanceId),!0}removeBucketCrossTileIDs(i,r){for(let n in r.indexedSymbolInstances)for(let a of r.indexedSymbolInstances[n])delete this.usedCrossTileIDs[i][a.crossTileID]}removeStaleBuckets(i){let r=!1;for(let n in this.indexes){let a=this.indexes[n];for(let o in a)i[a[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,a[o]),delete a[o],r=!0)}return r}}class tb{constructor(){this.layerIndexes={},this.crossTileIDs=new tx,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(i,r,n,a){let o=this.layerIndexes[i.id];void 0===o&&(o=this.layerIndexes[i.id]=new tv);let s=!1,l={};for(let h of("globe"!==a.name&&o.handleWrapJump(n),r)){let r=h.getBucket(i);r&&i.id===r.layerIds[0]&&(r.bucketInstanceId||(r.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(h.tileID,r,this.crossTileIDs)&&(s=!0),l[r.bucketInstanceId]=!0)}return o.removeStaleBuckets(l)&&(s=!0),s}pruneUnusedLayers(i){let r={};for(let n in i.forEach(i=>{r[i]=!0}),this.layerIndexes)r[n]||delete this.layerIndexes[n]}}let tw=(r,n)=>i.emitValidationErrors(r,n&&n.filter(i=>"source.canvas"!==i.identifier)),tT=i.pick(eV,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),tE=i.pick(eV,["setCenter","setZoom","setBearing","setPitch"]),tS={version:8,layers:[],sources:{}},tI={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class tA extends i.Evented{constructor(r,n={}){super(),this.map=r,this.dispatcher=new B(eO(),this),this.imageManager=new T,this.imageManager.setEventedParent(this),this.glyphManager=new i.GlyphManager(r._requestManager,n.localFontFamily?i.LocalGlyphMode.all:n.localIdeographFontFamily?i.LocalGlyphMode.ideographs:i.LocalGlyphMode.none,n.localFontFamily||n.localIdeographFontFamily),this.lineAtlas=new i.LineAtlas(256,512),this.crossTileSymbolIndex=new tb,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new i.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedU
8pdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());let a=this;this._rtlTextPluginCallback=tA.registerForPluginStateChange(r=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:r.pluginStatus,pluginURL:r.pluginURL},(r,n)=>{if(i.triggerPluginCompletionEvent(r),n&&n.every(i=>i))for(let i in a._sourceCaches){let r=a._sourceCaches[i],n=r.getSource().type;"vector"!==n&&"geojson"!==n||r.reload()}})}),this.on("data",i=>{if("source"!==i.dataType||"metadata"!==i.sourceDataType)return;let r=this.getSource(i.sourceId);if(r&&r.vectorLayerIds)for(let i in this._layers){let n=this._layers[i];n.source===r.id&&this._validateLayer(n)}})}loadURL(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"}));let a="boolean"==typeof n.validate?n.validate:!i.isMapboxURL(r);r=this.map._requestManager.normalizeStyleURL(r,n.accessToken);let o=this.map._requestManager.transformRequest(r,i.ResourceType.Style);this._request=i.getJSON(o,(r,n)=>{this._request=null,r?this.fire(new i.ErrorEvent(r)):n&&this._load(n,a)})}loadJSON(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(()=>{this._request=null,this._load(r,!1!==n.validate)})}loadEmpty(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(tS,!1)}_updateLayerCount(i,r){let n=r?1:-1;i.is3D()&&(this._num3DLayers+=n),"circle"===i.type&&(this._numCircleLayers+=n),"symbol"===i.type&&(this._numSymbolLayers+=n)}_load(r,n){if(n&&tw(this,i.validateStyle(r)))return;for(let n in this._loaded=!0,this.stylesheet=i.clone$1(r),this._updateMapProjection(),r.sources)this.addSource(n,r.sources[n],{validate:!1});this._changed=!1,r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(r.glyphs);let a=eU(this.stylesheet.layers);for(let r of(this._order=a.map(i=>i.id),this._layers={},this._serializedLayers={},a))(r=i.createStyleLayer(r)).setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=r,this._serializedLayers[r.id]=r.serialize(),this._updateLayerCount(r,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new I(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}setProjection(i){i?this.stylesheet.projection=i:delete this.stylesheet.projection,this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(r){this._spriteRequest=function(r,n,a){let o,s,l;let h=i.exported.devicePixelRatio>1?"@2x":"",u=i.getJSON(n.transformRequest(n.normalizeSpriteURL(r,h,".json"),i.ResourceType.SpriteJSON),(i,r)=>{u=null,l||(l=i,o=r,p())}),c=i.getImage(n.transformRequest(n.normalizeSpriteURL(r,h,".png"),i.ResourceType.SpriteImage),(i,r)=>{c=null,l||(l=i,s=r,p())});function p(){if(l)a(l);else if(o&&s){let r=i.exported.getImageData(s),n={};for(let a in o){let{width:s,height:l,x:h,y:u,sdf:c,pixelRatio:p,stretchX:d,stretchY:f,content:m}=o[a],_=new i.RGBAImage({width:s,height:l});i.RGBAImage.copy(r,_,{x:h,y:u},{x:0,y:0},{width:s,height:l}),n[a]={data:_,pixelRatio:p,sdf:c,stretchX:d,stretchY:f,content:m}}a(null,n)}}return{cancel(){u&&(u.cancel(),u=null),c&&(c.cancel(),c=null)}}}(r,this.map._requestManager,(r,n)=>{if(this._spriteRequest=null,r)this.fire(new i.ErrorEvent(r));else if(n)for(let i in n)this.imageManager.addImage(i,n[i]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new i.Event("data",{dataType:"style"}))})}_validateLayer(r){let n=this.getSource(r.source);if(!n)return;let a=r.sourceLayer;a&&("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(a))&&this.fire(new i.ErrorEvent(Error(`Source layer "${a}" does not exist on source "${n.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let i in this._sourceCaches)if(!this._sourceCaches[i].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(i){let r=[];for(let n of i){let i=this._layers[n];
8"custom"!==i.type&&r.push(i.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(let i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(let i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(i){return!!this.terrain&&tI[i.type]}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}update(r){if(!this._loaded)return;let n=this._changed;if(this._changed){let i=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);for(let r in(i.length||n.length)&&this._updateWorkerLayers(i,n),this._updatedSources){let i=this._updatedSources[r];"reload"===i?this._reloadSource(r):"clear"===i&&this._clearSource(r)}for(let i in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[i].updateTransitions(r);this.light.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._resetUpdates()}let a={};for(let i in this._sourceCaches){let r=this._sourceCaches[i];a[i]=r.used,r.used=!1}for(let i of this._order){let n=this._layers[i];if(n.recalculate(r,this._availableImages),!n.isHidden(r.zoom)){let i=this._getLayerSourceCache(n);i&&(i.used=!0)}let a=this.map.painter;if(a){let i=n.getProgramIds();if(!i)continue;let o=n.getProgramConfiguration(r.zoom);for(let r of i)a.useProgram(r,o)}}for(let r in a){let n=this._sourceCaches[r];a[r]!==n.used&&n.getSource().fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:n.getSource().id}))}this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),n&&this.fire(new i.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){let i=Object.keys(this._changedImages);if(i.length){for(let r in this._sourceCaches)this._sourceCaches[r].reloadTilesForDependencies(["icons","patterns"],i);this._changedImages={}}}_updateWorkerLayers(i,r){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(i),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(r){if(this._checkLoaded(),tw(this,i.validateStyle(r)))return!1;(r=i.clone$1(r)).layers=eU(r.layers);let n=(function(i,r){if(!i)return[{command:eV.setStyle,args:[r]}];let n=[];try{if(!s(i.version,r.version))return[{command:eV.setStyle,args:[r]}];s(i.center,r.center)||n.push({command:eV.setCenter,args:[r.center]}),s(i.zoom,r.zoom)||n.push({command:eV.setZoom,args:[r.zoom]}),s(i.bearing,r.bearing)||n.push({command:eV.setBearing,args:[r.bearing]}),s(i.pitch,r.pitch)||n.push({command:eV.setPitch,args:[r.pitch]}),s(i.sprite,r.sprite)||n.push({command:eV.setSprite,args:[r.sprite]}),s(i.glyphs,r.glyphs)||n.push({command:eV.setGlyphs,args:[r.glyphs]}),s(i.transition,r.transition)||n.push({command:eV.setTransition,args:[r.transition]}),s(i.light,r.light)||n.push({command:eV.setLight,args:[r.light]}),s(i.fog,r.fog)||n.push({command:eV.setFog,args:[r.fog]}),s(i.projection,r.projection)||n.push({command:eV.setProjection,args:[r.projection]});let a={},o=[];!function(i,r,n,a){let o;for(o in r=r||{},i=i||{})i.hasOwnProperty(o)&&(r.hasOwnProperty(o)||eN(o,n,a));for(o in r){var l,h;r.hasOwnProperty(o)&&(i.hasOwnProperty(o)?s(i[o],r[o])||("geojson"===i[o].type&&"geojson"===r[o].type&&function(i,r,n){let a;for(a in i[n])if(i[n].hasOwnProperty(a)&&"data"!==a&&!s(i[n][a],r[n][a]))return!1;for(a in r[n])if(r[n].hasOwnProperty(a)&&"data"!==a&&!s(i[n][a],r[n][a]))return!1;return!0}(i,r,o)?n.push({command:eV.setGeoJSONSourceData,args:[o,r[o].data]}):(l=o,h=r,eN(l,n,a),ej(l,h,n))):ej(o,r,n))}}(i.sources,r.sources,o,a);let l=[];i.layers&&i.layers.forEach(i=>{i.source&&a[i.source]?n.push({command:eV.removeLayer,args:[i.id]}):l.push(i)});let h=i.terrain;h&&a[h.source]&&(n.push({command:eV.setTerrain,args:[void 0]}),h=void 0),n=n.concat(o),s(h,r.terrain)||n.push({command:eV.setTerrain,args:[r.terrain]}),function(i,r,n){let a,o,l,h,u,c,p;r=r||[];let d=(i=i||[]).map(eZ),f=r.map(eZ),m=i.reduce(e$,{}),_=r.reduce(e$,{}),g=d.slice(),y=Object.create(null);for(a=0,o=0;a<d.length;a++)l=d[a],_.hasOwnProperty(l)?o++:(n.push({command:eV.removeLayer,args:[l]}),g.splice(g.indexOf(l,o),1));for(a=0,o=0;a<f.length;a++)l=f[f.length-1-a],g[g.length-1-a]!==l&&(m.hasOwnProperty(l)?(n.push({command:eV.removeLayer,args:[l]}),g.splice(g.lastIndexOf(l,g.length-o),1)):o++,c=g[g.length-a],n.push({command:eV.addLayer,args:[_[l],c]}),g.splice(g.length-a,0,l),y[l]=!0);for(a=0;a<f.length;a++)if(h=m[l=f[a]],u=_[l],!y[l]&&!s(h,u)){if(s(h.source,u.source)&&s(h["source-layer"],u["source-layer"])&&s(h.type,u.type)){for(p in eG(h.layout,u.layout,n,l,null,eV.setLayoutProperty),eG(h.paint,u.paint,n,l,null,eV.setPaintProperty),s(h.filter,u.filter)||n.push({command:eV.setFilter,args:[l,u.filter]}),s(h.minzoom,u.minzoom)&&s(h.maxzoom,u.maxzoom)||n.push({command:eV.setLayerZoomRange,args:[l,u.minzoom,u.maxzoom]}),h)h.hasOwnProperty(p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?eG(h[p],u[p],n,l,p.slice(6),eV.setPaintProperty):s(h[p],u[p])||n.push({command:eV.setLayerProperty,args:[l,p,u[p]]}));for(p in u)u.hasOwnProperty(p)&&!h.hasOwnProperty(p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?eG(h[p],u[p],n,l,p.slice(6),eV.setPaintProperty):s(h[p],u[p])||n.push({command:eV.setLayerProperty,args:[l,p,u[p]]}))}else n.push({command:eV.removeLayer,args:[l]}),c=g[g.lastIndexOf(l)+1],n.push({command:eV.addLayer,args:[u,c]})}}(l,r.layers,n)}catch(i){console.warn("Unable to compute style diff:",i),n=[{command:eV.setStyle,args:[r]}]}return n})(this.serialize(),r).filter(i=>!(i.command in tE));if(0===n.length)return!1;let a=n.filter(i=>!(i.command in tT));if(a.length>0)throw Error(`Unimplemented: ${a.map(i=>i.command).join(", ")}.`);
8return n.forEach(i=>{"setTransition"!==i.command&&"setProjection"!==i.command&&this[i.command].apply(this,i.args)}),this.stylesheet=r,this._updateMapProjection(),!0}addImage(r,n){return this.getImage(r)?this.fire(new i.ErrorEvent(Error("An image with this name already exists."))):(this.imageManager.addImage(r,n),this._afterImageUpdated(r),this)}updateImage(i,r){this.imageManager.updateImage(i,r)}getImage(i){return this.imageManager.getImage(i)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r),this._afterImageUpdated(r),this):this.fire(new i.ErrorEvent(Error("No image with this name exists.")))}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(r,n,a={}){if(this._checkLoaded(),void 0!==this.getSource(r))throw Error("There is already a source with this ID");if(!n.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(i.validateSource,`sources.${r}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let o=eD(r,n,this.dispatcher,this);o.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(r),source:o.serialize(),sourceId:r}));let s=n=>{let a=(n?"symbol:":"other:")+r,s=this._sourceCaches[a]=new i.SourceCache(a,o,n);(n?this._symbolSourceCaches:this._otherSourceCaches)[r]=s,s.style=this,s.onAdd(this.map)};s(!1),"vector"!==n.type&&"geojson"!==n.type||s(!0),o.onAdd&&o.onAdd(this.map),this._changed=!0}removeSource(r){this._checkLoaded();let n=this.getSource(r);if(!n)throw Error("There is no source with this ID");for(let n in this._layers)if(this._layers[n].source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while layer "${n}" is using it.`)));if(this.terrain&&this.terrain.get().source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while terrain is using it.`)));let a=this._getSourceCaches(r);for(let r of a)delete this._sourceCaches[r.id],delete this._updatedSources[r.id],r.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:r.getSource().id})),r.setEventedParent(null),r.clearTiles();return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changed=!0,this}
8setGeoJSONSourceData(i,r){this._checkLoaded(),this.getSource(i).setData(r),this._changed=!0}getSource(i){let r=this._getSourceCache(i);return r&&r.getSource()}addLayer(r,n,a={}){let o;this._checkLoaded();let s=r.id;if(this.getLayer(s))return void this.fire(new i.ErrorEvent(Error(`Layer with id "${s}" already exists on this map`)));if("custom"===r.type){if(tw(this,i.validateCustomStyleLayer(r)))return;o=i.createStyleLayer(r)}else{if("object"==typeof r.source&&(this.addSource(s,r.source),r=i.clone$1(r),r=i.extend(r,{source:s})),this._validate(i.validateLayer,`layers.${s}`,r,{arrayIndex:-1},a))return;o=i.createStyleLayer(r),this._validateLayer(o),o.setEventedParent(this,{layer:{id:s}}),this._serializedLayers[o.id]=o.serialize(),this._updateLayerCount(o,!0)}let l=n?this._order.indexOf(n):this._order.length;if(n&&-1===l)return void this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`)));this._order.splice(l,0,s),this._layerOrderChanged=!0,this._layers[s]=o;let h=this._getLayerSourceCache(o);if(this._removedLayers[s]&&o.source&&h&&"custom"!==o.type){let i=this._removedLayers[s];delete this._removedLayers[s],i.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",h.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(r,n){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===n)return;let a=this._order.indexOf(r);this._order.splice(a,1);let o=n?this._order.indexOf(n):this._order.length;
8n&&-1===o?this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`))):(this._order.splice(o,0,r),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(r){this._checkLoaded();let n=this._layers[r];if(!n)return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be removed.`)));n.setEventedParent(null),this._updateLayerCount(n,!1);let a=this._order.indexOf(r);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=n,delete this._layers[r],delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],n.onRemove&&n.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(i){return this._layers[i]}hasLayer(i){return i in this._layers}hasLayerType(i){for(let r in this._layers)if(this._layers[r].type===i)return!0;return!1}setLayerZoomRange(r,n,a){this._checkLoaded();let o=this.getLayer(r);o?o.minzoom===n&&o.maxzoom===a||(null!=n&&(o.minzoom=n),null!=a&&(o.maxzoom=a),this._updateLayer(o)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(r,n,a={}){this._checkLoaded();let o=this.getLayer(r);if(o){if(!s(o.filter,n))return null==n?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(i.validateFilter,`layers.${o.id}.filter`,n,{layerType:o.type},a)||(o.filter=i.clone$1(n),this._updateLayer(o)))}else this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be filtered.`)))}getFilter(r){let n=this.getLayer(r);return n&&i.clone$1(n.filter)}setLayoutProperty(r,n,a,o={}){this._checkLoaded();let l=this.getLayer(r);l?s(l.getLayoutProperty(n),a)||(l.setLayoutProperty(n,a,o),this._updateLayer(l)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(r,n){let a=this.getLayer(r);if(a)return a.getLayoutProperty(n);this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style.`)))}setPaintProperty(r,n,a,o={}){this._checkLoaded();let l=this.getLayer(r);l?s(l.getPaintProperty(n),a)||(l.setPaintProperty(n,a,o)&&this._updateLayer(l),this._changed=!0,this._updatedPaintProps[r]=!0):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(i,r){let n=this.getLayer(i);return n&&n.getPaintProperty(r)}setFeatureState(r,n){this._checkLoaded();let a=r.source,o=r.sourceLayer,s=this.getSource(a);if(!s)return void this.fire(new i.ErrorEvent(Error(`The source '${a}' does not exist in the map's style.`)));let l=s.type;if("geojson"===l&&o)return void this.fire(new i.ErrorEvent(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===l&&!o)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided.")));let h=this._getSourceCaches(a);for(let i of h)i.setFeatureState(o,r.id,n)}removeFeatureState(r,n){this._checkLoaded();let a=r.source,o=this.getSource(a);if(!o)return void this.fire(new i.ErrorEvent(Error(`The source '${a}' does not exist in the map's style.`)));let s=o.type,l="vector"===s?r.sourceLayer:void 0;if("vector"===s&&!l)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&"string"!=typeof r.id&&"number"!=typeof r.id)return void this.fire(new i.ErrorEvent(Error("A feature id is required to remove its specific state property.")));let h=this._getSourceCaches(a);for(let i of h)i.removeFeatureState(l,r.id,n)}getFeatureState(r){this._checkLoaded();let n=r.source,a=r.sourceLayer,o=this.getSource(n);if(o){if("vector"!==o.type||a)return void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided."))),this._getSourceCaches(n)[0].getFeatureState(a,r.id);this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){let r={};for(let i in this._sourceCaches){let n=this._sourceCaches[i].getSource();r[n.id]||(r[n.id]=n.serialize())}return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.stylesheet.terrain,fog:this.stylesheet.fog,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,projection:this.stylesheet.projection,sources:r,layers:this._serializeLayers(this._order)},i=>void 0!==i)}_updateLayer(i){this._updatedLayers[i.id]=!0;let r=this._getLayerSourceCache(i);i.source&&!this._updatedSources[i.source]&&r&&"raster"!==r.getSource().type&&(this._updatedSources[i.source]="reload",r.pause()),this._changed=!0,i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){let r={},n=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if("fill-extrusion"===this._layers[o].type)for(let s of(r[o]=a,i)){let i=s[o];if(i)for(let r of i)n.push(r)}}n.sort((i,r)=>r.intersectionZ-i.intersectionZ);let a=[];for(let o=this._order.length-1;o>=0;o--){let s=this._order[o];if("fill-extrusion"===this._layers[s].type)for(let i=n.length-1;i>=0;i--){let s=n[i].feature;if(r[s.layer.id]<o)break;a.push(s),n.pop()}else for(let r of i){let i=r[s];if(i)for(let r of i)a.push(r.feature)}}return a}
8queryRenderedFeatures(r,n,a){n&&n.filter&&this._validate(i.validateFilter,"queryRenderedFeatures.filter",n.filter,null,n);let o={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new i.ErrorEvent(Error("parameters.layers must be an Array."))),[];for(let r of n.layers){let n=this._layers[r];if(!n)return this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be queried for features.`))),[];o[n.source]=!0}}let s=[];n.availableImages=this._availableImages;let l=n&&n.layers?n.layers.some(i=>{let r=this.getLayer(i);return r&&r.is3D()}):this.has3DLayers(),h=F.createFromScreenPoints(r,a);for(let r in this._sourceCaches){let u=this._sourceCaches[r].getSource().id;n.layers&&!o[u]||s.push(function(r,n,a,o,s,l,h,u=!1){let c=r.tilesIn(o,h,u);c.sort(eL);let p=[];for(let o of c)p.push({wrappedTileID:o.tile.tileID.wrapped().key,queryResults:o.tile.queryRenderedFeatures(n,a,r._state,o,s,l,function(r,n){let a=i.identity([]);return i.scale(a,a,[.5*r.width,-(.5*r.height),1]),i.translate(a,a,[1,-1,0]),i.multiply(a,a,r.calculateProjMatrix(n.toUnwrapped())),Float32Array.from(a)}(r.transform,o.tile.tileID),u)});let d=function(i){let r={},n={};for(let a of i){let i=a.queryResults,o=a.wrappedTileID,s=n[o]=n[o]||{};for(let n in i){let a=i[n],o=s[n]=s[n]||{},l=r[n]=r[n]||[];for(let i of a)o[i.featureIndex]||(o[i.featureIndex]=!0,l.push(i))}}return r}(p);
8for(let i in d)d[i].forEach(i=>{let n=i.feature,a=n.layer;a&&"background"!==a.type&&"sky"!==a.type&&(n.source=a.source,a["source-layer"]&&(n.sourceLayer=a["source-layer"]),n.state=void 0!==n.id?r.getFeatureState(a["source-layer"],n.id):{})});return d}(this._sourceCaches[r],this._layers,this._serializedLayers,h,n,a,l,!!this.map._showQueryGeometry))}return this.placement&&s.push(function(i,r,n,a,o,s,l){let h={},u=s.queryRenderedSymbols(a),c=[];for(let i of Object.keys(u).map(Number))c.push(l[i]);for(let n of(c.sort(eL),c)){let a=n.featureIndex.lookupSymbolFeatures(u[n.bucketInstanceId],r,n.bucketIndex,n.sourceLayerIndex,o.filter,o.layers,o.availableImages,i);for(let i in a){let r=h[i]=h[i]||[],o=a[i];for(let i of(o.sort((i,r)=>{let a=n.featureSortOrder;if(a){let n=a.indexOf(i.featureIndex);return a.indexOf(r.featureIndex)-n}return r.featureIndex-i.featureIndex}),o))r.push(i)}}for(let r in h)h[r].forEach(a=>{let o=a.feature,s=n(i[r]).getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=s});return h}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),h.screenGeometry,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(s)}querySourceFeatures(r,n){n&&n.filter&&this._validate(i.validateFilter,"querySourceFeatures.filter",n.filter,null,n);let a=this._getSourceCaches(r),o=[];for(let i of a)o=o.concat(function(i,r){let n=i.getRenderableIds().map(r=>i.getTileByID(r)),a=[],o={};for(let i=0;i<n.length;i++){let s=n[i],l=s.tileID.canonical.key;o[l]||(o[l]=!0,s.querySourceFeatures(a,r))}return a}(i,n));return o}addSourceType(i,r,n){return tA.getSourceType(i)?n(Error(`A source type called "${i}" already exists.`)):(tA.setSourceType(i,r),r.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:i,url:r.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(i,r={}){this._checkLoaded();let n=this.light.getLight(),a=!1;for(let r in i)if(!s(i[r],n[r])){a=!0;break}if(!a)return;let o=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(i,r),this.light.updateTransitions(o)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(r,n=1){if(this._checkLoaded(),!r)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(1===n){if("object"==typeof r.source){let n="terrain-dem-src";this.addSource(n,r.source),r=i.clone$1(r),r=i.extend(r,{source:n})}if(this._validate(i.validateTerrain,"terrain",r))return}if(!this.terrain||this.terrain&&n!==this.terrain.drapeRenderMode)this._createTerrain(r,n);else{let n=this.terrain,a=n.get();for(let n of Object.keys(i.spec.terrain))!r.hasOwnProperty(n)&&i.spec.terrain[n].default&&(r[n]=i.spec.terrain[n].default);for(let i in r)if(!s(r[i],a[i])){n.set(r),this.stylesheet.terrain=r;let i=this._setTransitionParameters({duration:0});n.updateTransitions(i);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(i){let r=this.fog=new L(i,this.map.transform);this.stylesheet.fog=i;let n=this._setTransitionParameters({duration:0});r.updateTransitions(n)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(let i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(i){if(this._checkLoaded(),!i)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){let r=this.fog,n=r.get();for(let a in 0===Object.keys(i).length&&r.set(i),i)if(!s(i[a],n[a])){r.set(i),this.stylesheet.fog=i;let n=this._setTransitionParameters({duration:0});r.updateTransitions(n);break}}else this._createFog(i);this._markersNeedUpdate=!0}_setTransitionParameters(r){return{now:i.exported.now(),transition:i.extend(r,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;let i=this._order.filter(i=>
8this.isLayerDraped(this._layers[i])),r=this._order.filter(i=>!this.isLayerDraped(this._layers[i]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...r)}_createTerrain(i,r){let n=this.terrain=new C(i,r);this.stylesheet.terrain=i,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();let a=this._setTransitionParameters({duration:0});n.updateTransitions(a)}_force3DLayerUpdate(){for(let i in this._layers){let r=this._layers[i];"fill-extrusion"===r.type&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(let i in this._layers){let r=this._layers[i];"symbol"===r.type&&this._updateLayer(r)}}_validate(r,n,a,o,s={}){return(!s||!1!==s.validate)&&tw(this,r.call(i.validateStyle,i.extend({key:n,style:this.serialize(),value:a,styleSpec:i.spec},o)))}_remove(){for(let r in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[r].setEventedParent(null);for(let i in this._sourceCaches)this._sourceCaches[i].clearTiles(),this._sourceCaches[i].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(i){let r=this._getSourceCaches(i);for(let i of r)i.clearTiles()}_reloadSource(i){let r=this._getSourceCaches(i);for(let i of r)i.resume(),i.reload()}_updateSources(i){for(let r in this._sourceCaches)this._sourceCaches[r].update(i)}_generateCollisionBoxes(){for(let i in this._sourceCaches){let r=this._sourceCaches[i];r.resume(),r.reload()}}_updatePlacement(r,n,a,o,s=!1){let l=!1,h=!1,u={};for(let i of this._order){let n=this._layers[i];if("symbol"!==n.type)continue;if(!u[n.source]){let i=this._getLayerSourceCache(n);if(!i)continue;u[n.source]=i.getRenderableIds(!0).map(r=>i.getTileByID(r)).sort((i,r)=>r.tileID.overscaledZ-i.tileID.overscaledZ||(i.tileID.isLessThan(r.tileID)?-1:1))}let a=this.crossTileSymbolIndex.addLayer(n,u[n.source],r.center.lng,r.projection);l=l||a}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),s=s||this._layerOrderChanged||0===a,this._layerOrderChanged&&this.fire(new i.Event("neworder")),(s||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),r.zoom))&&(this.pauseablePlacement=new t_(r,this._order,s,n,a,o,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,u),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),h=!0),l&&this.pauseablePlacement.placement.setStale()),h||l)for(let i of this._order){let r=this._layers[i];"symbol"===r.type&&this.placement.updateLayerOpacities(r,u[r.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}_releaseSymbolFadeTiles(){for(let i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}getImages(i,r,n){this.imageManager.getImages(r.icons,n),this._updateTilesForChangedImages();let a=i=>{i&&i.setDependencies(r.tileID.key,r.type,r.icons)};a(this._otherSourceCaches[r.source]),a(this._symbolSourceCaches[r.source])}getGlyphs(i,r,n){this.glyphManager.getGlyphs(r.stacks,n)}getResource(r,n,a){return i.makeRequest(n,a)}_getSourceCache(i){return this._otherSourceCaches[i]}_getLayerSourceCache(i){return"symbol"===i.type?this._symbolSourceCaches[i.source]:this._otherSourceCaches[i.source]}_getSourceCaches(i){let r=[];return this._otherSourceCaches[i]&&r.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&r.push(this._symbolSourceCaches[i]),r}_isSourceCacheLoaded(r){let n=this._getSourceCaches(r);return 0===n.length?(this.fire(new i.ErrorEvent(Error(`There is no source with ID '${r}'`))),!1):n.every(i=>i.loaded())}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}tA.getSourceType=function(i){return ek[i]},tA.setSourceType=function(i,r){ek[i]=r},tA.registerForPluginStateChange=i.registerForPluginStateChange;var tM="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#define HALF_PI PI/2.0\n#define QUARTER_PI PI/4.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0",tC="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;
8void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",tz="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);
8vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;vec4 bounds=vec4(d,vec2(1.0)-d);h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",tP="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",tk="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif";let tD={},tL={},tB=[];tU(tM,tB),tU(tz,tB),tU(tP,tB),tU(tk,tB),tD=tV("",tz),tL=tV(tk,tP);let tR=tV("\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}
8vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}","\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\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(\nunpack_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;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),tF="\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif";var tO={background:tV("uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:tV("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);vec4 out_color=mix(color1,color2,u_mix);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:tV("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius
8/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void 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);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);vec4 world_center=vec4(pos,1);\n#else \nmat3 surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);vec4 world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radiu
8s,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:tV("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:tV("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 FOG\nif (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\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;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying 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;vec2 tilePos=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\nvec3 pos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:tV("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}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:tV("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;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_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:tV("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_2f;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_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-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(\n0.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:tV("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;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1
8);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:tV("#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\nvec4 out_color=color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:tV("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);vec4 out_color=outline_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:tV("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);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:tV("uniform 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);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*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);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:tV("uniform lowp vec3 u_lightpos;varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;varying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\nvoid main() {vec4 color=v_color;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
8),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(v_normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=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;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying highp vec3 v_normal;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\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\nvec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;vec3 pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_normal=normal;v_depth=gl_Position.w;\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,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*=(\n(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)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
8ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);directional*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\nv_color.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:tV("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;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 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\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 vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\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;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_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=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 p=vec3(pos_nx.xy,h);\n#else\nvec3 p=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\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,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*=(\n(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)));}
8\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);directional*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\nv_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:tV("#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) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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(\n(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.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:tV("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;void 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 FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\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;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:tV("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\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 floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\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);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist_a=texture2D(u_dash_image,v_tex_a).a;float sdfdist_b=texture2D(u_dash_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);
8float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\n#ifdef RENDER_LINE_GRADIENT\nhighp vec4 out_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nvec4 out_color=color;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);}}\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;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 vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\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 floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\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;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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:tV("uniform 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);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_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_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;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;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_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:tV("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(\ndot(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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*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 vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:tV("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}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform 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 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;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying 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_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);vec4 offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\nvec4 offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_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(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:tV("#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_
8color\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}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform 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 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 vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying 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_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);vec4 offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\nvec4 offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 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(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:tV
vendor: 6,675 bytes, line 8
8("#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}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform 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 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 vec3 u_up_vector;uniform vec2 u_texsize_icon;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying 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_tex_size.xy;vec2 a_size=a_tex_size.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[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat 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(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:
8tV("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nconst float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=u_skirt_height*u_skirt_height*wireframeOffset;\n#endif\nvec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;\n#endif\n}"),terrainDepth:tV("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:tV("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
8nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",tC),skyboxGradient:tV("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",tC),skyboxCapture:tV
vendor: 3,851 bytes, line 8
8("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:
8tV("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);vec4 color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\nvec4 color=texture2D(u_image0,v_pos0);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;\n#ifdef GLOBE_POLES\nattribute vec3 a_globe_pos;attribute vec2 a_uv;\n#else\nattribute vec2 a_pos;\n#endif\nvarying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idy=u_grid_matrix[1][2];float S=u_grid_matrix[2][2];vec3 latLng=u_grid_matrix*vec3(a_pos,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=a_pos[0]*S;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;\n#ifdef GLOBE_POLES\nvec3 up_vector=normalize(globe_pos)*u_tile_up_scale;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nglobe_pos+=up_vector*height;\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}"),globeAtmosphere:tV("uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));
8return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);\n#ifdef PROJECTION_GLOBE_VIEW\nfloat globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));float horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nfloat horizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}","attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}")};function tU(i,r){let n=i.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let i of n)if("#"===(i=i.trim())[0]&&i.includes("if")&&!i.includes("endif")){i=i.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();let n=i.split(" ");for(let i of n)r.includes(i)||r.push(i)}}function tV(i,r){let n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=r.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),o={},s=[...tB];return tU(i,s),tU(r,s),{fragmentSource:i=i.replace(n,(i,r,n,a,s)=>(o[s]=!0,"define"===r?` 9#ifndef HAS_UNIFORM_u_${s} 10varying ${n} ${a} ${s}; 11#else 12uniform ${n} ${a} u_${s}; 13#endif 14`:` 15#ifdef HAS_UNIFORM_u_${s} 16 ${n} ${a} ${s} = u_${s}; 17#endif 18`)),vertexSource:r=r.replace(n,(i,r,n,a,s)=>{let l="float"===a?"vec2":"vec4",h=s.match(/color/)?"color":l;return o[s]?"define"===r?` 19#ifndef HAS_UNIFORM_u_${s} 20uniform lowp float u_${s}_t; 21attribute ${n} ${l} a_${s}; 22varying ${n} ${a} ${s}; 23#else 24uniform ${n} ${a} u_${s}; 25#endif 26`:"vec4"===h?` 27#ifndef HAS_UNIFORM_u_${s} 28 ${s} = a_${s}; 29#else 30 ${n} ${a} ${s} = u_${s}; 31#endif 32`:` 33#ifndef HAS_UNIFORM_u_${s} 34 ${s} = unpack_mix_${h}(a_${s}, u_${s}_t); 35#else 36 ${n} ${a} ${s} = u_${s}; 37#endif 38`:"define"===r?` 39#ifndef HAS_UNIFORM_u_${s} 40uniform lowp float u_${s}_t; 41attribute ${n} ${l} a_${s}; 42#else 43uniform ${n} ${a} u_${s}; 44#endif 45`:"vec4"===h?` 46#ifndef HAS_UNIFORM_u_${s} 47 ${n} ${a} ${s} = a_${s}; 48#else 49 ${n} ${a} ${s} = u_${s}; 50#endif 51`:` 52#ifndef HAS_UNIFORM_u_${s} 53 ${n} ${a} ${s} = unpack_mix_${h}(a_${s}, u_${s}_t); 54#else 55 ${n} ${a} ${s} = u_${s}; 56#endif 57`}),staticAttributes:a,usedDefines:s}}class tj{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(i,r,n,a,o,s,l){this.context=i;let h=this.boundPaintVertexBuffers.length!==a.length;for(let i=0;!h&&i<a.length;i++)this.boundPaintVertexBuffers[i]!==a[i]&&(h=!0);let u=this.boundDynamicVertexBuffers.length!==l.length;for(let i=0;!u&&i<l.length;i++)this.boundDynamicVertexBuffers[i]!==l[i]&&(u=!0);if(!i.extVertexArrayObject||!this.vao||this.boundProgram!==r||this.boundLayoutVertexBuffer!==n||h||u||this.boundIndexBuffer!==o||this.boundVertexOffset!==s)this.freshBind(r,n,a,o,s,l);else{for(let r of(i.bindVertexArrayOES.set(this.vao),l))r&&r.bind();o&&o.dynamicDraw&&o.bind()}}freshBind(i,r,n,a,o,s){let l;let h=i.numAttributes,u=this.context,c=u.gl;if(u.extVertexArrayObject)this.vao&&this.destroy(),this.vao=u.extVertexArrayObject.createVertexArrayOES(),u.bindVertexArrayOES.set(this.vao),l=0,this.boundProgram=i,this.boundLayoutVertexBuffer=r,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=a,this.boundVertexOffset=o,this.boundDynamicVertexBuffers=s;else{l=u.currentNumAttributes||0;for(let i=h;i<l;i++)c.disableVertexAttribArray(i)}for(let a of(r.enableAttributes(c,i),r.bind(),r.setVertexAttribPointers(c,i,o),n))a.enableAttributes(c,i),a.bind(),a.setVertexAttribPointers(c,i,o);for(let r of s)r&&(r.enableAttributes(c,i),r.bind(),r.setVertexAttribPointers(c,i,o));a&&a.bind(),u.currentNumAttributes=h}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function tN(r,n,a){if(!n.needsDEMTextureUpload)return;let o=r.context,s=o.gl;o.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||r.getTileTexture(a.stride);let l=a.getPixels();n.demTexture?n.demTexture.update(l,{premultiply:!1}):n.demTexture=new i.Texture(o,l,s.RGBA,{premultiply:!1}),n.needsDEMTextureUpload=!1}let tG=r=>({u_matrix:new i.UniformMatrix4f(r),u_image0:new i.Uniform1i(r),u_skirt_height:new i.Uniform1f(r)}),tZ=(i,r)=>({u_matrix:i,u_image0:0,u_skirt_height:r}),t$=(i,r,n,a,o,s,l,h,u,c,p,d,f,m)=>({u_proj_matrix:Float32Array.from(i),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(a),u_merc_matrix:n,u_zoom_transition:o,u_merc_center:s,u_image0:0,u_frustum_tl:l,u_frustum_tr:h,u_frustum_br:u,u_frustum_bl:c,u_globe_pos:p,u_globe_radius:d,u_viewport:f,u_grid_matrix:m?Float32Array.from(m):new Float32Array(9)});function tq(i,r){return null!=i&&null!=r&&!(!i.hasData()||!r.hasData())&&null!=i.demTexture&&null!=r.demTexture&&i.tileID.key!==r.tileID.key}let tX=new class{constructor(){this.operations={}}newMorphing(i,r,n,a,o){if(i in this.operations){let r=this.operations[i];r.to.tileID.key!==n.tileID.key&&(r.queued=n)}else this.operations[i]={startTime:a,phase:0,duration:o,from:r,to:n,queued:null}}getMorphValuesForProxy(i){if(!(i in this.operations))return null;let r=this.operations[i];return{from:r.from,to:r.to,phase:r.phase}}update(i){for(let r in this.operations){let n=this.operations[r];for(n.phase=(i-n.startTime)/n.duration;n.phase>
57=1||!this._validOp(n);)if(!this._nextOp(n,i)){delete this.operations[r];break}}}_nextOp(i,r){return!!i.queued&&(i.from=i.to,i.to=i.queued,i.queued=null,i.phase=0,i.startTime=r,!0)}_validOp(i){return i.from.hasData()&&i.to.hasData()}},tW={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"},tH=i=>({u_matrix:i});function tY(r,n,a,o,s){if(s>0){let l=i.exported.now(),h=(l-r.timeAdded)/s,u=n?(l-n.timeAdded)/s:-1,c=a.getSource(),p=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),d=!n||Math.abs(n.tileID.overscaledZ-p)>Math.abs(r.tileID.overscaledZ-p),f=d&&r.refreshedUponExpiration?1:i.clamp(d?h:1-u,0,1);return r.refreshedUponExpiration&&h>=1&&(r.refreshedUponExpiration=!1),n?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}class tK extends i.SourceCache{constructor(i){let r={type:"raster-dem",maxzoom:i.transform.maxZoom},n=new B(eO(),null),a=eD("mock-dem",r,n,i.style);super("mock-dem",a,!1),a.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,r){i.state="loaded",r(null)}}class tJ extends i.SourceCache{constructor(i){let r=eD("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},new B(eO(),null),i.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,n,a){if(r.freezeTileCoverage)return;this.transform=r;let o=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((n,a)=>{if(n[a.key]="",!this._tiles[a.key]){let n=new i.Tile(a,this._source.tileSize*a.overscaleFactor(),r.tileZoom);n.state="loaded",this._tiles[a.key]=n}return n},{});for(let i in this._tiles)i in o||(this.freeFBO(i),this._tiles[i].unloadVectorData(),delete this._tiles[i])}freeFBO(i){let r=this.proxyCachedFBO[i];if(void 0!==r){let n=Object.values(r);this.renderCachePool.push(...n),delete this.proxyCachedFBO[i]}}deallocRenderCache(){this.renderCache.forEach(i=>i.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class tQ extends i.OverscaledTileID{constructor(i,r,n){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=r,this.projMatrix=n}}class t0 extends i.Elevation{constructor(r,n){super(),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};let[a,o,s]=function(r){let n=new i.StructArrayLayout4i8,a=new i.StructArrayLayout3ui6;n.reserve(17161),a.reserve(33800);let o=i.EXTENT/128,s=i.EXTENT+o/2,l=s+o;for(let r=-o;r<l;r+=o)for(let a=-o;a<l;a+=o){let o=a<0||a>s||r<0||r>s?24575:0,l=i.clamp(Math.round(a),0,i.EXTENT),h=i.clamp(Math.round(r),0,i.EXTENT);n.emplaceBack(l+o,h,l,h)}let h=(i,r)=>{let n=131*r+i;a.emplaceBack(n+1,n,n+131),a.emplaceBack(n+131,n+131+1,n+1)};for(let i=1;i<129;i++)for(let r=1;r<129;r++)h(r,i);return[0,129].forEach(i=>{for(let r=0;r<130;r++)h(r,i),h(i,r)}),[n,a,32768]}(),l=r.context;this.gridBuffer=l.createVertexBuffer(a,i.boundsAttributes.members),this.gridIndexBuffer=l.createIndexBuffer(o),this.gridSegments=i.SegmentVector.simpleSegment(0,0,a.length,o.length),this.gridNoSkirtSegments=i.SegmentVector.simpleSegment(0,0,a.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new tJ(n.map),this.orthoMatrix=i.create(),i.ortho(this.orthoMatrix,0,i.EXTENT,0,i.EXTENT,0,1);let h=l.gl;this._overlapStencilMode=new i.StencilMode({func:h.GEQUAL,mask:255},0,255,h.KEEP,h.KEEP,h.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new tK(n.map)}set style(i){i.on("data",this._onStyleDataEvent.bind(this)),i.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=i,this._checkRenderCacheEfficiency()}update(r,n,a){if(r&&r.terrain){this._style!==r&&(this.style=r),this.enabled=!0;let o=r.terrain.properties;this.sourceCache=0===r.terrain.drapeRenderMode?this._mockSourceCache:r._getSourceCache(o.get("source")),this._exaggeration=o.get("exaggeration");let s=()=>{this.sourceCache.used&&i.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 58This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);let r=this.getScaledDemTileSize();this.sourceCache.update(n,r,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,s(),this._initializing=!0),s(),n.updateElevation(!a),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(i){this._findCoveringTileCache[i]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){let r=this.renderCacheEfficiency(this._style);
58this._style.map._optimizeForTerrain||100!==r.efficiency&&i.warnOnce(`Terrain render cache efficiency is not optimal (${r.efficiency}%) and performance 59 may be affected negatively, consider placing all background, fill and line layers before layer 60 with id '${r.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(i){i.coord&&"source"===i.dataType?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):"style"===i.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(let i in this._style._sourceCaches)this._style._sourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(i=>i.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){let i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;let n=this.proxySourceCache,a=this.painter.transform;this._initializing&&(this._initializing=0===a._centerAltitude&&-1===this.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(a.center),-1),this._emptyDEMTextureDirty=!this._initializing);let o=this.proxyCoords=n.getIds().map(i=>{let r=n.getTileByID(i).tileID;return r.projMatrix=a.calculateProjMatrix(r.toUnwrapped()),r});(function(r,n){let a=n.transform.pointCoordinate(n.transform.getCameraPoint()),o=new i.pointGeometry(a.x,a.y);r.sort((r,n)=>{if(n.overscaledZ-r.overscaledZ)return n.overscaledZ-r.overscaledZ;let a=new i.pointGeometry(r.canonical.x+(1<<r.canonical.z)*r.wrap,r.canonical.y),s=new i.pointGeometry(n.canonical.x+(1<<n.canonical.z)*n.wrap,n.canonical.y),l=o.mult(1<<r.canonical.z);return l.x-=.5,l.y-=.5,l.distSqr(a)-l.distSqr(s)})})(o,this.painter),this._previousZoom=a.zoom;let s=this.proxyToSource||{};this.proxyToSource={},o.forEach(i=>{this.proxyToSource[i.key]={}}),this.terrainTileForTile={};let l=this._style._sourceCaches;for(let i in l){let n=l[i];if(!n.used||(n!==this.sourceCache&&this.resetTileLookupCache(n.id),this._setupProxiedCoordsForOrtho(n,r[i],s),n.usedForTerrain))continue;let a=r[i];n.getSource().reparseOverscaled&&this._assignTerrainTiles(a)}this.proxiedCoords[n.id]=o.map(i=>new tQ(i,i.key,this.orthoMatrix)),this._assignTerrainTiles(o),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(s),this.renderingToTexture=!1,this._updateTimestamp=i.exported.now();let h={};for(let i of(this._visibleDemTiles=[],this.proxyCoords)){let r=this.terrainTileForTile[i.key];if(!r)continue;let n=r.tileID.key;n in h||(this._visibleDemTiles.push(r),h[n]=n)}}_assignTerrainTiles(i){this._initializing||i.forEach(i=>{if(this.terrainTileForTile[i.key])return;let r=this._findTileCoveringTileID(i,this.sourceCache);r&&(this.terrainTileForTile[i.key]=r)})}_prepareDEMTextures(){let i=this.painter.context,r=i.gl;for(let n in this.terrainTileForTile){let a=this.terrainTileForTile[n],o=a.dem;o&&(!a.demTexture||a.needsDEMTextureUpload)&&(i.activeTexture.set(r.TEXTURE1),tN(this.painter,a,o))}}_prepareDemTileUniforms(i,r,n,a){if(!r||null==r.demTexture)return!1;let o=i.tileID.canonical,s=Math.pow(2,r.tileID.canonical.z-o.z),l=a||"";return n[`u_dem_tl${l}`]=[o.x*s%1,o.y*s%1],n[`u_dem_scale${l}`]=s,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){let r=this.painter.context,n=r.gl;if(!this._emptyDepthBufferTexture){let a=new i.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new i.Texture(r,a,n.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let i=0,r=this._visibleDemTiles.reduce((r,n)=>{if(!n.dem)return r;let a=n.dem.tree.minimums[0];return a>0&&i++,r+a},0);return i?r/i:0}_updateEmptyDEMTexture(){let r=this.painter.context,n=r.gl;r.activeTexture.set(n.TEXTURE2);let a=this._getLoadedAreaMinimum(),o=new i.RGBAImage({width:1,height:1},new Uint8Array(i.DEMData.pack(a,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let s=this._emptyDEMTexture;return s?s.update(o,{premultiply:!1}):s=this._emptyDEMTexture=new i.Texture(r,o,n.RGBA,{premultiply:!1}),s}setupElevationDraw(r,n,a){var o;let s=this.painter.context,l=s.gl,h=(o=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:i.DEMData.getUnpackVector(o),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0,u_tile_tl_up:[0,0,1],u_tile_tr_up:[0,0,1],u_tile_br_up:[0,0,1],u_tile_bl_up:[0,0,1],u_tile_up_scale:1});h.u_dem_size=this.sourceCache.getSource().tileSize,h.u_exaggeration=this.exaggeration();let u=this.painter.transform,c=u.projection,p=r.tileID.canonical;h.u_tile_tl_up=c.upVector(p,0,0),h.u_tile_tr_up=c.upVector(p,i.EXTENT,0),h.u_tile_br_up=c.upVector(p,i.EXTENT,i.EXTENT),h.u_tile_bl_up=c.upVector(p,0,i.EXTENT),h.u_tile_up_scale=a&&a.useDenormalizedUpVectorScale?i.GLOBE_METERS_TO_ECEF:c.upVectorScale(p,u.center.lat,u.worldSize).metersToTile;let d=null,f=null,m=1;if(a&&a.morphing&&this._useVertexMorphing){let i=a.morphing.srcDemTile,n=a.morphing.dstDemTile;
60m=a.morphing.phase,i&&n&&(this._prepareDemTileUniforms(r,i,h,"_prev")&&(f=i),this._prepareDemTileUniforms(r,n,h)&&(d=n))}if(f&&d?(s.activeTexture.set(l.TEXTURE2),d.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),s.activeTexture.set(l.TEXTURE4),f.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),h.u_dem_lerp=m):(d=this.terrainTileForTile[r.tileID.key],s.activeTexture.set(l.TEXTURE2),(this._prepareDemTileUniforms(r,d,h)?d.demTexture:this.emptyDEMTexture).bind(l.NEAREST,l.CLAMP_TO_EDGE)),s.activeTexture.set(l.TEXTURE3),a&&a.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),this._depthFBO&&(h.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),h.u_depth_size_inv=[1,1]),a&&a.useMeterToDem&&d){let r=(1<<d.tileID.canonical.z)*i.mercatorZfromAltitude(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;h.u_meter_to_dem=r}a&&a.labelPlaneMatrixInv&&(h.u_label_plane_matrix_inv=a.labelPlaneMatrixInv),n.setTerrainUniformValues(s,h)}renderToBackBuffer(r){let n=this.painter,a=this.painter.context;0!==r.length&&(a.bindFramebuffer.set(null),a.viewport.set([0,0,n.width,n.height]),n.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(r,n,a,o,s){if("globe"===r.transform.projection.name)!function(r,n,a,o,s){let l,h;let u=r.context,c=u.gl,p=r.options.showTerrainWireframe?2:0,d=r.transform,f=i.globeUseCustomAntiAliasing(r,u,d),m=(i,n)=>{if(h===i)return;let a=[tW[i],"PROJECTION_GLOBE_VIEW"];f&&a.push("CUSTOM_ANTIALIASING"),n&&a.push(tW[p]),l=r.useProgram("globeRaster",null,a),h=i},_=r.colorModeForRenderPass(),g=new i.DepthMode(c.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tX.update(s);let y=i.calculateGlobeMercatorMatrix(d),x=[i.mercatorXfromLng(d.center.lng),i.mercatorYfromLat(d.center.lat)],v=r.globeSharedBuffers,b=[d.width*i.exported.devicePixelRatio,d.height*i.exported.devicePixelRatio],w=Float32Array.from(d.globeMatrix),T={useDenormalizedUpVectorScale:!0};if((p?[!1,!0]:[!1]).forEach(p=>{h=-1;let f=p?c.LINES:c.TRIANGLES;for(let h of o){let o=a.getTile(h),E=i.StencilMode.disabled,S=n.prevTerrainTileForTile[h.key],I=n.terrainTileForTile[h.key];tq(S,I)&&tX.newMorphing(h.key,S,I,s,250),u.activeTexture.set(c.TEXTURE0),o.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=tX.getMorphValuesForProxy(h.key),M=A?1:0;A&&i.extend$1(T,{morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:i.easeCubicInOut(A.phase)}});let C=i.tileCornersToBounds(h.canonical),z=i.getLatitudinalLod(C.getCenter().lat),P=i.getGridMatrix(h.canonical,C,z),k=i.globeNormalizeECEF(i.globeTileBounds(h.canonical)),D=t$(d.projMatrix,w,y,k,i.globeToMercatorTransition(d.zoom),x,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,b,P);if(m(M,p),n.setupElevationDraw(o,l,T),r.prepareDrawProgram(u,l,h.toUnwrapped()),v){let[n,a,o]=p?v.getWirefameBuffers(r.context,z):v.getGridBuffers(z);l.draw(u,f,g,E,_,i.CullFaceMode.backCCW,D,"globe_raster",n,a,o)}}}),v){let s=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];for(let h of(f&&s.push("CUSTOM_ANTIALIASING"),l=r.useProgram("globeRaster",null,s),o)){let{x:o,y:s,z:p}=h.canonical,f=0===s,m=s===(1<<p)-1,[y,w,E,S]=v.getPoleBuffers(p);if(S&&(f||m)){let s=a.getTile(h);u.activeTexture.set(c.TEXTURE0),s.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let v=i.globePoleMatrixForTile(p,o,d),I=i.globeNormalizeECEF(i.globeTileBounds(h.canonical)),A=(r,n)=>r.draw(u,c.TRIANGLES,g,i.StencilMode.disabled,_,i.CullFaceMode.disabled,t$(d.projMatrix,v,v,I,0,x,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,b),"globe_pole_raster",n,E,S);n.setupElevationDraw(s,l,T),r.prepareDrawProgram(u,l,h.toUnwrapped()),f&&A(l,y),m&&(v=i.scale(i.create(),v,[1,-1,1]),A(l,w))}}}}(r,n,a,o,s);else{let l,h;let u=r.context,c=u.gl,p=r.options.showTerrainWireframe?2:0,d=(i,n)=>{if(h===i)return;let a=[tW[i]];n&&a.push(tW[p]),l=r.useProgram("terrainRaster",null,a),h=i},f=r.colorModeForRenderPass(),m=new i.DepthMode(c.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tX.update(s);let _=r.transform,g=6*Math.pow(1.5,22-_.zoom)*n.exaggeration();
60(p?[!1,!0]:[!1]).forEach(p=>{h=-1;let y=p?c.LINES:c.TRIANGLES,[x,v]=p?n.getWirefameBuffer():[n.gridIndexBuffer,n.gridSegments];for(let h of o){let o;let b=a.getTile(h),w=i.StencilMode.disabled,T=n.prevTerrainTileForTile[h.key],E=n.terrainTileForTile[h.key];tq(T,E)&&tX.newMorphing(h.key,T,E,s,250),u.activeTexture.set(c.TEXTURE0),b.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST);let S=tX.getMorphValuesForProxy(h.key),I=S?1:0;S&&(o={morphing:{srcDemTile:S.from,dstDemTile:S.to,phase:i.easeCubicInOut(S.phase)}});let A=tZ(h.projMatrix,!function(i,r){let n=1<<i.z;return!r&&(0===i.x||i.x===n-1)||0===i.y||i.y===n-1}(h.canonical,_.renderWorldCopies)?g:g/10);d(I,p),n.setupElevationDraw(b,l,o),r.prepareDrawProgram(u,l,h.toUnwrapped()),l.draw(u,y,m,w,f,i.CullFaceMode.backCCW,A,"terrain_raster",n.gridBuffer,x,v)}})}}(n,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,n.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(0===this._drapedRenderBatches.length)return r+1;this.renderingToTexture=!0;let n=this.painter,a=this.painter.context,o=this.proxySourceCache,s=this.proxiedCoords[o.id],l=this._drapedRenderBatches.shift(),h=[],u=n.style.order,c=0;for(let p of s){let s;let d=o.getTileByID(p.proxyTileKey),f=o.proxyCachedFBO[p.key]?o.proxyCachedFBO[p.key][r]:void 0,m=void 0!==f?o.renderCache[f]:this.pool[c++],_=void 0!==f;if(d.texture=m.tex,_&&!m.dirty){h.push(d.tileID);continue}a.bindFramebuffer.set(m.fb.framebuffer),this.renderedToTile=!1,m.dirty&&(a.clear({color:i.Color.transparent,stencil:0}),m.dirty=!1);for(let i=l.start;i<=l.end;++i){let r=n.style._layers[u[i]];if(r.isHidden(n.transform.zoom))continue;let o=n.style._getLayerSourceCache(r),l=o?this.proxyToSource[p.key][o.id]:[p];l&&(a.viewport.set([0,0,m.fb.width,m.fb.height]),s!==(o?o.id:null)&&(this._setupStencil(m,l,r,o),s=o?o.id:null),n.renderLayer(n,o,r,l))}this.renderedToTile?(m.dirty=!0,h.push(d.tileID)):_||--c,5===c&&(c=0,this.renderToBackBuffer(h))}return this.renderToBackBuffer(h),this.renderingToTexture=!1,a.bindFramebuffer.set(null),a.viewport.set([0,0,n.width,n.height]),l.end+1}postRender(){}renderCacheEfficiency(i){let r=i.order.length;if(0===r)return{efficiency:100};let n,a=0,o=0,s=!1;for(let l=0;l<r;++l){let r=i._layers[i.order[l]];this._style.isLayerDraped(r)?(s&&++a,++o):s||(s=!0,n=r.id)}return 0===o?{efficiency:100}:{efficiency:100*(1-a/o),firstUndrapedLayer:n}}getMinElevationBelowMSL(){let i=0;return this._visibleDemTiles.filter(i=>i.dem).forEach(r=>{i=Math.min(i,r.dem.tree.minimums[0])}),0===i?i:(i-30)*this._exaggeration}raycast(i,r,n){if(!this._visibleDemTiles)return null;let a=this._visibleDemTiles.filter(i=>i.dem).map(a=>{let o=a.tileID,s=1<<o.overscaledZ,{x:l,y:h}=o.canonical,u=l/s,c=(l+1)/s,p=h/s,d=(h+1)/s;return{minx:u,miny:p,maxx:c,maxy:d,t:a.dem.tree.raycastRoot(u,p,c,d,i,r,n),tile:a}});for(let o of(a.sort((i,r)=>(null!==i.t?i.t:Number.MAX_VALUE)-(null!==r.t?r.t:Number.MAX_VALUE)),a)){if(null==o.t)break;let a=o.tile.dem.tree.raycast(o.minx,o.miny,o.maxx,o.maxy,i,r,n);if(null!=a)return a}return null}_createFBO(){let r=this.painter.context,n=r.gl,a=this.drapeBufferSize;r.activeTexture.set(n.TEXTURE0);let o=new i.Texture(r,{width:a[0],height:a[1],data:null},n.RGBA);o.bind(n.LINEAR,n.CLAMP_TO_EDGE);let s=r.createFramebuffer(a[0],a[1],!1);return s.colorAttachment.set(o.texture),s.depthAttachment=new eI(r,s.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,a[0],a[1]),this._stencilRef=0,s.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):s.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&!r.extTextureFilterAnisotropicForceOff&&n.texParameterf(n.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:s,tex:o,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.light&&this._style.light.hasTransition())return!0;for(let i in this._style._sourceCaches)if(this._style._sourceCaches[i].hasTransition())return!0;return this._style.order.some(i=>{let r=this._style._layers[i],n=r.isHidden(this.painter.transform.zoom),a=r.getCrossfadeParameters(),o=!!a&&1!==a.t,s=r.hasTransition();return"custom"!==r.type&&!n&&(o||s)})}_clearRasterFadeFromRenderCache(){let i=!1;for(let r in this._style._sourceCaches)if(this._style._sourceCaches[r]._source instanceof eC){i=!0;break}if(i)for(let i=0;i<this._style.order.length;++i){let r=this._style._layers[this._style.order[i]],n=r.isHidden(this.painter.transform.zoom),a=this._style._getLayerSourceCache(r);
60if("raster"!==r.type||n||!a)continue;let o=r.paint.get("raster-fade-duration");for(let i of this.proxyCoords){let r=this.proxyToSource[i.key][a.id];if(r)for(let i of r){let r=tY(a.getTile(i),a.findLoadedParent(i,0),a,this.painter.transform,o);(1!==r.opacity||0!==r.mix)&&this._clearRenderCacheForTile(a.id,i)}}}}_setupDrapedRenderBatches(){let i=this._style.order,r=i.length;if(0===r)return;let n=[],a,o=0,s=this._style._layers[i[o]];for(;!this._style.isLayerDraped(s)&&s.isHidden(this.painter.transform.zoom)&&++o<r;)s=this._style._layers[i[o]];for(;o<r;++o){let r=this._style._layers[i[o]];r.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(r)?void 0===a&&(a=o):void 0!==a&&(n.push({start:a,end:o-1}),a=void 0))}void 0!==a&&n.push({start:a,end:o-1}),this._drapedRenderBatches=n}_setupRenderCache(i){let r=this.proxySourceCache;if(this._shouldDisableRenderCache()||this._invalidateRenderCache){if(this._invalidateRenderCache=!1,r.renderCache.length>r.renderCachePool.length){let i=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let n=0;n<i.length;++n){let a=Object.values(i[n]);r.renderCachePool.push(...a)}}return}this._clearRasterFadeFromRenderCache();let n=this.proxyCoords,a=this._tilesDirty;for(let o=n.length-1;o>=0;o--){let s=n[o];if(r.getTileByID(s.key),void 0!==r.proxyCachedFBO[s.key]){let n=i[s.key],o=this.proxyToSource[s.key],l=0;for(let i in o){let r=o[i],s=n[i];if(!s||s.length!==r.length||r.some((r,n)=>r!==s[n]||a[i]&&a[i].hasOwnProperty(r.key))){l=-1;break}++l}for(let i in r.proxyCachedFBO[s.key])r.renderCache[r.proxyCachedFBO[s.key][i]].dirty=l<0||l!==Object.values(n).length}}let o=[...this._drapedRenderBatches];for(let i of(o.sort((i,r)=>r.end-r.start-(i.end-i.start)),o))for(let a of n){if(r.proxyCachedFBO[a.key])continue;let n=r.renderCachePool.pop();void 0===n&&r.renderCache.length<50&&(n=r.renderCache.length,r.renderCache.push(this._createFBO())),void 0!==n&&(r.proxyCachedFBO[a.key]={},r.proxyCachedFBO[a.key][i.start]=n,r.renderCache[n].dirty=!0)}this._tilesDirty={}}_setupStencil(i,r,n,a){let o;if(!a||!this._sourceTilesOverlap[a.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));let s=this.painter.context,l=s.gl;if(r.length<=1)return void(this._overlapStencilType=!1);if(n.isTileClipped())o=r.length,this._overlapStencilMode.test={func:l.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>r[r.length-1].overscaledZ))return void(this._overlapStencilType=!1);o=1,this._overlapStencilMode.test={func:l.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+o>255&&(s.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=o,this._overlapStencilMode.ref=this._stencilRef,n.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):i.StencilMode.disabled}_renderTileClippingMasks(r,n){let a=this.painter,o=this.painter.context,s=o.gl;a._tileClippingMaskIDs={},o.setColorMode(i.ColorMode.disabled),o.setDepthMode(i.DepthMode.disabled);let l=a.useProgram("clippingMask");for(let h of r){let r=a._tileClippingMaskIDs[h.key]=--n;l.draw(o,s.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:s.ALWAYS,mask:0},r,255,s.KEEP,s.KEEP,s.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,tH(h.projMatrix),"$clipping",a.tileExtentBuffer,a.quadTriangleIndexBuffer,a.tileExtentSegments)}}pointCoordinate(r){let n=this.painter.transform;if(r.x<0||r.x>n.width||r.y<0||r.y>n.height)return null;let a=[r.x,r.y,1,1];i.transformMat4$1(a,a,n.pixelMatrixInverse),i.scale$1(a,a,1/a[3]),a[0]/=n.worldSize,a[1]/=n.worldSize;let o=n._camera.position,s=i.mercatorZfromAltitude(1,n.center.lat),l=[o[0],o[1],o[2]/s,0],h=i.subtract([],a.slice(0,3),l);i.normalize(h,h);let u=this.raycast(l,h,this._exaggeration);return null!==u&&u?(i.scaleAndAdd(l,l,h,u),l[3]=l[2],l[2]*=s,l):null}drawDepth(){let r=this.painter,n=r.context,a=this.proxySourceCache,o=Math.ceil(r.width),s=Math.ceil(r.height);if(this._depthFBO&&(this._depthFBO.width!==o||this._depthFBO.height!==s)&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){let r=n.gl,a=n.createFramebuffer(o,s,!0);n.activeTexture.set(r.TEXTURE0);let l=new i.Texture(n,{width:o,height:s,data:null},r.RGBA);l.bind(r.NEAREST,r.CLAMP_TO_EDGE),a.colorAttachment.set(l.texture);let h=n.createRenderbuffer(n.gl.DEPTH_COMPONENT16,o,s);a.depthAttachment.set(h),this._depthFBO=a,this._depthTexture=l}n.bindFramebuffer.set(this._depthFBO.framebuffer),n.viewport.set([0,0,o,s]),function(r,n,a,o){if("globe"===r.transform.projection.name)return;let s=r.context,l=s.gl;s.clear({depth:1});let h=r.useProgram("terrainDepth"),u=new i.DepthMode(l.LESS,i.DepthMode.ReadWrite,r.depthRangeFor3D);for(let r of o){let o=a.getTile(r),c=tZ(r.projMatrix,0);n.setupElevationDraw(o,h),h.draw(s,l.TRIANGLES,u,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.backCCW,c,"terrain_depth",n.gridBuffer,n.gridIndexBuffer,n.gridNoSkirtSegments)}}(r,this,a,this.proxyCoords)}_setupProxiedCoordsForOrtho(i,r,n){if(i.getSource() instanceof eP)return this._setupProxiedCoordsForImageSource(i,r,n);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};let a=this.proxiedCoords[i.id]=[],o=this.proxyCoords;for(let r=0;r<o.length;r++){let s=o[r],l=this._findTileCoveringTileID(s,i);if(l){let r=this._createProxiedId(s,l,n[s.key]&&n[s.key][i.id]);a.push(r),this.proxyToSource[s.key][i.id]=[r]}}let s=!1;for(let o=0;o<r.length;o++){let l=i.getTile(r[o]);if(!l||!l.hasData())continue;let h=this._findTileCoveringTileID(l.tileID,this.proxySourceCache);
60if(h&&h.tileID.canonical.z!==l.tileID.canonical.z){let r=this.proxyToSource[h.tileID.key][i.id],o=this._createProxiedId(h.tileID,l,n[h.tileID.key]&&n[h.tileID.key][i.id]);r?r.splice(r.length-1,0,o):this.proxyToSource[h.tileID.key][i.id]=[o],a.push(o),s=!0}}this._sourceTilesOverlap[i.id]=s}_setupProxiedCoordsForImageSource(r,n,a){if(!r.getSource().loaded())return;let o=this.proxiedCoords[r.id]=[],s=this.proxyCoords,l=r.getSource(),h=new i.pointGeometry(l.tileID.x,l.tileID.y)._div(1<<l.tileID.z),u=l.coordinates.map(i.MercatorCoordinate.fromLngLat).reduce((i,r)=>(i.min.x=Math.min(i.min.x,r.x-h.x),i.min.y=Math.min(i.min.y,r.y-h.y),i.max.x=Math.max(i.max.x,r.x-h.x),i.max.y=Math.max(i.max.y,r.y-h.y),i),{min:new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(r,n)=>{let a=r.wrap+r.canonical.x/(1<<r.canonical.z),o=r.canonical.y/(1<<r.canonical.z),s=i.EXTENT/(1<<r.canonical.z),l=n.wrap+n.canonical.x/(1<<n.canonical.z),h=n.canonical.y/(1<<n.canonical.z);return a+s<l+u.min.x||a>l+u.max.x||o+s<h+u.min.y||o>h+u.max.y};for(let i=0;i<s.length;i++){let l=s[i];for(let i=0;i<n.length;i++){let s=r.getTile(n[i]);if(!s||!s.hasData()||c(l,s.tileID))continue;let h=this._createProxiedId(l,s,a[l.key]&&a[l.key][r.id]),u=this.proxyToSource[l.key][r.id];u?u.push(h):this.proxyToSource[l.key][r.id]=[h],o.push(h)}}}_createProxiedId(r,n,a){let o=this.orthoMatrix;if(a){let i=a.find(i=>i.key===n.tileID.key);if(i)return i}if(n.tileID.key!==r.key){let a,s,l;let h=r.canonical.z-n.tileID.canonical.z;o=i.create();let u=n.tileID.wrap-r.wrap<<r.overscaledZ;h>0?(s=(a=i.EXTENT>>h)*((n.tileID.canonical.x<<h)-r.canonical.x+u),l=a*((n.tileID.canonical.y<<h)-r.canonical.y)):(a=i.EXTENT<<-h,s=i.EXTENT*(n.tileID.canonical.x-(r.canonical.x+u<<-h)),l=i.EXTENT*(n.tileID.canonical.y-(r.canonical.y<<-h))),i.ortho(o,0,a,0,a,0,1),i.translate(o,o,[s,l,0])}return new tQ(n.tileID,r.key,o)}_findTileCoveringTileID(r,n){let a=n.getTile(r);if(a&&a.hasData())return a;let o=this._findCoveringTileCache[n.id],s=o[r.key];if((a=s?n.getTileByID(s):null)&&a.hasData()||null===s)return a;let l=a?a.tileID:r,h=l.overscaledZ,u=n.getSource().minzoom,c=[];if(!s){let o=n.getSource().maxzoom;if(r.canonical.z>=o){let a=r.canonical.z-o;n.getSource().reparseOverscaled?(h=Math.max(r.canonical.z+2,n.transform.tileZoom),l=new i.OverscaledTileID(h,r.wrap,o,r.canonical.x>>a,r.canonical.y>>a)):0!==a&&(h=o,l=new i.OverscaledTileID(h,r.wrap,o,r.canonical.x>>a,r.canonical.y>>a))}l.key!==r.key&&(c.push(l.key),a=n.getTile(l))}let p=i=>{c.forEach(r=>{o[r]=i}),c.length=0};for(h-=1;h>=u&&(!a||!a.hasData());h--){a&&p(a.tileID.key);let i=l.calculateScaledKey(h);if((a=n.getTileByID(i))&&a.hasData())break;let r=o[i];if(null===r)break;void 0===r?c.push(i):a=n.getTileByID(r)}return p(a?a.tileID.key:null),a&&a.hasData()?a:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(i,r){let n=this._tilesDirty[i];n||(n=this._tilesDirty[i]={}),n[r.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){let r=function(r){let n=0,a=new i.StructArrayLayout2ui4;for(let i=1;i<129;i++){for(let r=1;r<129;r++)n=131*i+r,a.emplaceBack(n,n+1),a.emplaceBack(n,n+131),a.emplaceBack(n+1,n+131),128===i&&a.emplaceBack(n+131,n+131+1);a.emplaceBack(n+1,n+1+131)}return a}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(r),this.wireframeSegments=i.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,r.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class t1{static cacheKey(i,r,n,a){let o=`${r}${a?a.cacheKey:""}`;for(let r of n)i.usedDefines.includes(r)&&(o+=`/${r}`);return o}constructor(r,n,a,o,s,l){let h=r.gl;this.program=h.createProgram();let u=function(i){let r=[];for(let n=0;n<i.length;n++){if(null===i[n])continue;let a=i[n].split(" ");r.push(a.pop())}return r}(a.staticAttributes),c=o?o.getBinderAttributes():[],p=u.concat(c),d=o?o.defines():[];d=d.concat(l.map(i=>`#define ${i}`));let f=d.concat(r.extStandardDerivatives?"#extension GL_OES_standard_derivatives : enable\n".concat(tF):tF,tF,tM,tR.fragmentSource,tL.fragmentSource,a.fragmentSource).join("\n"),m=d.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",tM,tR.vertexSource,tL.vertexSource,tD.vertexSource,a.vertexSource).join("\n"),_=h.createShader(h.FRAGMENT_SHADER);if(h.isContextLost())return void(this.failedToCreate=!0);h.shaderSource(_,f),h.compileShader(_),h.attachShader(this.program,_);let g=h.createShader(h.VERTEX_SHADER);if(h.isContextLost())this.failedToCreate=!0;else{h.shaderSource(g,m),h.compileShader(g),h.attachShader(this.program,g),this.attributes={},this.numAttributes=p.length;for(let i=0;i<this.numAttributes;i++)p[i]&&(h.bindAttribLocation(this.program,i,p[i]),this.attributes[p[i]]=i);h.linkProgram(this.program),h.deleteShader(g),h.deleteShader(_),this.fixedUniforms=s(r),this.binderUniforms=o?o.getUniforms(r):[],-1!==l.indexOf("TERRAIN")&&(this.terrainUniforms={u_dem:new i.Uniform1i(r),u_dem_prev:new i.Uniform1i(r),u_dem_unpack:new i.Uniform4f(r),u_dem_tl:new i.Uniform2f(r),u_dem_scale:new i.Uniform1f(r),u_dem_tl_prev:new i.Uniform2f(r),u_dem_scale_prev:new i.Uniform1f(r),u_dem_size:new i.Uniform1f(r),u_dem_lerp:new i.Uniform1f(r),u_exaggeration:new i.Uniform1f(r),u_depth:new i.Uniform1i(r),u_depth_size_inv:new i.Uniform2f(r),u_meter_to_dem:new i.Uniform1f(r),u_label_plane_matrix_inv:new i.UniformMatrix4f(r),u_tile_tl_up:new i.Uniform3f(r),u_tile_tr_up:new i.Uniform3f(r),u_tile_br_up:new i.Uniform3f(r),u_tile_bl_up:new i.Uniform3f(r),u_tile_up_scale:new i.Uniform1f(r)}),-1!==l.indexOf("FOG")&&(this.fogUniforms={u_fog_matrix:new i.UniformMatrix4f(r),u_fog_range:new i.Uniform2f(r),u_fog_color:new i.Uniform4f(r),u_fog_horizon_blend:new i.Uniform1f(r),u_fog_temporal_offset:new i.Uniform1f(r),u_frustum_tl:new i.Uniform3f(r),u_frustum_tr:new i.Uniform3f(r),u_frustum_br:new i.Uniform3f(r),u_frustum_bl:new i.Uniform3f(r),u_globe_pos:new i.Uniform3f(r),u_globe_radius:new i.Uniform1f(r),u_globe_transition:new i.Uniform1f(r),u_is_globe:new i.Uniform1i(r),u_viewport:new i.Uniform2f(r)})}}setTerrainUniformValues(i,r){if(!this.terrainUniforms)return;let n=this.terrainUniforms;if(!this.failedToCreate)for(let a in i.program.set(this.program),r)n[a].set(this.program,a,r[a])}setFogUniformValues(i,r){if(!this.fogUniforms)return;let n=this.fogUniforms;if(!this.failedToCreate)for(let a in i.program.set(this.program),r)n[a].set(this.program,a,r[a])}draw(i,r,n,a,o,s,l,h,u,c,p,d,f,m,_){let g=i.gl;if(this.failedToCreate)return;for(let r of(i.program.set(this.program),i.setDepthMode(n),i.setStencilMode(a),i.setColorMode(o),i.setCullFace(s),Object.keys(this.fixedUniforms)))this.fixedUniforms[r].set(this.program,r,l[r]);m&&m.setUniforms(this.program,i,this.binderUniforms,d,{zoom:f});let y={[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[r];for(let n of p.get()){let a=n.vaos||(n.vaos={});(a[h]||(a[h]=new tj)).bind(i,this,u,m?m.getPaintVertexBuffers():[],c,n.vertexOffset,_||[]),g.drawElements(r,n.primitiveLength*y,g.UNSIGNED_SHORT,n.primitiveOffset*y*2)}}}function t2(i,r,n){let a=1/R(n,1,r.transform.tileZoom),o=Math.pow(2,n.tileID.overscaledZ
60),s=n.tileSize*Math.pow(2,r.transform.tileZoom)/o,l=s*(n.tileID.canonical.x+n.tileID.wrap*o),h=s*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,i.fromScale,i.toScale],u_fade:i.t,u_pixel_coord_upper:[l>>16,h>>16],u_pixel_coord_lower:[65535&l,65535&h]}}let t3=i.create(),t5=(r,n,a,o,s,l,h,u,c,p,d)=>{let f=n.style.light,m=f.properties.get("position"),_=[m.x,m.y,m.z],g=i.create$1();"viewport"===f.properties.get("anchor")&&(i.fromRotation(g,-n.transform.angle),i.transformMat3(_,_,g));let y=f.properties.get("color"),x=n.transform,v={u_matrix:r,u_lightpos:_,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+a,u_opacity:o,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:t3,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:s,u_edge_radius:l};return"globe"===x.projection.name&&(v.u_tile_id=[h.canonical.x,h.canonical.y,1<<h.canonical.z],v.u_zoom_transition=c,v.u_inv_rot_matrix=d,v.u_merc_center=p,v.u_up_dir=x.projection.upVector(new i.CanonicalTileID(0,0,0),p[0]*i.EXTENT,p[1]*i.EXTENT),v.u_height_lift=u),v},t4=(r,n,a,o,s,l,h,u,c,p,d,f,m)=>{let _=t5(r,n,a,o,s,l,h,p,d,f,m),g={u_height_factor:-Math.pow(2,h.overscaledZ)/c.tileSize/8};return i.extend(_,t2(u,n,c),g)},t6=i=>({u_matrix:i}),t8=(r,n,a,o)=>i.extend(t6(r),t2(a,n,o)),t9=(i,r)=>({u_matrix:i,u_world:r}),t7=(r,n,a,o,s)=>i.extend(t8(r,n,a,o),{u_world:s}),ie=i.create(),it=(r,n,a,o,s,l)=>{let h;let u=r.transform,c="globe"===u.projection.name;if("map"===l.paint.get("circle-pitch-alignment")){if(c){let r=i.globePixelsToTileUnits(u.zoom,n.canonical)*u._pixelsPerMercatorPixel;h=Float32Array.from([r,0,0,r])}else h=u.calculatePixelsToTileUnitsMatrix(a)}else h=new Float32Array([u.pixelsToGLUnits[0],0,0,u.pixelsToGLUnits[1]]);let p={u_camera_to_center_distance:u.cameraToCenterDistance,u_matrix:r.translatePosMatrix(n.projMatrix,a,l.paint.get("circle-translate"),l.paint.get("circle-translate-anchor")),u_device_pixel_ratio:i.exported.devicePixelRatio,u_extrude_scale:h,u_inv_rot_matrix:ie,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){p.u_inv_rot_matrix=o,p.u_merc_center=s,p.u_tile_id=[n.canonical.x,n.canonical.y,1<<n.canonical.z],p.u_zoom_transition=i.globeToMercatorTransition(u.zoom);let r=s[0]*i.EXTENT,a=s[1]*i.EXTENT;p.u_up_dir=u.projection.upVector(new i.CanonicalTileID(0,0,0),r,a)}return p},ii=i=>{let r=[];return"map"===i.paint.get("circle-pitch-alignment")&&r.push("PITCH_WITH_MAP"),"map"===i.paint.get("circle-pitch-scale")&&r.push("SCALE_WITH_MAP"),r},ir=(r,n,a,o)=>{let s=i.EXTENT/a.tileSize;return{u_matrix:r,u_camera_to_center_distance:n.getCameraToCenterDistance(o),u_extrude_scale:[n.pixelsToGLUnits[0]/s,n.pixelsToGLUnits[1]/s]}},ia=(i,r,n=1)=>({u_matrix:i,u_color:r,u_overlay:0,u_overlay_scale:n}),io=i.create(),is=(r,n,a,o,s,l,h)=>{let u=r.transform,c="globe"===u.projection.name,p=c?i.globePixelsToTileUnits(u.zoom,n.canonical)*u._pixelsPerMercatorPixel:R(a,1,l),d={u_matrix:n.projMatrix,u_extrude_scale:p,u_intensity:h,u_inv_rot_matrix:io,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){d.u_inv_rot_matrix=o,d.u_merc_center=s,d.u_tile_id=[n.canonical.x,n.canonical.y,1<<n.canonical.z],d.u_zoom_transition=i.globeToMercatorTransition(u.zoom);let r=s[0]*i.EXTENT,a=s[1]*i.EXTENT;d.u_up_dir=u.projection.upVector(new i.CanonicalTileID(0,0,0),r,a)}return d},il=(i,r,n,a,o,s,l,h)=>{let u=i.transform,c=u.calculatePixelsToTileUnitsMatrix(r),p={u_matrix:ic(i,r,n,o),u_pixels_to_tile_units:c,u_device_pixel_ratio:l,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:s,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0,u_trim_offset:h};if(ip(n)){let n=iu(r,i.transform);p.u_texsize=r.lineAtlasTexture.size,p.u_scale=[n,a.fromScale,a.toScale],p.u_mix=a.t}return p},ih=(i,r,n,a,o,s)=>{let l=i.transform,h=iu(r,l);return{u_matrix:ic(i,r,n,o),u_texsize:r.imageAtlasTexture.size,u_pixels_to_tile_units:l.calculatePixelsToTileUnitsMatrix(r),u_device_pixel_ratio:s,u_image:0,u_scale:[h,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_alph
60a_discard_threshold:0}};function iu(i,r){return 1/R(i,1,r.tileZoom)}function ic(i,r,n,a){return i.translatePosMatrix(a||r.tileID.projMatrix,r,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}function ip(i){let r=i.paint.get("line-dasharray").value;return r.value||"constant"!==r.kind}let id=(i,r,n,a,o,s)=>{var l,h;return{u_matrix:i,u_tl_parent:r,u_scale_parent:n,u_fade_t:a.mix,u_opacity:a.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(h=o.paint.get("raster-saturation"))>0?1-1/(1.001-h):-h,u_contrast_factor:(l=o.paint.get("raster-contrast"))>0?1/(1-l):1+l,u_spin_weights:function(i){i*=Math.PI/180;let r=Math.sin(i),n=Math.cos(i);return[(2*n+1)/3,(-Math.sqrt(3)*r-n+1)/3,(Math.sqrt(3)*r-n+1)/3]}(o.paint.get("raster-hue-rotate")),u_perspective_transform:s}},im=i.create(),i_=(r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y)=>{let x=s.transform,v={u_is_size_zoom_constant:+("constant"===r||"source"===r),u_is_size_feature_constant:+("constant"===r||"camera"===r),u_size_t:n?n.uSizeT:0,u_size:n?n.uSize:0,u_camera_to_center_distance:x.cameraToCenterDistance,u_rotate_symbol:+a,u_aspect_ratio:x.width/x.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:l,u_label_plane_matrix:h,u_coord_matrix:u,u_is_text:+c,u_pitch_with_map:+o,u_texsize:p,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:im,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:im,u_up_vector:[0,-1,0]};return"globe"===y.name&&(v.u_tile_id=[d.canonical.x,d.canonical.y,1<<d.canonical.z],v.u_zoom_transition=f,v.u_inv_rot_matrix=_,v.u_merc_center=m,v.u_camera_forward=x._camera.forward(),v.u_ecef_origin=i.globeECEFOrigin(x.globeMatrix,d.toUnwrapped()),v.u_tile_matrix=Float32Array.from(x.globeMatrix),v.u_up_vector=g),v},ig=(r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y,x)=>i.extend(i_(r,n,a,o,s,l,h,u,c,p,f,m,_,g,y,x),{u_gamma_scale:o?s.transform.cameraToCenterDistance*Math.cos(s.terrain?0:s.transform._pitch):1,u_device_pixel_ratio:i.exported.devicePixelRatio,u_is_halo:+d}),iy=(r,n,a,o,s,l,h,u,c,p,d,f,m,_,g,y)=>i.extend(ig(r,n,a,o,s,l,h,u,!0,c,!0,d,f,m,_,g,y),{u_texsize_icon:p,u_texture_icon:1}),ix=(i,r,n)=>({u_matrix:i,u_opacity:r,u_color:n}),iv=(r,n,a,o,s,l)=>i.extend(function(i,r,n,a){let o=n.imageManager.getPattern(i.from.toString()),s=n.imageManager.getPattern(i.to.toString()),{width:l,height:h}=n.imageManager.getPixelSize(),u=Math.pow(2,a.tileID.overscaledZ),c=a.tileSize*Math.pow(2,n.transform.tileZoom)/u,p=c*(a.tileID.canonical.x+a.tileID.wrap*u),d=c*a.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[l,h],u_mix:r.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/R(a,1,n.transform.tileZoom),u_pixel_coord_upper:[p>>16,d>>16],u_pixel_coord_lower:[65535&p,65535&d]}}(o,l,a,s),{u_matrix:r,u_opacity:n}),ib={fillExtrusion:r=>({u_matrix:new i.UniformMatrix4f(r),u_lightpos:new i.Uniform3f(r),u_lightintensity:new i.Uniform1f(r),u_lightcolor:new i.Uniform3f(r),u_vertical_gradient:new i.Uniform1f(r),u_opacity:new i.Uniform1f(r),u_edge_radius:new i.Uniform1f(r),u_ao:new i.Uniform2f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_up_dir:new i.Uniform3f(r),u_height_lift:new i.Uniform1f(r)}),fillExtrusionPattern:r=>({u_matrix:new i.UniformMatrix4f(r),u_lightpos:new i.Uniform3f(r),u_lightintensity:new i.Uniform1f(r),u_lightcolor:new i.Uniform3f(r),u_vertical_gradient:new i.Uniform1f(r),u_height_factor:new i.Uniform1f(r),u_edge_radius:new i.Uniform1f(r),u_ao:new i.Uniform2f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_up_dir:new i.Uniform3f(r),u_height_lift:new i.Uniform1f(r),u_image:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_pixel_coord_upper:new i.Uniform2f(r),u_pixel_coord_lower:new i.Uniform2f(r),u_scale:new i.Uniform3f(r),u_fade:new i.Uniform1f(r),u_opacity:new i.Uniform1f(r)}),fill:r=>({u_matrix:new i.UniformMatrix4f(r)}),fillPattern:r=>({u_matrix:new i.UniformMatrix4f(r),u_image:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_pixel_coord_upper:new i.Uniform2f(r),u_pixel_coord_lower:new i.Uniform2f(r),u_scale:new i.Uniform3f(r),u_fade:new i.Uniform1f(r)}),fillOutline:r=>({u_matrix:new i.UniformMatrix4f(r),u_world:new i.Uniform2f(r)}),fillOutlinePattern:r=>({u_matrix:new i.UniformMatrix4f(r),u_world:new i.Uniform2f(r),u_image:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_pixel_coord_upper:new i.Uniform2f(r),u_pixel_coord_lower:new i.Uniform2f(r),u_scale:new i.Uniform3f(r),u_fade:new i.Uniform1f(r)}),circle:r=>({u_camera_to_center_distance:new i.Uniform1f(r),u_extrude_scale:new i.UniformMatrix2f(r),u_device_pixel_ratio:new i.Uniform1f(r),u_matrix:new i.UniformMatrix4f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_up_dir:new i.Uniform3f(r)}),collisionBox:r=>({u_matrix:new i.UniformMatrix4f(r),u_camera_to_center_distance:new i.Uniform1f(r),u_extrude_scale:new i.Uniform2f(r)}),collisionCircle:r=>({u_matrix:new i.UniformMatrix4f(r),u_inv_matrix:new i.UniformMatrix4f(r),u_camera_to_center_distance:new i.Uniform1f(r),u_viewport_size:new i.Uniform2f(r)}),debug:r=>
60({u_color:new i.UniformColor(r),u_matrix:new i.UniformMatrix4f(r),u_overlay:new i.Uniform1i(r),u_overlay_scale:new i.Uniform1f(r)}),clippingMask:r=>({u_matrix:new i.UniformMatrix4f(r)}),heatmap:r=>({u_extrude_scale:new i.Uniform1f(r),u_intensity:new i.Uniform1f(r),u_matrix:new i.UniformMatrix4f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_up_dir:new i.Uniform3f(r)}),heatmapTexture:r=>({u_image:new i.Uniform1i(r),u_color_ramp:new i.Uniform1i(r),u_opacity:new i.Uniform1f(r)}),hillshade:r=>({u_matrix:new i.UniformMatrix4f(r),u_image:new i.Uniform1i(r),u_latrange:new i.Uniform2f(r),u_light:new i.Uniform2f(r),u_shadow:new i.UniformColor(r),u_highlight:new i.UniformColor(r),u_accent:new i.UniformColor(r)}),hillshadePrepare:r=>({u_matrix:new i.UniformMatrix4f(r),u_image:new i.Uniform1i(r),u_dimension:new i.Uniform2f(r),u_zoom:new i.Uniform1f(r),u_unpack:new i.Uniform4f(r)}),line:r=>({u_matrix:new i.UniformMatrix4f(r),u_pixels_to_tile_units:new i.UniformMatrix2f(r),u_device_pixel_ratio:new i.Uniform1f(r),u_units_to_pixels:new i.Uniform2f(r),u_dash_image:new i.Uniform1i(r),u_gradient_image:new i.Uniform1i(r),u_image_height:new i.Uniform1f(r),u_texsize:new i.Uniform2f(r),u_scale:new i.Uniform3f(r),u_mix:new i.Uniform1f(r),u_alpha_discard_threshold:new i.Uniform1f(r),u_trim_offset:new i.Uniform2f(r)}),linePattern:r=>({u_matrix:new i.UniformMatrix4f(r),u_texsize:new i.Uniform2f(r),u_pixels_to_tile_units:new i.UniformMatrix2f(r),u_device_pixel_ratio:new i.Uniform1f(r),u_image:new i.Uniform1i(r),u_units_to_pixels:new i.Uniform2f(r),u_scale:new i.Uniform3f(r),u_fade:new i.Uniform1f(r),u_alpha_discard_threshold:new i.Uniform1f(r)}),raster:r=>({u_matrix:new i.UniformMatrix4f(r),u_tl_parent:new i.Uniform2f(r),u_scale_parent:new i.Uniform1f(r),u_fade_t:new i.Uniform1f(r),u_opacity:new i.Uniform1f(r),u_image0:new i.Uniform1i(r),u_image1:new i.Uniform1i(r),u_brightness_low:new i.Uniform1f(r),u_brightness_high:new i.Uniform1f(r),u_saturation_factor:new i.Uniform1f(r),u_contrast_factor:new i.Uniform1f(r),u_spin_weights:new i.Uniform3f(r),u_perspective_transform:new i.Uniform2f(r)}),symbolIcon:r=>({u_is_size_zoom_constant:new i.Uniform1i(r),u_is_size_feature_constant:new i.Uniform1i(r),u_size_t:new i.Uniform1f(r),u_size:new i.Uniform1f(r),u_camera_to_center_distance:new i.Uniform1f(r),u_rotate_symbol:new i.Uniform1i(r),u_aspect_ratio:new i.Uniform1f(r),u_fade_change:new i.Uniform1f(r),u_matrix:new i.UniformMatrix4f(r),u_label_plane_matrix:new i.UniformMatrix4f(r),u_coord_matrix:new i.UniformMatrix4f(r),u_is_text:new i.Uniform1i(r),u_pitch_with_map:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_camera_forward:new i.Uniform3f(r),u_tile_matrix:new i.UniformMatrix4f(r),u_up_vector:new i.Uniform3f(r),u_ecef_origin:new i.Uniform3f(r),u_texture:new i.Uniform1i(r)}),symbolSDF:r=>({u_is_size_zoom_constant:new i.Uniform1i(r),u_is_size_feature_constant:new i.Uniform1i(r),u_size_t:new i.Uniform1f(r),u_size:new i.Uniform1f(r),u_camera_to_center_distance:new i.Uniform1f(r),u_rotate_symbol:new i.Uniform1i(r),u_aspect_ratio:new i.Uniform1f(r),u_fade_change:new i.Uniform1f(r),u_matrix:new i.UniformMatrix4f(r),u_label_plane_matrix:new i.UniformMatrix4f(r),u_coord_matrix:new i.UniformMatrix4f(r),u_is_text:new i.Uniform1i(r),u_pitch_with_map:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_texture:new i.Uniform1i(r),u_gamma_scale:new i.Uniform1f(r),u_device_pixel_ratio:new i.Uniform1f(r),u_tile_id:new i.Uniform3f(r),u_zoom_transition:new i.Uniform1f(r),u_inv_rot_matrix:new i.UniformMatrix4f(r),u_merc_center:new i.Uniform2f(r),u_camera_forward:new i.Uniform3f(r),u_tile_matrix:new i.UniformMatrix4f(r),u_up_vector:new i.Uniform3f(r),u_ecef_origin:new i.Uniform3f(r),u_is_halo:new i.Uniform1i(r)}),symbolTextAndIcon:r=>({u_is_size_zoom_constant:new i.Uniform1i(r),u_is_size_feature_constant:new i.Uniform1i(r),u_size_t:new i.Uniform1f(r),u_size:new i.Uniform1f(r),u_c
60amera_to_center_distance:new i.Uniform1f(r),u_rotate_symbol:new i.Uniform1i(r),u_aspect_ratio:new i.Uniform1f(r),u_fade_change:new i.Uniform1f(r),u_matrix:new i.UniformMatrix4f(r),u_label_plane_matrix:new i.UniformMatrix4f(r),u_coord_matrix:new i.UniformMatrix4f(r),u_is_text:new i.Uniform1i(r),u_pitch_with_map:new i.Uniform1i(r),u_texsize:new i.Uniform2f(r),u_texsize_icon:new i.Uniform2f(r),u_texture:new i.Uniform1i(r),u_texture_icon:new i.Uniform1i(r),u_gamma_scale:new i.Uniform1f(r),u_device_pixel_ratio:new i.Uniform1f(r),u_is_halo:new i.Uniform1i(r)}),background:r=>({u_matrix:new i.UniformMatrix4f(r),u_opacity:new i.Uniform1f(r),u_color:new i.UniformColor(r)}),backgroundPattern:r=>({u_matrix:new i.UniformMatrix4f(r),u_opacity:new i.Uniform1f(r),u_image:new i.Uniform1i(r),u_pattern_tl_a:new i.Uniform2f(r),u_pattern_br_a:new i.Uniform2f(r),u_pattern_tl_b:new i.Uniform2f(r),u_pattern_br_b:new i.Uniform2f(r),u_texsize:new i.Uniform2f(r),u_mix:new i.Uniform1f(r),u_pattern_size_a:new i.Uniform2f(r),u_pattern_size_b:new i.Uniform2f(r),u_scale_a:new i.Uniform1f(r),u_scale_b:new i.Uniform1f(r),u_pixel_coord_upper:new i.Uniform2f(r),u_pixel_coord_lower:new i.Uniform2f(r),u_tile_units_to_pixels:new i.Uniform1f(r)}),terrainRaster:tG,terrainDepth:tG,skybox:r=>({u_matrix:new i.UniformMatrix4f(r),u_sun_direction:new i.Uniform3f(r),u_cubemap:new i.Uniform1i(r),u_opacity:new i.Uniform1f(r),u_temporal_offset:new i.Uniform1f(r)}),skyboxGradient:r=>({u_matrix:new i.UniformMatrix4f(r),u_color_ramp:new i.Uniform1i(r),u_center_direction:new i.Uniform3f(r),u_radius:new i.Uniform1f(r),u_opacity:new i.Uniform1f(r),u_temporal_offset:new i.Uniform1f(r)}),skyboxCapture:r=>({u_matrix_3f:new i.UniformMatrix3f(r),u_sun_direction:new i.Uniform3f(r),u_sun_intensity:new i.Uniform1f(r),u_color_tint_r:new i.Uniform4f(r),u_color_tint_m:new i.Uniform4f(r),u_luminance:new i.Uniform1f(r)}),globeRaster:r=>({u_proj_matrix:new i.UniformMatrix4f(r),u_globe_matrix:new i.UniformMatrix4f(r),u_normalize_matrix:new i.UniformMatrix4f(r),u_merc_matrix:new i.UniformMatrix4f(r),u_zoom_transition:new i.Uniform1f(r),u_merc_center:new i.Uniform2f(r),u_image0:new i.Uniform1i(r),u_grid_matrix:new i.UniformMatrix3f(r),u_frustum_tl:new i.Uniform3f(r),u_frustum_tr:new i.Uniform3f(r),u_frustum_br:new i.Uniform3f(r),u_frustum_bl:new i.Uniform3f(r),u_globe_pos:new i.Uniform3f(r),u_globe_radius:new i.Uniform1f(r),u_viewport:new i.Uniform2f(r)}),globeAtmosphere:r=>({u_frustum_tl:new i.Uniform3f(r),u_frustum_tr:new i.Uniform3f(r),u_frustum_br:new i.Uniform3f(r),u_frustum_bl:new i.Uniform3f(r),u_horizon:new i.Uniform1f(r),u_transition:new i.Uniform1f(r),u_fadeout_range:new i.Uniform1f(r),u_color:new i.Uniform4f(r),u_high_color:new i.Uniform4f(r),u_space_color:new i.Uniform4f(r),u_star_intensity:new i.Uniform1f(r),u_star_density:new i.Uniform1f(r),u_star_size:new i.Uniform1f(r),u_temporal_offset:new i.Uniform1f(r),u_horizon_angle:new i.Uniform1f(r),u_rotation_matrix:new i.UniformMatrix4f(r)})};function iw(r,n,a,s,l,h,u){let c=r.context,p=c.gl,d=r.transform,f=r.useProgram("collisionBox"),m=[],_=0,g=0;for(let o=0;o<s.length;o++){let y=s[o],x=n.getTile(y),v=x.getBucket(a);if(!v)continue;let b=function(i,r,n){if(r.projection.name===n.projection.name)return i.projMatrix;let a=n.clone();return a.setProjection(r.projection),tt(a,r.getProjection(),i)}(y,v,d),w=b;0===l[0]&&0===l[1]||(w=r.translatePosMatrix(b,x,l,h));let T=u?v.textCollisionBox:v.iconCollisionBox,E=v.collisionCircleArray;if(E.length>0){let r=i.create(),n=w;i.mul(r,v.placementInvProjMatrix,d.glCoordMatrix),i.mul(r,r,v.placementViewportMatrix),m.push({circleArray:E,circleOffset:g,transform:n,invTransform:r,projection:v.getProjection()}),_+=E.length/4,g=_}T&&(r.terrain&&r.terrain.setupElevationDraw(x,f),f.draw(c,p.LINES,i.DepthMode.disabled,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.disabled,ir(w,d,x,v.getProjection()),a.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,null,d.zoom,null,[T.collisionVertexBuffer,T.collisionVertexBufferExt]))}if(!u||!m.length)return;let y=r.useProgram("collisionCircle"),x=new i.StructArrayLayout2f1f2i16;x.resize(4*_),x._trim();let v=0;for(let i of m)for(let r=0;r<i.circleArray.length/4;r++){let n=4*r,a=i.circleArray[n+0],o=i.circleArray[n+1],s=i.circleArray[n+2],l=i.circleArray[n+3];x.emplace(v++,a,o,s,l,0),x.emplace(v++,a,o,s,l,1),x.emplace(v++,a,o,s,l,2),x.emplace(v++,a,o,s,l,3)}(!o||o.length<2*_)&&(o=function(r){let n=2*r,a=new i.StructArrayLayout3ui6;a.resize(n),a._trim();for(let i=0;i<n;i++){let r=6*i;a.uint16[r+0]=4*i+0,a.uint16[r+1]=4*i+1,a.uint16[r+2]=4*i+2,a.uint16[r+3]=4*i+2,a.uint16[r+4]=4*i+3,a.uint16[r+5]=4*i+0}return a}(_));let b=c.createIndexBuffer(o,!0),w=c.createVertexBuffer(x,i.collisionCircleLayout.members,!0);for(let n of m){let o={u_matrix:n.transform,u_inv_matrix:n.invTransform,u_camera_to_center_distance:d.getCameraToCenterDistance(n.projection),u_viewport_size:[d.width,d.height]};y.draw(c,p.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.disabled,o,a.id,w,b,i.SegmentVector.simpleSegment(0,2*n.circleOffset,n.circleArray.length,n.circleArray.length/2),null,d.zoom)}w.destroy(),b.destroy()}let iT=i.create();function iE(r,n,a,o,s,l,h,u,c,p,d,f){let m=r.context,_=m.gl,g=r.transform,y="map"===u,x="map"===c,v=y&&"point"!==a.layout.get("symbol-placement"),b=y&&!x&&!v,w=void 0!==a.layout.get("symbol-sort-key").constantOr(1),T=!1,E=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),S=[i.mercatorXfromLng(g.center.lng),i.mercatorYfromLat(g.center.lat)],I=a.layout.get("text-variable-anchor"),A="globe"===g.projection.name,M=[],C=[0,-1,0],z=C;for(let u of((A||g.mercatorFromTransition)&&!y&&(z=function(r){let n=r._camera.getWorldToCamera(r.worldSize,1),a=i.multiply([],n,r.globeMatrix);i.invert(a,a);let o=[0,0,0],s=[0,1,0,0];return i.transformMat4$1(s,s,a),o[0]=s[0],o[1]=s[1],o[2]=s[2],i.normalize(o,o),o}(g)),o)){let o;let c=n.getTile(u),d=c.getBucket(a);if(!d||"mercator"===d.projection.name&&A)continue;let f=s?d.text:d.icon;if(!f||d.fullyClipped||!f.segments.get().length)continue;let m=f.programConfigurations.get(a.id),E=s||d.sdfIcons,P=s?d.textSizeData:d.iconSizeData,k=x||0!==g.pitch,D=i.evaluateSizeForZoom(P,g.zoom),L,B,R,F,O=[0,0],U=null;if(s){if(B=c.glyphAtlasTexture,R=_.LINEAR,L=c.glyphAtlasTexture.size,d.iconsInText){O=c.imageAtlasTexture.size,U=c.imageAtlasTexture;let i="composite"===P.kind||"camera"===P.kind;F=k||r.options.rotating||r.options.zooming||i?_.LINEAR:_.NEAREST}}else{let i=1!==a.layout.get("icon-size").constantOr(0)||d.iconsNeedLinear;B=c.imageAtlasTexture,R=E||r.options.rotating||r.options.zooming||i||k?_.LINEAR:_.NEAREST,L=c.imageAtlasTexture.size}let V="globe"===d.projection.name,j=V?z:C,N=V?i.globeToMercatorTransition(g.zoom):0,G=ti(u,d.getProjection(),g),Z=g.calculatePixelsToTileUnitsMatrix(c),$=eH(G,c.tileID.canonical,x,y,g,d.getProjection(),Z),q=r.terrain&&x&&v?i.invert(i.create(),$):iT,X=eK(G,c.tileID.canonical,x,y,g,d.getProjection(),Z),W=I&&d.hasTextData(),H="none"!==a.layout.get("icon-text-fit")&&W&&d.hasIconData();if(v){let n=g.elevation,a=n?n.getAtTileOffsetFunc(u,g.center.lat,g.worldSize,d.getProjection()):i=>[0,0,0],o=eY(G,c.tileID.canonical,x,y,g,d.getProjection(),Z);!function(r,n,a,o,s,l,h,u,c,p){let d=a.transform,f=o?r.textSizeData:r.iconSizeData,m=i.evaluateSizeForZoom(f,a.transform.zoom),_="globe"===d.projection.name,g=[256/a.width*2+1,256/a.height*2+1],y=o?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;y.clear();let x=null;_&&(x=o?r.text.globeExtVertexArray:r.icon.globeExtVertexArray);let v=r.lineVertexArray,b=o?r.text.placedSymbolArray:r.icon.placedSymbolArray,w=a.transform.width/a.transform.height,T=!1;for(let o=0;o<b.length;o++){let _=b.get(o);if(_.writingMode!==i.WritingMode.vertical||T||0!==o&&b.get(o-1).writingMode===i.WritingMode.horizontal||(T=!0),(_.hidden||_.writingMode===i.WritingMode.vertical)&&!T){e9(_.numGlyphs,y);continue}T=!1;let E=new i.pointGeometry(_.tileAnchorX,_.tileAnchorY),S=c?c(E):[0,0,0],I=d.projection.projectTilePoint(E.x,E.y,p.canonical),A=[I.x+S[0],I.y+S[1],I.z+S[2]],M=[...A,1];if(i.transformMat4$1(M,M,n),!function(i,r){let n=i[0]/i[3],a=i[1]/i[3];return n>=-r[0]&&n<=r[0]&&a>=-r[1]&&a<=r[1]}(M,g)){e9(_.numGlyphs,y);continue}let C=e0(a.transform.cameraToCenterDistance,M[3]),z=i.evaluateSizeForFeature
60(f,m,_),P=h?z/C:z*C,k=eJ(new i.pointGeometry(A[0],A[1]),s,A[2]);if(k.signedDistanceFromCamera<=0){e9(_.numGlyphs,y);continue}let D={},L=h?null:c,B=e3(_,P,!1,u,n,s,l,r.glyphOffsetArray,v,y,x,k.point,E,D,w,L,d.projection,p,h);T=B.useVertical,L&&B.needsFlipping&&(D={}),(B.notEnoughRoom||T||B.needsFlipping&&e3(_,P,!0,u,n,s,l,r.glyphOffsetArray,v,y,x,k.point,E,D,w,L,d.projection,p,h).notEnoughRoom)&&e9(_.numGlyphs,y)}o?(r.text.dynamicLayoutVertexBuffer.updateData(y),x&&r.text.globeExtVertexBuffer.updateData(x)):(r.icon.dynamicLayoutVertexBuffer.updateData(y),x&&r.icon.globeExtVertexBuffer.updateData(x))}(d,G,r,s,o,X,x,p,a,u)}let Y=v||s&&I||H,K=r.translatePosMatrix(G,c,l,h),J=Y?iT:$,Q=r.translatePosMatrix(X,c,l,h,!0),ee=d.getProjection().createInversionMatrix(g,u.canonical),et=[];r.terrain&&x&&et.push("PITCH_WITH_MAP_TERRAIN"),V&&et.push("PROJECTION_GLOBE_VIEW"),Y&&et.push("PROJECTED_POS_ON_VIEWPORT");let ei=E&&0!==a.paint.get(s?"text-halo-width":"icon-halo-width").constantOr(1);o=E?d.iconsInText?iy(P.kind,D,b,x,r,K,J,Q,L,O,u,N,S,ee,j,d.getProjection()):ig(P.kind,D,b,x,r,K,J,Q,s,L,!0,u,N,S,ee,j,d.getProjection()):i_(P.kind,D,b,x,r,K,J,Q,s,L,u,N,S,ee,j,d.getProjection());let er={program:r.useProgram(d.iconsInText&&s?"symbolTextAndIcon":E?"symbolSDF":"symbolIcon",m,et),buffers:f,uniformValues:o,atlasTexture:B,atlasTextureIcon:U,atlasInterpolation:R,atlasInterpolationIcon:F,isSDF:E,hasHalo:ei,tile:c,labelPlaneMatrixInv:q};if(w&&d.canOverlap){T=!0;let r=f.segments.get();for(let n of r)M.push({segments:new i.SegmentVector([n]),sortKey:n.sortKey,state:er})}else M.push({segments:f.segments,sortKey:0,state:er})}for(let i of(T&&M.sort((i,r)=>i.sortKey-r.sortKey),M)){let n=i.state;if(r.terrain&&r.terrain.setupElevationDraw(n.tile,n.program,{useDepthForOcclusion:!A,labelPlaneMatrixInv:n.labelPlaneMatrixInv}),m.activeTexture.set(_.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,_.CLAMP_TO_EDGE),n.atlasTextureIcon&&(m.activeTexture.set(_.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,_.CLAMP_TO_EDGE)),n.isSDF){let o=n.uniformValues;n.hasHalo&&(o.u_is_halo=1,iS(n.buffers,i.segments,a,r,n.program,E,d,f,o)),o.u_is_halo=0}iS(n.buffers,i.segments,a,r,n.program,E,d,f,n.uniformValues)}}function iS(r,n,a,o,s,l,h,u,c){let p=o.context,d=[r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer,r.globeExtVertexBuffer];s.draw(p,p.gl.TRIANGLES,l,h,u,i.CullFaceMode.disabled,c,a.id,r.layoutVertexBuffer,r.indexBuffer,n,a.paint,o.transform.zoom,r.programConfigurations.get(a.id),d)}function iI(r,n,a,o,s,l,h){let u,c,p,d,f;let m=r.context.gl,_=a.paint.get("fill-pattern"),g=_&&_.constantOr(1),y=a.getCrossfadeParameters();for(let x of(h?(c=g&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=m.LINES):(c=g?"fillPattern":"fill",u=m.TRIANGLES),o)){let o=n.getTile(x);if(g&&!o.patternsLoaded())continue;let v=o.getBucket(a);if(!v)continue;r.prepareDrawTile();let b=v.programConfigurations.get(a.id),w=r.useProgram(c,b);g&&(r.context.activeTexture.set(m.TEXTURE0),o.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),b.updatePaintBuffers(y));let T=_.constantOr(null);if(T&&o.imageAtlas){let i=o.imageAtlas,r=i.patternPositions[T.to.toString()],n=i.patternPositions[T.from.toString()];r&&n&&b.setConstantPatternPositions(r,n)}let E=r.translatePosMatrix(x.projMatrix,o,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor"));if(h){d=v.indexBuffer2,f=v.segments2;let i=r.terrain&&r.terrain.renderingToTexture?r.terrain.drapeBufferSize:[m.drawingBufferWidth,m.drawingBufferHeight];p="fillOutlinePattern"===c&&g?t7(E,r,y,o,i):t9(E,i)}else d=v.indexBuffer,f=v.segments,p=g?t8(E,r,y,o):t6(E);r.prepareDrawProgram(r.context,w,x.toUnwrapped()),w.draw(r.context,u,s,r.stencilModeForClipping(x),l,i.CullFaceMode.disabled,p,a.id,v.layoutVertexBuffer,d,f,a.paint,r.transform.zoom,b)}}function iA(r,n,a,o,s,l,h){let u=r.context,c=u.gl,p=r.transform,d=a.paint.get("fill-extrusion-pattern"),f=d.constantOr(1),m=a.getCrossfadeParameters(),_=a.paint.get("fill-extrusion-opacity"),g=[a.paint.get("fill-extrusion-ambient-occlusion-intensity"),a.paint.get("fill-extrusion-ambient-occlusion-radius")],y=a.layout.get("fill-extrusion-edge-radius"),x="globe"===p.projection.name?i.fillExtrusionHeightLift():0,v="globe"===p.projection.name,b=v?i.globeToMercatorTransition(p.zoom):0,w=[i.mercatorXfromLng(p.center.lng),i.mercatorYfromLat(p.center.lat)],T=[];for(let E of(v&&(T.push("PROJECTION_GLOBE_VIEW"),r.style.terrainSetForDrapingOnly()&&T.push("TERRAIN")),g[0]>0&&T.push("FAUX_AO"),o)){let o=n.getTile(E),S=o.getBucket(a);if(!S||S.projection.name!==p.projection.name)continue;let I=S.programConfigurations.get(a.id),A=r.useProgram(f?"fillExtrusionPattern":"fillExtrusion",I,T);if(r.terrain){let s=r.terrain;if(r.style.terrainSetForDrapingOnly())s.setupElevationDraw(o,A,{useMeterToDem:!0});else{if(!S.enableTerrain)continue;if(s.setupElevationDraw(o,A,{useMeterToDem:!0}),function(r,n,a,o,s,l){let h,u,c;let p=[r=>{let n=r.canonical.x-1,a=r.wrap;return n<0&&(n=(1<<r.canonical.z)-1,a--),new i.OverscaledTileID(r.overscaledZ,a,r.canonical.z,n,r.canonical.y)},r=>{let n=r.canonical.x+1,a=r.wrap;return n===1<<r.canonical.z&&(n=0,a++),new i.OverscaledTileID(r.overscaledZ,a,r.canonical.z,n,r.canonical.y)},r=>new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(0===r.canonical.y?1<<r.canonical.z:r.canonical.y)-1),r=>new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)],d=i=>{let r=n.getSource().minzoom,a=i=>{let r=n.getTileByID(i);if(r&&r.hasData())return r.getBucket(s)};
60for(let n of[0,-1,1]){if(i.overscaledZ+n<r)continue;let o=a(i.calculateScaledKey(i.overscaledZ+n));if(o)return o}},f=[0,0,0],m=(r,n)=>(f[0]=Math.min(r.min.y,n.min.y),f[1]=Math.max(r.max.y,n.max.y),f[2]=i.EXTENT-n.min.x>r.max.x?n.min.x-i.EXTENT:r.max.x,f),_=(r,n)=>(f[0]=Math.min(r.min.x,n.min.x),f[1]=Math.max(r.max.x,n.max.x),f[2]=i.EXTENT-n.min.y>r.max.y?n.min.y-i.EXTENT:r.max.y,f),g=[(i,r)=>m(i,r),(i,r)=>m(r,i),(i,r)=>_(i,r),(i,r)=>_(r,i)],y=new i.pointGeometry(0,0),x=(r,n,o,s,p)=>{let d=[[s?o:r,s?r:o,0],[s?o:n,s?n:o,0]],f=p<0?i.EXTENT+p:p,m=[s?f:(r+n)/2,s?(r+n)/2:f,0];return 0===o&&p<0||0!==o&&p>0?l.getForTilePoints(c,[m],!0,u):d.push(m),l.getForTilePoints(a,d,!0,h),Math.max(d[0][2],d[1][2],m[2])/l.exaggeration()};for(let r=0;r<4;r++){let n=(r<2?1:5)-r,s=o.borders[r];if(0===s.length)continue;let f=c=p[r](a),m=d(f);if(!(m&&m instanceof i.FillExtrusionBucket&&m.enableTerrain)||o.borderDoneWithNeighborZ[r]===m.canonical.z&&m.borderDoneWithNeighborZ[n]===o.canonical.z||!(u=l.findDEMTileFor(f))||!u.dem)continue;if(!h){let i=l.findDEMTileFor(a);if(!i||!i.dem)return;h=i}let _=m.borders[n],v=0,b=m.borderDoneWithNeighborZ[n]!==o.canonical.z;if(o.canonical.z===m.canonical.z){for(let a=0;a<s.length;a++){let l;let h=o.featuresOnBorder[s[a]],u=h.borders[r];for(;v<_.length&&!((l=m.featuresOnBorder[_[v]]).borders[n][1]>u[0]+3);)b&&m.encodeCentroid(void 0,l,!1),v++;if(l&&v<_.length){let a=v,s=0;for(;!(l.borders[n][0]>u[1]-3)&&(s++,++v!==_.length);)l=m.featuresOnBorder[_[v]];if(l=m.featuresOnBorder[_[a]],h.intersectsCount()>1||l.intersectsCount()>1||1!==s){1!==s&&(v=a),o.encodeCentroid(void 0,h,!1),b&&m.encodeCentroid(void 0,l,!1);continue}let c=g[r](h,l),p=r%2?i.EXTENT-1:0;y.x=x(c[0],Math.min(i.EXTENT-1,c[1]),p,r<2,c[2]),y.y=0,o.encodeCentroid(y,h,!1),b&&m.encodeCentroid(y,l,!1)}else o.encodeCentroid(void 0,h,!1)}o.borderDoneWithNeighborZ[r]=m.canonical.z,o.needsCentroidUpdate=!0,b&&(m.borderDoneWithNeighborZ[n]=o.canonical.z,m.needsCentroidUpdate=!0)}else{for(let i of s)o.encodeCentroid(void 0,o.featuresOnBorder[i],!1);if(b){for(let i of _)m.encodeCentroid(void 0,m.featuresOnBorder[i],!1);m.borderDoneWithNeighborZ[n]=o.canonical.z,m.needsCentroidUpdate=!0}o.borderDoneWithNeighborZ[r]=m.canonical.z,o.needsCentroidUpdate=!0}}(o.needsCentroidUpdate||!o.centroidVertexBuffer&&0!==o.centroidVertexArray.length)&&o.uploadCentroid(r)}(u,n,E,S,a,s),!S.centroidVertexBuffer){let i=A.attributes.a_centroid_pos;void 0!==i&&c.vertexAttrib2f(i,0,0)}}}f&&(r.context.activeTexture.set(c.TEXTURE0),o.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),I.updatePaintBuffers(m));let M=d.constantOr(null);if(M&&o.imageAtlas){let i=o.imageAtlas,r=i.patternPositions[M.to.toString()],n=i.patternPositions[M.from.toString()];r&&n&&I.setConstantPatternPositions(r,n)}let C=r.translatePosMatrix(E.projMatrix,o,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),z=p.projection.createInversionMatrix(p,E.canonical),P=a.paint.get("fill-extrusion-vertical-gradient"),k=f?t4(C,r,P,_,g,y,E,m,o,x,b,w,z):t5(C,r,P,_,g,y,E,x,b,w,z);r.prepareDrawProgram(u,A,E.toUnwrapped());let D=[];r.terrain&&D.push(S.centroidVertexBuffer),v&&D.push(S.layoutVertexExtBuffer),A.draw(u,u.gl.TRIANGLES,s,l,h,i.CullFaceMode.backCCW,k,a.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,a.paint,r.transform.zoom,I,D)}}let iM=new i.Color(1,0,0,1),iC=new i.Color(0,1,0,1),iz=new i.Color(0,0,1,1),iP=new i.Color(1,0,1,1),ik=new i.Color(0,1,1,1);function iD(i,r,n,a){iB(i,0,r+n/2,i.transform.width,n,a)}function iL(i,r,n,a){iB(i,r-n/2,0,n,i.transform.height,a)}function iB(r,n,a,o,s,l){let h=r.context,u=h.gl;u.enable(u.SCISSOR_TEST),u.scissor(n*i.exported.devicePixelRatio,a*i.exported.devicePixelRatio,o*i.exported.devicePixelRatio,s*i.exported.devicePixelRatio),h.clear({color:l}),u.disable(u.SCISSOR_TEST)}let iR=i.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:iF}=iR;function iO(i,r,n,a){i.emplaceBack(r,n,a)}class iU{constructor(r){this.vertexArray=new i.StructArrayLayout3f12,this.indices=new i.StructArrayLayout3ui6,iO(this.vertexArray,-1,-1,1),iO(this.vertexArray,1,-1,1),iO(this.vertexArray,-1,1,1),iO(this.vertexArray,1,1,1),iO(this.vertexArray,-1,-1,-1),iO(this.vertexArray,1,-1,-1),iO(this.vertexArray,-1,1,-1),iO(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=r.createVertexBuffer(this.vertexArray,iF),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=i.SegmentVector.simpleSegment(0,0,36,12)}}function iV(r,n,a,o,s,l){let h=r.gl,u=n.paint.get("sky-atmosphere-color"),c=n.paint.get("sky-atmosphere-halo-color"),p=n.paint.get("sky-atmosphere-sun-intensity"),d={u_matrix_3f:i.fromMat4(i.create$1(),o),u_sun_direction:s,u_sun_intensity:p,u_color_tint_r:[u.r,u.g,u.b,u.a],u_color_tint_m:[c.r,c.g,c.b,c.a],u_luminance:5e-5};h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_CUBE_MAP_POSITIVE_X+l,n.skyboxTexture,0),a.draw(r,h.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.frontCW,d,"skyboxCapture",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}let ij=i.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class iN{constructor(r){let n=new i.StructArrayLayout5f20;n.emplaceBack(-1,1,1,0,0),n.emplaceBack(1,1,1,1,0),n.emplaceBack(1,-1,1,1,1),n.emplaceBack(-1,-1,1,0,1);let a=new i.StructArrayLayout3ui6;a.emplaceBack(0,1,2),a.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(n,ij.members),this.indexBuffer=r.createIndexBuffer(a),this.segments=i.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}
60let iG={symbol:function(r,n,a,o,s){if("translucent"!==r.renderPass)return;let l=i.StencilMode.disabled,h=r.colorModeForRenderPass();a.layout.get("text-variable-anchor")&&function(r,n,a,o,s,l,h){let u=n.transform,c="map"===s,p="map"===l;for(let n of r){let r=o.getTile(n),s=r.getBucket(a);if(!s||!s.text||!s.text.segments.get().length)continue;let l=i.evaluateSizeForZoom(s.textSizeData,u.zoom),d=ti(n,s.getProjection(),u),f=u.calculatePixelsToTileUnitsMatrix(r),m=eH(d,r.tileID.canonical,p,c,u,s.getProjection(),f),_="none"!==a.layout.get("icon-text-fit")&&s.hasIconData();if(l){let a=Math.pow(2,u.zoom-r.tileID.overscaledZ);(function(r,n,a,o,s,l,h,u,c,p,d){let f=r.text.placedSymbolArray,m=r.text.dynamicLayoutVertexArray,_=r.icon.dynamicLayoutVertexArray,g={},y=ti(u,r.getProjection(),l),x=l.elevation,v=r.getProjection().upVectorScale(u.canonical,l.center.lat,l.worldSize);m.clear();for(let _=0;_<f.length;_++){let b=f.get(_),w=r.allowVerticalPlacement&&!b.placedOrientation,T=b.hidden||!b.crossTileID||w?null:o[b.crossTileID];if(T){let o;let f=new i.pointGeometry(b.tileAnchorX,b.tileAnchorY),_=r.getProjection().upVector(u.canonical,f.x,f.y),w=x?x.getAtTileOffset(u,f.x,f.y):0,E=eQ([b.projectedAnchorX+w*_[0]*v.metersToTile,b.projectedAnchorY+w*_[1]*v.metersToTile,b.projectedAnchorZ+w*_[2]*v.metersToTile],a?y:h),S=e0(l.getCameraToCenterDistance(r.getProjection()),E.signedDistanceFromCamera),I=s.evaluateSizeForFeature(r.textSizeData,p,b)*S/i.ONE_EM;a&&(I*=r.tilePixelRatio/c);let{width:A,height:M,anchor:C,textOffset:z,textScale:P}=T,k=function(r,n,a,o,s,l){let{horizontalAlign:h,verticalAlign:u}=i.getAnchorAlignment(r),c=i.evaluateVariableOffset(r,o);return new i.pointGeometry((-(h-.5)*n/s+c[0])*l,(-(u-.5)*a/s+c[1])*l)}(C,A,M,z,P,I);if(a){let i=f.add(k),{x:n,y:a,z:s}=r.getProjection().projectTilePoint(i.x,i.y,u.canonical);o=eQ([n+w*_[0]*v.metersToTile,a+w*_[1]*v.metersToTile,s+w*_[2]*v.metersToTile],h).point}else{let i=n?k.rotate(-l.angle):k;o=[E.point[0]+i.x,E.point[1]+i.y,0]}let D=r.allowVerticalPlacement&&b.placedOrientation===i.WritingMode.vertical?Math.PI/2:0;for(let r=0;r<b.numGlyphs;r++)i.addDynamicAttributes(m,o[0],o[1],o[2],D);d&&b.associatedIconIndex>=0&&(g[b.associatedIconIndex]={shiftedAnchor:o,angle:D})}else e9(b.numGlyphs,m)}if(d){_.clear();let n=r.icon.placedSymbolArray;for(let r=0;r<n.length;r++){let a=n.get(r);if(a.hidden)e9(a.numGlyphs,_);else{let n=g[r];if(n)for(let r=0;r<a.numGlyphs;r++)i.addDynamicAttributes(_,n.shiftedAnchor[0],n.shiftedAnchor[1],n.shiftedAnchor[2],n.angle);else e9(a.numGlyphs,_)}}r.icon.dynamicLayoutVertexBuffer.updateData(_)}r.text.dynamicLayoutVertexBuffer.updateData(m)})(s,c,p,h,i.symbolSize,u,m,n,a,l,_)}}}(o,r,a,n,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),s),0!==a.paint.get("icon-opacity").constantOr(1)&&iE(r,n,a,o,!1,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),a.layout.get("icon-rotation-alignment"),a.layout.get("icon-pitch-alignment"),a.layout.get("icon-keep-upright"),l,h),0!==a.paint.get("text-opacity").constantOr(1)&&iE(r,n,a,o,!0,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),a.layout.get("text-keep-upright"),l,h),n.map.showCollisionBoxes&&(iw(r,n,a,o,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),iw(r,n,a,o,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(r,n,a,o){if("translucent"!==r.renderPass)return;let s=a.paint.get("circle-opacity"),l=a.paint.get("circle-stroke-width"),h=a.paint.get("circle-stroke-opacity"),u=void 0!==a.layout.get("circle-sort-key").constantOr(1);if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===h.constantOr(1)))return;let c=r.context,p=c.gl,d=r.transform,f=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),m=i.StencilMode.disabled,_=r.colorModeForRenderPass(),g="globe"===d.projection.name,y=[i.mercatorXfromLng(d.center.lng),i.mercatorYfromLat(d.center.lat)],x=[];for(let s=0;s<o.length;s++){let l=o[s],h=n.getTile(l),c=h.getBucket(a);if(!c||c.projection.name!==d.projection.name)continue;let p=c.programConfigurations.get(a.id),f=ii(a);g&&f.push("PROJECTION_GLOBE_VIEW");let m=r.useProgram("circle",p,f),_=c.layoutVertexBuffer,v=c.globeExtVertexBuffer,b=c.indexBuffer,w=d.projection.createInversionMatrix(d,l.canonical),T={programConfiguration:p,program:m,layoutVertexBuffer:_,globeExtVertexBuffer:v,indexBuffer:b,uniformValues:it(r,l,h,w,y,a),tile:h};if(u){let r=c.segments.get();for(let n of r)x.push({segments:new i.SegmentVector([n]),sortKey:n.sortKey,state:T})}else x.push({segments:c.segments,sortKey:0,state:T})}u&&x.sort((i,r)=>i.sortKey-r.sortKey);let v={useDepthForOcclusion:!g};for(let n of x){let{programConfiguration:o,program:s,layoutVertexBuffer:l,globeExtVertexBuffer:h,indexBuffer:u,uniformValues:g,tile:y}=n.state,x=n.segments;r.terrain&&r.terrain.setupElevationDraw(y,s,v),r.prepareDrawProgram(c,s,y.tileID.toUnwrapped()),s.draw(c,p.TRIANGLES,f,m,_,i.CullFaceMode.disabled,g,a.id,l,u,x,a.paint,d.zoom,o,[h])}},heatmap:function(r,n,a,o){if(0!==a.paint.get("heatmap-opacity")){if("offscreen"===r.renderPass){let s=r.context,l=s.gl,h=i.StencilMode.disabled,u=new i.ColorMode([l.ONE,l.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(i,r,n,a){let o=i.gl,s=r.width*a,l=r.height*a;i.activeTexture.set(o.TEXTURE1),i.viewport.set([0,0,s,l]);let h=n.heatmapFbo;if(!h||h&&(h.width!==s||h.height!==l)){h&&h.destroy();let r=o.createTexture();o.bindTexture(o.TEXTURE_2D,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),h=n.heatmapFbo=i.createFramebuffer(s,l,!1),function(i,r,n,a,o,s){let l=i.gl;l.texImage2D(l.TEXTURE_2D,0,l.RGBA,o,s,0,l.RGBA,i.extRenderToTextureHalfFloat?i.extTextureHalfFloat.HALF_FLOAT_OES:l.UNSIGNED_BYTE,null),a.colorAttachment.set(n)}(i,0,r,h,s,l)}else o.bindTexture(o.TEXTURE_2D,h.colorAttachment.get()),i.bindFramebuffer.set(h.framebuffer)})(s,r,a,"globe"===r.transform.projection.name?.5:.25),s.clear({color:i.Color.transparent});let c=r.transform,p="globe"===c.projection.name,d=p?["PROJECTION_GLOBE_VIEW"]:null,f=p?i.CullFaceMode.frontCCW:i.CullFaceMode.disabled,m=[i.mercatorXfromLng(c.center.lng),i.mercatorYfromLat(c.center.lat)];for(let _=0;_<o.length;_++){let g=o[_];if(n.hasRenderableParent(g))continue;let y=n.getTile(g),x=y.getBucket(a);if(!x||x.projection.name!==c.projection.name)continue;let v=x.programConfigurations.get(a.id),b=r.useProgram("heatmap",v,d),{zoom:w}=r.transform;r.terrain&&r.terrain.setupElevationDraw(y,b),r.prepareDrawProgram(s,b,g.toUnwrapped());let T=c.projection.createInversionMatrix(c,g.canonical);b.draw(s,l.TRIANGLES,i.DepthMode.disabled,h,u,f,is(r,g,y,T,m,w,a.paint.get("heatmap-intensity")),a.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,a.paint,r.transform.zoom,v,p?[x.globeExtVertexBuffer]:null)}s.viewport.set([0,0,r.width,r.height])}else"translucent"===r.renderPass&&(r.context.setColorMode(r.colorModeForRenderPass()),function(r,n){let a=r.context,o=a.gl,s=n.heatmapFbo;if(!s)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,s.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1);let l=n.colorRampTexture;l||(l=n.colorRampTexture=new i.Texture(a,n.colorRamp,o.RGBA)),l.bind(o.LINEAR,o.CLAMP_TO_EDGE),r.useProgram("heatmapTexture").draw(a,o.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.disabled,{u_image:0,u_color_ramp:1,u_opacity:n.paint.get("heatmap-opacity")},n.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,n.paint,r.transform.zoom)}(r,a))}},line:function(r,n,a,o){if("translucent"!==r.renderPass)return;let s=a.paint.get("line-opacity"),l=a.paint.get("line-width");if(0===s.constantOr(1)||0===l.constantOr(1))return;let h=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),u=r.colorModeForRenderPass(),c=r.terrain&&r.terrain.renderingToTexture?1:i.exported.devicePixelRatio,p=a.paint.get("line-dasharray"),d=p.constantOr(1),f=a.layout.get("line-cap"),m=a.paint.get("line-pattern"),_=m.constantOr(1),g=a.paint.get("line-gradient"),y=a.getCrossfadeParameters(),x=_?"linePattern":"line",v=r.context,b=v.gl,w=(i=>{let r=[];ip(i)&&r.push("RENDER_LINE_DASH"),i.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT");let n=i.paint.get("line-trim-offset");0===n[0]&&0===n[1]||r.push("RENDER_LINE_TRIM_OFFSET");let a=i.paint.get("line-pattern").constantOr(1),o=1!==i.paint.get("line-opacity").constantOr(1);return!a&&o&&r.push("RENDER_LINE_ALPHA_DISCARD"),r})(a),T=w.includes("RENDER_LINE_ALPHA_DISCARD");for(let s of(r.terrain&&r.terrain.clipOrMaskOverlapStencilType()&&(T=!1),o)){let o=n.getTile(s);if(_&&!o.patternsLoaded())continue;let l=o.getBucket(a);if(!l)continue;r.prepareDrawTile();let E=l.programConfigurations.get(a.id),S=r.useProgram(x,E,w),I=m.constantOr(null);if(I&&o.imageAtlas){let i=o.imageAtlas,r=i.patternPositions[I.to.toString()],n=i.patternPositions[I.from.toString()];r&&n&&E.setConstantPatternPositions(r,n)}let A=p.constantOr(null),M=f.constantOr(null);if(!_&&A&&M&&o.lineAtlas){let i=o.lineAtlas,r=i.getDash(A.to,M),n=i.getDash(A.from,M);r&&n&&E.setConstantPatternPositions(r,n)}let[C,z]=a.paint.get("line-trim-offset");("round"===M||"square"===M)&&C!==z&&(0===C&&(C-=1),1===z&&(z+=1));let P=r.terrain?s.projMatrix:null,k=_?ih(r,o,a,y,P,c):il(r,o,a,y,P,l.lineClipsArray.length,c,[C,z]);if(g){let o=l.gradients[a.id],h=o.texture;if(a.gradientVersion!==o.version){let u=256;
60if(a.stepInterpolant){let a=n.getSource().maxzoom,o=s.canonical.z===a?Math.ceil(1<<r.transform.maxZoom-s.canonical.z):1;u=i.clamp(i.nextPowerOfTwo(l.maxLineLength/i.EXTENT*1024*o),256,v.maxTextureSize)}o.gradient=i.renderColorRamp({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:u,image:o.gradient||void 0,clips:l.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new i.Texture(v,o.gradient,b.RGBA),o.version=a.gradientVersion,h=o.texture}v.activeTexture.set(b.TEXTURE1),h.bind(a.stepInterpolant?b.NEAREST:b.LINEAR,b.CLAMP_TO_EDGE)}d&&(v.activeTexture.set(b.TEXTURE0),o.lineAtlasTexture.bind(b.LINEAR,b.REPEAT),E.updatePaintBuffers(y)),_&&(v.activeTexture.set(b.TEXTURE0),o.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),E.updatePaintBuffers(y)),r.prepareDrawProgram(v,S,s.toUnwrapped());let D=n=>{S.draw(v,b.TRIANGLES,h,n,u,i.CullFaceMode.disabled,k,a.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,a.paint,r.transform.zoom,E,[l.layoutVertexBuffer2])};if(T){let n=r.stencilModeForClipping(s).ref;0===n&&r.terrain&&v.clear({stencil:0});let a={func:b.EQUAL,mask:255};k.u_alpha_discard_threshold=.8,D(new i.StencilMode(a,n,255,b.KEEP,b.KEEP,b.INVERT)),k.u_alph
60a_discard_threshold=0,D(new i.StencilMode(a,n,255,b.KEEP,b.KEEP,b.KEEP))}else D(r.stencilModeForClipping(s))}T&&(r.resetStencilClippingMasks(),r.terrain&&v.clear({stencil:0}))},fill:function(r,n,a,o){let s=a.paint.get("fill-color"),l=a.paint.get("fill-opacity");if(0===l.constantOr(1))return;let h=r.colorModeForRenderPass(),u=a.paint.get("fill-pattern"),c=r.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===s.constantOr(i.Color.transparent).a&&1===l.constantOr(0)?"opaque":"translucent";if(r.renderPass===c){let s=r.depthModeForSublayer(1,"opaque"===r.renderPass?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly);iI(r,n,a,o,s,h,!1)}if("translucent"===r.renderPass&&a.paint.get("fill-antialias")){let s=r.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,i.DepthMode.ReadOnly);iI(r,n,a,o,s,h,!0)}},"fill-extrusion":function(r,n,a,o){let s=a.paint.get("fill-extrusion-opacity");if(0!==s&&"translucent"===r.renderPass){let l=new i.DepthMode(r.context.gl.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);if(1!==s||a.paint.get("fill-extrusion-pattern").constantOr(1))iA(r,n,a,o,l,i.StencilMode.disabled,i.ColorMode.disabled),iA(r,n,a,o,l,r.stencilModeFor3D(),r.colorModeForRenderPass()),r.resetStencilClippingMasks();else{let s=r.colorModeForRenderPass();iA(r,n,a,o,l,i.StencilMode.disabled,s)}}},hillshade:function(r,n,a,o){if("offscreen"!==r.renderPass&&"translucent"!==r.renderPass)return;let s=r.context,l=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),h=r.colorModeForRenderPass(),u=r.terrain&&r.terrain.renderingToTexture,[c,p]="translucent"!==r.renderPass||u?[{},o]:r.stencilConfigForOverlap(o);for(let o of p){let s=n.getTile(o);if(s.needsHillshadePrepare&&"offscreen"===r.renderPass)!function(r,n,a,o,s,l){let h=r.context,u=h.gl;if(!n.dem)return;let c=n.dem;if(h.activeTexture.set(u.TEXTURE1),tN(r,n,c),!n.demTexture)return;n.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);let p=c.dim;h.activeTexture.set(u.TEXTURE0);let d=n.fbo;if(!d){let r=new i.Texture(h,{width:p,height:p,data:null},u.RGBA);r.bind(u.LINEAR,u.CLAMP_TO_EDGE),(d=n.fbo=h.createFramebuffer(p,p,!0)).colorAttachment.set(r.texture)}h.bindFramebuffer.set(d.framebuffer),h.viewport.set([0,0,p,p]);let{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:_}=r.getMercatorTileBoundsBuffers();r.useProgram("hillshadePrepare").draw(h,u.TRIANGLES,o,s,l,i.CullFaceMode.disabled,((r,n)=>{let a=n.stride,o=i.create();return i.ortho(o,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(o,o,[0,-i.EXTENT,0]),{u_matrix:o,u_image:1,u_dimension:[a,a],u_zoom:r.overscaledZ,u_unpack:n.unpackVector}})(n.tileID,c),a.id,f,m,_),n.needsHillshadePrepare=!1}(r,s,a,l,i.StencilMode.disabled,h);else if("translucent"===r.renderPass){let n=u&&r.terrain?r.terrain.stencilModeForRTTOverlap(o):c[o.overscaledZ];!function(r,n,a,o,s,l,h){let u=r.context,c=u.gl,p=a.fbo;if(!p)return;r.prepareDrawTile();let d=r.useProgram("hillshade");u.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,p.colorAttachment.get());let f=((r,n,a,o)=>{let s=a.paint.get("hillshade-shadow-color"),l=a.paint.get("hillshade-highlight-color"),h=a.paint.get("hillshade-accent-color"),u=a.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===a.paint.get("hillshade-illumination-anchor")&&(u-=r.transform.angle);let c=!r.options.moving;return{u_matrix:o||r.transform.calculateProjMatrix(n.tileID.toUnwrapped(),c),u_image:0,u_latrange:function(r,n){let a=Math.pow(2,n.canonical.z),o=n.canonical.y;return[new i.MercatorCoordinate(0,o/a).toLngLat().lat,new i.MercatorCoordinate(0,(o+1)/a).toLngLat().lat]}(0,n.tileID),u_light:[a.paint.get("hillshade-exaggeration"),u],u_shadow:s,u_highlight:l,u_accent:h}})(r,a,o,r.terrain?n.projMatrix:null);r.prepareDrawProgram(u,d,n.toUnwrapped());let{tileBoundsBuffer:m,tileBoundsIndexBuffer:_,tileBoundsSegments:g}=r.getTileBoundsBuffers(a);d.draw(u,c.TRIANGLES,s,l,h,i.CullFaceMode.disabled,f,o.id,m,_,g)}(r,o,s,a,l,n,h)}}s.viewport.set([0,0,r.width,r.height]),r.resetStencilClippingMasks()},raster:function(r,n,a,o,s,l){if("translucent"!==r.renderPass||0===a.paint.get("raster-opacity")||!o.length)return;let h=r.context,u=h.gl,c=n.getSource(),p=r.useProgram("raster"),d=r.colorModeForRenderPass(),f=r.terrain&&r.terrain.renderingToTexture,[m,_]=c
60instanceof eP||f?[{},o]:r.stencilConfigForOverlap(o),g=_[_.length-1].overscaledZ,y=!r.options.moving;for(let o of _){let s,_;let x=f?i.DepthMode.disabled:r.depthModeForSublayer(o.overscaledZ-g,1===a.paint.get("raster-opacity")?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly,u.LESS),v=o.toUnwrapped(),b=n.getTile(o);if(f&&(!b||!b.hasData()))continue;let w=f?o.projMatrix:r.transform.calculateProjMatrix(v,y),T=r.terrain&&f?r.terrain.stencilModeForRTTOverlap(o):m[o.overscaledZ],E=l?0:a.paint.get("raster-fade-duration");b.registerFadeDuration(E);let S=n.findLoadedParent(o,0),I=tY(b,S,n,r.transform,E);r.terrain&&r.terrain.prepareDrawTile();let A="nearest"===a.paint.get("raster-resampling")?u.NEAREST:u.LINEAR;h.activeTexture.set(u.TEXTURE0),b.texture.bind(A,u.CLAMP_TO_EDGE),h.activeTexture.set(u.TEXTURE1),S?(S.texture.bind(A,u.CLAMP_TO_EDGE),s=Math.pow(2,S.tileID.overscaledZ-b.tileID.overscaledZ),_=[b.tileID.canonical.x*s%1,b.tileID.canonical.y*s%1]):b.texture.bind(A,u.CLAMP_TO_EDGE);let M=id(w,_||[0,0],s||1,I,a,c instanceof eP?c.perspectiveTransform:[0,0]);if(r.prepareDrawProgram(h,p,v),c instanceof eP)c.boundsBuffer&&c.boundsSegments&&p.draw(h,u.TRIANGLES,x,i.StencilMode.disabled,d,i.CullFaceMode.disabled,M,a.id,c.boundsBuffer,r.quadTriangleIndexBuffer,c.boundsSegments);else{let{tileBoundsBuffer:n,tileBoundsIndexBuffer:o,tileBoundsSegments:s}=r.getTileBoundsBuffers(b);p.draw(h,u.TRIANGLES,x,T,d,i.CullFaceMode.disabled,M,a.id,n,o,s)}}r.resetStencilClippingMasks()},background:function(r,n,a,o){let s=a.paint.get("background-color"),l=a.paint.get("background-opacity");if(0===l)return;let h=r.context,u=h.gl,c=r.transform,p=c.tileSize,d=a.paint.get("background-pattern");if(r.isPatternMissing(d))return;let f=!d&&1===s.a&&1===l&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==f)return;let m=i.StencilMode.disabled,_=r.depthModeForSublayer(0,"opaque"===f?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly),g=r.colorModeForRenderPass(),y=r.useProgram(d?"backgroundPattern":"background"),x,v=o;v||(v=Object.values(x=r.getBackgroundTiles()).map(i=>i.tileID)),d&&(h.activeTexture.set(u.TEXTURE0),r.imageManager.bind(r.context));let b=a.getCrossfadeParameters();for(let f of v){let v=f.toUnwrapped(),w=o?f.projMatrix:r.transform.calculateProjMatrix(v);r.prepareDrawTile();let T=n?n.getTile(f):x?x[f.key]:new i.Tile(f,p,c.zoom,r),E=d?iv(w,l,r,d,{tileID:f,tileSize:p},b):ix(w,l,s);r.prepareDrawProgram(h,y,v);let{tileBoundsBuffer:S,tileBoundsIndexBuffer:I,tileBoundsSegments:A}=r.getTileBoundsBuffers(T);y.draw(h,u.TRIANGLES,_,m,g,i.CullFaceMode.disabled,E,a.id,S,I,A)}},sky:function(r,n,a){let o=r.transform,s="mercator"===o.projection.name||"globe"===o.projection.name?1:i.smoothstep(7,8,o.zoom),l=a.paint.get("sky-opacity")*s;if(0===l)return;let h=r.context,u=a.paint.get("sky-type"),c=new i.DepthMode(h.gl.LEQUAL,i.DepthMode.ReadOnly,[0,1]),p=r.frameCounter/1e3%1;"atmosphere"===u?"offscreen"===r.renderPass?a.needsSkyboxCapture(r)&&(function(r,n,a,o){let s=r.context,l=s.gl,h=n.skyboxFbo;if(!h){h=n.skyboxFbo=s.createFramebuffer(32,32,!1),n.skyboxGeometry=new iU(s),n.skyboxTexture=s.gl.createTexture(),l.bindTexture(l.TEXTURE_CUBE_MAP,n.skyboxTexture),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,l.LINEAR);for(let i=0;i<6;++i)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,l.RGBA,32,32,0,l.RGBA,l.UNSIGNED_BYTE,null)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,32,32]);let u=n.getCenter(r,!0),c=r.useProgram("skyboxCapture"),p=new Float64Array(16);i.identity(p),i.rotateY(p,p,-(.5*Math.PI)),iV(s,n,c,p,u,0),i.identity(p),i.rotateY(p,p,.5*Math.PI),iV(s,n,c,p,u,1),i.identity(p),i.rotateX(p,p,-(.5*Math.PI)),iV(s,n,c,p,u,2),i.identity(p),i.rotateX(p,p,.5*Math.PI),iV(s,n,c,p,u,3),i.identity(p),iV(s,n,c,p,u,4),i.identity(p),i.rotateY(p,p,Math.PI),iV(s,n,c,p,u,5),s.viewport.set([0,0,r.width,r.height])}(r,a),a.markSkyboxValid(r)):"sky"===r.renderPass&&function(r,n,a,o,s){let l=r.context,h=l.gl,u=r.transform,c=r.useProgram("skybox");l.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_CUBE_MAP,n.skyboxTexture);let p={u_matrix:u.skyboxMatrix,u_sun_direction:n.getCenter(r,!1),u_cubemap:0,u_opacity:o,u_temporal_offset:s};r.prepareDrawProgram(l,c),c.draw(l,h.TRIANGLES,a,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,p,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,a,c,l,p):"gradient"===u&&"sky"===r.renderPass&&function(r,n,a,o,s){var l,h,u;let c=r.context,p=c.gl,d=r.transform,f=r.useProgram("skyboxGradient");n.skyboxGeometry||(n.skyboxGeometry=new iU(c)),c.activeTexture.set(p.TEXTURE0);let m=n.colorRampTexture;m||(m=n.colorRampTexture=new i.Texture(c,n.colorRamp,p.RGBA)),m.bind(p.LINEAR,p.CLAMP_TO_EDGE);let _=(l=d.skyboxMatrix,h=n.getCenter(r,!1),u=n.paint.get("sky-gradient-radius"),{u_matrix:l,u_color_ramp:0,u_center_direction:h,u_radius:i.degToRad(u),u_opacity:o,u_temporal_offset:s});r.prepareDrawProgram(c,f),f.draw(c,p.TRIANGLES,a,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,_,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,a,c,l,p)},debug:function(r,n,a){for(let o=0;o<a.length;o++)!function(r,n,a){let o=r.context,s=r.transform,l=o.gl,h="globe"===s.projection.name,u=a.projMatrix;if(h&&i.globeToMercatorTransition(s.zoom)>0){let r=i.transitionTileAABBinECEF(a.canonical,s),n=i.globeDenormalizeECEF(r);u=i.multiply(new Float32Array(16),s.globeMatrix,n),i.multiply(u,s.projMatrix,u)}let c=r.useProgram("debug",null,h?["PROJECTION_GLOBE_VIEW"]:null),p=n.getTileByID(a.key);r.terrain&&r.terrain.setupElevationDraw(p,c);let d=i.DepthMode.disabled,f=i.StencilMode.disabled,m=r.colorModeForRenderPass(),_="$debug";o.activeTexture.set(l.TEXTURE0),r.emptyTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),h?p._makeGlobeTileDebugBuffers(r.context,s):p._makeDebugTileBoundsBuffers(r.context,s.projection);let g=p._tileDebugBuffer||r.debugBuffer,y=p._tileDebugIndexBuffer||r.debugIndexBuffer,x=p._tileDebugSegments||r.debugSegments;c.draw(o,l.LINE_STRIP,d,f,m,i.CullFaceMode.disabled,ia(u,i.Color.red),_,g,y,x,null,
60null,null,[p._globeTileDebugBorderBuffer]);let v=p.latestRawTileData,b=Math.floor((v&&v.byteLength||0)/1024),w=n.getTile(a).tileSize,T=512/Math.min(w,512)*(a.overscaledZ/s.zoom)*.5,E=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(E+=` => ${a.overscaledZ}`),function(i,r){i.initDebugOverlayCanvas();let n=i.debugOverlayCanvas,a=i.context.gl,o=i.debugOverlayCanvas.getContext("2d");o.clearRect(0,0,n.width,n.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(r,5,5),o.strokeText(r,5,5),i.debugOverlayTexture.update(n),i.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}(r,E+=` ${b}kb`);let S=p._tileDebugTextBuffer||r.debugBuffer,I=p._tileDebugTextIndexBuffer||r.quadTriangleIndexBuffer,A=p._tileDebugTextSegments||r.debugSegments;c.draw(o,l.TRIANGLES,d,f,i.ColorMode.alphaBlended,i.CullFaceMode.disabled,ia(u,i.Color.transparent,T),_,S,I,A,null,null,null,[p._globeTileDebugTextBuffer])}(r,n,a[o])},custom:function(r,n,a){let o=r.context,s=a.implementation;if(r.transform.projection.unsupportedLayers&&r.transform.projection.unsupportedLayers.includes("custom"))i.warnOnce("Custom layers are not yet supported with non-mercator projections. Use mercator to enable custom layers.");else if("offscreen"===r.renderPass){let i=s.prerender;i&&(r.setCustomLayerDefaults(),o.setColorMode(r.colorModeForRenderPass()),i.call(s,o.gl,r.transform.customLayerMatrix()),o.setDirty(),r.setBaseState())}else if("translucent"===r.renderPass){r.setCustomLayerDefaults(),o.setColorMode(r.colorModeForRenderPass()),o.setStencilMode(i.StencilMode.disabled);let n="3d"===s.renderingMode?new i.DepthMode(r.context.gl.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,i.DepthMode.ReadOnly);o.setDepthMode(n),s.render(o.gl,r.transform.customLayerMatrix()),o.setDirty(),r.setBaseState(),o.bindFramebuffer.set(null)}}};class iZ{constructor(r,n){this.context=new eM(r),this.transform=n,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=i.SourceCache.maxUnderzooming+i.SourceCache.maxOverzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new tb,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}updateTerrain(i,r){let n=!!i&&!!i.terrain&&this.transform.projection.supportsTerrain;if(!(n||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new t0(this,i));let a=this._terrain;this.transform.elevation=n?a:null,a.update(i,this.transform,r)}_updateFog(i){let r=i.fog;if(!r||"globe"===this.transform.projection.name||1>r.getOpacity(this.transform.pitch)||.03>r.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);let[n,a]=r.getFovAdjustedRange(this.transform._fov);if(n>a)return void(this.transform.fogCullDistSq=null);let o=n+.78*(a-n);this.transform.fogCullDistSq=o*o}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(r,n){if(this.width=r*i.exported.devicePixelRatio,this.height=n*i.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style.order)this.style._layers[i].resize()}setup(){let r=this.context,n=new i.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(i.EXTENT,0),n.emplaceBack(0,i.EXTENT),n.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=r.createVertexBuffer(n,i.posAttributes.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);let a=new i.StructArrayLayout2i4;a.emplaceBack(0,0),a.emplaceBack(i.EXTENT,0),a.emplaceBack(0,i.EXTENT),a.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=r.createVertexBuffer(a,i.posAttributes.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);let o=new i.StructArrayLayout2i4;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(-1,1),o.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(o,i.posAttributes.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);let s=new i.StructArrayLayout4i8;s.emplaceBack(0,0,0,0),s.emplaceBack(i.EXTENT,0,i.EXTENT,0),s.emplaceBack(0,i.EXTENT,0,i.EXTENT),s.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.mercatorBoundsBuffer=r.createVertexBuffer(s,i.boundsAttributes.members),this.mercatorBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);let l=new i.StructArrayLayout3ui6;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(l);let h=new i.StructArrayLayout1ui2;for(let i of[0,1,3,2,0])h.emplaceBack(i);this.debugIndexBuffer=r.createIndexBuffer(h),this.emptyTexture=new i.Texture(r,
60new i.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA),this.identityMat=i.create();let u=this.context.gl;this.stencilClearMode=new i.StencilMode({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.loadTimeStamps.push(i.window.performance.now()),this.atmosphereBuffer=new iN(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(i){return i._makeTileBoundsBuffers(this.context,this.transform.projection),i._tileBoundsBuffer?{tileBoundsBuffer:i._tileBoundsBuffer,tileBoundsIndexBuffer:i._tileBoundsIndexBuffer,tileBoundsSegments:i._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){let r=this.context,n=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(r,n.TRIANGLES,i.DepthMode.disabled,this.stencilClearMode,i.ColorMode.disabled,i.CullFaceMode.disabled,tH(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,n,a){if(!n||this.currentStencilSource===n.id||!r.isTileClipped()||!a||0===a.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let i=!1;for(let r of a)if(void 0===this._tileClippingMaskIDs[r.key]){i=!0;break}if(!i)return}this.currentStencilSource=n.id;let o=this.context,s=o.gl;this.nextStencilID+a.length>256&&this.clearStencil(),o.setColorMode(i.ColorMode.disabled),o.setDepthMode(i.DepthMode.disabled);let l=this.useProgram("clippingMask");for(let r of(this._tileClippingMaskIDs={},a)){let a=n.getTile(r),h=this._tileClippingMaskIDs[r.key]=this.nextStencilID++,{tileBoundsBuffer:u,tileBoundsIndexBuffer:c,tileBoundsSegments:p}=this.getTileBoundsBuffers(a);l.draw(o,s.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:s.ALWAYS,mask:0},h,255,s.KEEP,s.KEEP,s.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,tH(r.projMatrix),"$clipping",u,c,p)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let r=this.nextStencilID++,n=this.context.gl;return new i.StencilMode({func:n.NOTEQUAL,mask:255},r,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);let n=this.context.gl;return new i.StencilMode({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(r){let n=this.context.gl,a=r.sort((i,r)=>r.overscaledZ-i.overscaledZ),o=a[a.length-1].overscaledZ,s=a[0].overscaledZ-o+1;if(s>1){this.currentStencilSource=void 0,this.nextStencilID+s>256&&this.clearStencil();let r={};for(let a=0;a<s;a++)r[a+o]=new i.StencilMode({func:n.GEQUAL,mask:255},a+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=s,[r,a]}return[{[o]:i.StencilMode.disabled},a]}colorModeForRenderPass(){let r=this.context.gl;if(this._showOverdrawInspector){let n=1/8;return new i.ColorMode([r.CONSTANT_COLOR,r.ONE],new i.Color(n,n,n,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?i.ColorMode.unblended:i.ColorMode.alphaBlended}depthModeForSublayer(r,n,a){if(!this.opaquePassEnabledForLayer())return i.DepthMode.disabled;let o=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new i.DepthMode(a||this.context.gl.LEQUAL,n,[o,o])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(r,n){this.style=r,this.options=n,this.lineAtlas=r.lineAtlas,this.imageManager=r.imageManager,this.glyphManager=r.glyphManager,this.symbolFadeChange=r.placement.symbolFadeChange(i.exported.now()),this.imageManager.beginFrame();let a=this.style.order,o=this.style._sourceCaches;for(let i in o){let r=o[i];r.used&&r.prepare(this.context)}let s={},l={},h={};for(let i in o){let r=o[i];s[i]=r.getVisibleCoordinates(),l[i]=s[i].slice().reverse(),h[i]=r.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let i=0;i<a.length;i++)if(this.style._layers[a[i]].is3D()){this.opaquePassCutoff=i;break}if(this.terrain&&(this.terrain.updateTileBinding(h),this.opaquePassCutoff=0),"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new i.GlobeSharedBuffers(this.context)),i.isMapAuthenticated(this.context.gl)){for(let i of(this.renderPass="offscreen",a)){let n=this.style._layers[i],a=r._getLayerSourceCache(n);if(!n.hasOffscreenPass()||n.isHidden(this.transform.zoom))continue;let o=a?l[a.id]:void 0;("custom"===n.type||n.isSky()||o&&o.length)&&this.renderLayer(this,a,n,o)}if(this.depthRangeFor3D=[0,1-(r.order.length+2)*this.numSublayers*this.depthEpsilon],this.terrain&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&this.terrain.drawDepth(),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]),this.context.clear({color:n.showOverdrawInspector?i.
60Color.black:i.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.renderPass="opaque",!this.terrain)for(this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){let i=this.style._layers[a[this.currentLayer]],n=r._getLayerSourceCache(i);if(i.isSky())continue;let o=n?l[n.id]:void 0;this._renderTileClippingMasks(i,n,o),this.renderLayer(this,n,i,o)}if(this.style.fog&&this.transform.projection.supportsFog&&function(r,n){var a,o,s;let l=r.context,h=l.gl,u=r.transform,c=new i.DepthMode(h.LEQUAL,i.DepthMode.ReadOnly,[0,1]),p=r.useProgram("globeAtmosphere",null,"globe"===u.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),d=i.globeToMercatorTransition(u.zoom),f=n.properties.get("color").toArray01(),m=n.properties.get("high-color").toArray01(),_=n.properties.get("space-color").toArray01PremultipliedAlpha(),g=i.identity$1([]);i.rotateY$1(g,g,-i.degToRad(u._center.lng)),i.rotateX$1(g,g,i.degToRad(u._center.lat)),i.rotateZ$1(g,g,u.angle),i.rotateX$1(g,g,-u._pitch);let y=i.fromQuat(new Float32Array(16),g),x=i.mapValue(n.properties.get("star-intensity"),0,1,0,.25),v=i.mapValue(n.properties.get("horizon-blend"),0,1,5e-4,.25),b=i.globeUseCustomAntiAliasing(r,l,u)&&5e-4===v?u.worldSize/(2*Math.PI*1.025)-1:u.globeRadius,w=r.frameCounter/1e3%1,T=i.length(u.globeCenterInViewSpace),E=Math.sqrt(Math.pow(T,2)-Math.pow(b,2)),S=Math.acos(E/T),I=(a=u.frustumCorners.TL,o=u.frustumCorners.TR,s=u.frustumCorners.BR,{u_frustum_tl:a,u_frustum_tr:o,u_frustum_br:s,u_frustum_bl:u.frustumCorners.BL,u_horizon:u.frustumCorners.horizon,u_transition:d,u_fadeout_range:v,u_color:f,u_high_color:m,u_space_color:_,u_star_intensity:x,u_star_size:5*i.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:w,u_horizon_angle:S,u_rotation_matrix:y});r.prepareDrawProgram(l,p);let A=r.atmosphereBuffer;A&&p.draw(l,h.TRIANGLES,c,i.StencilMode.disabled,i.ColorMode.alphaBlended,i.CullFaceMode.backCW,I,"skybox",A.vertexBuffer,A.indexBuffer,A.segments)}(this,this.style.fog),this.renderPass="sky",(i.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer<a.length;this.currentLayer++){let i=this.style._layers[a[this.currentLayer]],n=r._getLayerSourceCache(i);i.isSky()&&this.renderLayer(this,n,i,n?l[n.id]:void 0)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<a.length;){let i=this.style._layers[a[this.currentLayer]],n=r._getLayerSourceCache(i);if(i.isSky()){++this.currentLayer;continue}if(this.terrain&&this.style.isLayerDraped(i)){if(i.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer);continue}let o=n?("symbol"===i.type?h:l)[n.id]:void 0;this._renderTileClippingMasks(i,n,n?s[n.id]:void 0),this.renderLayer(this,n,i,o),++this.currentLayer}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry){let n=null;i.values(this.style._layers).forEach(i=>{let a=r._getLayerSourceCache(i);a&&!i.isHidden(this.transform.zoom)&&(!n||n.getSource().maxzoom<a.getSource().maxzoom)&&(n=a)}),n&&this.options.showTileBoundaries&&iG.debug(this,n,n.getVisibleCoordinates())}this.options.showPadding&&function(i){var r,n;let a=i.transform.padding;iD(i,i.transform.height-(a.top||0),3,iM),iD(i,a.bottom||0,3,iC),iL(i,a.left||0,3,iz),iL(i,i.transform.width-(a.right||0),3,iP);let o=i.transform.centerPoint;r=o.x,n=i.transform.height-o.y,iB(i,r-1,n-10,2,20,ik),iB(i,r-10,n-1,20,2,ik)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(i.window.performance.now()),this.saveC
60anvasCopy())}}renderLayer(i,r,n,a){n.isHidden(this.transform.zoom)||("background"===n.type||"sky"===n.type||"custom"===n.type||a&&a.length)&&(this.id=n.id,this.gpuTimingStart(n),i.transform.projection.unsupportedLayers&&i.transform.projection.unsupportedLayers.includes(n.type)||iG[n.type](i,r,n,a,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(i){if(!this.options.gpuTiming)return;let r=this.context.extTimerQuery,n=this.gpuTimers[i.id];n||(n=this.gpuTimers[i.id]={calls:0,cpuTime:0,query:r.createQueryEXT()}),n.calls++,r.beginQueryEXT(r.TIME_ELAPSED_EXT,n.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){let i=this.context.extTimerQuery,r=i.createQueryEXT();this.deferredRenderGpuTimeQueries.push(r),i.beginQueryEXT(i.TIME_ELAPSED_EXT,r)}}gpuTimingDeferredRenderEnd(){if(!this.options.gpuTimingDeferredRender)return;let i=this.context.extTimerQuery;i.endQueryEXT(i.TIME_ELAPSED_EXT)}gpuTimingEnd(){if(!this.options.gpuTiming)return;let i=this.context.extTimerQuery;i.endQueryEXT(i.TIME_ELAPSED_EXT)}collectGpuTimers(){let i=this.gpuTimers;return this.gpuTimers={},i}collectDeferredRenderGpuQueries(){let i=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],i}queryGpuTimers(i){let r={};for(let n in i){let a=i[n],o=this.context.extTimerQuery,s=o.getQueryObjectEXT(a.query,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(a.query),r[n]=s}return r}queryGpuTimeDeferredRender(i){if(!this.options.gpuTimingDeferredRender)return 0;let r=this.context.extTimerQuery,n=0;for(let a of i)n+=r.getQueryObjectEXT(a,r.QUERY_RESULT_EXT)/1e6,r.deleteQueryEXT(a);return n}translatePosMatrix(r,n,a,o,s){if(!a[0]&&!a[1])return r;let l=s?"map"===o?this.transform.angle:0:"viewport"===o?-this.transform.angle:0;if(l){let i=Math.sin(l),r=Math.cos(l);a=[a[0]*r-a[1]*i,a[0]*i+a[1]*r]}let h=[s?a[0]:R(n,a[0],this.transform.zoom),s?a[1]:R(n,a[1],this.transform.zoom),0],u=new Float32Array(16);return i.translate(u,r,h),u}saveTileTexture(i){let r=this._tileTextures[i.size[0]];r?r.push(i):this._tileTextures[i.size[0]]=[i]}getTileTexture(i){let r=this._tileTextures[i];return r&&r.length>0?r.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;let r=this.imageManager.getPattern(i.from.toString()),n=this.imageManager.getPattern(i.to.toString());return!r||!n}currentGlobalDefines(){let i=this.terrain&&this.terrain.renderingToTexture,r=this.style&&this.style.fog,n=[];return this.terrain&&!this.terrain.renderingToTexture&&n.push("TERRAIN"),r&&!i&&0!==r.getOpacity(this.transform.pitch)&&n.push("FOG"),i&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}useProgram(i,r,n){this.cache=this.cache||{};let a=this.currentGlobalDefines().concat(n||[]),o=t1.cacheKey(tO[i],i,a,r);return this.cache[o]||(this.cache[o]=new t1(this.context,i,tO[i],r,ib[i],a)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(r,n,a){if(this.terrain&&this.terrain.renderingToTexture)return;let o=this.style.fog;if(o){let s=o.getOpacity(this.transform.pitch),l=((r,n,a,o,s,l,h,u,c,p,d)=>{let f=r.transform,m=n.properties.get("color").toArray01();m[3]=o;let _=r.frameCounter/1e3%1;return{u_fog_matrix:a?f.calculateFogTileMatrix(a):r.identityMat,u_fog_range:n.getFovAdjustedRange(f._fov),u_fog_color:m,u_fog_horizon_blend:n.properties.get("horizon-blend"),u_fog_temporal_offset:_,u_frustum_tl:s,u_frustum_tr:l,u_frustum_br:h,u_frustum_bl:u,u_globe_pos:c,u_globe_radius:p,u_viewport:d,u_globe_transition:i.globeToMercatorTransition(f.zoom),u_is_globe:+("globe"===f.projection.name)}})(this,o,a,s,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*i.exported.devicePixelRatio,this.transform.height*i.exported.devicePixelRatio]);n.setFogUniformValues(r,l)}}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){let i=this.context.gl,r=i.createTexture();return i.bindTexture(i.TEXTURE_2D,r),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;let i=this.style&&this.style.fog;return!!i&&0!==i.getOpacity(this.transform.pitch)}
60getBackgroundTiles(){let r=this._backgroundTiles,n=this._backgroundTiles={},a=this.transform.coveringTiles({tileSize:512});for(let o of a)n[o.key]=r[o.key]||new i.Tile(o,512,this.transform.tileZoom,this);return n}clearBackgroundTiles(){this._backgroundTiles={}}}class i${constructor(i=0,r=0,n=0,a=0){if(isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=r,this.left=n,this.right=a}interpolate(r,n,a){return null!=n.top&&null!=r.top&&(this.top=i.number(r.top,n.top,a)),null!=n.bottom&&null!=r.bottom&&(this.bottom=i.number(r.bottom,n.bottom,a)),null!=n.left&&null!=r.left&&(this.left=i.number(r.left,n.left,a)),null!=n.right&&null!=r.right&&(this.right=i.number(r.right,n.right,a)),this}getCenter(r,n){let a=i.clamp((this.left+r-this.right)/2,0,r),o=i.clamp((this.top+n-this.bottom)/2,0,n);return new i.pointGeometry(a,o)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new i$(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function iq(r,n){let a=i.getColumn(r,3);i.fromQuat(r,n),i.setColumn(r,3,a)}function iX(r,n){let a=i.identity$1([]);return i.rotateZ$1(a,a,-n),i.rotateX$1(a,a,-r),a}function iW(r,n){let a=[r[0],r[1],0],o=[n[0],n[1],0];if(i.length(a)>=1e-15){let r=i.normalize([],a);i.scale$2(o,r,i.dot(o,r)),n[0]=o[0],n[1]=o[1]}let s=i.cross([],n,r);if(1e-15>i.len(s))return null;let l=Math.atan2(-s[1],s[0]);return iX(Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2]),l)}class iH{constructor(i,r){this.position=i,this.orientation=r}get position(){return this._position}set position(r){if(r){let n=r instanceof i.MercatorCoordinate?r:new i.MercatorCoordinate(r[0],r[1],r[2]);
60this._renderWorldCopies&&(n.x=i.wrap(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(r,n){if(this.orientation=null,!this.position)return;let a=this._elevation?this._elevation.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(r)):0,o=this.position,s=i.MercatorCoordinate.fromLngLat(r,a),l=[s.x-o.x,s.y-o.y,s.z-o.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=iW(l,n)}setPitchBearing(r,n){this.orientation=iX(i.degToRad(r),i.degToRad(-n))}}class iY{constructor(r,n){this._transform=i.identity([]),this.orientation=n,this.position=r}get mercatorPosition(){let r=this.position;return new i.MercatorCoordinate(r[0],r[1],r[2])}get position(){let r=i.getColumn(this._transform,3);return[r[0],r[1],r[2]]}set position(r){r&&i.setColumn(this._transform,3,[r[0],r[1],r[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||i.identity$1([]),r&&iq(this._transform,this._orientation)}getPitchBearing(){let i=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,r){this._orientation=iX(i,r),iq(this._transform,this._orientation)}forward(){let r=i.getColumn(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){let r=i.getColumn(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){let r=i.getColumn(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,n){let a=new Float64Array(16);return i.invert(a,this.getWorldToCamera(r,n)),a}getWorldToCameraPosition(r,n,a){let o=this.position;i.scale$2(o,o,-r);let s=new Float64Array(16);return i.fromScaling(s,[a,a,a]),i.translate(s,s,o),s[10]*=n,s}getWorldToCamera(r,n){let a=new Float64Array(16),o=new Float64Array(4),s=this.position;return i.conjugate(o,this._orientation),i.scale$2(s,s,-r),i.fromQuat(a,o),i.translate(a,a,s),a[1]*=-1,a[5]*=-1,a[9]*=-1,a[13]*=-1,a[8]*=n,a[9]*=n,a[10]*=n,a[11]*=n,a}getCameraToClipPerspective(r,n,a,o){let s=new Float64Array(16);return i.perspective(s,r,n,a,o),s}getDistanceToElevation(r){let n=0===r?0:i.mercatorZfromAltitude(r,this.position[1]),a=this.forward();return(n-this.position[2])/a[2]}clone(){return new iY([...this.position],[...this.orientation])}}function iK(r,n){let a=iQ(r.projection,r.zoom,r.width,r.height),o=function(r,n,a,o,s){let l=new i.LngLat(a.lng-180*i0,a.lat),h=new i.LngLat(a.lng+180*i0,a.lat),u=r.project(l.lng,l.lat),c=r.project(h.lng,h.lat),p=-Math.atan2(c.y-u.y,c.x-u.x),d=i.MercatorCoordinate.fromLngLat(a);d.y=i.clamp(d.y,-.999975,.999975);let f=d.toLngLat(),m=r.project(f.lng,f.lat),_=i.MercatorCoordinate.fromLngLat(f);_.x+=i0;let g=_.toLngLat(),y=r.project(g.lng,g.lat),x=i2(y.x-m.x,y.y-m.y,p),v=i.MercatorCoordinate.fromLngLat(f);v.y+=i0;let b=v.toLngLat(),w=r.project(b.lng,b.lat),T=i2(w.x-m.x,w.y-m.y,p),E=Math.abs(x.x)/Math.abs(T.y),S=i.identity([]);i.rotateZ(S,S,-p*(1-(s?0:o)));let I=i.identity([]);return i.scale(I,I,[1,1-(1-E)*o,1]),I[4]=-T.x/T.y*o,i.rotateZ(I,I,p),i.multiply(I,S,I),I}(r.projection,0,r.center,a,n),s=iJ(r);return i.scale(o,o,[s,s,1]),o}function iJ(r){let n=r.projection,a=iQ(r.projection,r.zoom,r.width,r.height),o=i1(n,r.center),s=i1(n,i.LngLat.convert(n.center));return Math.pow(2,o*a+(1-a)*s)}function iQ(r,n,a,o,s=1/0){let l=r.range;if(!l)return 0;let h=Math.min(s,Math.max(a,o)),u=Math.log(h/1024)/Math.LN2;return i.smoothstep(l[0]+u,l[1]+u,n)}let i0=1/4e4;function i1(r,n){let a=i.clamp(n.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),o=new i.LngLat(n.lng-180*i0,a),s=new i.LngLat(n.lng+180*i0,a),l=r.project(o.lng,a),h=r.project(s.lng,a),u=i.MercatorCoordinate.fromLngLat(o),c=i.MercatorCoordinate.fromLngLat(s),p=h.x-l.x,d=h.y-l.y,f=c.x-u.x,m=c.y-u.y,_=Math.sqrt((f*f+m*m)/(p*p+d*d));return Math.log(_)/Math.LN2}function i2(i,r,n){let a=Math.cos(n),o=Math.sin(n);return{x:i*a-r*o,y:i*o+r*a}}class i3{constructor(r,n,a,o,s,l,h){this.tileSize=512,this._renderWorldCopies=void 0===s||s,this._minZoom=r||0,this._maxZoom=n||22,this._minPitch=null==a?0:a,this._maxPitch=null==o?60:o,this.setProjection(l),this.setMaxBounds(h),this.width=0,this.height=0,this._center=new i.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new i$,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new iY,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){let i=new i3(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i._centerAltitudeValidForE
60xaggeration=this._centerAltitudeValidForExaggeration,i.tileSize=this.tileSize,i.width=this.width,i.height=this.height,i.cameraElevationReference=this.cameraElevationReference,i._center=this._center,i._setZoom(this.zoom),i._seaLevelZoom=this._seaLevelZoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._nearZ=this._nearZ,i._farZ=this._farZ,i._averageElevation=this._averageElevation,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._camera=this._camera.clone(),i._calcMatrices(),i.freezeTileCoverage=this.freezeTileCoverage,i.frustumCorners=this.frustumCorners,i}get elevation(){return this._elevation}set elevation(i){this._elevation!==i&&(this._elevation=i,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(i){let r=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||r)&&this._updateCameraOnTerrain(),(i||r)&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return i.pick(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};let n=this.projection?this.getProjection():void 0;this.projection=i.getProjection(this.projectionOptions);let a=!s(n,this.getProjection());return a&&this._calcMatrices(),this.mercatorFromTransition=!1,a}setMercatorFromTransition(){let r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=i.getProjection({name:"mercator"});let n=r!==this.projection.name;return n&&this._calcMatrices(),n}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(i){void 0===i?i=!0:null===i&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){let i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return i.mercatorZfromAltitude(this.center.lat,this.cameraWorldSize)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.pointGeometry(this.width,this.height)}get bearing(){return i.wrap(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(r){var n,a,o,s,l,h,u,c,p,d;let f=-r*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=(n=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n),a=this.rotationMatrix,o=this.rotationMatrix,s=this.angle,l=o[0],h=o[1],u=o[2],c=o[3],p=Math.sin(s),d=Math.cos(s),a[0]=l*d+u*p,a[1]=h*d+c*p,a[2]=-(l*p)+u*d,a[3]=-(h*p)+c*d)}get pitch(){return this._pitch/Math.PI*180}set pitch(r){let n=i.clamp(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(i){this._averageElevation=i,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(i){let r=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(i){this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForE
60xaggeration=void 0);let i=this._elevation;this._centerAltitude=i.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=i.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;let r=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],a=this.horizonLineFromTop(),o=0,s=0;for(let l=0;l<n.length;l++){let h=new i.pointGeometry(n[l][0]*this.width,a+n[l][1]*(this.height-a)),u=r.pointCoordinate(h);if(!u)continue;let c=1/Math.hypot(u[0]-this._camera.position[0],u[1]-this._camera.position[1]);o+=u[3]*c,s+=c}return 0===s?NaN:o/s}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;let i=this._seaLevelZoom,r=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),n=this.pixelsPerMeter/this.worldSize*r,a=this._mercatorZfromZoom(i),o=this._mercatorZfromZoom(this._maxZoom),s=Math.max(a-n,o);this._setZoom(this._zoomFromMercatorZ(s))}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}computeZoomRelativeTo(r){let n;let a=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,r.toAltitude()));n=r.z<this._camera.position[2]?[a.x,a.y,a.z]:[r.x,r.y,r.z];let o=i.length(i.sub([],this._camera.position,n));return i.clamp(this._zoomFromMercatorZ(o),this._minZoom,this._maxZoom)}setFreeCameraOptions(r){if(!this.height||!r.position&&!r.orientation)return;this._updateCameraState();let n=!1;if(r.orientation&&!i.exactEquals(r.orientation,this._camera.orientation)&&(n=this._setCameraOrientation(r.orientation)),r.position){let a=[r.position.x,r.position.y,r.position.z];i.exactEquals$1(a,this._camera.position)||(this._setCameraPosition(a),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();let r=this._camera.position,n=new iH;return n.position=new i.MercatorCoordinate(r[0],r[1],r[2]),n.orientation=this._camera.orientation,n._elevation=this.elevation,n._renderWorldCopies=this.renderWorldCopies,n}_setCameraOrientation(r){if(!i.length$1(r))return!1;i.normalize$1(r,r);let n=i.transformQuat([],[0,0,-1],r),a=i.transformQuat([],[0,-1,0],r);if(a[2]<0)return!1;let o=iW(n,a);return!!o&&(this._camera.orientation=o,!0)}_setCameraPosition(r){let n=this.zoomScale(this.minZoom)*this.tileSize,a=this.zoomScale(this.maxZoom)*this.tileSize,o=this.cameraToCenterDistance;r[2]=i.clamp(r[2],o/a,o/n),this._camera.position=r}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,r,n){this._unmodified=!1,this._edgeInsets.interpolate(i,r,n),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){let r=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,r)}getVisibleUnwrappedCoordinates(r){let n=[new i.UnwrappedTileID(0,r)];if(this.renderWorldCopies){let a=this.pointCoordinate(new i.pointGeometry(0,0)),o=this.pointCoordinate(new i.pointGeometry(this.width,0)),s=this.pointCoordinate(new i.pointGeometry(this.width,this.height)),l=this.pointCoordinate(new i.pointGeometry(0,this.height)),h=Math.floor(Math.min(a.x,o.x,s.x,l.x)),u=Math.floor(Math.max(a.x,o.x,s.x,l.x));for(let a=h-1;a<=u+1;a++)0!==a&&n.push(new i.UnwrappedTileID(a,r))}return n}coveringTiles(r){let n=this.coveringZoomLevel(r),a=n,o=this.elevation&&!r.isTerrainDEM,s="mercator"===this.projection.name;if(void 0!==r.minzoom&&n<r.minzoom)return[];void 0!==r.maxzoom&&n>r.maxzoom&&(n=r.maxzoom);let l=this.locationCoordinate(this.center),h=this.center.lat,u=1<<n,c=[u*l.x,u*l.y,0],p="globe"===this.projection.name,d=!p,f=i.Frustum.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,d),m=p?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),_=u*i.mercatorZfromAltitude(1,this.center.lat),g=this._camera.position[2]/i.mercatorZfromAltitude(1,this.center.lat),y=[u*m.x,u*m.y,g*(d?1:_)],x=this.cameraToCenterDistance/r.tileSize*(r.roundZoom?1:.502),v=this.pitch<=60&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace?n:0,b=r.isTerrainDEM&&this._elevation?1e4*this._elevation.exaggeration():this._centerAltitude,w=r.isTerrainDEM?-b:this._elevation?this._elevation.getMinElevationBelowMSL():0,T=this.projection.isReprojectedInTileSpace?iJ(this):1,E=r=>{let n=1/4e4,a=new i.MercatorCoordinate(r.x+n,r.y,r.z),o=new i.MercatorCoordinate(r.x,r.y+n,r.z),s=r.toLngLat(),l=a.toLngLat(),h=o.toLngLat(),u=this.locationCoordinate(s),c=this.locationCoordinate(l),p=this.locationCoordinate(h),d=Math.hypot(c.x-u.x,c.y-u.y),f=Math.hypot(p.x-u.x,p.y-u.
60y);return Math.sqrt(d*f)*T/n},S=r=>({aabb:i.tileAABB(this,u,0,0,0,r,w,b,this.projection),zoom:0,x:0,y:0,minZ:w,maxZ:b,wrap:r,fullyVisible:!1}),I=[],A=[],M=n,C=r.reparseOverscaled?a:n,z=i=>i*i,P=z((g-this._centerAltitude)*_),k=i=>{if(!this._elevation||!i.tileID||!s)return;let r=this._elevation.getMinMaxForTile(i.tileID),n=i.aabb;r?(n.min[2]=r.min,n.max[2]=r.max,n.center[2]=(n.min[2]+n.max[2])/2):(i.shouldSplit=D(i),i.shouldSplit||(n.min[2]=n.max[2]=n.center[2]=this._centerAltitude))},D=r=>{if(r.zoom<v)return!0;if(r.zoom===M)return!1;if(null!=r.shouldSplit)return r.shouldSplit;let n=r.aabb.distanceX(y),s=r.aabb.distanceY(y),l=P,u=1;if(p){l=z(r.aabb.distanceZ(y));let n=Math.pow(2,r.zoom),a=i.latFromMercatorY((r.y+1)/n),o=i.latFromMercatorY(r.y/n),s=Math.min(Math.max(h,a),o),c=i.circumferenceAtLatitude(s)/i.circumferenceAtLatitude(h);if(u=s===h?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,c/this._mercatorScaleRatio),this.zoom<=i.GLOBE_ZOOM_THRESHOLD_MIN&&r.zoom===M-1&&c>=.9)return!0}else if(o&&(l=z(r.aabb.distanceZ(y)*_)),this.projection.isReprojectedInTileSpace&&a<=5){let n=Math.pow(2,r.zoom),a=E(new i.MercatorCoordinate((r.x+.5)/n,(r.y+.5)/n));u=a>.85?1:a}let c=n*n+s*s+l;return c<z((1<<M-r.zoom)*x*u*((i,r)=>{if(r*z(.707)<i)return 1;let n=Math.sqrt(r/i);return n/(1.4144271570014144+(Math.pow(1.1,n-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(l,P),c))};if(this.renderWorldCopies)for(let i=1;i<=3;i++)I.push(S(-i)),I.push(S(i));for(I.push(S(0));I.length>0;){let a=I.pop(),l=a.x,h=a.y,d=a.fullyVisible;if(!d){let i=a.aabb.intersects(f);if(0===i)continue;d=2===i}if(a.zoom!==M&&D(a))for(let r=0;r<4;r++){let n=(l<<1)+r%2,c=(h<<1)+(r>>1),f={aabb:s?a.aabb.quadrant(r):i.tileAABB(this,u,a.zoom+1,n,c,a.wrap,a.minZ,a.maxZ,this.projection),zoom:a.zoom+1,x:n,y:c,wrap:a.wrap,fullyVisible:d,tileID:void 0,shouldSplit:void 0,minZ:a.minZ,maxZ:a.maxZ};o&&!p&&(f.tileID=new i.OverscaledTileID(a.zoom+1===M?C:a.zoom+1,a.wrap,a.zoom+1,n,c),k(f)),I.push(f)}else{let o=a.zoom===M?C:a.zoom;if(r.minzoom&&r.minzoom>o)continue;let s=c[0]-(.5+l+(a.wrap<<a.zoom))*(1<<n-a.zoom),u=c[1]-.5-h,p=a.tileID?a.tileID:new i.OverscaledTileID(o,a.wrap,a.zoom,l,h);A.push({tileID:p,distanceSq:s*s+u*u})}}if(this.fogCullDistSq){let n=this.fogCullDistSq,a=this.horizonLineFromTop();A=A.filter(o=>{let s=[0,0,0,1],l=[i.EXTENT,i.EXTENT,0,1],h=this.calculateFogTileMatrix(o.tileID.toUnwrapped());i.transformMat4$1(s,s,h),i.transformMat4$1(l,l,h);let u=i.getAABBPointSquareDist(s,l);if(0===u)return!0;let c=!1,p=this._elevation;if(p&&u>n&&0!==a){let n;let s=this.calculateProjMatrix(o.tileID.toUnwrapped());r.isTerrainDEM||(n=p.getMinMaxForTile(o.tileID)),n||(n={min:w,max:b});let l=i.furthestTileCorner(this.rotation),h=[l[0]*i.EXTENT,l[1]*i.EXTENT,n.max];i.transformMat4(h,h,s),c=(1-h[1])*this.height*.5<a}return u<n||c})}return A.sort((i,r)=>i.distanceSq-r.distanceSq).map(i=>i.tileID)}resize(i,r){this.width=i,this.height=r,this.pixelsToGLUnits=[2/i,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(r){let n=i.clamp(r.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),a=this.projection.project(r.lng,n);return new i.pointGeometry(a.x*this.worldSize,a.y*this.worldSize)}unproject(i){return this.projection.unproject(i.x/this.worldSize,i.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(r,n){let a,o;let s=this.centerPoint;if("globe"===this.projection.name){let i=this.worldSize;a=(n.x-s.x)/i,o=(n.y-s.y)/i}else{let i=this.pointCoordinate(n),r=this.pointCoordinate(s);a=i.x-r.x,o=i.y-r.y}let l=this.locationCoordinate(r);this.setLocation(new i.MercatorCoordinate(l.x-a,l.y-o))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i){return this.projection.locationPoint(this,i)}locationPoint3D(i){return this.projection.locationPoint(this,i,!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i){return this.coordinateLocation(this.pointCoordinate3D(i))}locationCoordinate(r,n){let a=n?i.mercatorZfromAltitude(n,r.lat):void 0,o=this.projection.project(r.lng,r.lat);return new i.MercatorCoordinate(o.x,o.y,a)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(r,n){let a=null!=n?n:this._centerAltitude,o=[r.x,r.y,0,1],s=[r.x,r.y,1,1];i.transformMat4$1(o,o,this.pixelMatrixInverse),i.transformMat4$1(s,s,this.pixelMatrixInverse);let l=s[3];i.scale$1(o,o,1/o[3]),i.scale$1(s,s,1/l);let h=o[2],u=s[2];return{p0:o,p1:s,t:h===u?0:(a-h)/(u-h)}}screenPointToMercatorRay(r){let n=[r.x,r.y,0,1],a=[r.x,r.y,1,1];return i.transformMat4$1(n,n,this.pixelMatrixInverse),i.transformMat4$1(a,a,this.pixelMatrixInverse),i.scale$1(n,n,1/n[3]),i.scale$1(a,a,1/a[3]),n[2]=i.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,a[2]=i.mercatorZfromAltitude(a[2],this._center.lat)*this.worldSize,i.scale$1(n,n,1/this.worldSize),i.scale$1(a,a,1/this.worldSize),new i.Ray([n[0],n[1],n[2]],i.normalize([],i.sub([],a,n)))}rayIntersectionCoordinate(r){let{p0:n,p1:a,t:o}=r,s=i.mercatorZfromAltitude(n[2],this._center.lat),l=i.mercatorZfromAltitude(a[2],this._center.lat);return new i.MercatorCoordinate(i.number(n[0],a[0],o)/this.worldSize,i.number(n[1],a[1],o)/this.worldSize,i.number(s,l,o))}pointCoordinate(i,r=this._centerAltitude){return this.projection.pointCoordinate(this,i.x,i.y,r)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);let n=this.projection.pointCoordinate3D(this,r.x,r.y);if(n)return new i.MercatorCoordinate(n[0],n[1],n[2]);let a=0,o=this.horizonLineFromTop();if(r.y>o)return this.pointCoordinate(r);let s=.02*o,l=r.clone();for(let r=0;r<10&&o-a>s;r++){l.y=i.number(a,o,.66);let r=this.projection.pointCoordinate3D(this,l.x,l.y);r?(o=l.y,n=r):a=l.y}return n?new i.MercatorCoordinate(n[0],n[1],n[2]):this.pointCoordinate(r)}isPointAboveHorizon(i){return this.projection.isPointAboveHorizon(this,i)}_coordinatePoint(r,n){let a=n&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,o=[r.x*this.worldSize,r.y*this.worldSize,a+r.toAltitude(),1];return i.transformMat4$1(o,o,this.pixelMatrix),o[3]>0?new i.pointGeometry(o[0]/o[3],o[1]/o[3]):new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(r,n){var a,o,s,l;let h=new i.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),u=new i.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),c=new i.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),p=new i.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom),d=this.pointCoordinate(h,r),f=this.pointCoordinate(u,r),m=this.pointCoordinate(c,n),_=this.pointCoordinate(p,n);return d.y>1&&f.y>=0?d=new i.MercatorCoordinate((1-_.y)/(((a=d).y-_.y)/(a.x-_.x))+_.x,1):d.y<0&&f.y<=1&&(d=new i.MercatorCoordinate(-_.y/(((o=d).y-_.y)/(o.x-_.x))+_.x,0)),f.y>1&&d.y>=0?f=new i.MercatorCoordinate((1-m.y)/(((s=f).y-m.y)/(s.x-m.x))+m.x,1):f.y<0&&d.y<=1&&(f=new i.MercatorCoordinate(-m.y/(((l=f).y-m.y)/(l.x-m.x))+m.x,0)),(new i.LngLatBounds).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(m))}_getBounds3D(){let i=this.elevation;if(!i.visibleDemTiles.length)return this._getBounds(0,0);let r=i.visibleDemTiles.reduce((i,r)=>{if(r.dem){let n=r.dem.tree;i.min=Math.min(i.min,n.minimums[0]),i.max=Math.max(i.max,n.maximums[0])}return i},{min:Number.MAX_VALUE,max:0});return this._getBounds(r.min*i.exaggeration(),r.max*i.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(i=!0){let r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,n=this.height/2-r*(1-this._horizonShift);return i?Math.max(0,n):n}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-i.MAX_MERCATOR_LATITUDE,this.maxLat=i.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=i.mercatorXfromLng(this.minLng)*this.tileSize,this.worldMaxX=i.mercatorXfromLng(this.maxLng)*this.tileSize,this.worldMinY=i.mercatorYfromLat(this.maxLat)*this.tileSize,this.worldMaxY=i.mercatorYfromLat(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(i,r){return this.projection.createTileMatrix(this,r,i)}calculateDistanceTileData(r){let n=r.key,a=this._distanceTileDataCache;if(a[n])return a[n];let o=r.canonical,s=1/this.height,l=this.cameraWorldSize/this.zoomScale(o.z),h=(o.x+Math.pow(2,o.z)*r.wrap)*l,u=o.y*l,c=this.point,p=this.angle,d=Math.sin(-p),f=-Math.cos(-p);return a[n]={bearing:[d,f],center:[(c.x-h)*s,(c.y-u)*s],scale:l/i.EXTENT*s},a[n]}calculateFogTileMatrix(r){let n=r.key,a=this._fogTileMatrixCache;if(a[n])return a[n];let o=this.projection.createTileMatrix(this,this.cameraWorldSize,r);return i.multiply(o,this.worldToFogMatrix,o),a[n]=new Float32Array(o),a[n]}calculateProjMatrix(r,n=!1){let a=r.key,o=n?this._alignedProjMatrixCache:this._projMatrixCache;if(o[a])return o[a];let s=this.calculatePosMatrix(r,this.worldSize);return i.multiply(s,this.projection.isReprojectedInTileSpace?this.mercatorMatrix:n?this.alignedProjMatrix:this.projMatrix,s),o[a]=new Float32Array(s),o[a]}calculatePixelsToTileUnitsMatrix(r){let n=r.tileID.key,a=this._pixelsToTileUnitsCache;if(a[n])return a[n];let o=function(r,n){var a,o,s,l,h,u,c,p;let{scale:d}=r.tileTransform,f=d*i.EXTENT/(r.tileSize*Math.pow(2,n.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return a=new Float32Array(4),l=(o=n.inverseAdjustmentMatrix)[1],h=o[2],u=o[3],p=(s=[f,f])[1],a[0]=o[0]*(c=s[0]),a[1]=l*c,a[2]=h*p,a[3]=u*p,a}(r,this);return a[n]=o,a[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;let r=this._elevation;this._updateCameraState();let n=i.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,a=this._computeCameraPosition(n),o=this._camera.forward(),s=i.mercatorZfromAltitude(1,this._center.lat);a[2]/=s,o[2]/=s,i.normalize(o,o);let l=r.raycast(a,o,r.exaggeration());if(l){let r=i.scaleAndAdd([],a,o,l),n=new i.MercatorCoordinate(r[0],r[1],i.mercatorZfromAltitude(r[2],i.latFromMercatorY(r[1]))),h=(n.z+i.length([n.x-a[0],n.y-a[1],n.z-a[2]*s]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(h),this._centerAltitude=n.toAltitude(),this._center=this.coordinateLocation(n),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCameraAltitude(){if(!this._elevation)return;let r=this._elevation;this._updateCameraState();let n=i.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,a=this._computeCameraPosition(n),o=r.getAtPointOrZero(new i.MercatorCoordinate(...a)),s=this._minimumHeightOverTerrain()*M
60ath.cos(i.degToRad(this._maxPitch)),l=this._camera.position[2]-this.pixelsPerMeter/this.worldSize*o;if(l<s){let r=this.locationCoordinate(this._center,this._centerAltitude),n=[r.x-a[0],r.y-a[1],r.z-a[2]],o=i.length(n);n[2]-=(s-l)/this._pixelsPerMercatorPixel;let h=i.length(n);if(0===h)return;i.scale$2(n,n,o/h*this._pixelsPerMercatorPixel),this._camera.position=[r.x-n[0],r.y-n[1],r.z*this._pixelsPerMercatorPixel-n[2]],this._camera.orientation=iW(n,this._camera.up()),this._updateStateFromCamera()}}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let r="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||r){let n=this.center;return n.lat=i.clamp(n.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||r)||(n.lng=i.clamp(n.lng,this.minLng,this.maxLng)),this.center=n,void(this._constraining=!1)}let n=this._unmodified,{x:a,y:o}=this.point,s=0,l=a,h=o,u=this.width/2,c=this.height/2,p=this.worldMinY*this.scale,d=this.worldMaxY*this.scale;if(o-c<p&&(h=p+c),o+c>d&&(h=d-c),d-p<this.height&&(s=Math.max(s,this.height/(d-p)),h=(d+p)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){let i=this.worldMinX*this.scale,r=this.worldMaxX*this.scale,n=this.worldSize/2-(i+r)/2;(l=(a+n+this.worldSize)%this.worldSize-n)-u<i&&(l=i+u),l+u>r&&(l=r-u),r-i<this.width&&(s=Math.max(s,this.width/(r-i)),l=(r+i)/2)}l===a&&h===o||(this.center=this.unproject(new i.pointGeometry(l,h))),s&&(this.zoom+=this.scaleZoom(s)),this._constrainCameraAltitude(),this._unmodified=n,this._constraining=!1}_minZoomForBounds(){let i=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(i=Math.max(i,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),i}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;let r=this.centerOffset,n=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=i.mercatorZfromAltitude(1,this.center.lat)/i.mercatorZfromAltitude(1,i.GLOBE_SCALE_MATCH_LATITUDE));let a=iQ(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,a),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;let o=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?n:1),s=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);s[8]=-(2*r.x)/this.width,s[9]=2*r.y/this.height;let l=i.mul([],s,o);if(this.projection.isReprojectedInTileSpace){let r=this.locationCoordinate(this.center),n=i.identity([]);i.translate(n,n,[r.x*this.worldSize,r.y*this.worldSize,0]),i.multiply(n,n,iK(this)),i.translate(n,n,[-r.x*this.worldSize,-r.y*this.worldSize,0]),i.multiply(l,l,n),this.inverseAdjustmentMatrix=function(i){let r=iK(i,!0);return w([],[r[0],r[1],r[4],r[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];this.mercatorMatrix=i.scale([],l,[this.worldSize,this.worldSize,this.worldSize/n,1]),this.projMatrix=l,this.invProjMatrix=i.invert(new Float64Array(16),this.projMatrix);let h=i.invert([],s);this.frustumCorners=i.FrustumCorners.fromInvProjectionMatrix(h,this.horizonLineFromTop(),this.height);let u=new Float32Array(16);i.identity(u),i.scale(u,u,[1,-1,1]),i.rotateX(u,u,this._pitch),i.rotateZ(u,u,this.angle);let c=i.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ),p=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;c[8]=-(2*r.x)/this.width,c[9]=2*(r.y+p)/this.height,this.skyboxMatrix=i.multiply(u,c,u);let d=this.point,f=d.x,m=d.y,_=this.width%2/2,g=this.height%2/2,y=Math.cos(this.angle),x=Math.sin(this.angle),v=f-Math.round(f)+y*_+x*g,b=m-Math.round(m)+y*g+x*_,T=new Float64Array(l);if(i.translate(T,T,[v>.5?v-1:v,b>.5?b-1:b,0]),this.alignedProjMatrix=T,l=i.create(),i.scale(l,l,[this.width/2,-this.height/2,1]),i.translate(l,l,[1,-1,0]),this.labelPlaneMatr
60ix=l,l=i.create(),i.scale(l,l,[1,-1,1]),i.translate(l,l,[-1,-1,0]),i.scale(l,l,[2/this.width,2/this.height,1]),this.glCoordMatrix=l,this.pixelMatrix=i.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},!(l=i.invert(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");if(this.pixelMatrixInverse=l,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=i.calculateGlobeMatrix(this);let r=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.transformMat4(r,r,o),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=l;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};let r=this.cameraWorldSize,n=this.cameraPixelsPerMeter,a=this._camera.position,o=1/this.height/this._pixelsPerMercatorPixel,s=[r,r,n];i.scale$2(s,s,o),i.scale$2(a,a,-1),i.multiply$2(a,a,s);let l=i.create();i.translate(l,l,a),i.scale(l,l,s),this.mercatorFogMatrix=l,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,n,o)}_computeCameraPosition(i){let r=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,n=this._camera.forward(),a=this.point,o=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*r-i/this.worldSize*this._centerAltitude;return[a.x/this.worldSize-n[0]*o,a.y/this.worldSize-n[1]*o,i/this.worldSize*this._centerAltitude-n[2]*o]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){let n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),a=r[2],o=1;a>0&&(o=Math.min((n-this._camera.position[2])/a,1)),this._camera.position=i.scaleAndAdd([],this._camera.position,r,o),this._updateStateFromCamera(),this.projection.wrap&&(this.center=this.center.wrap())}_updateStateFromCamera(){let r=this._camera.position,n=this._camera.forward(),{pitch:a,bearing:o}=this._camera.getPitchBearing(),s=i.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,l=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.degToRad(this._maxPitch)),h=Math.max((r[2]-s)/Math.cos(a),l),u=this._zoomFromMercatorZ(h);i.scaleAndAdd(r,r,n,h),this._pitch=i.clamp(a,i.degToRad(this.minPitch),i.degToRad(this.maxPitch)),this.angle=i.wrap(o,-Math.PI,Math.PI),this._setZoom(i.clamp(u,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.MercatorCoordinate(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){let i=Math.min((null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(i*this.tileSize))}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(r,n){let a=Math.min(r.x,n.x),o=Math.max(r.x,n.x),s=Math.min(r.y,n.y),l=Math.max(r.y,n.y);if(s<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;let h=[new i.pointGeometry(a,s),new i.pointGeometry(o,l),new i.pointGeometry(a,l),new i.pointGeometry(o,s)],u=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(let i of h){let r=this.pointRayIntersection(i);if(r.t<0)return!0;let n=this.rayIntersectionCoordinate(r);if(n.x<u||n.y<0||n.x>c||n.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.pointGeometry(0,0),new i.pointGeometry(this.width,this.height))}zoomDeltaToMovement(r,n){let a=i.length(i.sub([],this._camera.position,r)),o=this._zoomFromMercatorZ(a)+n;return a-this._mercatorZfromZoom(o)}getCameraPoint(){if("globe"===this.projection.name){let r=function(r,n){let a=[r[0],r[1],r[2],1];i.transformMat4$1(a,a,n);let o=Math.max(a[3],1e-6);return[a[0]/o,a[1]/o,a[2]/o,o]}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.pointGeometry(r[0],r[1])}{let r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,r))}}getCameraToCenterDistance(i){let r=iQ(i,this.zoom,this.width,this.height,1024),n=i.pixelSpaceConversion(this.center.lat,this.worldSize,r);return .5/Math.tan(.5*this._fov)*this.height*n}}function i5(i,r){let n=!1,a=null,o=()=>{a=null,n&&(i(),a=setTimeout(o,r),n=!1)};return()=>(n=!0,a||o(),a)}class i4{constructor(r){this._hashName=r&&encodeURIComponent(r),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=i5(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,i.window.addEventListener("hashchange",this._onHashChange,!1),r.on("moveend",this._updateHash),this}remove(){return this._map&&(this._map.off("moveend",this._updateHash),i.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0),this}getHashString(){let r=this._map;if(!r)return"";let n=i6(r);if(this._hashName){let r=this._hashName,a=!1,o=i.window.location.hash.slice(1).split("&").map(i=>{let o=i.split("=")[0];return o===r?(a=!0,`${o}=${n}`):i}).filter(i=>i);return a||o.push(`${r}=${n}`),`#${o.join("&")}`}return`#${n}`}_getCurrentHash(){let r=i.window.location.hash.replace("#","");if(this._hashName){let i;return r.split("&").map(i=>
60i.split("=")).forEach(r=>{r[0]===this._hashName&&(i=r)}),(i&&i[1]||"").split("/")}return r.split("/")}_onHashChange(){let i=this._map;if(!i)return!1;let r=this._getCurrentHash();if(r.length>=3&&!r.some(i=>isNaN(i))){let n=i.dragRotate.isEnabled()&&i.touchZoomRotate.isEnabled()?+(r[3]||0):i.getBearing();return i.jumpTo({center:[+r[2],+r[1]],zoom:+r[0],bearing:n,pitch:+(r[4]||0)}),!0}return!1}_updateHashUnthrottled(){let r=i.window.location.href.replace(/(#.+)?$/,this.getHashString());i.window.history.replaceState(i.window.history.state,null,r)}}function i6(i,r){let n=i.getCenter(),a=Math.round(100*i.getZoom())/100,o=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),s=Math.pow(10,o),l=Math.round(n.lng*s)/s,h=Math.round(n.lat*s)/s,u=i.getBearing(),c=i.getPitch(),p=r?`/${l}/${h}/${a}`:`${a}/${h}/${l}`;return(u||c)&&(p+="/"+Math.round(10*u)/10),c&&(p+=`/${Math.round(c)}`),p}let i8={linearity:.3,easing:i.bezier(0,0,.3,1)},i9=i.extend({deceleration:2500,maxSpeed:1400},i8),i7=i.extend({deceleration:20,maxSpeed:1400},i8),re=i.extend({deceleration:1e3,maxSpeed:360},i8),rt=i.extend({deceleration:1e3,maxSpeed:90},i8);class ri{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:r})}_drainInertiaBuffer(){let r=this._inertiaBuffer,n=i.exported.now();for(;r.length>0&&n-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let n={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(let{settings:i}of this._inertiaBuffer)n.zoom+=i.zoomDelta||0,n.bearing+=i.bearingDelta||0,n.pitch+=i.pitchDelta||0,i.panDelta&&n.pan._add(i.panDelta),i.around&&(n.around=i.around),i.pinchAround&&(n.pinchAround=i.pinchAround);let a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(n.pan.mag()){let s=rn(n.pan.mag(),a,i.extend({},i9,r||{}));o.offset=n.pan.mult(s.amount/n.pan.mag()),o.center=this._map.transform.center,rr(o,s)}if(n.zoom){let i=rn(n.zoom,a,i7);o.zoom=this._map.transform.zoom+i.amount,rr(o,i)}if(n.bearing){let r=rn(n.bearing,a,re);o.bearing=this._map.transform.bearing+i.clamp(r.amount,-179,179),rr(o,r)}if(n.pitch){let i=rn(n.pitch,a,rt);o.pitch=this._map.transform.pitch+i.amount,rr(o,i)}if(o.zoom||o.bearing){let i=void 0===n.pinchAround?n.around:n.pinchAround;o.around=i?this._map.unproject(i):this._map.getCenter()}return this.clear(),o.noMoveStart=!0,o}}function rr(i,r){(!i.duration||i.duration<r.duration)&&(i.duration=r.duration,i.easing=r.easing)}function rn(r,n,a){let{maxSpeed:o,linearity:s,deceleration:l}=a,h=i.clamp(r*s/(n/1e3),-o,o),u=Math.abs(h)/(l*s);return{easing:a.easing,duration:1e3*u,amount:h*(u/2)}}class ra extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,n,a,o={}){let s=y(n.getCanvasContainer(),a),l=n.unproject(s);super(r,i.extend({point:s,lngLat:l,originalEvent:a},o)),this._defaultPrevented=!1,this.target=n}}class ro extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,n,a){let o="touchend"===r?a.changedTouches:a.touches,s=x(n.getCanvasContainer(),o),l=s.map(i=>n.unproject(i)),h=s.reduce((i,r,n,a)=>i.add(r.div(a.length)),new i.pointGeometry(0,0));super(r,{points:s,point:h,lngLats:l,lngLat:n.unproject(h),originalEvent:a}),this._defaultPrevented=!1}}class rs extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,n){super(i,{originalEvent:n}),this._defaultPrevented=!1}}class rl{constructor(i,r){this._map=i,this._clickTolerance=r.clickTolerance}reset(){this._mousedownPos=void 0}wheel(i){return this._firePreventable(new rs(i.type,this._map,i))}mousedown(i,r){return this._mousedownPos=r,this._firePreventable(new ra(i.type,this._map,i))}mouseup(i){this._map.fire(new ra(i.type,this._map,i))}preclick(r){let n=i.extend({},r);n.type="preclick",this._map.fire(new ra(n.type,this._map,n))}click(i,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(i),this._map.fire(new ra(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new ra(i.type,this._map,i))}mouseover(i){this._map.fire(new ra(i.type,this._map,i))}mouseout(i){this._map.fire(new ra(i.type,this._map,i))}touchstart(i){return this._firePreventable(new ro(i.type,this._map,i))}touchmove(i){this._map.fire(new ro(i.type,this._map,i))}touchend(i){this._map.fire(new ro(i.type,this._map,i))}touchcancel(i){this._map.fire(new ro(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rh{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(i){this._map.fire(new ra(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ra("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new ra(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ru{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,r){this.isEnabled()&&i.shiftKey&&0===i.button&&(f(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(i,r){if(!this._active||this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;let n=this._startPos;this._lastPos=r,this._box||(this._box=u("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",i));let a=Math.min(n.x,r.x),o=Math.max(n.x,r.x),s=Math.min(n.y,r.y),l=Math.max(n.y,r.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${a}px,${s}px)`,this._box.style.width=o-a+"px",this._box.style.height=l-s+"px")})}mouseupWindow(r,n){if(!this._active||0!==r.button)return;let a=this._startPos;if(this.reset(),g(),a.x!==n.x||a.y!==n.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:r})),{cameraAnimation:i=>i.fitScreenCoordinates(a,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}keydown(i){this._active&&27===i.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",i))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),m(),delete this._startPos,delete this._lastPos}_fireEvent(r,n){return this._map.fire(new i.Event(r,{originalEvent:n}))}}function rc(i,r){let n={};for(let a=0;a<i.length;a++)n[i[a].identifier]=r[a];return n}class rp{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(r,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=r.timeStamp),a.length===this.numTouches&&(this.centroid=function(r){let n=new i.pointGeometry(0,0);for(let i of r)n._add(i);return n.div(r.length)}
60(n),this.touches=rc(a,n)))}touchmove(i,r,n){if(this.aborted||!this.centroid)return;let a=rc(n,r);for(let i in this.touches){let r=this.touches[i],n=a[i];(!n||n.dist(r)>30)&&(this.aborted=!0)}}touchend(i,r,n){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}}class rd{constructor(i){this.singleTap=new rp(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(i,r,n){this.singleTap.touchstart(i,r,n)}touchmove(i,r,n){this.singleTap.touchmove(i,r,n)}touchend(i,r,n){let a=this.singleTap.touchend(i,r,n);if(a){let r=i.timeStamp-this.lastTime<500,n=!this.lastTap||30>this.lastTap.dist(a);if(r&&n||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class rf{constructor(){this._zoomIn=new rd({numTouches:1,numTaps:2}),this._zoomOut=new rd({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,r,n){this._zoomIn.touchstart(i,r,n),this._zoomOut.touchstart(i,r,n)}touchmove(i,r,n){this._zoomIn.touchmove(i,r,n),this._zoomOut.touchmove(i,r,n)}touchend(i,r,n){let a=this._zoomIn.touchend(i,r,n),o=this._zoomOut.touchend(i,r,n);return a?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()+1,around:r.unproject(a)},{originalEvent:i})}):o?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()-1,around:r.unproject(o)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let rm={0:1,2:2};class r_{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(i,r){return!1}_move(i,r){return{}}mousedown(i,r){if(this._lastPoint)return;let n=v(i);this._correctButton(i,n)&&(this._lastPoint=r,this._eventButton=n)}mousemoveWindow(i,r){let n=this._lastPoint;if(n){if(i.preventDefault(),null!=this._eventButton&&function(i,r){let n=rm[r];return void 0===i.buttons||(i.buttons&n)!==n}(i,this._eventButton))this.reset();else if(this._moved||!(r.dist(n)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(n,r)}}mouseupWindow(i){this._lastPoint&&v(i)===this._eventButton&&(this._moved&&g(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rg extends r_{mousedown(i,r){super.mousedown(i,r),this._lastPoint&&(this._active=!0)}_correctButton(i,r){return 0===r&&!i.ctrlKey}_move(i,r){return{around:r,panDelta:r.sub(i)}}}class ry extends r_{_correctButton(i,r){return 0===r&&i.ctrlKey||2===r}_move(i,r){let n=.8*(r.x-i.x);if(n)return this._active=!0,{bearingDelta:n}}contextmenu(i){i.preventDefault()}}class rx extends r_{_correctButton(i,r){return 0===r&&i.ctrlKey||2===r}_move(i,r){let n=-.5*(r.y-i.y);if(n)return this._active=!0,{pitchDelta:n}}contextmenu(i){i.preventDefault()}}class rv{constructor(r,n){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=n.clickTolerance||1,this.reset(),i.bindAll(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new i.pointGeometry(0,0)}touchstart(i,r,n){return this._calculateTransform(i,r,n)}touchmove(r,n,a){if(this._active&&!(a.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===a.length&&!i.isFullscreen())return void this._showTouchPanBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return r.cancelable&&r.preventDefault(),this._calculateTransform(r,n,a)}}touchend(i,r,n){this._calculateTransform(i,r,n),this._active&&n.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,n,a){a.length>0&&(this._active=!0);let o=rc(a,n),s=new i.pointGeometry(0,0),l=new i.pointGeometry(0,0),h=0;for(let i in o){let r=o[i],n=this._touches[i];n&&(s._add(r),l._add(r.sub(n)),h++,o[i]=r)}if(this._touches=o,h<this._minTouches||!l.mag())return;let u=l.div(h);return this._sum._add(u),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(h),panDelta:u}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=u("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")},500)}}class rb{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(i){}_move(i,r,n){return{}}touchstart(i,r,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([r[0],r[1]]))}touchmove(i,r,n){let a=this._firstTwoTouches;if(!a)return;i.preventDefault();let[o,s]=a,l=rw(n,r,o),h=rw(n,r,s);if(!l||!h)return;let u=this._aroundCenter?null:l.add(h).div(2);return this._move([l,h],u,i)}touchend(i,r,n){if(!this._firstTwoTouches)return;let[a,o]=this._firstTwoTouches,s=rw(n,r,a),l=rw(n,r,o);s&&l||(this._active&&g(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function rw(i,r,n){for(let a=0;a<i.length;a++)if(i[a].identifier===n)return r[a]}function rT(i,r){return Math.log(i/r)/Math.LN2}class rE extends rb{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,r){let n=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(.1>Math.abs(rT(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:rT(this._distance,n),pinchAround:r}}}function rS(i,r){return 180*i.angleWith(r)/Math.PI}class rI extends rb{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,r){let n=this._vector;if(this._vector=i[0].sub(i[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:rS(this._vector,n),pinchAround:r}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());let r=25/(Math.PI*this._minDiameter)*360,n=rS(i,this._startVector);return Math.abs(n)<r}}function rA(i){return Math.abs(i.y)>Math.abs(i.x)}class rM extends rb{constructor(i){super(),this._map=i}
60reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(i){this._lastPoints=i,rA(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,r,n){let a=this._lastPoints;if(!a)return;let o=i[0].sub(a[0]),s=i[1].sub(a[1]);return this._map._cooperativeGestures&&n.touches.length<3||(this._valid=this.gestureBeginsVertically(o,s,n.timeStamp),!this._valid)?void 0:(this._lastPoints=i,this._active=!0,{pitchDelta:-((o.y+s.y)/2*.5)})}gestureBeginsVertically(i,r,n){if(void 0!==this._valid)return this._valid;let a=i.mag()>=2,o=r.mag()>=2;if(!a&&!o)return;if(!a||!o)return null==this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;let s=i.y>0==r.y>0;return rA(i)&&rA(r)&&s}}let rC={panStep:100,bearingStep:15,pitchStep:10};class rz{constructor(){this._panStep=rC.panStep,this._bearingStep=rC.bearingStep,this._pitchStep=rC.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let r=0,n=0,a=0,o=0,s=0;switch(i.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:i.shiftKey?n=-1:(i.preventDefault(),o=-1);break;case 39:i.shiftKey?n=1:(i.preventDefault(),o=1);break;case 38:i.shiftKey?a=1:(i.preventDefault(),s=-1);break;case 40:i.shiftKey?a=-1:(i.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(n=0,a=0),{cameraAnimation:l=>{let h=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:rP,zoom:r?Math.round(h)+r*(i.shiftKey?2:1):h,bearing:l.getBearing()+n*this._bearingStep,pitch:l.getPitch()+a*this._pitchStep,offset:[-o*this._panStep,-s*this._panStep],center:l.getCenter()},{originalEvent:i})}}}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 rP(i){return i*(2-i)}class rk{constructor(r,n){this._map=r,this._el=r.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||i.isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=r.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY,a=i.exported.now(),o=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,0!==n&&n%4.000244140625==0?this._type="wheel":0!==n&&4>Math.abs(n)?this._type="trackpad":o>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=200>Math.abs(o*n)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),r.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=r,this._delta-=n,this._active||this._start(r)),r.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let r=y(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:r,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRe
60nderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let r=this._map.transform,n=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(0!==this._delta){let i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==a&&(a=1/a);let o=n(),s=Math.pow(2,o),l="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(l*a))),"wheel"===this._type&&(this._startZoom=o,this._easing=this._smoothOutEasing(200)),this._delta=0}let a="number"==typeof this._targetZoom?this._targetZoom:n(),o=this._startZoom,s=this._easing,l,h=!1;if("wheel"===this._type&&o&&s){let r=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),n=s(r);l=i.number(o,a,n),r<1?this._frameId||(this._frameId=!0):h=!0}else l=a,h=!0;return this._active=!0,h&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!h,zoomDelta:l-n(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let n=i.ease;if(this._prevEase){let r=this._prevEase,a=(i.exported.now()-r.start)/r.duration,o=r.easing(a+.01)-r.easing(a),s=.27/Math.sqrt(o*o+1e-4)*.01,l=Math.sqrt(.0729-s*s);n=i.bezier(s,l,.25,1)}return this._prevEase={start:i.exported.now(),duration:r,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=u("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(i.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")},200)}}class rD{constructor(i,r){this._clickZoom=i,this._tapZoom=r}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 rL{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,r){return i.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:n.getZoom()+(i.shiftKey?-1:1),around:n.unproject(r)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rB{constructor(){this._tap=new rd({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(i,r,n){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=r[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(i,r,n))}touchmove(i,r,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;let a=r[0],o=a.y-this._swipePoint.y;return this._swipePoint=a,i.preventDefault(),this._active=!0,{zoomDelta:o/128}}}else this._tap.touchmove(i,r,n)}touchend(i,r,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(i,r,n)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rR{constructor(i,r,n){this._el=i,this._mousePan=r,this._touchPan=n}
60enable(i){this._inertiaOptions=i||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class rF{constructor(i,r,n){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=r,this._mousePitch=n}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 rO{constructor(i,r,n,a){this._el=i,this._touchZoom=r,this._touchRotate=n,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("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()}}let rU=i=>i.zoom||i.drag||i.pitch||i.rotate;class rV extends i.Event{}class rj{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,n){let a=i.sub([],n,r);this.radius=i.length(a[2]<0?i.div([],a,this.constants):[a[0],a[1],0])}projectRay(r){i.div(r,r,this.constants),i.normalize(r,r),i.mul$1(r,r,this.constants);let n=i.scale$2([],r,this.radius);if(n[2]>0){let r=i.scale$2([],[0,0,1],i.dot(n,[0,0,1])),a=i.scale$2([],i.normalize([],[n[0],n[1],0]),this.radius),o=i.add([],n,i.scale$2([],i.sub([],i.add([],a,r),n),2));n[0]=o[0],n[1]=o[1]}return n}}function rN(i){return i.panDelta&&i.panDelta.mag()||i.zoomDelta||i.bearingDelta||i.pitchDelta}class rG{constructor(r,n){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ri(r),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new rj,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),i.bindAll(["handleEvent","handleWindowEvent"],this);let a=this._el;for(let[r,n,o]of(this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0}],[i.window.document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[i.window,"blur",void 0]],this._listeners))r.addEventListener(n,r===i.window.document?this.handleWindowEvent:this.handleEvent,o)}destroy(){for(let[r,n,a]of this._listeners)r.removeEventListener(n,r===i.window.document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(i){let r=this._map,n=r.getCanvasContainer();this._add("mapEvent",new rl(r,i));let a=r.boxZoom=new ru(r,i);this._add("boxZoom",a);let o=new rf,s=new rL;r.doubleClickZoom=new rD(s,o),this._add("tapZoom",o),this._add("clickZoom",s);let l=new rB;this._add("tapDragZoom",l);let h=r.touchPitch=new rM(r);this._add("touchPitch",h);let u=new ry(i),c=new rx(i);r.dragRotate=new rF(i,u,c),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);let p=new rg(i),d=new rv(r,i);r.dragPan=new rR(n,p,d),this._add("mousePan",p),this._add("touchPan",d,["touchZoom","touchRotate"]);let f=new rI,m=new rE;r.touchZoomRotate=new rO(n,m,f,l),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new rh(r));let _=r.scrollZoom=new rk(r,this);this._add("scrollZoom",_,["mousePan"]);let g=r.keyboard=new rz;for(let n of(this._add("keyboard",g),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))i.interactive&&i[n]&&r[n].enable(i[n])}_add(i,r,n){this._handlers.push({handlerName:i,handler:r,allowed:n}),this._handlersById[i]=r}stop(i){if(!this._updatingCamera){for(let{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(let{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!rU(this._eventsInProgress)||this.isZooming()}_blockedByActive(i,r,n){for(let a in i)if(a!==n&&(!r||0>r.indexOf(a)))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){let r=[];for(let n of i)this._el.contains(n.target)&&r.push(n);return r}handleEvent(i,r){this._updatingCamera=!0;let n="renderFrame"===i.type,a=n?void 0:i,o={needsRenderFrame:!1},s={},l={},h=i.touches?this._getMapTouches(i.touches):void 0,u=h?x(this._el,h):n?void 0:y(this._el,i);for(let{handlerName:n,handler:c,allowed:p}of this._handlers){let d;c.isEnabled()&&(this._blockedByActive(l,p,n)?c.reset():c[r||i.type]&&(d=c[r||i.type](i,u,h),this.mergeHandlerResult(o,s,d,n,a),d&&d.needsRenderFrame&&this._triggerRe
60nderFrame()),(d||c.isActive())&&(l[n]=c))}let c={};for(let i in this._previousActiveHandlers)l[i]||(c[i]=a);this._previousActiveHandlers=l,(Object.keys(c).length||rN(o))&&(this._changes.push([o,s,c]),this._triggerRenderFrame()),(Object.keys(l).length||rN(o))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:p}=o;p&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],p(this._map))}mergeHandlerResult(r,n,a,o,s){if(!a)return;i.extend(r,a);let l={handlerName:o,originalEvent:a.originalEvent||s};void 0!==a.zoomDelta&&(n.zoom=l),void 0!==a.panDelta&&(n.drag=l),void 0!==a.pitchDelta&&(n.pitch=l),void 0!==a.bearingDelta&&(n.rotate=l)}_applyChanges(){let r={},n={},a={};for(let[o,s,l]of this._changes)o.panDelta&&(r.panDelta=(r.panDelta||new i.pointGeometry(0,0))._add(o.panDelta)),o.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+o.pitchDelta),void 0!==o.around&&(r.around=o.around),void 0!==o.aroundCoord&&(r.aroundCoord=o.aroundCoord),void 0!==o.pinchAround&&(r.pinchAround=o.pinchAround),o.noInertia&&(r.noInertia=o.noInertia),i.extend(n,s),i.extend(a,l);this._updateMapTransform(r,n,a),this._changes=[]}_updateMapTransform(r,n,a){let o=this._map,s=o.transform,l=i=>[i.x,i.y,i.z];if((i=>{let r=this._eventsInProgress.drag;return r&&!this._handlersById[r.handlerName].isActive()})()&&!rN(r)){let i=s.zoom;s.cameraElevationReference="sea",s.recenterOnTerrain(),s.cameraElevationReference="ground",i!==s.zoom&&this._map._update(!0)}if(!rN(r))return void this._fireEvents(n,a,!0);let{panDelta:h,zoomDelta:u,bearingDelta:c,pitchDelta:p,around:d,aroundCoord:f,pinchAround:m}=r;void 0!==m&&(d=m),n.drag&&!this._eventsInProgress.drag&&d&&(this._dragOrigin=l(s.pointCoordinate3D(d)),this._trackingEllipsoid.setup(s._camera.position,this._dragOrigin)),s.cameraElevationReference="sea",o._stop(!0),d=d||o.transform.centerPoint,c&&(s.bearing+=c),p&&(s.pitch+=p),s._updateCameraState();let _=[0,0,0];if(h){if("mercator"===s.projection.name){let i=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(d).dir),r=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(d.sub(h)).dir);_[0]=r[0]-i[0],_[1]=r[1]-i[1]}else{let r=s.pointCoordinate(d);if("globe"===s.projection.name){h=h.rotate(-s.angle);let n=s._pixelsPerMercatorPixel/s.worldSize;_[0]=-h.x*i.mercatorScale(i.latFromMercatorY(r.y))*n,_[1]=-h.y*i.mercatorScale(s.center.lat)*n}else{let i=s.pointCoordinate(d.sub(h));r&&i&&(_[0]=i.x-r.x,_[1]=i.y-r.y)}}}let g=s.zoom,y=[0,0,0];if(u){let r=l(f||s.pointCoordinate3D(d)),n={dir:i.normalize([],i.sub([],r,s._camera.position))};if(n.dir[2]<0){let a=s.zoomDeltaToMovement(r,u);i.scale$2(y,n.dir,a)}}let x=i.add(_,_,y);s._translateCameraConstrained(x),u&&Math.abs(s.zoom-g)>1e-4&&s.recenterOnTerrain(),s.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(n,a,!0)}_fireEvents(r,n,a){let o;let s=rU(this._eventsInProgress),l=rU(r),h={};for(let i in r){let{originalEvent:n}=r[i];this._eventsInProgress[i]||(h[`${i}start`]=n),this._eventsInProgress[i]=r[i]}for(let i in!s&&l&&this._fireEvent("movestart",l.originalEvent),h)this._fireEvent(i,h[i]);for(let i in l&&this._fireEvent("move",l.originalEvent),r){let{originalEvent:n}=r[i];this._fireEvent(i,n)}let u={};for(let i in this._eventsInProgress){let{handlerName:r,originalEvent:a}=this._eventsInProgress[i];this._handlersById[r].isActive()||(delete this._eventsInProgress[i],o=n[r]||a,u[`${i}end`]=o)}for(let i in u)this._fireEvent(i,u[i]);let c=rU(this._eventsInProgress);if(a&&(s||l)&&!c){var p,d;this._updatingCamera=!0;let r=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);r?(0!==(p=r.bearing||this._map.getBearing())&&-this._bearingSnap<p&&p<this._bearingSnap&&(r.bearing=0),this._map.easeTo(r,{originalEvent:o})):(this._map.fire(new i.Event("moveend",{originalEvent:o})),0!==(d=this._map.getBearing())&&-this._bearingSnap<d&&d<this._bearingSnap&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,n){this._map.fire(new i.Event(r,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{this._frameId=void 0,this.handleEvent(new rV("renderFrame",{timeStamp:i})),this._applyChanges()})}
60_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}let rZ="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class r$ extends i.Evented{constructor(r,n){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}getCenter(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(i,r){return this.jumpTo({center:i},r)}panBy(r,n,a){return r=i.pointGeometry.convert(r).mult(-1),this.panTo(this.transform.center,i.extend({offset:r},n),a)}panTo(r,n,a){return this.easeTo(i.extend({center:r},n),a)}getZoom(){return this.transform.zoom}setZoom(i,r){return this.jumpTo({zoom:i},r),this}zoomTo(r,n,a){return this.easeTo(i.extend({zoom:r},n),a)}zoomIn(i,r){return this.zoomTo(this.getZoom()+1,i,r),this}zoomOut(i,r){return this.zoomTo(this.getZoom()-1,i,r),this}getBearing(){return this.transform.bearing}setBearing(i,r){return this.jumpTo({bearing:i},r),this}getPadding(){return this.transform.padding}setPadding(i,r){return this.jumpTo({padding:i},r),this}rotateTo(r,n,a){return this.easeTo(i.extend({bearing:r},n),a)}resetNorth(r,n){return this.rotateTo(0,i.extend({duration:1e3},r),n),this}resetNorthPitch(r,n){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},r),n),this}snapToNorth(i,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,r):this}getPitch(){return this.transform.pitch}setPitch(i,r){return this.jumpTo({pitch:i},r),this}cameraForBounds(r,n){"globe"===this.transform.projection.name&&i.warnOnce('Globe projection does not support cameraForBounds API, this API may behave unexpectedly."'),r=i.LngLatBounds.convert(r);let a=n&&n.bearing||0;return this._cameraForBoxAndBearing(r.getNorthWest(),r.getSouthEast(),a,n)}_extendCameraOptions(r){let n={top:0,bottom:0,right:0,left:0};if("number"==typeof(r=i.extend({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){let i=r.padding;r.padding={top:i,bottom:i,right:i,left:i}}return r.padding=i.extend(n,r.padding),r}_cameraForBoxAndBearing(r,n,a,o){let s=this._extendCameraOptions(o),l=this.transform,h=l.padding,u=l.project(i.LngLat.convert(r)),c=l.project(i.LngLat.convert(n)),p=new i.pointGeometry(u.x,c.y),d=new i.pointGeometry(c.x,u.y),f=-i.degToRad(a),m=u.rotate(f),_=c.rotate(f),g=p.rotate(f),y=d.rotate(f),x=new i.pointGeometry(Math.max(m.x,_.x,g.x,y.x),Math.max(m.y,_.y,g.y,y.y)),v=new i.pointGeometry(Math.min(m.x,_.x,g.x,y.x),Math.min(m.y,_.y,g.y,y.y)),b=x.sub(v),w=(l.width-((h.left||0)+(h.right||0)+s.padding.left+s.padding.right))/b.x,T=(l.height-((h.top||0)+(h.bottom||0)+s.padding.top+s.padding.bottom))/b.y;if(T<0||w<0)return void i.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let E=Math.min(l.scaleZoom(l.scale*Math.min(w,T)),s.maxZoom),S="number"==typeof s.offset.x&&"number"==typeof s.offset.y?new i.pointGeometry(s.offset.x,s.offset.y):i.pointGeometry.convert(s.offset),I=new i.pointGeometry((s.padding.left-s.padding.right)/2,(s.padding.top-s.padding.bottom)/2).rotate(a*Math.PI/180),A=S.add(I).mult(l.scale/l.zoomScale(E));return{center:l.unproject(u.add(c).div(2).sub(A)),zoom:E,bearing:a}}_cameraForBox(r,n,a,o,s){var l;let h=this._extendCameraOptions(s);a=a||0,o=o||0,r=i.LngLat.convert(r),n=i.LngLat.convert(n);let u=this.transform.clone();u.padding=h.padding;let c=this.getFreeCameraOptions(),p=new i.LngLat(.5*(r.lng+n.lng),.5*(r.lat+n.lat)),d=.5*(a+o);if(u._camera.position[2]<i.mercatorZfromAltitude(d,p.lat))return void i.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");c.lookAtPoint(p),u.setFreeCameraOptions(c);let f=i.MercatorCoordinate.fromLngLat(r),m=i.MercatorCoordinate.fromLngLat(n),_=u.pointRayIntersection(u.centerPoint,d),g=[(l=u.rayIntersectionCoordinate(_)).x,l.y,l.z],y=u.screenPointToMercatorRay(u.centerPoint),x="globe"!==u.projection.name,v,b=0;do{let r=Math.floor(u.zoom),n=1<<r,s=Math.min(n*f.x,n*m.x),l=Math.min(n*f.y,n*m.y),h=Math.max(n*f.x,n*m.x),c=Math.max(n*f.y,n*m.y),p=new i.Aabb([s,l,a],[h,c,o]),d=i.Frustum.fromInvProjectionMatrix(u.invProjMatrix,u.worldSize,r,x);if(2!==p.intersects(d)){v&&(u._camera.position=i.scaleAndAdd([],u._camera.position,y.dir,-v),u._updateStateFromCamera());break}let _=i.sub([],u._camera.position,g);v=.5*i.length(_),u._camera.position=i.scaleAndAdd([],u._camera.position,y.dir,v);try{u._updateStateFromCamera()}catch(r){return void i.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}}while(++b<10);return{center:u.center,zoom:u.zoom,bearing:u.bearing,pitch:u.pitch}}fitBounds(r,n,a){return"globe"===this.transform.projection.name&&i.warnOnce("Globe projection does not support fitBounds API, this API may behave unex
60pectedly."),this._fitInternal(this.cameraForBounds(r,n),n,a)}_raycastElevationBox(r,n){let a=this.transform.elevation;if(!a)return;let o=new i.pointGeometry(r.x,n.y),s=new i.pointGeometry(n.x,r.y),l=a.pointCoordinate(r);if(!l)return;let h=a.pointCoordinate(n);if(!h)return;let u=a.pointCoordinate(o);if(!u)return;let c=a.pointCoordinate(s);if(!c)return;let p=new i.MercatorCoordinate(l[0],l[1]).toLngLat(),d=new i.MercatorCoordinate(h[0],h[1]).toLngLat(),f=new i.MercatorCoordinate(u[0],u[1]).toLngLat(),m=new i.MercatorCoordinate(c[0],c[1]).toLngLat(),_=Math.min(p.lng,Math.min(d.lng,Math.min(f.lng,m.lng))),g=Math.min(p.lat,Math.min(d.lat,Math.min(f.lat,m.lat))),y=Math.max(p.lng,Math.max(d.lng,Math.max(f.lng,m.lng))),x=Math.max(p.lat,Math.max(d.lat,Math.max(f.lat,m.lat))),v=Math.min(l[3],Math.min(h[3],Math.min(u[3],c[3]))),b=Math.max(l[3],Math.max(h[3],Math.max(u[3],c[3])));return{minLngLat:new i.LngLat(_,g),maxLngLat:new i.LngLat(y,x),minAltitude:v,maxAltitude:b}}fitScreenCoordinates(r,n,a,o,s){let l,h,u,c;"globe"===this.transform.projection.name&&i.warnOnce("Globe projection does not support fitScreenCoordinates API, this API may behave unexpectedly.");let p=i.pointGeometry.convert(r),d=i.pointGeometry.convert(n),f=this._raycastElevationBox(p,d);if(f)l=f.minLngLat,h=f.maxLngLat,u=f.minAltitude,c=f.maxAltitude;else{if(this.transform.anyCornerOffEdge(p,d))return this;l=this.transform.pointLocation(p),h=this.transform.pointLocation(d)}return this._fitInternal(0===this.transform.pitch?this._cameraForBoxAndBearing(this.transform.pointLocation(i.pointGeometry.convert(r)),this.transform.pointLocation(i.pointGeometry.convert(n)),a,o):this._cameraForBox(l,h,u,c,o),o,s)}_fitInternal(r,n,a){return r?(delete(n=i.extend(r,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(r,n){this.stop();let a=r.preloadOnly?this.transform.clone():this.transform,o=!1,s=!1,l=!1;return"zoom"in r&&a.zoom!==+r.zoom&&(o=!0,a.zoom=+r.zoom),void 0!==r.center&&(a.center=i.LngLat.convert(r.center)),"bearing"in r&&a.bearing!==+r.bearing&&(s=!0,a.bearing=+r.bearing),"pitch"in r&&a.pitch!==+r.pitch&&(l=!0,a.pitch=+r.pitch),null==r.padding||a.isPaddingEqual(r.padding)||(a.padding=r.padding),r.preloadOnly?(this._preloadTiles(a),this):(this.fire(new i.Event("movestart",n)).fire(new i.Event("move",n)),o&&this.fire(new i.Event("zoomstart",n)).fire(new i.Event("zoom",n)).fire(new i.Event("zoomend",n)),s&&this.fire(new i.Event("rotatestart",n)).fire(new i.Event("rotate",n)).fire(new i.Event("rotateend",n)),l&&this.fire(new i.Event("pitchstart",n)).fire(new i.Event("pitch",n)).fire(new i.Event("pitchend",n)),this.fire(new i.Event("moveend",n)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.warnOnce(rZ),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,n){let a=this.transform;if(!a.projection.supportsFreeCamera)return i.warnOnce(rZ),this;this.stop();let o=a.zoom,s=a.pitch,l=a.bearing;a.setFreeCameraOptions(r);let h=o!==a.zoom,u=s!==a.pitch,c=l!==a.bearing;return this.fire(new i.Event("movestart",n)).fire(new i.Event("move",n)),h&&this.fire(new i.Event("zoomstart",n)).fire(new i.Event("zoom",n)).fire(new i.Event("zoomend",n)),c&&this.fire(new i.Event("rotatestart",n)).fire(new i.Event("rotate",n)).fire(new i.Event("rotateend",n)),u&&this.fire(new i.Event("pitchstart",n)).fire(new i.Event("pitch",n)).fire(new i.Event("pitchend",n)),this.fire(new i.Event("moveend",n)),this}easeTo(r,n){let a,o,s,l,h;this._stop(!1,r.easeId),(!1===(r=i.extend({offset:[0,0],duration:500,easing:i.ease},r)).animate||!r.essential&&i.exported.prefersReducedMotion)&&(r.duration=0);let u=this.transform,c=this.getZoom(),p=this.getBearing(),d=this.getPitch(),f=this.getPadding(),m="zoom"in r?+r.zoom:c,_="bearing"in r?this._normalizeBearing(r.bearing,p):p,g="pitch"in r?+r.pitch:d,y="padding"in r?r.padding:u.padding,x=i.pointGeometry.convert(r.offset);if("globe"===u.projection.name){let n=i.MercatorCoordinate.fromLngLat(u.center),l=x.rotate(-u.angle);n.x+=l.x/u.worldSize,n.y+=l.y/u.worldSize;let h=n.toLngLat(),c=i.LngLat.convert(r.center||h);this._normalizeCenter(c),a=u.centerPoint.add(l),o=new i.pointGeometry(n.x,n.y).mult(u.worldSize),s=new i.pointGeometry(i.mercatorXfromLng(c.lng),i.mercatorYfromLat(c.lat)).mult(u.worldSize).sub(o)}else{a=u.centerPoint.add(x);let n=u.pointLocation(a),l=i.LngLat.convert(r.center||n);this._normalizeCenter(l),o=u.project(n),s=u.project(l).sub(o)}let v=u.zoomScale(m-c);r.around&&(l=i.LngLat.convert(r.around),h=u.locationPoint(l));let b=this._zooming||m!==c,w=this._rotating||p!==_,T=this._pitching||g!==d,E=!u.isPaddingEqual(y),S=u=>S=>{if(b&&(u.zoom=i.number(c,m,S)),w&&(u.bearing=i.number(p,_,S)),T&&(u.pitch=i.number(d,g,S)),E&&(u.interpolatePadding(f,y,S),a=u.centerPoint.add(x)),l)u.setLocationAtPoint(l,h);else{let i=u.zoomScale(u.zoom-c),r=m>c?Math.min(2,v):Math.max(.5,v),n=Math.pow(r,1-S),l=u.unproject(o.add(s.mult(S*n)).mult(i));u.setLocationAtPoint(u.renderWorldCopies?l.wrap():l,a)}return r.preloadOnly||this._fireMoveEvents(n),u};if(r.preloadOnly){let i=this._emulate(S,r.duration,u);return this._preloadTiles(i),this}let I={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=b,this._rotating=w,this._pitching=T,this._padding=E,this._easeId=r.easeId,this._prepareEase(n,r.noMoveStart,I),this._ease(S(u),i=>{u.recenterOnTerrain(),this._afterEase(n,i)},r),this}_prepareEase(r,n,a={}){this._moving=!0,this.transform.cameraElevationReference="sea",n||a.moving||this.fire(new i.Event("movestart",r)),this._zooming&&!a.zooming&&this.fire(new i.Event("zoomstart",r)),this._rotating&&!a.rotating&&this.fire(new i.Event("rotatestart",r)),this._pitching&&!a.pitching&&this.fire(new i.Event("pitchstart",r))}_fireMoveEvents(r){this.fire(new i.Event("move",r)),this._zooming&&this.fire(new i.Event("zoom",r)),this._rotating&&this.fire(new i.Event("rotate",r)),this._pitching&&this.fire(new i.Event("pitch",r))}_afterEase(r,n){if(this._easeId&&n&&this._easeId===n)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";let a=this._zooming,o=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new i.Event("zoomend",r)),o&&this.fire(new i.Event("rotateend",r)),s&&this.fire(new i.Event("pitchend",r)),this.fire(new i.Event("moveend",r))}flyTo(r,n){if(!r.essential&&i.exported.prefersReducedMotion){let a=i.pick(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(a,n)}this.stop(),r=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},r);let a=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),h=this.getPadding(),u="zoom"in r?i.clamp(+r.zoom,a.minZoom,a.maxZoom):o,c="bearing"in r?this._normalizeBearing(r.bearing,s):s,p="pitch"in r?+r.pitch:l,d="padding"in r?r.padding:a.padding,f
60=a.zoomScale(u-o),m=i.pointGeometry.convert(r.offset),_=a.centerPoint.add(m),g=a.pointLocation(_),y=i.LngLat.convert(r.center||g);this._normalizeCenter(y);let x=a.project(g),v=a.project(y).sub(x),b=r.curve,w=Math.max(a.width,a.height),T=w/f,E=v.mag();if("minZoom"in r){let n=i.clamp(Math.min(r.minZoom,o,u),a.minZoom,a.maxZoom),s=w/a.zoomScale(n-o);b=Math.sqrt(s/E*2)}let S=b*b;function I(i){let r=(T*T-w*w+(i?-1:1)*S*S*E*E)/(2*(i?T:w)*S*E);return Math.log(Math.sqrt(r*r+1)-r)}function A(i){return(Math.exp(i)-Math.exp(-i))/2}function M(i){return(Math.exp(i)+Math.exp(-i))/2}let C=I(0),z=function(i){return M(C)/M(C+b*i)},P=function(i){var r;return w*((M(C)*(A(r=C+b*i)/M(r))-A(C))/S)/E},k=(I(1)-C)/b;if(1e-6>Math.abs(E)||!isFinite(k)){if(1e-6>Math.abs(w-T))return this.easeTo(r,n);let i=T<w?-1:1;k=Math.abs(Math.log(T/w))/b,P=function(){return 0},z=function(r){return Math.exp(i*b*r)}}r.duration="duration"in r?+r.duration:1e3*k/("screenSpeed"in r?+r.screenSpeed/b:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);let D=s!==c,L=p!==l,B=!a.isPaddingEqual(d),R=a=>f=>{let g=f*k,b=1/z(g);a.zoom=1===f?u:o+a.scaleZoom(b),D&&(a.bearing=i.number(s,c,f)),L&&(a.pitch=i.number(l,p,f)),B&&(a.interpolatePadding(h,d,f),_=a.centerPoint.add(m));let w=1===f?y:a.unproject(x.add(v.mult(P(g))).mult(b));return a.setLocationAtPoint(a.renderWorldCopies?w.wrap():w,_),a._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(n),a};if(r.preloadOnly){let i=this._emulate(R,r.duration,a);return this._preloadTiles(i),this}return this._zooming=!0,this._rotating=D,this._pitching=L,this._padding=B,this._prepareEase(n,!1),this._ease(R(a),()=>this._afterEase(n),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){let i=this._onEaseEnd;this._onEaseEnd=void 0,i.call(this,r)}if(!i){let i=this.handlers;i&&i.stop(!1)}return this}_ease(r,n,a){!1===a.animate||0===a.duration?(r(1),n()):(this._easeStart=i.exported.now(),this._easeOptions=a,this._onEaseFrame=r,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let r=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1),n=this._onEaseFrame;n&&n(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,n){r=i.wrap(r,-180,180);let a=Math.abs(r-n);return Math.abs(r-360-n)<a&&(r-=360),Math.abs(r+360-n)<a&&(r+=360),r}_normalizeCenter(i){let r=this.transform;if(!r.renderWorldCopies||r.maxBounds)return;let n=i.lng-r.center.lng;i.lng+=n>180?-360:n<-180?360:0}_emulate(i,r,n){let a=Math.ceil(15*r/1e3),o=[],s=i(n.clone());for(let i=0;i<=a;i++){let r=s(i/a);o.push(r.clone())}return o}}class rq{constructor(r={}){this.options=r,i.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){let r=this.options&&this.options.compact;return this._map=i,this._container=u("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=u("button","mapboxgl-ctrl-attrib-button",this._container),u("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=u("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),r&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===r&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(i,r){let n=this._map._getUIString(`AttributionControl.${r}`);i.setAttribute("aria-label",n),i.removeAttribute("title"),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
60se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));let n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN}];if(r){let a=n.reduce((i,r,a)=>(r.value&&(i+=`${r.key}=${r.value}${a<n.length-1?"&":""}`),i),"?");r.href=`${i.config.FEEDBACK_URL}/${a}#${i6(this._map,!0)}`,r.rel="noopener nofollow",this._setElementTitle(r,"MapFeedback")}}_updateData(i){i&&("metadata"===i.sourceDataType||"visibility"===i.sourceDataType||"style"===i.dataType)&&(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let i=[];if(this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let r=this._map.style._sourceCaches;for(let n in r){let a=r[n];if(a.used){let r=a.getSource();r.attribution&&0>i.indexOf(r.attribution)&&i.push(r.attribution)}}i.sort((i,r)=>i.length-r.length),i=i.filter((r,n)=>{for(let a=n+1;a<i.length;a++)if(i[a].indexOf(r)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i]:i.unshift(this.options.customAttribution));let n=i.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,i.length?(this._innerContainer.innerHTML=n,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class rX{constructor(){i.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(i){this._map=i,this._container=u("div","mapboxgl-ctrl");let r=u("a","mapboxgl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://www.mapbox.com/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(i){i&&"metadata"!==i.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;let i=this._map.style._sourceCaches;if(0===Object.entries(i).length)return!0;for(let r in i){let n=i[r].getSource();if(n.hasOwnProperty("mapbox_logo")&&!n.mapbox_logo)return!1}return!0}_updateCompact(){let i=this._container.children;if(i.length){let r=i[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class rW{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){let r=++this._id;return this._queue.push({callback:i,id:r,cancelled:!1}),r}remove(i){let r=this._currentlyRunning,n=r?this._queue.concat(r):this._queue;for(let r of n)if(r.id===i)return void(r.cancelled=!0)}run(i=0){let r=this._currentlyRunning=this._queue;for(let n of(this._queue=[],r))if(!n.cancelled&&(n.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function rH(r,n,a){if(r=new i.LngLat(r.lng,r.lat),n){let o=new i.LngLat(r.lng-360,r.lat),s=new i.LngLat(r.lng+360,r.lat),l=360*Math.ceil(Math.abs(r.lng-a.center.lng)/360),h=a.locationPoint(r).distSqr(n),u=n.x<0||n.y<0||n.x>a.width||n.y>a.height;a.locationPoint(o).distSqr(n)<h&&(u||Math.abs(o.lng-a.center.lng)<l)?r=o:a.locationPoint(s).distSqr(n)<h&&(u||Math.abs(s.lng-a.center.lng)<l)&&(r=s)}for(;Math.abs(r.lng-a.center.lng)>180;){let i=a.locationPoint(r);if(i.x>=0&&i.y>=0&&i.x<=a.width&&i.y<=a.height)break;r.lng>a.center.lng?r.lng-=360:r.lng+=360}return r}
60let rY={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%)"};class rK extends i.Evented{constructor(r,n){if(super(),(r instanceof i.window.HTMLElement||n)&&(r=i.extend({element:r},n)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),r&&r.element)this._element=r.element,this._offset=i.pointGeometry.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=u("div");let n=c("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},this._element),a=c("radialGradient",{id:"shadowGradient"},c("defs",{},n));c("stop",{offset:"10%","stop-opacity":.4},a),c("stop",{offset:"100%","stop-opacity":.05},a),c("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},n),c("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},n),c("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},n),c("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},n),this._offset=i.pointGeometry.convert(r&&r.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()});let a=this._element.classList;for(let i in rY)a.remove(`mapboxgl-marker-anchor-${i}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(i){return i===this._map||(this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._updateMoving),i.on("moveend",this._update),i.on("remove",this._clearFadeTimer),i._addMarker(this),this.setDraggable(this._draggable),this._update(),i.on("click",this._onMapClick)),this}remove(){let i=this._map;return i&&(i.off("click",this._onMapClick),i.off("move",this._updateMoving),i.off("moveend",this._update),i.off("mousedown",this._addDragHandler),i.off("touchstart",this._addDragHandler),i.off("mouseup",this._onUp),i.off("touchend",this._onUp),i.off("mousemove",this._onMove),i.off("touchmove",this._onMove),i.off("remove",this._clearFadeTimer),i._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=i.LngLat.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){let r=Math.sqrt(91.125);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(24.6+r)],"bottom-right":[-r,-1*(24.6+r)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=i,i._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","fal
60se")}return this}_onKeyPress(i){let r=i.code,n=i.charCode||i.keyCode;"Space"!==r&&"Enter"!==r&&32!==n&&13!==n||this.togglePopup()}_onMapClick(i){let r=i.originalEvent.target,n=this._element;this._popup&&(r===n||n.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let i=this._popup;return i&&(i.isOpen()?(i.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(i.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_behindTerrain(){let i=this._map;if(!i)return!1;let r=i.unproject(this._pos),n=i.getFreeCameraOptions();if(!n.position)return!1;let a=n.position.toLngLat();return a.distanceTo(r)<.9*a.distanceTo(this._lngLat)}_evaluateOpacity(){let r;let n=this._map;if(!n)return;let a=this._pos;if(!a||a.x<0||a.x>n.transform.width||a.y<0||a.y>n.transform.height)return void this._clearFadeTimer();let o=n.unproject(a);n._showingGlobe()&&i.isLngLatBehindGlobe(n.transform,this._lngLat)?r=0:(r=1-n._queryFogOpacity(o),n.transform._terrainEnabled()&&n.getTerrain()&&this._behindTerrain()&&(r*=.2)),this._element.style.opacity=`${r}`,this._element.style.pointerEvents=r>0?"auto":"none",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){let i=this._pos;if(!i||!this._map)return;let r=this._offset.mult(this._scale);this._element.style.transform=` 61 translate(${i.x}px,${i.y}px) 62 ${rY[this._anchor]} 63 ${this._calculateXYTransform()} ${this._calculateZTransform()} 64 translate(${r.x}px,${r.y}px) 65 `}_calculateXYTransform(){let r=this._pos,n=this._map,a=this.getPitchAlignment();if(!n||!r||"map"!==a)return"";if(!n._showingGlobe()){let i=n.getPitch();return i?`rotateX(${i}deg)`:""}let o=i.radToDeg(i.globeTiltAtLngLat(n.transform,this._lngLat)),s=r.sub(i.globeCenterToScreenPoint(n.transform)),l=Math.abs(s.x)+Math.abs(s.y);if(0===l)return"";let h=o/l;return`rotateX(${-s.y*h}deg) rotateY(${s.x*h}deg)`}_calculateZTransform(){let r=this._pos,n=this._map;if(!n||!r)return"";let a=0,o=this.getRotationAlignment();if("map"===o){if(n._showingGlobe()){let r=n.project(new i.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),o=n.project(new i.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(r);a=i.radToDeg(Math.atan2(o.y,o.x))-90}else a=-n.getBearing()}else if("horizon"===o){let o=i.smoothstep(4,6,n.getZoom()),s=i.globeCenterToScreenPoint(n.transform);s.y+=o*n.transform.height;let l=r.sub(s),h=i.radToDeg(Math.atan2(l.y,l.x));a=(h>90?h-270:h+90)*(1-o)}return(a+=this._rotation)?`rotateZ(${a}deg)`:""}_update(r){i.window.cancelAnimationFrame(this._updateFrameId);let n=this._map;
65n&&(n.transform.renderWorldCopies&&(this._lngLat=rH(this._lngLat,this._pos,n.transform)),this._pos=n.project(this._lngLat),!0===r?this._updateFrameId=i.window.requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),n._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(n._showingGlobe()||n.getTerrain()||n.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=i.pointGeometry.convert(r),this._update(),this}_onMove(r){let n=this._map;if(n){if(!this._isDragging){let i=this._clickTolerance||n._clickTolerance;this._isDragging=r.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=r.point.sub(this._positionDelta),this._lngLat=n.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new i.Event("dragstart"))),this.fire(new i.Event("drag")))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;let r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new i.Event("dragend")),this._state="inactive"}_addDragHandler(i){let r=this._map;r&&this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos),this._pointerdownPos=i.point,this._state="pending",r.on("mousemove",this._onMove),r.on("touchmove",this._onMove),r.once("mouseup",this._onUp),r.once("touchend",this._onUp))}setDraggable(i){this._draggable=!!i;let r=this._map;return r&&(i?(r.on("mousedown",this._addDragHandler),r.on("touchstart",this._addDragHandler)):(r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i||"auto",this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}}class rJ{constructor(i){this.jumpTo(i)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;let n=i.easeCubicInOut((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(i){return i>=this._startTime&&i<=this._endTime}jumpTo(i){this._startTime=-1/0,this._endTime=-1/0,this._start=i,this._end=i}easeTo(i,r,n){this._start=this.getValue(r),this._end=i,this._startTime=r,this._endTime=r+n}}let rQ={"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","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use â + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},r0={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileC
65acheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0};function r1(i){i.parentNode&&i.parentNode.removeChild(i)}let r2={showCompass:!0,showZoom:!0,visualizePitch:!1};class r3{constructor(r,n,a=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new ry({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,a&&(this.mousePitch=new rx({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(i,r){this.mouseRotate.mousedown(i,r),this.mousePitch&&this.mousePitch.mousedown(i,r),f()}move(i,r){let n=this.map,a=this.mouseRotate.mousemoveWindow(i,r),o=a&&a.bearingDelta;if(o&&n.setBearing(n.getBearing()+o),this.mousePitch){let a=this.mousePitch.mousemoveWindow(i,r),o=a&&a.pitchDelta;o&&n.setPitch(n.getPitch()+o)}}off(){let i=this.element;i.removeEventListener("mousedown",this.mousedown),i.removeEventListener("touchstart",this.touchstart,{passive:!1}),i.removeEventListener("touchmove",this.touchmove),i.removeEventListener("touchend",this.touchend),i.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){m(),i.window.removeEventListener("mousemove",this.mousemove),i.window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(i.extend({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),y(this.element,r)),i.window.addEventListener("mousemove",this.mousemove),i.window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,y(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){1!==i.targetTouches.length?this.reset():(this._startPos=this._lastPos=x(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){1!==i.targetTouches.length?this.reset():(this._lastPos=x(this.element,i.targetTouches)[0],this.move({preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){0===i.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()}}let r5={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},r4={maxWidth:100,unit:"metric"};function r6(i,r,n){let a=r8(r),o=a/r,s={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"}[n];this._map._requestDomTask(()=>{this._container.style.width=i*o+"px",this._container.innerHTML=`${a} ${s}`})}function r8(i){let r=Math.pow(10,`${Math.floor(i)}`.length-1),n=i/r;return r*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(i){let r=Math.pow(10,Math.ceil(-Math.log(i)/Math.LN10));return Math.round(i*r)/r}(n))}let r9={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"};function r7(r=new i.pointGeometry(0,0),n="bottom"){if("number"==typeof r){let a=Math.round(Math.sqrt(.5*Math.pow(r,2)));switch(n){case"top":return new i.pointGeometry(0,r);case"top-left":return new i.pointGeometry(a,a);case"top-right":return new i.pointGeometry(-a,a);case"bottom":return new i.pointGeometry(0,-r);case"bottom-left":return new i.pointGeometry(a,-a);case"bottom-right":return new i.pointGeometry(-a,-a);case"left":return new i.pointGeometry(r,0);case"right":return new i.pointGeometry(-r,0)}return new i.pointGeometry(0,0)}return r instanceof i.pointGeometry||Array.isArray(r)?i.pointGeometry.convert(r):i.pointGeometry.convert(r[n]||[0,0])}let ne={version:i.version,supported:l,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:class extends r${constructor(r){if(null!=(r=i.extend({},r0,r)).minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(r.antialias&&i.isSafariWithAntialiasingBug(i.window)&&(r.antialias=!1,i.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new i3(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),r),this._interactive=r.interactive,this._minTileCacheSize=r.minTileCacheSize,this._maxTileC
65acheSize=r.maxTileCacheSize,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=r.preserveDrawingBuffer,this._antialias=r.antialias,this._trackResize=r.trackResize,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=r.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=r.collectResourceTiming,this._optimizeForTerrain=r.optimizeForTerrain,this._language="auto"===r.language?i.window.navigator.language:r.language,this._worldview=r.worldview,this._renderTaskQueue=new rW,this._domRenderTaskQueue=new rW,this._controls=[],this._markers=[],this._mapId=i.uniqueId(),this._locale=i.extend({},rQ,r.locale),this._clickTolerance=r.clickTolerance,this._cooperativeGestures=r.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new rJ(0),this._useExplicitProjection=!1,this._requestManager=new i.RequestManager(r.transformRequest,r.accessToken,r.testMode),this._silenceAuthErrors=!!r.testMode,"string"==typeof r.container){if(this._container=i.window.document.getElementById(r.container),!this._container)throw Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof i.window.HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(this._container.childNodes.length>0&&i.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),r.maxBounds&&this.setMaxBounds(r.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),void 0!==i.window&&(i.window.addEventListener("online",this._onWindowOnline,!1),i.window.addEventListener("resize",this._onWindowResize,!1),i.window.addEventListener("orientationchange",this._onWindowResize,!1),i.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new rG(this,r),this._localFontFamily=r.localFontFamily,this._localIdeographFontFamily=r.localIdeographFontFamily,r.style&&this.setStyle(r.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),r.projection&&this.setProjection(r.projection),this._hash=r.hash&&new i4("string"==typeof r.hash&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,i.extend({},r.fitBoundsOptions,{duration:0})))),this.resize(),r.attributionControl&&this.addControl(new rq({customAttribution:r.customAttribution})),this._logoControl=new rX,this.addControl(this._logoControl,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",r=>{this._update("style"===r.dataType),this.fire(new i.Event(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new i.Event(`${r.dataType}dataloading`,r))})}_getMapId(){return this._mapId}addControl(r,n){if(void 0===n&&(n=r.getDefaultPosition?r.getDefaultPosition():"top-right"),!r||!r.onAdd)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let a=r.onAdd(this);this._controls.push(r);let o=this._controlPositions[n];return -1!==n.indexOf("bottom")?o.insertBefore(a,o.firstChild):o.appendChild(a),this}removeControl(r){if(!r||!r.onRemove)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let n=this._controls.indexOf(r);return n>-1&&this._controls.splice(n,1),r.onRemove(this),this}hasControl(i){return this._controls.indexOf(i)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(r){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));let n=!this._moving;return n&&this.fire(new i.Event("movestart",r)).fire(new i.Event("move",r)),this.fire(new i.Event("resize",r)),n&&this.fire(new i.Event("moveend",r)),this}getBounds(){return"globe"===this.transform.projection.name&&i.warnOnce('Globe projection does not support getBounds API, this API may behave unex
65pectedly."'),this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(r){return this.transform.setMaxBounds(i.LngLatBounds.convert(r)),this._update()}setMinZoom(r){if((r=null==r?-2:r)>=-2&&r<=this.transform.maxZoom)return this.transform.minZoom=r,this._update(),this.getZoom()<r?this.setZoom(r):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(r){if((r=null==r?22:r)>=this.transform.minZoom)return this.transform.maxZoom=r,this._update(),this.getZoom()>r?this.setZoom(r):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(r){if((r=null==r?0:r)<0)throw Error("minPitch must be greater than or equal to 0");if(r>=0&&r<=this.transform.maxPitch)return this.transform.minPitch=r,this._update(),this.getPitch()<r?this.setPitch(r):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(r){if((r=null==r?85:r)>85)throw Error("maxPitch must be less than or equal to 85");if(r>=this.transform.minPitch)return this.transform.maxPitch=r,this._update(),this.getPitch()>r?this.setPitch(r):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(i){return this.transform.renderWorldCopies=i,this._update()}getLanguage(){return this._language}setLanguage(r){if(this._language="auto"===r?i.window.navigator.language:r,this.style)for(let i in this.style._sourceCaches){let r=this.style._sourceCaches[i]._source;r._setLanguage&&r._setLanguage(this._language)}for(let i of this._controls)i._setLanguage&&i._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(i){if(this._worldview=i,this.style)for(let r in this.style._sourceCaches){let n=this.style._sourceCaches[r]._source;n._setWorldview&&n._setWorldview(i)}return this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(i){return this._lazyInitEmptyStyle(),i?"string"==typeof i&&(i={name:i}):i=null,this._useExplicitProjection=!!i,this._prioritizeAndUpdateProjection(i,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){let r;if("globe"!==this.getProjection().name)return;let n=this.transform,a=n.projection.name;"globe"===a&&n.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX?(n.setMercatorFromTransition(),r=!0):"mercator"===a&&n.zoom<i.GLOBE_ZOOM_THRESHOLD_MAX&&(n.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}_prioritizeAndUpdateProjection(i,r){return this._updateProjection(i||r||{name:"mercator"})}_updateProjection(r){let n;if(n="globe"===r.name&&this.transform.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(r),this.style.applyProjectionUpdate(),n){for(let i in this.painter.clearBackgroundTiles(),this.style._sourceCaches)this.style._sourceCaches[i].clearTiles();this._update(!0)}return this}project(r){return this.transform.locationPoint3D(i.LngLat.convert(r))}unproject(r){return this.transform.pointLocation3D(i.pointGeometry.convert(r))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}
65_createDelegatedListener(i,r,n){if("mouseenter"===i||"mouseover"===i){let a=!1,o=o=>{let s=r.filter(i=>this.getLayer(i)),l=s.length?this.queryRenderedFeatures(o.point,{layers:s}):[];l.length?a||(a=!0,n.call(this,new ra(i,this,o.originalEvent,{features:l}))):a=!1},s=()=>{a=!1};return{layers:new Set(r),listener:n,delegates:{mousemove:o,mouseout:s}}}if("mouseleave"===i||"mouseout"===i){let a=!1,o=o=>{let s=r.filter(i=>this.getLayer(i));(s.length?this.queryRenderedFeatures(o.point,{layers:s}):[]).length?a=!0:a&&(a=!1,n.call(this,new ra(i,this,o.originalEvent)))},s=r=>{a&&(a=!1,n.call(this,new ra(i,this,r.originalEvent)))};return{layers:new Set(r),listener:n,delegates:{mousemove:o,mouseout:s}}}{let a=i=>{let a=r.filter(i=>this.getLayer(i)),o=a.length?this.queryRenderedFeatures(i.point,{layers:a}):[];o.length&&(i.features=o,n.call(this,i),delete i.features)};return{layers:new Set(r),listener:n,delegates:{[i]:a}}}}on(i,r,n){if(void 0===n)return super.on(i,r);Array.isArray(r)||(r=[r]);let a=this._createDelegatedListener(i,r,n);for(let r in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[i]=this._delegatedListeners[i]||[],this._delegatedListeners[i].push(a),a.delegates)this.on(r,a.delegates[r]);return this}once(i,r,n){if(void 0===n)return super.once(i,r);Array.isArray(r)||(r=[r]);let a=this._createDelegatedListener(i,r,n);for(let i in a.delegates)this.once(i,a.delegates[i]);return this}off(i,r,n){if(void 0===n)return super.off(i,r);r=new Set(Array.isArray(r)?r:[r]);let a=(i,r)=>{if(i.size!==r.size)return!1;for(let n of i)if(!r.has(n))return!1;return!0},o=this._delegatedListeners?this._delegatedListeners[i]:void 0;return o&&(i=>{for(let o=0;o<i.length;o++){let s=i[o];if(s.listener===n&&a(s.layers,r)){for(let i in s.delegates)this.off(i,s.delegates[i]);return i.splice(o,1),this}}})(o),this}queryRenderedFeatures(r,n){return this.style?(void 0!==n||void 0===r||r instanceof i.pointGeometry||Array.isArray(r)||(n=r,r=void 0),this.style.queryRenderedFeatures(r=r||[[0,0],[this.transform.width,this.transform.height]],n=n||{},this.transform)):[]}querySourceFeatures(i,r){return this.style.querySourceFeatures(i,r)}queryTerrainElevation(r,n){let a=this.transform.elevation;return a?(n=i.extend({},{exaggerated:!0},n),a.getAtPoint(i.MercatorCoordinate.fromLngLat(r),null,n.exaggerated)):null}setStyle(r,n){return!1!==(n=i.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},n)).diff&&n.localIdeographFontFamily===this._localIdeographFontFamily&&n.localFontFamily===this._localFontFamily&&this.style&&r?(this._diffStyle(r,n),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._localFontFamily=n.localFontFamily,this._updateStyle(r,n))}_getUIString(i){let r=this._locale[i];if(null==r)throw Error(`Missing UI string '${i}'`);return r}_updateStyle(i,r){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),i&&(this.style=new tA(this,r||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof i?this.style.loadURL(i):this.style.loadJSON(i)),this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new tA(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(r,n){if("string"==typeof r){let a=this._requestManager.normalizeStyleURL(r),o=this._requestManager.transformRequest(a,i.ResourceType.Style);i.getJSON(o,(r,a)=>{r?this.fire(new i.ErrorEvent(r)):a&&this._updateDiff(a,n)})}else"object"==typeof r&&this._updateDiff(r,n)}_updateDiff(r,n){try{this.style.setState(r)&&this._update(!0)}catch(a){i.warnOnce(`Unable to perform style diff: ${a.message||a.error||a}. Rebuilding the style from scratch.`),this._updateStyle(r,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(i.warnOnce("There is no style added to the map."),!1)}addSource(i,r){return this._lazyInitEmptyStyle(),this.style.addSource(i,r),this._update(!0)}isSourceLoaded(i){return!!this.style&&this.style._isSourceCacheLoaded(i)}areTilesLoaded(){let i=this.style&&this.style._sourceCaches;for(let r in i){let n=i[r]._tiles;for(let i in n){let r=n[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}}return!0}addSourceType(i,r,n){this._lazyInitEmptyStyle(),this.style.addSourceType(i,r,n)}removeSource(i){return this.style.removeSource(i),this._updateTerrain(),this._update(!0)}getSource(i){return this.style.getSource(i)}addImage(r,n,{pixelRatio:a=1,sdf:o=!1,stretchX:s,stretchY:l,content:h}={}){if(this._lazyInitEmptyStyle(),n instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&n instanceof i.window.ImageBitmap){let{width:u,height:c,data:p}=i.exported.getImageData(n);this.style.addImage(r,{data:new i.RGBAImage({width:u,height:c},p),pixelRatio:a,stretchX:s,stretchY:l,content:h,sdf:o,version:0})}else if(void 0===n.width||void 0===n.height)this.fire(new i.ErrorEvent(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`")));else{let{width:u,height:c}=n;this.style.addImage(r,{data:new i.RGBAImage({width:u,height:c},new Uint8Array(n.data)),pixelRatio:a,stretchX:s,stretchY:l,content:h,sdf:o,version:0,userImage:n}),n.onAdd&&n.onAdd(this,r)}}updateImage(r,n){let a=this.style.getImage(r);if(!a)return void this.fire(new i.ErrorEvent(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let o=n instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&n instanceof i.window.ImageBitmap?i.exported.getImageData(n):n,{width:s,height:l}=o;void 0!==s&&void 0!==l?s===a.data.width&&l===a.data.height?(a.data.replace(o.data,!(n instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&n instanceof i.window.ImageBitmap)),this.style.updateImage(r,a)):this.fire(new i.ErrorEvent(Error(`The width and height of the updated image (${s}, ${l}) 66 must be that same as the previous version of the image 67 (${a.data.width}, ${a.data.height})`))):this.fire(new i.ErrorEvent(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`")))}hasImage(r){return r?!!this.style.getImage(r):(this.fire(new i.ErrorEvent(Error("Missing required image id"))),!1)}removeImage(i){this.style.removeImage(i)}loadImage(r,n){i.getImage(this._requestManager.transformRequest(r,i.ResourceType.Image),(r,a)=>{n(r,a instanceof i.window.HTMLImageElement?i.exported.getImageData(a):a)})}listImages(){return this.style.listImages()}addLayer(i,r){return this._lazyInitEmptyStyle(),this.style.addLayer(i,r),this._update(!0)}moveLayer(i,r){return this.style.moveLayer(i,r),this._update(!0)}removeLayer(i){return this.style.removeLayer(i),this._update(!0)}getLayer(i){return this.style.getLayer(i)}setLayerZoomRange(i,r,n){return this.style.setLayerZoomRange(i,r,n),this._update(!0)}setFilter(i,r,n={}){return this.style.setFilter(i,r,n),this._update(!0)}getFilter(i){return this.style.getFilter(i)}setPaintProperty(i,r,n,a={}){return this.style.setPaintProperty(i,r,n,a),this._update(!0)}getPaintProperty(i,r){return this.style.getPaintProperty(i,r)}setLayoutProperty(i,r,n,a={}){return this.style.setLayoutProperty(i,r,n,a),this._update(!0)}getLayoutProperty(i,r){return this.style.getLayoutProperty(i,r)}setLight(i,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(i,r),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(i){return this._lazyInitEmptyStyle(),!i&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(i),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(i){return this._lazyInitEmptyStyle(),this.style.setFog(i),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(r){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.LngLat.convert(r),this.transform):0}setFeatureState(i,r){return this.style.setFeatureState(i,r),this._update()}removeFeatureState(i,r){return this.style.removeFeatureState(i,r),this._update()}getFeatureState(i){return this.style.getFeatureState(i)}_updateContainerDimensions(){if(!this._container)return;let r=this._container.getBoundingClientRect().width||400,n=this._container.getBoundingClientRect().height||300,a,o,s,l=this._container;for(;l&&(!o||!s);){let r=i.window.getComputedStyle(l).transform;
67r&&"none"!==r&&((a=r.match(/matrix.*\((.+)\)/)[1].split(", "))[0]&&"0"!==a[0]&&"1"!==a[0]&&(o=a[0]),a[3]&&"0"!==a[3]&&"1"!==a[3]&&(s=a[3])),l=l.parentElement}this._containerWidth=o?Math.abs(r/o):r,this._containerHeight=s?Math.abs(n/s):n}_detectMissingCSS(){"rgb(250, 128, 114)"!==i.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&i.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){let i=this._container;i.classList.add("mapboxgl-map"),(this._missingCSSCanary=u("div","mapboxgl-canary",i)).style.visibility="hidden",this._detectMissingCSS();let r=this._canvasContainer=u("div","mapboxgl-canvas-container",i);this._interactive&&r.classList.add("mapboxgl-interactive"),this._canvas=u("canvas","mapboxgl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);let n=this._controlContainer=u("div","mapboxgl-control-container",i),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(i=>{a[i]=u("div",`mapboxgl-ctrl-${i}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,n){let a=i.exported.devicePixelRatio||1;this._canvas.width=a*Math.ceil(r),this._canvas.height=a*Math.ceil(n),this._canvas.style.width=`${r}px`,this._canvas.style.height=`${n}px`}_addMarker(i){this._markers.push(i)}_removeMarker(i){let r=this._markers.indexOf(i);-1!==r&&this._markers.splice(r,1)}_setupPainter(){let r=i.extend({},l.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r);n?(i.storeAuthState(n,!0),this.painter=new iZ(n,this.transform),this.on("data",i=>{"source"===i.dataType&&this.painter.setTileLoadedFlag(!0)}),i.exported$1.testSupport(n)):this.fire(new i.ErrorEvent(Error("Failed to initialize WebGL")))}_contextLost(r){r.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:r}))}_contextRestored(r){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:r}))}_onMapScroll(i){if(i.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(i){return this.style&&(this._styleDirty=this._styleDirty||i,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(i){return this._update(),this._renderTaskQueue.add(i)}_cancelRenderFrame(i){this._renderTaskQueue.remove(i)}_requestDomTask(i){!this.loaded()||this.loaded()&&!this.isMoving()?i():this._domRenderTaskQueue.add(i)}_render(r){let n;let a=this.painter.context.extTimerQuery,o=i.exported.now();if(this.listens("gpu-timing-frame")&&(n=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,n)),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(r),this._domRenderTaskQueue.run(r),this._removed)return;this._updateProjectionTransition();let s=!1,l=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;let r=this.transform.zoom,n=this.transform.pitch,a=i.exported.now();this.style.zoomHistory.update(r,a);let o=new i.EvaluationParameters(r,{now:a,fadeDuration:l,pitch:n,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),h=o.crossFadingFactor();1===h&&h===this._crossFadingFactor||(s=!0,this._crossFadingFactor=h),this.style.update(o)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedU
67pdate=!0,this._sourcesDirty=!0);let h=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),h=this._updateAverageElevation(o),this.style._updateSources(this.transform),this._forceMarkerUpdate()):h=this._updateAverageElevation(o),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.Event("load"))),this.style&&(this.style.hasTransitions()||s)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),n){let r=i.exported.now()-o;a.endQueryEXT(a.TIME_ELAPSED_EXT,n),setTimeout(()=>{let s=a.getQueryObjectEXT(n,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(n),this.fire(new i.Event("gpu-timing-frame",{cpuTime:r,gpuTime:s})),i.window.performance.mark("frame-gpu",{startTime:o,detail:{gpuTime:s}})},50)}if(this.listens("gpu-timing-layer")){let r=this.painter.collectGpuTimers();setTimeout(()=>{let n=this.painter.queryGpuTimers(r);this.fire(new i.Event("gpu-timing-layer",{layerTimes:n}))},50)}if(this.listens("gpu-timing-deferred-render")){let r=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{let n=this.painter.queryGpuTimeDeferredRender(r);this.fire(new i.Event("gpu-timing-deferred-render",{gpuTime:n}))},50)}let u=this._sourcesDirty||this._styleDirty||this._placementDirty||h;if(u||this._repaint)this.triggerRepaint();else{let r=!this.isMoving()&&this.loaded();if(r&&(h=this._updateAverageElevation(o,!0)),h)this.triggerRepaint();else if(this._triggerFrame(!1),r&&(this.fire(new i.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let r=this._calculateSpeedIndex();this.fire(new i.Event("speedindexcompleted",{speedIndex:r})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||u||(this._fullyLoaded=!0,this._authenticate())}_forceMarkerUpdate(){for(let i of this._markers)i._update()}_updateAverageElevation(i,r=!1){let n=i=>(this.transform.averageElevation=i,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&n(0);if((r||i-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(i)){let r=this.transform.averageElevation,a=this.transform.sampleAverageElevation(),o=!1;this.transform.elevation&&(o=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(a)?a=0:this._averageElevationLastSampledAt=i;let s=Math.abs(r-a);if(s>1){if(this._isInitialLoad||o)return this._averageElevation.jumpTo(a),n(a);this._averageElevation.easeTo(a,i,300)}else if(s>1e-4)return this._averageElevation.jumpTo(a),n(a)}return!!this._averageElevation.isEasing(i)&&n(this._averageElevation.getValue(i))}_authenticate(){i.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,r=>{if(r&&(r.message===i.AUTH_ERR_MSG||401===r.status)){let r=this.painter.context.gl;i.storeAuthState(r,!1),this._logoControl instanceof rX&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.ErrorEvent(Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),i.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){let i=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());let n=this.painter.context.gl,a=n.createFramebuffer();function o(i){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,i,0);let r=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,r),r}return n.bindFramebuffer(n.FRAMEBUFFER,a),this._canvasPixelComparison(o(i),r.canvasCopies.map(o),r.timeStamps)}_canvasPixelComparison(i,r,n){let a=n[1]-n[0],o=i.length/4;for(let s=0;s<r.length;s++){let l=r[s],h=0;for(let r=0;r<l.length;r+=4)l[r]===i[r]&&l[r+1]===i[r+1]&&l[r+2]===i[r+2]&&l[r+3]===i[r+3]&&(h+=1);a+=(n[s+2]-n[s+1])*(1-h/o)}return a}remove(){for(let i of(this._hash&&this._hash.remove(),this._controls))i.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),void 0!==i.window&&(i.window.removeEventListener("resize",this._onWindowResize,!1),i.window.removeEventListener("orientationchange",this._onWindowResize,!1),i.window.removeEventListener("webkitfullscreenchange",this._onWindowResize,!1),i.window.removeEventListener("online",this._onWindowOnline,!1));let r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),r1(this._canvasContainer),r1(this._controlContainer),r1(this._missingCSSCanary),this._container.classList.remove("mapboxgl-map"),i.removeAuthState(this.painter.context.gl),this._removed=!0,this.fire(new i.Event("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(r){this._renderNextFrame=this._renderNextFrame||r,this.style&&!this._frame&&(this._frame=i.exported.frame(i=>{let r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(i)}))}_preloadTiles(r){let n=this.style?Object.values(this.style._sourceCaches):[];return i.asyncAll(n,(i,n)=>i._preloadTiles(r,n),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(i){this._trackResize&&this.resize({originalEvent:i})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(i){this._showTileBoundaries!==i&&(this._showTileBoundaries=i,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(i){this._showTerrainWireframe!==i&&(this._showTerrainWireframe=i,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(i){this._speedIndexTiming!==i&&(this._speedIndexTiming=i,this._update())}get showPadding(){return!!this._showPadding}set showPadding(i){this._showPadding!==i&&(this._showPadding=i,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(i){this._showCollisionBoxes!==i&&(this._showCollisionBoxes=i,i?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(i){this._showOverdrawInspector!==i&&(this._showOverdrawInspector=i,this._update())}get repaint(){return!!this._repaint}set repaint(i){this._repaint!==i&&(this._repaint=i,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(i){this._vertices=i,this._update()}_setCacheLimits(r,n){i.setCacheLimits(r,n)}get version(){return i.version}},NavigationControl:class{constructor(r){this.options=i.extend({},r2,r),this._container=u("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>{this._map&&this._map.zoomIn({},{originalEvent:i})}),u("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",i=>{this._map&&this._map.zoomOut({},{originalEvent:i})}),u("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{let r=this._map;r&&(this.options.visualizePitch?r.resetNorthPitch({},{originalEvent:i}):r.resetNorth({},{originalEvent:i}))}),this._compassIcon=u("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let i=this._map;if(!i)return;let r=i.getZoom(),n=r===i.getMaxZoom(),a=r===i.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())}_rotateCompassArrow(){let i=this._map;if(!i)return;let r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(i.transform.pitch*(Math.PI/180)
67),.5)}) rotateX(${i.transform.pitch}deg) rotateZ(${i.transform.angle*(180/Math.PI)}deg)`:`rotate(${i.transform.angle*(180/Math.PI)}deg)`;i._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(i){return this._map=i,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),i.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&i.on("pitch",this._rotateCompassArrow),i.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new r3(i,this._compass,this.options.visualizePitch)),this._container}onRemove(){let i=this._map;i&&(this._container.remove(),this.options.showZoom&&i.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&i.off("pitch",this._rotateCompassArrow),i.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(i,r){let n=u("button",i,this._container);return n.type="button",n.addEventListener("click",r),n}_setButtonTitle(i,r){if(!this._map)return;let n=this._map._getUIString(`NavigationControl.${r}`);i.setAttribute("aria-label",n),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends i.Evented{constructor(r){super(),this.options=i.extend({geolocation:i.window.navigator.geolocation},r5,r),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=i5(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(i){return this._map=i,this._container=u("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(r){void 0!==this._supportsGeolocation?r(this._supportsGeolocation):void 0!==i.window.navigator.permissions?i.window.navigator.permissions.query({name:"geolocation"}).then(i=>{this._supportsGeolocation="denied"!==i.state,r(this._supportsGeolocation)}):(this._supportsGeolocation=!!this.options.geolocation,r(this._supportsGeolocation))}_isOutOfMapMaxBounds(i){let r=this._map.getMaxBounds(),n=i.coords;return!!r&&(n.longitude<r.getWest()||n.longitude>r.getEast()||n.latitude<r.getSouth()||n.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(r){if(this._map){if(this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(r),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",r)),this._finish()}}
67_updateCamera(r){let n=new i.LngLat(r.coords.longitude,r.coords.latitude),a=r.coords.accuracy,o=this._map.getBearing(),s=i.extend({bearing:o},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(a),s,{geolocateSource:!0})}_updateMarker(r){if(r){let n=new i.LngLat(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let r=this._map.transform,n=i.mercatorZfromAltitude(1,r._center.lat)*r.worldSize,a=Math.ceil(2*this._accuracy*n);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(r){if(this._map){if(this.options.trackUserLocation){if(1===r.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===r.code&&this._noTimeout)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",r)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(r){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=u("button","mapboxgl-ctrl-geolocate",this._container),u("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===r){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=u("div","mapboxgl-user-location"),this._dotElement.appendChild(u("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(u("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new rK({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=u("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new rK({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",r=>{r.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r.originalEvent&&"resize"===r.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.Event("trackuserlocationend")))})}_onDeviceOrientation(i){this._userLocationDotMarker&&(i.webkitCompassHeading?this._heading=i.webkitCompassHeading:!0===i.absolute&&(this._heading=-1*i.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.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 i.Event("trackuserlocationstart"));break;
67case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let i;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(i={maximumAge:6e5,timeout:0},this._noTimeout=!0):(i=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,i),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){let r=()=>{i.window.addEventListener("ondeviceorientationabsolute"in i.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};void 0!==i.window.DeviceMotionEvent&&"function"==typeof i.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(i=>{"granted"===i&&r()}).catch(console.error):r()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),i.window.removeEventListener("deviceorientation",this._onDeviceOrientation),i.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:rq,ScaleControl:class{constructor(r){this.options=i.extend({},r4,r),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch(i){return!1}}()||(this._setScale=r6.bind(this)),i.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){let i=this.options.maxWidth||100,r=this._map,n=r._containerHeight/2,a=r._containerWidth/2-i/2,o=r.unproject([a,n]),s=r.unproject([a+i,n]),l=o.distanceTo(s);if("imperial"===this.options.unit){let r=3.2808*l;r>5280?this._setScale(i,r/5280,"mile"):this._setScale(i,r,"foot")}else"nautical"===this.options.unit?this._setScale(i,l/1852,"nautical-mile"):l>=1e3?this._setScale(i,l/1e3,"kilometer"):this._setScale(i,l,"meter")}_setScale(i,r,n){let a=r8(r),o=a/r;this._map._requestDomTask(()=>{this._container.style.width=i*o+"px",this._container.innerHTML="nautical-mile"!==n?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"narrow",unit:n}).format(a):`${a} nm`})}onAdd(i){return this._map=i,this._language=i.getLanguage(),this._container=u("div","mapboxgl-ctrl mapboxgl-ctrl-scale",i.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(i){this._language=i,this._update()}setUnit(i){this.options.unit=i,this._update()}},FullscreenControl:class{constructor(r){this._fullscreen=!1,r&&r.container&&(r.container instanceof i.window.HTMLElement?this._container=r.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in i.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(r){return this._map=r,this._container||(this._container=this._map.getContainer()),this._controlContainer=u("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!i.window.document.fullscreenEnabled&&!i.window.document.webkitFullscreenEnabled)}_setupUI(){let r=this._fullscreenButton=u("button","mapboxgl-ctrl-fullscreen",this._controlContainer);u("span","mapboxgl-ctrl-icon",r).setAttribute("aria-hidden","true"),r.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let i=this._getTitle();this._fullscreenButton.setAttribute("aria-label",i),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",i)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(i.window.document.fullscreenElement||i.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends i.Evented{constructor(r){super(),this.options=i.extend(Object.create(r9),r),i.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(r&&r.className?r.className.trim().split(/\s+/):[])}addTo(r){return this._map&&this.remove(),this._map=r,this.options.closeOnClick&&r.on("preclick",this._onClose),this.options.closeOnMove&&r.on("move",this._onClose),r.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(r.on("mousemove",this._onMouseEvent),r.on("mouseup",this._onMouseEvent),r._canvasContainer.classList.add("mapboxgl-track-pointer")):r.on("move",this._update),this.fire(new i.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);let r=this._map;return r&&(r.off("move",this._update),r.off("move",this._onClose),r.off("preclick",this._onClose),r.off("click",this._onClose),r.off("remove",this.remove),r.off("mousemove",this._onMouseEvent),r.off("mouseup",this._onMouseEvent),r.off("drag",this._onMouseEvent),this._map=void 0),this.fire(new i.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(r){this._lngLat=i.LngLat.convert(r),this._pos=null,this._trackPointer=!1,this._update();let n=this._map;return n&&(n.on("move",this._update),n.off("mousemove",this._onMouseEvent),n._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();let i=this._map;return i&&(i.off("move",this._update),i.on("mousemove",this._onMouseEvent),i.on("drag",this._onMouseEvent),i._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(r){return this.setDOMContent(i.window.document.createTextNode(r))}setHTML(r){let n;let a=i.window.document.createDocumentFragment(),o=i.window.document.createElement("body");for(o.innerHTML=r;n=o.firstChild;)a.appendChild(n);return this.setDOMContent(a)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(i){return this.options.maxWidth=i,this._update(),this}setDOMContent(i){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=u("div","mapboxgl-popup-content",this._container||void 0);
67if(r.appendChild(i),this.options.closeButton){let i=this._closeButton=u("button","mapboxgl-popup-close-button",r);i.type="button",i.setAttribute("aria-label","Close popup"),i.setAttribute("aria-hidden","true"),i.innerHTML="×",i.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(i){return this._classList.add(i),this._updateClassList(),this}removeClassName(i){return this._classList.delete(i),this._updateClassList(),this}setOffset(i){return this.options.offset=i,this._update(),this}toggleClassName(i){let r;return this._classList.delete(i)?r=!1:(this._classList.add(i),r=!0),this._updateClassList(),r}_onMouseEvent(i){this._update(i.point)}_getAnchor(i){if(this.options.anchor)return this.options.anchor;let r=this._map,n=this._container,a=this._pos;if(!r||!n||!a)return"bottom";let o=n.offsetWidth,s=n.offsetHeight,l=a.x<o/2,h=a.x>r.transform.width-o/2;if(a.y+i<s)return l?"top-left":h?"top-right":"top";if(a.y>r.transform.height-s){if(l)return"bottom-left";if(h)return"bottom-right"}return l?"left":h?"right":"bottom"}_updateClassList(){let i=this._container;if(!i)return;let r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),i.className=r.join(" ")}_update(r){let n=this._map,a=this._content;if(!n||!this._lngLat&&!this._trackPointer||!a)return;let o=this._container;if(o||(o=this._container=u("div","mapboxgl-popup",n.getContainer()),this._tip=u("div","mapboxgl-popup-tip",o),o.appendChild(a)),this.options.maxWidth&&o.style.maxWidth!==this.options.maxWidth&&(o.style.maxWidth=this.options.maxWidth),n.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=rH(this._lngLat,this._pos,n.transform)),!this._trackPointer||r){let i=this._pos=this._trackPointer&&r?r:n.project(this._lngLat),a=r7(this.options.offset),o=this._anchor=this._getAnchor(a.y),s=r7(this.options.offset,o),l=i.add(s).round();n._requestDomTask(()=>{this._container&&o&&(this._container.style.transform=`${rY[o]} translate(${l.x}px,${l.y}px)`)})}if(!this._marker&&n._showingGlobe()){let r=i.isLngLatBehindGlobe(n.transform,this._lngLat)?0:1;this._setOpacity(r)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let i=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");i&&i.focus()}_onClose(){this.remove()}_setOpacity(i){this._container&&(this._container.style.opacity=`${i}`),this._content&&(this._content.style.pointerEvents=i?"auto":"none")}},Marker:rK,Style:tA,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,FreeCameraOptions:iH,Evented:i.Evented,config:i.config,prewarm:function(){eO().acquire(eR)},clearPrewarmedResources:function(){let i=a;i&&(i.isPreloaded()&&1===i.numActive()?(i.release(eR),a=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 accessToken(){return i.config.ACCESS_TOKEN},set accessToken(t){i.config.ACCESS_TOKEN=t},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(t){i.config.API_URL=t},get workerCount(){return eF.workerCount},set workerCount(e){eF.workerCount=e},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){i.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(r){i.clearTileCache(r)},workerUrl:"",workerClass:null,setNow:i.exported.setNow,restoreNow:i.exported.restoreNow};return ne}),n}()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.