PageSourceSearch

https://www.ketv.com/_assets/fre/scopes/htv/_next/static/chunks/ab1f22a2.b18de81f17bed116.js

js ketv.com collected 2026-09-24 08:50:48 UTC 1,032,101 bytes, 53 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1758],{61279:function(t){t.exports=function(){"use strict";var t={},i={};function r(r,a,n){if(i[r]=n,"index"===r){var s="var sharedModule = {}; ("+i.shared+")(sharedModule); ("+i.worker+")(sharedModule);",o={};return i.shared(o),i.index(t,o),"u">typeof window&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([s],{type:"text/javascript"}))),t}}return r("shared",["exports"],function(t){let i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v;function b(t,i,r,a){return new(r||(r=Promise))(function(n,s){function o(t){try{h(a.next(t))}catch(t){s(t)}}function l(t){try{h(a.throw(t))}catch(t){s(t)}}function h(t){var i;t.done?n(t.value):((i=t.value)instanceof r?i:new r(function(t){t(i)})).then(o,l)}h((a=a.apply(t,i||[])).next())})}function w(t,i){this.x=t,this.y=i}function T(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}"function"==typeof SuppressedError&&SuppressedError,w.prototype={clone(){return new w(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,i){return this.clone()._rotateAround(t,i)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){let i=t.x-this.x,r=t.y-this.y;return i*i+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,i){return Math.atan2(this.x*i-this.y*t,this.x*t+this.y*i)},_matMult(t){let i=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=i,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let i=Math.cos(t),r=Math.sin(t),a=r*this.x+i*this.y;return this.x=i*this.x-r*this.y,this.y=a,this},_rotateAround(t,i){let r=Math.cos(t),a=Math.sin(t),n=i.y+a*(this.x-i.x)+r*(this.y-i.y);return this.x=i.x+r*(this.x-i.x)-a*(this.y-i.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:w},w.convert=function(t){if(t instanceof w)return t;if(Array.isArray(t))return new w(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new w(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};var S,P,M,I,E,C,A,D,z,k,R,L,F,B,O,V,j,N,U,G,$,Z,q,W,H=T(function(){if(iv)return ix;function t(t,i,r,a){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=r,this.p2y=a}return iv=1,ix=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(void 0===i&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,a=0;a<8;a++){var n=this.sampleCurveX(r)-t;if(Math.abs(n)<i)return r;var s=this.sampleCurveDerivativeX(r);if(1e-6>Math.abs(s))break;r-=n/s}var o=0,l=1;for(r=t,a=0;a<20&&!(Math.abs((n=this.sampleCurveX(r))-t)<i);a++)t>n?o=r:l=r,r=.5*(l-o)+o;return r},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},ix}());function X(){return null!=i||(i="u">typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),i}function Y(){if(null==r&&(r=!1,X())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let i=0;i<25;i++){let r=4*i;
1t.fillStyle=`rgb(${r},${r+1},${r+2})`,t.fillRect(i%5,Math.floor(i/5),1,1)}let i=t.getImageData(0,0,5,5).data;for(let t=0;t<100;t++)if(t%4!=3&&i[t]!==t){r=!0;break}}}return r||!1}var K="u">typeof Float32Array?Float32Array:Array;function J(){var t=new K(9);return K!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Q(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ee(){var t=new K(3);return K!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function et(t){var i=t[0],r=t[1],a=t[2];return Math.sqrt(i*i+r*r+a*a)}function ei(t,i,r){var a=new K(3);return a[0]=t,a[1]=i,a[2]=r,a}function er(t,i,r){return t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function ea(t,i,r){return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t}function en(t,i,r){var a=i[0],n=i[1],s=i[2],o=r[0],l=r[1],h=r[2];return t[0]=n*h-s*l,t[1]=s*o-a*h,t[2]=a*l-n*o,t}function es(t,i,r){var a=i[0],n=i[1],s=i[2],o=i[3];return t[0]=r[0]*a+r[4]*n+r[8]*s+r[12]*o,t[1]=r[1]*a+r[5]*n+r[9]*s+r[13]*o,t[2]=r[2]*a+r[6]*n+r[10]*s+r[14]*o,t[3]=r[3]*a+r[7]*n+r[11]*s+r[15]*o,t}function eo(){var t=new K(4);return K!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function el(t,i,r,a){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",s=Math.PI/360;i*=s,a*=s,r*=s;var o=Math.sin(i),l=Math.cos(i),h=Math.sin(r),u=Math.cos(r),c=Math.sin(a),d=Math.cos(a);switch(n){case"xyz":t[0]=o*u*d+l*h*c,t[1]=l*h*d-o*u*c,t[2]=l*u*c+o*h*d,t[3]=l*u*d-o*h*c;break;case"xzy":t[0]=o*u*d-l*h*c,t[1]=l*h*d-o*u*c,t[2]=l*u*c+o*h*d,t[3]=l*u*d+o*h*c;break;case"yxz":t[0]=o*u*d+l*h*c,t[1]=l*h*d-o*u*c,t[2]=l*u*c-o*h*d,t[3]=l*u*d+o*h*c;break;case"yzx":t[0]=o*u*d+l*h*c,t[1]=l*h*d+o*u*c,t[2]=l*u*c-o*h*d,t[3]=l*u*d-o*h*c;break;case"zxy":t[0]=o*u*d-l*h*c,t[1]=l*h*d+o*u*c,t[2]=l*u*c+o*h*d,t[3]=l*u*d-o*h*c;break;case"zyx":t[0]=o*u*d-l*h*c,t[1]=l*h*d+o*u*c,t[2]=l*u*c-o*h*d,t[3]=l*u*d+o*h*c;break;default:throw Error("Unknown angle order "+n)}return t}function eh(){var t=new K(2);return K!=Float32Array&&(t[0]=0,t[1]=0),t}function eu(t,i){var r=new K(2);return r[0]=t,r[1]=i,r}function ec(t,i,r){return i*(8192/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}function ed(t){return t instanceof Error?t:Error("string"==typeof t?t:String(t))}function ep(t,i){return(t%i+i)%i}function ef(t,i,r){return t*(1-r)+i*r}function em(t){if(t<=0)return 0;if(t>=1)return 1;let i=t*t,r=i*t;return 4*(t<.5?r:3*(t-i)+r-.75)}function e_(t,i,r,a){let n=new H(t,i,r,a);return t=>n.solve(t)}ee(),ib=new K(4),K!=Float32Array&&(ib[0]=0,ib[1]=0,ib[2]=0,ib[3]=0),ee(),ei(1,0,0),ei(0,1,0),eo(),eo(),J(),eh();let eg=e_(.25,.1,.25,1);function ey(t,i,r){return Math.min(r,Math.max(i,t))}function ex(t,i,r){let a=r-i,n=((t-i)%a+a)%a+i;return n===i?r:n}function ev(t,...i){for(let r of i)for(let i in r)t[i]=r[i];return t}let eb=1;function ew(t,i,r){let a={};for(let r in t)a[r]=i.call(this,t[r],r,t);return a}function eT(t,i,r){let a={};for(let r in t)i.call(this,t[r],r,t)&&(a[r]=t[r]);return a}function eS(t){return Array.isArray(t)?t.map(eS):"object"==typeof t&&t?ew(t,eS):t}let eP={};function eM(t){eP[t]||("u">typeof console&&console.warn(t),eP[t]=!0)}function eI(t,i,r){return(r.y-t.y)*(i.x-t.x)>(i.y-t.y)*(r.x-t.x)}function eE(t){return"u">typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let eC=null;function eA(t){return"u">typeof ImageBitmap&&t instanceof ImageBitmap}let eD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ez(t,i,r,a,n){return b(this,void 0,void 0,function*(){if("u"<typeof VideoFrame)throw Error("VideoFrame not supported");let s=new VideoFrame(t,{timestamp:0});try{let o,l,h,u,c=null==s?void 0:s.format;if(!c||!c.startsWith("BGR")&&!c.startsWith("RGB"))throw Error(`Unrecognized format ${c}`);let d=c.startsWith("BGR"),p=new Uint8ClampedArray(a*n*4);if(yield s.copyTo(p,(o=4*Math.max(-i,0),l=(Math.max(0,r)-r)*a*4+o,h=Math.max(0,i),u=Math.max(0,r),{rect:{x:h,y:u,width:Math.min(t.width,i+a)-h,height:Math.min(t.height,r+n)-u},layout:[{offset:l,stride:4*a}]})),d)for(let t=0;t<p.length;t+=4){let i=p[t];p[t]=p[t+2],p[t+2]=i}return p}finally{s.close()}})}function ek(t,i,r,a){return t.addEventListener(i,r,a),{unsubscribe:()=>{t.removeEventListener(i,r,a)}}}function eR(t){return t*Math.PI/180}function eL(t){return t/Math.PI*180}let eF={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0}
1,eB={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},eO="AbortError";class eV extends Error{constructor(t=eO){super(t instanceof Error?t.message:t),this.name=eO,t instanceof Error&&t.stack&&(this.stack=t.stack)}}function ej(t){return t instanceof Error&&t.name===eO}function eN(t){if(t.aborted)throw new eV(t.reason)}let eU={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function eG(t){return eU.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}let e$="global-dispatcher";class eZ extends Error{constructor(t,i,r,a){super(`AJAXError: ${i} (${t}): ${r}`),this.status=t,this.statusText=i,this.url=r,this.body=a}}let eq=()=>{var t;return eE(self)?null==(t=self.worker)?void 0:t.referrer:("blob:"===window.location.protocol?window.parent:window).location.href},eW=function(t,i){return b(this,void 0,void 0,function*(){var r,a,n,s;if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let a=eG(t.url);if(a){let r=yield a(t,i);return r.data||"arrayBuffer"!==t.type?r:ev(r,{data:new ArrayBuffer(0)})}if(eE(self)&&(null==(r=self.worker)?void 0:r.actor))return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:e$},i)}if(!((n=t.url).startsWith("file:")||(null==(s=eq())?void 0:s.startsWith("file:"))&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return function(t,i){return b(this,void 0,void 0,function*(){let r,a,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:eq(),referrerPolicy:t.referrerPolicy,signal:i.signal});"json"!==t.type||n.headers.has("Accept")||n.headers.set("Accept","application/json");try{r=yield fetch(n)}catch(i){if(ej(i))throw i;throw new eZ(0,ed(i).message,t.url,new Blob)}if(!r.ok){let i=yield r.blob();throw new eZ(r.status,r.statusText,t.url,i)}a="arrayBuffer"===t.type||"image"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text();let s=yield a;return eN(i.signal),{data:s,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),etag:r.headers.get("ETag")}})}(t,i);if(eE(self)&&(null==(a=self.worker)?void 0:a.actor))return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:e$},i)}return new Promise((r,a)=>{var n;let s=new XMLHttpRequest;for(let i in s.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(s.responseType="arraybuffer"),t.headers)s.setRequestHeader(i,t.headers[i]);"json"===t.type&&(s.responseType="text",(null==(n=t.headers)?void 0:n.Accept)||s.setRequestHeader("Accept","application/json")),s.withCredentials="include"===t.credentials,s.onerror=()=>{a(Error(s.statusText))},s.onload=()=>{if(!i.signal.aborted)if((s.status>=200&&s.status<300||0===s.status)&&null!==s.response){let i=s.response;if("json"===t.type)try{i=JSON.parse(s.response)}catch(t){return void a(t)}r({data:i,cacheControl:s.getResponseHeader("Cache-Control"),expires:s.getResponseHeader("Expires"),etag:s.getResponseHeader("ETag")})}else{let i=new Blob([s.response],{type:s.getResponseHeader("Content-Type")});a(new eZ(s.status,s.statusText,t.url,i))}},i.signal.addEventListener("abort",()=>{s.abort(),a(new eV(i.signal.reason))}),s.send(t.body)})})};function eH(t){if(!t||0>=t.indexOf("://")||t.startsWith("data:image/")||t.startsWith("blob:"))return!0;let i=new URL(t),r=window.location;return i.protocol===r.protocol&&i.host===r.host}function eX(t,i,r){var a;(null==(a=r[t])?void 0:a.includes(i))||(r[t]||(r[t]=[]),r[t].push(i))}function eY(t,i,r){if(null==r?void 0:r[t]){let a=r[t].indexOf(i);-1!==a&&r[t].splice(a,1)}}class eK{constructor(t,i={}){ev(this,i),this.type=t}}class eJ extends eK{constructor(t,i={}){super("error",ev({error:t},i))}}class eQ{on(t,i){return this._listeners||(this._listeners={}),eX(t,i,this._listeners),{unsubscribe:()=>{this.off(t,i)}}}off(t,i){return eY(t,i,this._listeners),eY(t,i,this._oneTimeListeners),this}once(t,i){return i?(this._oneTimeListeners||(this._oneTimeListeners={}),eX(t,i,this._oneTimeListeners),this):new Promise(i=>this.once(t,i))}fire(t,i){var r,a;"string"==typeof t&&(t=new eK(t,i||{}));let n=t.type;if(this.listens(n)){for(let i of(t.target=this,(null==(r=this._listeners)?void 0:r[n])?this._listeners[n].slice():[]))i.call(this,t);for(let i of(null==(a=this._oneTimeListeners)?void 0:a[n])?this._oneTimeListeners[n].slice():[])eY(n,i,this._oneTimeListeners),i.call(this,t);let i=this._eventedParent;i&&(ev(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t))}else t instanceof eJ&&console.error(t.error);return this}listens(t){var i,r,a,n,s;return(null==(r=null==(i=this._listeners)?void 0:i[t])?void 0:r.length)>0||(null==(n=null==(a=this._oneTimeListeners)?void 0:a[t])?void 0:n.length)>0||(null==(s=this._eventedParent)?void 0:s.listens(t))}setEventedParent(t,i){return this._eventedParent=t,this._eventedParentData=i,this}}var e0={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"}
vendor: 28,891 bytes, line 1
1,bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}
1,"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};let e1=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function e2(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(!e2(t[r],i[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==i){if("object"!=typeof i||Object.keys(t).length!==Object.keys(i).length)return!1;for(let r in t)if(!e2(t[r],i[r]))return!1;return!0}return t===i}function e3(t,i){t.push(i)}function e5(t,i,r){e3(r,{command:"addSource",args:[t,i[t]]})}function e6(t,i,r){e3(i,{command:"removeSource",args:[t]}),r[t]=!0}function e4(t,i,r,a,n,s){for(let o in i=i||{},t=t||{})Object.prototype.hasOwnProperty.call(t,o)&&(e2(t[o],i[o])||r.push({command:s,args:[a,o,i[o],n]}));for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&!Object.prototype.hasOwnProperty.call(t,o)&&(e2(t[o],i[o])||r.push({command:s,args:[a,o,i[o],n]}))}function e8(t){return t.id}function e7(t,i){return t[i.id]=i,t}class e9{constructor(t,i,r,a){this.message=(t?`${t}: `:"")+r,a&&(this.identifier=a),null!=i&&i.__line__&&(this.line=i.__line__)}}function te(t,...i){for(let r of i)for(let i in r)t[i]=r[i];return t}
1class tt extends Error{constructor(t,i){super(i),this.message=i,this.key=t}}class ti{constructor(t,i=[]){for(const[r,a]of(this.parent=t,this.bindings={},i))this.bindings[r]=a}concat(t){return new ti(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}let tr={kind:"null"},ta={kind:"number"},tn={kind:"string"},ts={kind:"boolean"},to={kind:"color"},tl={kind:"projectionDefinition"},th={kind:"object"},tu={kind:"value"},tc={kind:"collator"},td={kind:"formatted"},tp={kind:"padding"},tf={kind:"colorArray"},tm={kind:"numberArray"},t_={kind:"resolvedImage"},tg={kind:"variableAnchorOffsetCollection"};function ty(t,i){return{kind:"array",itemType:t,N:i}}function tx(t){if("array"===t.kind){let i=tx(t.itemType);return"number"==typeof t.N?`array<${i}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${i}>`}return t.kind}let tv=[tr,ta,tn,ts,to,tl,td,th,ty(tu),tp,tm,tf,t_,tg];function tb(t,i){if("error"===i.kind)return null;if("array"===t.kind){if("array"===i.kind&&(0===i.N&&"value"===i.itemType.kind||!tb(t.itemType,i.itemType))&&("number"!=typeof t.N||t.N===i.N))return null}else{if(t.kind===i.kind)return null;if("value"===t.kind){for(let t of tv)if(!tb(t,i))return null}}return`Expected ${tx(t)} but found ${tx(i)} instead.`}function tw(t,i){return i.some(i=>i.kind===t.kind)}function tT(t,i){return i.some(i=>"null"===i?null===t:"array"===i?Array.isArray(t):"object"===i?t&&!Array.isArray(t)&&"object"==typeof t:i===typeof t)}function tS(t,i){return"array"===t.kind&&"array"===i.kind?t.itemType.kind===i.itemType.kind&&"number"==typeof t.N:t.kind===i.kind}let tP=4/29,tM=6/29,tI=6/29*3*(6/29),tE=6/29*(6/29)*(6/29),tC=Math.PI/180,tA=180/Math.PI;function tD(t){return(t%=360)<0&&(t+=360),t}function tz([t,i,r,a]){let n,s,o=tR((.2225045*(t=tk(t))+.7168786*(i=tk(i))+.0606169*(r=tk(r)))/1);t===i&&i===r?n=s=o:(n=tR((.4360747*t+.3850649*i+.1430804*r)/.96422),s=tR((.0139322*t+.0971045*i+.7141733*r)/.82521));let l=116*o-16;return[l<0?0:l,500*(n-o),200*(o-s),a]}function tk(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function tR(t){return t>tE?Math.pow(t,1/3):t/tI+tP}function tL([t,i,r,a]){let n=(t+16)/116,s=isNaN(i)?n:n+i/500,o=isNaN(r)?n:n-r/200;return n=+tB(n),[tF(3.1338561*(s=.96422*tB(s))-1.6168667*n-.4906146*(o=.82521*tB(o))),tF(-.9787684*s+1.9161415*n+.033454*o),tF(.0719453*s-.2289914*n+1.4052427*o),a]}
1function tF(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function tB(t){return t>tM?t*t*t:tI*(t-tP)}let tO=Object.hasOwn||function(t,i){return Object.prototype.hasOwnProperty.call(t,i)};function tV(t,i){return tO(t,i)?t[i]:void 0}function tj(t){return parseInt(t.padEnd(2,t),16)/255}function tN(t,i){return tU(i?t/100:t,0,1)}function tU(t,i,r){return Math.min(Math.max(i,t),r)}function tG(t){return!t.some(Number.isNaN)}let t$={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function tZ(t,i,r){return t.map((t,a)=>t+r*(i[a]-t))}class tq{constructor(t,i,r,a=1,n=!0){this.r=t,this.g=i,this.b=r,this.a=a,n||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[t,i,r,a]))}static parse(t){if(t instanceof tq)return t;if("string"!=typeof t)return;let i=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];let i=tV(t$,t);if(i){let[t,r,a]=i;return[t/255,r/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let i=t.length<6?1:2,r=1;return[tj(t.slice(r,r+=i)),tj(t.slice(r,r+=i)),tj(t.slice(r,r+=i)),tj(t.slice(r,r+i)||"ff")]}if(t.startsWith("rgb")){let i=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[t,r,a,n,s,o,l,h,u,c,d,p]=i,f=[n||" ",l||" ",c].join("");if("  "===f||"  /"===f||",,"===f||",,,"===f){let t=[a,o,u].join(""),i="%%%"===t?100:255*(""===t);if(i){let t=[tU(r/i,0,1),tU(s/i,0,1),tU(h/i,0,1),d?tN(+d,p):1];if(tG(t))return t}}return}}let r=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[t,i,a,n,s,o,l,h,u]=r,c=[a||" ",s||" ",l].join("");if("  "===c||"  /"===c||",,"===c||",,,"===c){let t=[+i,tU(+n,0,100),tU(+o,0,100),h?tN(+h,u):1];if(tG(t))return function([t,i,r,a]){function n(a){let n=(a+t/30)%12,s=i*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(n-3,9-n,1))}return t=tD(t),i/=100,r/=100,[n(0),n(8),n(4),a]}(t)}}}(t);return i?new tq(...i,!1):void 0}get rgb(){let{r:t,g:i,b:r,a:a}=this,n=a||1/0;return this.overwriteGetter("rgb",[t/n,i/n,r/n,a])}get hcl(){return this.overwriteGetter("hcl",function(t){let[i,r,a,n]=tz(t),s=Math.sqrt(r*r+a*a);return[Math.round(1e4*s)?tD(Math.atan2(a,r)*tA):NaN,s,i,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",tz(this.rgb))}overwriteGetter(t,i){return Object.defineProperty(this,t,{value:i}),i}toString(){let[t,i,r,a]=this.rgb;return`rgba(${[t,i,r].map(t=>Math.round(255*t)).join(",")},${a})`}static interpolate(t,i,r,a="rgb"){switch(a){case"rgb":{let[a,n,s,o]=tZ(t.rgb,i.rgb,r);return new tq(a,n,s,o,!1)}case"hcl":{let a,n,[s,o,l,h]=t.hcl,[u,c,d,p]=i.hcl;if(isNaN(s)||isNaN(u))isNaN(s)?isNaN(u)?a=NaN:(a=u,1!==l&&0!==l||(n=c)):(a=s,1!==d&&0!==d||(n=o));else{let t=u-s;u>s&&t>180?t-=360:u<s&&s-u>180&&(t+=360),a=s+r*t}let[f,m,_,g]=function([t,i,r,a]){return tL([r,Math.cos(t=isNaN(t)?0:t*tC)*i,Math.sin(t)*i,a])}([a,null!=n?n:o+r*(c-o),l+r*(d-l),h+r*(p-h)]);return new tq(f,m,_,g,!1)}case"lab":{let[a,n,s,o]=tL(tZ(t.lab,i.lab,r));return new tq(a,n,s,o,!1)}}}}tq.black=new tq(0,0,0,1),tq.white=new tq(1,1,1,1),tq.transparent=new tq(0,0,0,0),tq.red=new tq(1,0,0,1);class tW{constructor(t,i,r){this.sensitivity=t?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,i){return this.collator.compare(t,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let tH=["bottom","center","top"];class tX{constructor(t,i,r,a,n,s){this.text=t,this.image=i,this.scale=r,this.fontStack=a,this.textColor=n,this.verticalAlign=s}}class tY{constructor(t){this.sections=t}
1static fromString(t){return new tY([new tX(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof tY?t:tY.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class tK{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof tK)return t;if("number"==typeof t)return new tK([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let i of t)if("number"!=typeof i)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new tK(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new tK(tZ(t.values,i.values,r))}}class tJ{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof tJ)return t;if("number"==typeof t)return new tJ([t]);if(Array.isArray(t)){for(let i of t)if("number"!=typeof i)return;return new tJ(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new tJ(tZ(t.values,i.values,r))}}class tQ{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof tQ)return t;if("string"==typeof t){let i=tq.parse(t);if(!i)return;return new tQ([i])}if(!Array.isArray(t))return;let i=[];for(let r of t){if("string"!=typeof r)return;let t=tq.parse(r);if(!t)return;i.push(t)}return new tQ(i)}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r,a="rgb"){let n=[];if(t.values.length!=i.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)n.push(tq.interpolate(t.values[s],i.values[s],r,a));return new tQ(n)}}class t0 extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}let t1=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class t2{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof t2)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let i=0;i<t.length;i+=2){let r=t[i],a=t[i+1];if("string"!=typeof r||!t1.has(r)||!Array.isArray(a)||2!==a.length||"number"!=typeof a[0]||"number"!=typeof a[1])return}return new t2(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){let a=t.values,n=i.values;if(a.length!==n.length)throw new t0(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${i.toString()}`);let s=[];for(let t=0;t<a.length;t+=2){if(a[t]!==n[t])throw new t0(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${a[t]}, to[${t}]: ${n[t]}`);s.push(a[t]);let[i,o]=a[t+1],[l,h]=n[t+1];s.push([i+r*(l-i),o+r*(h-o)])}return new t2(s)}}class t3{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new t3({name:t,available:!1}):null}}class t5{constructor(t,i,r){this.from=t,this.to=i,this.transition=r}static interpolate(t,i,r){return new t5(t,i,r)}static parse(t){return t instanceof t5?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new t5(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new t5(t.from,t.to,t.transition):"string"==typeof t?new t5(t,t,1):void 0}}function t6(t,i,r,a){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[t,i,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[t,i,r,a]:[t,i,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function t4(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof t5||t instanceof tq||t instanceof tW||t instanceof tY||t instanceof tK||t instanceof tJ||t instanceof tQ||t instanceof t2||t instanceof t3)return!0;if(Array.isArray(t)){for(let i of t)if(!t4(i))return!1;return!0}if("object"==typeof t){for(let i in t)if(!t4(t[i]))return!1;return!0}return!1}function t8(t){if(null===t)return tr;if("string"==typeof t)return tn;if("boolean"==typeof t)return ts;if("number"==typeof t)return ta;if(t instanceof tq)return to;if(t instanceof t5)return tl;if(t instanceof tW)return tc;if(t instanceof tY)return td;if(t instanceof tK)return tp;if(t instanceof tJ)return tm;if(t instanceof tQ)return tf;if(t instanceof t2)return tg;if(t instanceof t3)return t_;if(Array.isArray(t)){let i,r=t.length;for(let r of t){let t=t8(r);if(i){if(i===t)continue;i=tu;break}i=t}return ty(i||tu,r)}return th}function t7(t){let i=typeof t;return null===t?"":"string"===i||"number"===i||"boolean"===i?String(t):t instanceof tq||t instanceof t5||t instanceof tY||t instanceof tK||t instanceof tJ||t instanceof tQ||t instanceof t2||t instanceof t3?t.toString():JSON.stringify(t)}class t9{constructor(t,i){this.type=t,this.value=i}static parse(t,i){if(2!==t.length)return i.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!t4(t[1]))return i.error("invalid value");let r=t[1],a=t8(r),n=i.expectedType;return"array"===a.kind&&0===a.N&&n&&"array"===n.kind&&("number"!=typeof n.N||0===n.N)&&(a=n),new t9(a,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let ie={string:tn,number:ta,boolean:ts,object:th};class it{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r,a=1,n=t[0];if("array"===n){let n,s;if(t.length>2){let r=t[1];if("string"!=typeof r||!(r in ie)||"object"===r)return i.error('The item type argument of "array" must be one of string, number, boolean',1);n=ie[r],a++}else n=tu;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);s=t[2],a++}r=ty(n,s)}else{if(!ie[n])throw Error(`Types doesn't contain name = ${n}`);r=ie[n]}let s=[];for(;a<t.length;a++){let r=i.parse(t[a],a,tu);if(!r)return null;s.push(r)}return new it(r,s)}evaluate(t){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(t);if(!tb(this.type,t8(r)))return r;if(i===this.args.length-1)throw new t0(`Expected value to be of type ${tx(this.type)}, but found ${tx(t8(r))} instead.`)}throw Error()}
1eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}let ii={"to-boolean":ts,"to-color":to,"to-number":ta,"to-string":tn};class ir{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[0];if(!ii[r])throw Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return i.error("Expected one argument.");let a=ii[r],n=[];for(let r=1;r<t.length;r++){let a=i.parse(t[r],r,tu);if(!a)return null;n.push(a)}return new ir(a,n)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let i,r;for(let a of this.args){if(i=a.evaluate(t),r=null,i instanceof tq)return i;if("string"==typeof i){let r=t.parseColor(i);if(r)return r}else if(Array.isArray(i)&&!(r=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:t6(i[0],i[1],i[2],i[3])))return new tq(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new t0(r||`Could not parse color from value '${"string"==typeof i?i:JSON.stringify(i)}'`)}case"padding":{let i;for(let r of this.args){i=r.evaluate(t);let a=tK.parse(i);if(a)return a}throw new t0(`Could not parse padding from value '${"string"==typeof i?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(let r of this.args){i=r.evaluate(t);let a=tJ.parse(i);if(a)return a}throw new t0(`Could not parse numberArray from value '${"string"==typeof i?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(let r of this.args){i=r.evaluate(t);let a=tQ.parse(i);if(a)return a}throw new t0(`Could not parse colorArray from value '${"string"==typeof i?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(let r of this.args){i=r.evaluate(t);let a=t2.parse(i);if(a)return a}throw new t0(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof i?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(let r of this.args){if(null===(i=r.evaluate(t)))return 0;let a=Number(i);if(!isNaN(a))return a}throw new t0(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return tY.fromString(t7(this.args[0].evaluate(t)));case"resolvedImage":return t3.fromString(t7(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return t7(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}let ia=["Unknown","Point","LineString","Polygon"];class is{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?ia[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let i=this._parseColorCache.get(t);return i||(i=tq.parse(t),this._parseColorCache.set(t,i)),i}}class io{constructor(t,i,r=[],a,n=new ti,s=[]){this.registry=t,this.path=r,this.key=r.map(t=>`[${t}]`).join(""),this.scope=n,this.errors=s,this.expectedType=a,this._isConstant=i}parse(t,i,r,a,n={}){return i?this.concat(i,r,a)._parse(t,n):this._parse(t,n)}_parse(t,i){function r(t,i,r){return"assert"===r?new it(i,[t]):"coerce"===r?new ir(i,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let a=t[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 n=this.registry[a];if(n){let a=n.parse(t,this);if(!a)return null;if(this.expectedType){let t=this.expectedType,n=a.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===t.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(n.kind))a=r(a,t,i.typeAnnotation||"coerce");else if(this.checkSubtype(t,n))return null}
1else a=r(a,t,i.typeAnnotation||"assert")}if(!(a instanceof t9)&&"resolvedImage"!==a.type.kind&&this._isConstant(a)){let t=new is;try{a=new t9(a.type,a.evaluate(t))}catch(t){return this.error(t.message),null}}return a}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,i,r){let a="number"==typeof t?this.path.concat(t):this.path,n=r?this.scope.concat(r):this.scope;return new io(this.registry,this._isConstant,a,i||null,n,this.errors)}error(t,...i){let r=`${this.key}${i.map(t=>`[${t}]`).join("")}`;this.errors.push(new tt(r,t))}checkSubtype(t,i){let r=tb(t,i);return r&&this.error(r),r}}class il{constructor(t,i){this.type=i.type,this.bindings=[].concat(t),this.result=i}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let i of this.bindings)t(i[1]);t(this.result)}static parse(t,i){if(t.length<4)return i.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let r=[];for(let a=1;a<t.length-1;a+=2){let n=t[a];if("string"!=typeof n)return i.error(`Expected string, but found ${typeof n} instead.`,a);if(/[^a-zA-Z0-9_]/.test(n))return i.error("Variable names must contain only alphanumeric characters or '_'.",a);let s=i.parse(t[a+1],a+1);if(!s)return null;r.push([n,s])}let a=i.parse(t[t.length-1],t.length-1,i.expectedType,r);return a?new il(r,a):null}outputDefined(){return this.result.outputDefined()}}class ih{constructor(t,i){this.type=i.type,this.name=t,this.boundExpression=i}static parse(t,i){if(2!==t.length||"string"!=typeof t[1])return i.error("'var' expression requires exactly one string literal argument.");let r=t[1];return i.scope.has(r)?new ih(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class iu{constructor(t,i,r){this.type=t,this.index=i,this.input=r}static parse(t,i){if(3!==t.length)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,ta),a=i.parse(t[2],2,ty(i.expectedType||tu));return r&&a?new iu(a.type.itemType,r,a):null}evaluate(t){let i=this.index.evaluate(t),r=this.input.evaluate(t);if(i<0)throw new t0(`Array index out of bounds: ${i} < 0.`);if(i>=r.length)throw new t0(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i!==Math.floor(i))throw new t0(`Array index must be an integer, but found ${i} instead.`);return r[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class ic{constructor(t,i){this.type=ts,this.needle=t,this.haystack=i}static parse(t,i){if(3!==t.length)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,tu),a=i.parse(t[2],2,tu);return r&&a?tw(r.type,[ts,tn,ta,tr,tu])?new ic(r,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${tx(r.type)} instead`):null}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!tT(i,["boolean","string","number","null"]))throw new t0(`Expected first argument to be of type boolean, string, number or null, but found ${tx(t8(i))} instead.`);if(!tT(r,["string","array"]))throw new t0(`Expected second argument to be of type array or string, but found ${tx(t8(r))} instead.`);return r.indexOf(i)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class id{constructor(t,i,r){this.type=ta,this.needle=t,this.haystack=i,this.fromIndex=r}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,tu),a=i.parse(t[2],2,tu);if(!r||!a)return null;if(!tw(r.type,[ts,tn,ta,tr,tu]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${tx(r.type)} instead`);if(4===t.length){let n=i.parse(t[3],3,ta);return n?new id(r,a,n):null}return new id(r,a)}evaluate(t){let i,r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!tT(r,["boolean","string","number","null"]))throw new t0(`Expected first argument to be of type boolean, string, number or null, but found ${tx(t8(r))} instead.`);if(this.fromIndex&&(i=this.fromIndex.evaluate(t)),tT(a,["string"])){let t=a.indexOf(r,i);return -1===t?-1:[...a.slice(0,t)].length}if(tT(a,["array"]))return a.indexOf(r,i);throw new t0(`Expected second argument to be of type array or string, but found ${tx(t8(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class ip{constructor(t,i,r,a,n,s){this.inputType=t,this.type=i,this.input=r,this.cases=a,this.outputs=n,this.otherwise=s}static parse(t,i){let r,a;
1if(t.length<5)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return i.error("Expected an even number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(a=i.expectedType);let n={},s=[];for(let o=2;o<t.length-1;o+=2){let l=t[o],h=t[o+1];Array.isArray(l)||(l=[l]);let u=i.concat(o);if(0===l.length)return u.error("Expected at least one branch label.");for(let t of l){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,t8(t)))return null}else r=t8(t);if(void 0!==n[String(t)])return u.error("Branch labels must be unique.");n[String(t)]=s.length}let c=i.parse(h,o,a);if(!c)return null;a=a||c.type,s.push(c)}let o=i.parse(t[1],1,tu);if(!o)return null;let l=i.parse(t[t.length-1],t.length-1,a);return l?"value"!==o.type.kind&&i.concat(1).checkSubtype(r,o.type)?null:new ip(r,a,o,n,s,l):null}evaluate(t){let i=this.input.evaluate(t);return(t8(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class im{constructor(t,i,r){this.type=t,this.branches=i,this.otherwise=r}static parse(t,i){let r;if(t.length<4)return i.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return i.error("Expected an odd number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(r=i.expectedType);let a=[];for(let n=1;n<t.length-1;n+=2){let s=i.parse(t[n],n,ts);if(!s)return null;let o=i.parse(t[n+1],n+1,r);if(!o)return null;a.push([s,o]),r=r||o.type}let n=i.parse(t[t.length-1],t.length-1,r);if(!n)return null;if(!r)throw Error("Can't infer output type");return new im(r,a,n)}evaluate(t){for(let[i,r]of this.branches)if(i.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[i,r]of this.branches)t(i),t(r);t(this.otherwise)}outputDefined(){return this.branches.every(([t,i])=>i.outputDefined())&&this.otherwise.outputDefined()}}class i_{constructor(t,i,r,a){this.type=t,this.input=i,this.beginIndex=r,this.endIndex=a}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,tu),a=i.parse(t[2],2,ta);if(!r||!a)return null;if(!tw(r.type,[ty(tu),tn,tu]))return i.error(`Expected first argument to be of type array or string, but found ${tx(r.type)} instead`);if(4===t.length){let n=i.parse(t[3],3,ta);return n?new i_(r.type,r,a,n):null}return new i_(r.type,r,a)}evaluate(t){let i,r=this.input.evaluate(t),a=this.beginIndex.evaluate(t);if(this.endIndex&&(i=this.endIndex.evaluate(t)),tT(r,["string"]))return[...r].slice(a,i).join("");if(tT(r,["array"]))return r.slice(a,i);throw new t0(`Expected first argument to be of type array or string, but found ${tx(t8(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ig(t,i){let r=t.length-1,a,n,s=0,o=r,l=0;for(;s<=o;)if(a=t[l=Math.floor((s+o)/2)],n=t[l+1],a<=i){if(l===r||i<n)return l;s=l+1}else{if(!(a>i))throw new t0("Input is not a number.");o=l-1}return 0}class iy{constructor(t,i,r){for(const[a,n]of(this.type=t,this.input=i,this.labels=[],this.outputs=[],r))this.labels.push(a),this.outputs.push(n)}static parse(t,i){if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");let r=i.parse(t[1],1,ta);if(!r)return null;let a=[],n=null;i.expectedType&&"value"!==i.expectedType.kind&&(n=i.expectedType);for(let r=1;r<t.length;r+=2){let s=1===r?-1/0:t[r],o=t[r+1],l=r,h=r+1;if("number"!=typeof s)return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',l);if(a.length&&a[a.length-1][0]>=s)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',l);let u=i.parse(o,h,n);if(!u)return null;n=n||u.type,a.push([s,u])}return new iy(n,r,a)}evaluate(t){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(t);let a=this.input.evaluate(t);if(a<=i[0])return r[0].evaluate(t);let n=i.length;return a>=i[n-1]?r[n-1].evaluate(t):r[ig(i,a)].evaluate(t)}eachChild(t){for(let i of(t(this.input),this.outputs))t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}var ix,iv,ib,iw,iT,iS,iP=(iw=function(){if(iS)return iT;function t(t,i,r,a){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=r,this.p2y=a}return iS=1,iT=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(void 0===i&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,a=0;a<8;a++){var n=this.sampleCurveX(r)-t;if(Math.abs(n)<i)return r;var s=this.sampleCurveDerivativeX(r);if(1e-6>Math.abs(s))break;r-=n/s}var o=0,l=1;for(r=t,a=0;a<20&&!(Math.abs((n=this.sampleCurveX(r))-t)<i);a++)t>n?o=r:l=r,r=.5*(l-o)+o;return r},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},iT}())&&iw.__esModule&&Object.prototype.hasOwnProperty.call(iw,"default")?iw.default:iw;class iM{constructor(t,i,r,a,n){for(const[s,o]of(this.type=t,this.operator=i,this.interpolation=r,this.input=a,this.labels=[],this.outputs=[],n))this.labels.push(s),this.outputs.push(o)}static interpolationFactor(t,i,r,a){let n=0;if("exponential"===t.name)n=iI(i,t.base,r,a);else if("linear"===t.name)n=iI(i,1,r,a);else if("cubic-bezier"===t.name){let s=t.controlPoints;n=new iP(s[0],s[1],s[2],s[3]).solve(iI(i,1,r,a))}return n}static parse(t,i){let[r,a,n,...s]=t;if(!Array.isArray(a)||0===a.length)return i.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){let t=a[1];if("number"!=typeof t)return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:t}}else{if("cubic-bezier"!==a[0])return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{let t=a.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(!(n=i.parse(n,2,ta)))return null;let o=[],l=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||i.expectedType==tf?i.expectedType&&"value"!==i.expectedType.kind&&(l=i.expectedType):l=to;for(let t=0;t<s.length;t+=2){let r=s[t],a=s[t+1],n=t+3,h=t+4;if("number"!=typeof r)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(o.length&&o[o.length-1][0]>=r)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let u=i.parse(a,h,l);if(!u)return null;l=l||u.type,o.push([r,u])}return tS(l,ta)||tS(l,tl)||tS(l,to)||tS(l,tp)||tS(l,tm)||tS(l,tf)||tS(l,tg)||tS(l,ty(ta))?new iM(l,r,a,n,o):i.error(`Type ${tx(l)} is not interpolatable.`)}evaluate(t){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(t);let a=this.input.evaluate(t);if(a<=i[0])return r[0].evaluate(t);let n=i.length;if(a>=i[n-1])return r[n-1].evaluate(t);let s=ig(i,a),o=iM.interpolationFactor(this.interpolation,a,i[s],i[s+1]),l=r[s].evaluate(t),h=r[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return l+o*(h-l);case"color":return tq.interpolate(l,h,o);case"padding":return tK.interpolate(l,h,o);case"colorArray":return tQ.interpolate(l,h,o);case"numberArray":return tJ.interpolate(l,h,o);case"variableAnchorOffsetCollection":return t2.interpolate(l,h,o);case"array":return tZ(l,h,o);case"projectionDefinition":return t5.interpolate(l,h,o)}case"interpolate-hcl":switch(this.type.kind){case"color":return tq.interpolate(l,h,o,"hcl");case"colorArray":return tQ.interpolate(l,h,o,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return tq.interpolate(l,h,o,"lab");case"colorArray":return tQ.interpolate(l,h,o,"lab")}}}eachChild(t){for(let i of(t(this.input),this.outputs))t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function iI(t,i,r,a){let n=a-r,s=t-r;return 0===n?0:1===i?s/n:(Math.pow(i,s)-1)/(Math.pow(i,n)-1)}let iE={color:tq.interpolate,number:function(t,i,r){return t+r*(i-t)},padding:tK.interpolate,numberArray:tJ.interpolate,colorArray:tQ.interpolate,variableAnchorOffsetCollection:t2.interpolate,array:tZ};class iC{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=null,a=i.expectedType;a&&"value"!==a.kind&&(r=a);let n=[];for(let a of t.slice(1)){let t=i.parse(a,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,n.push(t)}if(!r)throw Error("No output type");return new iC(a&&n.some(t=>tb(a,t.type))?tu:r,n)}evaluate(t){let i,r=null,a=0;for(let n of this.args)if(a++,(r=n.evaluate(t))&&r instanceof t3&&!r.available&&(i||(i=r.name),r=null,a===this.args.length&&(r=i)),null!==r)break;return r}
1eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function iA(t,i){return"=="===t||"!="===t?"boolean"===i.kind||"string"===i.kind||"number"===i.kind||"null"===i.kind||"value"===i.kind:"string"===i.kind||"number"===i.kind||"value"===i.kind}function iD(t,i,r,a){return 0===a.compare(i,r)}function iz(t,i,r){let a="=="!==t&&"!="!==t;return class n{constructor(t,i,r){this.type=ts,this.lhs=t,this.rhs=i,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===i.type.kind}static parse(t,i){if(3!==t.length&&4!==t.length)return i.error("Expected two or three arguments.");let r=t[0],s=i.parse(t[1],1,tu);if(!s)return null;if(!iA(r,s.type))return i.concat(1).error(`"${r}" comparisons are not supported for type '${tx(s.type)}'.`);let o=i.parse(t[2],2,tu);if(!o)return null;if(!iA(r,o.type))return i.concat(2).error(`"${r}" comparisons are not supported for type '${tx(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return i.error(`Cannot compare types '${tx(s.type)}' and '${tx(o.type)}'.`);a&&("value"===s.type.kind&&"value"!==o.type.kind?s=new it(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new it(s.type,[o])));let l=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return i.error("Cannot use collator to compare non-string types.");if(!(l=i.parse(t[3],3,tc)))return null}return new n(s,o,l)}evaluate(n){let s=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(a&&this.hasUntypedArgument){let i=t8(s),r=t8(o);if(i.kind!==r.kind||"string"!==i.kind&&"number"!==i.kind)throw new t0(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${i.kind}, ${r.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let t=t8(s),r=t8(o);if("string"!==t.kind||"string"!==r.kind)return i(n,s,o)}return this.collator?r(n,s,o,this.collator.evaluate(n)):i(n,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}let ik=iz("==",function(t,i,r){return i===r},iD),iR=iz("!=",function(t,i,r){return i!==r},function(t,i,r,a){return!iD(0,i,r,a)}),iL=iz("<",function(t,i,r){return i<r},function(t,i,r,a){return 0>a.compare(i,r)}),iF=iz(">",function(t,i,r){return i>r},function(t,i,r,a){return a.compare(i,r)>0}),iB=iz("<=",function(t,i,r){return i<=r},function(t,i,r,a){return 0>=a.compare(i,r)}),iO=iz(">=",function(t,i,r){return i>=r},function(t,i,r,a){return a.compare(i,r)>=0});class iV{constructor(t,i,r){this.type=tc,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}static parse(t,i){if(2!==t.length)return i.error("Expected one argument.");let r=t[1];if("object"!=typeof r||Array.isArray(r))return i.error("Collator options argument must be an object.");let a=i.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,ts);if(!a)return null;let n=i.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,ts);if(!n)return null;let s=null;return!r.locale||(s=i.parse(r.locale,1,tn))?new iV(a,n,s):null}evaluate(t){return new tW(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class ij{constructor(t,i,r,a,n,s){this.type=tn,this.number=t,this.locale=i,this.currency=r,this.unit=a,this.minFractionDigits=n,this.maxFractionDigits=s}static parse(t,i){if(3!==t.length)return i.error("Expected two arguments.");let r=i.parse(t[1],1,ta);if(!r)return null;let a=t[2];if("object"!=typeof a||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let n=null;if(a.locale&&!(n=i.parse(a.locale,1,tn)))return null;let s=null;if(a.currency&&!(s=i.parse(a.currency,1,tn)))return null;let o=null;if(a.unit&&!(o=i.parse(a.unit,1,tn)))return null;if(s&&o)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(a["min-fraction-digits"]&&!(l=i.parse(a["min-fraction-digits"],1,ta)))return null;let h=null;return!a["max-fraction-digits"]||(h=i.parse(a["max-fraction-digits"],1,ta))?new ij(r,n,s,o,l,h):null}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class iN{constructor(t){this.type=td,this.sections=t}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return i.error("First argument must be an image or text section.");let a=[],n=!1;for(let r=1;r<=t.length-1;++r){let s=t[r];
1if(n&&"object"==typeof s&&!Array.isArray(s)){n=!1;let t=null;if(s["font-scale"]&&!(t=i.parse(s["font-scale"],1,ta)))return null;let r=null;if(s["text-font"]&&!(r=i.parse(s["text-font"],1,ty(tn))))return null;let o=null;if(s["text-color"]&&!(o=i.parse(s["text-color"],1,to)))return null;let l=null;if(s["vertical-align"]){if("string"==typeof s["vertical-align"]&&!tH.includes(s["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(!(l=i.parse(s["vertical-align"],1,tn)))return null}let h=a[a.length-1];h.scale=t,h.font=r,h.textColor=o,h.verticalAlign=l}else{let s=i.parse(t[r],1,tu);if(!s)return null;let o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,a.push({content:s,scale:null,font:null,textColor:null,verticalAlign:null})}}return new iN(a)}evaluate(t){return new tY(this.sections.map(i=>{let r=i.content.evaluate(t);return t8(r)===t_?new tX("",r,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(t):null):new tX(t7(r),null,i.scale?i.scale.evaluate(t):null,i.font?i.font.evaluate(t).join(","):null,i.textColor?i.textColor.evaluate(t):null,i.verticalAlign?i.verticalAlign.evaluate(t):null)}))}eachChild(t){for(let i of this.sections)t(i.content),i.scale&&t(i.scale),i.font&&t(i.font),i.textColor&&t(i.textColor),i.verticalAlign&&t(i.verticalAlign)}outputDefined(){return!1}}class iU{constructor(t){this.type=t_,this.input=t}static parse(t,i){if(2!==t.length)return i.error("Expected two arguments.");let r=i.parse(t[1],1,tn);return r?new iU(r):i.error("No image name provided.")}evaluate(t){let i=this.input.evaluate(t),r=t3.fromString(i);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(i)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}}class iG{constructor(t){this.type=ta,this.input=t}static parse(t,i){if(2!==t.length)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);let r=i.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?i.error(`Expected argument of type string or array, but found ${tx(r.type)} instead.`):new iG(r):null}evaluate(t){let i=this.input.evaluate(t);if("string"==typeof i)return[...i].length;if(Array.isArray(i))return i.length;throw new t0(`Expected value to be of type string or array, but found ${tx(t8(i))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}function i$(t,i){let r=Math.pow(2,i.z);return[360*((t[0]/8192+i.x)/r)-180,360/Math.PI*Math.atan(Math.exp((180-360*((t[1]/8192+i.y)/r))*Math.PI/180))-90]}function iZ(t,i){t[0]=Math.min(t[0],i[0]),t[1]=Math.min(t[1],i[1]),t[2]=Math.max(t[2],i[0]),t[3]=Math.max(t[3],i[1])}function iq(t,i){return!(t[0]<=i[0]||t[2]>=i[2]||t[1]<=i[1]||t[3]>=i[3])}function iW(t,i,r,a){var n,s;return 0!=(n=[a[0]-r[0],a[1]-r[1]])[0]*(s=[i[0]-t[0],i[1]-t[1]])[1]-n[1]*s[0]&&!(!iY(t,i,r,a)||!iY(r,a,t,i))}function iH(t,i,r=!1){var a,n;let s=!1;for(let o of i)for(let i=0;i<o.length-1;i++){if(function(t,i,r){let a=t[0]-i[0],n=t[1]-i[1],s=t[0]-r[0],o=t[1]-r[1];return a*o-s*n==0&&a*s<=0&&n*o<=0}(t,o[i],o[i+1]))return r;(a=o[i])[1]>t[1]!=(n=o[i+1])[1]>t[1]&&t[0]<(n[0]-a[0])*(t[1]-a[1])/(n[1]-a[1])+a[0]&&(s=!s)}return s}function iX(t,i){for(let r of t)if(!iH(r,i))return!1;for(let r=0;r<t.length-1;++r)if(function(t,i,r){for(let a of r)for(let r=0;r<a.length-1;++r)if(iW(t,i,a[r],a[r+1]))return!0;return!1}(t[r],t[r+1],i))return!1;return!0}function iY(t,i,r,a){let n=a[0]-r[0],s=a[1]-r[1],o=(t[0]-r[0])*s-n*(t[1]-r[1]),l=(i[0]-r[0])*s-n*(i[1]-r[1]);return o>0&&l<0||o<0&&l>0}function iK(t,i,r){let a=[];for(let n=0;n<t.length;n++){let s=[];for(let a=0;a<t[n].length;a++){let o=function(t,i){let r=(180+t[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,i.z);return[Math.round(r*n*8192),Math.round(a*n*8192)]}(t[n][a],r);iZ(i,o),s.push(o)}a.push(s)}return a}function iJ(t,i,r){let a=[];for(let n=0;n<t.length;n++){let s=iK(t[n],i,r);a.push(s)}return a}function iQ(t,i,r,a){if(t[0]<r[0]||t[0]>r[2]){let i=.5*a,n=t[0]-r[0]>i?-a:r[0]-t[0]>i?a:0;0===n&&(n=t[0]-r[2]>i?-a:r[2]-t[0]>i?a:0),t[0]+=n}iZ(i,t)}function i0(t,i,r,a){let n=8192*Math.pow(2,a.z),s=[8192*a.x,8192*a.y],o=[];for(let a of t)for(let t of a){let a=[t.x+s[0],t.y+s[1]];iQ(a,i,r,n),o.push(a)}return o}function i1(t,i,r,a){let n=8192*Math.pow(2,a.z),s=[8192*a.x,8192*a.y],o=[];for(let r of t){let t=[];for(let a of r){let r=[a.x+s[0],a.y+s[1]];iZ(i,r),t.push(r)}o.push(t)}if(i[2]-i[0]<=n/2)for(let t of(i[0]=i[1]=1/0,i[2]=i[3]=-1/0,o))for(let a of t)iQ(a,i,r,n);return o}class i2{constructor(t,i){this.type=ts,this.geojson=t,this.geometries=i}static parse(t,i){if(2!==t.length)return i.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(t4(t[1])){let i=t[1];
1if("FeatureCollection"===i.type){let t=[];for(let r of i.features){let{type:i,coordinates:a}=r.geometry;"Polygon"===i&&t.push(a),"MultiPolygon"===i&&t.push(...a)}if(t.length)return new i2(i,{type:"MultiPolygon",coordinates:t})}else if("Feature"===i.type){let t=i.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new i2(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new i2(i,i)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===i.type){let s=iK(i.coordinates,a,n),o=i0(t.geometry(),r,a,n);if(!iq(r,a))return!1;for(let t of o)if(!iH(t,s))return!1}if("MultiPolygon"===i.type){let s=iJ(i.coordinates,a,n),o=i0(t.geometry(),r,a,n);if(!iq(r,a))return!1;for(let t of o)if(!function(t,i){for(let r of i)if(iH(t,r))return!0;return!1}(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if("Polygon"===i.type){let s=iK(i.coordinates,a,n),o=i1(t.geometry(),r,a,n);if(!iq(r,a))return!1;for(let t of o)if(!iX(t,s))return!1}if("MultiPolygon"===i.type){let s=iJ(i.coordinates,a,n),o=i1(t.geometry(),r,a,n);if(!iq(r,a))return!1;for(let t of o)if(!function(t,i){for(let r of i)if(iX(t,r))return!0;return!1}(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let i3=class{constructor(t=[],i=(t,i)=>t<i?-1:+(t>i)){if(this.data=t,this.length=this.data.length,this.compare=i,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;let t=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:i,compare:r}=this,a=i[t];for(;t>0;){let n=t-1>>1,s=i[n];if(r(a,s)>=0)break;i[t]=s,t=n}i[t]=a}_down(t){let{data:i,compare:r}=this,a=this.length>>1,n=i[t];for(;t<a;){let a=1+(t<<1),s=a+1;if(s<this.length&&0>r(i[s],i[a])&&(a=s),r(i[a],n)>=0)break;i[t]=i[a],t=a}i[t]=n}};function i5(t,i,r){let a=t[i];t[i]=t[r],t[r]=a}function i6(t,i){let r,a;if(t.length<=1)return[t];let n=[];for(let i of t){let t=function(t){let i=0;for(let r,a,n=0,s=t.length,o=s-1;n<s;o=n++)r=t[n],i+=((a=t[o]).x-r.x)*(r.y+a.y);return i}(i);0!==t&&(i.area=Math.abs(t),void 0===a&&(a=t<0),a===t<0?(r&&n.push(r),r=[i]):r.push(i))}if(r&&n.push(r),i>1)for(let t=0;t<n.length;t++)n[t].length<=i||(function t(i,r,a=0,n=i.length-1,s=function(t,i){return t<i?-1:+(t>i)}){for(;n>a;){if(n-a>600){let o=n-a+1,l=r-a+1,h=Math.log(o),u=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*u*(o-u)/o)*(l-o/2<0?-1:1);t(i,r,Math.max(a,Math.floor(r-l*u/o+c)),Math.min(n,Math.floor(r+(o-l)*u/o+c)),s)}let o=i[r],l=a,h=n;for(i5(i,a,r),s(i[n],o)>0&&i5(i,a,n);l<h;){for(i5(i,l,h),l++,h--;0>s(i[l],o);)l++;for(;s(i[h],o)>0;)h--}0===s(i[a],o)?i5(i,a,h):i5(i,++h,n),h<=r&&(a=h+1),r<=h&&(n=h-1)}}(n[t],i,1,n[t].length-1,i4),n[t]=n[t].slice(0,i));return n}function i4(t,i){return i.area-t.area}let i8=1/298.257223563*(2-1/298.257223563),i7=Math.PI/180;class i9{constructor(t){const i=6378.137*i7*1e3,r=Math.cos(t*i7),a=1/(1-i8*(1-r*r)),n=Math.sqrt(a);this.kx=i*n*r,this.ky=i*n*a*(1-i8)}distance(t,i){let r=this.wrap(t[0]-i[0])*this.kx,a=(t[1]-i[1])*this.ky;return Math.sqrt(r*r+a*a)}pointOnLine(t,i){let r,a,n,s,o=1/0;for(let l=0;l<t.length-1;l++){let h=t[l][0],u=t[l][1],c=this.wrap(t[l+1][0]-h)*this.kx,d=(t[l+1][1]-u)*this.ky,p=0;0===c&&0===d||((p=(this.wrap(i[0]-h)*this.kx*c+(i[1]-u)*this.ky*d)/(c*c+d*d))>1?(h=t[l+1][0],u=t[l+1][1]):p>0&&(h+=c/this.kx*p,u+=d/this.ky*p));let f=(c=this.wrap(i[0]-h)*this.kx)*c+(d=(i[1]-u)*this.ky)*d;f<o&&(o=f,r=h,a=u,n=l,s=p)}return{point:[r,a],index:n,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function re(t,i){return i[0]-t[0]}function rt(t){return t[1]-t[0]+1}function ri(t,i){return t[1]>=t[0]&&t[1]<i}function rr(t,i){if(t[0]>
1t[1])return[null,null];let r=rt(t);if(i){if(2===r)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(1===r)return[t,null];let a=Math.floor(r/2)-1;return[[t[0],t[0]+a],[t[0]+a+1,t[1]]]}function ra(t,i){if(!ri(i,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let a=i[0];a<=i[1];++a)iZ(r,t[a]);return r}function rn(t){let i=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let t of r)iZ(i,t);return i}function rs(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function ro(t,i,r){if(!rs(t)||!rs(i))return NaN;let a=0,n=0;return t[2]<i[0]&&(a=i[0]-t[2]),t[0]>i[2]&&(a=t[0]-i[2]),t[1]>i[3]&&(n=t[1]-i[3]),t[3]<i[1]&&(n=i[1]-t[3]),r.distance([0,0],[a,n])}function rl(t,i,r){let a=r.pointOnLine(i,t);return r.distance(t,a.point)}function rh(t,i,r,a,n){return Math.min(Math.min(rl(t,[r,a],n),rl(i,[r,a],n)),Math.min(rl(r,[t,i],n),rl(a,[t,i],n)))}function ru(t,i){for(let r of t)for(let t of r)if(iH(t,i,!0))return!0;return!1}function rc(t,i,r,a,n,s){if(!s)return;let o=ro(ra(a,s),n,r);o<i&&t.push([o,s,[0,0]])}function rd(t,i,r,a,n,s,o){if(!s||!o)return;let l=ro(ra(a,s),ra(n,o),r);l<i&&t.push([l,s,o])}function rp(t,i,r,a,n=1/0){let s=Math.min(a.distance(t[0],r[0][0]),n);if(0===s)return s;let o=new i3([[0,[0,t.length-1],[0,0]]],re),l=rn(r);for(;o.length>0;){let n=o.pop();if(n[0]>=s)continue;let h=n[1],u=i?50:100;if(rt(h)<=u){if(!ri(h,t.length))return NaN;if(i){let i=function(t,i,r,a){if(!ri(i,t.length))return NaN;for(let a=i[0];a<=i[1];++a)if(iH(t[a],r,!0))return 0;let n=1/0;for(let s=i[0];s<i[1];++s){let i=t[s],o=t[s+1];for(let t of r)for(let r=0,s=t.length,l=s-1;r<s;l=r++){let s=t[l],h=t[r];if(iW(i,o,s,h))return 0;n=Math.min(n,rh(i,o,s,h,a))}}return n}(t,h,r,a);if(isNaN(i)||0===i)return i;s=Math.min(s,i)}else for(let i=h[0];i<=h[1];++i)if(0===(s=Math.min(s,function(t,i,r){if(iH(t,i,!0))return 0;let a=1/0;for(let n of i){let i=n[0],s=n[n.length-1];if(i!==s&&0===(a=Math.min(a,rl(t,[s,i],r))))break;let o=r.pointOnLine(n,t);if(0===(a=Math.min(a,r.distance(t,o.point))))break}return a}(t[i],r,a))))return 0}else{let r=rr(h,i);rc(o,s,a,t,l,r[0]),rc(o,s,a,t,l,r[1])}}return s}function rf(t,i,r,a,n,s=1/0){let o=Math.min(s,n.distance(t[0],r[0]));if(0===o)return o;let l=new i3([[0,[0,t.length-1],[0,r.length-1]]],re);for(;l.length>0;){let s=l.pop();if(s[0]>=o)continue;let h=s[1],u=s[2],c=i?50:100,d=a?50:100;if(rt(h)<=c&&rt(u)<=d){if(!ri(h,t.length)&&ri(u,r.length))return NaN;if(i&&a)o=Math.min(o,function(t,i,r,a,n){if(!ri(i,t.length)||!ri(a,r.length))return 1/0;let s=1/0;for(let o=i[0];o<i[1];++o){let i=t[o],l=t[o+1];for(let t=a[0];t<a[1];++t){let a=r[t],o=r[t+1];if(iW(i,l,a,o))return 0;s=Math.min(s,rh(i,l,a,o,n))}}return s}(t,h,r,u,n));else if(i&&!a){let i=t.slice(h[0],h[1]+1);for(let t=u[0];t<=u[1];++t)if(0===(o=Math.min(o,rl(r[t],i,n))))return o}else if(!i&&a){let i=r.slice(u[0],u[1]+1);for(let r=h[0];r<=h[1];++r)if(0===(o=Math.min(o,rl(t[r],i,n))))return o}else o=Math.min(o,function(t,i,r,a,n){if(!ri(i,t.length)||!ri(a,r.length))return NaN;let s=1/0;for(let o=i[0];o<=i[1];++o)for(let i=a[0];i<=a[1];++i)if(0===(s=Math.min(s,n.distance(t[o],r[i]))))return s;return s}(t,h,r,u,n))}else{let s=rr(h,i),c=rr(u,a);rd(l,o,n,t,r,s[0],c[0]),rd(l,o,n,t,r,s[0],c[1]),rd(l,o,n,t,r,s[1],c[0]),rd(l,o,n,t,r,s[1],c[1])}}return o}function rm(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class r_{constructor(t,i){this.type=ta,this.geojson=t,this.geometries=i}static parse(t,i){if(2!==t.length)return i.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(t4(t[1])){let i=t[1];if("FeatureCollection"===i.type)return new r_(i,i.features.map(t=>rm(t.geometry)).flat());if("Feature"===i.type)return new r_(i,rm(i.geometry));if("type"in i&&"coordinates"in i)return new r_(i,rm(i))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,i){let r=t.geometry(),a=r.flat().map(i=>i$([i.x,i.y],t.canonical));if(0===r.length)return NaN;let n=new i9(a[0][1]),s=1/0;for(let t of i){switch(t.type){case"Point":s=Math.min(s,rf(a,!1,[t.coordinates],!1,n,s));break;case"LineString":s=Math.min(s,rf(a,!1,t.coordinates,!0,n,s));break;case"Polygon":s=Math.min(s,rp(a,!1,t.coordinates,n,s))}if(0===s)break}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,i){let r=t.geometry(),a=r.flat().map(i=>i$([i.x,i.y],t.canonical));if(0===r.length)return NaN;let n=new i9(a[0][1]),s=1/0;for(let t of i){switch(t.type){case"Point":s=Math.min(s,rf(a,!0,[t.coordinates],!1,n,s));break;case"LineString":s=Math.min(s,rf(a,!0,t.coordinates,!0,n,s));break;case"Polygon":s=Math.min(s,rp(a,!0,t.coordinates,n,s))}if(0===s)break}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,i){let r=t.geometry();if(0===r.length||0===r[0].length)return NaN;let a=i6(r,0).map(i=>i.map(i=>i.map(i=>i$([i.x,i.y],t.canonical)))),n=new i9(a[0][0][0][1]),s=1/0;for(let t of i)for(let i of a){switch(t.type){case"Point":s=Math.min(s,rp([t.coordinates],!1,i,n,s)
1);break;case"LineString":s=Math.min(s,rp(t.coordinates,!0,i,n,s));break;case"Polygon":s=Math.min(s,function(t,i,r,a=1/0){let n=rn(t),s=rn(i);if(a!==1/0&&ro(n,s,r)>=a)return a;if(iq(n,s)){if(ru(t,i))return 0}else if(ru(i,t))return 0;let o=1/0;for(let a of t)for(let t=0,n=a.length,s=n-1;t<n;s=t++){let n=a[s],l=a[t];for(let t of i)for(let i=0,a=t.length,s=a-1;i<a;s=i++){let a=t[s],h=t[i];if(iW(n,l,a,h))return 0;o=Math.min(o,rh(n,l,a,h,r))}}return o}(i,t.coordinates,n,s))}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class rg{constructor(t){this.type=tu,this.key=t}static parse(t,i){if(2!==t.length)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);let r=t[1];return null==r?i.error("Global state property must be defined."):"string"!=typeof r?i.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new rg(r)}evaluate(t){var i;let r=null==(i=t.globals)?void 0:i.globalState;return r&&0!==Object.keys(r).length?tV(r,this.key):null}eachChild(){}outputDefined(){return!1}}let ry={"==":ik,"!=":iR,">":iF,"<":iL,">=":iO,"<=":iB,array:it,at:iu,boolean:it,case:im,coalesce:iC,collator:iV,format:iN,image:iU,in:ic,"index-of":id,interpolate:iM,"interpolate-hcl":iM,"interpolate-lab":iM,length:iG,let:il,literal:t9,match:ip,number:it,"number-format":ij,object:it,slice:i_,step:iy,string:it,"to-boolean":ir,"to-color":ir,"to-number":ir,"to-string":ir,var:ih,within:i2,distance:r_,"global-state":rg};class rx{constructor(t,i,r,a){this.name=t,this.type=i,this._evaluate=r,this.args=a}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,i){let r=t[0],a=rx.definitions[r];if(!a)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(a)?a[0]:a.type,s=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,o=s.filter(([i])=>!Array.isArray(i)||i.length===t.length-1),l=null;for(let[a,s]of o){l=new io(i.registry,rT,i.path,null,i.scope);let o=[],h=!1;for(let i=1;i<t.length;i++){let r=t[i],n=Array.isArray(a)?a[i-1]:a.type,s=l.parse(r,1+o.length,n);if(!s){h=!0;break}o.push(s)}if(!h)if(Array.isArray(a)&&a.length!==o.length)l.error(`Expected ${a.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){let i=Array.isArray(a)?a[t]:a.type,r=o[t];l.concat(t+1).checkSubtype(i,r.type)}if(0===l.errors.length)return new rx(r,n,s,o)}}if(1===o.length)i.errors.push(...l.errors);else{let r=(o.length?o:s).map(([t])=>Array.isArray(t)?`(${t.map(tx).join(", ")})`:`(${tx(t.type)}...)`).join(" | "),a=[];for(let r=1;r<t.length;r++){let n=i.parse(t[r],1+a.length);if(!n)return null;a.push(tx(n.type))}i.error(`Expected arguments of type ${r}, but found (${a.join(", ")}) instead.`)}return null}static register(t,i){for(let r in rx.definitions=i,i)t[r]=rx}}function rv(t,[i,r,a,n]){i=i.evaluate(t),r=r.evaluate(t),a=a.evaluate(t);let s=n?n.evaluate(t):1,o=t6(i,r,a,s);if(o)throw new t0(o);return new tq(i/255,r/255,a/255,s,!1)}function rb(t,i){let r=i[t];return void 0===r?null:r}function rw(t){return{type:t}}function rT(t){if(t instanceof ih)return rT(t.boundExpression);if(t instanceof rx&&"error"===t.name||t instanceof iV||t instanceof i2||t instanceof r_||t instanceof rg)return!1;let i=t instanceof ir||t instanceof it,r=!0;return t.eachChild(t=>{r=i?r&&rT(t):r&&t instanceof t9}),!!r&&rS(t)&&rM(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function rS(t){if(t instanceof rx&&("get"===t.name&&1===t.args.length||"feature-state"===t.name||"has"===t.name&&1===t.args.length||"properties"===t.name||"geometry-type"===t.name||"id"===t.name||/^filter-/.test(t.name))||t instanceof i2||t instanceof r_)return!1;let i=!0;return t.eachChild(t=>{i&&!rS(t)&&(i=!1)}),i}function rP(t){if(t instanceof rx&&"feature-state"===t.name)return!1;let i=!0;return t.eachChild(t=>{i&&!rP(t)&&(i=!1)}),i}function rM(t,i){if(t instanceof rx&&i.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(t=>{r&&!rM(t,i)&&(r=!1)}),r}function rI(t){return{result:"success",value:t}}function rE(t){return{result:"error",value:t}}function rC(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function rA(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function rD(t){return!!t.expression&&t.expression.interpolated}function rz(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function rk(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&t8(t)===th}function rR(t){return t}function rL(t,i,r){return void 0!==t?t:void 0!==i?i:void 0!==r?r:void 0}function rF(t,i,r,a,n){return rL(typeof r===n?a[r]:void 0,t.default,i.default)}function rB(t,i,r){if("number"!==rz(r))return rL(t.default,i.default);let a=t.stops.length;if(1===a||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[a-1][0])return t.stops[a-1][1];let n=ig(t.stops.map(t=>t[0]),r);return t.stops[n][1]}function rO(t,i,r){var a;let n,s,o=void 0!==t.base?t.base:1;if("number"!==rz(r))return rL(t.default,i.default);let l=t.stops.length;if(1===l||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[l-1][0])return t.stops[l-1][1];let h=ig(t.stops.map(t=>
1t[0]),r),u=(a=t.stops[h][0],n=t.stops[h+1][0]-a,s=r-a,0===n?0:1===o?s/n:(Math.pow(o,s)-1)/(Math.pow(o,n)-1)),c=t.stops[h][1],d=t.stops[h+1][1],p=iE[i.type]||rR;return"function"==typeof c.evaluate?{evaluate(...i){let r=c.evaluate.apply(void 0,i),a=d.evaluate.apply(void 0,i);if(void 0!==r&&void 0!==a)return p(r,a,u,t.colorSpace)}}:p(c,d,u,t.colorSpace)}function rV(t,i,r){switch(i.type){case"color":r=tq.parse(r);break;case"formatted":r=tY.fromString(r.toString());break;case"resolvedImage":r=t3.fromString(r.toString());break;case"padding":r=tK.parse(r);break;case"colorArray":r=tQ.parse(r);break;case"numberArray":r=tJ.parse(r);break;default:rz(r)===i.type||"enum"===i.type&&i.values[r]||(r=void 0)}return rL(r,t.default,i.default)}rx.register(ry,{error:[{kind:"error"},[tn],(t,[i])=>{throw new t0(i.evaluate(t))}],typeof:[tn,[tu],(t,[i])=>tx(t8(i.evaluate(t)))],"to-rgba":[ty(ta,4),[to],(t,[i])=>{let[r,a,n,s]=i.evaluate(t).rgb;return[255*r,255*a,255*n,s]}],rgb:[to,[ta,ta,ta],rv],rgba:[to,[ta,ta,ta,ta],rv],has:{type:ts,overloads:[[[tn],(t,[i])=>i.evaluate(t)in t.properties()],[[tn,th],(t,[i,r])=>i.evaluate(t)in r.evaluate(t)]]},get:{type:tu,overloads:[[[tn],(t,[i])=>rb(i.evaluate(t),t.properties())],[[tn,th],(t,[i,r])=>rb(i.evaluate(t),r.evaluate(t))]]},"feature-state":[tu,[tn],(t,[i])=>rb(i.evaluate(t),t.featureState||{})],properties:[th,[],t=>t.properties()],"geometry-type":[tn,[],t=>t.geometryType()],id:[tu,[],t=>t.id()],zoom:[ta,[],t=>t.globals.zoom],"heatmap-density":[ta,[],t=>t.globals.heatmapDensity||0],elevation:[ta,[],t=>t.globals.elevation||0],"line-progress":[ta,[],t=>t.globals.lineProgress||0],accumulated:[tu,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[ta,rw(ta),(t,i)=>{let r=0;for(let a of i)r+=a.evaluate(t);return r}],"*":[ta,rw(ta),(t,i)=>{let r=1;for(let a of i)r*=a.evaluate(t);return r}],"-":{type:ta,overloads:[[[ta,ta],(t,[i,r])=>i.evaluate(t)-r.evaluate(t)],[[ta],(t,[i])=>-i.evaluate(t)]]},"/":[ta,[ta,ta],(t,[i,r])=>i.evaluate(t)/r.evaluate(t)],"%":[ta,[ta,ta],(t,[i,r])=>i.evaluate(t)%r.evaluate(t)],ln2:[ta,[],()=>Math.LN2],pi:[ta,[],()=>Math.PI],e:[ta,[],()=>Math.E],"^":[ta,[ta,ta],(t,[i,r])=>Math.pow(i.evaluate(t),r.evaluate(t))],sqrt:[ta,[ta],(t,[i])=>Math.sqrt(i.evaluate(t))],log10:[ta,[ta],(t,[i])=>Math.log(i.evaluate(t))/Math.LN10],ln:[ta,[ta],(t,[i])=>Math.log(i.evaluate(t))],log2:[ta,[ta],(t,[i])=>Math.log(i.evaluate(t))/Math.LN2],sin:[ta,[ta],(t,[i])=>Math.sin(i.evaluate(t))],cos:[ta,[ta],(t,[i])=>Math.cos(i.evaluate(t))],tan:[ta,[ta],(t,[i])=>Math.tan(i.evaluate(t))],asin:[ta,[ta],(t,[i])=>Math.asin(i.evaluate(t))],acos:[ta,[ta],(t,[i])=>Math.acos(i.evaluate(t))],atan:[ta,[ta],(t,[i])=>Math.atan(i.evaluate(t))],min:[ta,rw(ta),(t,i)=>Math.min(...i.map(i=>i.evaluate(t)))],max:[ta,rw(ta),(t,i)=>Math.max(...i.map(i=>i.evaluate(t)))],abs:[ta,[ta],(t,[i])=>Math.abs(i.evaluate(t))],round:[ta,[ta],(t,[i])=>{let r=i.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[ta,[ta],(t,[i])=>Math.floor(i.evaluate(t))],ceil:[ta,[ta],(t,[i])=>Math.ceil(i.evaluate(t))],"filter-==":[ts,[tn,tu],(t,[i,r])=>t.properties()[i.value]===r.value],"filter-id-==":[ts,[tu],(t,[i])=>t.id()===i.value],"filter-type-==":[ts,[tn],(t,[i])=>t.geometryType()===i.value],"filter-<":[ts,[tn,tu],(t,[i,r])=>{let a=t.properties()[i.value],n=r.value;return typeof a==typeof n&&a<n}],"filter-id-<":[ts,[tu],(t,[i])=>{let r=t.id(),a=i.value;return typeof r==typeof a&&r<a}],"filter->":[ts,[tn,tu],(t,[i,r])=>{let a=t.properties()[i.value],n=r.value;return typeof a==typeof n&&a>n}],"filter-id->":[ts,[tu],(t,[i])=>{let r=t.id(),a=i.value;return typeof r==typeof a&&r>a}],"filter-<=":[ts,[tn,tu],(t,[i,r])=>{let a=t.properties()[i.value],n=r.value;return typeof a==typeof n&&a<=n}],"filter-id-<=":[ts,[tu],(t,[i])=>{let r=t.id(),a=i.value;return typeof r==typeof a&&r<=a}],"filter->=":[ts,[tn,tu],(t,[i,r])=>{let a=t.properties()[i.value],n=r.value;return typeof a==typeof n&&a>=n}],"filter-id->=":[ts,[tu],(t,[i])=>{let r=t.id(),a=i.value;return typeof r==typeof a&&r>=a}],"filter-has":[ts,[tu],(t,[i])=>i.value in t.properties()],"filter-has-id":[ts,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[ts,[ty(tn)],(t,[i])=>i.value.indexOf(t.geometryType())>=0],"filter-id-in":[ts,[ty(tu)],(t,[i])=>i.value.indexOf(t.id())>=0],"filter-in-small":[ts,[tn,ty(tu)],(t,[i,r])=>r.value.indexOf(t.properties()[i.value])>=0],"filter-in-large":[ts,[tn,ty(tu)],(t,[i,r])=>(function(t,i,r,a){for(;r<=a;){let n=r+a>>1;if(i[n]===t)return!0;
1i[n]>t?a=n-1:r=n+1}return!1})(t.properties()[i.value],r.value,0,r.value.length-1)],all:{type:ts,overloads:[[[ts,ts],(t,[i,r])=>i.evaluate(t)&&r.evaluate(t)],[rw(ts),(t,i)=>{for(let r of i)if(!r.evaluate(t))return!1;return!0}]]},any:{type:ts,overloads:[[[ts,ts],(t,[i,r])=>i.evaluate(t)||r.evaluate(t)],[rw(ts),(t,i)=>{for(let r of i)if(r.evaluate(t))return!0;return!1}]]},"!":[ts,[ts],(t,[i])=>!i.evaluate(t)],"is-supported-script":[ts,[tn],(t,[i])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(i.evaluate(t))}],upcase:[tn,[tn],(t,[i])=>i.evaluate(t).toUpperCase()],downcase:[tn,[tn],(t,[i])=>i.evaluate(t).toLowerCase()],concat:[tn,rw(tu),(t,i)=>i.map(i=>t7(i.evaluate(t))).join("")],split:[ty(tn),[tn,tn],(t,[i,r])=>i.evaluate(t).split(r.evaluate(t))],join:[tn,[ty(tn),tn],(t,[i,r])=>i.evaluate(t).join(r.evaluate(t))],"resolved-locale":[tn,[tc],(t,[i])=>i.evaluate(t).resolvedLocale()]});class rj{constructor(t,i,r){this.expression=t,this._warningHistory={},this._evaluator=new is,this._defaultValue=i?function(t){if("color"===t.type&&rk(t.default))return new tq(0,0,0,0);switch(t.type){case"color":return tq.parse(t.default)||null;case"padding":return tK.parse(t.default)||null;case"numberArray":return tJ.parse(t.default)||null;case"colorArray":return tQ.parse(t.default)||null;case"variableAnchorOffsetCollection":return t2.parse(t.default)||null;case"projectionDefinition":return t5.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(i):null,this._enumValues=i&&"enum"===i.type?i.values:null,this._globalState=r}evaluateWithoutErrorHandling(t,i,r,a,n,s){return this._globalState&&(t=rH(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=i,this._evaluator.featureState=r,this._evaluator.canonical=a,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,i,r,a,n,s){this._globalState&&(t=rH(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=i||null,this._evaluator.featureState=r||null,this._evaluator.canonical=a,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s||null;try{let t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new t0(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"u">typeof console&&console.warn(t.message)),this._defaultValue}}}function rN(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in ry}function rU(t,i,r){let a,n=new io(ry,rT,[],i?(a={color:to,string:tn,number:ta,enum:tn,boolean:ts,formatted:td,padding:tp,numberArray:tm,colorArray:tf,projectionDefinition:tl,resolvedImage:t_,variableAnchorOffsetCollection:tg},"array"===i.type?ty(a[i.value]||tu,i.length):a[i.type]):void 0),s=n.parse(t,void 0,void 0,void 0,i&&"string"===i.type?{typeAnnotation:"coerce"}:void 0);return s?rI(new rj(s,i,r)):rE(n.errors)}class rG{constructor(t,i,r){this.kind=t,this._styleExpression=i,this.isStateDependent="constant"!==t&&!rP(i.expression),this.globalStateRefs=rW(i.expression),this._globalState=r}evaluateWithoutErrorHandling(t,i,r,a,n,s){return this._globalState&&(t=rH(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,i,r,a,n,s)}evaluate(t,i,r,a,n,s){return this._globalState&&(t=rH(t,this._globalState)),this._styleExpression.evaluate(t,i,r,a,n,s)}}class r${constructor(t,i,r,a,n){this.kind=t,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==t&&!rP(i.expression),this.globalStateRefs=rW(i.expression),this.interpolationType=a,this._globalState=n}evaluateWithoutErrorHandling(t,i,r,a,n,s){return this._globalState&&(t=rH(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,i,r,a,n,s)}evaluate(t,i,r,a,n,s){return this._globalState&&(t=rH(t,this._globalState)),this._styleExpression.evaluate(t,i,r,a,n,s)}interpolationFactor(t,i,r){return this.interpolationType?iM.interpolationFactor(this.interpolationType,t,i,r):0}}function rZ(t,i,r){let a=rU(t,i,r);if("error"===a.result)return a;let n=a.value.expression,s=rS(n);if(!s&&!rC(i))return rE([new tt("","data expressions not supported")]);let o=rM(n,["zoom"]);if(!o&&!rA(i))return rE([new tt("","zoom expressions not supported")]);let l=function t(i){let r=null;if(i instanceof il)r=t(i.result);else if(i instanceof iC){for(let a of i.args)if(r=t(a))break}
1else(i instanceof iy||i instanceof iM)&&i.input instanceof rx&&"zoom"===i.input.name&&(r=i);return r instanceof tt||i.eachChild(i=>{let a=t(i);a instanceof tt?r=a:!r&&a?r=new tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):r&&a&&r!==a&&(r=new tt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}(n);return l||o?l instanceof tt?rE([l]):l instanceof iM&&!rD(i)?rE([new tt("",'"interpolate" expressions cannot be used with this property')]):rI(l?new r$(s?"camera":"composite",a.value,l.labels,l instanceof iM?l.interpolation:void 0,r):new rG(s?"constant":"source",a.value,r)):rE([new tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class rq{constructor(t,i){this._parameters=t,this._specification=i,te(this,function t(i,r){var a;let n,s,o=i.stops&&"object"==typeof i.stops[0][0],l=o||!(o||void 0!==i.property),h=i.type||(rD(r)?"exponential":"interval"),u=function(t){switch(t.type){case"color":return tq.parse;case"padding":return tK.parse;case"numberArray":return tJ.parse;case"colorArray":return tQ.parse;default:return null}}(r);if(u&&((i=te({},i)).stops&&(i.stops=i.stops.map(t=>[t[0],u(t[1])])),i.default=u(i.default?i.default:r.default)),i.colorSpace&&"rgb"!==(a=i.colorSpace)&&"hcl"!==a&&"lab"!==a)throw Error(`Unknown color space: "${i.colorSpace}"`);let c=function(t){switch(t){case"exponential":return rO;case"interval":return rB;case"categorical":return rF;case"identity":return rV;default:throw Error(`Unknown function type "${t}"`)}}(h);if("categorical"===h){for(let t of(n=Object.create(null),i.stops))n[t[0]]=t[1];s=typeof i.stops[0][0]}if(o){let a={},n=[];for(let t=0;t<i.stops.length;t++){let r=i.stops[t],s=r[0].zoom;void 0===a[s]&&(a[s]={zoom:s,type:i.type,property:i.property,default:i.default,stops:[]},n.push(s)),a[s].stops.push([r[0].value,r[1]])}let s=[];for(let i of n)s.push([a[i].zoom,t(a[i],r)]);let o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:iM.interpolationFactor.bind(void 0,o),zoomStops:s.map(t=>t[0]),evaluate:({zoom:t},a)=>rO({stops:s,base:i.base},r,t).evaluate(t,a)}}if(l){let t="exponential"===h?{name:"exponential",base:void 0!==i.base?i.base:1}:null;return{kind:"camera",interpolationType:t,interpolationFactor:iM.interpolationFactor.bind(void 0,t),zoomStops:i.stops.map(t=>t[0]),evaluate:({zoom:t})=>c(i,r,t,n,s)}}return{kind:"source",evaluate(t,a){let o=a&&a.properties?a.properties[i.property]:void 0;return void 0===o?rL(i.default,r.default):c(i,r,o,n,s)}}}(this._parameters,this._specification))}static deserialize(t){return new rq(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function rW(t,i=new Set){return t instanceof rg&&i.add(t.key),t.eachChild(t=>{rW(t,i)}),i}function rH(t,i){let{zoom:r,heatmapDensity:a,elevation:n,lineProgress:s,isSupportedScript:o,accumulated:l}=null!=t?t:{};return{zoom:r,heatmapDensity:a,elevation:n,lineProgress:s,isSupportedScript:o,accumulated:l,globalState:i}}function rX(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let i of t.slice(1))if(!rX(i)&&"boolean"!=typeof i)return!1;return!0;default:return!0}}let rY={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function rK(t,i){if(null==t)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};rX(t)||(t=function t(i){if(!i)return!0;let r=i[0];return i.length<=1?"any"!==r:"=="===r?rQ(i[1],i[2],"=="):"!="===r?r2(rQ(i[1],i[2],"==")):"<"===r||">"===r||"<="===r||">="===r?rQ(i[1],i[2],r):"any"===r?["any"].concat(i.slice(1).map(t)):"all"===r?["all"].concat(i.slice(1).map(t)):"none"===r?["all"].concat(i.slice(1).map(t).map(r2)):"in"===r?r0(i[1],i.slice(2)):"!in"===r?r2(r0(i[1],i.slice(2))):"has"===r?r1(i[1]):"!has"!==r||r2(r1(i[1]))}(t));let r=rU(t,rY,i);if("error"===r.result)throw Error(r.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,i,a)=>r.value.evaluate(t,i,{},a),needGeometry:function t(i){if(!Array.isArray(i))return!1;if("within"===i[0]||"distance"===i[0])return!0;for(let r=1;r<i.length;r++)if(t(i[r]))return!0;return!1}(t),getGlobalStateRefs:()=>rW(r.value.expression)}}function rJ(t,i){return t<i?-1:+(t>i)}function rQ(t,i,r){switch(t){case"$type":return[`filter-type-${r}`,i];case"$id":return[`filter-id-${r}`,i];default:return[`filter-${r}`,t,i]}}function r0(t,i){if(0===i.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(t=>typeof t!=typeof i[0])?["filter-in-large",t,["literal",i.sort(rJ)]]:["filter-in-small",t,["literal",i]]}}function r1(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function r2(t){return["!",t]}function r3(t){let i=t.value;return i?[new e9(t.key,i,"constants have been deprecated as of v8")]:[]}function r5(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function r6(t){if(Array.isArray(t))return t.map(r6);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let i={};for(let r in t)i[r]=r6(t[r]);return i}return r5(t)}function r4(t){let i=t.key,r=t.value,a=t.valueSpec||{},n=t.objectElementValidators||{},s=t.style,o=t.styleSpec,l=t.validateSpec,h=[],u=rz(r);if("object"!==u)return[new e9(i,r,`object expected, ${u}
1 found`)];for(let t in r){let u,c=t.split(".")[0],d=tV(a,c)||a["*"];if(tV(n,c))u=n[c];else if(tV(a,c)){if(void 0===r[t])continue;u=l}else if(n["*"])u=n["*"];else{if(!a["*"]){h.push(new e9(i,r[t],`unknown property "${t}"`));continue}u=l}h=h.concat(u({key:(i?`${i}.`:i)+t,value:r[t],valueSpec:d,style:s,styleSpec:o,object:r,objectKey:t,validateSpec:l},r))}for(let t in a)n[t]||a[t].required&&void 0===a[t].default&&void 0===r[t]&&h.push(new e9(i,r,`missing required property "${t}"`));return h}function r8(t){let i=t.value,r=t.valueSpec,a=t.style,n=t.styleSpec,s=t.key,o=t.arrayElementValidator||t.validateSpec;if("array"!==rz(i))return[new e9(s,i,`array expected, ${rz(i)} found`)];if(r.length&&i.length!==r.length)return[new e9(s,i,`array length ${r.length} expected, length ${i.length} found`)];let l={type:r.value,values:r.values};n.$version<7&&(l.function=r.function),"object"===rz(r.value)&&(l=r.value);let h=[];for(let r=0;r<i.length;r++)h=h.concat(o({array:i,arrayIndex:r,value:i[r],valueSpec:l,validateSpec:t.validateSpec,style:a,styleSpec:n,key:`${s}[${r}]`}));return h}function r7(t){let i=t.key,r=t.value,a=t.valueSpec,n=rz(r);return"number"===n&&r!=r&&(n="NaN"),"number"!==n?[new e9(i,r,`number expected, ${n} found`)]:"minimum"in a&&r<a.minimum?[new e9(i,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new e9(i,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function r9(t){let i=t.valueSpec,r=r5(t.value.type),a,n,s,o={},l="categorical"!==r&&void 0===t.value.property,h="array"===rz(t.value.stops)&&"array"===rz(t.value.stops[0])&&"object"===rz(t.value.stops[0][0]),u=r4({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new e9(t.key,t.value,'identity function may not have a "stops" property')];let i=[],a=t.value;return i=i.concat(r8({key:t.key,value:a,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:c})),"array"===rz(a)&&0===a.length&&i.push(new e9(t.key,a,"array must have at least one stop")),i},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:i,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===r&&l&&u.push(new e9(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||u.push(new e9(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!rD(t.valueSpec)&&u.push(new e9(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l||rC(t.valueSpec)?l&&!rA(t.valueSpec)&&u.push(new e9(t.key,t.value,"zoom functions not supported")):u.push(new e9(t.key,t.value,"property functions not supported"))),("categorical"===r||h)&&void 0===t.value.property&&u.push(new e9(t.key,t.value,'"property" property is required')),u;function c(t){let r=[],a=t.value,l=t.key;if("array"!==rz(a))return[new e9(l,a,`array expected, ${rz(a)} found`)];if(2!==a.length)return[new e9(l,a,`array length 2 expected, length ${a.length} found`)];if(h){if("object"!==rz(a[0]))return[new e9(l,a,`object expected, ${rz(a[0])} found`)];if(void 0===a[0].zoom)return[new e9(l,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new e9(l,a,"object stop key must have value")];if(s&&s>r5(a[0].zoom))return[new e9(l,a[0].zoom,"stop zoom values must appear in ascending order")];r5(a[0].zoom)!==s&&(s=r5(a[0].zoom),n=void 0,o={}),r=r.concat(r4({key:`${l}[0]`,value:a[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:r7,value:d}}))}else r=r.concat(d({key:`${l}[0]`,value:a[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},a));return rN(r6(a[1]))?r.concat([new e9(`${l}[1]`,a[1],"expressions are not allowed in function stops.")]):r.concat(t.validateSpec({key:`${l}[1]`,value:a[1],valueSpec:i,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function d(t,s){let l=rz(t.value),h=r5(t.value),u=null!==t.value?t.value:s;if(a){if(l!==a)return[new e9(t.key,u,`${l} stop domain type must match previous stop domain type ${a}`)]}else a=l;if("number"!==l&&"string"!==l&&"boolean"!==l)return[new e9(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==l&&"categorical"!==r){let a=`number expected, ${l}
1 found`;return rC(i)&&void 0===r&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e9(t.key,u,a)]}return"categorical"!==r||"number"!==l||isFinite(h)&&Math.floor(h)===h?"categorical"!==r&&"number"===l&&void 0!==n&&h<n?[new e9(t.key,u,"stop domain values must appear in ascending order")]:(n=h,"categorical"===r&&h in o?[new e9(t.key,u,"stop domain values must be unique")]:(o[h]=!0,[])):[new e9(t.key,u,`integer expected, found ${h}`)]}}function ae(t){let i=("property"===t.expressionContext?rZ:rU)(r6(t.value),t.valueSpec);if("error"===i.result)return i.value.map(i=>new e9(`${t.key}${i.key}`,t.value,i.message));let r=i.value.expression||i.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new e9(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!rP(r))return[new e9(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!rP(r))return[new e9(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!rM(r,["zoom","feature-state"]))return[new e9(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!rS(r))return[new e9(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function at(t){let i=t.key,r=t.value,a=rz(r);return"string"!==a?[new e9(i,r,`color expected, ${a} found`)]:tq.parse(String(r))?[]:[new e9(i,r,`color expected, "${r}" found`)]}function ai(t){let i=t.key,r=t.value,a=t.valueSpec,n=[];return Array.isArray(a.values)?-1===a.values.indexOf(r5(r))&&n.push(new e9(i,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(a.values).indexOf(r5(r))&&n.push(new e9(i,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function ar(t){return rX(r6(t.value))?ae(te({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(i){let r=i.value,a=i.key;if("array"!==rz(r))return[new e9(a,r,`array expected, ${rz(r)} found`)];let n=i.styleSpec,s,o=[];if(r.length<1)return[new e9(a,r,"filter array must have at least 1 element")];switch(o=o.concat(ai({key:`${a}[0]`,value:r[0],valueSpec:n.filter_operator,style:i.style,styleSpec:i.styleSpec})),r5(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===r5(r[1])&&o.push(new e9(a,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":3!==r.length&&o.push(new e9(a,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&"string"!==(s=rz(r[1]))&&o.push(new e9(`${a}[1]`,r[1],`string expected, ${s} found`));for(let t=2;t<r.length;t++)s=rz(r[t]),"$type"===r5(r[1])?o=o.concat(ai({key:`${a}[${t}]`,value:r[t],valueSpec:n.geometry_type,style:i.style,styleSpec:i.styleSpec})):"string"!==s&&"number"!==s&&"boolean"!==s&&o.push(new e9(`${a}[${t}]`,r[t],`string, number, or boolean expected, ${s} found`));break;case"any":case"all":case"none":for(let n=1;n<r.length;n++)o=o.concat(t({key:`${a}[${n}]`,value:r[n],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":s=rz(r[1]),2!==r.length?o.push(new e9(a,r,`filter array for "${r[0]}" operator must have 2 elements`)):"string"!==s&&o.push(new e9(`${a}[1]`,r[1],`string expected, ${s} found`))}return o}(t)}function aa(t,i){let r,a=t.key,n=t.validateSpec,s=t.style,o=t.styleSpec,l=t.value,h=t.objectKey,u=o[`${i}_${t.layerType}`];if(!u)return[];let c=h.match(/^(.*)-transition$/);if("paint"===i&&c&&u[c[1]]&&u[c[1]].transition)return n({key:a,value:l,valueSpec:o.transition,style:s,styleSpec:o});let d=t.valueSpec||u[h];if(!d)return[new e9(a,l,`unknown property "${h}"`)];if("string"===rz(l)&&rC(d)&&!d.tokens&&(r=/^{([^}]+)}$/.exec(l)))return[new e9(a,l,`"${h}" does not support interpolation syntax
2Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(r[1])} }\`.`)];let p=[];return"symbol"===t.layerType&&"text-font"===h&&rk(r6(l))&&"identity"===r5(l.type)&&p.push(new e9(a,l,'"text-font" does not support identity functions')),p.concat(n({key:t.key,value:l,valueSpec:d,style:s,styleSpec:o,expressionContext:"property",propertyType:i,propertyKey:h}))}function an(t){return aa(t,"paint")}function as(t){return aa(t,"layout")}function ao(t){var i,r;let a=[],n=t.value,s=t.key,o=t.style,l=t.styleSpec;if("object"!==rz(n))return[new e9(s,n,`object expected, ${rz(n)} found`)];n.type||n.ref||a.push(new e9(s,n,'either "type" or "ref" is required'));let h=r5(n.type),u=r5(n.ref);
2if(n.id){let i=r5(n.id);for(let r=0;r<t.arrayIndex;r++){let t=o.layers[r];r5(t.id)===i&&a.push(new e9(s,n.id,`duplicate layer id "${n.id}", previously used at line ${t.id.__line__}`))}}if("ref"in n){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in n&&a.push(new e9(s,n[t],`"${t}" is prohibited for ref layers`))}),o.layers.forEach(i=>{r5(i.id)===u&&(t=i)}),t?t.ref?a.push(new e9(s,n.ref,"ref cannot reference another ref layer")):h=r5(t.type):a.push(new e9(s,n.ref,`ref layer "${u}" not found`))}else if("background"!==h)if(n.source){let t=o.sources&&o.sources[n.source],i=t&&r5(t.type);t?"vector"===i&&"raster"===h?a.push(new e9(s,n.source,`layer "${n.id}" requires a raster source`)):"raster-dem"!==i&&"hillshade"===h||"raster-dem"!==i&&"color-relief"===h?a.push(new e9(s,n.source,`layer "${n.id}" requires a raster-dem source`)):"raster"===i&&"raster"!==h?a.push(new e9(s,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==i||n["source-layer"]?"raster-dem"===i&&"hillshade"!==h&&"color-relief"!==h?a.push(new e9(s,n.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"===h&&n.paint&&n.paint["line-gradient"]&&("geojson"!==i||!t.lineMetrics)&&a.push(new e9(s,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):a.push(new e9(s,n,`layer "${n.id}" must specify a "source-layer"`)):a.push(new e9(s,n.source,`source "${n.source}" not found`))}else a.push(new e9(s,n,'missing required property "source"'));return"raster"===h&&(null==(i=n.paint)?void 0:i.resampling)&&(null==(r=n.paint)?void 0:r["raster-resampling"])&&a.push(new e9(s,n.paint,`layer "${n.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),a=a.concat(r4({key:s,value:n,valueSpec:l.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${s}.type`,value:n.type,valueSpec:l.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:n,objectKey:"type"}),filter:ar,layout:t=>r4({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>as(te({layerType:h},t))}}),paint:t=>r4({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>an(te({layerType:h},t))}})}}))}function al(t){let i=t.value,r=t.key,a=rz(i);return"string"!==a?[new e9(r,i,`string expected, ${a} found`)]:[]}let ah={promoteId:function({key:t,value:i}){if("string"===rz(i))return al({key:t,value:i});{let r=[];for(let a in i)r.push(...al({key:`${t}.${a}`,value:i[a]}));return r}}};function au(t){let i,r=t.value,a=t.key,n=t.styleSpec,s=t.style,o=t.validateSpec;if(!r.type)return[new e9(a,r,'"type" is required')];let l=r5(r.type);switch(l){case"vector":case"raster":return r4({key:a,value:r,valueSpec:n[`source_${l.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:ah,validateSpec:o});case"raster-dem":return function(t){var i;let r=null!=(i=t.sourceName)?i:"",a=t.value,n=t.styleSpec,s=n.source_raster_dem,o=t.style,l=[],h=rz(a);if(void 0===a)return l;if("object"!==h)return l.push(new e9("source_raster_dem",a,`object expected, ${h} found`)),l;let u="custom"===r5(a.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],d=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let i in a)!u&&c.includes(i)?l.push(new e9(i,a[i],`In "${r}": "${i}" is only valid when "encoding" is set to "custom". ${d} encoding found`)):s[i]?l=l.concat(t.validateSpec({key:i,value:a[i],valueSpec:s[i],validateSpec:t.validateSpec,style:o,styleSpec:n})):l.push(new e9(i,a[i],`unknown property "${i}"`));return l}({sourceName:a,value:r,style:t.style,styleSpec:n,validateSpec:o});case"geojson":if(i=r4({key:a,value:r,valueSpec:n.source_geojson,style:s,styleSpec:n,validateSpec:o,objectElementValidators:ah}),r.cluster)for(let t in r.clusterProperties){let[n,s]=r.clusterProperties[t],o="string"==typeof n?[n,["accumulated"],["get",t]]:n;i.push(...ae({key:`${a}.${t}.map`,value:s,expressionContext:"cluster-map"})),i.push(...ae({key:`${a}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return i;case"video":return r4({key:a,value:r,valueSpec:n.source_video,style:s,validateSpec:o,styleSpec:n});case"image":return r4({key:a,value:r,valueSpec:n.source_image,style:s,validateSpec:o,styleSpec:n});case"canvas":return[new e9(a,null,"Please use runtime APIs to add canvas sources, rather than 
2including them in stylesheets.","source.canvas")];default:return ai({key:`${a}.type`,value:r.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function ac(t){let i=t.value,r=t.styleSpec,a=r.light,n=t.style,s=[],o=rz(i);if(void 0===i)return s;if("object"!==o)return s.concat([new e9("light",i,`object expected, ${o} found`)]);for(let o in i){let l=o.match(/^(.*)-transition$/);s=s.concat(l&&a[l[1]]&&a[l[1]].transition?t.validateSpec({key:o,value:i[o],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r}):a[o]?t.validateSpec({key:o,value:i[o],valueSpec:a[o],validateSpec:t.validateSpec,style:n,styleSpec:r}):[new e9(o,i[o],`unknown property "${o}"`)])}return s}function ad(t){let i=t.value,r=t.styleSpec,a=r.sky,n=t.style,s=rz(i);if(void 0===i)return[];if("object"!==s)return[new e9("sky",i,`object expected, ${s} found`)];let o=[];for(let s in i)o=o.concat(a[s]?t.validateSpec({key:s,value:i[s],valueSpec:a[s],style:n,styleSpec:r}):[new e9(s,i[s],`unknown property "${s}"`)]);return o}function ap(t){let i=t.value,r=t.styleSpec,a=r.terrain,n=t.style,s=[],o=rz(i);if(void 0===i)return s;if("object"!==o)return s.concat([new e9("terrain",i,`object expected, ${o} found`)]);for(let o in i)s=s.concat(a[o]?t.validateSpec({key:o,value:i[o],valueSpec:a[o],validateSpec:t.validateSpec,style:n,styleSpec:r}):[new e9(o,i[o],`unknown property "${o}"`)]);return s}function af(t){let i=[],r=t.value,a=t.key;if(Array.isArray(r)){let n=[],s=[];for(let o in r)r[o].id&&n.includes(r[o].id)&&i.push(new e9(a,r,`all the sprites' ids must be unique, but ${r[o].id} is duplicated`)),n.push(r[o].id),r[o].url&&s.includes(r[o].url)&&i.push(new e9(a,r,`all the sprites' URLs must be unique, but ${r[o].url} is duplicated`)),s.push(r[o].url),i=i.concat(r4({key:`${a}[${o}]`,value:r[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return i}return al({key:a,value:r})}function am(t){return!!t&&t.constructor===Object}function a_(t){return am(t.value)?[]:[new e9(t.key,t.value,`object expected, ${rz(t.value)} found`)]}let ag={"*":()=>[],array:r8,boolean:function(t){let i=t.value,r=t.key,a=rz(i);return"boolean"!==a?[new e9(r,i,`boolean expected, ${a} found`)]:[]},number:r7,color:at,constants:r3,enum:ai,filter:ar,function:r9,layer:ao,object:r4,source:au,light:ac,sky:ad,terrain:ap,projection:function(t){let i=t.value,r=t.styleSpec,a=r.projection,n=t.style,s=rz(i);if(void 0===i)return[];if("object"!==s)return[new e9("projection",i,`object expected, ${s} found`)];let o=[];
2for(let s in i)o=o.concat(a[s]?t.validateSpec({key:s,value:i[s],valueSpec:a[s],style:n,styleSpec:r}):[new e9(s,i[s],`unknown property "${s}"`)]);return o},projectionDefinition:function(t){var i;let r=t.key,a=t.value,n=rz(a=a instanceof String?a.valueOf():a);return"array"!==n||Array.isArray(i=a)&&3===i.length&&"string"==typeof i[0]&&"string"==typeof i[1]&&"number"==typeof i[2]||["interpolate","step","literal"].includes(a[0])?["array","string"].includes(n)?[]:[new e9(r,a,`projection expected, invalid type "${n}" found`)]:[new e9(r,a,`projection expected, invalid array ${JSON.stringify(a)} found`)]},string:al,formatted:function(t){return 0===al(t).length?[]:ae(t)},resolvedImage:function(t){return 0===al(t).length?[]:ae(t)},padding:function(t){let i=t.key,r=t.value;if("array"===rz(r)){if(r.length<1||r.length>4)return[new e9(i,r,`padding requires 1 to 4 values; ${r.length} values found`)];let a={type:"number"},n=[];for(let s=0;s<r.length;s++)n=n.concat(t.validateSpec({key:`${i}[${s}]`,value:r[s],validateSpec:t.validateSpec,valueSpec:a}));return n}return r7({key:i,value:r,valueSpec:{}})},numberArray:function(t){let i=t.key,r=t.value;if("array"===rz(r)){let a={type:"number"};if(r.length<1)return[new e9(i,r,"array length at least 1 expected, length 0 found")];let n=[];for(let s=0;s<r.length;s++)n=n.concat(t.validateSpec({key:`${i}[${s}]`,value:r[s],validateSpec:t.validateSpec,valueSpec:a}));return n}return r7({key:i,value:r,valueSpec:{}})},colorArray:function(t){let i=t.key,r=t.value;if("array"===rz(r)){if(r.length<1)return[new e9(i,r,"array length at least 1 expected, length 0 found")];let t=[];for(let a=0;a<r.length;a++)t=t.concat(at({key:`${i}[${a}]`,value:r[a]}));return t}return at({key:i,value:r})},variableAnchorOffsetCollection:function(t){let i=t.key,r=t.value,a=rz(r),n=t.styleSpec;if("array"!==a||r.length<1||r.length%2!=0)return[new e9(i,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let a=0;a<r.length;a+=2)s=(s=s.concat(ai({key:`${i}[${a}]`,value:r[a],valueSpec:n.layout_symbol["text-anchor"]}))).concat(r8({key:`${i}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return s},sprite:af,state:a_,fontFaces:function(t){let i=t.key,r=t.value,a=t.validateSpec,n=t.styleSpec,s=t.style;if(!am(r))return[new e9(i,r,`object expected, ${rz(r)} found`)];let o=[];for(let t in r){let l=r[t],h=rz(l);if("string"===h)o.push(...al({key:`${i}.${t}`,value:l}));else if("array"===h){let r={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[h,u]of l.entries())o.push(...r4({key:`${i}.${t}[${h}]`,value:u,valueSpec:r,styleSpec:n,style:s,validateSpec:a}))}else o.push(new e9(`${i}.${t}`,l,`string or array expected, ${h} found`))}return o}};function ay(t){let i=t.value,r=t.valueSpec,a=t.styleSpec;return t.validateSpec=ay,r.expression&&rk(r5(i))?r9(t):r.expression&&rN(r6(i))?ae(t):r.type&&ag[r.type]?ag[r.type](t):r4(te({},t,{valueSpec:r.type?a[r.type]:r}))}function ax(t){let i=t.value,r=t.key,a=al(t);return a.length||(-1===i.indexOf("{fontstack}")&&a.push(new e9(r,i,'"glyphs" url must include a "{fontstack}" token')),-1===i.indexOf("{range}")&&a.push(new e9(r,i,'"glyphs" url must include a "{range}" token'))),a}function av(t,i=e0){let r=[];return r=r.concat(ay({key:"",value:t,valueSpec:i.$root,styleSpec:i,style:t,validateSpec:ay,objectElementValidators:{glyphs:ax,"*":()=>[]}})),t.constants&&(r=r.concat(r3({key:"constants",value:t.constants}))),aw(r)}function ab(t){return function(i){return t(Object.assign({},i,{validateSpec:ay}))}}function aw(t){return[].concat(t).sort((t,i)=>t.line-i.line)}function aT(t){return function(...i){return aw(t.apply(this,i))}}av.source=aT(ab(au)),av.sprite=aT(ab(af)),av.glyphs=aT(ab(ax)),av.light=aT(ab(ac)),av.sky=aT(ab(ad)),av.terrain=aT(ab(ap)),av.state=aT(ab(a_)),av.layer=aT(ab(ao)),av.filter=aT(ab(ar)),av.paintProperty=aT(ab(an)),av.layoutProperty=aT(ab(as));let aS={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class aP{constructor(t,i){this._globalState=i,this.setValue(t)}evaluate(){var t;return null!=(t=this._literalValue)?t:this._compiledValue.evaluate({})}setValue(t){if(null==t||"visible"===t||"none"===t)return this._literalValue="none"===t?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let i=rU(t,aS,this._globalState);if("error"===i.result)throw this._literalValue="visible",this._compiledValue=void 0,Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=rW(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let aM=av.light,aI=av.sky,aE=av.paintProperty,aC=av.layoutProperty;function aA(t,i){let r=!1;if(null==i?void 0:i.length)for(let a of i)t.fire(new eJ(Error(a.message))),r=!0;return r}class aD{constructor(t,i,r){const a=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const n=new Int32Array(this.arrayBuffer);t=n[0],this.d=(i=n[1])+2*(r=n[2]);for(let t=0;t<this.d*this.d;t++){const i=n[3+t],r=n[3+t+1];a.push(i===r?null:n.subarray(i,r))}const s=n[3+a.length+1];this.keys=n.subarray(n[3+a.length],s),this.bboxes=n.subarray(s),this.insert=this._insertReadonly}else{this.d=i+2*r;for(let t=0;t<this.d*this.d;t++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t,this.padding=r,this.scale=i/t,this.uid=0;const n=r/i*t;this.min=-n,this.max=t+n}
2insert(t,i,r,a,n){this._forEachCell(i,r,a,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,i,r,a,n,s){this.cells[n].push(s)}query(t,i,r,a,n){let s=this.min,o=this.max;if(t<=s&&i<=s&&o<=r&&o<=a&&!n)return[...this.keys];{let s=[];return this._forEachCell(t,i,r,a,this._queryCell,s,{},n),s}}_queryCell(t,i,r,a,n,s,o,l){let h=this.cells[n];if(null!==h){let n=this.keys,u=this.bboxes;for(let c of h)if(void 0===o[c]){let h=4*c;(l?l(u[h+0],u[h+1],u[h+2],u[h+3]):t<=u[h+2]&&i<=u[h+3]&&r>=u[h+0]&&a>=u[h+1])?(o[c]=!0,s.push(n[c])):o[c]=!1}}}_forEachCell(t,i,r,a,n,s,o,l){let h=this._convertToCellCoord(t),u=this._convertToCellCoord(i),c=this._convertToCellCoord(r),d=this._convertToCellCoord(a);for(let p=h;p<=c;p++)for(let h=u;h<=d;h++){let u=this.d*h+p;if((!l||l(this._convertFromCellCoord(p),this._convertFromCellCoord(h),this._convertFromCellCoord(p+1),this._convertFromCellCoord(h+1)))&&n.call(this,t,i,r,a,u,s,o,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,i=3+this.cells.length+1+1,r=0;for(let t of this.cells)r+=t.length;let a=new Int32Array(i+r+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let n=i;for(let i=0;i<t.length;i++){let r=t[i];a[3+i]=n,a.set(r,n),n+=r.length}return a[3+t.length]=n,a.set(this.keys,n),n+=this.keys.length,a[3+t.length+1]=n,a.set(this.bboxes,n),n+=this.bboxes.length,a.buffer}static serialize(t,i){let r=t.toArrayBuffer();return i&&i.push(r),{buffer:r}}static deserialize(t){return new aD(t.buffer)}}let az={};function ak(t,i,r={}){if(az[t])throw Error(`${t} is already registered.`);Object.defineProperty(i,"_classRegistryKey",{value:t,writeable:!1}),az[t]={klass:i,omit:r.omit||[],shallow:r.shallow||[]}}for(let t in ak("Object",Object),ak("Set",Set),ak("TransferableGridIndex",aD),ak("Color",tq),ak("Error",Error),ak("AJAXError",eZ),ak("ResolvedImage",t3),ak("StylePropertyFunction",rq),ak("StyleExpression",rj,{omit:["_evaluator"]}),ak("ZoomDependentExpression",r$),ak("ZoomConstantExpression",rG),ak("CompoundExpression",rx,{omit:["_evaluate"]}),ry)ry[t]._classRegistryKey||ak(`Expression_${t}`,ry[t]);function aR(t){var i;return t&&"u">typeof ArrayBuffer&&(t instanceof ArrayBuffer||"ArrayBuffer"===(null==(i=t.constructor)?void 0:i.name))}function aL(t){return t.$name||t.constructor._classRegistryKey}function aF(t){return!function(t){if(null===t||"object"!=typeof t)return!1;let i=aL(t);return i&&"Object"!==i}(t)&&(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||aR(t)||eA(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function aB(t,i){if(aF(t))return(aR(t)||eA(t))&&i&&i.push(t),ArrayBuffer.isView(t)&&i&&i.push(t.buffer),t instanceof ImageData&&i&&i.push(t.data.buffer),t;if(Array.isArray(t)){let r=[];for(let a of t)r.push(aB(a,i));return r}if("object"!=typeof t)throw Error("can't serialize object of type "+typeof t);let r=aL(t);if(!r)throw Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!az[r])throw Error(`${r} is not registered.`);let{klass:a}=az[r],n=a.serialize?a.serialize(t,i):{};if(a.serialize){if(n===(null==i?void 0:i[i.length-1]))throw Error("statically serialized object won't survive transfer of $name property")}else{for(let a in t){if(!t.hasOwnProperty(a)||az[r].omit.includes(a))continue;let s=t[a];n[a]=az[r].shallow.includes(a)?s:aB(s,i)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}function aO(t){if(aF(t))return t;if(Array.isArray(t))return t.map(aO);if("object"!=typeof t)throw Error("can't deserialize object of type "+typeof t);let i=aL(t)||"Object";if(!az[i])throw Error(`can't deserialize unregistered class ${i}`);let{klass:r}=az[i];if(!r)throw Error(`can't deserialize unregistered class ${i}`);if(r.deserialize)return r.deserialize(t);let a=Object.create(r.prototype);for(let r of Object.keys(t)){if("$name"===r)continue;let n=t[r];a[r]=az[i].shallow.includes(r)?n:aO(n)}return a}class aV{constructor(){this.first=!0}update(t,i){let r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=i),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}function aj(t){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}function aN(t){return/\s/u.test(String.fromCodePoint(t))}function aU(t){for(let i of t)if(aj(i.codePointAt(0)))return!0;return!1}function aG(t){return RegExp(t.map(t=>{try{return RegExp(`\\p{sc=${t}}`,"u").source}catch(t){return null}}).filter(t=>t).join("|"),"u")}let a$=aG(["Arab","Dupl","Mong","Ougr","Syrc"]);function aZ(t){return!(aj(t)||/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t)))}
2let aq=aG(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function aW(t){return aq.test(String.fromCodePoint(t))}let aH=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(aH.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,i){return b(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if("loading"!==t.pluginStatus)return this.setState(t),t;let r=t.pluginURL,a=new Promise(t=>{this.loadScriptResolve=t});i(r);let n=new Promise(t=>setTimeout(()=>t(),this.TIMEOUT));if(yield Promise.race([a,n]),this.isParsed()){let t={pluginStatus:"loaded",pluginURL:r};return this.setState(t),t}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};class aX{constructor(t,i){this.isSupportedScript=aY,this.zoom=t,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new aV,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new aV,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,i=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*i}}}function aY(t){var i,r="loaded"===aH.getRTLTextPluginStatus();for(let a of t)if(i=a.codePointAt(0),!r&&aW(i)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(i)))return!1;return!0}let aK="-transition";class aJ{constructor(t,i,r){this.property=t,this.value=i,this.expression=function(t,i,r){if(rk(t))return new rq(t,i);if(rN(t)){let a=rZ(t,i,r);if("error"===a.result)throw Error(a.value.map(t=>`${t.key}: ${t.message}`).join(", "));return a.value}{let r=t;return"color"===i.type&&"string"==typeof t?r=tq.parse(t):"padding"===i.type&&("number"==typeof t||Array.isArray(t))?r=tK.parse(t):"numberArray"===i.type&&("number"==typeof t||Array.isArray(t))?r=tJ.parse(t):"colorArray"===i.type&&("string"==typeof t||Array.isArray(t))?r=tQ.parse(t):"variableAnchorOffsetCollection"===i.type&&Array.isArray(t)?r=t2.parse(t):"projectionDefinition"===i.type&&"string"==typeof t&&(r=t5.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>r}}}(void 0===i?t.specification.default:i,t.specification,r)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,i,r){return this.property.possiblyEvaluate(this,t,i,r)}}class aQ{constructor(t,i){this.property=t,this.value=new aJ(t,void 0,i)}transitioned(t,i){return new a1(this.property,this.value,i,ev({},t.transition,this.transition),t.now)}untransitioned(){return new a1(this.property,this.value,null,{},0)}}class a0{constructor(t,i){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=i}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return eS(this._values[t].value.value)}setValue(t,i){Object.hasOwn(this._values,t)||(this._values[t]=new aQ(this._values[t].property,this._globalState)),this._values[t].value=new aJ(this._values[t].property,null===i?void 0:eS(i),this._globalState)}getTransition(t){return eS(this._values[t].transition)}setTransition(t,i){Object.hasOwn(this._values,t)||(this._values[t]=new aQ(this._values[t].property,this._globalState)),this._values[t].transition=eS(i)||void 0}serialize(){let t={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(t[i]=r);let a=this.getTransition(i);void 0!==a&&(t[`${i}${aK}`]=a)}return t}transitioned(t,i){let r=new a2(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].transitioned(t,i._values[a]);return r}untransitioned(){let t=new a2(this._properties);for(let i of Object.keys(this._values))t._values[i]=this._values[i].untransitioned();return t}}class a1{constructor(t,i,r,a,n){this.property=t,this.value=i,this.begin=n+a.delay||0,this.end=this.begin+a.duration||0,t.specification.transition&&(a.delay||a.duration)&&(this.prior=r)}possiblyEvaluate(t,i,r){let a=t.now||0,n=this.value.possiblyEvaluate(t,i,r),s=this.prior;if(s){if(a>this.end||this.value.isDataDriven())return this.prior=null,n;if(a<this.begin)return s.possiblyEvaluate(t,i,r);{let o=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,i,r),n,em(o))}}return n}}class a2{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,i,r){let a=new a6(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(t,i,r);return a}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class a3{constructor(t,i){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=i}hasValue(t){return void 0!==this._values[t].value}hasProperty(t){return t in this._properties.defaultPropertyValues}getValue(t){return eS(this._values[t].value)}setValue(t,i){this._values[t]=new aJ(this._values[t].property,null===i?void 0:eS(i),this._globalState)}serialize(){let t={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(t[i]=r)}return t}possiblyEvaluate(t,i,r){let a=new a6(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(t,i,r);return a}}class a5{constructor(t,i,r){this.property=t,this.value=i,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,i,r,a){return this.property.evaluate(this.value,this.parameters,t,i,r,a)}}class a6{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class a4{constructor(t){this.specification=t}possiblyEvaluate(t,i){if(t.isDataDriven())throw Error("Value should not be data driven");return t.expression.evaluate(i)}interpolate(t,i,r){let a=iE[this.specification.type];return a?a(t,i,r):t}}class a8{constructor(t,i){this.specification=t,this.overrides=i}possiblyEvaluate(t,i,r,a){return new a5(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(i,null,{},r,a)}:t.expression,i)}interpolate(t,i,r){if("constant"!==t.value.kind||"constant"!==i.value.kind)return t;if(void 0===t.value.value||void 0===i.value.value)return new a5(this,{kind:"constant",value:void 0},t.parameters);let a=iE[this.specification.type];return a?new a5(this,{kind:"constant",value:a(t.value.value,i.value.value,r)},t.parameters):t}evaluate(t,i,r,a,n,s){return"constant"===t.kind?t.value:t.evaluate(i,r,a,n,s)}}class a7 extends a8{possiblyEvaluate(t,i,r,a){if(void 0===t.value)return new a5(this,{kind:"constant",value:void 0},i);if("constant"===t.expression.kind){let n=t.expression.evaluate(i,null,{},r,a),s="resolvedImage"===t.property.specification.type&&"string"!=typeof n?n.name:n;return new a5(this,{kind:"constant",value:this._calculate(s,s,s,i)},i)}return"camera"===t.expression.kind?new a5(this,{kind:"constant",value:this._calculate(t.expression.evaluate({zoom:i.zoom-1}),t.expression.evaluate({zoom:i.zoom}),t.expression.evaluate({zoom:i.zoom+1}),i)},i):new a5(this,t.expression,i)}evaluate(t,i,r,a,n,s){if("source"===t.kind){let o=t.evaluate(i,r,a,n,s);return this._calculate(o,o,o,i)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(i.zoom)-1},r,a),t.evaluate({zoom:Math.floor(i.zoom)},r,a),t.evaluate({zoom:Math.floor(i.zoom)+1},r,a),i):t.value}_calculate(t,i,r,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:i}:{from:r,to:i}}interpolate(t){return t}}class a9{constructor(t){this.specification=t}possiblyEvaluate(t,i,r,a){if(void 0!==t.value){if("constant"===t.expression.kind){let n=t.expression.evaluate(i,null,{},r,a);return this._calculate(n,n,n,i)}return this._calculate(t.expression.evaluate(new aX(Math.floor(i.zoom-1),i)),t.expression.evaluate(new aX(Math.floor(i.zoom),i)),t.expression.evaluate(new aX(Math.floor(i.zoom+1),i)),i)}}_calculate(t,i,r,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:i}:{from:r,to:i}}interpolate(t){return t}}class ne{constructor(t){this.specification=t}possiblyEvaluate(t,i,r,a){return!!t.expression.evaluate(i,null,{},r,a)}interpolate(){return!1}}class nt{constructor(t){for(const i in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){const r=t[i];r.specification.overridable&&this.overridableProperties.push(i);const a=this.defaultPropertyValues[i]=new aJ(r,void 0,void 0),n=this.defaultTransitionablePropertyValues[i]=new aQ(r,void 0);this.defaultTransitioningPropertyValues[i]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=a.possiblyEvaluate({})}}}ak("DataDrivenProperty",a8),ak("DataConstantProperty",a4),ak("CrossFadedDataDrivenProperty",a7),ak("CrossFadedProperty",a9),ak("ColorRampProperty",ne);let ni=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",nr=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class na extends eQ{constructor(t,i,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(t,i){return new aP(t,i)}(this.visibility,r),"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=rK(t.filter,r)),i.layout&&(this._unevaluatedLayout=new a3(i.layout,r)),i.paint)){for(const a in this._transitionablePaint=new a0(i.paint,r),t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(const i in t.layout)this.setLayoutProperty(i,t.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new a6(i.paint)}}setFilter(t){this.filter=t,this._featureFilter=rK(t,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){var i;if("visibility"===t)return this.visibility;if(null==(i=this._transitionablePaint)?void 0:i.hasProperty(t))throw Error(t+ni);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let i of this._visibilityExpression.getGlobalStateRefs())t.add(i);if(this._unevaluatedLayout)for(let i in this._unevaluatedLayout._values)for(let r of this._unevaluatedLayout._values[i].getGlobalStateRefs())t.add(r);for(let i of this._featureFilter.getGlobalStateRefs())t.add(i);return t}getPaintAffectingGlobalStateRefs(){var t;let i=new globalThis.Map;if(this._transitionablePaint)for(let r in this._transitionablePaint._values){let a=this._transitionablePaint._values[r].value;for(let n of a.getGlobalStateRefs()){let s=null!=(t=i.get(n))?t:[];s.push({name:r,value:a.value}),i.set(n,s)}}return i}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,i,r={}){var a;"visibility"===t?(this.visibility=i,this._visibilityExpression.setValue(i),this.recalculateVisibility()):(null==(a=this._transitionablePaint)?void 0:a.hasProperty(t))?this.fire(new eJ(Error(t+ni))):null!=i&&this._val
2idate(aC,`layers.${this.id}.layout.${t}`,t,i,r)||this._unevaluatedLayout.setValue(t,i)}getPaintProperty(t){var i,r;if(t.endsWith(aK)){let r=t.slice(0,-11);if("visibility"===r||(null==(i=this._unevaluatedLayout)?void 0:i.hasProperty(r)))throw Error(t+nr);return this._transitionablePaint.getTransition(r)}if("visibility"===t||(null==(r=this._unevaluatedLayout)?void 0:r.hasProperty(t)))throw Error(t+nr);return this._transitionablePaint.getValue(t)}setPaintProperty(t,i,r={}){var a;if("visibility"===t||(null==(a=this._unevaluatedLayout)?void 0:a.hasProperty(t)))return this.fire(new eJ(Error(t+nr))),!1;if(null!=i&&this._validate(aE,`layers.${this.id}.paint.${t}`,t,i,r))return!1;if(t.endsWith(aK))return this._transitionablePaint.setTransition(t.slice(0,-11),i||void 0),!1;{let r=this._transitionablePaint._values[t],a="cross-faded-data-driven"===r.property.specification["property-type"],n=r.value.isDataDriven(),s=r.value;this._transitionablePaint.setValue(t,i),this._handleSpecialPaintPropertyUpdate(t);let o=this._transitionablePaint._values[t].value;return o.isDataDriven()||n||a||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,i,r){return!1}isHidden(t=this.minzoom,i=!1){return!!(this.minzoom&&t<(i?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,i){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,i)}serialize(){var t,i;
2let r={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:null==(t=this._unevaluatedLayout)?void 0:t.serialize(),paint:null==(i=this._transitionablePaint)?void 0:i.serialize()};return this.visibility&&(r.layout||(r.layout={}),r.layout.visibility=this.visibility),eT(r,(t,i)=>!(void 0===t||"layout"===i&&!Object.keys(t).length||"paint"===i&&!Object.keys(t).length))}_validate(t,i,r,a,n={}){return!1!==(null==n?void 0:n.validate)&&aA(this,t.call(av,{key:i,layerType:this.type,objectKey:r,value:a,styleSpec:e0,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let i=this.paint.get(t);if(i instanceof a5&&rC(i.property.specification)&&("source"===i.value.kind||"composite"===i.value.kind)&&i.value.isStateDependent)return!0}return!1}}var nn={get paint(){return s=s||new nt({"raster-opacity":new a4(e0.paint_raster["raster-opacity"]),"raster-hue-rotate":new a4(e0.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new a4(e0.paint_raster["raster-brightness-min"]),"raster-brightness-max":new a4(e0.paint_raster["raster-brightness-max"]),"raster-saturation":new a4(e0.paint_raster["raster-saturation"]),"raster-contrast":new a4(e0.paint_raster["raster-contrast"]),resampling:new a4(e0.paint_raster.resampling),"raster-resampling":new a4(e0.paint_raster["raster-resampling"]),"raster-fade-duration":new a4(e0.paint_raster["raster-fade-duration"])})}};class ns extends na{constructor(t,i){super(t,nn,i)}}let no={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};
2class nl{constructor(t,i){this._structArray=t,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class nh{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,i){return t._trim(),i&&(t.isTransferred=!0,i.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let i=Object.create(this.prototype);return i.arrayBuffer=t.arrayBuffer,i.length=t.length,i.capacity=t.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function nu(t,i=1){let r=0,a=0;return{members:t.map(t=>{let n=no[t.type].BYTES_PER_ELEMENT,s=r=nc(r,Math.max(i,n)),o=t.components||1;return a=Math.max(a,n),r+=n*o,{name:t.name,type:t.type,components:o,offset:s}}),size:nc(r,Math.max(a,i)),alignment:i}}function nc(t,i){return Math.ceil(t/i)*i}class nd extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){let a=2*t;return this.int16[a+0]=i,this.int16[a+1]=r,t}}nd.prototype.bytesPerElement=4,ak("StructArrayLayout2i4",nd);class np extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=3*t;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,t}}np.prototype.bytesPerElement=6,ak("StructArrayLayout3i6",np);class nf extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,t,i,r,a)}emplace(t,i,r,a,n){let s=4*t;return this.int16[s+0]=i,this.int16[s+1]=r,this.int16[s+2]=a,this.int16[s+3]=n,t}}nf.prototype.bytesPerElement=8,ak("StructArrayLayout4i8",nf);class nm extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=6*t;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=s,this.int16[l+5]=o,t}}nm.prototype.bytesPerElement=12,ak("StructArrayLayout2i4i12",nm);class n_ extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=4*t,h=8*t;return this.int16[l+0]=i,this.int16[l+1]=r,this.uint8[h+4]=a,this.uint8[h+5]=n,this.uint8[h+6]=s,this.uint8[h+7]=o,t}}n_.prototype.bytesPerElement=8,ak("StructArrayLayout2i4ub8",n_);class ng extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){let a=2*t;return this.float32[a+0]=i,this.float32[a+1]=r,t}}ng.prototype.bytesPerElement=8,ak("StructArrayLayout2f8",ng);class ny extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,h,u){let c=this.length;return this.resize(c+1),this.emplace(c,t,i,r,a,n,s,o,l,h,u)}emplace(t,i,r,a,n,s,o,l,h,u,c){let d=10*t;return this.uint16[d+0]=i,this.uint16[d+1]=r,this.uint16[d+2]=a,this.uint16[d+3]=n,this.uint16[d+4]=s,this.uint16[d+5]=o,this.uint16[d+6]=l,this.uint16[d+7]=h,this.uint16[d+8]=u,this.uint16[d+9]=c,t}}ny.prototype.bytesPerElement=20,ak("StructArrayLayout10ui20",ny);
2class nx extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l){let h=this.length;return this.resize(h+1),this.emplace(h,t,i,r,a,n,s,o,l)}emplace(t,i,r,a,n,s,o,l,h){let u=8*t;return this.uint16[u+0]=i,this.uint16[u+1]=r,this.uint16[u+2]=a,this.uint16[u+3]=n,this.uint16[u+4]=s,this.uint16[u+5]=o,this.uint16[u+6]=l,this.uint16[u+7]=h,t}}nx.prototype.bytesPerElement=16,ak("StructArrayLayout8ui16",nx);class nv extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,h,u,c,d){let p=this.length;return this.resize(p+1),this.emplace(p,t,i,r,a,n,s,o,l,h,u,c,d)}emplace(t,i,r,a,n,s,o,l,h,u,c,d,p){let f=12*t;return this.int16[f+0]=i,this.int16[f+1]=r,this.int16[f+2]=a,this.int16[f+3]=n,this.uint16[f+4]=s,this.uint16[f+5]=o,this.uint16[f+6]=l,this.uint16[f+7]=h,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=d,this.int16[f+11]=p,t}}nv.prototype.bytesPerElement=24,ak("StructArrayLayout4i4ui4i24",nv);class nb extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=3*t;return this.float32[n+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,t}}nb.prototype.bytesPerElement=12,ak("StructArrayLayout3f12",nb);class nw extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint32[+t+0]=i,t}}nw.prototype.bytesPerElement=4,ak("StructArrayLayout1ul4",nw);class nT extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,h){let u=this.length;return this.resize(u+1),this.emplace(u,t,i,r,a,n,s,o,l,h)}emplace(t,i,r,a,n,s,o,l,h,u){let c=10*t;return this.int16[c+0]=i,this.int16[c+1]=r,this.int16[c+2]=a,this.int16[c+3]=n,this.int16[c+4]=s,this.int16[c+5]=o,this.uint32[5*t+3]=l,this.uint16[c+8]=h,this.uint16[c+9]=u,t}}nT.prototype.bytesPerElement=20,ak("StructArrayLayout6i1ul2ui20",nT);class nS extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=6*t;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=s,this.int16[l+5]=o,t}}nS.prototype.bytesPerElement=12,ak("StructArrayLayout2i2i2i12",nS);class nP extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,t,i,r,a,n)}emplace(t,i,r,a,n,s){let o=4*t,l=8*t;return this.float32[o+0]=i,this.float32[o+1]=r,this.float32[o+2]=a,this.int16[l+6]=n,this.int16[l+7]=s,t}}nP.prototype.bytesPerElement=16,ak("StructArrayLayout2f1f2i16",nP);class nM extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s){let o=this.length;return this.resize(o+1),this.emplace(o,t,i,r,a,n,s)}emplace(t,i,r,a,n,s,o){let l=16*t,h=4*t,u=8*t;return this.uint8[l+0]=i,this.uint8[l+1]=r,this.float32[h+1]=a,this.float32[h+2]=n,this.int16[u+6]=s,this.int16[u+7]=o,t}}nM.prototype.bytesPerElement=16,ak("StructArrayLayout2ub2f2i16",nM);class nI extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=3*t;return this.uint16[n+0]=i,this.uint16[n+1]=r,this.uint16[n+2]=a,t}}
2nI.prototype.bytesPerElement=6,ak("StructArrayLayout3ui6",nI);class nE extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g){let y=this.length;return this.resize(y+1),this.emplace(y,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g)}emplace(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y){let x=24*t,v=12*t,b=48*t;return this.int16[x+0]=i,this.int16[x+1]=r,this.uint16[x+2]=a,this.uint16[x+3]=n,this.uint32[v+2]=s,this.uint32[v+3]=o,this.uint32[v+4]=l,this.uint16[x+10]=h,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=d,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=m,this.uint8[b+38]=_,this.uint32[v+10]=g,this.int16[x+22]=y,t}}nE.prototype.bytesPerElement=48,ak("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",nE);class nC extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,P,M,I,E){let C=this.length;return this.resize(C+1),this.emplace(C,t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,P,M,I,E)}emplace(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,P,M,I,E,C){let A=32*t,D=16*t;return this.int16[A+0]=i,this.int16[A+1]=r,this.int16[A+2]=a,this.int16[A+3]=n,this.int16[A+4]=s,this.int16[A+5]=o,this.int16[A+6]=l,this.int16[A+7]=h,this.uint16[A+8]=u,this.uint16[A+9]=c,this.uint16[A+10]=d,this.uint16[A+11]=p,this.uint16[A+12]=f,this.uint16[A+13]=m,this.uint16[A+14]=_,this.uint16[A+15]=g,this.uint16[A+16]=y,this.uint16[A+17]=x,this.uint16[A+18]=v,this.uint16[A+19]=b,this.uint16[A+20]=w,this.uint16[A+21]=T,this.uint16[A+22]=S,this.uint32[D+12]=P,this.float32[D+13]=M,this.float32[D+14]=I,this.uint16[A+30]=E,this.uint16[A+31]=C,t}}nC.prototype.bytesPerElement=64,ak("StructArrayLayout8i15ui1ul2f2ui64",nC);class nA extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.float32[+t+0]=i,t}}nA.prototype.bytesPerElement=4,ak("StructArrayLayout1f4",nA);class nD extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=3*t;return this.uint16[6*t+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,t}}nD.prototype.bytesPerElement=12,ak("StructArrayLayout1ui2f12",nD);class nz extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t,i,r)}emplace(t,i,r,a){let n=4*t;return this.uint32[2*t+0]=i,this.uint16[n+2]=r,this.uint16[n+3]=a,t}}nz.prototype.bytesPerElement=8,ak("StructArrayLayout1ul2ui8",nz);class nk extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,i)}emplace(t,i,r){let a=2*t;return this.uint16[a+0]=i,this.uint16[a+1]=r,t}}nk.prototype.bytesPerElement=4,ak("StructArrayLayout2ui4",nk);class nR extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let i=this.length;return this.resize(i+1),this.emplace(i,t)}emplace(t,i){return this.uint16[+t+0]=i,t}}nR.prototype.bytesPerElement=2,ak("StructArrayLayout1ui2",nR);class nL extends nh{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,t,i,r,a)}emplace(t,i,r,a,n){let s=4*t;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.float32[s+3]=n,t}}nL.prototype.bytesPerElement=16,ak("StructArrayLayout4f16",nL);
2class nF extends nl{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new w(this.anchorPointX,this.anchorPointY)}}nF.prototype.size=20;class nB extends nT{get(t){return new nF(this,t)}}ak("CollisionBoxArray",nB);class nO extends nl{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}nO.prototype.size=48;class nV extends nE{get(t){return new nO(this,t)}}ak("PlacedSymbolArray",nV);class nj extends nl{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}nj.prototype.size=64;class nN extends nC{get(t){return new nj(this,t)}}ak("SymbolInstanceArray",nN);
2class nU extends nA{getoffsetX(t){return this.float32[+t+0]}}ak("GlyphOffsetArray",nU);class nG extends np{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}ak("SymbolLineVertexArray",nG);class n$ extends nl{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}n$.prototype.size=12;class nZ extends nD{get(t){return new n$(this,t)}}ak("TextAnchorOffsetArray",nZ);class nq extends nl{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]}}nq.prototype.size=8;class nW extends nz{get(t){return new nq(this,t)}}ak("FeatureIndexArray",nW);class nH extends nd{}class nX extends nd{}class nY extends nd{}class nK extends nm{}class nJ extends n_{}class nQ extends ng{}class n0 extends ny{}class n1 extends nx{}class n2 extends nv{}class n3 extends nb{}class n5 extends nw{}class n6 extends nS{}class n4 extends nM{}class n8 extends nI{}class n7 extends nk{}let{members:n9}=nu([{name:"a_pos",components:2,type:"Int16"}],4);class se{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,i,r,a){let n=this.segments[this.segments.length-1];return t>se.MAX_VERTEX_ARRAY_LENGTH&&eM(`Max vertices per segment is ${se.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${se.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>se.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==a?this.createNewSegment(i,r,a):n}createNewSegment(t,i,r){let a={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==r&&(a.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(a),a}getOrCreateLatestSegment(t,i,r){return this.prepareSegment(0,t,i,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let i in t.vaos)t.vaos[i].destroy()}static simpleSegment(t,i,r,a){return new se([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}}function st(t,i){return 256*(t=ey(Math.floor(t),0,255))+ey(Math.floor(i),0,255)}se.MAX_VERTEX_ARRAY_LENGTH=65535,ak("SegmentVector",se);let si=nu([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),sr=nu([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var sa,sn,ss,so={exports:{}},sl={exports:{}},sh={exports:{}},su=T(function(){if(ss)return so.exports;ss=1;var t=(sa||(sa=1,sl.exports=function(t,i){var r,a,n,s,o,l;for(a=t.length-(r=3&t.length),n=i,l=0;l<a;)o=255&t.charCodeAt(l)|(255&t.charCodeAt(++l))<<8|(255&t.charCodeAt(++l))<<16|(255&t.charCodeAt(++l))<<24,++l,n=27492+(65535&(s=5*(65535&(n=(n^=o=(65535&(o=(o=(65535&o)*0xcc9e2d51+(((o>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|o>>>17))*0x1b873593+(((o>>>16)*0x1b873593&65535)<<16)|0)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)|0))+((58964+(s>>>16)&65535)<<16);switch(o=0,r){case 3:o^=(255&t.charCodeAt(l+2))<<16;case 2:o^=(255&t.charCodeAt(l+1))<<8;case 1:n^=o=(65535&(o=(o=(65535&(o^=255&t.charCodeAt(l)))*0xcc9e2d51+(((o>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|o>>>17))*0x1b873593+(((o>>>16)*0x1b873593&65535)<<16)|0}return n^=t.length,n=0x85ebca6b*(65535&(n^=n>>>16))+((0x85ebca6b*(n>>>16)&65535)<<16)|0,n=0xc2b2ae35*(65535&(n^=n>>>13))+((0xc2b2ae35*(n>>>16)&65535)<<16)|0,(n^=n>>>16)>>>0}),sl.exports),i=(sn||(sn=1,sh.exports=function(t,i){for(var r,a=t.length,n=i^a,s=0;a>=4;)r=0x5bd1e995*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((0x5bd1e995*(r>>>16)&65535)<<16),n=0x5bd1e995*(65535&n)+((0x5bd1e995*(n>>>16)&65535)<<16)^(r=0x5bd1e995*(65535&(r^=r>>>24))+((0x5bd1e995*(r>>>16)&65535)<<16)),a-=4,++s;switch(a){case 3:n^=(255&t.charCodeAt(s+2))<<16;case 2:n^=(255&t.charCodeAt(s+1))<<8;case 1:n=0x5bd1e995*(65535&(n^=255&t.charCodeAt(s)))+((0x5bd1e995*(n>>>16)&65535)<<16)}return n=0x5bd1e995*(65535&(n^=n>>>13))+((0x5bd1e995*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}
2),sh.exports);return so.exports=t,so.exports.murmur3=t,so.exports.murmur2=i,so.exports}());class sc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,i,r,a){this.ids.push(sd(t)),this.positions.push(i,r,a)}getPositions(t){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let i=sd(t),r=0,a=this.ids.length-1;for(;r<a;){let t=r+a>>1;this.ids[t]>=i?a=t:r=t+1}let n=[];for(;this.ids[r]===i;)n.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return n}static serialize(t,i){let r=new Float64Array(t.ids),a=new Uint32Array(t.positions);return function t(i,r,a,n){for(;a<n;){let s=i[a+n>>1],o=a-1,l=n+1;for(;;){do o++;while(i[o]<s);do l--;while(i[l]>s);if(o>=l)break;sp(i,o,l),sp(r,3*o,3*l),sp(r,3*o+1,3*l+1),sp(r,3*o+2,3*l+2)}l-a<n-l?(t(i,r,a,l),a=l+1):(t(i,r,l+1,n),n=l)}}(r,a,0,r.length-1),i&&i.push(r.buffer,a.buffer),{ids:r,positions:a}}static deserialize(t){let i=new sc;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}}function sd(t){let i=+t;return!isNaN(i)&&i<=Number.MAX_SAFE_INTEGER?i:su(String(t))}function sp(t,i,r){let a=t[i];t[i]=t[r],t[r]=a}ak("FeaturePositionMap",sc);class sf{constructor(t,i){this.gl=t.gl,this.location=i}}class sm extends sf{constructor(t,i){super(t,i),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class s_ extends sf{constructor(t,i){super(t,i),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class sg extends sf{constructor(t,i){super(t,i),this.current=tq.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}let sy=new Float32Array(16);function sx(t){return[st(255*t.r,255*t.g),st(255*t.b,255*t.a)]}class sv{constructor(t,i,r){this.value=t,this.uniformNames=i.map(t=>`u_${t}`),this.type=r}setUniform(t,i,r){t.set(r.constantOr(this.value))}getBinding(t,i,r){return"color"===this.type?new sg(t,i):new sm(t,i)}}class sb{constructor(t,i){this.uniformNames=i.map(t=>`u_${t}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,i){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(t,i,r,a){let n=null;"u_pattern_to"===a?n=this.patternTo:"u_pattern_from"===a?n=this.patternFrom:"u_dasharray_to"===a?n=this.dashTo:"u_dasharray_from"===a?n=this.dashFrom:"u_pixel_ratio_to"===a?n=this.pixelRatioTo:"u_pixel_ratio_from"===a&&(n=this.pixelRatioFrom),null!==n&&t.set(n)}getBinding(t,i,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new s_(t,i):new sm(t,i)}}class sw{constructor(t,i,r,a){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,i,r){let a=this.paintVertexArray.length,n=this.expression.evaluate(new aX(0,r),i,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(a,t,n)}updatePaintArray(t,i,r,a,n){let s=this.expression.evaluate(new aX(0,n),r,a);this._setPaintValue(t,i,s)}_setPaintValue(t,i,r){if("color"===this.type){let a=sx(r);for(let r=t;r<i;r++)this.paintVertexArray.emplace(r,a[0],a[1])}else{for(let a=t;a<i;a++)this.paintVertexArray.emplace(a,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){var i,r;(null==(i=this.paintVertexArray)?void 0:i.arrayBuffer.byteLength)&&((null==(r=this.paintVertexBuffer)?void 0:r.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class sT{constructor(t,i,r,a,n,s){this.expression=t,this.uniformNames=i.map(t=>`u_${t}_t`),this.type=r,this.useIntegerZoom=a,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=i.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(t,i,r){let a=this.expression.evaluate(new aX(this.zoom,r),i,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new aX(this.zoom+1,r),i,{},r.canonical,[],r.formattedSection),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,a,n)}updatePaintArray(t,i,r,a,n){let s=this.expression.evaluate(new aX(this.zoom,n),r,a),o=this.expression.evaluate(new aX(this.zoom+1,n),r,a);this._setPaintValue(t,i,s,o)}_setPaintValue(t,i,r,a){if("color"===this.type){let n=sx(r),s=sx(a);for(let r=t;r<i;r++)this.paintVertexArray.emplace(r,n[0],n[1],s[0],s[1])}else{for(let n=t;n<i;n++)this.paintVertexArray.emplace(n,r,a);
2this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(a))}}upload(t){var i,r;(null==(i=this.paintVertexArray)?void 0:i.arrayBuffer.byteLength)&&((null==(r=this.paintVertexBuffer)?void 0:r.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,i){let r=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,a=ey(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(a)}getBinding(t,i,r){return new sm(t,i)}}class sS{constructor(t,i,r,a,n,s){this.expression=t,this.type=i,this.useIntegerZoom=r,this.zoom=a,this.layerId=s,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,i,r){let a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(a,t,this.getPositionIds(i),r)}updatePaintArray(t,i,r,a,n){this._setPaintValues(t,i,this.getPositionIds(r),n)}_setPaintValues(t,i,r,a){let n=this.getPositions(a);if(!n||!r)return;let s=n[r.min],o=n[r.mid],l=n[r.max];if(s&&o&&l)for(let r=t;r<i;r++)this.emplace(this.zoomInPaintVertexArray,r,o,s),this.emplace(this.zoomOutPaintVertexArray,r,o,l)}upload(t){var i,r;if((null==(i=this.zoomInPaintVertexArray)?void 0:i.arrayBuffer.byteLength)&&(null==(r=this.zoomOutPaintVertexArray)?void 0:r.arrayBuffer.byteLength)){let i=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,i,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,i,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class sP extends sS{getPositions(t){return t.imagePositions}getPositionIds(t){var i;return null==(i=t.patterns)?void 0:i[this.layerId]}getVertexAttributes(){return si.members}emplace(t,i,r,a){t.emplace(i,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],a.tlbr[0],a.tlbr[1],a.tlbr[2],a.tlbr[3],r.pixelRatio,a.pixelRatio)}}class sM extends sS{getPositions(t){return t.dashPositions}getPositionIds(t){var i;return null==(i=t.dashes)?void 0:i[this.layerId]}getVertexAttributes(){return sr.members}emplace(t,i,r,a){t.emplace(i,0,r.y,r.height,r.width,0,a.y,a.height,a.width)}}class sI{constructor(t,i,r){this.binders={},this._buffers=[];const a=[];for(const n in t.paint._values){if(!r(n))continue;const s=t.paint.get(n);if(!(s instanceof a5&&rC(s.property.specification)))continue;const o=function(t,i){return({"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]})[t]||[t.replace(`${i}-`,"").replace(/-/g,"_")]}(n,t.type),l=s.value,h=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],d="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===l.kind)this.binders[n]=d?new sb(l.value,o):new sv(l.value,o,h),a.push(`/u_${n}`);else if("source"===l.kind||d){const r=sC(n,h,"source");this.binders[n]=d?"line-dasharray"===n?new sM(l,h,u,i,r,t.id):new sP(l,h,u,i,r,t.id):new sw(l,o,h,r),a.push(`/a_${n}`)}else{const t=sC(n,h,"composite");this.binders[n]=new sT(l,o,h,u,i,t),a.push(`/z_${n}`)}}this.cacheKey=a.sort().join("")}getMaxValue(t){let i=this.binders[t];return i instanceof sw||i instanceof sT?i.maxValue:0}populatePaintArrays(t,i,r){for(let a in this.binders){let n=this.binders[a];
2(n instanceof sw||n instanceof sT||n instanceof sS)&&n.populatePaintArray(t,i,r)}}setConstantPatternPositions(t,i){for(let r in this.binders){let a=this.binders[r];a instanceof sb&&a.setConstantPatternPositions(t,i)}}setConstantDashPositions(t,i){for(let r in this.binders){let a=this.binders[r];a instanceof sb&&a.setConstantDashPositions(t,i)}}updatePaintArrays(t,i,r,a,n){let s=!1;for(let o in t)for(let l of i.getPositions(o)){let i=r.feature(l.index);for(let r in this.binders){let h=this.binders[r];(h instanceof sw||h instanceof sT||h instanceof sS)&&!0===h.expression.isStateDependent&&(h.expression=a.paint.get(r).value,h.updatePaintArray(l.start,l.end,i,t[o],n),s=!0)}}return s}defines(){let t=[];for(let i in this.binders){let r=this.binders[i];(r instanceof sv||r instanceof sb)&&t.push(...r.uniformNames.map(t=>`#define HAS_UNIFORM_${t}`))}return t}getBinderAttributes(){let t=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof sw||r instanceof sT)for(let i of r.paintVertexAttributes)t.push(i.name);else if(r instanceof sS)for(let i of r.getVertexAttributes())t.push(i.name)}return t}getBinderUniforms(){let t=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof sv||r instanceof sb||r instanceof sT)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,i){let r=[];for(let a in this.binders){let n=this.binders[a];if(n instanceof sv||n instanceof sb||n instanceof sT){for(let s of n.uniformNames)if(i[s]){let o=n.getBinding(t,i[s],s);r.push({name:s,property:a,binding:o})}}}return r}setUniforms(t,i,r,a){for(let{name:t,property:n,binding:s}of i)this.binders[n].setUniform(s,a,r.get(n),t)}updatePaintBuffers(t){for(let i in this._buffers=[],this.binders){let r=this.binders[i];if(t&&r instanceof sS){let i=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof sw||r instanceof sT)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let i in this.binders){let r=this.binders[i];(r instanceof sw||r instanceof sT||r instanceof sS)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let i=this.binders[t];(i instanceof sw||i instanceof sT||i instanceof sS)&&i.destroy()}}}class sE{constructor(t,i,r=()=>!0){for(const a of(this.programConfigurations={},t))this.programConfigurations[a.id]=new sI(a,i,r);this.needsUpload=!1,this._featureMap=new sc,this._bufferOffset=0}populatePaintArrays(t,i,r,a){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,i,a);void 0!==i.id&&this._featureMap.add(i.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,i,r,a){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,i,n,a)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let i in this.programConfigurations)this.programConfigurations[i].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function sC(t,i,r){let a={"line-pattern":{source:n0,composite:n0}
2,"fill-pattern":{source:n0,composite:n0},"fill-extrusion-pattern":{source:n0,composite:n0},"line-dasharray":{source:n1,composite:n1}}[t];return(null==a?void 0:a[r])||({color:{source:ng,composite:nL},number:{source:nA,composite:ng}})[i][r]}ak("ConstantBinder",sv),ak("CrossFadedConstantBinder",sb),ak("SourceExpressionBinder",sw),ak("CrossFadedPatternBinder",sP),ak("CrossFadedDasharrayBinder",sM),ak("CompositeExpressionBinder",sT),ak("ProgramConfiguration",sI,{omit:["_buffers"]}),ak("ProgramConfigurationSet",sE);let sA=-16383-1;function sD(t){let i=8192/t.extent,r=t.loadGeometry();for(let t of r)for(let r of t){let t=Math.round(r.x*i),a=Math.round(r.y*i);r.x=ey(t,sA,16383),r.y=ey(a,sA,16383),(t<r.x||t>r.x+1||a<r.y||a>r.y+1)&&eM("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function sz(t,i){return{type:t.type,id:t.id,properties:t.properties,geometry:i?sD(t):[]}}class sk{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new nX,this.indexArray=new n8,this.segments=new se,this.programConfigurations=new sE(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,i,r){let a=this.layers[0],n=[],s=null,o=!1,l="heatmap"===a.type;"circle"===a.type&&(o=!(s=a.layout.get("circle-sort-key")).isConstant(),l||(l="map"===a.paint.get("circle-pitch-alignment")));let h=l?i.subdivisionGranularity.circle:1;for(let{feature:i,id:a,index:l,sourceLayerIndex:h}of t){let t=this.layers[0]._featureFilter.needGeometry,u=sz(i,t);if(!this.layers[0]._featureFilter.filter(new aX(this.zoom),u,r))continue;let c=o?s.evaluate(u,{},r):void 0,d={id:a,properties:i.properties,type:i.type,sourceLayerIndex:h,index:l,geometry:t?u.geometry:sD(i),patterns:{},sortKey:c};n.push(d)}for(let a of(o&&n.sort((t,i)=>t.sortKey-i.sortKey),n)){let{geometry:n,index:s,sourceLayerIndex:o}=a,l=t[s].feature;this.addFeature(a,n,s,r,h),i.featureIndex.insert(l,n,s,o,this.index)}}update(t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,n9),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,i,r,a,n=1){let s;switch(n){case 1:s=[0,7];break;case 3:s=[0,2,5,7];break;case 5:s=[0,1,3,4,6,7];break;case 7:s=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let o=s.length;for(let r of i)for(let i of r){let r=i.x,a=i.y;if(r<0||r>=8192||a<0||a>=8192)continue;let n=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,t.sortKey),c=n.vertexLength;for(let t=0;t<o;t++)for(let i=0;i<o;i++){var l,h,u;l=this.layoutVertexArray,h=s[i],u=s[t],l.emplaceBack(-32768+8*r+h,-32768+8*a+u)}for(let t=0;t<o-1;t++)for(let i=0;i<o-1;i++){let r=c+t*o+i,a=c+(t+1)*o+i;this.indexArray.emplaceBack(r,a+1,r+1),this.indexArray.emplaceBack(r,a,a+1)}n.vertexLength+=o*o,n.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:{},canonical:a})}}function sR(t,i){for(let r of t)if(sN(i,r))return!0;for(let r of i)if(sN(t,r))return!0;return sB(t,i)}function sL(t,i,r){return!!sN(t,i)||sO(i,t,r)}function sF(t,i){if(1===t.length)return sj(i,t[0]);for(let r of i)for(let i of r)if(sN(t,i))return!0;for(let r of t)if(sj(i,r))return!0;for(let r of i)if(sB(t,r))return!0;return!1}function sB(t,i){if(0===t.length||0===i.length)return!1;for(let o=0;o<t.length-1;o++){let l=t[o],h=t[o+1];for(let t=0;t<i.length-1;t++){var r,a,n,s;if(r=l,a=h,n=i[t],eI(r,n,s=i[t+1])!==eI(a,n,s)&&eI(r,a,n)!==eI(r,a,s))return!0}}return!1}function sO(t,i,r){let a=r*r;if(1===i.length)return t.distSqr(i[0])<a;for(let r=1;r<i.length;r++)if(sV(t,i[r-1],i[r])<a)return!0;return!1}function sV(t,i,r){let a=i.distSqr(r);if(0===a)return t.distSqr(i);let n=((t.x-i.x)*(r.x-i.x)+(t.y-i.y)*(r.y-i.y))/a;return t.distSqr(n<0?i:n>1?r:r.sub(i)._mult(n)._add(i))}function sj(t,i){let r,a,n=!1;for(let s of t)for(let t=0,o=s.length-1;t<s.length;o=t++)r=s[t],a=s[o],r.y>i.y!=a.y>i.y&&i.x<(a.x-r.x)*(i.y-r.y)/(a.y-r.y)+r.x&&(n=!n);return n}function sN(t,i){let r=!1;for(let a=0,n=t.length-1;a<t.length;n=a++){let s=t[a],o=t[n];s.y>i.y!=o.y>i.y&&i.x<(o.x-s.x)*(i.y-s.y)/(o.y-s.y)+s.x&&(r=!r)}return r}function sU(t,i,r){let a=i.paint.get(t).value;return"constant"===a.kind?a.value:r.programConfigurations.get(i.id).getMaxValue(t)}function sG(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function s$(t,i,r,a,n){if(!i[0]&&!i[1])return t;let s=w.convert(i)._mult(n);"viewport"===r&&s._rotate(-a);let o=[];for(let i of t)o.push(i.sub(s));return o}function sZ({queryGeometry:t,size:i},r){return sL(t,r,i)}function sq({queryGeometry:t,size:i,transform:r,unwrappedTileID:a,getElevation:n},s){return sL(t,s,i*(r.projectTileCoordinates(s.x,s.y,a,n).signedDistanceFromCamera/r.cameraToCenterDistance))}function sW({queryGeometry:t,size:i,transform:r,unwrappedTileID:a,getElevation:n},s){let o=r.projectTileCoordinates(s.x,s.y,a,n).signedDistanceFromCamera,l=i*(r.cameraToCenterDistance/o);return sL(t,sY(s,r,a,n),l)}function sH({queryGeometry:t,size:i,transform:r,unwrappedTileID:a,getElevation:n},s){return sL(t,sY(s,r,a,n),i)}function sX({queryGeometry:t,size:i,transform:r,unwrappedTileID:a,getElevation:n,pitchAlignment:s="map",pitchScale:o="map"},l){let h="map"===s?"map"===o?sZ:sq:"map"===o?sW:sH,u={queryGeometry:t,size:i,transform:r,unwrappedTileID:a,getElevation:n};for(let t of l)for(let i of t)if(h(u,i))return!0;return!1}function sY(t,i,r,a){let n=i.projectTileCoordinates(t.x,t.y,r,a).point;return new w((.5*n.x+.5)*i.width,(-(.5*n.y)+.5)*i.height)}ak("CircleBucket",sk,{omit:["layers"]});var sK={get paint(){return l=l||new nt({"circle-radius":new a8(e0.paint_circle["circle-radius"]),"circle-color":new a8(e0.paint_circle["circle-color"]),"circle-blur":new a8(e0.paint_circle["circle-blur"]),"circle-opacity":new a8(e0.paint_circle["circle-opacity"]),"circle-translate":new a4(e0.paint_circle["circle-translate"]),"circle-translate-anchor":new a4(e0.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new a4(e0.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new a4(e0.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new a8(e0.paint_circle["circle-stroke-width"]),"circle-stroke-color":new a8(e0.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new a8(e0.paint_circle["circle-stroke-opacity"])})},get layout(){return o=o||new nt({"circle-sort-key":new a8(e0.layout_circle["circle-sort-key"])})}};class sJ extends na{constructor(t,i){super(t,sK,i)}createBucket(t){return new sk(t)}queryRadius(t){return sU("circle-radius",this,t)+sU("circle-stroke-width",this,t)+sG(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:l}){let h,u,c=s$(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,s),d=this.paint.get("circle-radius").evaluate(i,r)+this.paint.get("circle-stroke-width").evaluate(i,r),p=this.paint.get("circle-pitch-scale"),f=this.paint.get("circle-pitch-alignment");return"map"===f?(h=c,u=d*s):(h=c.map(t=>sY(t,n,o,l)),u=d),sX({queryGeometry:h,size:u,transform:n,unwrappedTileID:o,getElevation:l,pitchAlignment:f,pitchScale:p},a)}}class sQ extends sk{}ak("HeatmapBucket",sQ,{omit:["layers"]});var s0={get paint(){return h=h||new nt({"heatmap-radius":new a8(e0.paint_heatmap["heatmap-radius"]),"heatmap-weight":new a8(e0.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new a4(e0.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ne(e0.paint_heatmap["heatmap-color"]),"heatmap-opacity":new a4(e0.paint_heatmap["heatmap-opacity"])})}};function s1(t,{width:i,height:r}
2,a,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==i*r*a)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${i*r*a}`)}else n=new Uint8Array(i*r*a);return t.width=i,t.height=r,t.data=n,t}function s2(t,{width:i,height:r},a){if(i===t.width&&r===t.height)return;let n=s1({},{width:i,height:r},a);s3(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,i),height:Math.min(t.height,r)},a),t.width=i,t.height=r,t.data=n.data}function s3(t,i,r,a,n,s){if(0===n.width||0===n.height)return i;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>i.width||n.height>i.height||a.x>i.width-n.width||a.y>i.height-n.height)throw RangeError("out of range destination coordinates for image copy");let o=t.data,l=i.data;if(o===l)throw Error("srcData equals dstData, so image is already copied");for(let h=0;h<n.height;h++){let u=((r.y+h)*t.width+r.x)*s,c=((a.y+h)*i.width+a.x)*s;for(let t=0;t<n.width*s;t++)l[c+t]=o[u+t]}return i}class s5{constructor(t,i){s1(this,t,1,i)}resize(t){s2(this,t,1)}clone(){return new s5({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,a,n){s3(t,i,r,a,n,1)}}class s6{constructor(t,i){s1(this,t,4,i)}resize(t){s2(this,t,4)}replace(t,i){i?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new s6({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,a,n){s3(t,i,r,a,n,4)}setPixel(t,i,r){let a=4*(t*this.width+i);this.data[a+0]=Math.round(255*r.r/r.a),this.data[a+1]=Math.round(255*r.g/r.a),this.data[a+2]=Math.round(255*r.b/r.a),this.data[a+3]=Math.round(255*r.a)}}function s4(t){let i=new Uint8Array(t.length);for(let r=0;r<t.length;r+=4){let a=t[r+3];i[r+0]=Math.round(t[r+0]*a/255),i[r+1]=Math.round(t[r+1]*a/255),i[r+2]=Math.round(t[r+2]*a/255),i[r+3]=a}return i}function s8(t){let i={},r=t.resolution||256,a=t.clips?t.clips.length:1,n=t.image||new s6({width:r,height:a});if(Math.log(r)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${r}`);let s=(a,s,o)=>{i[t.evaluationKey]=o;let l=t.expression.evaluate(i);n.setPixel(a/4/r,s/4,l)};if(t.clips)for(let i=0,n=0;i<a;++i,n+=4*r)for(let a=0,o=0;a<r;a++,o+=4){let l=a/(r-1),{start:h,end:u}=t.clips[i];s(n,o,h*(1-l)+u*l)}else for(let t=0,i=0;t<r;t++,i+=4)s(0,i,t/(r-1));return n}ak("AlphaImage",s5),ak("RGBAImage",s6);let s7="big-fb";class s9 extends na{createBucket(t){return new sQ(t)}constructor(t,i){super(t,s0,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=s8({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(s7)&&this.heatmapFbos.delete(s7)}queryRadius(t){return sU("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:l}){return sX({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(i,r)*s,transform:n,unwrappedTileID:o,getElevation:l},a)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}}var oe={get paint(){return u=u||new nt({"hillshade-illumination-direction":new a4(e0.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new a4(e0.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new a4(e0.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new a4(e0.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new a4(e0.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new a4(e0.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new a4(e0.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new a4(e0.paint_hillshade["hillshade-method"]),resampling:new a4(e0.paint_hillshade.resampling)})}};class ot extends na{constructor(t,i){super(t,oe,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,a=this.paint.get("hillshade-shadow-color").values,n=Math.max(t.length,i.length,r.length,a.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),a=a.concat(Array(n-a.length).fill(a.at(-1)));let s=i.map(eR);return{directionRadians:t.map(eR),altitudeRadians:s,shadowColor:a,highlightColor:r}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}}var oi={get paint(){return c=c||new nt({"color-relief-opacity":new a4(e0["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new ne(e0["paint_color-relief"]["color-relief-color"]),resampling:new a4(e0["paint_color-relief"].resampling)})}};class or{constructor(t,i,r,a){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(i,a)}update(t,i,r){var a;let{width:n,height:s}=t,o=((null==(a=this.size)?void 0:a[0])!==n||this.size[1]!==s)&&!r,{context:l}=this,{gl:h}=l;this.useMipmap=!!(null==i?void 0:i.useMipmap),h.bindTexture(h.TEXTURE_2D,this.texture),l.pixelStoreUnpackFlipY.set(!1),l.pixelStoreUnpack.set(1);let u=this.format===h.RGBA&&!1!==(null==i?void 0:i.premultiply);if(o)this.size=[n,s],"data"in t?(l.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,u,n,s,h)):(l.pixelStoreUnpackPremultiplyAlpha.set(u),this._uploadDomImage(t,h));else{let{x:i,y:a}=r||{x:0,y:0};"data"in t?(l.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,u,i,a,n,s,h)):(l.pixelStoreUnpackPremultiplyAlpha.set(u),this._updateDomImage(t,i,a,h))}this.useMipmap&&this.isSizePowerOfTwo()&&h.generateMipmap(h.TEXTURE_2D),l.pixelStoreUnpackFlipY.setDefault(),l.pixelStoreUnpack.setDefault(),l.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,i){i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,i.UNSIGNED_BYTE,t)}_uploadRawData(t,i,r,a,n){let{data:s}=t;i&&s&&(s=s4(s)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,a,0,this.format,n.UNSIGNED_BYTE,s)}_updateDomImage(t,i,r,a){a.texSubImage2D(a.TEXTURE_2D,0,i,r,a.RGBA,a.UNSIGNED_BYTE,t)}_updateRawData(t,i,r,a,n,s,o){let{data:l}=t;i&&l&&(l=s4(l)),o.texSubImage2D(o.TEXTURE_2D,0,r,a,n,s,o.RGBA,o.UNSIGNED_BYTE,l)}
2bind(t,i,r){let{context:a}=this,{gl:n}=a;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),r!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),i!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class oa{constructor(t,i,r,a=1,n=1,s=1,o=0){if(this.uid=t,i.height!==i.width)throw RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r))return void eM(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;const l=this.dim=i.height-2;switch(this.data=new Uint32Array(i.data.buffer),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=a,this.greenFactor=n,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<l;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(l,t)]=this.data[this._idx(l-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,l)]=this.data[this._idx(t,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<l;t++)for(let i=0;i<l;i++){const r=this.get(t,i);r>this.max&&(this.max=r),r<this.min&&(this.min=r)}}get(t,i){let r=new Uint8Array(this.data.buffer),a=4*this._idx(t,i);return this.unpack(r[a],r[a+1],r[a+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,i){if(t<-1||t>=this.dim+1||i<-1||i>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${i}, dim: ${this.dim}`);return(i+1)*this.stride+(t+1)}unpack(t,i,r){return t*this.redFactor+i*this.greenFactor+r*this.blueFactor-this.baseShift}pack(t){return on(t,this.getUnpackVector())}getPixels(){return new s6({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,i,r){if(this.dim!==t.dim)throw Error("dem dimension mismatch");let a=i*this.dim,n=i*this.dim+this.dim,s=r*this.dim,o=r*this.dim+this.dim;switch(i){case -1:a=n-1;break;case 1:n=a+1}switch(r){case -1:s=o-1;break;case 1:o=s+1}let l=-i*this.dim,h=-r*this.dim;for(let i=s;i<o;i++)for(let r=a;r<n;r++)this.data[this._idx(r,i)]=t.data[this._idx(r+l,i+h)]}}function on(t,i){let r=i[0],a=i[1],n=i[2],s=i[3],o=Math.min(r,a,n),l=Math.round((t+s)/o);return{r:Math.floor(l*o/r)%256,g:Math.floor(l*o/a)%256,b:Math.floor(l*o/n)%256}}ak("DEMData",oa);class os extends na{constructor(t,i){super(t,oi,i)}_createColorRamp(t){let i={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof rG&&r._styleExpression.expression instanceof iM){this.colorRampExpression=r;let t=r._styleExpression.expression;for(let r of(i.elevationStops=t.labels,i.colorStops=[],i.elevationStops))i.colorStops.push(t.evaluate({globals:{elevation:r}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[tq.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=t)return i;let a={elevationStops:[],colorStops:[]},n=(i.elevationStops.length-1)/(t-1);for(let t=0;t<i.elevationStops.length-.5;t+=n)a.elevationStops.push(i.elevationStops[Math.round(t)]),a.colorStops.push(i.colorStops[Math.round(t)]);return eM(`Too many colors in specification of ${this.id}
2 color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${i.elevationStops.length}`),a}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,i,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let a=this._createColorRamp(i),n=new s6({width:a.colorStops.length,height:1}),s=new s6({width:a.colorStops.length,height:1});for(let t=0;t<a.elevationStops.length;t++){let i=on(a.elevationStops[t],r);s.setPixel(0,t,new tq(i.r/255,i.g/255,i.b/255,1)),n.setPixel(0,t,a.colorStops[t])}return this.colorRampTextures={elevationTexture:new or(t,s,t.gl.RGBA),colorTexture:new or(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let{members:oo}=nu([{name:"a_pos",components:2,type:"Int16"}],4);function ol(t,i,r){let a=r.patternDependencies,n=!1;for(let r of i){let i=r.paint.get(`${t}-pattern`);i.isConstant()||(n=!0);let s=i.constantOr(null);s&&(n=!0,a[s.to]=!0,a[s.from]=!0)}return n}function oh(t,i,r,a,n){let{zoom:s}=a,o=n.patternDependencies;for(let a of i){let i=a.paint.get(`${t}-pattern`).value;if("constant"!==i.kind){let t=i.evaluate({zoom:s-1},r,{},n.availableImages),l=i.evaluate({zoom:s},r,{},n.availableImages),h=i.evaluate({zoom:s+1},r,{},n.availableImages);t=(null==t?void 0:t.name)?t.name:t,l=(null==l?void 0:l.name)?l.name:l,h=(null==h?void 0:h.name)?h.name:h,o[t]=!0,o[l]=!0,o[h]=!0,r.patterns[a.id]={min:t,mid:l,max:h}}}return r}function ou(t,i,r,a,n){let s;if(n===function(t,i,r,a){let n=0;for(let s=i,o=r-a;s<r;s+=a)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}(t,i,r,a)>0)for(let n=i;n<r;n+=a)s=oT(n/a|0,t[n],t[n+1],s);else for(let n=r-a;n>=i;n-=a)s=oT(n/a|0,t[n],t[n+1],s);return s&&og(s,s.next)&&(oS(s),s=s.next),s}function oc(t,i){if(!t)return t;i||(i=t);let r,a=t;do if(r=!1,a.steiner||!og(a,a.next)&&0!==o_(a.prev,a,a.next))a=a.next;else{if(oS(a),(a=i=a.prev)===a.next)break;r=!0}while(r||a!==i);return i}function od(t,i){let r=t.x-i.x;return 0===r&&0==(r=t.y-i.y)&&(r=(t.next.y-t.y)/(t.next.x-t.x)-(i.next.y-i.y)/(i.next.x-i.x)),r}function op(t,i,r,a,n){return(t=0x55555555&((t=0x33333333&((t=0xf0f0f0f&((t=0xff00ff&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(i=0x55555555&((i=0x33333333&((i=0xf0f0f0f&((i=0xff00ff&((i=(i-a)*n|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function of(t,i,r,a,n,s,o,l){return(n-o)*(i-l)>=(t-o)*(s-l)&&(t-o)*(a-l)>=(r-o)*(i-l)&&(r-o)*(s-l)>=(n-o)*(a-l)}function om(t,i,r,a,n,s,o,l){return(t!==o||i!==l)&&of(t,i,r,a,n,s,o,l)}function o_(t,i,r){return(i.y-t.y)*(r.x-i.x)-(i.x-t.x)*(r.y-i.y)}function og(t,i){return t.x===i.x&&t.y===i.y}function oy(t,i,r,a){let n=ov(o_(t,i,r)),s=ov(o_(t,i,a)),o=ov(o_(r,a,t)),l=ov(o_(r,a,i));return n!==s&&o!==l||!(0!==n||!ox(t,r,i))||!(0!==s||!ox(t,a,i))||!(0!==o||!ox(r,t,a))||!(0!==l||!ox(r,i,a))}function ox(t,i,r){return i.x<=Math.max(t.x,r.x)&&i.x>=Math.min(t.x,r.x)&&i.y<=Math.max(t.y,r.y)&&i.y>=Math.min(t.y,r.y)}function ov(t){return t>0?1:t<0?-1:0}function ob(t,i){return 0>o_(t.prev,t,t.next)?o_(t,i,t.next)>=0&&o_(t,t.prev,i)>=0:0>o_(t,i,t.prev)||0>o_(t,t.next,i)}function ow(t,i){let r=oP(t.i,t.x,t.y),a=oP(i.i,i.x,i.y),n=t.next,s=i.prev;return t.next=i,i.prev=t,r.next=n,n.prev=r,a.next=r,r.prev=a,s.next=a,a.prev=s,a}function oT(t,i,r,a){let n=oP(t,i,r);return a?(n.next=a.next,n.prev=a,a.next.prev=n,a.next=n):(n.prev=n,n.next=n),n}function oS(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function oP(t,i,r){return{i:t,x:i,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class oM{constructor(t,i){if(i>t)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=i}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class oI{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}oI.noSubdivision=new oI({fill:new oM(0,0),line:new oM(0,0),tile:new oM(0,0),stencil:new oM(0,0),circle:1}),ak("SubdivisionGranularityExpression",oM),ak("SubdivisionGranularitySetting",oI);class oE{constructor(t,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=8192/t,this._canonical=i}_getKey(t,i){return(t+=32768)<<16|i+32768}_vertexToIndex(t,i){if(t<-32768||i<-32768||t>32767||i>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let r=0|Math.round(t),a=0|Math.round(i),n=this._getKey(r,a);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let s=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,s),this._vertexBuffer.push(r,a),s}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(t,i){let r=[];for(let a=0;a<i.length;a+=3){let n=i[a],s=i[a+1],o=i[a+2],l=t[2*n],h=t[2*n+1];(t[2*s]-l)*(t[2*o+1]-h)-(t[2*s+1]-h)*(t[2*o]-l)>0?(r.push(n),r.push(o),r.push(s)):(r.push(n),r.push(s),r.push(o))}return r}(this._vertexBuffer,t);let i=[],r=t.length;for(let a=0;a<r;a+=3){let r=[t[a+0],t[a+1],t[a+2]],n=[this._vertexBuffer[2*t[a+0]+0],this._vertexBuffer[2*t[a+0]+1],this._vertexBuffer[2*t[a+1]+0],this._vertexBuffer[2*t[a+1]+1],this._vertexBuffer[2*t[a+2]+0],this._vertexBuffer[2*t[a+2]+1]],s=1/0,o=1/0,l=-1/0,h=-1/0;for(let t=0;t<3;t++){let i=n[2*t],r=n[2*t+1];s=Math.min(s,i),l=Math.max(l,i),o=Math.min(o,r),h=Math.max(h,r)}if(s===l||o===h)continue;let u=Math.floor(s/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),d=Math.floor(o/this._granularityCellSize),p=Math.ceil(h/this._granularityCellSize);if(u!==c||d!==p)for(let t=d;t<p;t++){let a=this._scanlineGenerateVertexRingForCellRow(t,n,r);!function(t,i,r){if(0===i.length)throw Error("Subdivision vertex ring is empty.");let a=0,n=t[2*i[0]];for(let r=1;r<i.length;r++){let s=t[2*i[r]];s<n&&(n=s,a=r)}let s=i.length,o=a,l=(o+1)%s;for(;;){let a=o-1>=0?o-1:s-1,n=(l+1)%s,h=t[2*i[a]],u=t[2*i[n]],c=t[2*i[o]],d=t[2*i[o]+1],p=t[2*i[l]+1],f=!1;if(h<u)f=!0;else if(h>u)f=!1;else{let r=p-d,s=-(t[2*i[l]]-c),o=d<p?1:-1;((h-c)*r+(t[2*i[a]+1]-d)*s)*o>((u-c)*r+(t[2*i[n]+1]-d)*s)*o&&(f=!0)}if(f){let t=i[a],n=i[o],h=i[l];t!==n&&t!==h&&n!==h&&r.push(h,n,t),--o<0&&(o=s-1)}else{let t=i[n],a=i[o],h=i[l];t!==a&&t!==h&&a!==h&&r.push(h,a,t),++l>=s&&(l=0)}
2if(a===n)break}}(this._vertexBuffer,a,i)}else i.push(...r)}return i}_scanlineGenerateVertexRingForCellRow(t,i,r){let a=t*this._granularityCellSize,n=a+this._granularityCellSize,s=[];for(let t=0;t<3;t++){let o=i[2*t],l=i[2*t+1],h=i[2*(t+1)%6],u=i[(2*(t+1)+1)%6],c=i[2*(t+2)%6],d=i[(2*(t+2)+1)%6],p=h-o,f=u-l,m=0===p,_=0===f,g=(a-l)/f,y=(n-l)/f,x=Math.min(g,y),v=Math.max(g,y);if(!_&&(x>=1||v<=0)||_&&(l<a||l>n)){u>=a&&u<=n&&s.push(r[(t+1)%3]);continue}!_&&x>0&&s.push(this._vertexToIndex(o+p*x,l+f*x));let b=o+p*Math.max(x,0),w=o+p*Math.min(v,1);m||this._generateIntraEdgeVertices(s,o,l,h,u,b,w),!_&&v<1&&s.push(this._vertexToIndex(o+p*v,l+f*v)),(_||u>=a&&u<=n)&&s.push(r[(t+1)%3]),!_&&(u<=a||u>=n)&&this._generateInterEdgeVertices(s,o,l,h,u,c,d,w,a,n)}return s}_generateIntraEdgeVertices(t,i,r,a,n,s,o){let l=a-i,h=n-r,u=0===h,c=u?Math.min(i,a):Math.min(s,o),d=u?Math.max(i,a):Math.max(s,o),p=Math.floor(c/this._granularityCellSize)+1,f=Math.ceil(d/this._granularityCellSize)-1;if(u?i<a:s<o)for(let a=p;a<=f;a++){let n=a*this._granularityCellSize;t.push(this._vertexToIndex(n,r+h*(n-i)/l))}else for(let a=f;a>=p;a--){let n=a*this._granularityCellSize;t.push(this._vertexToIndex(n,r+h*(n-i)/l))}}_generateInterEdgeVertices(t,i,r,a,n,s,o,l,h,u){let c=o-n,d=(h-n)/c,p=(u-n)/c,f=Math.min(d,p),m=Math.max(d,p),_=a+(s-a)*f,g=Math.floor(Math.min(_,l)/this._granularityCellSize)+1,y=Math.ceil(Math.max(_,l)/this._granularityCellSize)-1,x=l<_,v=0===c;if(v&&(o===h||o===u))return;if(v||f>=1||m<=0){let t=r-o,a=s+(i-s)*Math.min((h-o)/t,(u-o)/t);g=Math.floor(Math.min(a,l)/this._granularityCellSize)+1,y=Math.ceil(Math.max(a,l)/this._granularityCellSize)-1,x=l<a}let b=n-r>0?u:h;if(x)for(let i=g;i<=y;i++)t.push(this._vertexToIndex(i*this._granularityCellSize,b));else for(let i=y;i>=g;i--)t.push(this._vertexToIndex(i*this._granularityCellSize,b))}_generateOutline(t){let i=[];for(let r of t){let t=oA(r,this._granularity,!0),a=this._pointArrayToIndices(t),n=[];for(let t=1;t<a.length;t++)n.push(a[t-1]),n.push(a[t]);i.push(n)}return i}_handlePoles(t){let i=!1,r=!1;this._canonical&&(0===this._canonical.y&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(i||r)&&this._fillPoles(t,i,r)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let i=0;i<t.length;i+=2){let r=t[i+1];-32768===r&&(t[i+1]=-32767),32767===r&&(t[i+1]=32766)}}_generatePoleQuad(t,i,r,a,n,s){a>n!=(-32768===s)?(t.push(i),t.push(r),t.push(this._vertexToIndex(a,s)),t.push(r),t.push(this._vertexToIndex(n,s))):(t.push(r),t.push(i),t.push(this._vertexToIndex(a,s)),t.push(this._vertexToIndex(n,s)),t.push(r)),t.push(this._vertexToIndex(a,s))}_fillPoles(t,i,r){let a=this._vertexBuffer,n=t.length;for(let s=2;s<n;s+=3){let n=t[s-2],o=t[s-1],l=t[s],h=a[2*n],u=a[2*n+1],c=a[2*o],d=a[2*o+1],p=a[2*l],f=a[2*l+1];i&&(0===u&&0===d&&this._generatePoleQuad(t,n,o,h,c,-32768),0===d&&0===f&&this._generatePoleQuad(t,o,l,c,p,-32768),0===f&&0===u&&this._generatePoleQuad(t,l,n,p,h,-32768)),r&&(8192===u&&8192===d&&this._generatePoleQuad(t,n,o,h,c,32767),8192===d&&8192===f&&this._generatePoleQuad(t,o,l,c,p,32767),8192===f&&8192===u&&this._generatePoleQuad(t,l,n,p,h,32767))}}_initializeVertices(t){for(let i=0;i<t.length;i+=2)this._vertexToIndex(t[i],t[i+1])}subdividePolygonInternal(t,i){let r;if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:a,holeIndices:n}=function(t){let i=[],r=[];for(let a of t)if(0!==a.length)for(let n of(a!==t[0]&&i.push(r.length/2),a))r.push(n.x),r.push(n.y);return{flattened:r,holeIndices:i}}(t);this._initializeVertices(a);try{let t=function(t,i,r=2){let a,n,s,o=i&&i.length,l=o?i[0]*r:t.length,h=ou(t,0,l,r,!0),u=[];if(!h||h.next===h.prev)return u;if(o&&(h=function(t,i,r,a){let n=[];for(let r=0,s=i.length;r<s;r++){let o=ou(t,i[r]*a,r<s-1?i[r+1]*a:t.length,a,!1);o===o.next&&(o.steiner=!0),n.push(function(t){let i=t,r=t;do(i.x<r.x||i.x===r.x&&i.y<r.y)&&(r=i),i=i.next;while(i!==t);return r}(o))}n.sort(od);for(let t=0;t<n.length;t++)r=function(t,i){let r=function(t,i){let r=i,a=t.x,n=t.y,s,o=-1/0;if(og(t,r))return r;do{if(og(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let t=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y
2);if(t<=a&&t>o&&(o=t,s=r.x<r.next.x?r:r.next,t===a))return s}r=r.next}while(r!==i);if(!s)return null;let l=s,h=s.x,u=s.y,c=1/0;r=s;do{if(a>=r.x&&r.x>=h&&a!==r.x&&of(n<u?a:o,n,h,u,n<u?o:a,n,r.x,r.y)){var d,p;let i=Math.abs(n-r.y)/(a-r.x);ob(r,t)&&(i<c||i===c&&(r.x>s.x||r.x===s.x&&(d=s,p=r,0>o_(d.prev,d,p.prev)&&0>o_(p.next,d,d.next))))&&(s=r,c=i)}r=r.next}while(r!==l);return s}(t,i);if(!r)return i;let a=ow(r,t);return oc(a,a.next),oc(r,r.next)}(n[t],r);return r}(t,i,h,r)),t.length>80*r){a=t[0],n=t[1];let i=a,o=n;for(let s=r;s<l;s+=r){let r=t[s],l=t[s+1];r<a&&(a=r),l<n&&(n=l),r>i&&(i=r),l>o&&(o=l)}s=Math.max(i-a,o-n),s=0!==s?32767/s:0}return function t(i,r,a,n,s,o,l){if(!i)return;!l&&o&&function(t,i,r,a){let n=t;do 0===n.z&&(n.z=op(n.x,n.y,i,r,a)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){let i,r=1;do{let a,n=t;t=null;let s=null;for(i=0;n;){i++;let o=n,l=0;for(let t=0;t<r&&(l++,o=o.nextZ);t++);let h=r;for(;l>0||h>0&&o;)0!==l&&(0===h||!o||n.z<=o.z)?(a=n,n=n.nextZ,l--):(a=o,o=o.nextZ,h--),s?s.nextZ=a:t=a,a.prevZ=s,s=a;n=o}s.nextZ=null,r*=2}while(i>1)}(n)}(i,n,s,o);let h=i;for(;i.prev!==i.next;){let u=i.prev,c=i.next;if(o?function(t,i,r,a){let n=t.prev,s=t.next;if(o_(n,t,s)>=0)return!1;let o=n.x,l=t.x,h=s.x,u=n.y,c=t.y,d=s.y,p=Math.min(o,l,h),f=Math.min(u,c,d),m=Math.max(o,l,h),_=Math.max(u,c,d),g=op(p,f,i,r,a),y=op(m,_,i,r,a),x=t.prevZ,v=t.nextZ;for(;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&om(o,u,l,c,h,d,x.x,x.y)&&o_(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&om(o,u,l,c,h,d,v.x,v.y)&&o_(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&om(o,u,l,c,h,d,x.x,x.y)&&o_(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&om(o,u,l,c,h,d,v.x,v.y)&&o_(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}(i,n,s,o):function(t){let i=t.prev,r=t.next;if(o_(i,t,r)>=0)return!1;let a=i.x,n=t.x,s=r.x,o=i.y,l=t.y,h=r.y,u=Math.min(a,n,s),c=Math.min(o,l,h),d=Math.max(a,n,s),p=Math.max(o,l,h),f=r.next;for(;f!==i;){if(f.x>=u&&f.x<=d&&f.y>=c&&f.y<=p&&om(a,o,n,l,s,h,f.x,f.y)&&o_(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}(i))r.push(u.i,i.i,c.i),oS(i),i=c.next,h=c.next;else if((i=c)===h){l?1===l?t(i=function(t,i){let r=t;do{let a=r.prev,n=r.next.next;!og(a,n)&&oy(a,r,r.next,n)&&ob(a,n)&&ob(n,a)&&(i.push(a.i,r.i,n.i),oS(r),oS(r.next),r=t=n),r=r.next}while(r!==t);return oc(r)}(oc(i),r),r,a,n,s,o,2):2===l&&function(i,r,a,n,s,o){let l=i;do{let i=l.next.next;for(;i!==l.prev;){var h,u;if(l.i!==i.i&&(h=l,u=i,h.next.i!==u.i&&h.prev.i!==u.i&&!function(t,i){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==i.i&&r.next.i!==i.i&&oy(r,r.next,t,i))return!0;r=r.next}while(r!==t);return!1}(h,u)&&(ob(h,u)&&ob(u,h)&&function(t,i){let r=t,a=!1,n=(t.x+i.x)/2,s=(t.y+i.y)/2;do r.y>s!=r.next.y>
2s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(a=!a),r=r.next;while(r!==t);return a}(h,u)&&(o_(h.prev,h,u.prev)||o_(h,u.prev,u))||og(h,u)&&o_(h.prev,h,h.next)>0&&o_(u.prev,u,u.next)>0))){let h=ow(l,i);return l=oc(l,l.next),h=oc(h,h.next),t(l,r,a,n,s,o,0),void t(h,r,a,n,s,o,0)}i=i.next}l=l.next}while(l!==i)}(i,r,a,n,s,o):t(oc(i),r,a,n,s,o,1);break}}}(h,u,r,a,n,s,0),u}(a,n),i=this._convertIndices(a,t);r=this._subdivideTrianglesScanline(i)}catch(t){console.error(t)}let s=[];return i&&(s=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(r),{verticesFlattened:this._vertexBuffer,indicesTriangles:r,indicesLineList:s}}_convertIndices(t,i){let r=[];for(let a of i)r.push(this._vertexToIndex(t[2*a],t[2*a+1]));return r}_pointArrayToIndices(t){let i=[];for(let r of t)i.push(this._vertexToIndex(r.x,r.y));return i}}function oC(t,i,r,a=!0){return new oE(r,i).subdividePolygonInternal(t,a)}function oA(t,i,r=!1){if(!t||t.length<1||t.length<2)return[];let a=t[0],n=t[t.length-1],s=r&&(a.x!==n.x||a.y!==n.y);if(i<2)return s?[...t,t[0]]:[...t];let o=Math.floor(8192/i),l=[];l.push(new w(t[0].x,t[0].y));let h=t.length,u=s?h:h-1;for(let i=0;i<u;i++){let r=t[i],a=i<h-1?t[i+1]:t[0],n=r.x,s=r.y,u=a.x,c=a.y,d=n!==u,p=s!==c;if(!d&&!p)continue;let f=u-n,m=c-s,_=Math.abs(f),g=Math.abs(m),y=n,x=s;for(;;){let t=f>0?(Math.floor(y/o)+1)*o:(Math.ceil(y/o)-1)*o,i=m>0?(Math.floor(x/o)+1)*o:(Math.ceil(x/o)-1)*o,r=Math.abs(y-t),a=Math.abs(x-i),n=Math.abs(x-c),s=d?r/_:1/0,h=p?a/g:1/0;if((Math.abs(y-u)<=r||!d)&&(n<=a||!p))break;if(s<h&&d||!p){let i=new w(y=t,Math.round(x+=m*s));l[l.length-1].x===i.x&&l[l.length-1].y===i.y||l.push(i)}else{let t=new w(Math.round(y+=f*h),x=i);l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t)}}let v=new w(u,c);l[l.length-1].x===v.x&&l[l.length-1].y===v.y||l.push(v)}return l}function oD(t,i,r,a,n,s,o,l,h){let u=n.length/2,c=o&&l&&h;if(u<se.MAX_VERTEX_ARRAY_LENGTH){let d,p,f=i.prepareSegment(u,r,a),m=f.vertexLength;for(let t=0;t<s.length;t+=3)a.emplaceBack(m+s[t],m+s[t+1],m+s[t+2]);f.vertexLength+=u,f.primitiveLength+=s.length/3,c&&(d=(p=o.prepareSegment(u,r,l)).vertexLength,p.vertexLength+=u);for(let i=0;i<n.length;i+=2)t(n[i],n[i+1]);if(c)for(let t of h){for(let i=1;i<t.length;i+=2)l.emplaceBack(d+t[i-1],d+t[i]);p.primitiveLength+=t.length/2}}else!function(t,i,r,a,n,s){let o=[];for(let t=0;t<a.length/2;t++)o.push(-1);let l={count:0},h=0,u=t.getOrCreateLatestSegment(i,r),c=u.vertexLength;for(let d=2;d<n.length;d+=3){let p=n[d-2],f=n[d-1],m=n[d],_=o[p]<h,g=o[f]<h,y=o[m]<h;u.vertexLength+(+!!_+ +!!g+ +!!y)>se.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(i,r),h=l.count,_=!0,g=!0,y=!0,c=0);let x=oz(o,a,s,l,p,_,u),v=oz(o,a,s,l,f,g,u),b=oz(o,a,s,l,m,y,u);r.emplaceBack(c+x-h,c+v-h,c+b-h),u.primitiveLength++}}(i,r,a,n,s,t),c&&function(t,i,r,a,n,s){let o=[];for(let t=0;t<a.length/2;t++)o.push(-1);let l={count:0},h=0,u=t.getOrCreateLatestSegment(i,r),c=u.vertexLength;for(let d of n)for(let n=1;n<d.length;n+=2){let p=d[n-1],f=d[n],m=o[p]<h,_=o[f]<h;u.vertexLength+(+!!m+ +!!_)>se.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(i,r),h=l.count,m=!0,_=!0,c=0);let g=oz(o,a,s,l,p,m,u),y=oz(o,a,s,l,f,_,u);r.emplaceBack(c+g-h,c+y-h),u.primitiveLength++}}(o,r,l,n,h,t),i.forceNewSegmentOnNextPrepare(),null==o||o.forceNewSegmentOnNextPrepare()}function oz(t,i,r,a,n,s,o){if(s){let s=a.count;return r(i[2*n],i[2*n+1]),t[n]=a.count,a.count++,o.vertexLength++,s}return t[n]}class ok{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new nY,this.indexArray=new n8,this.indexArray2=new n7,this.programConfigurations=new sE(t.layers,t.zoom),this.segments=new se,this.segments2=new se,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,i,r){this.hasDependencies=ol("fill",this.layers,i);let a=this.layers[0].layout.get("fill-sort-key"),n=!a.isConstant(),s=[];for(let{feature:o,id:l,index:h,sourceLayerIndex:u}of t){let t=this.layers[0]._featureFilter.needGeometry,c=sz(o,t);if(!this.layers[0]._featureFilter.filter(new aX(this.zoom),c,r))continue;let d=n?a.evaluate(c,{},r,i.availableImages):void 0,p={id:l,properties:o.properties,type:o.type,sourceLayerIndex:u,index:h,geometry:t?c.geometry:sD(o),patterns:{},sortKey:d};s.push(p)}for(let a of(n&&s.sort((t,i)=>t.sortKey-i.sortKey),s)){let{geometry:n,index:s,sourceLayerIndex:o}=a;
2if(this.hasDependencies){let t=oh("fill",this.layers,a,{zoom:this.zoom},i);this.patternFeatures.push(t)}else this.addFeature(a,n,s,r,{},i.subdivisionGranularity);i.featureIndex.insert(t[s].feature,n,s,o,this.index)}}update(t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:r})}addFeatures(t,i,r){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,i,r,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,oo),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,i,r,a,n,s){for(let t of i6(i,500)){let i=oC(t,a,s.fill.getGranularityForZoomLevel(a.z)),r=this.layoutVertexArray;oD((t,i)=>{r.emplaceBack(t,i)},this.segments,this.layoutVertexArray,this.indexArray,i.verticesFlattened,i.indicesTriangles,this.segments2,this.indexArray2,i.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:a})}}ak("FillBucket",ok,{omit:["layers","patternFeatures"]});var oR={get paint(){return p=p||new nt({"fill-antialias":new a4(e0.paint_fill["fill-antialias"]),"fill-opacity":new a8(e0.paint_fill["fill-opacity"]),"fill-color":new a8(e0.paint_fill["fill-color"]),"fill-outline-color":new a8(e0.paint_fill["fill-outline-color"]),"fill-translate":new a4(e0.paint_fill["fill-translate"]),"fill-translate-anchor":new a4(e0.paint_fill["fill-translate-anchor"]),"fill-pattern":new a7(e0.paint_fill["fill-pattern"])})},get layout(){return d=d||new nt({"fill-sort-key":new a8(e0.layout_fill["fill-sort-key"])})}};class oL extends na{constructor(t,i){super(t,oR,i)}recalculate(t,i){super.recalculate(t,i);let r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new ok(t)}queryRadius(){return sG(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:i,transform:r,pixelsToTileUnits:a}){return sF(s$(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,a),i)}isTileClipped(){return!0}}let oF=nu([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),oB=nu([{name:"a_centroid",components:2,type:"Int16"}],4),{members:oO}=oF;class oV{constructor(t,i,r,a,n){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=a,this._values=n,t.readFields(oj,this,i)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let i=t.readVarint()+t.pos,r=[],a,n=1,s=0,o=0,l=0;for(;t.pos<i;){if(s<=0){let i=t.readVarint();n=7&i,s=i>>3}if(s--,1===n||2===n)o+=t.readSVarint(),l+=t.readSVarint(),1===n&&(a&&r.push(a),a=[]),a&&a.push(new w(o,l));else{if(7!==n)throw Error(`unknown command ${n}`);a&&a.push(a[0].clone())}}return a&&r.push(a),r}bbox(){let t=this._pbf;t.pos=this._geometry;let i=t.readVarint()+t.pos,r=1,a=0,n=0,s=0,o=1/0,l=-1/0,h=1/0,u=-1/0;for(;t.pos<i;){if(a<=0){let i=t.readVarint();r=7&i,a=i>>3}if(a--,1===r||2===r)n+=t.readSVarint(),s+=t.readSVarint(),n<o&&(o=n),n>l&&(l=n),s<h&&(h=s),s>u&&(u=s);else if(7!==r)throw Error(`unknown command ${r}`)}return[o,h,l,u]}toGeoJSON(t,i,r){let a,n=this.extent*Math.pow(2,r),s=this.extent*t,o=this.extent*i,l=this.loadGeometry();function h(t){return[360*(t.x+s)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+o)/n)*Math.PI))-90]}function u(t){return t.map(h)}if(1===this.type){let t=[];for(let i of l)t.push(i[0]);let i=u(t);a=1===t.length?{type:"Point",coordinates:i[0]}:{type:"MultiPoint",coordinates:i}}else if(2===this.type){let t=l.map(u);a=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}else{if(3!==this.type)throw Error("unknown feature type");{let t=oN(l),i=[];for(let r of t)i.push(r.map(u));a=1===i.length?{type:"Polygon",coordinates:i[0]}:{type:"MultiPolygon",coordinates:i}}}let c={type:"Feature",geometry:a,properties:this.properties};return null!=this.id&&(c.id=this.id),c}}function oj(t,i,r){1===t?i.id=r.readVarint():2===t?function(t,i){let r=t.readVarint()+t.pos;for(;t.pos<r;){let r=i._keys[t.readVarint()],a=i._values[t.readVarint()];i.properties[r]=a}}(r,i):3===t?i.type=r.readVarint():4===t&&(i._geometry=r.pos)}function oN(t){let i,r,a=t.length;if(a<=1)return[t];let n=[];for(let s=0;s<a;s++){let a=function(t){let i=0;for(let r,a,n=0,s=t.length,o=s-1;n<s;o=n++)r=t[n],i+=((a=t[o]).x-r.x)*(r.y+a.y);return i}(t[s]);0!==a&&(void 0===r&&(r=a<0),r===a<0?(i&&n.push(i),i=[t[s]]):i&&i.push(t[s]))}return i&&n.push(i),n}oV.types=["Unknown","Point","LineString","Polygon"];class oU{constructor(t,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(oG,this,i),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let i=this._pbf.readVarint()+this._pbf.pos;return new oV(this._pbf,i,this.extent,this._keys,this._values)}}function oG(t,i,r){15===t?i.version=r.readVarint():1===t?i.name=r.readString():5===t?i.extent=r.readVarint():2===t?i._features.push(r.pos):3===t?i._keys.push(r.readString()):4===t&&i._values.push(function(t){let i=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let r=t.readVarint()>>3;i=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}if(null==i)throw Error("unknown feature value");return i}(r))}class o${constructor(t,i){this.layers=t.readFields(oZ,{},i)}}function oZ(t,i,r){if(3===t){let t=new oU(r,r.readVarint()+r.pos);t.length&&(i[t.name]=t)}}function oq(t,i,r,a,n,s,o,l){t.emplaceBack(i,r,2*Math.floor(8192*a)+o,8192*n*2,8192*s*2,Math.round(l))}class oW{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>
2t.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new nK,this.centroidVertexArray=new nH,this.indexArray=new n8,this.programConfigurations=new sE(t.layers,t.zoom),this.segments=new se,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,i,r){for(let{feature:a,id:n,index:s,sourceLayerIndex:o}of(this.features=[],this.hasDependencies=ol("fill-extrusion",this.layers,i),t)){let t=this.layers[0]._featureFilter.needGeometry,l=sz(a,t);if(!this.layers[0]._featureFilter.filter(new aX(this.zoom),l,r))continue;let h={id:n,sourceLayerIndex:o,index:s,geometry:t?l.geometry:sD(a),properties:a.properties,type:a.type,patterns:{}};this.hasDependencies?this.features.push(oh("fill-extrusion",this.layers,h,{zoom:this.zoom},i)):this.addFeature(h,h.geometry,s,r,{},i.subdivisionGranularity),i.featureIndex.insert(a,h.geometry,s,o,this.index,!0)}}addFeatures(t,i,r){for(let a of this.features){let{geometry:n}=a;this.addFeature(a,n,a.index,i,r,t.subdivisionGranularity)}}update(t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,oO),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,oB.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,i,r,a,n,s){for(let r of i6(i,500)){let i={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(i,a,t,r,s);let o=this.layoutVertexArray.length-n,l=Math.floor(i.x/i.sampleCount),h=Math.floor(i.y/i.sampleCount);for(let t=0;t<o;t++)this.centroidVertexArray.emplaceBack(l,h)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:a})}processPolygon(t,i,r,a,n){if(a.length<1||oH(a[0]))return;for(let i of a)0!==i.length&&function(t,i){for(let r=0;r<i.length;r++){let a=i[r];r===i.length-1&&i[0].x===a.x&&i[0].y===a.y||(t.x+=a.x,t.y+=a.y,t.sampleCount++)}}(t,i);let s={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=n.fill.getGranularityForZoomLevel(i.z),l="Polygon"===oV.types[r.type];for(let t of a){if(0===t.length||oH(t))continue;let i=oA(t,o,l);this._generateSideFaces(i,s)}if(!l)return;let h=oC(a,i,o,!1),u=this.layoutVertexArray;oD((t,i)=>{oq(u,t,i,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,h.verticesFlattened,h.indicesTriangles)}_generateSideFaces(t,i){let r=0;for(let s=1;s<t.length;s++){var a,n;let o=t[s],l=t[s-1];if(a=o,n=l,a.x===n.x&&(a.x<0||a.x>8192)||a.y===n.y&&(a.y<0||a.y>8192))continue;i.segment.vertexLength+4>se.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let h=o.sub(l)._perp()._unit(),u=l.dist(o);r+u>32768&&(r=0),oq(this.layoutVertexArray,o.x,o.y,h.x,h.y,0,0,r),oq(this.layoutVertexArray,o.x,o.y,h.x,h.y,0,1,r),r+=u,oq(this.layoutVertexArray,l.x,l.y,h.x,h.y,0,0,r),oq(this.layoutVertexArray,l.x,l.y,h.x,h.y,0,1,r);let c=i.segment.vertexLength;this.indexArray.emplaceBack(c,c+2,c+1),this.indexArray.emplaceBack(c+1,c+2,c+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}}function oH(t){return t.every(t=>t.x<0)||t.every(t=>t.x>8192)||t.every(t=>t.y<0)||t.every(t=>t.y>8192)}ak("FillExtrusionBucket",oW,{omit:["layers","features"]});var oX={get paint(){return f=f||new nt({"fill-extrusion-opacity":new a4(e0["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new a8(e0["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new a4(e0["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new a4(e0["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new a7(e0["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new a8(e0["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new a8(e0["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new a4(e0["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class oY extends na{constructor(t,i){super(t,oX,i)}createBucket(t){return new oW(t)}
2queryRadius(){return sG(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s,pixelPosMatrix:o}){let l=s$(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,s),h=this.paint.get("fill-extrusion-height").evaluate(i,r),u=this.paint.get("fill-extrusion-base").evaluate(i,r),c=function(t,i){let r=[];for(let a of t){let t=[a.x,a.y,0,1];es(t,t,i),r.push(new w(t[0]/t[3],t[1]/t[3]))}return r}(l,o),d=function(t,i,r,a){let n=[],s=[],o=a[8]*i,l=a[9]*i,h=a[10]*i,u=a[11]*i,c=a[8]*r,d=a[9]*r,p=a[10]*r,f=a[11]*r;for(let i of t){let t=[],r=[];for(let n of i){let i=n.x,s=n.y,m=a[0]*i+a[4]*s+a[12],_=a[1]*i+a[5]*s+a[13],g=a[2]*i+a[6]*s+a[14],y=a[3]*i+a[7]*s+a[15],x=g+h,v=y+u,b=m+c,T=_+d,S=g+p,P=y+f,M=new w((m+o)/v,(_+l)/v);M.z=x/v,t.push(M);let I=new w(b/P,T/P);I.z=S/P,r.push(I)}n.push(t),s.push(r)}return[n,s]}(a,u,h,o);return function(t,i,r){let a=1/0;sF(r,i)&&(a=oJ(r,i[0]));for(let n=0;n<i.length;n++){let s=i[n],o=t[n];for(let t=0;t<s.length-1;t++){let i=s[t],n=[i,s[t+1],o[t+1],o[t],i];sR(r,n)&&(a=Math.min(a,oJ(r,n)))}}return a!==1/0&&a}(d[0],d[1],c)}}function oK(t,i){return t.x*i.x+t.y*i.y}function oJ(t,i){if(1===t.length){let r,a=0,n=i[a++];for(;!r||n.equals(r);)if(!(r=i[a++]))return 1/0;for(;a<i.length;a++){let s=i[a],o=t[0],l=r.sub(n),h=s.sub(n),u=o.sub(n),c=oK(l,l),d=oK(l,h),p=oK(h,h),f=oK(u,l),m=oK(u,h),_=c*p-d*d,g=(p*f-d*m)/_,y=(c*m-d*f)/_,x=n.z*(1-g-y)+r.z*g+s.z*y;if(isFinite(x))return x}return 1/0}{let t=1/0;for(let r of i)t=Math.min(t,r.z);return t}}let oQ=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class o0{static from(t){if(!(t instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[i,r]=new Uint8Array(t,0,2);if(219!==i)throw Error("Data does not appear to be in a KDBush format.");let a=r>>4;if(1!==a)throw Error(`Got v${a} data when expected v1.`);let n=oQ[15&r];if(!n)throw Error("Unrecognized array type.");let[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new o0(o,s,n,t)}constructor(t,i=64,r=Float64Array,a){if(isNaN(t)||t<0)throw Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const n=oQ.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-o%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${r}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+l,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+o+l),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+l,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=t)}add(t,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=i,r}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return function t(i,r,a,n,s,o){if(s-n<=a)return;let l=n+s>>1;(function t(i,r,a,n,s,o){for(;s>n;){if(s-n>600){let l=s-n+1,h=a-n+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);t(i,r,a,Math.max(n,Math.floor(a-h*c/l+d)),Math.min(s,Math.floor(a+(l-h)*c/l+d)),o)}let l=r[2*a+o],h=n,u=s;for(o1(i,r,n,a),r[2*s+o]>l&&o1(i,r,n,s);h<u;){for(o1(i,r,h,u),h++,u--;r[2*h+o]<l;)h++;for(;r[2*u+o]>l;)u--}r[2*n+o]===l?o1(i,r,n,u):o1(i,r,++u,s),u<=a&&(n=u+1),a<=u&&(s=u-1)}})(i,r,l,n,s,o),t(i,r,a,n,l-1,1-o),t(i,r,a,l+1,s,1-o)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:s,nodeSize:o}=this,l=[0,n.length-1,0],h=[];for(;l.length;){let u=l.pop()||0,c=l.pop()||0,d=l.pop()||0;if(c-d<=o){for(let o=d;o<=c;o++){let l=s[2*o],u=s[2*o+1];l>=t&&l<=r&&u>=i&&u<=a&&h.push(n[o])}continue}let p=d+c>>1,f=s[2*p],m=s[2*p+1];f>=t&&f<=r&&m>=i&&m<=a&&h.push(n[p]),(0===u?t<=f:i<=m)&&(l.push(d),l.push(p-1),l.push(1-u)),(0===u?r>=f:a>=m)&&(l.push(p+1),l.push(c),l.push(1-u))}return h}within(t,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:s}=this,o=[0,a.length-1,0],l=[],h=r*r;for(;o.length;){let u=o.pop()||0,c=o.pop()||0,d=o.pop()||0;
2if(c-d<=s){for(let r=d;r<=c;r++)o3(n[2*r],n[2*r+1],t,i)<=h&&l.push(a[r]);continue}let p=d+c>>1,f=n[2*p],m=n[2*p+1];o3(f,m,t,i)<=h&&l.push(a[p]),(0===u?t-r<=f:i-r<=m)&&(o.push(d),o.push(p-1),o.push(1-u)),(0===u?t+r>=f:i+r>=m)&&(o.push(p+1),o.push(c),o.push(1-u))}return l}}function o1(t,i,r,a){o2(t,r,a),o2(i,2*r,2*a),o2(i,2*r+1,2*a+1)}function o2(t,i,r){let a=t[i];t[i]=t[r],t[r]=a}function o3(t,i,r,a){let n=t-r,s=i-a;return n*n+s*s}function o5(t,i,r,a){let n={id:null==t?null:t,type:i,geometry:r,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(i){case"Point":case"MultiPoint":o4(n,r);break;case"LineString":o4(n,r.points);break;case"Polygon":o4(n,r[0].points);break;case"MultiLineString":for(let t of r)o4(n,t.points);break;case"MultiPolygon":for(let t of r)o4(n,t[0].points)}return n}function o6(t){t.points.length>64&&(t.points=new Float64Array(t.points))}function o4(t,i){for(let r=0;r<i.length;r+=3)t.minX=Math.min(t.minX,i[r]),t.minY=Math.min(t.minY,i[r+1]),t.maxX=Math.max(t.maxX,i[r]),t.maxY=Math.max(t.maxY,i[r+1])}function o8(t,i){let r=[];switch(t.type){case"FeatureCollection":for(let a=0;a<t.features.length;a++)o7(r,t.features[a],i,a);break;case"Feature":o7(r,t,i);break;default:o7(r,{geometry:t,properties:void 0},i)}return r}function o7(t,i,r,a){var n,s,o,l,h,u;if(!i.geometry)return;if("GeometryCollection"===i.geometry.type)return void function(t,i,r,a,n){for(let s of r.geometries)o7(t,{id:i.id,geometry:s,properties:i.properties},a,n)}(t,i,i.geometry,r,a);let c=i.geometry.coordinates;if(!c?.length)return;let d=r.promoteId?i.properties?.[r.promoteId]:r.generateId?a||0:i.id,p=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2);switch(i.geometry.type){case"Point":let f;return void(n=i.geometry,s=i.properties,(f=[]).push(lt(n.coordinates[0]),li(n.coordinates[1]),0),t.push(o5(d,"Point",f,s)));case"MultiPoint":return void function(t,i,r,a){let n=[];for(let t of r.coordinates)n.push(lt(t[0]),li(t[1]),0);t.push(o5(i,"MultiPoint",n,a))}(t,d,i.geometry,i.properties);case"LineString":let m;return void(o=i.geometry,l=i.properties,m={points:[]},o9(o.coordinates,m,p,!1),t.push(o5(d,"LineString",m,l)));case"MultiLineString":return void function(t,i,r,a,n,s){if(n.lineMetrics)for(let n of r.coordinates){let r={points:[]};o9(n,r,a,!1),t.push(o5(i,"LineString",r,s))}else{let n=[];le(r.coordinates,n,a,!1),t.push(o5(i,"MultiLineString",n,s))}}(t,d,i.geometry,p,r,i.properties);case"Polygon":let _;return void(h=i.geometry,u=i.properties,_=[],le(h.coordinates,_,p,!0),t.push(o5(d,"Polygon",_,u)));case"MultiPolygon":return void function(t,i,r,a,n){let s=[];for(let t of r.coordinates){let i=[];le(t,i,a,!0),s.push(i)}t.push(o5(i,"MultiPolygon",s,n))}(t,d,i.geometry,p,i.properties);default:throw Error("Input data is not a valid GeoJSON object.")}}function o9(t,i,r,a){let n,s,o=0;for(let r=0;r<t.length;r++){let l=lt(t[r][0]),h=li(t[r][1]);i.points.push(l,h,0),r>0&&(o+=a?(n*h-l*s)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(h-s,2))),n=l,s=h}let l=i.points.length-3;i.points[2]=1,r>0&&function t(i,r,a,n){let s=n,o=r+(a-r>>1),l,h=a-r,u=i[r],c=i[r+1],d=i[a],p=i[a+1];for(let t=r+3;t<a;t+=3){let r=function(t,i,r,a,n,s){let o=n-r,l=s-a;if(0!==o||0!==l){let h=((t-r)*o+(i-a)*l)/(o*o+l*l);h>1?(r=n,a=s):h>0&&(r+=o*h,a+=l*h)}return(o=t-r)*o+(l=i-a)*l}(i[t],i[t+1],u,c,d,p);if(r>s)l=t,s=r;else if(r===s){let i=Math.abs(t-o);i<h&&(l=t,h=i)}}s>n&&(l-r>3&&t(i,r,l,n),i[l+2]=s,a-l>3&&t(i,l,a,n))}(i.points,0,l,r),i.points[l+2]=1,o6(i),i.size=Math.abs(o),i.start=0,i.end=i.size}function le(t,i,r,a){for(let n=0;n<t.length;n++){let s={points:[]};o9(t[n],s,r,a),i.push(s)}}function lt(t){return t/360+.5}function li(t){let i=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}function lr(t){let i={type:"Feature",geometry:function(t){let{type:i,geometry:r}=t;switch(i){case"Point":return{type:i,coordinates:function(t,i){return[ln(t),ls(i)]}(r[0],r[1])};case"MultiPoint":return{type:i,coordinates:la(r)};case"LineString":return{type:i,coordinates:la(r.points)};case"MultiLineString":case"Polygon":return{type:i,coordinates:r.map(t=>la(t.points))};case"MultiPolygon":return{type:i,coordinates:r.map(t=>t.map(t=>la(t.points)))}}}(t),properties:t.tags};return null!=t.id&&(i.id=t.id),i}function la(t){let i=[];for(let n=0;n<t.length;n+=3){var r,a;i.push((r=t[n],a=t[n+1],[ln(r),ls(a)]))}return i}function ln(t){return 360*(t-.5)}function ls(t){return 360*Math.atan(Math.exp((180-360*t)*Math.PI/180)
2)/Math.PI-90}function lo(t,i,r,a,n,s,o,l){if(a/=i,s>=(r/=i)&&o<a)return t;if(o<r||s>=a)return null;let h=[];for(let i of t){let t=n===L.X?i.minX:i.minY,s=n===L.X?i.maxX:i.maxY;if(t>=r&&s<a)h.push(i);else if(!(s<r||t>=a))switch(i.type){case"Point":case"MultiPoint":!function(t,i,r,a,n){let s=[];(function(t,i,r,a,n){for(let s=0;s<t.length;s+=3){let o=t[s+n];o>=r&&o<=a&&lc(i,t[s],t[s+1],t[s+2])}})(t.geometry,s,r,a,n),s.length&&i.push(o5(t.id,3===s.length?"Point":"MultiPoint",s,t.tags))}(i,h,r,a,n);continue;case"LineString":!function(t,i,r,a,n,s){let o=[];if(ll(t.geometry,o,r,a,n,!1,s.lineMetrics),o.length)if(s.lineMetrics)for(let r of o)i.push(o5(t.id,"LineString",r,t.tags));else i.push(o.length>1?o5(t.id,"MultiLineString",o,t.tags):o5(t.id,"LineString",o[0],t.tags))}(i,h,r,a,n,l);continue;case"MultiLineString":!function(t,i,r,a,n){let s=[];lu(t.geometry,s,r,a,n,!1),s.length&&i.push(1!==s.length?o5(t.id,"MultiLineString",s,t.tags):o5(t.id,"LineString",s[0],t.tags))}(i,h,r,a,n);continue;case"Polygon":!function(t,i,r,a,n){let s=[];lu(t.geometry,s,r,a,n,!0),s.length&&i.push(o5(t.id,"Polygon",s,t.tags))}(i,h,r,a,n);continue;case"MultiPolygon":!function(t,i,r,a,n){let s=[];for(let i of t.geometry){let t=[];lu(i,t,r,a,n,!0),t.length&&s.push(t)}s.length&&i.push(o5(t.id,"MultiPolygon",s,t.tags))}(i,h,r,a,n);continue}}return h.length?h:null}function ll(t,i,r,a,n,s,o){let l=lh(t),h=n===L.X?ld:lp,u,c,d=t.start;for(let p=0;p<t.points.length-3;p+=3){let f=t.points[p],m=t.points[p+1],_=t.points[p+2],g=t.points[p+3],y=t.points[p+4],x=n===L.X?f:m,v=n===L.X?g:y,b=!1;o&&(u=Math.sqrt(Math.pow(f-g,2)+Math.pow(m-y,2))),x<r?v>r&&(c=h(l,f,m,g,y,r),o&&(l.start=d+u*c)):x>a?v<a&&(c=h(l,f,m,g,y,a),o&&(l.start=d+u*c)):lc(l.points,f,m,_),v<r&&x>=r&&(c=h(l,f,m,g,y,r),b=!0),v>a&&x<=a&&(c=h(l,f,m,g,y,a),b=!0),!s&&b&&(o&&(l.end=d+u*c),i.push(l),l=lh(t)),o&&(d+=u)}let p=t.points.length-3,f=t.points[p],m=t.points[p+1],_=n===L.X?f:m;_>=r&&_<=a&&lc(l.points,f,m,t.points[p+2]),p=l.points.length-3,s&&p>=3&&(l.points[p]!==l.points[0]||l.points[p+1]!==l.points[1])&&lc(l.points,l.points[0],l.points[1],l.points[2]),l.points.length&&(o6(l),i.push(l))}function lh(t){return{points:[],size:t.size,start:t.start,end:t.end}}function lu(t,i,r,a,n,s){for(let o of t)ll(o,i,r,a,n,s,!1)}function lc(t,i,r,a){t.push(i,r,a)}function ld(t,i,r,a,n,s){let o=(s-i)/(a-i);return lc(t.points,s,r+(n-r)*o,1),o}function lp(t,i,r,a,n,s){let o=(s-r)/(n-r);return lc(t.points,i+(a-i)*o,s,1),o}function lf(t,i){let r=i.buffer/i.extent,a=t,n=lo(t,1,-1-r,r,L.X,-1,2,i),s=lo(t,1,1-r,2+r,L.X,-1,2,i);return(n||s)&&(a=lo(t,1,-r,1+r,L.X,-1,2,i)||[],n&&(a=lm(n,1).concat(a)),s&&(a=a.concat(lm(s,-1)))),a}function lm(t,i){let r=[];for(let a of t)switch(a.type){case"Point":case"MultiPoint":{let t=function(t,i){let r=[];for(let a=0;a<t.length;a+=3)r.push(t[a]+i,t[a+1],t[a+2]);return r}(a.geometry,i);r.push(o5(a.id,a.type,t,a.tags));continue}case"LineString":{let t=l_(a.geometry,i);r.push(o5(a.id,a.type,t,a.tags));continue}case"MultiLineString":case"Polygon":{let t=[];for(let r of a.geometry)t.push(l_(r,i));r.push(o5(a.id,a.type,t,a.tags));continue}case"MultiPolygon":{let t=[];for(let r of a.geometry){let a=[];for(let t of r)a.push(l_(t,i));t.push(a)}r.push(o5(a.id,a.type,t,a.tags));continue}}return r}function l_(t,i){let r={points:[],size:t.size};void 0!==t.start&&(r.start=t.start,r.end=t.end);for(let a=0;a<t.points.length;a+=3)r.points.push(t.points[a]+i,t.points[a+1],t.points[a+2]);return o6(r),r}function lg(t,i){if(i.removeAllProperties)return{};let r={...t||{}};if(i.removeProperties)for(let t of i.removeProperties)delete r[t];if(i.addOrUpdateProperties)for(let{key:t,value:a}of i.addOrUpdateProperties)r[t]=a;return r}(S=L||(L={}))[S.X=0]="X",S[S.Y=1]="Y";let ly={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t};class lx{constructor(t){this.options=Object.assign(Object.create(ly),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(t){let i=[];for(let r of t){if(!r.geometry)continue;let[t,a]=r.geometry.coordinates,[n,s]=[lt(t),li(a)];i.push({id:r.id,type:"Point",geometry:[n,s],tags:r.properties})}this.createIndex(i)}initialize(t){let i=[];for(let r of t)"Point"===r.type&&i.push(r);this.createIndex(i)}updateIndex(t,i,r){this.options=Object.assign(Object.create(ly),r.clusterOptions),this.initialize(t)}createIndex(t){let{log:i,minZoom:r,maxZoom:a}=this.options;i&&console.time("total time");let n=`prepare ${t.length} points`;i&&console.time(n),this.points=t;let s=[];for(let i=0;i<t.length;i++){let r=t[i];if(!r?.geometry)continue;let[a,n]=r.geometry;a=Math.fround(a),n=Math.fround(n),s.push(a,n,1/0,i,-1,1),this.options.reduce&&s.push(0)}let o=this.trees[a+1]=this.createTree(s);i&&console.timeEnd(n);for(let t=a;t>=r;t--){let r=Date.now();o=this.trees[t]=this.createTree(this.cluster(o,t)),i&&console.log("z%d: %d clusters in %dms",t,o.numItems,Date.now()-r)}
2i&&console.timeEnd("total time")}getClusters(t,i){return this.getClustersInternal(t,i).map(t=>lr(t))}getClustersInternal(t,i){let r=((t[0]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[1])),n=180===t[2]?180:((t[2]+180)%360+360)%360-180,s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){let t=this.getClustersInternal([r,a,180,s],i),o=this.getClustersInternal([-180,a,n,s],i);return t.concat(o)}let o=this.trees[this.limitZoom(i)],l=o.range(lt(r),li(s),lt(n),li(a)),h=o.flatData,u=[];for(let t of l){var c,d,p;let i=this.stride*t;u.push(h[i+5]>1?(c=h,d=i,p=this.clusterProps,{id:c[d+3],type:"Point",tags:lv(c,d,p),geometry:[c[d],c[d+1]]}):this.points[h[i+3]])}return u}getChildren(t){let i=this.getOriginId(t),r=this.getOriginZoom(t),a=Error("No cluster with the specified id: "+t),n=this.trees[r];if(!n)throw a;let s=n.flatData;if(i*this.stride>=s.length)throw a;let o=this.options.radius/(this.options.extent*Math.pow(2,r-1)),l=n.within(s[i*this.stride],s[i*this.stride+1],o),h=[];for(let i of l){var u,c,d;let r=i*this.stride;s[r+4]===t&&h.push(s[r+5]>1?(u=s,c=r,d=this.clusterProps,{type:"Feature",id:u[c+3],properties:lv(u,c,d),geometry:{type:"Point",coordinates:[ln(u[c]),ls(u[c+1])]}}):lr(this.points[s[r+3]]))}if(0===h.length)throw a;return h}getLeaves(t,i,r){let a=[];return this.appendLeaves(a,t,i=i||10,r=r||0,0),a}getTile(t,i,r){let a=this.trees[this.limitZoom(t)];if(!a)return null;let n=Math.pow(2,t),{extent:s,radius:o}=this.options,l=o/s,h=(r-l)/n,u=(r+1+l)/n,c={transformed:!0,features:[],source:null,x:i,y:r,z:t};return this.addTileFeatures(a.range((i-l)/n,h,(i+1+l)/n,u),a.flatData,i,r,n,c),0===i&&this.addTileFeatures(a.range(1-l/n,h,1,u),a.flatData,n,r,n,c),i===n-1&&this.addTileFeatures(a.range(0,h,l/n,u),a.flatData,-1,r,n,c),c}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,i,r,a,n){for(let s of this.getChildren(i)){let i=s.properties;if(i?.cluster?n+i.point_count<=a?n+=i.point_count:n=this.appendLeaves(t,i.cluster_id,r,a,n):n<a?n++:t.push(s),t.length===r)break}return n}createTree(t){let i=new o0(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)i.add(t[r],t[r+1]);return i.finish(),i.flatData=t,i.data=null,i}addTileFeatures(t,i,r,a,n,s){for(let o of t){let t,l,h,u,c=o*this.stride,d=i[c+5]>1;if(d)t=lv(i,c,this.clusterProps),l=i[c],h=i[c+1];else{let r=this.points[i[c+3]];t=r.tags,[l,h]=r.geometry}let p={type:1,geometry:[[Math.round(this.options.extent*(l*n-r)),Math.round(this.options.extent*(h*n-a))]],tags:t};void 0!==(u=d||this.options.generateId?i[c+3]:this.points[i[c+3]].id)&&(p.id=u),s.features.push(p)}}limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}cluster(t,i){let{radius:r,extent:a,reduce:n,minPoints:s}=this.options,o=r/(a*Math.pow(2,i)),l=t.flatData,h=[],u=this.stride;for(let r=0;r<l.length;r+=u){if(l[r+2]<=i)continue;l[r+2]=i;let a=l[r],c=l[r+1],d=t.within(l[r],l[r+1],o),p=l[r+5],f=p;for(let t of d){let r=t*u;l[r+2]>i&&(f+=l[r+5])}if(f>p&&f>=s){let t,s=a*p,o=c*p,m=-1,_=(r/u<<5)+(i+1)+this.points.length;for(let a of d){let h=a*u;if(l[h+2]<=i)continue;l[h+2]=i;let c=l[h+5];s+=l[h]*c,o+=l[h+1]*c,l[h+4]=_,n&&(t||(t=this.map(l,r,!0),m=this.clusterProps.length,this.clusterProps.push(t)),n(t,this.map(l,h)))}l[r+4]=_,h.push(s/f,o/f,1/0,_,-1,f),n&&h.push(m)}else{for(let t=0;t<u;t++)h.push(l[r+t]);if(f>1)for(let t of d){let r=t*u;if(!(l[r+2]<=i)){l[r+2]=i;for(let t=0;t<u;t++)h.push(l[r+t])}}}}return h}getOriginId(t){return t-this.points.length>>5}getOriginZoom(t){return(t-this.points.length)%32}map(t,i,r){if(t[i+5]>1){let a=this.clusterProps[t[i+6]];return r?Object.assign({},a):a}let a=this.points[t[i+3]].tags,n=this.options.map(a);return r&&n===a?Object.assign({},n):n}}function lv(t,i,r){let a=t[i+5],n=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a,s=t[i+6];return Object.assign(-1===s?{}:Object.assign({},r[s]),{cluster:!0,cluster_id:t[i+3],point_count:a,point_count_abbreviated:n})}let lb="geojsonvt_clip_start",lw="geojsonvt_clip_end";function lT(t,i,r,a,n){let s=i===n.maxZoom?0:n.tolerance/((1<<i)*n.extent),o={transformed:!1,features:[],source:null,x:r,y:a,z:i,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:t.length};for(let i of t)!function(t,i,r,a){switch(t.minX=Math.min(t.minX,i.minX),t.minY=Math.min(t.minY,i.minY),t.maxX=Math.max(t.maxX,i.maxX),t.maxY=Math.max(t.maxY,i.maxY),i.type){case"Point":case"MultiPoint":return function(t,i){let r=[];for(let a=0;a<i.geometry.length;a+=3)r.push(i.geometry[a],i.geometry[a+1]),t.numPoints++,t.numSimplified++;if(!r.length)return;let a={type:1,tags:i.tags||null,geometry:r};null!==i.id&&(a.id=i.id),t.features.push(a)}(t,i);case"LineString":return function(t,i,r,a){let n=[];if(lS(n,i.geometry,t,r,!1,!1),!n.length)return;let s=i.tags||null;if(a.lineMetrics){for(let t in s={},i.tags)s[t]=i.tags[t];s[lb]=i.geometry.start/i.geometry.size,s[lw]=i.geometry.end/i.geometry.size}let o={type:2,tags:s,geometry:n};null!==i.id&&(o.id=i.id),t.features.push(o)}(t,i,r,a);case"MultiLineString":case"Polygon":return function(t,i,r){let a=[];for(let n=0;n<i.geometry.length;
2n++)lS(a,i.geometry[n],t,r,"Polygon"===i.type,0===n);if(!a.length)return;let n={type:"Polygon"===i.type?3:2,tags:i.tags||null,geometry:a};null!==i.id&&(n.id=i.id),t.features.push(n)}(t,i,r);case"MultiPolygon":return function(t,i,r){let a=[];for(let n=0;n<i.geometry.length;n++){let s=i.geometry[n];for(let i=0;i<s.length;i++)lS(a,s[i],t,r,!0,0===i)}if(!a.length)return;let n={type:3,tags:i.tags||null,geometry:a};null!==i.id&&(n.id=i.id),t.features.push(n)}(t,i,r)}}(o,i,s,n);return o}function lS(t,i,r,a,n,s){let o=a*a;if(a>0&&i.size<(n?o:a))return void(r.numPoints+=i.points.length/3);let l=[];for(let t=0;t<i.points.length;t+=3)(0===a||i.points[t+2]>o)&&(r.numSimplified++,l.push(i.points[t],i.points[t+1])),r.numPoints++;n&&function(t,i){let r=0;for(let i=0,a=t.length,n=a-2;i<a;n=i,i+=2)r+=(t[i]-t[n])*(t[i+1]+t[n+1]);if(r>0===i)for(let i=0,r=t.length;i<r/2;i+=2){let a=t[i],n=t[i+1];t[i]=t[r-2-i],t[i+1]=t[r-1-i],t[r-2-i]=a,t[r-1-i]=n}}(l,s),t.push(l)}function lP(t,i){if(t.transformed)return t;let r=1<<t.z,a=t.x,n=t.y;for(let s of t.features)1===s.type?function(t,i,r,a,n){let s=t.geometry,o=[];for(let t=0;t<s.length;t+=2)o.push(lM(s[t],s[t+1],i,r,a,n));t.geometry=o}(s,i,r,a,n):function(t,i,r,a,n){let s=t.geometry,o=[];for(let t of s){let s=[];for(let o=0;o<t.length;o+=2)s.push(lM(t[o],t[o+1],i,r,a,n));o.push(s)}t.geometry=o}(s,i,r,a,n);return t.transformed=!0,t}function lM(t,i,r,a,n,s){return[Math.round(r*(t*a-n)),Math.round(r*(i*a-s))]}class lI{constructor(t){this.options=t,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(t){this.splitTile(t,0,0,0),this.options.debug&&(t.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(t,i,r){r.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(i),r.debug>1&&console.timeEnd("invalidating");let[a,n,s]=[0,0,0],o=lT(t,a,n,s,r);o.source=t;let l=lE(a,n,s);if(this.tiles[l]=o,this.tileCoords.push({z:a,x:n,y:s,id:l}),r.debug){let t=`z${a}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,i,r){return null}getTile(t,i,r){let{extent:a,debug:n}=this.options,s=1<<t,o=lE(t,i=i+s&s-1,r);if(this.tiles[o])return lP(this.tiles[o],a);n>1&&console.log("drilling down to z%d-%d-%d",t,i,r);let l,h=t,u=i,c=r;for(;!l&&h>0;)h--,u>>=1,c>>=1,l=this.tiles[lE(h,u,c)];return l?.source?(n>1&&(console.log("found parent tile z%d-%d-%d",h,u,c),console.time("drilling down")),this.splitTile(l.source,h,u,c,t,i,r),n>1&&console.timeEnd("drilling down"),this.tiles[o]?lP(this.tiles[o],a):null):null}splitTile(t,i,r,a,n,s,o){let l=[t,i,r,a],h=this.options,u=h.debug;for(;l.length;){a=l.pop(),r=l.pop(),i=l.pop(),t=l.pop();let c=1<<i,d=lE(i,r,a),p=this.tiles[d];if(!p&&(u>1&&console.time("creation"),p=this.tiles[d]=lT(t,i,r,a,h),this.tileCoords.push({z:i,x:r,y:a,id:d}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,r,a,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let t=`z${i}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(p.source=t,null==n){if(i===h.indexMaxZoom||p.numPoints<=h.indexMaxPoints)continue}else{if(i===h.maxZoom||i===n)continue;if(null!=n){let t=n-i;if(r!==s>>t||a!==o>>t)continue}}if(p.source=null,!t.length)continue;u>1&&console.time("clipping");let f=.5*h.buffer/h.extent,m=.5-f,_=.5+f,g=1+f,y=null,x=null,v=null,b=null,w=lo(t,c,r-f,r+_,L.X,p.minX,p.maxX,h),T=lo(t,c,r+m,r+g,L.X,p.minX,p.maxX,h);w&&(y=lo(w,c,a-f,a+_,L.Y,p.minY,p.maxY,h),x=lo(w,c,a+m,a+g,L.Y,p.minY,p.maxY,h)),T&&(v=lo(T,c,a-f,a+_,L.Y,p.minY,p.maxY,h),b=lo(T,c,a+m,a+g,L.Y,p.minY,p.maxY,h)),u>1&&console.timeEnd("clipping"),l.push(y||[],i+1,2*r,2*a),l.push(x||[],i+1,2*r,2*a+1),l.push(v||[],i+1,2*r+1,2*a),l.push(b||[],i+1,2*r+1,2*a+1)}}invalidateTiles(t){if(!t.length)return;let i=this.options,{debug:r}=i,a=1/0,n=-1/0,s=1/0,o=-1/0;for(let i of t)a=Math.min(a,i.minX),n=Math.max(n,i.maxX),s=Math.min(s,i.minY),o=Math.max(o,i.maxY);let l=i.buffer/i.extent,h=new Set;for(let i in this.tiles){let u=this.tiles[i],c=1<<u.z,d=(u.x-l)/c,p=(u.x+1+l)/c,f=(u.y-l)/c,m=(u.y+1+l)/c;if(n<d||a>=p||o<f||s>=m)continue;let _=!1;for(let i of t)if(i.maxX>=d&&i.minX<p&&i.maxY>=f&&i.minY<m){_=!0;break}if(_){if(r){r>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",u.z,u.x,u.y,u.numFeatures,u.numPoints,u.numSimplified);let t=`z${u.z}`;this.stats[t]=(this.stats[t]||0)-1,this.total--}delete this.tiles[i],h.add(i)}}h.size&&(this.tileCoords=this.tileCoords.filter(t=>!h.has(t.id)))}}function lE(t,i,r){return 32*((1<<t)*r+i)+t}let lC={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,
2cluster:!1,clusterOptions:ly,debug:0},{members:lA}=nu([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:lD}=nu([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),lz=Math.cos(Math.PI/180*37.5);class lk{constructor(t){for(const i of(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers))this.gradients[i.id]={};this.layoutVertexArray=new nJ,this.layoutVertexArray2=new nQ,this.indexArray=new n8,this.programConfigurations=new sE(t.layers,t.zoom),this.segments=new se,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,i,r){this.hasDependencies=ol("line",this.layers,i)||this.hasLineDasharray(this.layers);let a=this.layers[0].layout.get("line-sort-key"),n=!a.isConstant(),s=[];for(let{feature:i,id:o,index:l,sourceLayerIndex:h}of t){let t=this.layers[0]._featureFilter.needGeometry,u=sz(i,t);if(!this.layers[0]._featureFilter.filter(new aX(this.zoom),u,r))continue;let c=n?a.evaluate(u,{},r):void 0,d={id:o,properties:i.properties,type:i.type,sourceLayerIndex:h,index:l,geometry:t?u.geometry:sD(i),patterns:{},dashes:{},sortKey:c};s.push(d)}for(let a of(n&&s.sort((t,i)=>t.sortKey-i.sortKey),s)){let{geometry:n,index:s,sourceLayerIndex:o}=a;this.hasDependencies?(ol("line",this.layers,i)?oh("line",this.layers,a,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,a,this.zoom,i),this.patternFeatures.push(a)):this.addFeature(a,n,s,r,{},{},i.subdivisionGranularity),i.featureIndex.insert(t[s].feature,n,s,o,this.index)}}update(t,i,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,i,this.stateDependentLayers,{imagePositions:r,dashPositions:a})}addFeatures(t,i,r,a){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,i,r,a,t.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,lD)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,lA),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,lb)&&Object.hasOwn(t.properties,lw))return{start:+t.properties[lb],end:+t.properties[lw]}}addFeature(t,i,r,a,n,s,o){let l=this.layers[0].layout,h=l.get("line-join").evaluate(t,{}),u=l.get("line-cap").evaluate(t,{}),c=l.get("line-miter-limit").evaluate(t,{}),d=l.get("line-round-limit").evaluate(t,{});for(let r of(this.lineClips=this.lineFeatureClips(t),i))this.addLine(r,t,h,u,c,d,a,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:s,canonical:a})}addLine(t,i,r,a,n,s,o,l){let h,u,c,d,p;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=oA(t,o?l.line.getGranularityForZoomLevel(o.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let i=0;i<t.length-1;i++)this.totalDistance+=t[i].dist(t[i+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let f="Polygon"===oV.types[i.type],m=t.length;for(;m>=2&&t[m-1].equals(t[m-2]);)m--;let _=0;for(;_<m-1&&t[_].equals(t[_+1]);)_++;if(m<(f?3:2))return;"bevel"===r&&(n=1.05);let g=this.overscaling<=16?122880/(512*this.overscaling):0,y=this.segments.prepareSegment(10*m,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,f&&(h=t[m-2],p=t[_].sub(h)._unit()._perp());for(let i=_;i<m;i++){if((c=i===m-1?f?t[_+1]:void 0:t[i+1])&&t[i].equals(c))continue;p&&(d=p),h&&(u=h),h=t[i],p=c?c.sub(h)._unit()._perp():d,d||(d=p);let o=d.add(p);0===o.x&&0===o.y||o._unit();let l=d.x*p.x+d.y*p.y,x=o.x*p.x+o.y*p.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<lz&&u&&c,T=d.x*p.y-d.y*p.x>0;if(w&&i>_){let t=h.dist(u);if(t>
22*g){let i=h.sub(h.sub(u)._mult(g/t)._round());this.updateDistance(u,i),this.addCurrentVertex(i,d,0,0,y),u=i}}let S=u&&c,P=S?r:f?"butt":a;if(S&&"round"===P&&(v<s?P="miter":v<=2&&(P="fakeround")),"miter"===P&&v>n&&(P="bevel"),"bevel"===P&&(v>2&&(P="flipbevel"),v<n&&(P="miter")),u&&this.updateDistance(u,h),"miter"===P)o._mult(v),this.addCurrentVertex(h,o,0,0,y);else if("flipbevel"===P){if(v>100)o=p.mult(-1);else{let t=v*d.add(p).mag()/d.sub(p).mag();o._perp()._mult(t*(T?-1:1))}this.addCurrentVertex(h,o,0,0,y),this.addCurrentVertex(h,o.mult(-1),0,0,y)}else if("bevel"===P||"fakeround"===P){let t=-Math.sqrt(v*v-1),i=T?t:0,r=T?0:t;if(u&&this.addCurrentVertex(h,d,i,r,y),"fakeround"===P){let t=Math.round(180*b/Math.PI/20);for(let i=1;i<t;i++){let r=i/t;if(.5!==r){let t=r-.5;r+=r*t*(r-1)*((1.0904+l*(l*(3.55645-1.43519*l)-3.2452))*t*t+(.848013+l*(.215638*l-1.06021)))}let a=p.sub(d)._mult(r)._add(d)._unit()._mult(T?-1:1);this.addHalfVertex(h,a.x,a.y,!1,T,0,y)}}c&&this.addCurrentVertex(h,p,-i,-r,y)}else if("butt"===P)this.addCurrentVertex(h,o,0,0,y);else if("square"===P){let t=u?1:-1;this.addCurrentVertex(h,o,t,t,y)}else"round"===P&&(u&&(this.addCurrentVertex(h,d,0,0,y),this.addCurrentVertex(h,d,1,1,y,!0)),c&&(this.addCurrentVertex(h,p,-1,-1,y,!0),this.addCurrentVertex(h,p,0,0,y)));if(w&&i<m-1){let t=h.dist(c);if(t>2*g){let i=h.add(c.sub(h)._mult(g/t)._round());this.updateDistance(h,i),this.addCurrentVertex(i,p,0,0,y),h=i}}}}addCurrentVertex(t,i,r,a,n,s=!1){let o=i.y*a-i.x,l=-i.y-i.x*a;this.addHalfVertex(t,i.x+i.y*r,i.y-i.x*r,s,!1,r,n),this.addHalfVertex(t,o,l,s,!0,-a,n),this.distance>16384&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,i,r,a,n,s))}addHalfVertex({x:t,y:i},r,a,n,s,o,l){let h=.5*(this.lineClips?32767*this.scaledDistance:this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+ +!!n,(i<<1)+ +!!s,Math.round(63*r)+128,Math.round(63*a)+128,1+(0===o?0:o<0?-1:1)|(63&h)<<2,h>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let u=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),l.primitiveLength++),s?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,i){this.distance+=t.dist(i),this.updateScaledDistance()}hasLineDasharray(t){for(let i of t){let t=i.paint.get("line-dasharray");if(t&&!t.isConstant())return!0}return!1}addLineDashDependencies(t,i,r,a){for(let n of t){let t=n.paint.get("line-dasharray");if(!t||"constant"===t.value.kind)continue;let s="round"===n.layout.get("line-cap").evaluate(i,{}),o={dasharray:t.value.evaluate({zoom:r-1},i,{}),round:s},l={dasharray:t.value.evaluate({zoom:r},i,{}),round:s},h={dasharray:t.value.evaluate({zoom:r+1},i,{}),round:s},u=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,d=`${h.dasharray.join(",")},${h.round}`;a.dashDependencies[u]=o,a.dashDependencies[c]=l,a.dashDependencies[d]=h,i.dashes[n.id]={min:u,mid:c,max:d}}}}ak("LineBucket",lk,{omit:["layers","patternFeatures"]});var lR={get paint(){return _=_||new nt({"line-opacity":new a8(e0.paint_line["line-opacity"]),"line-color":new a8(e0.paint_line["line-color"]),"line-translate":new a4(e0.paint_line["line-translate"]),"line-translate-anchor":new a4(e0.paint_line["line-translate-anchor"]),"line-width":new a8(e0.paint_line["line-width"]),"line-gap-width":new a8(e0.paint_line["line-gap-width"]),"line-offset":new a8(e0.paint_line["line-offset"]),"line-blur":new a8(e0.paint_line["line-blur"]),"line-dasharray":new a7(e0.paint_line["line-dasharray"]),"line-pattern":new a7(e0.paint_line["line-pattern"]),"line-gradient":new ne(e0.paint_line["line-gradient"])})},get layout(){return m=m||new nt({"line-cap":new a8(e0.layout_line["line-cap"]),"line-join":new a8(e0.layout_line["line-join"]),"line-miter-limit":new a8(e0.layout_line["line-miter-limit"]),"line-round-limit":new a8(e0.layout_line["line-round-limit"]),"line-sort-key":new a8(e0.layout_line["line-sort-key"])})}};class lL extends a8{possiblyEvaluate(t,i){return i=new aX(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(t,i)}evaluate(t,i,r,a){return i=ev({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(t,i,r,a)}}class lF extends na{constructor(t,i){super(t,lR,i),this.gradientVersion=0,g||((g=new lL(lR.paint.properties["line-width"].specification)).useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){let t=this.gradientExpression();this.stepInterpolant=void 0!==t._styleExpression&&t._styleExpression.expression instanceof iy,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,i){super.recalculate(t,i),this.paint._values["line-floorwidth"]=g.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new lk(t)}queryRadius(t){var i,r;return i=sU("line-width",this,t),((r=sU("line-gap-width",this,t))>0?r+2*i:i)/2+Math.abs(sU("line-offset",this,t))+sG(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:i,featureState:r,geometry:a,transform:n,pixelsToTileUnits:s}){var o,l;let h=s$(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,s),u=s/2*(o=this.paint.get("line-width").evaluate(i,r),(l=this.paint.get("line-gap-width").evaluate(i,r))>0?l+2*o:o),c=this.paint.get("line-offset").evaluate(i,r);return c&&(a=function(t,i){let r=[];for(let a of t){let t=function(t){let i=[];for(let r=0;r<t.length;r++){let a=t[r],n=i.at(-1);(0===r||n&&!a.equals(n))&&i.push(a)}return i}(a),n=[];for(let r=0;r<t.length;r++){let a=t[r],s=t[r-1],o=t[r+1],l=0===r?new w(0,0):a.sub(s)._unit()._perp(),h=r===t.length-1?new w(0,0):o.sub(a)._unit()._perp(),u=l._add(h)._unit(),c=u.x*h.x+u.y*h.y;0!==c&&u._mult(1/c),n.push(u._mult(i)._add(a))}r.push(n)}return r}(a,c*s)),function(t,i,r){for(let a of i){if(t.length>=3){for(let i of a)if(sN(t,i))return!0}if(function(t,i,r){if(t.length>1){if(sB(t,i))return!0;for(let a of i)if(sO(a,t,r))return!0}for(let a of t)if(sO(a,i,r))return!0;return!1}(t,a,r))return!0}return!1}(h,a,u)}isTileClipped(){return!0}}let lB=nu([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),lO=nu([{name:"a_projected_pos",components:3,type:"Float32"}],4);nu([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let lV=nu([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);nu([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let lj=nu([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),lN=nu([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);
2nu([{name:"triangle",components:3,type:"Uint16"}]),nu([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),nu([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),nu([{type:"Float32",name:"offsetX"}]),nu([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),nu([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let lU={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","\xa2":"¢","\xa3":"£","\xa5":"¥","\xa6":"¦","\xac":"¬","\xaf":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},lG={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},l$={40:!0};function lZ(t,i,r,a,n,s){if("fontStack"in i){let a=r[i.fontStack],s=null==a?void 0:a[t];return s?s.metrics.advance*i.scale+n:0}{let t=a[i.imageName];return t?t.displaySize[0]*i.scale*24/s+n:0}}function lq(t,i,r,a){let n=Math.pow(t-i,2);return a?t<i?n/2:2*n:n+Math.abs(r)*r}function lW(t,i,r,a,n,s){let o=null,l=lq(i,r,n,s);for(let t of a){let a=lq(i-t.x,r,n,s)+t.badness;a<=l&&(o=t,l=a)}return{index:t,x:i,priorBreak:o,badness:l}}class lH{constructor(t="",i=[],r=[]){this.text=t,this.sections=i,this.sectionIndex=r,this.imageSectionID=null}static fromFeature(t,i){let r=new lH;for(let a of t.sections)a.image?r.addImageSection(a):r.addTextSection(a,i);return r}length(){return[...this.text].length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=function(t){let i="",r={premature:!0,value:void 0},a=t[Symbol.iterator](),n=a.next(),s=t[Symbol.iterator]();s.next();let o=s.next();for(;!n.done;)i+=!o.done&&aZ(o.value.codePointAt(0))&&!lU[o.value]||!r.premature&&aZ(r.value.codePointAt(0))&&!lU[r.value]||!lU[n.value]?n.value:lU[n.value],r={value:n.value,premature:!1},n=a.next(),o=s.next();return i}(this.text)}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){let t=this.text.match(/^\s*/),i=t?t[0].length:0,r=this.text.match(/\S\s*$/),a=r?r[0].length-1:0;this.text=this.text.substring(i,this.text.length-a),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-a)}substring(t,i){let r=[...this.text].slice(t,i).join(""),a=this.sectionIndex.slice(t,i);return new lH(r,this.sections,a)}toCodeUnitIndex(t){return[...this.text].slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,i)=>Math.max(t,this.sections[i].scale),0)}getMaxImageSize(t){let i=0,r=0;for(let a=0;a<this.length();a++){let n=this.getSection(a);if("imageName"in n){let a=t[n.imageName];if(!a)continue;let s=a.displaySize;i=Math.max(i,s[0]),r=Math.max(r,s[1])}}return{maxImageWidth:i,maxImageHeight:r}}addTextSection(t,i){this.text+=t.text,this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||i});let r=this.sections.length-1;this.sectionIndex.push(...[...t.text].map(()=>r))}addImageSection(t){let i=t.image?t.image.name:"";if(0===i.length)return void eM("Can't add FormattedSection with an empty image.");let r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):eM("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,i,r,a,n){let s=[],o=this.determineAverageLineWidth(t,i,r,a,n),l=this.hasZeroWidthSpaces(),h=0,u=0,c=this.text[Symbol.iterator](),d=c.next(),p=this.text[Symbol.iterator]();p.next();let f=p.next(),m=this.text[Symbol.iterator]();m.next(),m.next();let _=m.next();for(;!d.done;){let i=this.getSection(u),g=d.value.codePointAt(0);if(aN(g)||(h+=lZ(g,i,r,a,t,n)),!f.done){let t=/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(g)),r=f.value.codePointAt(0);(lG[g]||t||"imageName"in i||!_.done&&l$[r])&&s.push(lW(u+1,h,o,s,function(t,i,r){let a=0;return 10===t&&(a-=1e4),r&&(a+=150),40!==t&&65288!==t||(a+=50),41!==i&&65289!==i||(a+=50),a}(g,r,t&&l),!1))}u++,d=c.next(),f=p.next(),_=m.next()}return function t(i){return i?t(i.priorBreak).concat(i.index):[]}(lW(this.length(),h,o,s,0,!0))}determineAverageLineWidth(t,i,r,a,n){let s=0,o=0;for(let i of this.text){let l=this.getSection(o);s+=lZ(i.codePointAt(0),l,r,a,t,n),o++}return s/Math.max(1,Math.ceil(s/i))}}let lX="u"<typeof TextDecoder?null:new TextDecoder("utf-8");class lY{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,i,r=this.length){for(;this.pos<r;){let r=this.readVarint(),a=r>>3,n=this.pos;this.type=7&r,t(a,i,this),this.pos===n&&this.skip(r)}return i}readMessage(t,i){return this.readFields(t,i,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getUint32(this.pos+4,!0);return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getInt32(this.pos+4,!0);return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let i,r,a=this.buf;return i=127&(r=a[this.pos++]),r<128?i:(i|=(127&(r=a[this.pos++]))<<7,r<128?i:(i|=(127&(r=a[this.pos++]))<<14,r<128?i:(i|=(127&(r=a[this.pos++]))<<21,r<128?i:function(t,i,r){let a,n,s=r.buf;if(a=(112&(n=s[r.pos++]))>>4,n<128||(a|=(127&(n=s[r.pos++]))<<3,n<128)||(a|=(127&(n=s[r.pos++]))<<10,n<128)||(a|=(127&(n=s[r.pos++]))<<17,n<128)||(a|=(127&(n=s[r.pos++]))<<24,n<128)||(a|=(1&(n=s[r.pos++]))<<31,n<128))return function(t,i,r){return r?0x100000000*i+(t>>>0):0x100000000*(i>>>0)+(t>>>0)}(t,a,i);throw Error("Expected varint not more than 10 bytes")}(i|=(15&(r=a[this.pos]))<<28,t,this))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let t=this.readVarint();return t%2==1?-((t+1)/2):t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,i=this.pos;return this.pos=t,t-i>=12&&lX?lX.decode(this.buf.subarray(i,t)):function(t,i,r){let a="",n=i;for(;n<r;){let i=t[n],s,o,l,h=null,u=i>239?4:i>223?3:i>191?2:1;if(n+u>r)break;
21===u?i<128&&(h=i):2===u?128==(192&(s=t[n+1]))&&(h=(31&i)<<6|63&s)<=127&&(h=null):3===u?(s=t[n+1],o=t[n+2],128==(192&s)&&128==(192&o)&&((h=(15&i)<<12|(63&s)<<6|63&o)<=2047||h>=55296&&h<=57343)&&(h=null)):4===u&&(s=t[n+1],o=t[n+2],l=t[n+3],128==(192&s)&&128==(192&o)&&128==(192&l)&&((h=(15&i)<<18|(63&s)<<12|(63&o)<<6|63&l)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,a+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),a+=String.fromCharCode(h),n+=u}return a}(this.buf,i,t)}readBytes(){let t=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,t);return this.pos=t,i}readPackedVarint(t=[],i){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readVarint(i));return t}readPackedSVarint(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFloat());return t}readPackedDouble(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){let i=7&t;if(0===i)for(;this.buf[this.pos++]>127;);else if(2===i)this.pos=this.readVarint()+this.pos;else if(5===i)this.pos+=4;else{if(1!==i)throw Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(t,i){this.writeVarint(t<<3|i)}realloc(t){let i=this.length||16;for(;i<this.pos+t;)i*=2;if(i!==this.length){let t=new Uint8Array(i);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=i}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*t),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*t),!0),this.pos+=8}writeVarint(t){(t=+t||0)>0xfffffff||t<0?function(t,i){var r,a;let n,s,o;if(t>=0?(n=t%0x100000000|0,s=t/0x100000000|0):(n=~(-t%0x100000000),s=~(-t/0x100000000),0xffffffff^n?n=n+1|0:(n=0,s=s+1|0)),t>=0xffffffffffffffff||t<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");i.realloc(10),r=n,i.buf[i.pos++]=127&r|128,r>>>=7,i.buf[i.pos++]=127&r|128,r>>>=7,i.buf[i.pos++]=127&r|128,r>>>=7,i.buf[i.pos++]=127&r|128,i.buf[i.pos]=127&(r>>>=7),o=(7&(a=s))<<4,i.buf[i.pos++]|=o|128*!!(a>>>=3),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a|128*!!(a>>>=7),a&&(i.buf[i.pos++]=127&a)))))}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|128*(t>127),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|128*(t>127),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|128*(t>127),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?-(2*t)-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;let i=this.pos;this.pos=function(t,i,r){for(let a,n,s=0;s<i.length;s++){if((a=i.charCodeAt(s))>55295&&a<57344){if(!n){a>56319||s+1===i.length?(t[r++]=239,t[r++]=191,t[r++]=189):n=a;continue}if(a<56320){t[r++]=239,t[r++]=191,t[r++]=189,n=a;continue}a=n-55296<<10|a-56320|65536,n=null}else n&&(t[r++]=239,t[r++]=191,t[r++]=189,n=null);a<128?t[r++]=a:(a<2048?t[r++]=a>>6|192:(a<65536?t[r++]=a>>12|224:(t[r++]=a>>18|240,t[r++]=a>>12&63|128),t[r++]=a>>6&63|128),t[r++]=63&a|128)}return r}(this.buf,t,this.pos);let r=this.pos-i;r>=128&&lK(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let i=t.length;this.writeVarint(i),this.realloc(i);for(let r=0;r<i;r++)this.buf[this.pos++]=t[r]}writeRawMessage(t,i){this.pos++;let r=this.pos;t(i,this);let a=this.pos-r;a>=128&&lK(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a}writeMessage(t,i,r){this.writeTag(t,2),this.writeRawMessage(i,r)}writePackedVarint(t,i){i.length&&this.writeMessage(t,lJ,i)}writePackedSVarint(t,i){i.length&&this.writeMessage(t,lQ,i)}writePackedBoolean(t,i){i.length&&this.writeMessage(t,l2,i)}writePackedFloat(t,i){i.length&&this.writeMessage(t,l0,i)}writePackedDouble(t,i){i.length&&this.writeMessage(t,l1,i)}writePackedFixed32(t,i){i.length&&this.writeMessage(t,l3,i)}writePackedSFixed32(t,i){i.length&&this.writeMessage(t,l5,i)}writePackedFixed64(t,i){i.length&&this.writeMessage(t,l6,i)}writePackedSFixed64(t,i){i.length&&this.writeMessage(t,l4,i)}writeBytesField(t,i){this.writeTag(t,2),this.writeBytes(i)}writeFixed32Field(t,i){this.writeTag(t,5),this.writeFixed32(i)}writeSFixed32Field(t,i){this.writeTag(t,5),this.writeSFixed32(i)}
2writeFixed64Field(t,i){this.writeTag(t,1),this.writeFixed64(i)}writeSFixed64Field(t,i){this.writeTag(t,1),this.writeSFixed64(i)}writeVarintField(t,i){this.writeTag(t,0),this.writeVarint(i)}writeSVarintField(t,i){this.writeTag(t,0),this.writeSVarint(i)}writeStringField(t,i){this.writeTag(t,2),this.writeString(i)}writeFloatField(t,i){this.writeTag(t,5),this.writeFloat(i)}writeDoubleField(t,i){this.writeTag(t,1),this.writeDouble(i)}writeBooleanField(t,i){this.writeVarintField(t,+i)}}function lK(t,i,r){let a=i<=16383?1:i<=2097151?2:i<=0xfffffff?3:Math.floor(Math.log(i)/(7*Math.LN2));r.realloc(a);for(let i=r.pos-1;i>=t;i--)r.buf[i+a]=r.buf[i]}function lJ(t,i){for(let r=0;r<t.length;r++)i.writeVarint(t[r])}function lQ(t,i){for(let r=0;r<t.length;r++)i.writeSVarint(t[r])}function l0(t,i){for(let r=0;r<t.length;r++)i.writeFloat(t[r])}function l1(t,i){for(let r=0;r<t.length;r++)i.writeDouble(t[r])}function l2(t,i){for(let r=0;r<t.length;r++)i.writeBoolean(t[r])}function l3(t,i){for(let r=0;r<t.length;r++)i.writeFixed32(t[r])}function l5(t,i){for(let r=0;r<t.length;r++)i.writeSFixed32(t[r])}function l6(t,i){for(let r=0;r<t.length;r++)i.writeFixed64(t[r])}function l4(t,i){for(let r=0;r<t.length;r++)i.writeSFixed64(t[r])}function l8(t,i,r){1===t&&r.readMessage(l7,i)}function l7(t,i,r){if(3===t){let{id:t,bitmap:a,width:n,height:s,left:o,top:l,advance:h}=r.readMessage(l9,{});i.push({id:t,bitmap:new s5({width:n+6,height:s+6},a),metrics:{width:n,height:s,left:o,top:l,advance:h}})}}function l9(t,i,r){1===t?i.id=r.readVarint():2===t?i.bitmap=r.readBytes():3===t?i.width=r.readVarint():4===t?i.height=r.readVarint():5===t?i.left=r.readSVarint():6===t?i.top=r.readSVarint():7===t&&(i.advance=r.readVarint())}function he(t){let i=0,r=0;for(let a of t)i+=a.w*a.h,r=Math.max(r,a.w);t.sort((t,i)=>i.h-t.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),r),h:1/0}],n=0,s=0;for(let i of t)for(let t=a.length-1;t>=0;t--){let r=a[t];if(!(i.w>r.w||i.h>r.h)){if(i.x=r.x,i.y=r.y,s=Math.max(s,i.y+i.h),n=Math.max(n,i.x+i.w),i.w===r.w&&i.h===r.h){let i=a.pop();i&&t<a.length&&(a[t]=i)}else i.h===r.h?(r.x+=i.w,r.w-=i.w):(i.w===r.w||a.push({x:r.x+i.w,y:r.y,w:r.w-i.w,h:i.h}),r.y+=i.h,r.h-=i.h);break}}return{w:n,h:s,fill:i/(n*s)||0}}class ht{constructor(t,{pixelRatio:i,version:r,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l}){this.paddedRect=t,this.pixelRatio=i,this.stretchX=a,this.stretchY=n,this.content=s,this.version=r,this.textFitWidth=o,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class hi{constructor(t,i){const r={},a={};this.haveRenderCallbacks=[];const n=[];this.addImages(t,r,n),this.addImages(i,a,n);const{w:s,h:o}=he(n),l=new s6({width:s||1,height:o||1});for(const i in t){const a=t[i],n=r[i].paddedRect;s6.copy(a.data,l,{x:0,y:0},{x:n.x+1,y:n.y+1},a.data)}for(const t in i){const r=i[t],n=a[t].paddedRect,s=n.x+1,o=n.y+1,h=r.data.width,u=r.data.height;s6.copy(r.data,l,{x:0,y:0},{x:s,y:o},r.data),s6.copy(r.data,l,{x:0,y:u-1},{x:s,y:o-1},{width:h,height:1}),s6.copy(r.data,l,{x:0,y:0},{x:s,y:o+u},{width:h,height:1}),s6.copy(r.data,l,{x:h-1,y:0},{x:s-1,y:o},{width:1,height:u}),s6.copy(r.data,l,{x:0,y:0},{x:s+h,y:o},{width:1,height:u})}this.image=l,this.iconPositions=r,this.patternPositions=a}addImages(t,i,r){for(let a in t){let n=t[a],s={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(s),i[a]=new ht(s,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(a)}}patchUpdatedImages(t,i){for(let r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),i),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),i)}patchUpdatedImage(t,i,r){if(!t||!i||t.version===i.version)return;t.version=i.version;let[a,n]=t.tl;r.update(i.data,void 0,{x:a,y:n})}}function hr(i,r,a,n,s,o,l,h,u,c,d,p,f,m,_){let g,y=lH.fromFeature(i,s);p===t.ax.vertical&&y.verticalizePunctuation();let x=y.determineLineBreaks(c,o,r,n,m),{processBidirectionalText:v,processStyledBidirectionalText:b}=aH;if(v&&1===y.sections.length)for(let t of(g=[],x=x.map(t=>y.toCodeUnitIndex(t)),v(y.toString(),x))){let i=[...t].map(()=>0);g.push(new lH(t,y.sections,i))}else if(b){g=[],x=x.map(t=>y.toCodeUnitIndex(t));let t=0,i=[];for(let r of y.text)i.push(...Array(r.length).fill(y.sectionIndex[t])),t++;for(let t of b(y.text,i,x)){let i=[],r="";for(let a of t[0])i.push(t[1][r.length]),r+=a;g.push(new lH(t[0],y.sections,i))}}else g=function(t,i){let r=[],a=0;for(let n of i)r.push(t.substring(a,n)),a=n;return a<t.length()&&r.push(t.substring(a,t.length())),r}(y,x);let w=[],T={positionedLines:w,text:y.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(i,r,a,n,s,o,l,h,u,c,d,p){let f=0,m=0,_=0,g=0,y="right"===h?1:.5*("left"!==h),x=24/p,v=0;for(let l of s){l.trim();let s=l.getMaxScale(),h={positionedGlyphs:[],lineOffset:0};i.positionedLines[v]=h;let p=h.positionedGlyphs,S=0;if(!l.length()){m+=o,++v;continue}let P=function(t,i,r){let a=24*i.getMaxScale(),{maxImageWidth:n,maxImageHeight:s}=i.getMaxImageSize(t),o=Math.max(a,s*r);return{verticalLineContentWidth:Math.max(a,n*r),horizontalLineContentHeight:o}}(n,l,x),M=0;for(let o of l.text){var b,w,T;let h,_=l.getSection(M),g=o.codePointAt(0),y=(b=u,w=d,T=g,!(b===t.ax.horizontal||!w&&!aj(T)||w&&(aN(T)||/\p{sc=Arab}/u.test(String.fromCodePoint(T))))),v={glyph:g,imageName:null,x:f,y:m+-17,vertical:y,scale:1,fontStack:"",sectionIndex:l.getSectionIndex(M),metrics:null,rect:null};if("fontStack"in _){if(!(h=function(t,i,r,a,n,s){let o,l=s[t.fontStack],h=function(t,i,r,a){if(null==t?void 0:t.rect)return t;let n=i[r.fontStack],s=null==n?void 0:n[a];return s?{rect:null,metrics:s.metrics}:null}(null==l?void 0:l[i],n,t,i);if(null===h)return null;if(r)o=a.verticalLineContentWidth-24*t.scale;else{let i=hn(t.verticalAlign);o=(a.horizontalLineContentHeight-24*t.scale)*i}return{rect:h.rect,metrics:h.metrics,baselineOffset:o}}(_,g,y,P,r,a)))continue;v.fontStack=_.fontStack}else{if(i.iconsInText=!0,_.scale*=x,!(h=function(t,i,r,a,n){let s,o=n[t.imageName];if(!o)return null;let l=o.paddedRect,h=o.displaySize,u={width:h[0],height:h[1],left:1,top:-3,advance:i?h[1]:h[0]};if(i)s=a.verticalLineContentWidth-h[1]*t.scale;else{let i=hn(t.verticalAlign);s=(a.horizontalLineContentHeight-h[1]*t.scale)*i}return{rect:l,metrics:u,baselineOffset:s,imageOffset:(i?h[0]:h[1])*t.scale-24*r}}(_,y,s,P,n)))continue;S=Math.max(S,h.imageOffset),v.imageName=_.imageName}let{rect:I,metrics:E,baselineOffset:C}=h;v.y+=C,v.scale=_.scale,v.metrics=E,v.rect=I,p.push(v),y?(i.verticalizable=!0,f+=("imageName"in _?E.advance:24)*_.scale+c):f+=E.advance*_.scale+c,M++}0!==p.length&&(_=Math.max(f-c,_),function(t,i,r){if(0===r)return;let a=t[i],n=(t[i].x+a.metrics.advance*a.scale)*r;
2for(let r=0;r<=i;r++)t[r].x-=n}(p,p.length-1,y)),f=0,h.lineOffset=Math.max(S,(s-1)*24);let I=o*s+S;m+=I,g=Math.max(I,g),++v}let{horizontalAlign:S,verticalAlign:P}=ha(l);(function(t,i,r,a,n,s,o,l,h){let u=(i-r)*n,c=0;for(let i of(c=s!==o?-l*a- -17:-a*h*o+.5*o,t))for(let t of i.positionedGlyphs)t.x+=u,t.y+=c})(i.positionedLines,y,S,P,_,g,o,m,s.length),i.top+=-P*m,i.bottom=i.top+m,i.left+=-S*_,i.right=i.left+_}(T,r,a,n,g,l,h,u,p,c,f,_),!function(t){for(let i of t)if(0!==i.positionedGlyphs.length)return!1;return!0}(w)&&T}function ha(t){let i=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":i=1;break;case"left":case"top-left":case"bottom-left":i=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:i,verticalAlign:r}}function hn(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function hs(t){var i,r;let a=t.left,n=t.top,s=t.right-a,o=t.bottom-n,l=null!=(i=t.image.textFitWidth)?i:"stretchOrShrink",h=null!=(r=t.image.textFitHeight)?r:"stretchOrShrink",u=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===h){if("stretchOnly"===l&&s/o<u||"proportional"===l){let t=Math.ceil(o*u);a*=t/s,s=t}}else if("proportional"===l&&"stretchOnly"===h&&0!==u&&s/o>u){let t=Math.ceil(s/u);n*=t/o,o=t}return{x1:a,y1:n,x2:a+s,y2:n+o}}function ho(t,i,r,a,n,s){let o,l,h,u,c,d=t.image;if(d.content){let t=d.content,i=d.pixelRatio||1;o=[t[0]/i,t[1]/i,d.displaySize[0]-t[2]/i,d.displaySize[1]-t[3]/i]}let p=i.left*s,f=i.right*s;"width"===r||"both"===r?(c=n[0]+p-a[3],h=n[0]+f+a[1]):h=(c=n[0]+(p+f-d.displaySize[0])/2)+d.displaySize[0];let m=i.top*s,_=i.bottom*s;return"height"===r||"both"===r?(l=n[1]+m-a[0],u=n[1]+_+a[2]):u=(l=n[1]+(m+_-d.displaySize[1])/2)+d.displaySize[1],{image:d,top:l,right:h,bottom:u,left:c,collisionPadding:o}}function hl(t,i){let{expression:r}=i;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new aX(t+1))};if("source"===r.kind)return{kind:"source"};{let{zoomStops:i,interpolationType:a}=r,n=0;for(;n<i.length&&i[n]<=t;)n++;let s=n=Math.max(0,n-1);for(;s<i.length&&i[s]<t+1;)s++;s=Math.min(i.length-1,s);let o=i[n],l=i[s];return"composite"===r.kind?{kind:"composite",minZoom:o,maxZoom:l,interpolationType:a}:{kind:"camera",minZoom:o,maxZoom:l,minSize:r.evaluate(new aX(o)),maxSize:r.evaluate(new aX(l)),interpolationType:a}}}function hh(t,i,r){let a="never",n=t.get(i);return n?a=n:t.get(r)&&(a="always"),a}ak("ImagePosition",ht),ak("ImageAtlas",hi),t.ax=void 0,(F=t.ax||(t.ax={}))[F.none=0]="none",F[F.horizontal=1]="horizontal",F[F.vertical=2]="vertical",F[F.horizontalOnly=3]="horizontalOnly";let hu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function hc(t,i,r,a,n,s,o,l,h,u,c,d,p){let f=l?Math.min(32640,Math.round(l[0])):0,m=l?Math.min(32640,Math.round(l[1])):0;t.emplaceBack(i,r,Math.round(32*a),Math.round(32*n),s,o,(f<<1)+ +!!h,m,16*u,16*c,256*d,256*p)}function hd(t,i,r){t.emplaceBack(i.x,i.y,r),t.emplaceBack(i.x,i.y,r),t.emplaceBack(i.x,i.y,r),t.emplaceBack(i.x,i.y,r)}class hp{constructor(t){this.layoutVertexArray=new n2,this.indexArray=new n8,this.programConfigurations=t,this.segments=new se,this.dynamicLayoutVertexArray=new n3,this.opacityVertexArray=new n5,this.hasVisibleVertices=!1,this.placedSymbolArray=new nV}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,i,r,a){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,lB.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,lO.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,hu,!0),this.opacityVertexBuffer.itemSize=1),(r||a)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}
2ak("SymbolBuffers",hp);class hf{constructor(t,i,r){this.layoutVertexArray=new t,this.layoutAttributes=i,this.indexArray=new r,this.segments=new se,this.collisionVertexArray=new n4}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,lV.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ak("CollisionBuffers",hf);class hm{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(t=>t.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hl(this.zoom,r["text-size"]),this.iconSizeData=hl(this.zoom,r["icon-size"]);const a=this.layers[0].layout,n=a.get("symbol-sort-key"),s=a.get("symbol-z-order");this.canOverlap="never"!==hh(a,"text-overlap","text-allow-overlap")||"never"!==hh(a,"icon-overlap","icon-allow-overlap")||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==s&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===s||"auto"===s&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===a.get("symbol-placement")&&(this.writingModes=a.get("text-writing-mode").map(i=>t.ax[i])),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.sourceID=i.sourceID}createArrays(){this.text=new hp(new sE(this.layers,this.zoom,t=>t.startsWith("text"))),this.icon=new hp(new sE(this.layers,this.zoom,t=>t.startsWith("icon"))),this.glyphOffsetArray=new nU,this.lineVertexArray=new nG,this.symbolInstances=new nN,this.textAnchorOffsets=new nZ}calculateGlyphDependencies(t,i,r,a,n){for(let s of t)if(i[s.codePointAt(0)]=!0,(r||a)&&n){let t=lU[s];t&&(i[t.codePointAt(0)]=!0)}}populate(i,r,a){var n;let s=this.layers[0],o=s.layout,l=o.get("text-font"),h=o.get("text-field"),u=o.get("icon-image"),c=("constant"!==h.value.kind||h.value.value instanceof tY&&!h.value.value.isEmpty()||h.value.value.toString().length>0)&&("constant"!==l.value.kind||l.value.value.length>0),d="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!c&&!d)return;let f=r.iconDependencies,m=r.glyphDependencies,_=r.availableImages,g=new aX(this.zoom);for(let{feature:r,id:h,index:u,sourceLayerIndex:y}of i){let i,x,v=s._featureFilter.needGeometry,b=sz(r,v);if(!s._featureFilter.filter(g,b,a))continue;if(v||(b.geometry=sD(r)),c){let t=s.getValueAndResolveTokens("text-field",b,a,_),r=tY.factory(t);this.hasRTLText||(this.hasRTLText=function(t){for(let i of t.sections)if(function(t){for(let i of t)if(aW(i.codePointAt(0)))return!0;return!1}(i.text))return!0;return!1}(r)),(!this.hasRTLText||"unavailable"===aH.getRTLTextPluginStatus()||this.hasRTLText&&aH.isParsed())&&(i=function(t,i,r){for(let a of t.sections)a.text=function(t,i,r){let a=i.layout.get("text-transform").evaluate(r,{});return"uppercase"===a?t=t.toLocaleUpperCase():"lowercase"===a&&(t=t.toLocaleLowerCase()),aH.applyArabicShaping&&(t=aH.applyArabicShaping(t)),t}(a.text,i,r);return t}(r,s,b))}if(d){let t=s.getValueAndResolveTokens("icon-image",b,a,_);x=t instanceof t3?t:t3.fromString(t)}if(!i&&!x)continue;let w=this.sortFeaturesByKey?p.evaluate(b,{},a):void 0;if(this.features.push({id:h,text:i,icon:x,index:u,sourceLayerIndex:y,geometry:b.geometry,properties:r.properties,type:oV.types[r.type],sortKey:w}),x&&(f[x.name]=!0),i){let r=l.evaluate(b,{},a).join(","),s="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");for(let a of(this.allowVerticalPlacement=null==(n=this.writingModes)?void 0:n.includes(t.ax.vertical),i.sections))if(a.image)f[a.image.name]=!0;else{let t=aU(i.toString()),n=a.fontStack||r;m[n]||(m[n]={}),this.calculateGlyphDependencies(a.text,m[n],s,this.allowVerticalPlacement,t)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){let i={},r={},a=[],n=0;function s(i){a.push(t[i]),n++}function o(t,i,n){let s=r[t];return delete r[t],r[i]=s,a[s].geometry[0].pop(),a[s].geometry[0]=a[s].geometry[0].concat(n[0]),s}function l(t,r,n){let s=i[r];return delete i[r],i[t]=s,a[s].geometry[0].shift(),a[s].geometry[0]=n[0].concat(a[s].geometry[0]),s}function h(t,i,r){let a=r?i[0][i[0].length-1]:i[0][0];return`${t}:${a.x}:${a.y}`}for(let u=0;u<t.length;u++){let c=t[u],d=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}let f=h(p,d),m=h(p,d,!0);if(f in r&&m in i&&r[f]!==i[m]){let t=l(f,m,d),n=o(f,m,a[t].geometry);delete i[f],delete r[m],r[h(p,a[n].geometry,!0)]=n,a[t].geometry=null}else f in r?o(f,m,d):m in i?l(f,m,d):(s(u),i[f]=n-1,r[m]=n-1)}return a.filter(t=>t.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((t,i)=>t.sortKey-i.sortKey)}update(t,i,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,i,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,i,this.layers,{imagePositions:r}))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,i){let r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(i[t.segment+1]),a=t.dist(i[t.segment]),n={};for(let a=t.segment+1;a<i.length;a++)n[a]={x:i[a].x,y:i[a].y,tileUnitDistanceFromAnchor:r}
2,a<i.length-1&&(r+=i[a+1].dist(i[a]));for(let r=t.segment||0;r>=0;r--)n[r]={x:i[r].x,y:i[r].y,tileUnitDistanceFromAnchor:a},r>0&&(a+=i[r-1].dist(i[r]));for(let t=0;t<i.length;t++){let i=n[t];this.lineVertexArray.emplaceBack(i.x,i.y,i.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(i,r,a,n,s,o,l,h,u,c,d,p){let f=i.indexArray,m=i.layoutVertexArray,_=i.segments.prepareSegment(4*r.length,m,f,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,y=_.vertexLength,x=this.allowVerticalPlacement&&l===t.ax.vertical?Math.PI/2:0,v=o.text&&o.text.sections;for(let t=0;t<r.length;t++){let{tl:n,tr:s,bl:l,br:u,tex:c,pixelOffsetTL:d,pixelOffsetBR:g,minFontScaleX:y,minFontScaleY:b,glyphOffset:w,isSDF:T,sectionIndex:S}=r[t],P=_.vertexLength,M=w[1];hc(m,h.x,h.y,n.x,M+n.y,c.x,c.y,a,T,d.x,d.y,y,b),hc(m,h.x,h.y,s.x,M+s.y,c.x+c.w,c.y,a,T,g.x,d.y,y,b),hc(m,h.x,h.y,l.x,M+l.y,c.x,c.y+c.h,a,T,d.x,g.y,y,b),hc(m,h.x,h.y,u.x,M+u.y,c.x+c.w,c.y+c.h,a,T,g.x,g.y,y,b),hd(i.dynamicLayoutVertexArray,h,x),f.emplaceBack(P,P+2,P+1),f.emplaceBack(P+1,P+2,P+3),_.vertexLength+=4,_.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(w[0]),t!==r.length-1&&S===r[t+1].sectionIndex||i.programConfigurations.populatePaintArrays(m.length,o,o.index,{imagePositions:{},canonical:p,formattedSection:null==v?void 0:v[S]})}i.placedSymbolArray.emplaceBack(h.x,h.y,g,this.glyphOffsetArray.length-g,y,u,c,h.segment,a?a[0]:0,a?a[1]:0,n[0],n[1],l,0,!1,0,d)}_addCollisionDebugVertex(t,i,r,a,n,s){return i.emplaceBack(0,0),t.emplaceBack(r.x,r.y,a,n,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(t,i,r,a,n,s,o){let l=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),h=l.vertexLength,u=n.layoutVertexArray,c=n.collisionVertexArray,d=o.anchorX,p=o.anchorY;this._addCollisionDebugVertex(u,c,s,d,p,new w(t,i)),this._addCollisionDebugVertex(u,c,s,d,p,new w(r,i)),this._addCollisionDebugVertex(u,c,s,d,p,new w(r,a)),this._addCollisionDebugVertex(u,c,s,d,p,new w(t,a)),l.vertexLength+=4;let f=n.indexArray;f.emplaceBack(h,h+1),f.emplaceBack(h+1,h+2),f.emplaceBack(h+2,h+3),f.emplaceBack(h+3,h),l.primitiveLength+=4}addDebugCollisionBoxes(t,i,r,a){for(let n=t;n<i;n++){let t=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,a?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new hf(n6,lj.members,n7),this.iconCollisionBox=new hf(n6,lj.members,n7);for(let t=0;t<this.symbolInstances.length;t++){let i=this.symbolInstances.get(t);this.addDebugCollisionBoxes(i.textBoxStartIndex,i.textBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.iconBoxStartIndex,i.iconBoxEndIndex,i,!1),this.addDebugCollisionBoxes(i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i,!1)}}_deserializeCollisionBoxesForSymbol(t,i,r,a,n,s,o,l,h){let u={};for(let a=i;a<r;a++){let i=t.get(a);u.textBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},u.textFeatureIndex=i.featureIndex;break}for(let i=a;i<n;i++){let r=t.get(i);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let i=s;i<o;i++){let r=t.get(i);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let i=l;i<h;i++){let r=t.get(i);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){let r=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,i){let r=t.placedSymbolArray.get(i),a=r.vertexStartIndex+4*r.numGlyphs;for(let i=r.vertexStartIndex;i<a;
2i+=4)t.indexArray.emplaceBack(i,i+2,i+1),t.indexArray.emplaceBack(i+1,i+2,i+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let i=Math.sin(t),r=Math.cos(t),a=[],n=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);let o=this.symbolInstances.get(t);a.push(0|Math.round(i*o.anchorX+r*o.anchorY)),n.push(o.featureIndex)}return s.sort((t,i)=>a[t]-a[i]||n[i]-n[t]),s}addToSortKeyRanges(t,i){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];(null==r?void 0:r.sortKey)===i?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(let i of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let t=this.symbolInstances.get(i);this.featureSortOrder.push(t.featureIndex);let r=[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex];for(let t=0;t<r.length;t++){let i=r[t];i>=0&&r.indexOf(i)===t&&this.addIndicesForPlacedSymbol(this.text,i)}t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}ak("SymbolBucket",hm,{omit:["layers","collisionBoxArray","features","compareText"]}),hm.MAX_GLYPHS=65535,hm.addDynamicAttributes=hd;var h_={get paint(){return x=x||new nt({"icon-opacity":new a8(e0.paint_symbol["icon-opacity"]),"icon-color":new a8(e0.paint_symbol["icon-color"]),"icon-halo-color":new a8(e0.paint_symbol["icon-halo-color"]),"icon-halo-width":new a8(e0.paint_symbol["icon-halo-width"]),"icon-halo-blur":new a8(e0.paint_symbol["icon-halo-blur"]),"icon-translate":new a4(e0.paint_symbol["icon-translate"]),"icon-translate-anchor":new a4(e0.paint_symbol["icon-translate-anchor"]),"text-opacity":new a8(e0.paint_symbol["text-opacity"]),"text-color":new a8(e0.paint_symbol["text-color"],{runtimeType:to,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new a8(e0.paint_symbol["text-halo-color"]),"text-halo-width":new a8(e0.paint_symbol["text-halo-width"]),"text-halo-blur":new a8(e0.paint_symbol["text-halo-blur"]),"text-translate":new a4(e0.paint_symbol["text-translate"]),"text-translate-anchor":new a4(e0.paint_symbol["text-translate-anchor"])})},get layout(){return y=y||new nt({"symbol-placement":new a4(e0.layout_symbol["symbol-placement"]),"symbol-spacing":new a4(e0.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new a4(e0.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new a8(e0.layout_symbol["symbol-sort-key"]),"symbol-z-order":new a4(e0.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new a4(e0.layout_symbol["icon-allow-overlap"]),"icon-overlap":new a4(e0.layout_symbol["icon-overlap"]),"icon-ignore-placement":new a4(e0.layout_symbol["icon-ignore-placement"]),"icon-optional":new a4(e0.layout_symbol["icon-optional"]),"icon-rotation-alignment":new a4(e0.layout_symbol["icon-rotation-alignment"]),"icon-size":new a8(e0.layout_symbol["icon-size"]),"icon-text-fit":new a4(e0.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new a4(e0.layout_symbol["icon-text-fit-padding"]),"icon-image":new a8(e0.layout_symbol["icon-image"]),"icon-rotate":new a8(e0.layout_symbol["icon-rotate"]),"icon-padding":new a8(e0.layout_symbol["icon-padding"]),"icon-keep-upright":new a4(e0.layout_symbol["icon-keep-upright"]),"icon-offset":new a8(e0.layout_symbol["icon-offset"]),"icon-anchor":new a8(e0.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new a4(e0.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new a4(e0.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new a4(e0.layout_symbol["text-rotation-alignment"]),"text-field":new a8(e0.layout_symbol["text-field"]),"text-font":new a8(e0.layout_symbol["text-font"]),"text-size":new a8(e0.layout_symbol["text-size"]),"text-max-width":new a8(e0.layout_symbol["text-max-width"]),"text-line-height":new a4(e0.layout_symbol["text-line-height"]),"text-letter-spacing":new a8(e0.layout_symbol["text-letter-spacing"]),"text-justify":new a8(e0.layout_symbol["text-justify"]),"text-radial-offset":new a8(e0.layout_symbol["text-radial-offset"]),"text-variable-anchor":new a4(e0.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new a8(e0.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new a8(e0.layout_symbol["text-anchor"]),"text-max-angle":new a4(e0.layout_symbol["text-max-angle"]),"text-writing-mode":new a4(e0.layout_symbol["text-writing-mode"]),"text-rotate":new a8(e0.layout_symbol["text-rotate"]),"text-padding":new a4(e0.layout_symbol["text-padding"]),"text-keep-upright":new a4(e0.layout_symbol["text-keep-upright"]),"text-transform":new a8(e0.layout_symbol["text-transform"]),"text-offset":new a8(e0.layout_symbol["text-offset"]),"text-allow-overlap":new a4(e0.layout_symbol["text-allow-overlap"]),"text-overlap":new a4(e0.layout_symbol["text-overlap"]),"text-ignore-placement":new a4(e0.layout_symbol["text-ignore-placement"]),"text-optional":new a4(e0.layout_symbol["text-optional"])})}};class hg{constructor(t){if(void 0===t.property.overrides)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:tr,this.defaultValue=t}evaluate(t){if(t.formattedSection){let i=this.defaultValue.property.overrides;if(null==i?void 0:i.hasOverride(t.formattedSection))return i.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ak("FormatSectionOverride",hg,{omit:["defaultValue"]});class hy extends na{constructor(t,i){super(t,h_,i)}recalculate(t,i){if(super.recalculate(t,i),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){let t=this.layout.get("text-writing-mode");if(t){let i=[];for(let r of t)i.includes(r)||i.push(r);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,i,r,a){var n;let s=this.layout.get(t).evaluate(i,{},r,a),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||rN(o.value)||!s?s:(n=i.properties,s.replace(/{([^{}]+)}/g,(t,i)=>n&&i in n?String(n[i]):""))}createBucket(t){return new hm(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of h_.paint.overridableProperties){if(!hy.hasPaintOverride(this.layout,t))continue;let i=this.paint.get(t),r=new rj(new hg(i),i.property.specification),a=null;a="constant"===i.value.kind||"source"===i.value.kind?new rG("source",r):new r$("composite",r,i.value.zoomStops),this.paint._values[t]=new a5(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&hy.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){let r=t.get("text-field"),a=h_.paint.properties[i],n=!1,s=t=>{var i;for(let r of t)if(null==(i=a.overrides)?void 0:i.hasOverride(r))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof tY)s(r.value.value.sections);else if("source"===r.value.kind||"composite"===r.value.kind){let t=i=>{n||(i instanceof t9&&t8(i.value)===td?s(i.value.sections):i instanceof iN?s(i.sections):i.eachChild(t))},i=r.value;i._styleExpression&&t(i._styleExpression.expression)}return n}}var hx={get paint(){return v=v||new nt({"background-color":new a4(e0.paint_background["background-color"]),"background-pattern":new a9(e0.paint_background["background-pattern"]),"background-opacity":new a4(e0.paint_background["background-opacity"])})}};class hv extends na{constructor(t,i){super(t,hx,i)}}class hb extends na{constructor(t,i){super(t,{},i),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}}class hw{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var t;this._triggered||(this._triggered=!0,null==(t=this._channel)||t.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let hT={once:!0};class hS{constructor(t,i){if(isNaN(t)||isNaN(i))throw Error(`Invalid LngLat object: (${t}, ${i})`);
2if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new hS(ex(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let i=Math.PI/180,r=this.lat*i,a=t.lat*i;return 6371008.8*Math.acos(Math.min(Math.sin(r)*Math.sin(a)+Math.cos(r)*Math.cos(a)*Math.cos((t.lng-this.lng)*i),1))}static convert(t){if(t instanceof hS)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new hS(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new hS(Number("lng"in t?t.lng:t.lon),Number(t.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 hP=2*Math.PI*6371008.8;function hM(t){return hP*Math.cos(t*Math.PI/180)}function hI(t){return(180+t)/360}function hE(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function hC(t){return 360*t-180}function hA(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function hD(t,i){return t*hM(hA(i))}class hz{constructor(t,i,r=0){this.x=+t,this.y=+i,this.z=+r}static fromLngLat(t,i=0){let r=hS.convert(t);return new hz(hI(r.lng),hE(r.lat),i/hM(r.lat))}toLngLat(){return new hS(hC(this.x),hA(this.y))}toAltitude(){return hD(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/hP*(1/Math.cos(hA(this.y)*Math.PI/180))}}function hk(t,i,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[t*a-2*Math.PI*6378137/2,i*a-2*Math.PI*6378137/2]}class hR{constructor(t,i,r){if(!function(t,i,r){return!(t<0||t>25||r<0||r>=Math.pow(2,t)||i<0||i>=Math.pow(2,t))}(t,i,r))throw Error(`x=${i}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=i,this.y=r,this.key=hB(0,t,t,i,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,i,r){var a,n,s,o,l;let h=(n=this.y,s=this.z,o=hk(256*(a=this.x),256*(n=Math.pow(2,s)-n-1),s),l=hk(256*(a+1),256*(n+1),s),o[0]+","+o[1]+","+l[0]+","+l[1]),u=function(t,i,r){let a="";for(let n=t;n>0;n--){let t=1<<n-1;a+=(i&t?1:0)+(r&t?2:0)}return a}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,h)}isChildOf(t){let i=this.z-t.z;return i>0&&t.x===this.x>>i&&t.y===this.y>>i}getTilePoint(t){let i=Math.pow(2,this.z);return new w((t.x*i-this.x)*8192,(t.y*i-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}}class hL{constructor(t,i){this.wrap=t,this.canonical=i,this.key=hB(t,i.z,i.z,i.x,i.y)}}class hF{constructor(t,i,r,a,n){if(this.terrainRttPosMatrix32f=null,t<r)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=i,this.canonical=new hR(r,+a,+n),this.key=hB(i,t,r,a,n)}clone(){return new hF(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?new hF(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new hF(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,i){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?hB(this.wrap*i,t,this.canonical.z,this.canonical.x,this.canonical.y):hB(this.wrap*i,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;
2if(0===t.overscaledZ)return this.overscaledZ>0;let i=this.canonical.z-t.canonical.z;return!(i<0)&&t.canonical.x===this.canonical.x>>i&&t.canonical.y===this.canonical.y>>i}children(t){if(this.overscaledZ>=t)return[new hF(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=2*this.canonical.x,a=2*this.canonical.y;return[new hF(i,this.wrap,i,r,a),new hF(i,this.wrap,i,r+1,a),new hF(i,this.wrap,i,r,a+1),new hF(i,this.wrap,i,r+1,a+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new hF(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new hF(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new hL(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new hz(t.x-this.wrap,t.y))}normalizeCoordinates(t,i,r=8192){if(t>=0&&t<r&&i>=0&&i<r)return{tileID:this,x:t,y:i};let a=Math.floor(t/r),n=Math.floor(i/r),s=this.canonical.z,o=1<<s,l=this.canonical.y+n;if(l<0||l>=o)return null;let h=this.canonical.x+a,u=this.wrap;return h<0?(u-=Math.ceil(-h/o),h=(h%o+o)%o):h>=o&&(u+=Math.floor(h/o),h%=o),{tileID:new hF(this.overscaledZ,u,s,h,l),x:t-a*r,y:i-n*r}}}function hB(t,i,r,a,n){(t*=2)<0&&(t=-1*t-1);let s=1<<r;return(s*s*t+s*n+a).toString(36)+r.toString(36)+i.toString(36)}ak("CanonicalTileID",hR),ak("OverscaledTileID",hF,{omit:["terrainRttPosMatrix32f"]});class hO{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){let i=new hO;return i.extend(t(new w(this.minX,this.minY))),i.extend(t(new w(this.maxX,this.minY))),i.extend(t(new w(this.minX,this.maxY))),i.extend(t(new w(this.maxX,this.maxY))),i}static fromPoints(t){let i=new hO;for(let r of t)i.extend(r);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class hV{constructor(t){this._stringToNumber={},this._numberToString=[];for(let i=0;i<t.length;i++){const r=t[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class hj{constructor(t,i,r,a,n){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=a,this._z=i,this.properties=t.properties,this.id=n}projectPoint(t,i,r,a){return[360*(t.x+i)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+r)/a)*Math.PI))-90]}projectLine(t,i,r,a){return t.map(t=>this.projectPoint(t,i,r,a))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,i=t.extent*Math.pow(2,this._z),r=t.extent*this._x,a=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let t=[];for(let i of n)t.push(i[0]);let s=this.projectLine(t,r,a,i);this._geometry=1===t.length?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let t=n.map(t=>this.projectLine(t,r,a,i));this._geometry=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t};break}
2case 3:{let t=oN(n),s=[];for(let n of t)s.push(n.map(t=>this.projectLine(t,r,a,i)));this._geometry=1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let i in this)"_geometry"!==i&&"_vectorTileFeature"!==i&&"_x"!==i&&"_y"!==i&&"_z"!==i&&(t[i]=this[i]);return t}}class hN{constructor(t,i,r){this._name=t,this.dataBuffer=i,"number"==typeof r?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class hU extends hN{}class hG extends hU{getValueFromBuffer(t){return this.dataBuffer[t]}}class h$ extends hU{getValueFromBuffer(t){return this.dataBuffer[t]}}class hZ extends hN{constructor(t,i,r,a){super(t,i,a),this.delta=r}}class hq extends hZ{constructor(t,i,r,a){super(t,Int32Array.of(i),r,a)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}}class hW extends hN{constructor(t,i,r,a){super(t,a?Int32Array.of(i):Uint32Array.of(i),r)}getValueFromBuffer(t){return this.dataBuffer[0]}}class hH{constructor(t,i,r,a,n=4096){this._name=t,this._geometryVector=i,this._idVector=r,this._propertyVectors=a,this._extent=n}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],i=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let a;if(this.idVector){let t=this.idVector.getValue(r);a=this.containsMaxSafeIntegerValues(this.idVector)&&null!==t?Number(t):t}let n={coordinates:i[r],type:this.geometryVector.geometryType(r)},s={};for(let t of this.propertyVectors){if(!t)continue;let i=t.name,a=t.getValue(r);null!==a&&(s[i]=a)}t.push({id:a,geometry:n,properties:s})}return t}containsMaxSafeIntegerValues(t){return t instanceof hG||t instanceof hW||t instanceof hq||t instanceof h$}}class hX{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}}(P=B||(B={})).NONE="NONE",P.DELTA="DELTA",P.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",P.RLE="RLE",P.MORTON="MORTON",P.PDE="PDE",(M=O||(O={})).NONE="NONE",M.FAST_PFOR="FAST_PFOR",M.VARINT="VARINT",M.ALP="ALP";let hY=new Uint32Array(33);hY[0]=0;for(let t=1;t<=32;t++)hY[t]=32===t?0xffffffff:0xffffffff>>>32-t;let hK=function(){var t;if(!Number.isFinite(65536))return 65536;let i=(t=Math.floor(65536))-t%256;return 0===i?256:i}(),hJ=3*hK/256+hK|0;function hQ(){let t=new Uint8Array(hJ);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function h0(t,i,r){let a=new Uint32Array(r),n=0,s=i.get();for(let i=0;i<a.length;i++){let i=t[s++],r=127&i;i<128||(r|=(127&(i=t[s++]))<<7,i<128||(r|=(127&(i=t[s++]))<<14,i<128||(r|=(127&(i=t[s++]))<<21,i<128||(r|=(15&(i=t[s++]))<<28)))),a[n++]=r}return i.set(s),a}function h1(t,i,r){let a=new BigUint64Array(r);for(let r=0;r<a.length;r++)a[r]=function(t,i){let r=0n,a=0,n=i.get();for(;n<t.length;){let i=t[n++];if(r|=BigInt(127&i)<<BigInt(a),!(128&i))break;if((a+=7)>=64)throw Error("Varint too long")}return i.set(n),r}(t,i);return a}function h2(t){return t>>>1^-(1&t)}function h3(t){return t>>1n^-(1n&t)}function h5(t){return t%2==1?-((t+1)/2):t/2}function h6(t,i,r){if(void 0===r){r=0;for(let a=0;a<i;a++)r+=t[a]}let a=new Uint32Array(r),n=0;for(let r=0;r<i;r++){let s=t[r];a.fill(t[r+i],n,n+s),n+=s}return a}function h4(t,i,r){if(void 0===r){r=0;for(let a=0;a<i;a++)r+=Number(t[a])}let a=new BigUint64Array(r),n=0;for(let r=0;r<i;r++){let s=Number(t[r]);a.fill(t[r+i],n,n+s),n+=s}return a}function h8(t,i,r){let a=new Float64Array(r),n=0;for(let r=0;r<i;r++){let s=t[r];a.fill(t[r+i],n,n+s),n+=s}return a}function h7(t){let i=new Int32Array(t.length);i[0]=h2(t[0]);let r=t.length/4*4,a=1;if(r>=4)for(;a<r-4;a+=4){let r=t[a+1],n=t[a+2],s=t[a+3];
2i[a]=h2(t[a])+i[a-1],i[a+1]=h2(r)+i[a],i[a+2]=h2(n)+i[a+1],i[a+3]=h2(s)+i[a+2]}for(;a!==t.length;++a)i[a]=h2(t[a])+i[a-1];return i}function h9(t){let i=new BigInt64Array(t.length);i[0]=h3(t[0]);let r=t.length/4*4,a=1;if(r>=4)for(;a<r-4;a+=4){let r=t[a+1],n=t[a+2],s=t[a+3];i[a]=h3(t[a])+i[a-1],i[a+1]=h3(r)+i[a],i[a+2]=h3(n)+i[a+1],i[a+3]=h3(s)+i[a+2]}for(;a!==i.length;++a)i[a]=h3(t[a])+i[a-1];return i}function ue(t){let i=t.length/4*4,r=1;if(i>=4)for(let a=t[0];r<i-4;r+=4)a=t[r]+=a,a=t[r+1]+=a,a=t[r+2]+=a,a=t[r+3]+=a;for(;r!==t.length;)t[r]+=t[r-1],++r}function ut(t,i){let r,a,n=function(t,i){let r=t[i.get()],a=Object.values(V)[r>>4],n=null;switch(a){case V.DATA:n={dictionaryType:Object.values(j)[15&r]};break;case V.OFFSET:n={offsetType:Object.values(N)[15&r]};break;case V.LENGTH:n={lengthType:Object.values(U)[15&r]}}i.increment();let s=t[i.get()],o=Object.values(B)[s>>5],l=Object.values(B)[s>>2&7],h=Object.values(O)[3&s];i.increment();let u=h0(t,i,2),c=u[0];return{physicalStreamType:a,logicalStreamType:n,logicalLevelTechnique1:o,logicalLevelTechnique2:l,physicalLevelTechnique:h,numValues:c,byteLength:u[1],decompressedCount:c}}(t,i);return n.logicalLevelTechnique1===B.MORTON?(r=h0(t,i,2),{physicalStreamType:n.physicalStreamType,logicalStreamType:n.logicalStreamType,logicalLevelTechnique1:n.logicalLevelTechnique1,logicalLevelTechnique2:n.logicalLevelTechnique2,physicalLevelTechnique:n.physicalLevelTechnique,numValues:n.numValues,byteLength:n.byteLength,decompressedCount:n.decompressedCount,numBits:r[0],coordinateShift:r[1]}):B.RLE!==n.logicalLevelTechnique1&&B.RLE!==n.logicalLevelTechnique2||O.NONE===n.physicalLevelTechnique?n:(a=h0(t,i,2),{physicalStreamType:n.physicalStreamType,logicalStreamType:n.logicalStreamType,logicalLevelTechnique1:n.logicalLevelTechnique1,logicalLevelTechnique2:n.logicalLevelTechnique2,physicalLevelTechnique:n.physicalLevelTechnique,numValues:n.numValues,byteLength:n.byteLength,decompressedCount:a[1],runs:a[0],numRleValues:a[1]})}(I=V||(V={})).PRESENT="PRESENT",I.DATA="DATA",I.OFFSET="OFFSET",I.LENGTH="LENGTH",(E=j||(j={})).NONE="NONE",E.SINGLE="SINGLE",E.SHARED="SHARED",E.VERTEX="VERTEX",E.MORTON="MORTON",E.FSST="FSST",(C=N||(N={})).VERTEX="VERTEX",C.INDEX="INDEX",C.STRING="STRING",C.KEY="KEY",(A=U||(U={})).VAR_BINARY="VAR_BINARY",A.GEOMETRIES="GEOMETRIES",A.PARTS="PARTS",A.RINGS="RINGS",A.TRIANGLES="TRIANGLES",A.SYMBOL="SYMBOL",A.DICTIONARY="DICTIONARY",(D=G||(G={}))[D.FLAT=0]="FLAT",D[D.CONST=1]="CONST",D[D.SEQUENCE=2]="SEQUENCE",D[D.DICTIONARY=3]="DICTIONARY",D[D.FSST_DICTIONARY=4]="FSST_DICTIONARY";class ui{constructor(t,i){this.values=t,this._size=i}get(t){let i=Math.floor(t/8);return 1==(this.values[i]>>t%8&1)}set(t,i){let r=Math.floor(t/8);this.values[r]=this.values[r]|!!i<<t%8}getInt(t){let i=Math.floor(t/8);return this.values[i]>>t%8&1}size(){return this._size}getBuffer(){return this.values}}function ur(t,i,r){if(!i)return t;let a=i.size(),n=new(0,t.constructor)(a),s=0;for(let o=0;o<a;o++)n[o]=i.get(o)?t[s++]:r;return n}function ua(t,i,r,a,n){let s;var o=uo(t,i,r);switch(r.logicalLevelTechnique1){case B.DELTA:if(r.logicalLevelTechnique2===B.RLE){if(!n)return function(t,i,r){let a=new Int32Array(r),n=0,s=0;for(let r=0;r<i;r++){let o=t[r],l=h2(t[r+i]);for(let t=0;t<o;t++)s+=l,a[n++]=s}return a}(o,r.runs,r.numRleValues);s=h7(o=h6(o,r.runs,r.numRleValues))}else s=h7(o);break;case B.RLE:s=function(t,i,r){if(void 0===r){r=0;for(let a=0;a<i;a++)r+=t[a]}let a=new Int32Array(r),n=0;for(let r=0;r<i;r++){let s=t[r],o=t[r+i];o=h2(o),a.fill(o,n,n+s),n+=s}return a}(o,r.runs,r.numRleValues);break;case B.MORTON:ue(o),s=new Int32Array(o);break;case B.COMPONENTWISE_DELTA:s=function(t){if(t.length<2)return new Int32Array(t);let i=new Int32Array(t.length);i[0]=h2(t[0]),i[1]=h2(t[1]);let r=t.length/4*4,a=2;if(r>=4)for(;a<r-4;a+=4){let r=t[a+1],n=t[a+2],s=t[a+3];i[a]=h2(t[a])+i[a-2],i[a+1]=h2(r)+i[a-1],i[a+2]=h2(n)+i[a],i[a+3]=h2(s)+i[a+1]}for(;a!==t.length;a+=2)i[a]=h2(t[a])+i[a-2],i[a+1]=h2(t[a+1])+i[a-1];return i}(o);break;case B.NONE:s=function(t){let i=new Int32Array(t.length);for(let r=0;r<t.length;r++)i[r]=h2(t[r]);return i}(o);break;default:throw Error(`The specified Logical level technique is not supported: ${r.logicalLevelTechnique1}`)}return n?ur(s,n,0):s}function un(t,i,r,a,n){let s;var o=uo(t,i,r);
2switch(r.logicalLevelTechnique1){case B.DELTA:s=function(t){let i=new Uint32Array(t.length);i[0]=h2(t[0])>>>0;for(let r=1;r<t.length;r++)i[r]=i[r-1]+h2(t[r])>>>0;return i}(r.logicalLevelTechnique2===B.RLE?h6(o,r.runs,r.numRleValues):o);break;case B.RLE:s=h6(o,r.runs,r.numRleValues);break;case B.MORTON:ue(o),s=o;break;case B.COMPONENTWISE_DELTA:s=function(t){if(t.length<2)return new Uint32Array(t);let i=new Uint32Array(t.length);i[0]=h2(t[0])>>>0,i[1]=h2(t[1])>>>0;for(let r=2;r<t.length;r+=2)i[r]=i[r-2]+h2(t[r])>>>0,i[r+1]=i[r-1]+h2(t[r+1])>>>0;return i}(o);break;case B.NONE:s=o;break;default:throw Error(`The specified Logical level technique is not supported: ${r.logicalLevelTechnique1}`)}return n?ur(s,n,0):s}function us(t,i,r){return function(t,i){if(i.logicalLevelTechnique1===B.DELTA&&i.logicalLevelTechnique2===B.NONE){let i=new Int32Array(t.length+1);i[0]=0,i[1]=h2(t[0]);let r=i[1];for(let a=2;a!==i.length;++a)r+=h2(t[a-1]),i[a]=i[a-1]+r;return new Uint32Array(i)}if(i.logicalLevelTechnique1===B.RLE&&i.logicalLevelTechnique2===B.NONE)return function(t,i,r){let a=new Uint32Array(r+1);a[0]=0;let n=1,s=a[0];for(let r=0;r<i;r++){let o=t[r],l=t[r+i];for(let t=n;t<n+o;t++)a[t]=l+s,s=a[t];n+=o}return a}(t,i.runs,i.numRleValues);if(i.logicalLevelTechnique1===B.NONE&&i.logicalLevelTechnique2===B.NONE){let r=0;for(let i=0;i<t.length;i++)t[i]+=r,r=t[i];let a=new Uint32Array(i.numValues+1);return a[0]=0,a.set(t,1),a}if(i.logicalLevelTechnique1===B.DELTA&&i.logicalLevelTechnique2===B.RLE){let r=function(t,i,r){let a=new Int32Array(r+1);a[0]=0;let n=1,s=a[0];for(let r=0;r<i;r++){let o=t[r],l=t[r+i];l=h2(l);for(let t=n;t<n+o;t++)a[t]=l+s,s=a[t];n+=o}return a}(t,i.runs,i.numRleValues);return ue(r),new Uint32Array(r)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}(uo(t,i,r),r)}function uo(t,i,r){let a=r.physicalLevelTechnique;switch(a){case O.FAST_PFOR:var n,s;return n=r.numValues,function(t,i,r,a,n){let s=a.get();if(3&r)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${s} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let o=r>>>2,l=function(t,i){if(i<=t.encodedWords.length)return t.encodedWords;let r=new Uint32Array(Math.max(16,2*i));return t.encodedWords=r,r}(n,o);!function(t,i,r,a){if(i<0||r<0||i+r>t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${i}, byteLength=${r}, bytes.length=${t.length})`);let n=Math.floor(r/4),s=r%4!=0,o=s?n+1:n;if(a.length<o)throw RangeError(`decodeBigEndianInt32sInto: out.length=${a.length} < ${o}`);if(n>0){let r=t.byteOffset+i;if(3&r)for(let r=0;r<n;r++){let n=i+4*r;a[r]=t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]}else{let i=new Uint32Array(t.buffer,r,n);for(let t=0;t<n;t++)a[t]=0|function(t){let i=t>>>0;return((255&i)<<24|(65280&i)<<8|i>>>8&65280|i>>>24&255)>>>0}(i[t])}}if(s){let s=i+4*n,o=r-4*n,l=0;for(let i=0;i<o;i++)l|=t[s+i]<<24-8*i;a[n]=0|l}}(t,s,r,l);let h=function(t,i,r){let a=0,n=0,s=new Uint32Array(i),o=r??hQ();if(t.length>0){let i=0|t[a];if(a=a+1|0,255&i)throw Error(`FastPFOR decode: invalid alignedLength=${i} (expected multiple of 256)`);if(n+i>s.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${i}, out.length=${s.length})`);a=function(t,i,r,a,n,s){let o=a+(n-n%256),l=a,h=r;for(;l!==o;){let r=Math.min(hK,o-l);h=function(t,i,r,a,n,s){let o=0|r,l=0|t[o];if(l<=0||o+l>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${l} at pageStart=${o} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let h=o+l|0,u=t[h]>>>0,c=u+3>>>2,d=h+1,p=d+c;if(p>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${u} (metaInts=${c}, pageStart=${o}, packedEnd=${h}, byteContainerStart=${d}) causes bitmapPos=${p} out of bounds (encoded.length=${t.length})`);let f=function(t,i,r,a){a.byteContainer.length<r&&(a.byteContainer=new Uint8Array(2*r),a.byteContainerI32=void 0);let n=a.byteContainer,s=r>>>2;if(3&n.byteOffset)for(let r=0;r<s;r=r+1|0){let a=0|t[i+r|0],s=r<<2;n[s]=255&a,n[s+1|0]=a>>>8&255,n[s+2|0]=a>>>16&255,n[s+3|0]=a>>>24&255}else{let r=a.byteContainerI32;(!r||r.buffer!==n.buffer||r.byteOffset!==n.byteOffset||r.length<s)&&(r=a.byteContainerI32=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>>2)),r.set(t.subarray(i,i+s))}let o=3&r;if(o>0){let r=0|t[i+s|0],a=s<<2;for(let t=0;t<o;t=t+1|0)n[a+t|0]=r>>>(t<<3)&255}return n}(t,d,u,s),m=function(t,i,r){let a=0|t[i++],n=r.dataToBePacked;for(let o=2;o<=32;o=o+1|0){var s;if(!(a>>>o-1&1))continue;if(i>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${o}, streamWordIndex=${i}, needWords=1, availableWords=${t.length-i}, encodedWords=${t.length})`);let l=t[i++]>>>0,h=(s=l+31)-s%32,u=l*o+31>>>5;if(i+u>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${o}, size=${l}, streamWordIndex=${i}, needWords=${u}, availableWords=${t.length-i}, encodedWords=${t.length})`);let c=n[o];(!c||c.length<h)&&(c=n[o]=new Uint32Array(h));let d=0;for(;d<l;d=d+32|0)(function(t,i,r,a,n){switch(n){case 2:let s,o,l;return s=a,o=t[i]>>>0,l=t[i+1]>>>0,r[s++]=o>>>0&3,r[s++]=o>>>2&3,r[s++]=o>>>4&3,r[s++]=o>>>6&3,r[s++]=o>>>8&3,r[s++]=o>>>10&3,r[s++]=o>>>12&3,r[s++]=o>>>14&3,r[s++]=o>>>16&3,r[s++]=o>>>18&3,r[s++]=o>>>20&3,r[s++]=o>>>22&3,r[s++]=o>>>24&3,r[s++]=o>>>
226&3,r[s++]=o>>>28&3,r[s++]=o>>>30&3,r[s++]=l>>>0&3,r[s++]=l>>>2&3,r[s++]=l>>>4&3,r[s++]=l>>>6&3,r[s++]=l>>>8&3,r[s++]=l>>>10&3,r[s++]=l>>>12&3,r[s++]=l>>>14&3,r[s++]=l>>>16&3,r[s++]=l>>>18&3,r[s++]=l>>>20&3,r[s++]=l>>>22&3,r[s++]=l>>>24&3,r[s++]=l>>>26&3,r[s++]=l>>>28&3,r[s]=l>>>30&3;case 3:let h,u,c,d;return h=a,u=t[i]>>>0,c=t[i+1]>>>0,d=t[i+2]>>>0,r[h++]=u>>>0&7,r[h++]=u>>>3&7,r[h++]=u>>>6&7,r[h++]=u>>>9&7,r[h++]=u>>>12&7,r[h++]=u>>>15&7,r[h++]=u>>>18&7,r[h++]=u>>>21&7,r[h++]=u>>>24&7,r[h++]=u>>>27&7,r[h++]=7&(u>>>30|(1&c)<<2),r[h++]=c>>>1&7,r[h++]=c>>>4&7,r[h++]=c>>>7&7,r[h++]=c>>>10&7,r[h++]=c>>>13&7,r[h++]=c>>>16&7,r[h++]=c>>>19&7,r[h++]=c>>>22&7,r[h++]=c>>>25&7,r[h++]=c>>>28&7,r[h++]=7&(c>>>31|(3&d)<<1),r[h++]=d>>>2&7,r[h++]=d>>>5&7,r[h++]=d>>>8&7,r[h++]=d>>>11&7,r[h++]=d>>>14&7,r[h++]=d>>>17&7,r[h++]=d>>>20&7,r[h++]=d>>>23&7,r[h++]=d>>>26&7,r[h]=d>>>29&7;case 4:let p,f,m,_,g;return p=a,f=t[i]>>>0,m=t[i+1]>>>0,_=t[i+2]>>>0,g=t[i+3]>>>0,r[p++]=f>>>0&15,r[p++]=f>>>4&15,r[p++]=f>>>8&15,r[p++]=f>>>12&15,r[p++]=f>>>16&15,r[p++]=f>>>20&15,r[p++]=f>>>24&15,r[p++]=f>>>28&15,r[p++]=m>>>0&15,r[p++]=m>>>4&15,r[p++]=m>>>8&15,r[p++]=m>>>12&15,r[p++]=m>>>16&15,r[p++]=m>>>20&15,r[p++]=m>>>24&15,r[p++]=m>>>28&15,r[p++]=_>>>0&15,r[p++]=_>>>4&15,r[p++]=_>>>8&15,r[p++]=_>>>12&15,r[p++]=_>>>16&15,r[p++]=_>>>20&15,r[p++]=_>>>24&15,r[p++]=_>>>28&15,r[p++]=g>>>0&15,r[p++]=g>>>4&15,r[p++]=g>>>8&15,r[p++]=g>>>12&15,r[p++]=g>>>16&15,r[p++]=g>>>20&15,r[p++]=g>>>24&15,r[p]=g>>>28&15;case 5:let y,x,v,b,w,T;return y=a,x=t[i]>>>0,v=t[i+1]>>>0,b=t[i+2]>>>0,w=t[i+3]>>>0,T=t[i+4]>>>0,r[y++]=x>>>0&31,r[y++]=x>>>5&31,r[y++]=x>>>10&31,r[y++]=x>>>15&31,r[y++]=x>>>20&31,r[y++]=x>>>25&31,r[y++]=31&(x>>>30|(7&v)<<2),r[y++]=v>>>3&31,r[y++]=v>>>8&31,r[y++]=v>>>13&31,r[y++]=v>>>18&31,r[y++]=v>>>23&31,r[y++]=31&(v>>>28|(1&b)<<4),r[y++]=b>>>1&31,r[y++]=b>>>6&31,r[y++]=b>>>11&31,r[y++]=b>>>16&31,r[y++]=b>>>21&31,r[y++]=b>>>26&31,r[y++]=31&(b>>>31|(15&w)<<1),r[y++]=w>>>4&31,r[y++]=w>>>9&31,r[y++]=w>>>14&31,r[y++]=w>>>19&31,r[y++]=w>>>24&31,r[y++]=31&(w>>>29|(3&T)<<3),r[y++]=T>>>2&31,r[y++]=T>>>7&31,r[y++]=T>>>12&31,r[y++]=T>>>17&31,r[y++]=T>>>22&31,r[y]=T>>>27&31;case 6:let S,P,M,I,E,C,A;return S=a,P=t[i]>>>0,M=t[i+1]>>>0,I=t[i+2]>>>0,E=t[i+3]>>>0,C=t[i+4]>>>0,A=t[i+5]>>>0,r[S++]=P>>>0&63,r[S++]=P>>>6&63,r[S++]=P>>>12&63,r[S++]=P>>>18&63,r[S++]=P>>>24&63,r[S++]=63&(P>>>30|(15&M)<<2),r[S++]=M>>>4&63,r[S++]=M>>>10&63,r[S++]=M>>>16&63,r[S++]=M>>>22&63,r[S++]=63&(M>>>28|(3&I)<<4),r[S++]=I>>>2&63,r[S++]=I>>>8&63,r[S++]=I>>>14&63,r[S++]=I>>>20&63,r[S++]=I>>>26&63,r[S++]=E>>>0&63,r[S++]=E>>>6&63,r[S++]=E>>>12&63,r[S++]=E>>>18&63,r[S++]=E>>>24&63,r[S++]=63&(E>>>30|(15&C)<<2),r[S++]=C>>>4&63,r[S++]=C>>>10&63,r[S++]=C>>>16&63,r[S++]=C>>>22&63,r[S++]=63&(C>>>28|(3&A)<<4),r[S++]=A>>>2&63,r[S++]=A>>>8&63,r[S++]=A>>>14&63,r[S++]=A>>>20&63,r[S]=A>>>26&63;case 7:let D,z,k,R,L,F,B,O;return D=a,z=t[i]>>>0,k=t[i+1]>>>0,R=t[i+2]>>>0,L=t[i+3]>>>0,F=t[i+4]>>>0,B=t[i+5]>>>0,O=t[i+6]>>>0,r[D++]=z>>>0&127,r[D++]=z>>>7&127,r[D++]=z>>>14&127,r[D++]=z>>>21&127,r[D++]=127&(z>>>28|(7&k)<<4),r[D++]=k>>>3&127,r[D++]=k>>>10&127,r[D++]=k>>>17&127,r[D++]=k>>>24&127,r[D++]=127&(k>>>31|(63&R)<<1),r[D++]=R>>>6&127,r[D++]=R>>>13&127,r[D++]=R>>>20&127,r[D++]=127&(R>>>27|(3&L)<<5),r[D++]=L>>>2&127,r[D++]=L>>>9&127,r[D++]=L>>>16&127,r[D++]=L>>>23&127,r[D++]=127&(L>>>30|(31&F)<<2),r[D++]=F>>>5&127,r[D++]=F>>>12&127,r[D++]=F>>>19&127,r[D++]=127&(F>>>26|(1&B)<<6),r[D++]=B>>>1&127,r[D++]=B>>>8&127,r[D++]=B>>>15&127,r[D++]=B>>>22&127,r[D++]=127&(B>>>29|(15&O)<<3),r[D++]=O>>>4&127,r[D++]=O>>>11&127,r[D++]=O>>>18&127,r[D]=O>>>25&127;case 8:let V,j,N,U,G,$,Z,q,W;return V=a,j=t[i]>>>0,N=t[i+1]>>>0,U=t[i+2]>>>0,G=t[i+3]>>>0,$=t[i+4]>>>0,Z=t[i+5]>>>0,q=t[i+6]>>>0,W=t[i+7]>>>0,r[V++]=j>>>0&255,r[V++]=j>>>8&255,r[V++]=j>>>16&255,r[V++]=j>>>24&255,r[V++]=N>>>0&255,r[V++]=N>>>8&255,r[V++]=N>>>16&255,r[V++]=N>>>24&255,r[V++]=U>>>0&255,r[V++]=U>>>8&255,r[V++]=U>>>16&255,r[V++]=U>>>24&255,r[V++]=G>>>0&255,r[V++]=G>>>8&255,r[V++]=G>>>16&255,r[V++]=G>>>24&255,r[V++]=$>>>0&255,r[V++]=$>>>8&255,r[V++]=$>>>16&255,r[V++]=$>>>24&255,r[V++]=Z>>>0&255,r[V++]=Z>>>8&255,r[V++]=Z>>>16&255,r[V++]=Z>>>24&255,r[V++]=q>>>0&255,r[V++]=q>>>8&255,r[V++]=q>>>16&255,r[V++]=q>>>24&255,r[V++]=W>>>0&255,r[V++]=W>>>8&255,r[V++]=W>>>16&255,r[V]=W>>>24&255;case 9:let H,X,Y,K,J,Q,ee,et,ei,er;return H=a,X=t[i]>>>0,Y=t[i+1]>>>0,K=t[i+2]>
2>>0,J=t[i+3]>>>0,Q=t[i+4]>>>0,ee=t[i+5]>>>0,et=t[i+6]>>>0,ei=t[i+7]>>>0,er=t[i+8]>>>0,r[H++]=X>>>0&511,r[H++]=X>>>9&511,r[H++]=X>>>18&511,r[H++]=511&(X>>>27|(15&Y)<<5),r[H++]=Y>>>4&511,r[H++]=Y>>>13&511,r[H++]=Y>>>22&511,r[H++]=511&(Y>>>31|(255&K)<<1),r[H++]=K>>>8&511,r[H++]=K>>>17&511,r[H++]=511&(K>>>26|(7&J)<<6),r[H++]=J>>>3&511,r[H++]=J>>>12&511,r[H++]=J>>>21&511,r[H++]=511&(J>>>30|(127&Q)<<2),r[H++]=Q>>>7&511,r[H++]=Q>>>16&511,r[H++]=511&(Q>>>25|(3&ee)<<7),r[H++]=ee>>>2&511,r[H++]=ee>>>11&511,r[H++]=ee>>>20&511,r[H++]=511&(ee>>>29|(63&et)<<3),r[H++]=et>>>6&511,r[H++]=et>>>15&511,r[H++]=511&(et>>>24|(1&ei)<<8),r[H++]=ei>>>1&511,r[H++]=ei>>>10&511,r[H++]=ei>>>19&511,r[H++]=511&(ei>>>28|(31&er)<<4),r[H++]=er>>>5&511,r[H++]=er>>>14&511,r[H]=er>>>23&511;case 10:let ea,en,es,eo,el,eh,eu,ec,ed,ep,ef;return ea=a,en=t[i]>>>0,es=t[i+1]>>>0,eo=t[i+2]>>>0,el=t[i+3]>>>0,eh=t[i+4]>>>0,eu=t[i+5]>>>0,ec=t[i+6]>>>0,ed=t[i+7]>>>0,ep=t[i+8]>>>0,ef=t[i+9]>>>0,r[ea++]=en>>>0&1023,r[ea++]=en>>>10&1023,r[ea++]=en>>>20&1023,r[ea++]=1023&(en>>>30|(255&es)<<2),r[ea++]=es>>>8&1023,r[ea++]=es>>>18&1023,r[ea++]=1023&(es>>>28|(63&eo)<<4),r[ea++]=eo>>>6&1023,r[ea++]=eo>>>16&1023,r[ea++]=1023&(eo>>>26|(15&el)<<6),r[ea++]=el>>>4&1023,r[ea++]=el>>>14&1023,r[ea++]=1023&(el>>>24|(3&eh)<<8),r[ea++]=eh>>>2&1023,r[ea++]=eh>>>12&1023,r[ea++]=eh>>>22&1023,r[ea++]=eu>>>0&1023,r[ea++]=eu>>>10&1023,r[ea++]=eu>>>20&1023,r[ea++]=1023&(eu>>>30|(255&ec)<<2),r[ea++]=ec>>>8&1023,r[ea++]=ec>>>18&1023,r[ea++]=1023&(ec>>>28|(63&ed)<<4),r[ea++]=ed>>>6&1023,r[ea++]=ed>>>16&1023,r[ea++]=1023&(ed>>>26|(15&ep)<<6),r[ea++]=ep>>>4&1023,r[ea++]=ep>>>14&1023,r[ea++]=1023&(ep>>>24|(3&ef)<<8),r[ea++]=ef>>>2&1023,r[ea++]=ef>>>12&1023,r[ea]=ef>>>22&1023;case 11:let em,e_,eg,ey,ex,ev,eb,ew,eT,eS,eP,eM;return em=a,e_=t[i]>>>0,eg=t[i+1]>>>0,ey=t[i+2]>>>0,ex=t[i+3]>>>0,ev=t[i+4]>>>0,eb=t[i+5]>>>0,ew=t[i+6]>>>0,eT=t[i+7]>>>0,eS=t[i+8]>>>0,eP=t[i+9]>>>0,eM=t[i+10]>>>0,r[em++]=e_>>>0&2047,r[em++]=e_>>>11&2047,r[em++]=2047&(e_>>>22|(1&eg)<<10),r[em++]=eg>>>1&2047,r[em++]=eg>>>12&2047,r[em++]=2047&(eg>>>23|(3&ey)<<9),r[em++]=ey>>>2&2047,r[em++]=ey>>>13&2047,r[em++]=2047&(ey>>>24|(7&ex)<<8),r[em++]=ex>>>3&2047,r[em++]=ex>>>14&2047,r[em++]=2047&(ex>>>25|(15&ev)<<7),r[em++]=ev>>>4&2047,r[em++]=ev>>>15&2047,r[em++]=2047&(ev>>>26|(31&eb)<<6),r[em++]=eb>>>5&2047,r[em++]=eb>>>16&2047,r[em++]=2047&(eb>>>27|(63&ew)<<5),r[em++]=ew>>>6&2047,r[em++]=ew>>>17&2047,r[em++]=2047&(ew>>>28|(127&eT)<<4),r[em++]=eT>>>7&2047,r[em++]=eT>>>18&2047,r[em++]=2047&(eT>>>29|(255&eS)<<3),r[em++]=eS>>>8&2047,r[em++]=eS>>>19&2047,r[em++]=2047&(eS>>>30|(511&eP)<<2),r[em++]=eP>>>9&2047,r[em++]=eP>>>20&2047,r[em++]=2047&(eP>>>31|(1023&eM)<<1),r[em++]=eM>>>10&2047,r[em]=eM>>>21&2047;case 12:let eI,eE,eC,eA,eD,ez,ek,eR,eL,eF,eB,eO,eV;return eI=a,eE=t[i]>>>0,eC=t[i+1]>>>0,eA=t[i+2]>>>0,eD=t[i+3]>>>0,ez=t[i+4]>>>0,ek=t[i+5]>>>0,eR=t[i+6]>>>0,eL=t[i+7]>>>0,eF=t[i+8]>>>0,eB=t[i+9]>>>0,eO=t[i+10]>>>0,eV=t[i+11]>>>0,r[eI++]=eE>>>0&4095,r[eI++]=eE>>>12&4095,r[eI++]=4095&(eE>>>24|(15&eC)<<8),r[eI++]=eC>>>4&4095,r[eI++]=eC>>>16&4095,r[eI++]=4095&(eC>>>28|(255&eA)<<4),r[eI++]=eA>>>8&4095,r[eI++]=eA>>>20&4095,r[eI++]=eD>>>0&4095,r[eI++]=eD>>>12&4095,r[eI++]=4095&(eD>>>24|(15&ez)<<8),r[eI++]=ez>>>4&4095,r[eI++]=ez>>>16&4095,r[eI++]=4095&(ez>>>28|(255&ek)<<4),r[eI++]=ek>>>8&4095,r[eI++]=ek>>>20&4095,r[eI++]=eR>>>0&4095,r[eI++]=eR>>>12&4095,r[eI++]=4095&(eR>>>24|(15&eL)<<8),r[eI++]=eL>>>4&4095,r[eI++]=eL>>>16&4095,r[eI++]=4095&(eL>>>28|(255&eF)<<4),r[eI++]=eF>>>8&4095,r[eI++]=eF>>>20&4095,r[eI++]=eB>>>0&4095,r[eI++]=eB>>>12&4095,r[eI++]=4095&(eB>>>24|(15&eO)<<8),r[eI++]=eO>>>4&4095,r[eI++]=eO>>>16&4095,r[eI++]=4095&(eO>>>28|(255&eV)<<4),r[eI++]=eV>>>8&4095,r[eI]=eV>>>20&4095;case 16:let ej,eN,eU,eG,e$,eZ,eq,eW,eH,eX,eY,eK,eJ,eQ,e0,e1,e2;return ej=a,eN=t[i]>>>0,eU=t[i+1]>>>0,eG=t[i+2]>>>0,e$=t[i+3]>>>0,eZ=t[i+4]>>>0,eq=t[i+5]>>>0,eW=t[i+6]>>>0,eH=t[i+7]>>>0,eX=t[i+8]>>>0,eY=t[i+9]>>>0,eK=t[i+10]>>>0,eJ=t[i+11]>>>0,eQ=t[i+12]>>>0,e0=t[i+13]>>>0,e1=t[i+14]>>>0,e2=t[i+15]>>>0,r[ej++]=eN>>>0&65535,r[ej++]=eN>>>16&65535,r[ej++]=eU>>>0&65535,r[ej++]=eU>>>16&65535,r[ej++]=eG>>>0&65535,r[ej++]=eG>>>16&65535,r[ej++]=e$>>>0&65535,r[ej++]=e$>>>16&65535,r[ej++]=eZ>>>0&65535,r[ej++]=eZ>>>16&65535,r[ej++]=eq>>>0&65535,r[ej++]=eq>>>16&65535,r[ej++]=eW>>>0&65535,r[ej++]=eW>>>16&65535,r[ej++]=eH>>>0&65535,r[ej++]=eH>>>16&65535,r[ej++]=eX>>>0&65535,r[ej++]=eX>>>16&65535,r[ej++]=eY>>>0&65535,r[ej++]=eY>>>16&65535,r[ej++]=eK>>>0&65535,r[ej++]=eK>>>16&65535,r[ej++]=eJ>>>0&65535,r[ej++]=eJ>>>16&65535,r[ej++]=eQ>>>0&65535,r[ej++]=eQ>>>16&65535,r[ej++]=e0>>>0&65535,r[ej++]=e0>>>16&65535,r[ej++]=e1>>>0&65535,r[ej++]=e1>>>16&65535,r[ej++]=e2>>>0&65535,r[ej]=e2>>>16&65535;case 32:for(let n=0;n<32;n=n+1|0)r[a+n|0]=0|t[i+n|0];return}let e3=hY[n]>>>0,e5=i,e6=0,e4=t[e5]>>>0;for(let i=0;i<32;i++)if(e6+n<=32)r[a+i]=e4>>>e6&e3,32===(e6+=n)&&(e6=0,e5++,31!==i&&(e4=t[e5]>>>0));else{let s=32-e6,o=e4>>>e6;e4=t[++e5]>>>0,r[a+i]=(o|(e4&hY[n-s]>>>0)<<s)&e3,e6=n-s}})(t,i,c,d,o),i=i+o|0;i=i-((d-l|0)*o>>>5)|0,r.exceptionSizes[o]=l}return i}(t,p,s);return s.dataPointers.fill(0),function(t,i,r,a,n,s,o,l,h,u){let c=0|r,d=0;for(let i=0;i<o;i=i+1|0){let r=function(t,i,r,a){if(r+2>i)throw Error(`FastPFOR decode: byteContainer underflow at block=${a} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${i})`);let n=t[r++],s=t[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${a} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:s,bytePosIn:r}}(l,h,d,i);d=r.bytePosIn;let a=r.bitWidth,o=r.exceptionCount,p=s+256*i|0;switch(a){case 0:n.fill(0,p,p+256);break;case 32:for(let i=0;i<256;i=i+1|0)n[p+i|0]=0|t[c+i|0];c=c+256|0;break;default:c=function(t,i,r,a,n){switch(n){case 1:let s=a,o=i;for(let i=0;i<8;i++){let i=t[o++]>>>0;r[s++]=i>>>0&1,r[s++]=i>>>1&1,r[s++]=i>>>2&1,r[s++]=i>>>3&1,r[s++]=i>>>4&1,r[s++]=i>>>5&1,r[s++]=i>>>6&1,r[s++]=i>>>7&1,r[s++]=i>>>8&1,r[s++]=i>>>9&1,r[s++]=i>>>10&1,r[s++]=i>>>11&1,r[s++]=i>>>12&1,r[s++]=i>>>13&1,r[s++]=i>>>14&1,r[s++]=i>>>15&1,r[s++]=i>>>16&1,r[s++]=i>>>17&1,r[s++]=i>>>18&1,r[s++]=i>>>19&1,r[s++]=i>>>20&1,r[s++]=i>>>21&1,r[s++]=i>>>22&1,r[s++]=i>>>23&1,r[s++]=i>>>24&1,r[s++]=i>>>25&1,r[s++]=i>>>26&1,r[s++]=i>>>27&1,r[s++]=i>>>28&1,r[s++]=i>>>29&1,r[s++]=i>>>30&1,r[s++]=i>>>31&1}break;case 2:!function(t,i,r,a){let n=a,s=i;for(let i=0;i<8;i++){let i=t[s++]>>>0,a=t[s++]>>>0;r[n++]=i>>>0&3,r[n++]=i>>>2&3,r[n++]=i>>>4&3,r[n++]=i>>>6&3,r[n++]=i>>>8&3,r[n++]=i>>>10&3,r[n++]=i>>>12&3,r[n++]=i>>>
214&3,r[n++]=i>>>16&3,r[n++]=i>>>18&3,r[n++]=i>>>20&3,r[n++]=i>>>22&3,r[n++]=i>>>24&3,r[n++]=i>>>26&3,r[n++]=i>>>28&3,r[n++]=i>>>30&3,r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3}}(t,i,r,a);break;case 3:!function(t,i,r,a){let n=a,s=i;for(let i=0;i<8;i++){let i=t[s++]>>>0,a=t[s++]>>>0,o=t[s++]>>>0;r[n++]=i>>>0&7,r[n++]=i>>>3&7,r[n++]=i>>>6&7,r[n++]=i>>>9&7,r[n++]=i>>>12&7,r[n++]=i>>>15&7,r[n++]=i>>>18&7,r[n++]=i>>>21&7,r[n++]=i>>>24&7,r[n++]=i>>>27&7,r[n++]=7&(i>>>30|(1&a)<<2),r[n++]=a>>>1&7,r[n++]=a>>>4&7,r[n++]=a>>>7&7,r[n++]=a>>>10&7,r[n++]=a>>>13&7,r[n++]=a>>>16&7,r[n++]=a>>>19&7,r[n++]=a>>>22&7,r[n++]=a>>>25&7,r[n++]=a>>>28&7,r[n++]=7&(a>>>31|(3&o)<<1),r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n++]=o>>>29&7}}(t,i,r,a);break;case 4:!function(t,i,r,a){let n=a,s=i;for(let i=0;i<8;i++){let i=t[s++]>>>0,a=t[s++]>>>0,o=t[s++]>>>0,l=t[s++]>>>0;r[n++]=i>>>0&15,r[n++]=i>>>4&15,r[n++]=i>>>8&15,r[n++]=i>>>12&15,r[n++]=i>>>16&15,r[n++]=i>>>20&15,r[n++]=i>>>24&15,r[n++]=i>>>28&15,r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n++]=l>>>28&15}}(t,i,r,a);break;case 5:!function(t,i,r,a){let n=a,s=i;for(let i=0;i<8;i++){let i=t[s++]>>>0,a=t[s++]>>>0,o=t[s++]>>>0,l=t[s++]>>>0,h=t[s++]>>>0;r[n++]=i>>>0&31,r[n++]=i>>>5&31,r[n++]=i>>>10&31,r[n++]=i>>>15&31,r[n++]=i>>>20&31,r[n++]=i>>>25&31,r[n++]=31&(i>>>30|(7&a)<<2),r[n++]=a>>>3&31,r[n++]=a>>>8&31,r[n++]=a>>>13&31,r[n++]=a>>>18&31,r[n++]=a>>>23&31,r[n++]=31&(a>>>28|(1&o)<<4),r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>
226&31,r[n++]=31&(o>>>31|(15&l)<<1),r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=31&(l>>>29|(3&h)<<3),r[n++]=h>>>2&31,r[n++]=h>>>7&31,r[n++]=h>>>12&31,r[n++]=h>>>17&31,r[n++]=h>>>22&31,r[n++]=h>>>27&31}}(t,i,r,a);break;case 6:!function(t,i,r,a){let n=a,s=i;for(let i=0;i<8;i++){let i=t[s++]>>>0,a=t[s++]>>>0,o=t[s++]>>>0,l=t[s++]>>>0,h=t[s++]>>>0,u=t[s++]>>>0;r[n++]=i>>>0&63,r[n++]=i>>>6&63,r[n++]=i>>>12&63,r[n++]=i>>>18&63,r[n++]=i>>>24&63,r[n++]=63&(i>>>30|(15&a)<<2),r[n++]=a>>>4&63,r[n++]=a>>>10&63,r[n++]=a>>>16&63,r[n++]=a>>>22&63,r[n++]=63&(a>>>28|(3&o)<<4),r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=63&(l>>>30|(15&h)<<2),r[n++]=h>>>4&63,r[n++]=h>>>10&63,r[n++]=h>>>16&63,r[n++]=h>>>22&63,r[n++]=63&(h>>>28|(3&u)<<4),r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63}}(t,i,r,a);break;case 7:!function(t,i,r,a){let n=a,s=i;for(let i=0;i<8;i++){let i=t[s++]>>>0,a=t[s++]>>>0,o=t[s++]>>>0,l=t[s++]>>>0,h=t[s++]>>>0,u=t[s++]>>>0,c=t[s++]>>>0;r[n++]=i>>>0&127,r[n++]=i>>>7&127,r[n++]=i>>>14&127,r[n++]=i>>>21&127,r[n++]=127&(i>>>28|(7&a)<<4),r[n++]=a>>>3&127,r[n++]=a>>>10&127,r[n++]=a>>>17&127,r[n++]=a>>>24&127,r[n++]=127&(a>>>31|(63&o)<<1),r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=127&(o>>>27|(3&l)<<5),r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=127&(l>>>30|(31&h)<<2),r[n++]=h>>>5&127,r[n++]=h>>>12&127,r[n++]=h>>>19&127,r[n++]=127&(h>>>26|(1&u)<<6),r[n++]=u>>>1&127,r[n++]=u>>>8&127,r[n++]=u>>>15&127,r[n++]=u>>>22&127,r[n++]=127&(u>>>29|(15&c)<<3),r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n++]=c>>>25&127}}(t,i,r,a);break;case 8:!function(t,i,r,a){let n=a,s=i;for(let i=0;i<8;i++){let i=t[s++]>>>0,a=t[s++]>>>0,o=t[s++]>>>0,l=t[s++]>>>0,h=t[s++]>>>0,u=t[s++]>>>0,c=t[s++]>>>0,d=t[s++]>>>0;r[n++]=i>>>0&255,r[n++]=i>>>8&255,r[n++]=i>>>16&255,r[n++]=i>>>24&255,r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n++]=d>>>24&255}}(t,i,r,a);break;case 16:let l=a,h=i;for(let i=0;i<128;i++){let i=t[h++]>>>0;r[l++]=65535&i,r[l++]=i>>>16&65535}break;default:!function(t,i,r,a,n){let s=hY[n]>>>0,o=i,l=0,h=t[o]>>>0,u=a;for(let i=0;i<8;i++){for(let i=0;i<32;i++)if(l+n<=32)r[u+i]=h>>>l&s,32===(l+=n)&&(l=0,o++,31!==i&&(h=t[o]>>>0));else{let a=32-l,c=h>>>l;h=t[++o]>>>0;let d=n-a;r[u+i]=(c|(h&-1>>>32-d>>>0)<<a)&s,l=d}u+=32,l=0,i<7&&(h=t[o]>>>0)}}(t,i,r,a,n)}return i+(n<<3)|0}(t,c,n,p,a)}o>0&&(d=function(t,i,r,a,n,s,o,l,h){let{maxBits:u,exceptionBitWidth:c,bytePosIn:d}=function(t,i,r,a,n,s){if(r+1>i)throw Error(`FastPFOR decode: exception header underflow at block=${s} (need 1 byte for maxBits, bytePos=${r}, byteSize=${i})`);let o=t[r++];if(o<a||o>32)throw Error(`FastPFOR decode: invalid maxBits=${o} at block=${s} (bitWidth=${a}, expected ${a}..32)`);let l=o-a|0;if(l<1||l>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${l} at block=${s} (bitWidth=${a}, maxBits=${o})`);if(r+n>i)throw Error(`FastPFOR decode: exception positions underflow at block=${s} (need=${n}, have=${i-r})`);return{maxBits:o,exceptionBitWidth:l,bytePosIn:r}}(n,s,o,r,a,h);if(o=d,1===c){let s=1<<r;for(let r=0;r<a;r=r+1|0)t[n[o++]+i|0]|=s;return o}let p=l.dataToBePacked[c];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${c} (bitWidth=${r}, maxBits=${u}) at block ${h}`);let f=l.dataPointers,m=0|f[c],_=0|l.exceptionSizes[c];if(m+a>_)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${c} (ptr=${m}, need ${a}, size=${_}) at block ${h}`);for(let s=0;s<a;s=s+1|0){let a=n[o++],s=0|p[m++];t[a+i|0]|=s<<r}return f[c]=m,o}(n,p,a,o,l,h,d,u,i))}if(c!==a)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${i}, packedStart=${r}, consumedPackedEnd=${c}, expectedPackedEnd=${a}, packedWords=${a-r}, encoded.length=${t.length})`)}(t,o,o+1|0,h,i,0|a,n/256|0,f,u,s),m}(t,i,h,l,r,s),l=l+r|0}return h}
2(t,s,a,n,i,o),n=n+i|0}return function(t,i,r,a,n,s){if(0===s)return;let o=0,l=i,h=i+r,u=n,c=n+s,d=0,p=0;for(;l<h&&u<c;){let i=t[l]>>>o&255;if(o+=8,l+=o>>>5,o&=31,d|=(127&i)<<p,128&i)a[u++]=0|d,d=0,p=0;else if((p+=7)>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${d}, decoded=${u-n}/${s}, inPos=${l}, inEnd=${h})`)}if(u!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${u-n}, expected=${s}, consumedWords=${l-i}/${r}, vbyteStart=${i}, vbyteEnd=${h})`)}(t,a,t.length-a|0,s,n,i-n|0),s}(l.subarray(0,o),i,n.decoderWorkspace);return a.add(r),h}(t,n,s=r.byteLength,i,function(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);return{encodedWords:new Uint32Array(Math.max(16,0|t)),decoderWorkspace:hQ()}}(s>>>2));case O.VARINT:return h0(t,i,r.numValues);case O.NONE:{let a=i.get();return i.add(r.byteLength),new Uint32Array(t.subarray(a,i.get()))}default:throw Error(`Specified physicalLevelTechnique ${a} is not supported (yet).`)}}function ul(t,i,r){let a=uo(t,i,r);return 1===a.length?a[0]:a[1]}function uh(t,i,r){var a=uo(t,i,r);if(2===a.length){let t=h2(a[1]);return[t,t]}
2return[h2(a[2]),h2(a[3])]}function uu(t,i,r){var a=h1(t,i,r.numValues);if(2===a.length){let t=h3(a[1]);return[t,t]}return[h3(a[2]),h3(a[3])]}function uc(t,i,r,a){let n;var s=h1(t,i,r.numValues);switch(r.logicalLevelTechnique1){case B.DELTA:n=function(t){let i=new BigUint64Array(t.length);i[0]=BigInt.asUintN(64,h3(t[0]));for(let r=1;r<t.length;r++)i[r]=BigInt.asUintN(64,i[r-1]+h3(t[r]));return i}(r.logicalLevelTechnique2===B.RLE?h4(s,r.runs,r.numRleValues):s);break;case B.RLE:n=h4(s,r.runs,r.numRleValues);break;case B.NONE:n=s;break;default:throw Error(`The specified Logical level technique is not supported: ${r.logicalLevelTechnique1}`)}return a?ur(n,a,0n):n}function ud(t,i,r){let a=h1(t,i,r.numValues);return 1===a.length?a[0]:a[1]}function up(t,i,r,a,n="int32"){let s=t.logicalLevelTechnique1;if(s===B.RLE)return 1===t.runs?G.CONST:G.FLAT;if(s!==B.DELTA||t.logicalLevelTechnique2!==B.RLE)return 1===t.numValues?G.CONST:G.FLAT;let o=i instanceof ui?i.size():i;if(t.numRleValues!==o)return G.FLAT;if(1===t.runs)return G.SEQUENCE;if(2!==t.runs)return 1===t.numValues?G.CONST:G.FLAT;let l=a.get();if(t.physicalLevelTechnique===O.VARINT)return!function(t,i,r){let a=new hX(i.get());if("int64"===r){let i=h1(t,a,4);return 2n===i[2]&&2n===i[3]}let n=h0(t,a,4);return 2===n[2]&&2===n[3]}(r,a,n)?1===t.numValues?G.CONST:G.FLAT:G.SEQUENCE;let h=a.get(),u=new Int32Array(r.buffer,r.byteOffset+h,4);return a.set(l),2===u[2]&&2===u[3]?G.SEQUENCE:1===t.numValues?G.CONST:G.FLAT}class uf extends hU{getValueFromBuffer(t){return this.dataBuffer[t]}}class um extends hZ{constructor(t,i,r,a){super(t,BigInt64Array.of(i),r,a)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}}function u_(t,i,r){return{x:ug(t,i)-r,y:ug(t>>1,i)-r}}function ug(t,i){let r=0;for(let a=0;a<i;a++)r|=(t&1<<2*a)>>a;return r}function uy(t,i,r,a,n,s,o){return t===q.MORTON?function(t,i,r,a,n,s){let o=Array(n?a+1:a);for(let n=0;n<a;n++){let a=u_(t[i[r+n]],s.numBits,s.coordinateShift);o[n]=new w(a.x,a.y)}return n&&(o[o.length-1]=o[0]),o}(i,r,a,n,s,o):function(t,i,r,a,n){let s=Array(n?a+1:a);for(let n=0;n<2*a;n+=2){let a=2*i[r+n/2];s[n/2]=new w(t[a],t[a+1])}return n&&(s[s.length-1]=s[0]),s}(i,r,a,n,s)}function ux(t,i,r,a){let n=Array(a?r+1:r);for(let a=0;a<2*r;a+=2)n[a/2]=new w(t[i+a],t[i+a+1]);return a&&(n[n.length-1]=n[0]),n}(z=$||($={}))[z.POINT=0]="POINT",z[z.LINESTRING=1]="LINESTRING",z[z.POLYGON=2]="POLYGON",z[z.MULTIPOINT=3]="MULTIPOINT",z[z.MULTILINESTRING=4]="MULTILINESTRING",z[z.MULTIPOLYGON=5]="MULTIPOLYGON",(k=Z||(Z={}))[k.POINT=0]="POINT",k[k.LINESTRING=1]="LINESTRING",k[k.POLYGON=2]="POLYGON",(R=q||(q={}))[R.MORTON=0]="MORTON",R[R.VEC_2=1]="VEC_2",R[R.VEC_3=2]="VEC_3";class uv{constructor(t,i,r,a,n){this._vertexBufferType=t,this._topologyVector=i,this._vertexOffsets=r,this._vertexBuffer=a,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){let i=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){let i=u_(this.vertexBuffer[this.vertexOffsets[t]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[i.x,i.y]}let i=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return function(t){let i=Array(t.numGeometries),r=1,a=1,n=1,s=0,o=0,l=0,h=t.mortonSettings,u=t.topologyVector,c=u.geometryOffsets,d=u.partOffsets,p=u.ringOffsets,f=t.vertexOffsets,m=!f||0===f.length,_=t.containsPolygonGeometry(),g=t.vertexBuffer;for(let u=0;u<t.numGeometries;u++)switch(t.geometryType(u)){case $.POINT:{let u,_;if(m)u=g[o++],_=g[o++];else if(t.vertexBufferType===q.MORTON){let t=u_(g[f[l++]],h.numBits,h.coordinateShift);u=t.x,_=t.y}else{let t=2*f[l++];u=g[t],_=g[t+1]}i[s++]=[[new w(u,_)]],c&&n++,d&&r++,p&&a++}break;case $.MULTIPOINT:{let t=c[n]-c[n-1];n++;let h=Array(t);if(m)for(let i=0;i<t;i++){let t=g[o++],r=g[o++];h[i]=new w(t,r)}else for(let i=0;i<t;i++){let t=2*f[l++];h[i]=new w(g[t],g[t+1])}i[s++]=h.map(t=>[t]),r+=t,a+=t}break;case $.LINESTRING:{let u,y;_?(u=p[a]-p[a-1],a++):u=d[r]-d[r-1],r++,m?(y=ux(g,o,u,!1),o+=2*u):(y=uy(t.vertexBufferType,g,f,l,u,!1,h),l+=u),i[s++]=[y],c&&n++}break;case $.POLYGON:{let u=d[r]-d[r-1];r++;let _=Array(u-1),y,x=p[a]-p[a-1];if(a++,m){y=ux(g,o,x,!0),o+=2*x;for(let t=0;t<_.length;t++)x=p[a]-p[a-1],a++,_[t]=ux(g,o,x,!0),o+=2*x}else{y=uy(t.vertexBufferType,g,f,l,x,!0,h),l+=x;for(let i=0;i<_.length;i++)x=p[a]-p[a-1],a++,_[i]=uy(t.vertexBufferType,g,f,l,x,!0,h),l+=x}i[s++]=[y].concat(_),c&&n++}break;case $.MULTILINESTRING:{let u=c[n]-c[n-1];n++;let y=Array(u);for(let i=0;i<u;i++){let n;if(_?(n=p[a]-p[a-1],a++):n=d[r]-d[r-1],r++,m)y[i]=ux(g,o,n,!1),o+=2*n;else{let r=uy(t.vertexBufferType,g,f,l,n,!1,h);y[i]=r,l+=n}}i[s++]=y}break;case $.MULTIPOLYGON:{let u=c[n]-c[n-1];n++;let _=Array(u);for(let i=0;i<u;i++){let n,s=d[r]-d[r-1];r++;let u=Array(s-1),c=p[a]-p[a-1];a++,m?(n=ux(g,o,c,!0),o+=2*c):(n=uy(t.vertexBufferType,g,f,l,c,!0,h),l+=c);for(let i=0;i<u.length;i++){let r=p[a]-p[a-1];a++,m?(u[i]=ux(g,o,r,!0),o+=2*r):(u[i]=uy(t.vertexBufferType,g,f,l,r,!0,h),l+=r)}_[i]=[n].concat(u)}i[s++]=_.flat()}break;default:throw Error("The specified geometry type is currently not supported.")}return i}(this)}get mortonSettings(){return this._mortonSettings}}class ub extends uv{constructor(t,i,r,a,n,s,o){super(r,a,n,s,o),this._numGeometries=t,this._geometryType=i}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===$.POLYGON||this._geometryType===$.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class uw extends uv{constructor(t,i,r,a,n,s){super(t,r,a,n,s),this._geometryTypes=i}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===$.POLYGON||this.geometryType(t)===$.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class uT{constructor(t,i,r,a){this._triangleOffsets=t,this._indexBuffer=i,this._vertexBuffer=r,this._topologyVector=a}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let t=Array(this.numGeometries),i=this._topologyVector,r=i.partOffsets,a=i.ringOffsets,n=i.geometryOffsets,s=0,o=1,l=1,h=1;for(let i=0;i<this.numGeometries;
2i++)switch(this.geometryType(i)){case $.POLYGON:{let u=r[o]-r[o-1];o++;let c=[];for(let t=0;t<u;t++){let t=a[l]-a[l-1];l++;let i=[];for(let r=0;r<t;r++){let t=this._vertexBuffer[s++],r=this._vertexBuffer[s++];i.push(new w(t,r))}i.length>0&&i.push(i[0]),c.push(i)}t[i]=c,n&&h++}break;case $.MULTIPOLYGON:{let u=n[h]-n[h-1];h++;let c=[];for(let t=0;t<u;t++){let t=r[o]-r[o-1];o++;for(let i=0;i<t;i++){let t=a[l]-a[l-1];l++;let i=[];for(let r=0;r<t;r++){let t=this._vertexBuffer[s++],r=this._vertexBuffer[s++];i.push(new w(t,r))}i.length>0&&i.push(i[0]),c.push(i)}}t[i]=c}}return t}[Symbol.iterator](){return null}}class uS extends uT{constructor(t,i,r,a,n,s){super(r,a,n,s),this._numGeometries=t,this._geometryType=i}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}class uP extends uT{constructor(t,i,r,a,n){super(i,r,a,n),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function uM(t,i,r){let a=new Uint32Array(t.length+1),n=0;a[0]=n;let s=0;for(let o=0;o<t.length;o++)n=a[o+1]=n+(t[o]>r?i[s++]:1);return a}function uI(t,i,r,a){let n=new Uint32Array(i[i.length-1]+1),s=0;n[0]=s;let o=1,l=0;for(let h=0;h<t.length;h++){let u=t[h],c=i[h+1]-i[h];if(5===u||2===u||a&&(4===u||1===u))for(let t=0;t<c;t++)s=n[o++]=s+r[l++];else for(let t=0;t<c;t++)n[o++]=++s}return n}class uE extends hN{constructor(t,i,r){super(t,i.getBuffer(),r),this.dataVector=i}getValueFromBuffer(t){return this.dataVector.get(t)}}class uC extends hU{getValueFromBuffer(t){return this.dataBuffer[t]}}class uA extends hN{constructor(t,i,r,a){super(t,a?BigInt64Array.of(i):BigUint64Array.of(i),r)}getValueFromBuffer(t){return this.dataBuffer[0]}}function uD(t,i,r,a,n){let s=function(t,i,r,a){let n=new Uint8Array(i),s=0,o=a.get()+r;for(;s<i&&!(a.get()>=o);){let r=t[a.increment()];if(r<=127){let o=r+3,l=t[a.increment()],h=Math.min(s+o,i);n.fill(l,s,h),s=h}else{let o=256-r;for(let r=0;r<o&&s<i;r++)n[s++]=t[a.increment()]}}return a.set(o),n}(t,Math.ceil(i/8),r,a);return n?function(t,i,r){if(!r)return t;let a=r.size(),n=new ui(t,i),s=new ui(new Uint8Array(Math.ceil(a/8)),a),o=0;for(let t=0;t<a;t++){let i=!!r.get(t)&&n.get(o++);s.set(t,i)}return s.getBuffer()}(s,i,n):s}let uz=new TextDecoder;function uk(t,i,r){return r-i>=12?uz.decode(t.subarray(i,r)):function(t,i,r){let a="",n=i;for(;n<r;){let i=t[n],s,o,l,h=null,u=i>239?4:i>223?3:i>191?2:1;if(n+u>r)break;1===u?i<128&&(h=i):2===u?128==(192&(s=t[n+1]))&&(h=(31&i)<<6|63&s)<=127&&(h=null):3===u?(s=t[n+1],o=t[n+2],128==(192&s)&&128==(192&o)&&((h=(15&i)<<12|(63&s)<<6|63&o)<=2047||h>=55296&&h<=57343)&&(h=null)):4===u&&(s=t[n+1],o=t[n+2],l=t[n+3],128==(192&s)&&128==(192&o)&&128==(192&l)&&((h=(15&i)<<18|(63&s)<<12|(63&o)<<6|63&l)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,a+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),a+=String.fromCharCode(h),n+=u}return a}(t,i,r)}class uR extends hN{constructor(t,i,r,a){super(t,r,a),this.offsetBuffer=i}}class uL extends uR{constructor(t,i,r,a){super(t,i,r,a??i.length-1)}getValueFromBuffer(t){return uk(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class uF extends uR{constructor(t,i,r,a,n){super(t,r,a,n??i.length),this.indexBuffer=i,this.indexBuffer=i}getValueFromBuffer(t){let i=this.indexBuffer[t];return uk(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class uB extends uR{constructor(t,i,r,a,n,s,o){super(t,r,a,o),this.indexBuffer=i,this.symbolOffsetBuffer=n,this.symbolTableBuffer=s}getValueFromBuffer(t){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=function(t,i,r){let a=[],n=Array(i.length).fill(0);for(let t=1;t<i.length;t++)n[t]=n[t-1]+i[t-1];for(let s=0;s<r.length;s++)if(255===r[s])a.push(r[++s]);else{let o=i[r[s]],l=n[r[s]];for(let i=0;i<o;i++)a.push(t[l+i])}return new Uint8Array(a)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let i=this.indexBuffer[t];return uk(this.decodedDictionary,this.offsetBuffer[i],this.offsetBuffer[i+1])}offsetToLengthBuffer(t){let i=new Uint32Array(t.length-1),r=t[0];for(let a=1;a<t.length;a++){let n=t[a];i[a-1]=n-r,r=n}return i}}function uO(t){return t instanceof ui}function uV(t){switch(t){case 0:case 1:case 2:case 3:{let i={};i.nullable=!!(1&t),i.columnScope=0;let r={type:"logicalType",logicalType:0};return r.longID=!!(2&t),i.scalarType=r,i.type="scalarType",i}
2case 4:{let t={nullable:!1,columnScope:0};return t.type="complexType",t.complexType={type:"physicalType",physicalType:0},t}case 30:{let t={nullable:!1,columnScope:0};return t.type="complexType",t.complexType={type:"physicalType",physicalType:1},t}default:let i;switch(t){case 10:case 11:i=0;break;case 12:case 13:i=1;break;case 14:case 15:i=2;break;case 16:case 17:i=3;break;case 18:case 19:i=4;break;case 20:case 21:i=5;break;case 22:case 23:i=6;break;case 24:case 25:i=7;break;case 26:case 27:i=8;break;case 28:case 29:i=9;break;default:return null}let r={};r.nullable=!!(1&t),r.columnScope=0;let a={type:"physicalType"};return a.physicalType=i,r.type="scalarType",r.scalarType=a,r}}let uj=new TextDecoder;function uN(t,i){let r=h0(t,i,1)[0];if(0===r)return"";let a=i.get(),n=t.subarray(a,a+r);return i.add(r),uj.decode(n)}class uU{constructor(t,i){var r;switch(this._featureData=t,this.properties=this._featureData.properties||{},null==(r=this._featureData.geometry)?void 0:r.type){case $.POINT:case $.MULTIPOINT:this.type=1;break;case $.LINESTRING:case $.MULTILINESTRING:this.type=2;break;case $.POLYGON:case $.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let i of this._featureData.geometry.coordinates){let r=[];for(let t of i)r.push(new w(t.x,t.y));t.push(r)}return t}}class uG{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new uU(this.features[t],this.extent)}}class u${constructor(t){this.layers={};const i=function(t,i=!0){let r=new hX(0),a=[];for(;r.get()<t.length;){let s=h0(t,r,1)[0]>>>0,o=r.get()+s;if(o>t.length)throw Error(`Block overruns tile: ${o} > ${t.length}`);if(1!=h0(t,r,1)[0]>>>0){r.set(o);continue}let[l,h]=function(t,i){let r={featureTables:[]},a={};a.name=uN(t,i);let n=h0(t,i,1)[0]>>>0,s=h0(t,i,1)[0]>>>0;a.columns=Array(s);for(let r=0;r<s;r++)a.columns[r]=function(t,i){let r=h0(t,i,1)[0]>>>0,a=uV(r);if(!a)throw Error(`Unsupported column type code ${r}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(r>=10?a.name=uN(t,i):r>=0&&r<=3?a.name="id":4===r&&(a.name="geometry"),30===r){let r=h0(t,i,1)[0]>>>0,n=a.complexType;n.children=Array(r);for(let a=0;a<r;a++)n.children[a]=function t(i,r){let a=h0(i,r,1)[0]>>>0;if(a<10||a>30)throw Error(`Unsupported field type code ${a}. Supported: 10-29(scalars), 30(STRUCT)`);let n=uV(a);if(a>=10&&(n.name=uN(i,r)),30===a){let a=h0(i,r,1)[0]>>>0;n.complexType.children=Array(a);for(let s=0;s<a;s++)n.complexType.children[s]=t(i,r)}return{name:n.name,nullable:n.nullable,scalarField:n.scalarType,complexField:n.complexType,type:"scalarType"===n.type?"scalarField":"complexField"}}(t,i)}return a}(t,i);return r.featureTables.push(a),[r,n]}(t,r),u=l.featureTables[0],c=null,d=null,p=[],f=0;for(let a of u.columns){let s=a.name;if("scalarType"===a.type&&"logicalType"===a.scalarType?.type&&0===a.scalarType.logicalType){let n=null;if(a.nullable){let i=ut(t,r),a=r.get(),s=uD(t,i.numValues,i.byteLength,r);r.set(a+i.byteLength),n=new ui(s,i.numValues)}let o=ut(t,r);f=n?n.size():o.decompressedCount,c=function(t,i,r,a,n,s,o=!1){let l=i.scalarType;if(!l||"logicalType"!==l.type||0!==l.logicalType)throw Error(`ID column must be a logical ID scalar type: ${a}`);let h=l.longID?6:4,u="number"==typeof s?void 0:s,c=up(n,s,t,r,6===h?"int64":"int32");if(4===h)switch(c){case G.FLAT:return new hG(a,un(t,r,n,0,u),s);case G.SEQUENCE:{let i=uh(t,r,n);return new hq(a,i[0],i[1],n.numRleValues)}case G.CONST:return new hW(a,ul(t,r,n),s,!1)}switch(c){case G.FLAT:if(o)return new h$(a,function(t,i,r){var a=function(t,i,r){let a=new Float64Array(r);for(let n=0;n<r;n++)a[n]=function(t,i){let r,a;return a=t[i.get()],i.increment(),r=127&a,a<128?r:(a=t[i.get()],i.increment(),r|=(127&a)<<7,a<128?r:(a=t[i.get()],i.increment(),r|=(127&a)<<14,a<128?r:(a=t[i.get()],i.increment(),r|=(127&a)<<21,a<128?r:function(t,i,r){let a,n;if(n=i[r.get()],r.increment(),a=(112&n)>>4,n<128||(n=i[r.get()],r.increment(),a|=(127&n)<<3,n<128)||(n=i[r.get()],r.increment(),a|
2=(127&n)<<10,n<128)||(n=i[r.get()],r.increment(),a|=(127&n)<<17,n<128)||(n=i[r.get()],r.increment(),a|=(127&n)<<24,n<128)||(n=i[r.get()],r.increment(),a|=(1&n)<<31,n<128))return 0x100000000*a+(t>>>0);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(a=t[i.get()]))<<28,t,i))))}(t,i);return a}(t,i,r.numValues);switch(r.logicalLevelTechnique1){case B.DELTA:return r.logicalLevelTechnique2===B.RLE&&(a=h8(a,r.runs,r.numRleValues)),function(t){t[0]=h5(t[0]);let i=t.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let i=t[r+1],a=t[r+2],n=t[r+3];t[r]=h5(t[r])+t[r-1],t[r+1]=h5(i)+t[r],t[r+2]=h5(a)+t[r+1],t[r+3]=h5(n)+t[r+2]}for(;r!==t.length;++r)t[r]=h5(t[r])+t[r-1]}(a),a;case B.RLE:return h8(a,r.runs,r.numRleValues);case B.NONE:return a;default:throw Error(`The specified Logical level technique is not supported: ${r.logicalLevelTechnique1}`)}}(t,r,n),s);return new uf(a,uc(t,r,n,u),s);case G.SEQUENCE:{let i=uu(t,r,n);return new um(a,i[0],i[1],n.numRleValues)}case G.CONST:return new uA(a,ud(t,r,n),s,!1)}throw Error("Vector type not supported for id column.")}(t,a,r,s,o,n??f,i)}else{var n;if("complexType"===a.type&&"physicalType"===a.complexType?.type&&0===a.complexType.physicalType){let i=h0(t,r,1)[0];if(0===f){let i=r.get();f=ut(t,r).decompressedCount,r.set(i)}d=function(t,i,r,a){var n,s,o,l,h,u,c,d,p,f,m,_,g,y;let x,v,b,w,T,S,P,M,I,E,C,A=ut(t,r);if(up(A,a,t,r)===G.CONST){let d,p,f,m,_=ul(t,r,A);for(let a=0;a<i-1;a++){let i=ut(t,r);switch(i.physicalStreamType){case V.LENGTH:switch(i.logicalStreamType.lengthType){case U.GEOMETRIES:d=us(t,r,i);break;case U.PARTS:p=us(t,r,i);break;case U.RINGS:f=us(t,r,i);break;case U.TRIANGLES:m=us(t,r,i)}break;case V.OFFSET:switch(i.logicalStreamType.offsetType){case N.VERTEX:x=un(t,r,i);break;case N.INDEX:w=un(t,r,i)}break;case V.DATA:j.VERTEX===i.logicalStreamType.dictionaryType?v=ua(t,r,i):(b={numBits:i.numBits,coordinateShift:i.coordinateShift},v=un(t,r,i))}}return w?void 0!==d||void 0!==p?new uS(a,_,m,w,v,{geometryOffsets:d,partOffsets:p,ringOffsets:f}):new uS(a,_,m,w,v,void 0):void 0===b?(n={geometryOffsets:d,partOffsets:p,ringOffsets:f},s=x,o=v,new ub(a,_,q.VEC_2,n,s,o)):(l={geometryOffsets:d,partOffsets:p,ringOffsets:f},h=x,u=v,c=b,new ub(a,_,q.MORTON,l,h,u,c))}let D=un(t,r,A);for(let a=0;a<i-1;a++){let i=ut(t,r);switch(i.physicalStreamType){case V.LENGTH:switch(i.logicalStreamType.lengthType){case U.GEOMETRIES:T=un(t,r,i);break;case U.PARTS:S=un(t,r,i);break;case U.RINGS:P=un(t,r,i);break;case U.TRIANGLES:M=us(t,r,i)}break;case V.OFFSET:switch(i.logicalStreamType.offsetType){case N.VERTEX:x=un(t,r,i);break;case N.INDEX:w=un(t,r,i)}break;case V.DATA:j.VERTEX===i.logicalStreamType.dictionaryType?v=ua(t,r,i):(b={numBits:i.numBits,coordinateShift:i.coordinateShift},v=un(t,r,i))}}return T?(I=uM(D,T,2),S&&P?(E=uI(D,I,S,!1),C=function(t,i,r,a){let n=new Uint32Array(r[r.length-1]+1),s=0;n[0]=s;let o=1,l=1,h=0;for(let u=0;u<t.length;u++){let c=t[u],d=i[u+1]-i[u];if(0!==c&&3!==c)for(let t=0;t<d;t++){let t=r[o]-r[o-1];o++;for(let i=0;i<t;i++)s=n[l++]=s+a[h++]}else for(let t=0;t<d;t++)n[l++]=++s,o++}return n}(D,I,E,P)):S&&(E=function(t,i,r){let a=new Uint32Array(i[i.length-1]+1),n=0;a[0]=n;let s=1,o=0;for(let l=0;l<t.length;l++){let h=t[l],u=i[l+1]-i[l];if(4===h||1===h)for(let t=0;t<u;t++)n=a[s++]=n+r[o++];else for(let t=0;t<u;t++)a[s++]=++n}return a}(D,I,S))):S&&P?(E=uM(D,S,1),C=uI(D,E,P,!0)):S&&(E=uM(D,S,0)),w&&!E?new uP(D,M,w,v,void 0):w?new uP(D,M,w,v,{geometryOffsets:I,partOffsets:E,ringOffsets:C}):void 0===b?(d={geometryOffsets:I,partOffsets:E,ringOffsets:C},p=x,f=v,new uw(q.VEC_2,D,d,p,f)):(m={geometryOffsets:I,partOffsets:E,ringOffsets:C},_=x,g=v,y=b,new uw(q.MORTON,D,m,_,g,y))}(t,i,r,f)}else{let i=!function(t){if("scalarType"===t.type){let i=t.scalarType;if("physicalType"===i.type)switch(i.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if("logicalType"===i.type)return!1}else if("complexType"===t.type){let i=t.complexType;if("physicalType"===i.type)switch(i.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}(a)?1:h0(t,r,1)[0];if(0===i)continue;let s=(n=f,"scalarType"===a.type?function(t,i,r,a,n,s){var o,l;let h=null;if(0===t)return null;if(s.nullable){let t=ut(i,r),a=t.numValues,n=r.get(),s=uD(i,a,t.byteLength,r);r.set(n+t.byteLength),h=new ui(s,t.numValues)}let u=h??a;switch(n.physicalType){case 4:case 3:return function(t,i,r,a,n){let s,o=ut(t,i),l=up(o,n,t,i),h=3===a.physicalType;if(l===G.FLAT){let a=uO(n)?n:void 0,s=h?ua(t,i,o,0,a):un(t,i,o,0,a);return new hG(r.name,s,n)}if(l===G.SEQUENCE){let a=uh(t,i,o);return new hq(r.name,a[0],a[1],o.numRleValues)}let u=h?1===(s=uo(t,i,o)).length?h2(s[0]):h2(s[1]):ul(t,i,o);return new hW(r.name,u,n,h)}(i,r,s,n,u);case 9:return function(t,i,r,a,n){var s,o,l,h,u,c,d,p,f,m;let _=null,g=null,y=null,x=null,v=null,b=n??null,w=null,T=null;for(let t=0;t<a;t++){let t=ut(i,r);switch(t.physicalStreamType){case V.PRESENT:{let a=new ui(uD(i,t.numValues,t.byteLength,r),t.numValues);b=n??a;break}case V.OFFSET:g=un(i,r,t,0,b);break;case V.LENGTH:{let a=us(i,r,t);U.DICTIONARY===t.logicalStreamType.lengthType?_=a:U.SYMBOL===t.logicalStreamType.lengthType?x=a:w=a;break}case V.DATA:{let a=i.subarray(r.get(),r.get()+t.byteLength);r.add(t.byteLength);let n=t.logicalStreamType.dictionaryType;j.FSST===n?v=a:j.SINGLE===n||j.SHARED===n?y=a:j.NONE===n&&(T=a)}}}return s=v,o=g,l=_,h=y,u=x,c=b,(s?new uB(t,o,l,h,u,s,c):null)??(d=y,p=g,f=_,m=b,d?m?new uF(t,p,f,d,m):new uF(t,p,f,d):null)??function(t,i,r,a,n){if(!i||!r)return null;if(a)return n?new uF(t,a,i,r,n):new uF(t,a,i,r);if(n&&n.size()!==i.length-1){let a=new Uint32Array(n.size()),s=0;for(let t=0;t<n.size();t++)a[t]=n.get(t)?s++:0;return new uF(t,a,i,r,n)}return n?new uL(t,i,r,n):new uL(t,i,r)}(t,w,T,g,b)}(s.name,i,r,s.nullable?t-1:t,h);case 0:let c,d,p,f,m,_;return d=(c=ut(i,r)).numValues,p=r.get(),f=uO(u)?u:void 0,m=uD(i,d,c.byteLength,r,f),r.set(p+c.byteLength),_=new ui(m,d),new uE(s.name,_,u);case 6:case 5:return function(t,i,r,a,n){let s,o=ut(t,i),l=up(o,a,t,i,"int64"),h=5===n.physicalType;if(l===G.FLAT){let n=uO(a)?a:void 0,s=h?function(t,i,r,a){let n;var s=h1(t,i,r.numValues);switch(r.logicalLevelTechnique1){case B.DELTA:if(r.logicalLevelTechnique2===B.RLE){if(!a)return function(t,i,r){let a=new BigInt64Array(r),n=0,s=0n;for(let r=0;r<i;r++){let o=Number(t[r]),l=h3(t[r+i]);for(let t=0;t<o;t++)s+=l,a[n++]=s}return a}(s,r.runs,r.numRleValues);n=h9(s=h4(s,r.runs,r.numRleValues))}else n=h9(s);break;case B.RLE:n=function(t,i,r){if(void 0===r){r=0;for(let a=0;a<i;a++)r+=Number(t[a])}let a=new BigInt64Array(r),n=0;for(let r=0;r<i;r++){let s=Number(t[r]),o=t[r+i];o=h3(o),a.fill(o,n,n+s),n+=s}return a}(s,r.runs,r.numRleValues);break;case B.NONE:n=function(t){let i=new BigInt64Array(t.length);for(let r=0;r<t.length;r++)i[r]=h3(t[r]);return i}(s);break;default:throw Error(`The specified Logical level technique is not supported: ${r.logicalLevelTechnique1}`)}return a?ur(n,a,0n):n}(t,i,o,n):uc(t,i,o,n);return new uf(r.name,s,a)}if(l===G.SEQUENCE){let a=uu(t,i,o);return new um(r.name,a[0],a[1],o.numRleValues)}let u=h?1===(s=h1(t,i,o.numValues)).length?h3(s[0]):h3(s[1]):ud(t,i,o);return new uA(r.name,u,a,h)}(i,r,s,u,n);case 7:let g,y,x,v,b,w;return v=ut(i,r),b=uO(u)?u:void 0,o=v.numValues,y=(g=r.get())+o*Float32Array.BYTES_PER_ELEMENT,x=new Float32Array(new Uint8Array(i.subarray(g,y)).buffer),r.set(y),w=b?ur(x,b,0):x,new uC(s.name,w,u);case 8:let T,S,P,M,I,E;return M=ut(i,r),I=uO(u)?u:void 0,l=M.numValues,S=(T=r.get())+l*Float64Array.BYTES_PER_ELEMENT,P=new Float64Array(new Uint8Array(i.subarray(T,S)).buffer),r.set(S),E=I?ur(P,I,0):P,new h$(s.name,E,u);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}(i,t,r,n,a.scalarType,a):0===i?null:function(t,i,r,a){let n=null,s=null,o=null,l=null,h=!1;for(;!h;){let r=ut(t,i);switch(r.physicalStreamType){case V.LENGTH:U.DICTIONARY===r.logicalStreamType.lengthType?n=u
2s(t,i,r):o=us(t,i,r);break;case V.DATA:j.SINGLE===r.logicalStreamType.dictionaryType||j.SHARED===r.logicalStreamType.dictionaryType?(s=t.subarray(i.get(),i.get()+r.byteLength),h=!0):l=t.subarray(i.get(),i.get()+r.byteLength),i.add(r.byteLength)}}let u=r.complexType.children,c=[],d=0;for(let h of u){let u=h0(t,i,1)[0];if(0===u)continue;let p=h.name?`${r.name}${h.name}`:r.name;if(2!==u||"scalarField"!==h.type||9!==h.scalarField.physicalType)throw Error("Currently only optional string fields are implemented for a struct.");let f=ut(t,i),m=uD(t,f.numValues,f.byteLength,i),_=ut(t,i),g=un(t,i,_,0,_.decompressedCount!==a?new ui(m,f.numValues):void 0);c[d++]=l?new uB(p,g,n,s,o,l,new ui(m,f.numValues)):new uF(p,g,n,s,new ui(m,f.numValues))}return c}(t,r,a,n));if(s)if(Array.isArray(s))for(let t of s)p.push(t);else p.push(s)}}}let m=new hH(u.name,d,c,p,h);a.push(m),r.set(o)}return a}(new Uint8Array(t));this.layers=i.reduce((t,i)=>Object.assign(Object.assign({},t),{[i.name]:new uG(i)}),{})}}class uZ{constructor(t,i){this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{},this.extent=i,"id"in t&&("string"==typeof t.id?this.id=parseInt(t.id,10):"number"!=typeof t.id||isNaN(t.id)||(this.id=t.id))}loadGeometry(){let t=[];for(let i of 1===this.feature.type?[this.feature.geometry]:this.feature.geometry){let r=[];for(let t of i)r.push(new w(t[0],t[1]));t.push(r)}return t}}let uq="_geojsonTileLayer";function uW(t,i){if(!t.feature)return;let r=t.feature;void 0!==r.id&&i.writeVarintField(1,r.id),i.writeMessage(2,uH,t),i.writeVarintField(3,r.type),i.writeMessage(4,uX,r)}function uH(t,i){for(let r in t.feature?.properties){let a=t.feature.properties[r],n=t.keycache[r];if(null==a)continue;void 0===n&&(t.keys.push(r),n=t.keys.length-1,t.keycache[r]=n),i.writeVarint(n),"string"!=typeof a&&"boolean"!=typeof a&&"number"!=typeof a&&(a=t.jsonPrefix+JSON.stringify(a));let s=typeof a+":"+a,o=t.valuecache[s];void 0===o&&(t.values.push(a),o=t.values.length-1,t.valuecache[s]=o),i.writeVarint(o)}}function uX(t,i){let r=t.loadGeometry(),a=t.type,n=0,s=0;for(let o of r){let r=1;1===a&&(r=o.length),i.writeVarint((r<<3)+1);let l=3===a?o.length-1:o.length;for(let t=0;t<l;t++){1===t&&1!==a&&i.writeVarint((l-1<<3)+2);let r=o[t].x-n,h=o[t].y-s;i.writeVarint(r<<1^r>>31),i.writeVarint(h<<1^h>>31),n+=r,s+=h}3===t.type&&i.writeVarint(15)}}function uY(t,i){let r=typeof t;"string"===r?i.writeStringField(1,t):"boolean"===r?i.writeBooleanField(7,t):"number"===r&&(t%1!=0?i.writeDoubleField(3,t):t<0?i.writeSVarintField(6,t):i.writeVarintField(5,t))}class uK{constructor(t,i){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new aD(8192,16,0),this.grid3D=new aD(8192,16,0),this.featureIndexArray=new nW,this.promoteId=i}insert(t,i,r,a,n,s){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,a,n);let l=s?this.grid3D:this.grid;for(let t of i){let i=[1/0,1/0,-1/0,-1/0];for(let r of t)i[0]=Math.min(i[0],r.x),i[1]=Math.min(i[1],r.y),i[2]=Math.max(i[2],r.x),i[3]=Math.max(i[3],r.y);i[0]<8192&&i[1]<8192&&i[2]>=0&&i[3]>=0&&l.insert(o,i[0],i[1],i[2],i[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new o$(new lY(this.rawTileData)).layers:new u$(this.rawTileData).layers,this.sourceLayerCoder=new hV(this.vtLayers?Object.keys(this.vtLayers).sort():[uq])),this.vtLayers}query(t,i,r,a){let n;this.loadVTLayers();let s=t.params,o=8192/t.tileSize/t.scale,l=rK(s.filter,s.globalState),h=t.queryGeometry,u=t.queryPadding*o,c=hO.fromPoints(h),d=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),p=hO.fromPoints(t.cameraQueryGeometry).expandBy(u);for(let i of this.grid3D.query(p.minX,p.minY,p.maxX,p.maxY,(i,r,a,n)=>(function(t,i,r,a,n){for(let s of t)if(i<=s.x&&r<=s.y&&a>=s.x&&n>=s.y)return!0;let s=[new w(i,r),new w(i,n),new w(a,n),new w(a,r)];if(t.length>2){for(let i of s)if(sN(t,i))return!0}for(let i=0;i<t.length-1;i++)if(function(t,i,r){let a=r[0],n=r[2];if(t.x<a.x&&i.x<a.x||t.x>n.x&&i.x>n.x||t.y<a.y&&i.y<a.y||t.y>n.y&&i.y>n.y)return!1;let s=eI(t,i,r[0]);return s!==eI(t,i,r[1])||s!==eI(t,i,r[2])||s!==eI(t,i,r[3])}(t[i],t[i+1],s))return!0;return!1})(t.cameraQueryGeometry,i-u,r-u,a+u,n+u)))d.push(i);d.sort(uQ);let f={};for(let u of d){if(u===n)continue;n=u;let c=this.featureIndexArray.get(u),d=null;
2this.loadMatchingFeature(f,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,l,s.layers,s.availableImages,i,r,a,(i,r,a)=>(d||(d=sD(i)),r.queryIntersectsFeature({queryGeometry:h,feature:i,featureState:a,geometry:d,zoom:this.z,transform:t.transform,pixelsToTileUnits:o,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,i,r,a,n,s,o,l,h,u,c){let d=this.bucketLayerIDs[i];if(s&&!d.some(t=>s.has(t)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(a);if(n.needGeometry){let t=sz(f,!0);if(!n.filter(new aX(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!n.filter(new aX(this.tileID.overscaledZ),f))return;let m=this.getId(f,p);for(let i of d){if(s&&!s.has(i))continue;let r=l[i];if(!r)continue;let n={};m&&u&&(n=u.getState(r.sourceLayer||uq,m));let d=ev({},h[i]);d.paint=uJ(d.paint,r.paint,f,n,o),d.layout=uJ(d.layout,r.layout,f,n,o);let p=!c||c(f,r,n);if(!p)continue;let _=new hj(f,this.z,this.x,this.y,m);_.layer=d;let g=t[i];void 0===g&&(g=t[i]=[]),g.push({featureIndex:a,feature:_,intersectionZ:p})}}lookupSymbolFeatures(t,i,r,a,n,s,o,l){let h={};this.loadVTLayers();let u=rK(n.filterSpec,n.globalState);for(let n of t)this.loadMatchingFeature(h,r,a,n,u,s,o,l,i);return h}hasLayer(t){for(let i of this.bucketLayerIDs)for(let r of i)if(t===r)return!0;return!1}getId(t,i){var r;let a=t.id;return this.promoteId&&("boolean"==typeof(a=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[i]])&&(a=Number(a)),void 0===a&&(null==(r=t.properties)?void 0:r.cluster)&&this.promoteId&&(a=Number(t.properties.cluster_id))),a}}function uJ(t,i,r,a,n){return ew(t,(t,s)=>{let o=i instanceof a6?i.get(s):null;return(null==o?void 0:o.evaluate)?o.evaluate(r,a,n):o})}function uQ(t,i){return i-t}function u0(t,i,r,a,n){let s=[];for(let o of t){let t;for(let l=0;l<o.length-1;l++){let h=o[l],u=o[l+1];h.x<i&&u.x<i||(h.x<i?h=new w(i,h.y+(i-h.x)/(u.x-h.x)*(u.y-h.y))._round():u.x<i&&(u=new w(i,h.y+(i-h.x)/(u.x-h.x)*(u.y-h.y))._round()),h.y<r&&u.y<r||(h.y<r?h=new w(h.x+(r-h.y)/(u.y-h.y)*(u.x-h.x),r)._round():u.y<r&&(u=new w(h.x+(r-h.y)/(u.y-h.y)*(u.x-h.x),r)._round()),h.x>=a&&u.x>=a||(h.x>=a?h=new w(a,h.y+(a-h.x)/(u.x-h.x)*(u.y-h.y))._round():u.x>=a&&(u=new w(a,h.y+(a-h.x)/(u.x-h.x)*(u.y-h.y))._round()),h.y>=n&&u.y>=n||(h.y>=n?h=new w(h.x+(n-h.y)/(u.y-h.y)*(u.x-h.x),n)._round():u.y>=n&&(u=new w(h.x+(n-h.y)/(u.y-h.y)*(u.x-h.x),n)._round()),t&&h.equals(t[t.length-1])||(t=[h],s.push(t)),t.push(u)))))}}return s}function u1(t,i,r,a,n){switch(i){case 1:let s=[];for(let i of t)for(let t of i){let i=0===n?t.x:t.y;i>=r&&i<=a&&s.push([t])}return s;case 2:return u2(t,r,a,n,!1);case 3:return u2(t,r,a,n,!0)}return[]}function u2(t,i,r,a,n){let s=[];for(let o of t){let t=function(t,i,r,a,n){let s=0===a?u3:u5,o=[],l=[];for(let h=0;h<t.length-1;h++){let u=t[h],c=t[h+1],d=0===a?u.x:u.y,p=0===a?c.x:c.y,f=!1;d<i?p>i&&o.push(s(u,c,i)):d>r?p<r&&o.push(s(u,c,r)):o.push(u),p<i&&d>=i&&(o.push(s(u,c,i)),f=!0),p>r&&d<=r&&(o.push(s(u,c,r)),f=!0),!n&&f&&(l.push(o),o=[])}let h=t.length-1,u=0===a?t[h].x:t[h].y;return u>=i&&u<=r&&o.push(t[h]),n&&o.length>0&&!o[0].equals(o[o.length-1])&&o.push(new w(o[0].x,o[0].y)),o.length>0&&l.push(o),l}(o,i,r,a,n);t.length>0&&s.push(...t)}return s}function u3(t,i,r){return new w(r,t.y+(r-t.x)/(i.x-t.x)*(i.y-t.y))}function u5(t,i,r){return new w(t.x+(r-t.y)/(i.y-t.y)*(i.x-t.x),r)}ak("FeatureIndex",uK,{omit:["rawTileData","sourceLayerCoder"]});class u6 extends w{constructor(t,i,r,a){super(t,i),this.angle=r,void 0!==a&&(this.segment=a)}clone(){return new u6(this.x,this.y,this.angle,this.segment)}}function u4(t,i,r,a,n){if(void 0===i.segment||0===r)return!0;let s=i,o=i.segment+1,l=0;for(;l>-r/2;){if(--o<0)return!1;l-=t[o].dist(s),s=t[o]}l+=t[o].dist(t[o+1]),o++;let h=[],u=0;for(;l<r/2;){let i=t[o],r=t[o+1];if(!r)return!1;let s=t[o-1].angleTo(i)-i.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:l,angleDelta:s}),u+=s;l-h[0].distance>a;)u-=h.shift().angleDelta;if(u>n)return!1;o++,l+=i.dist(r)}return!0}function u8(t){let i=0;for(let r=0;r<t.length-1;r++)i+=t[r].dist(t[r+1]);return i}function u7(t,i){return Math.max(t?t.right-t.left:0,i?i.right-i.left:0)}function u9(t,i,r,a){let n=[],s=t.image,o=s.pixelRatio,l=s.paddedRect.w-2,h=s.paddedRect.h-2,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},c=s.stretchX||[[0,l]],d=s.stretchY||[[0,h]],p=(t,i)=>t+i[1]-i[0],f=c.reduce(p,0),m=d.reduce(p,0),_=l-f,g=h-m,y=0,x=f,v=0,b=m,T=0,S=_,P=0,M=g;if(s.content&&a){let i=s.content,r=i[2]-i[0],a=i[3]-i[1];(s.textFitWidth||s.textFitHeight)&&(u=hs(t)),y=ce(c,0,i[0]),v=ce(d,0,i[1]),x=ce(c,i[0],i[2]),b=ce(d,i[1],i[3]),T=i[0]-y,P=i[1]-v,S=r-x,M=a-b}let I=u.x1,E=u.y1,C=u.x2-I,A=u.y2-E,D=(t,a,n,l)=>{var h,u,c,d,p,_,g,D,z,k,R,L,F,B,O,V;let j=(h=t.stretch-y,h/x*C+I),N=(u=t.fixed-T,c=S,d=t.stretch,u-c*d/f),U=(p=a.stretch-v,p/b*A+E),G=(_=a.fixed-P,g=M,D=a.stretch,_-g*D/m),$=(z=n.stretch-y,z/x*C+I),Z=(k=n.fixed-T,R=S,L=n.stretch,k-R*L/f),q=(F=l.stretch-v,F/b*A+E),W=(B=l.fixed-P,O=M,V=l.stretch,B-O*V/m),H=new w(j,U),X=new w($,U),Y=new w($,q),K=new w(j,q),J=new w(N/o,G/o),Q=new w(Z/o,W/o),ee=i*Math.PI/180;if(ee){let t=Math.sin(ee),i=Math.cos(ee),r=[i,-t,t,i];H._matMult(r),X._matMult(r),K._matMult(r),Y._matMult(r)}let et=t.stretch+t.fixed,ei=a.stretch+a.fixed;return{tl:H,tr:X,bl:K,br:Y,tex:{x:s.paddedRect.x+1+et,y:s.paddedRect.y+1+ei,w:n.stretch+n.fixed-et,h:l.stretch+l.fixed-ei},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:J,pixelOffsetBR:Q,minFontScaleX:S/o/C,minFontScaleY:M/o/A,isSDF:r}};if(a&&(s.stretchX||s.stretchY)){let t=ct(c,_,f),i=ct(d,g,m);for(let r=0;r<t.length-1;r++){let a=t[r],s=t[r+1];for(let t=0;t<i.length-1;t++)n.push(D(a,i[t],s,i[t+1]))}}
2else n.push(D({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:h+1}));return n}function ce(t,i,r){let a=0;for(let n of t)a+=Math.max(i,Math.min(r,n[1]))-Math.max(i,Math.min(r,n[0]));return a}function ct(t,i,r){let a=[{fixed:-1,stretch:0}];for(let[i,r]of t){let t=a[a.length-1];a.push({fixed:i-t.stretch,stretch:t.stretch}),a.push({fixed:i-t.stretch,stretch:t.stretch+(r-i)})}return a.push({fixed:i+1,stretch:r}),a}ak("Anchor",u6);class ci{constructor(t,i,r,a,n,s,o,l,h,u){var c;if(this.boxStartIndex=t.length,h){let t=s.top,i=s.bottom;const r=s.collisionPadding;r&&(t-=r[1],i+=r[3]);let a=i-t;a>0&&(a=Math.max(10,a),this.circleDiameter=a)}else{const h=(null==(c=s.image)?void 0:c.content)&&(s.image.textFitWidth||s.image.textFitHeight)?hs(s):{x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};h.y1=h.y1*o-l[0],h.y2=h.y2*o+l[2],h.x1=h.x1*o-l[3],h.x2=h.x2*o+l[1];const d=s.collisionPadding;if(d&&(h.x1-=d[0]*o,h.y1-=d[1]*o,h.x2+=d[2]*o,h.y2+=d[3]*o),u){const t=new w(h.x1,h.y1),i=new w(h.x2,h.y1),r=new w(h.x1,h.y2),a=new w(h.x2,h.y2),n=u*Math.PI/180;t._rotate(n),i._rotate(n),r._rotate(n),a._rotate(n),h.x1=Math.min(t.x,i.x,r.x,a.x),h.x2=Math.max(t.x,i.x,r.x,a.x),h.y1=Math.min(t.y,i.y,r.y,a.y),h.y2=Math.max(t.y,i.y,r.y,a.y)}t.emplaceBack(i.x,i.y,h.x1,h.y1,h.x2,h.y2,r,a,n)}this.boxEndIndex=t.length}}class cr{constructor(t=[],i=(t,i)=>t<i?-1:+(t>i)){if(this.data=t,this.length=this.data.length,this.compare=i,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;let t=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:i,compare:r}=this,a=i[t];for(;t>0;){let n=t-1>>1,s=i[n];if(r(a,s)>=0)break;i[t]=s,t=n}i[t]=a}_down(t){let{data:i,compare:r}=this,a=this.length>>1,n=i[t];for(;t<a;){let a=1+(t<<1),s=a+1;if(s<this.length&&0>r(i[s],i[a])&&(a=s),r(i[a],n)>=0)break;i[t]=i[a],t=a}i[t]=n}}function ca(t,i){return i.max-t.max}class cn{constructor(t,i,r,a){this.p=new w(t,i),this.h=r,this.d=function(t,i){let r=!1,a=1/0;for(let n of i)for(let i=0,s=n.length,o=s-1;i<s;o=i++){let s=n[i],l=n[o];s.y>t.y!=l.y>t.y&&t.x<(l.x-s.x)*(t.y-s.y)/(l.y-s.y)+s.x&&(r=!r),a=Math.min(a,sV(t,s,l))}return(r?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}t.aM=void 0,(W=t.aM||(t.aM={}))[W.center=1]="center",W[W.left=2]="left",W[W.right=3]="right",W[W.top=4]="top",W[W.bottom=5]="bottom",W[W["top-left"]=6]="top-left",W[W["top-right"]=7]="top-right",W[W["bottom-left"]=8]="bottom-left",W[W["bottom-right"]=9]="bottom-right";let cs=1/0;function co(t,i){return i[1]!==cs?function(t,i,r){let a=0,n=0;switch(i=Math.abs(i),r=Math.abs(r),t){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(t){case"top-right":case"bottom-right":case"right":a=-i;break;case"top-left":case"bottom-left":case"left":a=i}return[a,n]}(t,i[0],i[1]):function(t,i){let r=0,a=0;i<0&&(i=0);let n=i/Math.SQRT2;switch(t){case"top-right":case"top-left":a=n-7;break;case"bottom-right":case"bottom-left":a=7-n;break;case"bottom":a=7-i;break;case"top":a=i-7}switch(t){case"top-right":case"bottom-right":r=-n;break;case"top-left":case"bottom-left":r=n;break;case"left":r=i;break;case"right":r=-i}return[r,a]}(t,i[0])}function cl(t,i,r){var a;let n=t.layout,s=null==(a=n.get("text-variable-anchor-offset"))?void 0:a.evaluate(i,{},r);if(s){let t=s.values,i=[];for(let r=0;r<t.length;r+=2){let a=i[r]=t[r],n=t[r+1].map(t=>24*t);a.startsWith("top")?n[1]-=7:a.startsWith("bottom")&&(n[1]+=7),i[r+1]=n}return new t2(i)}let o=n.get("text-variable-anchor");if(o){let a;a=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[24*n.get("text-radial-offset").evaluate(i,{},r),cs]:n.get("text-offset").evaluate(i,{},r).map(t=>24*t);let s=[];for(let t of o)s.push(t,co(t,a));return new t2(s)}return null}function ch(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function cu(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m){let _=function(t,i,r,a,n,s,o){let l=r.layout.get("text-rotate").evaluate(n,{})*Math.PI/180,h=[];for(let r of t.positionedLines)for(let n of r.positionedGlyphs){if(!n.rect)continue;let u=n.rect||{},c=4,d=!0,p=1,f=0,m=(a||o)&&n.vertical,_=n.metrics.advance*n.scale/2;if(o&&t.verticalizable&&(f=r.lineOffset/2-(n.imageName?-(24-n.metrics.width*n.scale)/2:(n.scale-1)*24)),n.imageName){let t=s[n.imageName];d=t.sdf,c=1/(p=t.pixelRatio)}let g=a?[n.x+_,n.y]:[0,0],y=a?[0,0]:[n.x+_+i[0],n.y+i[1]-f],x=[0,0];m&&(x=y,y=[0,0]);let v=n.metrics.isDoubleResolution?2:1,b=(n.metrics.left-c)*n.scale-_+y[0],T=(-n.metrics.top-c)*n.scale+y[1],S=b+u.w/v*n.scale/p,P=T+u.h/v*n.scale/p,M=new w(b,T),I=new w(S,T),E=new w(b,P),C=new w(S,P);if(m){let t=new w(-_,_- -17),i=-Math.PI/2,r=12-_,a=new w(22-r,-(n.imageName?r:0)),s=new w(...x);
2M._rotateAround(i,t)._add(a)._add(s),I._rotateAround(i,t)._add(a)._add(s),E._rotateAround(i,t)._add(a)._add(s),C._rotateAround(i,t)._add(a)._add(s)}if(l){let t=Math.sin(l),i=Math.cos(l),r=[i,-t,t,i];M._matMult(r),I._matMult(r),E._matMult(r),C._matMult(r)}let A=new w(0,0),D=new w(0,0);h.push({tl:M,tr:I,bl:E,br:C,tex:u,writingMode:t.writingMode,glyphOffset:g,sectionIndex:n.sectionIndex,isSDF:d,pixelOffsetTL:A,pixelOffsetBR:D,minFontScaleX:0,minFontScaleY:0})}return h}(r,l,n,s,o,a,t.allowVerticalPlacement),g=t.textSizeData,y=null;for(let r of("source"===g.kind?(y=[128*n.layout.get("text-size").evaluate(o,{})])[0]>32640&&eM(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===g.kind&&((y=[128*f.compositeTextSizes[0].evaluate(o,{},m),128*f.compositeTextSizes[1].evaluate(o,{},m)])[0]>32640||y[1]>32640)&&eM(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),t.addSymbols(t.text,_,y,l,s,o,u,i,h.lineStartIndex,h.lineLength,p,m),c))d[r]=t.text.placedSymbolArray.length-1;return 4*_.length}function cc(t){for(let i in t)return t[i];return null}t.$=ej,t.A=K,t.B=aK,t.C=aA,t.D=a4,t.E=eQ,t.F=av,t.G=function([t,i,r]){return i+=90,{x:t*Math.cos(i*=Math.PI/180)*Math.sin(r*=Math.PI/180),y:t*Math.sin(i)*Math.sin(r),z:t*Math.cos(r)}},t.H=iE,t.I=ht,t.J=aX,t.K=aI,t.L=function(t){if(null==eC){let i=t.navigator?t.navigator.userAgent:null;eC=!!t.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return eC},t.M=e$,t.N=class{constructor(t,i){this.target=t,this.mapId=i,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new hw(()=>this.process()),this.subscription=ek(this.target,"message",t=>this.receive(t),!1),this.globalScope=eE(self)?t:window}registerMessageHandler(t,i){this.messageHandlers[t]=i}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,i){return new Promise((r,a)=>{let n=Math.round(1e18*Math.random()).toString(36).substring(0,10),s=i?ek(i.signal,"abort",()=>{null==s||s.unsubscribe(),delete this.resolveRejects[n];let i={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(i)},hT):null;this.resolveRejects[n]={resolve:t=>{null==s||s.unsubscribe(),r(t)},reject:t=>{null==s||s.unsubscribe(),a(t)}};let o=[],l=Object.assign(Object.assign({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:aB(t.data,o)});this.target.postMessage(l,{transfer:o})})}receive(t){let i=t.data,r=i.id,a=["file://","resource://android","null"],n=[i.origin,location.origin],s=i.origin===location.origin,o=n.some(t=>a.includes(t));if((s||o)&&(!i.targetMapId||this.mapId===i.targetMapId)){if("<cancel>"===i.type){delete this.tasks[r];let t=this.abortControllers[r];return delete this.abortControllers[r],void(t&&t.abort())}if(eE(self)||i.mustQueue)return this.tasks[r]=i,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,i)}}process(){if(0===this.taskQueue.length)return;let t=this.taskQueue.shift(),i=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),i&&this.processTask(t,i)}processTask(t,i){return b(this,void 0,void 0,function*(){if("<response>"===i.type){let r=this.resolveRejects[t];if(delete this.resolveRejects[t],!r)return;return void(i.error?r.reject(ed(aO(i.error))):r.resolve(aO(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(t,Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let r=aO(i.data),a=new AbortController;this.abortControllers[t]=a;try{let n=yield this.messageHandlers[i.type](i.sourceMapId,r,a);this.completeTask(t,null,n)}catch(i){this.completeTask(t,ed(i))}})}completeTask(t,i,r){let a=[];delete this.abortControllers[t];let n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:i?aB(i):null,data:aB(r,a)};this.target.postMessage(n,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},t.O=function(){var t=new K(16);return K!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.P=w,t.Q=function(t,i,r){var a,n,s,o,l,h,u,c,d,p,f,m,_=r[0],g=r[1],y=r[2];return i===t?(t[12]=i[0]*_+i[4]*g+i[8]*y+i[12],t[13]=i[1]*_+i[5]*g+i[9]*y+i[13],t[14]=i[2]*_+i[6]*g+i[10]*y+i[14],t[15]=i[3]*_+i[7]*g+i[11]*y+i[15]):(n=i[1],s=i[2],o=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],t[0]=a=i[0],t[1]=n,t[2]=s,t[3]=o,t[4]=l,t[5]=h,t[6]=u,t[7]=c,t[8]=d,t[9]=p,t[10]=f,t[11]=m,t[12]=a*_+l*g
2+d*y+i[12],t[13]=n*_+h*g+p*y+i[13],t[14]=s*_+u*g+f*y+i[14],t[15]=o*_+c*g+m*y+i[15]),t},t.R=s6,t.S=function(t,i,r){var a=r[0],n=r[1],s=r[2];return t[0]=i[0]*a,t[1]=i[1]*a,t[2]=i[2]*a,t[3]=i[3]*a,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[7]=i[7]*n,t[8]=i[8]*s,t[9]=i[9]*s,t[10]=i[10]*s,t[11]=i[11]*s,t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},t.T=or,t.U=function(t,i,r){var a=i[0],n=i[1],s=i[2],o=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],_=i[12],g=i[13],y=i[14],x=i[15],v=r[0],b=r[1],w=r[2],T=r[3];return t[0]=v*a+b*l+w*d+T*_,t[1]=v*n+b*h+w*p+T*g,t[2]=v*s+b*u+w*f+T*y,t[3]=v*o+b*c+w*m+T*x,t[4]=(v=r[4])*a+(b=r[5])*l+(w=r[6])*d+(T=r[7])*_,t[5]=v*n+b*h+w*p+T*g,t[6]=v*s+b*u+w*f+T*y,t[7]=v*o+b*c+w*m+T*x,t[8]=(v=r[8])*a+(b=r[9])*l+(w=r[10])*d+(T=r[11])*_,t[9]=v*n+b*h+w*p+T*g,t[10]=v*s+b*u+w*f+T*y,t[11]=v*o+b*c+w*m+T*x,t[12]=(v=r[12])*a+(b=r[13])*l+(w=r[14])*d+(T=r[15])*_,t[13]=v*n+b*h+w*p+T*g,t[14]=v*s+b*u+w*f+T*y,t[15]=v*o+b*c+w*m+T*x,t},t.V=function(t,i){let r={};for(let a of i)a in t&&(r[a]=t[a]);return r},t.W=hS,t.X=ex,t.Y=hE,t.Z=hI,t._=b,t.a=eV,t.a$=function(t){var i=new K(3);return i[0]=t[0],i[1]=t[1],i[2]=t[2],i},t.a0=X,t.a1=Y,t.a2=ez,t.a3=hF,t.a4=hC,t.a5=hA,t.a6=8192,t.a7=hz,t.a8=hO,t.a9=25,t.aA=function(t){var i=t[0],r=t[1];return Math.sqrt(i*i+r*r)},t.aB=function(t){return t[0]=0,t[1]=0,t},t.aC=function(t,i,r){return t[0]=i[0]*r,t[1]=i[1]*r,t},t.aD=hd,t.aE=es,t.aF=function(t,i,r,a){let n=i.y-t.y,s=i.x-t.x,o=a.y-r.y,l=a.x-r.x,h=o*s-l*n;if(0===h)return null;let u=(l*(t.y-r.y)-o*(t.x-r.x))/h;return new w(t.x+u*s,t.y+u*n)},t.aG=u0,t.aH=sR,t.aI=function(t){let i=1/0,r=1/0,a=-1/0,n=-1/0;for(let s of t)i=Math.min(i,s.x),r=Math.min(r,s.y),a=Math.max(a,s.x),n=Math.max(n,s.y);return[i,r,a,n]},t.aJ=24,t.aK=ec,t.aL=function(t,i,r,a,n=!1){if(!r[0]&&!r[1])return[0,0];let s=n?"map"===a?-t.bearingInRadians:0:"viewport"===a?t.bearingInRadians:0;if(s){let t=Math.sin(s),i=Math.cos(s);r=[r[0]*i-r[1]*t,r[0]*t+r[1]*i]}return[n?r[0]:ec(i,r[0],t.zoom),n?r[1]:ec(i,r[1],t.zoom)]},t.aN=hh,t.aO=ch,t.aP=ha,t.aQ=t=>"symbol"===t.type,t.aR=o0,t.aS=nu,t.aT=oI,t.aU=nH,t.aV=se,t.aW=n8,t.aX=eL,t.aY=hD,t.aZ=ea,t.a_=er,t.aa=hR,t.ab=t=>{let i=window.document.createElement("video");return i.muted=!0,new Promise(r=>{for(let a of(i.onloadstart=()=>{r(i)},t)){let t=window.document.createElement("source");eH(a)||(i.crossOrigin="Anonymous"),t.src=a,i.appendChild(t)}})},t.ac=e9,t.ad=function(){return eb++},t.ae=nB,t.af=hm,t.ag=uq,t.ah=rK,t.ai=sz,t.aj=hj,t.ak=function(t){let i={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,r,a,n)=>{let s=a||n;return i[r]=!s||s.toLowerCase(),""}),i["max-age"]){let t=parseInt(i["max-age"],10);isNaN(t)?delete i["max-age"]:i["max-age"]=t}return i},t.al=ey,t.am=85.051129,t.an=eR,t.ao=function(t){return Math.pow(2,t)},t.ap=Q,t.aq=function(t,i){return t/hM(i)},t.ar=function(t){return Math.log(t)/Math.LN2},t.as=function(t){var i=t[0],r=t[1];return i*i+r*r},t.at=function(t){if(!t.length)return new Set;let i=Math.max(...t.map(t=>t.canonical.z)),r=1/0,a=-1/0,n=1/0,s=-1/0,o=[];for(let l of t){let{x:t,y:h,z:u}=l.canonical,c=Math.pow(2,i-u),d=t*c,p=h*c;o.push({id:l,x:d,y:p}),d<r&&(r=d),d>a&&(a=d),p<n&&(n=p),p>s&&(s=p)}let l=new Set;for(let t of o)t.x!==r&&t.x!==a&&t.y!==n&&t.y!==s||l.add(t.id);return l},t.au=function(t,i){let r=Math.abs(2*t.wrap)-(t.wrap<0),a=Math.abs(2*i.wrap)-(i.wrap<0);return t.overscaledZ-i.overscaledZ||a-r||i.canonical.y-t.canonical.y||i.canonical.x-t.canonical.x},t.av=class{constructor(t,i){this.max=t,this.onRemove=i,this.reset()}reset(){for(let t in this.data)for(let i of this.data[t])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(t,i,r){let a=t.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);let n={value:i,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(t,n)},r)),this.data[a].push(n),this.order.push(a),this.order.length>this.max){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){let i=this.data[t].shift();return i.timeout&&clearTimeout(i.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),i.value}getByKey(t){let i=this.data[t];return i?i[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,i){if(!this.has(t))return this;let r=t.wrapped().key,a=void 0===i?0:this.data[r].indexOf(i),n=this.data[r][a];return this.data[r].splice(a,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){let i=[];for(let r in this.data)for(let a of this.data[r])t(a.value)||i.push(a);for(let t of i)this.remove(t.value.tileID,t)}},t.aw=function(t,i){let r=0,a=0;if("constant"===t.kind)a=t.layoutSize;else if("source"!==t.kind){let{interpolationType:n,minZoom:s,maxZoom:
2o}=t,l=n?ey(iM.interpolationFactor(n,i,s,o),0,1):0;"camera"===t.kind?a=iE.number(t.minSize,t.maxSize,l):r=l}return{uSizeT:r,uSize:a}},t.ay=function(t,{uSize:i,uSizeT:r},{lowerSize:a,upperSize:n}){return"source"===t.kind?a/128:"composite"===t.kind?iE.number(a/128,n/128,r):i},t.az=eh,t.b=eA,t.b$=sg,t.b0=function(t,i,r){return t[0]=i[0]-r[0],t[1]=i[1]-r[1],t[2]=i[2]-r[2],t},t.b1=function(t,i){var r=i[0],a=i[1],n=i[2],s=r*r+a*a+n*n;return s>0&&(s=1/Math.sqrt(s)),t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t},t.b2=en,t.b3=function(t,i){return t[0]*i[0]+t[1]*i[1]+t[2]*i[2]},t.b4=function(t,i,r){return t[0]=i[0]*r[0],t[1]=i[1]*r[1],t[2]=i[2]*r[2],t[3]=i[3]*r[3],t},t.b5=et,t.b6=function(t,i,r){let a=i[0]*r[0]+i[1]*r[1]+i[2]*r[2];return 0===a?null:(-(t[0]*r[0]+t[1]*r[1]+t[2]*r[2])-r[3])/a},t.b7=et,t.b8=function(t,i,r){return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=i[3]*r,t},t.b9=function(t,i){return t[0]*i[0]+t[1]*i[1]+t[2]*i[2]+t[3]},t.bA=el,t.bB=function(t,i,r){var a=r[0],n=r[1],s=r[2],o=r[3],l=i[0],h=i[1],u=i[2],c=n*u-s*h,d=s*l-a*u,p=a*h-n*l;return t[0]=l+o*(c+=c)+n*(p+=p)-s*(d+=d),t[1]=h+o*d+s*c-a*p,t[2]=u+o*p+a*d-n*c,t},t.bC=function(t,i,r){var a,n,s,o,l,h,u;let c=(a=[t[0],t[1],t[2],i[0],i[1],i[2],r[0],r[1],r[2]])[0]*((u=a[8])*(s=a[4])-(o=a[5])*(h=a[7]))+a[1]*(-u*(n=a[3])+o*(l=a[6]))+a[2]*(h*n-s*l);if(0===c)return null;let d=en([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),p=en([],[r[0],r[1],r[2]],[t[0],t[1],t[2]]),f=en([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),m=ea([],d,-t[3]);return er(m,m,ea([],p,-i[3])),er(m,m,ea([],f,-r[3])),ea(m,m,1/c),m},t.bD=6371008.8,t.bE=function(){return new Float64Array(4)},t.bF=function(t,i,r,a){var n=[],s=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],s[0]=n[0]*Math.cos(a)-n[1]*Math.sin(a),s[1]=n[0]*Math.sin(a)+n[1]*Math.cos(a),s[2]=n[2],t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t},t.bG=function(t,i,r,a){var n=[],s=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],s[0]=n[0],s[1]=n[1]*Math.cos(a)-n[2]*Math.sin(a),s[2]=n[1]*Math.sin(a)+n[2]*Math.cos(a),t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t},t.bH=function(t,i,r,a){var n=[],s=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],s[0]=n[2]*Math.sin(a)+n[0]*Math.cos(a),s[1]=n[1],s[2]=n[2]*Math.cos(a)-n[0]*Math.sin(a),t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t},t.bI=function(t,i,r){var a=Math.sin(r),n=Math.cos(r),s=i[0],o=i[1],l=i[2],h=i[3],u=i[8],c=i[9],d=i[10],p=i[11];return i!==t&&(t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15]),t[0]=s*n-u*a,t[1]=o*n-c*a,t[2]=l*n-d*a,t[3]=h*n-p*a,t[8]=s*a+u*n,t[9]=o*a+c*n,t[10]=l*a+d*n,t[11]=h*a+p*n,t},t.bJ=function(t,i){let r=ep(t,360),a=ep(i,360),n=a-r,s=a>r?n-360:n+360;return Math.abs(n)<Math.abs(s)?n:s},t.bK=function(t){return t[0]=0,t[1]=0,t[2]=0,t},t.bL=function(t,i,r,a){let n=Math.sqrt(t*t+i*i),s=Math.sqrt(r*r+a*a);t/=n,i/=n;let o=Math.acos(t*(r/=s)+i*(a/=s));return-i*r+t*a>0?o:-o},t.bM=function(t,i){let r=ep(t,2*Math.PI),a=ep(i,2*Math.PI);return Math.min(Math.abs(r-a),Math.abs(r-a+2*Math.PI),Math.abs(r-a-2*Math.PI))},t.bN=function(){let t={},i=e0.$version;for(let r in e0.$root){let a=e0.$root[r];if(a.required){let n=null;null!=(n="version"===r?i:"array"===a.type?[]:{})&&(t[r]=n)}}return t},t.bO=eq,t.bP=aV,t.bQ=function t(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let a=0;a<i.length;a++)if(!t(i[a],r[a]))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 a in i)if(!t(i[a],r[a]))return!1;return!0}return i===r},t.bR=eN,t.bS=function(t){t=t.slice();let i=Object.create(null);for(let r=0;r<t.length;r++)i[t[r].id]=t[r];for(let r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=function(t,i){let r={};for(let i in t)"ref"!==i&&(r[i]=t[i]);return e1.forEach(t=>{t in i&&(r[t]=i[t])}),r}(t[r],i[t[r].ref]));return t},t.bT=function(t,i){if("custom"===t.type)return new hb(t,i);switch(t.type){case"background":return new hv(t,i);case"circle":return new sJ(t,i);case"color-relief":return new os(t,i);case"fill":return new oL(t,i);case"fill-extrusion":return new oY(t,i);case"heatmap":return new s9(t,i);case"hillshade":return new ot(t,i);case"line":return new lF(t,i);case"raster":return new ns(t,i);case"symbol":return new hy(t,i)}},t.bU=t=>"raster"===t.type,t.bV=eS,t.bW=function(t,i){if(!t)return[{command:"setStyle",args:[i]}];let r=[];try{if(!e2(t.version,i.version))return[{command:"setStyle",args:[i]}];e2(t.center,i.center)||r.push({command:"setCenter",args:[i.center]}),e2(t.state,i.state)||r.push({command:"setGlobalState",args:[i.state]}),e2(t.centerAltitude,i.centerAltitude)||r.push({command:"setCenterAltitude",args:[i.centerAltitude]}),e2(t.zoom,i.zoom)||r.push({command:"setZoom",args:[i.zoom]}),e2(t.bearing,i.bearing)||r.push({command:"setBearing",args:[i.bearing]}),e2(t.pitch,i.pitch)||r.push({command:"setPitch",args:[i.pitch]}),e2(t.roll,i.roll)||r.push({command:"setRoll",args:[i.roll]}),e2(t.sprite,i.sprite)||r.push({command:"setSprite",args:[i.sprite]}),e2(t.glyphs,i.glyphs)||r.push({command:"setGlyphs",args:[i.glyphs]}),e2(t.transition,i.transition)||r.push({command:"setTransition",args:[i.transition]}),e2(t.light,i.light)||r.push({command:"setLight",args:[i.light]}),e2(t.terrain,i.terrain)||r.push({command:"setTerrain",args:[i.terrain]}),e2(t.sky,i.sky)||r.push({command:"setSky",args:[i.sky]}),e2(t.projection,i.projection)||r.push({command:"setProjection",args:[i.projection]});let a={},n=[];!function(t,i,r,a){let n;for(n in i=i||{},t=t||{})Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(i,n)||e6(n,r,a));for(n in i){var s;Object.prototype.hasOwnProperty.call(i,n)&&(Object.prototype.hasOwnProperty.call(t,n)?e2(t[n],i[n])||("geojson"===t[n].type&&"geojson"===i[n].type&&function(t,i,r){let a;for(a in t[r])if(Object.prototype.hasOwnProperty.call(t[r],a)&&"data"!==a&&!e2(t[r][a],i[r][a]))return!1;for(a in i[r])if(Object.prototype.hasOwnProperty.call(i[r],a)&&"data"!==a&&!e2(t[r][a],i[r][a]))return!1;return!0}(t,i,n)?e3(r,{command:"setGeoJSONSourceData",args:[n,i[n].data]}):(s=i,e6(n,r,a),e5(n,s,r))):e5(n,i,r))}}(t.sources,i.sources,n,a);let s=[];
2t.layers&&t.layers.forEach(t=>{"source"in t&&a[t.source]?r.push({command:"removeLayer",args:[t.id]}):s.push(t)}),r=r.concat(n),function(t,i,r){let a,n,s,o,l;i=i||[];let h=(t=t||[]).map(e8),u=i.map(e8),c=t.reduce(e7,{}),d=i.reduce(e7,{}),p=h.slice(),f=Object.create(null);for(let t=0,i=0;t<h.length;t++)a=h[t],Object.prototype.hasOwnProperty.call(d,a)?i++:(e3(r,{command:"removeLayer",args:[a]}),p.splice(p.indexOf(a,i),1));for(let t=0,i=0;t<u.length;t++)a=u[u.length-1-t],p[p.length-1-t]!==a&&(Object.prototype.hasOwnProperty.call(c,a)?(e3(r,{command:"removeLayer",args:[a]}),p.splice(p.lastIndexOf(a,p.length-i),1)):i++,o=p[p.length-t],e3(r,{command:"addLayer",args:[d[a],o]}),p.splice(p.length-t,0,a),f[a]=!0);for(let t=0;t<u.length;t++)if(n=c[a=u[t]],s=d[a],!f[a]&&!e2(n,s))if(e2(n.source,s.source)&&e2(n["source-layer"],s["source-layer"])&&e2(n.type,s.type)){for(l in e4(n.layout,s.layout,r,a,null,"setLayoutProperty"),e4(n.paint,s.paint,r,a,null,"setPaintProperty"),e2(n.filter,s.filter)||e3(r,{command:"setFilter",args:[a,s.filter]}),e2(n.minzoom,s.minzoom)&&e2(n.maxzoom,s.maxzoom)||e3(r,{command:"setLayerZoomRange",args:[a,s.minzoom,s.maxzoom]}),n)Object.prototype.hasOwnProperty.call(n,l)&&"layout"!==l&&"paint"!==l&&"filter"!==l&&"metadata"!==l&&"minzoom"!==l&&"maxzoom"!==l&&(0===l.indexOf("paint.")?e4(n[l],s[l],r,a,l.slice(6),"setPaintProperty"):e2(n[l],s[l])||e3(r,{command:"setLayerProperty",args:[a,l,s[l]]}));for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&!Object.prototype.hasOwnProperty.call(n,l)&&"layout"!==l&&"paint"!==l&&"filter"!==l&&"metadata"!==l&&"minzoom"!==l&&"maxzoom"!==l&&(0===l.indexOf("paint.")?e4(n[l],s[l],r,a,l.slice(6),"setPaintProperty"):e2(n[l],s[l])||e3(r,{command:"setLayerProperty",args:[a,l,s[l]]}))}else e3(r,{command:"removeLayer",args:[a]}),o=p[p.lastIndexOf(a)+1],e3(r,{command:"addLayer",args:[s,o]})}(s,i.layers,r)}catch(t){console.warn("Unable to compute style diff:",t),r=[{command:"setStyle",args:[i]}]}return r},t.bX=function(t){let i=[],r=t.id;return void 0===r&&i.push({message:`layers.${r}: missing required property "id"`}),void 0===t.render&&i.push({message:`layers.${r}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&i.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),i},t.bY=ew,t.bZ=eT,t.b_=class extends sf{constructor(t,i){super(t,i),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.ba=hL,t.bb=hB,t.bc=function(t,i,r,a,n){var s=1/Math.tan(i/2);if(t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==1/0){var o=1/(a-n);t[10]=(n+a)*o,t[14]=2*n*a*o}else t[10]=-1,t[14]=-2*a;return t},t.bd=function(t){var i=new K(16);return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[4]=t[4],i[5]=t[5],i[6]=t[6],i[7]=t[7],i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},t.be=function(t,i,r){var a=Math.sin(r),n=Math.cos(r),s=i[0],o=i[1],l=i[2],h=i[3],u=i[4],c=i[5],d=i[6],p=i[7];return i!==t&&(t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15]),t[0]=s*n+u*a,t[1]=o*n+c*a,t[2]=l*n+d*a,t[3]=h*n+p*a,t[4]=u*n-s*a,t[5]=c*n-o*a,t[6]=d*n-l*a,t[7]=p*n-h*a,t},t.bf=function(t,i,r){var a=Math.sin(r),n=Math.cos(r),s=i[4],o=i[5],l=i[6],h=i[7],u=i[8],c=i[9],d=i[10],p=i[11];return i!==t&&(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15]),t[4]=s*n+u*a,t[5]=o*n+c*a,t[6]=l*n+d*a,t[7]=h*n+p*a,t[8]=u*n-s*a,t[9]=c*n-o*a,t[10]=d*n-l*a,t[11]=p*n-h*a,t},t.bg=function(t,i){var r=i[0],a=i[1],n=i[2],s=i[3],o=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11],m=i[12],_=i[13],g=i[14],y=i[15],x=r*l-a*o,v=r*h-n*o,b=r*u-s*o,w=a*h-n*l,T=a*u-s*l,S=n*u-s*h,P=c*_-d*m,M=c*g-p*m,I=c*y-f*m,E=d*g-p*_,C=d*y-f*_,A=p*y-f*g,D=x*A-v*C+b*E+w*I-T*M+S*P;return D?(t[0]=(l*A-h*C+u*E)*(D=1/D),t[1]=(n*C-a*A-s*E)*D,t[2]=(_*S-g*T+y*w)*D,t[3]=(p*T-d*S-f*w)*D,t[4]=(h*I-o*A-u*M)*D,t[5]=(r*A-n*I+s*M)*D,t[6]=(g*b-m*S-y*v)*D,t[7]=(c*S-p*b+f*v)*D,t[8]=(o*C-l*I+u*P)*D,t[9]=(a*I-r*C-s*P)*D,t[10]=(m*T-_*b+y*x)*D,t[11]=(d*b-c*T-f*x)*D,t[12]=(l*M-o*E-h*P)*D,t[13]=(r*E-a*M+n*P)*D,t[14]=(_*v-m*w-g*x)*D,t[15]=(c*w-d*v+p*x)*D,t):null},t.bh=function(){let t=new Float32Array(16);return Q(t),t},t.bi=function(){let t=new Float64Array(16);return Q(t),t},t.bj=function(){return new Float64Array(16)},t.bk=function(t,i,r){let a=new Float64Array(4);return el(a,t,i-90,r),a},t.bl=function(t,i,r,a){var n,s,o,l,h,u=i[0],c=i[1],d=i[2],p=i[3],f=r[0],m=r[1],_=r[2],g=r[3];return(s=u*f+c*m+d*_+p*g)<0&&(s=-s,f=-f,m=-m,_=-_,g=-g),1-s>1e-6?(o=Math.sin(n=Math.acos(s)),l=Math.sin((1-a)*n)/o,h=Math.sin(a*n)/o):(l=1-a,h=a),t[0]=l*u+h*f,t[1]=l*c+h*m,t[2]=l*d+h*_,t[3]=l*p+h*g,t},t.bm=function(t){var i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g;let y,x,v=new Float64Array(9);h=(i=t[0])*(s=i+i),u=(r=t[1])*s,d=(a=t[2])*s,p=a*(o=r+r),m=(n=t[3])*s,_=n*o,g=n*(l=a+a),v[0]=1-(c=r*o)-(f=a*l),v[3]=u-g,v[6]=d+_,v[1]=u+g,v[4]=1-h-f,v[7]=p-m,v[2]=d-_,v[5]=p+m,v[8]=1-h-c;let b=eL(-Math.asin(ey(v[2],-1,1)));return .001>Math.hypot(v[5],v[8])?(y=0,x=-eL(Math.atan2(v[3],v[4]))):(y=eL(0===v[5]&&0===v[8]?0:Math.atan2(v[5],v[8])),x=eL(0===v[1]&&0===v[0]?0:Math.atan2(v[1],v[0]))),{roll:y,pitch:b+90,bearing:x}},t.bn=function(t,i){return t.roll==i.roll&&t.pitch==i.pitch&&t.bearing==i.bearing},t.bo=tq,t.bp=sm,t.bq=-32768,t.br=32767,t.bs=oM,t.bt=ef,t.bu=em,t.bv=t5,t.bw=function(t,i,r,a,n){return ef(a,n,ey((t-i)/(r-i),0,1))},t.bx=function(t,i,r,a){return t[0]=i[0]+r[0]*a,t[1]=i[1]+r[1]*a,t[2]=i[2]+r[2]*a,t},t.by=ep,t.bz=function(){return new Float64Array(3)},t.c=eU,t.c$=rU,t.c0=class extends sf{constructor(t,i){super(t,i),this.current=sy}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let i=1;i<16;i++)if(t[i]!==this.current[i]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.c1=s_,t.c2=class extends sf{constructor(t,i){super(t,i),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.c3=class extends sf{constructor(t,i){super(t,i),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.c4=J,t.c5=function(t,i){var r=Math.sin(i),a=Math.cos(i);return t[0]=a,t[1]=r,t[2]=0,t[3]=-r,t[4]=a,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.c6=function(t,i,r){var a=i[0],n=i[1],s=i[2];return t[0]=a*r[0]+n*r[3]+s*r[6],t[1]=a*r[1]+n*r[4]+s*r[7],t[2]=a*r[2]+n*r[5]+s*r[8],t},t.c7=function(t,i,r,a,n,s,o){var l=1/(i-r),h=1/(a-n),u=1/(s-o);return t[0]=-2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(i+r)*l,t[13]=(n+a)*h,t[14]=(o+s)*u,t[15]=1,t},t.c8=class extends sf{constructor(t,i){super(t,i),this.current=[]}set(t){if(t!=this.current){this.current=t;let i=new Float32Array(4*t.length);for(let r=0;r<t.length;r++)i[4*r]=t[r].r,i[4*r+1]=t[r].g,i[4*r+2]=t[r].b,i[4*r+3]=t[r].a;this.gl.uniform4fv(this.location,i)}}},t.c9=class extends sf{constructor(t,i){super(t,i),this.current=[]}set(t){if(t!=this.current){this.current=t;let i=new Float32Array(t);this.gl.uniform1fv(this.location,i)}}},t.cA=function(t,i){return eF[i]&&"touches"in t},t.cB=function(t){return eF[t]||eB[t]},t.cC=function(t,i,r){var a=i[0],n=i[1];return t[0]=r[0]*a+r[4]*n+r[12],t[1]=r[1]*a+r[5]*n+r[13],t},t.cD=function(t,i){let{x:r,y:a}=hz.fromLngLat(i);return!(t<0||t>25||a<0||a>=1||r<0||r>=1)},t.cE=function(t,i){return t[0]=i[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=i[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.cF=class extends np{},t.cG=eZ,t.cH=function(t,i){eU.REGISTERED_PROTOCOLS[t]=i},t.cI=function(t){delete eU.REGISTERED_PROTOCOLS[t]},t.cJ=function(t,i){let r={};for(let a=0;a<t.length;a++){let n=i&&i[t[a].id]||function(t){let i="";for(let r of e1)i+=`/${function t(i){let r=typeof i;if("number"===r||"boolean"===r||"string"===r||null==i)return JSON.stringify(i);if(Array.isArray(i)){let r="[";for(let a of i)r+=`${t(a)},`;return`${r}]`}let a=Object.keys(i).sort(),n="{";for(let r=0;r<a.length;r++)n+=`${JSON.stringify(a[r])}:${t(i[a[r]])},`;return`${n}}`}(t[r])}`;return i}(t[a]);i&&(i[t[a].id]=n);let s=r[n];s||(s=r[n]=[]),s.push(t[a])}let a=[];for(let t in r)a.push(r[t]);return a},t.cK=ak,t.cL=hV,t.cM=uK,t.cN=hi,t.cO=function(i){var r,a;i.bucket.createArrays(),i.bucket.tilePixelRatio=8192/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;let n=i.bucket.layers[0],s=n.layout,o=n._unevaluatedLayout._values,l={layoutIconSize:o["icon-size"].possiblyEvaluate(new aX(i.bucket.zoom+1),i.canonical),layoutTextSize:o["text-size"].possiblyEvaluate(new aX(i.bucket.zoom+1),i.canonical),textMaxSize:o["text-size"].possiblyEvaluate(new aX(18))};
2if("composite"===i.bucket.textSizeData.kind){let{minZoom:t,maxZoom:r}=i.bucket.textSizeData;l.compositeTextSizes=[o["text-size"].possiblyEvaluate(new aX(t),i.canonical),o["text-size"].possiblyEvaluate(new aX(r),i.canonical)]}if("composite"===i.bucket.iconSizeData.kind){let{minZoom:t,maxZoom:r}=i.bucket.iconSizeData;l.compositeIconSizes=[o["icon-size"].possiblyEvaluate(new aX(t),i.canonical),o["icon-size"].possiblyEvaluate(new aX(r),i.canonical)]}let h=24*s.get("text-line-height"),u="viewport"!==s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),c=s.get("text-keep-upright"),d=s.get("text-size");for(let o of i.bucket.features){let p=s.get("text-font").evaluate(o,{},i.canonical).join(","),f=d.evaluate(o,{},i.canonical),m=l.layoutTextSize.evaluate(o,{},i.canonical),_=l.layoutIconSize.evaluate(o,{},i.canonical),g={horizontal:{},vertical:void 0},y=o.text,x,v=[0,0];if(y){let r=y.toString(),a=24*s.get("text-letter-spacing").evaluate(o,{},i.canonical),l=!function(t){for(let r of t){var i;if(i=r.codePointAt(0),a$.test(String.fromCodePoint(i)))return!1}return!0}(r)?0:a,d=s.get("text-anchor").evaluate(o,{},i.canonical),_=cl(n,o,i.canonical);if(!_){let t=s.get("text-radial-offset").evaluate(o,{},i.canonical);v=t?co(d,[24*t,cs]):s.get("text-offset").evaluate(o,{},i.canonical).map(t=>24*t)}let x=u?"center":s.get("text-justify").evaluate(o,{},i.canonical),b="point"===s.get("symbol-placement")?24*s.get("text-max-width").evaluate(o,{},i.canonical):1/0,w=()=>{i.bucket.allowVerticalPlacement&&aU(r)&&(g.vertical=hr(y,i.glyphMap,i.glyphPositions,i.imagePositions,p,b,h,d,"left",l,v,t.ax.vertical,!0,m,f))};if(!u&&_){let r=new Set;if("auto"===x)for(let t=0;t<_.values.length;t+=2)r.add(ch(_.values[t]));else r.add(x);let a=!1;for(let n of r)if(!g.horizontal[n])if(a)g.horizontal[n]=g.horizontal[0];else{let r=hr(y,i.glyphMap,i.glyphPositions,i.imagePositions,p,b,h,"center",n,l,v,t.ax.horizontal,!1,m,f);r&&(g.horizontal[n]=r,a=1===r.positionedLines.length)}w()}else{"auto"===x&&(x=ch(d));let a=hr(y,i.glyphMap,i.glyphPositions,i.imagePositions,p,b,h,d,x,l,v,t.ax.horizontal,!1,m,f);a&&(g.horizontal[x]=a),w(),aU(r)&&u&&c&&(g.vertical=hr(y,i.glyphMap,i.glyphPositions,i.imagePositions,p,b,h,d,x,l,v,t.ax.vertical,!1,m,f))}}let b=!1;if(null==(r=o.icon)?void 0:r.name){let t=i.imageMap[o.icon.name];t&&(x=function(t,i,r){let{horizontalAlign:a,verticalAlign:n}=ha(r),s=i[0]-t.displaySize[0]*a,o=i[1]-t.displaySize[1]*n;return{image:t,top:o,bottom:o+t.displaySize[1],left:s,right:s+t.displaySize[0]}}(i.imagePositions[o.icon.name],s.get("icon-offset").evaluate(o,{},i.canonical),s.get("icon-anchor").evaluate(o,{},i.canonical)),b=!!t.sdf,void 0===i.bucket.sdfIcons?i.bucket.sdfIcons=b:i.bucket.sdfIcons!==b&&eM("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==i.bucket.pixelRatio||0!==s.get("icon-rotate").constantOr(1))&&(i.bucket.iconsNeedLinear=!0))}let T=cc(g.horizontal)||g.vertical;
2(a=i.bucket).iconsInText||(a.iconsInText=!!T&&T.iconsInText),(T||x)&&function(i,r,a,n,s,o,l,h,u,c,d,p){let f,m=o.textMaxSize.evaluate(r,{});void 0===m&&(m=l);let _=i.layers[0].layout,g=_.get("icon-offset").evaluate(r,{},d),y=cc(a.horizontal),x=l/24,v=i.tilePixelRatio*x,b=i.tilePixelRatio*m/24,T=i.tilePixelRatio*h,S=i.tilePixelRatio*_.get("symbol-spacing"),P=_.get("text-padding")*i.tilePixelRatio,M=function(t,i,r,a=1){let n=t.get("icon-padding").evaluate(i,{},r),s=null==n?void 0:n.values;return[s[0]*a,s[1]*a,s[2]*a,s[3]*a]}(_,r,d,i.tilePixelRatio),I=_.get("text-max-angle")/180*Math.PI,E="viewport"!==_.get("text-rotation-alignment")&&"point"!==_.get("symbol-placement"),C="map"===_.get("icon-rotation-alignment")&&"point"!==_.get("symbol-placement"),A=_.get("symbol-placement"),D=S/2,z=_.get("icon-text-fit");n&&"none"!==z&&(i.allowVerticalPlacement&&a.vertical&&(f=ho(n,a.vertical,z,_.get("icon-text-fit-padding"),g,x)),y&&(n=ho(n,y,z,_.get("icon-text-fit-padding"),g,x)));let k=d?p.line.getGranularityForZoomLevel(d.z):1,R=(h,p)=>{p.x<0||p.x>=8192||p.y<0||p.y>=8192||function(i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,P,M){let I=i.addToLineVertexArray(r,a),E,C,A,D,z=0,k=0,R=0,L=0,F=-1,B=-1,O={},V=su("");if(i.allowVerticalPlacement&&n.vertical){let t=h.layout.get("text-rotate").evaluate(w,{},P)+90;A=new ci(u,r,c,d,p,n.vertical,f,m,_,t),l&&(D=new ci(u,r,c,d,p,l,y,x,_,t))}if(s){let a=h.layout.get("icon-rotate").evaluate(w,{}),n="none"!==h.layout.get("icon-text-fit"),o=u9(s,a,S,n),f=l?u9(l,a,S,n):void 0;C=new ci(u,r,c,d,p,s,y,x,!1,a),z=4*o.length;let m=i.iconSizeData,_=null;"source"===m.kind?(_=[128*h.layout.get("icon-size").evaluate(w,{})])[0]>32640&&eM(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===m.kind&&((_=[128*T.compositeIconSizes[0].evaluate(w,{},P),128*T.compositeIconSizes[1].evaluate(w,{},P)])[0]>32640||_[1]>32640)&&eM(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),i.addSymbols(i.icon,o,_,b,v,w,t.ax.none,r,I.lineStartIndex,I.lineLength,-1,P),F=i.icon.placedSymbolArray.length-1,f&&(k=4*f.length,i.addSymbols(i.icon,f,_,b,v,w,t.ax.vertical,r,I.lineStartIndex,I.lineLength,-1,P),B=i.icon.placedSymbolArray.length-1)}let j=Object.keys(n.horizontal);for(let a of j){let s=n.horizontal[a];if(!E){V=su(s.text);E=new ci(u,r,c,d,p,s,f,m,_,h.layout.get("text-rotate").evaluate(w,{},P))}let l=1===s.positionedLines.length;if(R+=cu(i,r,s,o,h,_,w,g,I,n.vertical?t.ax.horizontal:t.ax.horizontalOnly,l?j:[a],O,F,T,P),l)break}n.vertical&&(L+=cu(i,r,n.vertical,o,h,_,w,g,I,t.ax.vertical,["vertical"],O,B,T,P));let N=E?E.boxStartIndex:i.collisionBoxArray.length,U=E?E.boxEndIndex:i.collisionBoxArray.length,G=A?A.boxStartIndex:i.collisionBoxArray.length,$=A?A.boxEndIndex:i.collisionBoxArray.length,Z=C?C.boxStartIndex:i.collisionBoxArray.length,q=C?C.boxEndIndex:i.collisionBoxArray.length,W=D?D.boxStartIndex:i.collisionBoxArray.length,H=D?D.boxEndIndex:i.collisionBoxArray.length,X=-1,Y=(t,i)=>(null==t?void 0:t.circleDiameter)?Math.max(t.circleDiameter,i):i;X=Y(E,-1),X=Y(A,X),X=Y(C,X);let K=+((X=Y(D,X))>-1);K&&(X*=M/24),i.glyphOffsetArray.length>=hm.MAX_GLYPHS&&eM("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);let J=cl(h,w,P),[Q,ee]=function(i,r){let a=i.length,n=null==r?void 0:r.values;if((null==n?void 0:n.length)>0)for(let r=0;r<n.length;r+=2){let a=n[r+1];i.emplaceBack(t.aM[n[r]],a[0],a[1])}return[a,i.length]}(i.textAnchorOffsets,J);i.symbolInstances.emplaceBack(r.x,r.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical||-1,F,B,V,N,U,G,$,Z,q,W,H,c,R,L,z,k,K,0,f,X,Q,ee)}(i,p,h,a,n,s,f,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,v,[P,P,P,P],E,u,T,M,C,g,r,o,c,d,l)};if("line"===A)for(let t of u0(r.geometry,0,0,8192,8192)){let r=oA(t,k);for(let t of function(t,i,r,a,n,s,o){let l=a?.6*24*s:0,h=u7(a,n),u=h*s,c=0===t[0].x||8192===t[0].x||0===t[0].y||8192===t[0].y;return i-u<i/4&&(i=u+i/4),function t(i,r,a,n,s,o,l,h,u){let c=o/2,d=u8(i),p=0,f=r-a,m=[];for(let t=0;t<i.length-1;t++){let r=i[t],l=i[t+1],h=r.dist(l),_=l.angleTo(r);for(;f+a<p+h;){let g=((f+=a)-p)/h,y=iE.number(r.x,l.x,g),x=iE.number(r.y,l.y,g);if(y>=0&&y<u&&x>=0&&x<u&&f-c>=0&&f+c<=d){let r=new u6(y,x,_,t);r._round(),n&&!u4(i,r,o,n,s)||m.push(r)}}p+=h}return h||m.length||l||(m=t(i,p/2,a,n,s,o,l,!0,u)),m}(t,c?i/2*o%i:(h/2+48)*s*o%i,i,l,r,u,c,!1,8192)}(r,S,I,a.vertical||y,n,b,i.overscaling))y&&function(t,i,r,a){let n=t.compareText;if(i in n){let t=n[i];for(let i=t.length-1;i>=0;i--)if(a.dist(t[i])<r)return!0}else n[i]=[];return n[i].push(a),!1}(i,y.text,D,t)||R(r,t)}else if("line-center"===A){for(let t of r.geometry)if(t.length>
21){let i=oA(t,k),r=function(t,i,r,a,n){let s=r?.6*24*n:0,o=u7(r,a)*n,l=0,h=u8(t)/2;for(let r=0;r<t.length-1;r++){let a=t[r],n=t[r+1],u=a.dist(n);if(l+u>h){let c=(h-l)/u,d=new u6(iE.number(a.x,n.x,c),iE.number(a.y,n.y,c),n.angleTo(a),r);return d._round(),!s||u4(t,d,o,s,i)?d:void 0}l+=u}}(i,I,a.vertical||y,n,b);r&&R(i,r)}}else if("Polygon"===r.type)for(let t of i6(r.geometry,0)){let i=function(t,i=1){let r=hO.fromPoints(t[0]),a=Math.min(r.width(),r.height()),n=a/2,s=new cr([],ca),{minX:o,minY:l,maxX:h,maxY:u}=r;if(0===a)return new w(o,l);for(let i=o;i<h;i+=a)for(let r=l;r<u;r+=a)s.push(new cn(i+n,r+n,n,t));let c=function(t){let i=0,r=0,a=0,n=t[0];for(let t=0,s=n.length,o=s-1;t<s;o=t++){let s=n[t],l=n[o],h=s.x*l.y-l.x*s.y;r+=(s.x+l.x)*h,a+=(s.y+l.y)*h,i+=3*h}return new cn(r/i,a/i,0,t)}(t),d=c;for(;s.length;){let r=s.pop();(r.d>d.d||!d.d)&&(d=r),r.max-d.d<=i||(n=r.h/2,s.push(new cn(r.p.x-n,r.p.y-n,n,t)),s.push(new cn(r.p.x+n,r.p.y-n,n,t)),s.push(new cn(r.p.x-n,r.p.y+n,n,t)),s.push(new cn(r.p.x+n,r.p.y+n,n,t)))}return c.d>0&&d.d-c.d<=i?c.p:d.p}(t,16);R(oA(t[0],k,!0),new u6(i.x,i.y,0))}else if("LineString"===r.type)for(let t of r.geometry){let i=oA(t,k);R(i,new u6(i[0].x,i[0].y,0))}else if("Point"===r.type)for(let t of r.geometry)for(let i of t)R([i],new u6(i.x,i.y,0))}(i.bucket,o,g,x,i.imageMap,l,m,_,v,b,i.canonical,i.subdivisionGranularity)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},t.cP=ok,t.cQ=oW,t.cR=lk,t.cS=function(t,i=""){let r=new lY;return function(t,i,r=""){for(let a in t.layers)i.writeMessage(3,(t,i)=>(function(t,i,r=""){i.writeVarintField(15,t.version||1),i.writeStringField(1,t.name||""),i.writeVarintField(5,t.extent||4096);let a={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let r=0;r<t.length;r++)a.feature=t.feature(r),i.writeMessage(2,uW,a);for(let t of a.keys)i.writeStringField(3,t);for(let t of a.values)i.writeMessage(4,uY,t)})(t,i,r),t.layers[a])}(t,r,i),r.finish()},t.cT=function(t,i,r,a,n,s){let o=u1(t,i,r,n,0);return u1(o,i,a,s,1)},t.cU=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){let i=this.map.get(t);return void 0!==i&&(this.map.delete(t),this.map.set(t,i)),i}set(t,i){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){let t=this.map.keys().next().value;this.map.delete(t)}this.map.set(t,i)}clear(){this.map.clear()}},t.cV=o$,t.cW=lY,t.cX=u$,t.cY=function(t,i,r,s,o){return b(this,void 0,void 0,function*(){let l,h,u;if(Y())try{return yield ez(t,i,r,s,o)}catch(t){}return l=t.width,h=t.height,a&&n||(n=(a=new OffscreenCanvas(l,h)).getContext("2d",{willReadFrequently:!0})),a.width=l,a.height=h,n.drawImage(t,0,0,l,h),u=n.getImageData(i,r,s,o),n.clearRect(0,0,l,h),u.data})},t.cZ=oa,t.c_=class{constructor(t,i){this.layers={[uq]:this},this.name=uq,this.version=i?i.version:1,this.extent=i?i.extent:4096,this.length=t.length,this.features=t}feature(t){return new uZ(this.features[t],this.extent)}},t.ca=class extends nP{},t.cb=lN,t.cc=class extends nI{},t.cd=s7,t.ce=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.cf=s8,t.cg=function(t,i,r){var a=i[0],n=i[1],s=i[2],o=r[3]*a+r[7]*n+r[11]*s+r[15];return t[0]=(r[0]*a+r[4]*n+r[8]*s+r[12])/(o=o||1),t[1]=(r[1]*a+r[5]*n+r[9]*s+r[13])/o,t[2]=(r[2]*a+r[6]*n+r[10]*s+r[14])/o,t},t.ch=class extends nf{},t.ci=class extends nR{},t.cj=function(t,i){return t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]&&t[3]===i[3]&&t[4]===i[4]&&t[5]===i[5]&&t[6]===i[6]&&t[7]===i[7]&&t[8]===i[8]&&t[9]===i[9]&&t[10]===i[10]&&t[11]===i[11]&&t[12]===i[12]&&t[13]===i[13]&&t[14]===i[14]&&t[15]===i[15]},t.ck=function(t,i){var r=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],m=t[12],_=t[13],g=t[14],y=t[15],x=i[0],v=i[1],b=i[2],w=i[3],T=i[4],S=i[5],P=i[6],M=i[7],I=i[8],E=i[9],C=i[10],A=i[11],D=i[12],z=i[13],k=i[14],R=i[15];return Math.abs(r-x)<=1e-6*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(a-v)<=1e-6*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(n-b)<=1e-6*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(s-w)<=1e-6*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(o-T)<=1e-6*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(l-S)<=1e-6*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(h-P)<=1e-6*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(u-M)<=1e-6*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(c-I)<=1e-6*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(d-E)<=1e-6*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(p-C)<=1e-6*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(f-A)<=1e-6*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(m-D)<=1e-6*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(_-z)<=1e-6*Math.max(1,Math.abs(_),Math.abs(z))&&Math.abs(g-k)<=1e-6*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(y-R)<=1e-6*Math.max(1,Math.abs(y),Math.abs(R))},t.cl=function(t,i){return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},t.cm=t=>"circle"===t.type,t.cn=t=>"heatmap"===t.type,t.co=t=>"line"===t.type,t.cp=t=>"fill"===t.type,t.cq=t=>"fill-extrusion"===t.type,t.cr=t=>"hillshade"===t.type,t.cs=t=>"color-relief"===t.type,t.ct=t=>"background"===t.type,t.cu=t=>"custom"===t.type,t.cv=e_,t.cw=function(t,i,r){if(i<=0)return t;let a=1/i;return void 0===r||1e-10>Math.abs(r)?Math.round(t*a)/a:(r>0?Math.ceil(t*a-1e-9):Math.floor(t*a+1e-10))/a},t.cx=function(t,i,r){let a=eu(i.x-r.x,i.y-r.y),n=eu(t.x-r.x,t.y-r.y);return eL(Math.atan2(a[0]*n[1]-a[1]*n[0],a[0]*n[0]+a[1]*n[1]))},t.cy=eg,t.cz=function(t,i){var r;if(!eB[i])return!1;let a=null==t?void 0:t.target,n=(null==(r=null==a?void 0:a.ownerDocument)?void 0:r.defaultView)||window;return t instanceof n.MouseEvent||t instanceof n.WheelEvent},t.d=ed,t.d0=class{constructor(t,i){const r=(i=this.options=Object.assign({},lC,i)).debug;if(r&&console.time("preprocess data"),i.maxZoom<0||i.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(i.promoteId&&i.generateId)throw Error("promoteId and generateId cannot be used together.");let a=o8(t,i);r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",i.indexMaxZoom,i.indexMaxPoints),console.time("generate tiles")),a=lf(a,i),i.updateable&&(this.source=a),this.initializeIndex(a,i)}initializeIndex(t,i){this.tileIndex=i.cluster?new lx(i.clusterOptions):new lI(i),t.length&&this.tileIndex.initialize(t)}getTile(t,i,r){return i*=1,r*=1,(t*=1)<0||t>24?null:this.tileIndex.getTile(t,i,r)}updateData(t,i){let r=this.options;if(!r.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:a,source:n}
2=function(t,i,r){let a=i?{removeAll:i.removeAll,remove:new Set(i.remove||[]),add:new Map(i.add?.map(t=>[r.promoteId?t.properties[r.promoteId]:t.id,t])),update:new Map(i.update?.map(t=>[t.id,t]))}:{remove:new Set,add:new Map,update:new Map},n=[];if(a.removeAll&&(n=t,t=[]),a.remove.size||a.add.size){let i=[];for(let r of t)(a.remove.has(r.id)||a.add.has(r.id))&&i.push(r);if(i.length){n.push(...i);let r=new Set(i.map(t=>t.id));t=t.filter(t=>!r.has(t.id))}if(a.add.size){let i=o8({type:"FeatureCollection",features:Array.from(a.add.values())},r);i=lf(i,r),n.push(...i),t.push(...i)}}if(a.update.size){let i=new Map,s=[];for(let r of t)a.update.has(r.id)?i.set(r.id,[...i.get(r.id)||[],r]):s.push(r);for(let[t,o]of a.update){let a=i.get(t);if(!a||0===a.length)continue;let l=function(t,i,r){let a=!!i.newGeometry,n=i.removeAllProperties||i.removeProperties?.length>0||i.addOrUpdateProperties?.length>0;if(a){let a=t[0];return lf(o8({type:"FeatureCollection",features:[{type:"Feature",id:a.id,geometry:i.newGeometry,properties:n?lg(a.tags,i):a.tags}]},r),r)}if(n){let r=[];for(let a of t){let t={...a};t.tags=lg(t.tags,i),r.push(t)}return r}return t}(a,o,r);n.push(...a,...l),s.push(...l)}t=s}return{affected:n,source:t}}(this.source,t,r);i&&({affected:a,source:n}=this.filterUpdate(n,a,i)),a.length&&(this.source=n,this.tileIndex.updateIndex(n,a,r))}filterUpdate(t,i,r){let a=new Set;for(let n of t)null!=n.id&&(r(lr(n))||(i.push(n),a.add(n.id)));return{affected:i,source:t=t.filter(t=>!a.has(t.id))}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map(t=>lr(t))}}updateClusterOptions(t,i){let r=this.options.cluster;this.options.cluster=t,this.options.clusterOptions=i,r!=t?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,i,r){return this.tileIndex.getLeaves(t,i,r)}},t.d1=aH,t.e=ev,t.f=eH,t.g=eG,t.h=t=>b(void 0,void 0,void 0,function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));let i=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(i)}catch(t){throw Error(`Could not load image because of ${ed(t).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),t.i=eE,t.j=t=>new Promise((i,r)=>{let a=new Image;a.onload=()=>{i(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>a.src=eD)},a.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 n=new Blob([new Uint8Array(t)],{type:"image/png"});a.src=t.byteLength?URL.createObjectURL(n):eD}),t.k=(t,i)=>eW(ev(t,{type:"json"}),i),t.l=eJ,t.m=eW,t.n=eK,t.o=(t,i)=>eW(ev(t,{type:"arrayBuffer"}),i),t.p=he,t.q=function(t){return new lY(t).readFields(l8,[])},t.r=function(t){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))},t.s=ek,t.t=s5,t.u=nt,t.v=e0,t.w=eM,t.x=e0,t.y=a0,t.z=aM}),r("worker",["./shared"],function(t){class i{constructor(t,i){this.keyCache={},t&&this.replace(t,i)}replace(t,i){this._layerConfigs={},this._layers={},this.update(t,[],i)}update(i,r,a){for(let r of i){this._layerConfigs[r.id]=r;let i=this._layers[r.id]=t.bT(r,a);i._featureFilter=t.ah(i.filter,a),this.keyCache[r.id]&&delete this.keyCache[r.id]}for(let t of r)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];for(let i of(this.familiesBySource={},t.cJ(Object.values(this._layerConfigs),this.keyCache))){let r=i.map(t=>this._layers[t.id]),a=r[0];if(a.isHidden())continue;let n=a.source||"",s=this.familiesBySource[n];
2s||(s=this.familiesBySource[n]={});let o=a.sourceLayer||t.ag,l=s[o];l||(l=s[o]=[]),l.push(r)}}}class r{constructor(i){const r={},a=[];for(const t in i){const n=i[t],s=r[t]={};for(const t in n){const i=n[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const r={x:0,y:0,w:i.bitmap.width+2,h:i.bitmap.height+2};a.push(r),s[t]={rect:r,metrics:i.metrics}}}const{w:n,h:s}=t.p(a),o=new t.t({width:n||1,height:s||1});for(const a in i){const n=i[a];for(const i in n){const s=n[+i];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const l=r[a][i].rect;t.t.copy(s.bitmap,o,{x:0,y:0},{x:l.x+1,y:l.y+1},s.bitmap)}}this.image=o,this.positions=r}}t.cK("GlyphAtlas",r);class a{constructor(i){this.tileID=new t.a3(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.uid=i.uid,this.zoom=i.zoom,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.inFlightDependencies=[]}parse(i,a,s,o,l){return t._(this,void 0,void 0,function*(){this.status="parsing",this.data=i,this.collisionBoxArray=new t.ae;let h=new t.cL(Object.keys(i.layers).sort()),u=new t.cM(this.tileID,this.promoteId);u.bucketLayerIDs=[];let c={},d={featureIndex:u,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:s,subdivisionGranularity:l},p=a.familiesBySource[this.source];for(let r in p){let a=i.layers[r];if(!a)continue;1===a.version&&t.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let o=h.encode(r),l=[];for(let t=0;t<a.length;t++){let i=a.feature(t),n=u.getId(i,r);l.push({feature:i,id:n,index:t,sourceLayerIndex:o})}for(let i of p[r]){let r=i[0];r.source!==this.source&&t.w(`layer.source = ${r.source} does not equal this.source = ${this.source}`),r.isHidden(this.zoom,!0)||(n(i,this.zoom,s),(c[r.id]=r.createBucket({index:u.bucketLayerIDs.length,layers:i,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(l,d,this.tileID.canonical),u.bucketLayerIDs.push(i.map(t=>t.id)))}}let f=t.bY(d.glyphDependencies,t=>Object.keys(t).map(Number));for(let t of this.inFlightDependencies)null==t||t.abort();this.inFlightDependencies=[];let m=Promise.resolve({});if(Object.keys(f).length){let t=new AbortController;this.inFlightDependencies.push(t),m=o.sendAsync({type:"GG",data:{stacks:f,source:this.source,tileID:this.tileID,type:"glyphs"}},t)}let _=Object.keys(d.iconDependencies),g=Promise.resolve({});if(_.length){let t=new AbortController;this.inFlightDependencies.push(t),g=o.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"icons"}},t)}let y=Object.keys(d.patternDependencies),x=Promise.resolve({});if(y.length){let t=new AbortController;this.inFlightDependencies.push(t),x=o.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"patterns"}},t)}let v=d.dashDependencies,b=Promise.resolve({});if(Object.keys(v).length){let t=new AbortController;this.inFlightDependencies.push(t),b=o.sendAsync({type:"GDA",data:{dashes:v}},t)}let[w,T,S,P]=yield Promise.all([m,g,x,b]),M=new r(w),I=new t.cN(T,S);for(let i in c){let r=c[i];r instanceof t.af?(n(r.layers,this.zoom,s),t.cO({bucket:r,glyphMap:w,glyphPositions:M.positions,imageMap:T,imagePositions:I.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:d.subdivisionGranularity})):r.hasDependencies&&(r instanceof t.cP||r instanceof t.cQ||r instanceof t.cR)&&(n(r.layers,this.zoom,s),r.addFeatures(d,this.tileID.canonical,I.patternPositions,P))}return this.status="done",{buckets:Object.values(c).filter(t=>!t.isEmpty()),featureIndex:u,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:M.image,imageAtlas:I,dashPositions:P,glyphMap:this.returnDependencies?w:null,iconMap:this.returnDependencies?T:null,glyphPositions:this.returnDependencies?M.positions:null}})}}function n(i,r,a){let n=new t.J(r);
2for(let t of i)t.recalculate(n,a)}class s{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,i){this.loading[t]=i}finishLoading(t){delete this.loading[t]}abort(t){let i=this.loading[t];(null==i?void 0:i.abort)&&(i.abort.abort(),delete this.loading[t])}setParsing(t,i){this.parsing[t]=i}consumeParsing(t){let i=this.parsing[t];if(i)return delete this.parsing[t],i}clearParsing(t){delete this.parsing[t]}markLoaded(t,i){this.loaded[t]=i}getLoaded(t){let i=this.loaded[t];if(i)return i}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}}class o{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return 0===t.length&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}}class l{constructor(t,i,r,a,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=i,this.id=a}loadGeometry(){return this.pointsArray.map(i=>i.map(i=>new t.P(i.x,i.y)))}}class h{constructor(t,i,r){this.version=2,this._myFeatures=t,this.name=i,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}}class u{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}}function c(i){let r=t.cS(i);return 0===r.byteOffset&&r.byteLength===r.buffer.byteLength||(r=new Uint8Array(r)),{vectorTile:i,rawData:r.buffer}}class d{constructor(i,r,a){this.actor=i,this.layerIndex=r,this.availableImages=a,this.tileState=new s,this.overzoomedTileResultCache=new t.cU(1e3)}loadVectorTile(i,r){try{return{vectorTile:"mlt"!==i.encoding?new t.cV(new t.cW(r)):new t.cX(r),rawData:r}}catch(s){let a=new Uint8Array(r),n=`Unable to parse the tile at ${i.request.url}, `;throw Error(n+=31===a[0]&&139===a[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.d(s).message}`)}}loadTile(i){return t._(this,void 0,void 0,function*(){let{uid:r,overzoomParameters:n}=i;n&&(i.request=n.overzoomRequest);let s=this._startRequestTiming(i),o=new a(i);this.tileState.startLoading(r,o);let l=new AbortController;o.abort=l;try{let a=yield t.o(i.request,l);if(i.etag&&i.etag===a.etag)return this.tileState.finishLoading(r),this._getEtagUnmodifiedResult(a,s);let h=this.loadVectorTile(i,a.data);if(this.tileState.finishLoading(r),!h)return null;let{vectorTile:u,rawData:c}=h;n&&({vectorTile:u,rawData:c}=this._getOverzoomTile(i,u));let d=this._getExpiryData(a),p=this._finishRequestTiming(s);o.vectorTile=u,this.tileState.markLoaded(r,o);let f={rawData:c,cacheControl:d,resourceTiming:p};this.tileState.setParsing(r,f);try{return yield this._parseWorkerTile(o,i,f)}finally{this.tileState.clearParsing(r)}}catch(t){throw this.tileState.finishLoading(r),o.status="done",this.tileState.markLoaded(r,o),t}})}_getEtagUnmodifiedResult(i,r){let a=this._getExpiryData(i),n=this._finishRequestTiming(r);return t.e({etagUnmodified:!0},a,n)}_parseWorkerTile(i,r,a){return t._(this,void 0,void 0,function*(){let n=yield i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,r.subdivisionGranularity);if(a){let{rawData:i,cacheControl:s,resourceTiming:o}=a;n=t.e({rawTileData:i.slice(0),encoding:r.encoding},n,s,o)}return n})}_getExpiryData({expires:t,cacheControl:i,etag:r}){let a={};return t&&(a.expires=t),i&&(a.cacheControl=i),r&&(a.etag=r),a}_startRequestTiming(t){var i;if(null==(i=t.request)?void 0:i.collectResourceTiming)return new o(t.request.url)}_finishRequestTiming(t){let i=null==t?void 0:t.finish();return i?{resourceTiming:JSON.parse(JSON.stringify(i))}:{}}_getOverzoomTile(i,r){var a;let{tileID:n,source:s,overzoomParameters:o}=i,{maxZoomTileID:d}=o,p=`${d.key}_${n.key}_${null==(a=i.request)?void 0:a.url}`,f=this.overzoomedTileResultCache.get(p);if(f)return f;let m=new u,_=this.layerIndex.familiesBySource[s];for(let i in _){let a=r.layers[i];if(!a)continue;let s=function(i,r,a){let{extent:n}=i,s=Math.pow(2,a.z-r.z),o=(a.x-r.x*s)*n,u=(a.y-r.y*s)*n,c=[];for(let r=0;r<i.length;r++){let a=i.feature(r),h=a.loadGeometry();for(let t of h)for(let i of t)i.x=i.x*s-o,i.y=i.y*s-u;0!==(h=t.cT(h,a.type,-128,-128,n+128,n+128)).length&&c.push(new l(a.type,h,a.properties,a.id,n))}return new h(c,i.name,n)}(a,d,n.canonical);s.length>0&&m.addLayer(s)}let g=c(m);return this.overzoomedTileResultCache.set(p,g),g}reloadTile(i){return t._(this,void 0,void 0,function*(){let t=i.uid,r=this.tileState.getLoaded(t);if(!r)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.showCollisionBoxes=i.showCollisionBoxes,"parsing"===r.status){let a=this.tileState.consumeParsing(t);return yield this._parseWorkerTile(r,i,a)}if("done"===r.status&&r.vectorTile)return yield this._parseWorkerTile(r,i)})}abortTile(i){return t._(this,void 0,void 0,function*(){this.tileState.abort(i.uid)})}removeTile(i){return t._(this,void 0,void 0,function*(){this.tileState.removeLoaded(i.uid)})}}class p{constructor(){this.loaded={}}loadTile(i){return t._(this,void 0,void 0,function*(){let{uid:r,encoding:a,rawImageData:n,redFactor:s,greenFactor:o,blueFactor:l,baseShift:h}=i,u=n.width+2,c=n.height+2,d=t.b(n)?new t.R({width:u,height:c},(yield t.cY(n,-1,-1,u,c))):n,p=new t.cZ(r,d,a,s,o,l,h);return this.loaded||(this.loaded={}),this.loaded[r]=p,p})}removeTile(t){let i=this.loaded,r=t.uid;(null==i?void 0:i[r])&&delete i[r]}}class f{constructor(t,i,r,a=m){this.actor=t,this.layerIndex=i,this.availableImages=r,this.tileState=new s,this._createGeoJSONIndex=a}loadVectorTile(i){if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let{z:r,x:a,y:n}=i.tileID.canonical,s=this._geoJSONIndex.getTile(r,a,n);return s?c(new t.c_(s.features,{version:2,extent:t.a6})):null}loadTile(i){return t._(this,void 0,void 0,function*(){let{uid:t}=i,r=new a(i);r.abort=new AbortController;try{let a=this.loadVectorTile(i);if(!a)return null;let{vectorTile:n,rawData:s}=a;r.vectorTile=n,this.tileState.markLoaded(t,r);let o={rawData:s};this.tileState.setParsing(t,o);try{return yield this._parseWorkerTile(r,i,o)}finally{this.tileState.clearParsing(t)}}catch(i){throw r.status="done",this.tileState.markLoaded(t,r),i}})}_reloadLoadedTile(i){return t._(this,void 0,void 0,function*(){let t=i.uid,r=this.tileState.getLoaded(t);if(!r)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.showCollisionBoxes=i.showCollisionBoxes,"parsing"===r.status){let a=this.tileState.consumeParsing(t);return yield this._parseWorkerTile(r,i,a)}if("done"===r.status&&r.vectorTile)return yield this._parseWorkerTile(r,i)})}_parseWorkerTile(i,r,a){return t._(this,void 0,void 0,function*(){let n=yield i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,r.subdivisionGranularity);if(a){let{rawData:i}=a;n=t.e({rawTileData:i.slice(0),encoding:"mvt"},n)}return n})}abortTile(i){return t._(this,void 0,void 0,function*(){this.tileState.abort(i.uid)})}removeTile(i){return t._(this,void 0,void 0,function*(){this.tileState.removeLoaded(i.uid)})}loadData(i){return t._(this,void 0,void 0,function*(){var r;
2null==(r=this._pendingRequest)||r.abort();let a=this._startRequestTiming(i);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(i,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let t={};return i.request&&(t.data=i.data),this._finishRequestTiming(a,i,t),t}catch(i){if(delete this._pendingRequest,!t.$(i))throw i;return{abandoned:!0}}})}_startRequestTiming(t){var i;if(null==(i=t.request)?void 0:i.collectResourceTiming)return new o(t.request.url)}_finishRequestTiming(t,i,r){let a=null==t?void 0:t.finish();a&&(r.resourceTiming={[i.source]:JSON.parse(JSON.stringify(a))})}reloadTile(t){return this.tileState.getLoaded(t.uid)?this._reloadLoadedTile(t):this.loadTile(t)}loadAndProcessGeoJSON(i,r){return t._(this,void 0,void 0,function*(){if(i.request&&(i.data=(yield t.k(i.request,r)).data),i.data)return i.data=this._filterGeoJSON(i.data,i.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(i.data,i));if(i.dataDiff)return null!=this._geoJSONIndex||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},i)),void this._geoJSONIndex.updateData(i.dataDiff,this._getFilterPredicate(i.filter));if(i.updateCluster&&this._geoJSONIndex.updateClusterOptions(i.geojsonVtOptions.cluster,_(i)),null==this._geoJSONIndex)throw Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`)})}_filterGeoJSON(t,i){if("FeatureCollection"!==t.type)return t;let r=this._getFilterPredicate(i);return r?{type:"FeatureCollection",features:t.features.filter(t=>r(t))}:t}_getFilterPredicate(i){if("boolean"!=typeof i&&!(null==i?void 0:i.length))return;let r=t.c$(i,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===r.result)throw Error(r.value.map(t=>`${t.key}: ${t.message}`).join(", "));return t=>r.value.evaluate({zoom:0},t)}removeSource(i){return t._(this,void 0,void 0,function*(){var t;
2null==(t=this._pendingRequest)||t.abort()})}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getClusterChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getClusterLeaves(t.clusterId,t.limit,t.offset)}}function m(i,r){let a=t.e(r.geojsonVtOptions||{},{updateable:!0,clusterOptions:_(r)});return new t.d0(i,a)}function _({geojsonVtOptions:i,clusterProperties:r}){if(!r||!i.clusterOptions)return i.clusterOptions;let a={},n={},s={accumulated:null,zoom:0},o={properties:null},l=Object.keys(r);for(let i of l){let[s,o]=r[i],l=t.c$(o),h=t.c$("string"==typeof s?[s,["accumulated"],["get",i]]:s);a[i]=l.value,n[i]=h.value}return i.clusterOptions.map=t=>{o.properties=t;let i={};for(let t of l)i[t]=a[t].evaluate(s,o);return i},i.clusterOptions.reduce=(t,i)=>{for(let r of(o.properties=i,l))s.accumulated=t[r],t[r]=n[r].evaluate(s,o)},i.clusterOptions}class g{constructor(i){this.self=i,this.actor=new t.N(i),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(t,i)=>{if(this.externalWorkerSourceTypes[t])throw Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=i},this.self.addProtocol=t.cH,this.self.removeProtocol=t.cI,this.self.registerRTLTextPlugin=i=>{t.d1.setMethods(i)},this.self.makeRequest=t.m,this.actor.registerMessageHandler("LDT",(t,i)=>this._getDEMWorkerSource(t,i.source).loadTile(i)),this.actor.registerMessageHandler("RDT",(i,r)=>t._(this,void 0,void 0,function*(){this._getDEMWorkerSource(i,r.source).removeTile(r)})),this.actor.registerMessageHandler("GCEZ",(i,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(i,r.type,r.source).getClusterExpansionZoom(r)})),this.actor.registerMessageHandler("GCC",(i,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(i,r.type,r.source).getClusterChildren(r)})),this.actor.registerMessageHandler("GCL",(i,r)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(i,r.type,r.source).getClusterLeaves(r)})),this.actor.registerMessageHandler("LD",(t,i)=>this._getWorkerSource(t,i.type,i.source).loadData(i)),this.actor.registerMessageHandler("LT",(t,i)=>this._getWorkerSource(t,i.type,i.source).loadTile(i)),this.actor.registerMessageHandler("RT",(t,i)=>this._getWorkerSource(t,i.type,i.source).reloadTile(i)),this.actor.registerMessageHandler("AT",(t,i)=>this._getWorkerSource(t,i.type,i.source).abortTile(i)),this.actor.registerMessageHandler("RMT",(t,i)=>this._getWorkerSource(t,i.type,i.source).removeTile(i)),this.actor.registerMessageHandler("RS",(i,r)=>t._(this,void 0,void 0,function*(){var t,a;if(!(null==(a=null==(t=this.workerSources[i])?void 0:t[r.type])?void 0:a[r.source]))return;let n=this.workerSources[i][r.type][r.source];delete this.workerSources[i][r.type][r.source],void 0!==n.removeSource&&n.removeSource(r)})),this.actor.registerMessageHandler("RM",i=>t._(this,void 0,void 0,function*(){delete this.layerIndexes[i],delete this.availableImages[i],delete this.workerSources[i],delete this.demWorkerSources[i],this.globalStates.delete(i)})),this.actor.registerMessageHandler("SR",(i,r)=>t._(this,void 0,void 0,function*(){this.referrer=r})),this.actor.registerMessageHandler("SRPS",(t,i)=>this._syncRTLPluginState(t,i)),this.actor.registerMessageHandler("IS",(i,r)=>t._(this,void 0,void 0,function*(){this.self.importScripts(r)})),this.actor.registerMessageHandler("SI",(t,i)=>this._setImages(t,i)),this.actor.registerMessageHandler("UL",(i,r)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(i).update(r.layers,r.removedIds,this._getGlobalState(i))})),this.actor.registerMessageHandler("UGS",(i,r)=>t._(this,void 0,void 0,function*(){let t=this._getGlobalState(i);for(let i in r)t[i]=r[i]})),this.actor.registerMessageHandler("SL",(i,r)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(i).replace(r,this._getGlobalState(i))}))}_getGlobalState(t){let i=this.globalStates.get(t);return i||(i={},this.globalStates.set(t,i)),i}_setImages(i,r){return t._(this,void 0,void 0,function*(){for(let t in this.availableImages[i]=r,this.workerSources[i]){let a=this.workerSources[i][t];for(let t in a)a[t].availableImages=r}})}_syncRTLPluginState(i,r){return t._(this,void 0,void 0,function*(){return yield t.d1.syncState(r,this.self.importScripts)})}_getAvailableImages(t){let i=this.availableImages[t];
2return i||(i=[]),i}_getLayerIndex(t){let r=this.layerIndexes[t];return r||(r=this.layerIndexes[t]=new i),r}_getWorkerSource(t,i,r){var a,n;if((a=this.workerSources)[t]||(a[t]={}),(n=this.workerSources[t])[i]||(n[i]={}),!this.workerSources[t][i][r]){let a={sendAsync:(i,r)=>(i.targetMapId=t,this.actor.sendAsync(i,r))};switch(i){case"vector":this.workerSources[t][i][r]=new d(a,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][i][r]=new f(a,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][i][r]=new this.externalWorkerSourceTypes[i](a,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][i][r]}_getDEMWorkerSource(t,i){var r,a;return(r=this.demWorkerSources)[t]||(r[t]={}),(a=this.demWorkerSources[t])[i]||(a[i]=new p),this.demWorkerSources[t][i]}}return t.i(self)&&(self.worker=new g(self)),g}),r("index",["exports","./shared"],function(t,i){let r,a,n,s,o,l,h,u;var c,d,p,f,m,_,g="5.24.0";function y(){var t=new i.A(4);return i.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let x={frame(t,r,a,n){let s=n||window,o=s.requestAnimationFrame(t=>{l(),r(t)}),{unsubscribe:l}=i.s(t.signal,"abort",()=>{l(),s.cancelAnimationFrame(o),a(new i.a(t.signal.reason))},!1)},frameAsync(t,i){return new Promise((r,a)=>{this.frame(t,r,a,i)})},getImageData(t,i=0){return this.getImageCanvasContext(t).getImageData(-i,-i,t.width+2*i,t.height+2*i)},getImageCanvasContext(t){let i=window.document.createElement("canvas"),r=i.getContext("2d",{willReadFrequently:!0});if(!r)throw Error("failed to create canvas 2d context");return i.width=t.width,i.height=t.height,r.drawImage(t,0,0,t.width,t.height),r},resolveURL:t=>(r||(r=document.createElement("a")),r.href=t,r.href),hardwareConcurrency:"u">typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==n?n:!!matchMedia&&(null!=a||(a=matchMedia("(prefers-reduced-motion: reduce)")),a.matches)},set prefersReducedMotion(e){n=e}},v=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:performance.now()}setNow(t){this._frozenAt=t}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function b(){return v.getCurrentTime()}class w{static create(t,i,r){let a=window.document.createElement(t);return void 0!==i&&(a.className=i),r&&r.appendChild(a),a}static createNS(t,i){return window.document.createElementNS(t,i)}static disableDrag(){w.docStyle&&w.selectProp&&(w.userSelect=w.docStyle[w.selectProp],w.docStyle[w.selectProp]="none")}static enableDrag(){w.docStyle&&w.selectProp&&(w.docStyle[w.selectProp]=w.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",w.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",w.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",w.suppressClickInternal,!0)},0)}static getScale(t){let i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}static getPoint(t,r,a){let n=r.boundingClientRect;return new i.P((a.clientX-n.left)/r.x-t.clientLeft,(a.clientY-n.top)/r.y-t.clientTop)}static mousePos(t,i){let r=w.getScale(t);return w.getPoint(t,r,i)}static touchPos(t,i){let r=[],a=w.getScale(t);for(let n of i)r.push(w.getPoint(t,a,n));return r}static sanitize(t){let i=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body");for(let t of i.querySelectorAll("script"))t.remove();return w.clean(i),i.innerHTML}static isPossiblyDangerous(t,i){let r=i.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!r.includes("javascript:")&&!r.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){for(let i of t.children)w.removeAttributes(i),w.clean(i)}static removeAttributes(t){for(let{name:i,value:r}of t.attributes)w.isPossiblyDangerous(i,r)&&t.removeAttribute(i)}}w.docStyle="u">typeof window&&(null==(p=window.document)?void 0:p.documentElement.style),w.selectProp=!w.docStyle||"userSelect"in w.docStyle?"userSelect":"webkitUserSelect",function(t){let r,a,n,s;t.resetRequestQueue=()=>{r=[],a=0,n=0,s={}},t.addThrottleControl=t=>{let i=n++;return s[i]=t,i},t.removeThrottleControl=t=>{delete s[t],l()},t.getImage=(t,a,n=!0)=>new Promise((s,o)=>{t.headers||(t.headers={}),t.headers.accept="image/webp,*/*",i.e(t,{type:"image"}
2),r.push({abortController:a,requestParameters:t,supportImageRefresh:n,state:"queued",onError:t=>{o(t)},onSuccess:t=>{s(t)}}),l()});let o=t=>i._(this,void 0,void 0,function*(){var r;t.state="running";let{requestParameters:n,supportImageRefresh:s,onError:o,onSuccess:u,abortController:c}=t,d=!1===s&&!i.i(self)&&!i.g(n.url)&&(!n.headers||Object.keys(n.headers).reduce((t,i)=>t&&"accept"===i,!0));a++;let p=d?h(n,c):i.m(n,c);try{let a=yield p;delete t.abortController,t.state="completed",a.data instanceof HTMLImageElement||i.b(a.data)?u(a):a.data&&u({data:yield(r=a.data,"function"==typeof createImageBitmap?i.h(r):i.j(r)),cacheControl:a.cacheControl,expires:a.expires})}catch(r){delete t.abortController,o(i.d(r))}finally{a--,l()}}),l=()=>{let t=(()=>{for(let t of Object.keys(s))if(s[t]())return!0;return!1})()?i.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:i.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let i=a;i<t&&r.length>0;i++){let t=r.shift();t.abortController.signal.aborted?i--:o(t)}},h=(t,r)=>new Promise((a,n)=>{let s=new Image,o=t.url,l=t.credentials;l&&"include"===l?s.crossOrigin="use-credentials":(l&&"same-origin"===l||!i.f(o))&&(s.crossOrigin="anonymous"),r.signal.addEventListener("abort",()=>{s.src="",n(new i.a(r.signal.reason))}),s.fetchPriority="high",s.onload=()=>{s.onerror=s.onload=null,a({data:s})},s.onerror=()=>{s.onerror=s.onload=null,r.signal.aborted||n(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."))},s.src=o})}(f||(f={})),f.resetRequestQueue();class T{constructor(t){this._transformRequestFn=null!=t?t:null}transformRequest(t,i){return this._transformRequestFn&&this._transformRequestFn(t,i)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function S(t){let i=[];if("string"==typeof t)i.push({id:"default",url:t});else if(t&&t.length>0){let r=[];for(let{id:a,url:n}of t){let t=`${a}${n}`;r.includes(t)||(r.push(t),i.push({id:a,url:n}))}}return i}function P(t,i,r){try{let a=new URL(t);return a.pathname+=`${i}${r}`,a.toString()}catch(i){throw Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class M extends i.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.R({width:1,height:1}),this.dirty=!0}destroy(){for(let t of(this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null),Object.keys(this.images)))this.removeImage(t);this.patterns={},this.atlasImage=new i.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(let{ids:t,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t));this.requestors=[]}}getImage(t){let r=this.images[t];if(r&&!r.data&&r.spriteData){let t=r.spriteData;r.data=new i.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),r.spriteData=null}return r}addImage(t,i){if(this.images[t])throw Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,i)&&(this.images[t]=i)}_validate(t,r){let a=!0,n=r.data||r.spriteData;return this._validateStretch(r.stretchX,null==n?void 0:n.width)||(this.fire(new i.l(Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(r.stretchY,null==n?void 0:n.height)||(this.fire(new i.l(Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(r.content,r)||(this.fire(new i.l(Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,i){if(!t)return!0;let r=0;for(let a of t){if(a[0]<r||a[1]<a[0]||i<a[1])return!1;r=a[1]}return!0}_validateContent(t,i){if(!t)return!0;if(4!==t.length)return!1;let r=i.spriteData,a=(null==r?void 0:r.width)||i.data.width,n=(null==r?void 0:r.height)||i.data.height;return!(t[0]<0||a<t[0]||t[1]<0||n<t[1]||t[2]<0||a<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||!(t[3]>=t[1]))}updateImage(t,i,r=!0){let a=this.getImage(t);if(r&&(a.data.width!==i.data.width||a.data.height!==i.data.height))throw Error(`size mismatch between old image (${a.data.width}x${a.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=a.version+1,this.images[t]=i,this.updatedImages[t]=!0}removeImage(t){var i;let r=this.images[t];delete this.images[t],delete this.patterns[t],(null==(i=r.userImage)?void 0:i.onRemove)&&r.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise((i,r)=>{let a=!0;if(!this.isLoaded())for(let i of t)this.images[i]||(a=!1);this.isLoaded()||a?i(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:i})})}_getImagesForIds(t){var r;let a={};for(let n of t){let t=this.getImage(n);t||(this.fire(new i.n("styleimagemissing",{id:n})),t=this.getImage(n)),t?a[n]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:!!(null==(r=t.userImage)?void 0:r.render)}:i.w(`Image "${n}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return a}getPixelSize(){let{width:t,height:i}=this.atlasImage;return{width:t,height:i}}getPattern(t){let r=this.patterns[t],a=this.getImage(t);if(!a)return null;if(r&&r.position.version===a.version)return r.position;if(r)r.position.version=a.version;else{let r={w:a.data.width+2,h:a.data.height+2,x:0,y:0},n=new i.I(r,a);
2this.patterns[t]={bin:r,position:n}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){let r=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new i.T(t,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){let t=[];for(let i in this.patterns)t.push(this.patterns[i].bin);let{w:r,h:a}=i.p(t),n=this.atlasImage;for(let t in n.resize({width:r||1,height:a||1}),this.patterns){let{bin:r}=this.patterns[t],a=r.x+1,s=r.y+1,o=this.getImage(t).data,l=o.width,h=o.height;i.R.copy(o,n,{x:0,y:0},{x:a,y:s},{width:l,height:h}),i.R.copy(o,n,{x:0,y:h-1},{x:a,y:s-1},{width:l,height:1}),i.R.copy(o,n,{x:0,y:0},{x:a,y:s+h},{width:l,height:1}),i.R.copy(o,n,{x:l-1,y:0},{x:a-1,y:s},{width:1,height:h}),i.R.copy(o,n,{x:0,y:0},{x:a+l,y:s},{width:1,height:h})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let r of t){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;let t=this.getImage(r);t||i.w(`Image with ID: "${r}" was not found`),function(t){let{userImage:i}=t;return!(!(null==i?void 0:i.render)||!i.render()||(t.data.replace(new Uint8Array(i.data.buffer)),0))}(t)&&this.updateImage(r,t)}}cloneImages(){let t={};for(let i in this.images){let r=this.images[i];t[i]=Object.assign(Object.assign({},r),{data:r.data?r.data.clone():null})}return t}}let I=new Float64Array(256);for(let t=0;t<256;t++){let i=.5-Math.pow(t/255,1/2.2);I[t]=i*Math.abs(i)}function E(t,i,r,a,n,s,o,l,h){for(let u=i;u<i+a;u++)C(t,r*s+u,s,n,o,l,h);for(let u=r;u<r+n;u++)C(t,u*s+i,1,a,o,l,h)}function C(t,i,r,a,n,s,o){s[0]=0,o[0]=-1e20,o[1]=1e20,n[0]=t[i];for(let l=1,h=0,u=0;l<a;l++){n[l]=t[i+l*r];let a=l*l;do{let t=s[h];u=(n[l]-n[t]+a-t*t)/(l-t)/2}while(u<=o[h]&&--h>-1);s[++h]=l,o[h]=u,o[h+1]=1e20}for(let l=0,h=0;l<a;l++){for(;o[h+1]<l;)h++;let a=s[h],u=l-a;t[i+l*r]=n[a]+u*u}}I[255]=-1e20;let A=i.v.layout_symbol["text-font"].default.join(",");class D{constructor(t,i,r){this.requestManager=t,this.localIdeographFontFamily=i,this.entries={},this.lang=r}setURL(t){this.url=t}getGlyphs(t){return i._(this,void 0,void 0,function*(){let i=[];for(let r in t)for(let a of t[r])i.push(this._getAndCacheGlyphsPromise(r,a));let r=yield Promise.all(i),a={};for(let{stack:t,id:i,glyph:n}of r)a[t]||(a[t]={}),a[t][i]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return a})}_getAndCacheGlyphsPromise(t,r){return i._(this,void 0,void 0,function*(){var i;null!=(i=this.entries)[t]||(i[t]={glyphs:{},requests:{},ranges:{}});let a=this.entries[t],n=a.glyphs[r];return void 0!==n?{stack:t,id:r,glyph:n}:!this.url||this._charUsesLocalIdeographFontFamily(r)?(n=a.glyphs[r]=this._drawGlyph(a,t,r),{stack:t,id:r,glyph:n}):yield this._downloadAndCacheRangePromise(t,r)})}_downloadAndCacheRangePromise(t,r){return i._(this,void 0,void 0,function*(){var a;let n=this.entries[t],s=Math.floor(r/256);if(n.ranges[s])return{stack:t,id:r,glyph:null};(a=n.requests)[s]||(a[s]=D.loadGlyphRange(t,s,this.url,this.requestManager));try{let i=yield n.requests[s];for(let t in i)n.glyphs[+t]=i[+t];return n.ranges[s]=!0,{stack:t,id:r,glyph:i[r]||null}}catch(o){let a=n.glyphs[r]=this._drawGlyph(n,t,r);return this._warnOnMissingGlyphRange(a,s,r,i.d(o)),{stack:t,id:r,glyph:a}}})}_warnOnMissingGlyphRange(t,r,a,n){let s=256*r,o=a.toString(16).padStart(4,"0").toUpperCase();i.w(`Unable to load glyph range ${r}, ${s}-${s+255}. Rendering codepoint U+${o} locally instead. ${n}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&i.r(t)}_drawGlyph(t,r,a){let n=r===A&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(a),s=n?"ideographTinySDF":"tinySDF";t[s]||(t[s]=this._createTinySDF(n?this.localIdeographFontFamily:r));let o=t[s].draw(String.fromCodePoint(a)),l=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(a));return{id:a,bitmap:new i.t({width:o.width||60,height:o.height||60},o.data),metrics:{width:l?0:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:l?0:o.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){let i=t?t.split(","):[];i.push("sans-serif");let r=i.map(t=>/[-\w]+/.test(t)?t:`'${CSS.escape(t)}'`).join(",");return new D.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:r,fontWeight:this._fontWeight(i[0]),fontStyle:this._fontStyle(i[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){let i;for(let[r,a]of Object.entries({thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950}))RegExp(`\\b${r}\\b`,"i").test(t)&&(i=`${a}`);return i}destroy(){for(let t in this.entries){let i=this.entries[t];
2i.tinySDF=null,i.ideographTinySDF=null,i.glyphs={},i.requests={},i.ranges={}}this.entries={}}}D.loadGlyphRange=function(t,r,a,n){return i._(this,void 0,void 0,function*(){let s=256*r,o=s+255,l=yield n.transformRequest(a.replace("{fontstack}",t).replace("{range}",`${s}-${o}`),"Glyphs"),h=yield i.o(l,new AbortController);if(!(null==h?void 0:h.data))throw Error(`Could not load glyph range. range: ${r}, ${s}-${o}`);let u={};for(let t of i.q(h.data))u[t.id]=t;return u})},D.TinySDF=class{constructor({fontSize:t=24,buffer:i=3,radius:r=8,cutoff:a=.25,fontFamily:n="sans-serif",fontWeight:s="normal",fontStyle:o="normal",lang:l=null}={}){this.buffer=i,this.radius=r,this.cutoff=a,this.lang=l;const h=this.size=t+4*i,u=this._createCanvas(h),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${s} ${t}px ${n}`,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(t){if("u">typeof OffscreenCanvas)return new OffscreenCanvas(t,t);let i=document.createElement("canvas");return i.width=i.height=t,i}draw(t){let{width:i,actualBoundingBoxAscent:r,actualBoundingBoxDescent:a,actualBoundingBoxLeft:n,actualBoundingBoxRight:s}=this.ctx.measureText(t),o=Math.ceil(r),l=Math.floor(n),h=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s)-l)),u=Math.max(0,Math.min(this.size-this.buffer,o+Math.ceil(a))),c=h+2*this.buffer,d=u+2*this.buffer,p=Math.max(c*d,0),f=new Uint8ClampedArray(p),m={data:f,width:c,height:d,glyphWidth:h,glyphHeight:u,glyphTop:o,glyphLeft:l,glyphAdvance:i};if(0===h||0===u)return m;let{ctx:_,buffer:g,gridInner:y,gridOuter:x}=this;this.lang&&(_.lang=this.lang),_.clearRect(g,g,h,u),_.fillText(t,g-l,g+o);let v=_.getImageData(g,g,h,u);x.fill(1e20,0,p),y.fill(0,0,p);let b=3;for(let t=0;t<u;t++){let i=(t+g)*c+g;for(let t=0;t<h;t++,b+=4,i++){let t=v.data[b];if(0===t)continue;let r=I[t];x[i]=Math.max(0,r),y[i]=Math.max(0,-r)}}E(x,0,0,c,d,c,this.f,this.v,this.z),E(y,g,g,h,u,c,this.f,this.v,this.z);let w=255/this.radius,T=255*(1-this.cutoff);for(let t=0;t<p;t++){let i=Math.sqrt(x[t])-Math.sqrt(y[t]);f[t]=Math.round(T-w*i)}return m}};class z{constructor(){this.specification=i.x.light.position}possiblyEvaluate(t,r){return i.G(t.expression.evaluate(r))}interpolate(t,r,a){return{x:i.H.number(t.x,r.x,a),y:i.H.number(t.y,r.y,a),z:i.H.number(t.z,r.z,a)}}}class k extends i.E{constructor(t){super(),s||(s=new i.u({anchor:new i.D(i.x.light.anchor),position:new z,color:new i.D(i.x.light.color),intensity:new i.D(i.x.light.intensity)})),this._transitionable=new i.y(s,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,r={}){if(!this._validate(i.z,t,r))for(let r in t){let a=t[r];r.endsWith(i.B)?this._transitionable.setTransition(r.slice(0,-i.B.length),a):this._transitionable.setValue(r,a)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,a){return!1!==(null==a?void 0:a.validate)&&i.C(this,t.call(i.F,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:i.x}))}}let R=new i.u({"sky-color":new i.D(i.x.sky["sky-color"]),"horizon-color":new i.D(i.x.sky["horizon-color"]),"fog-color":new i.D(i.x.sky["fog-color"]),"fog-ground-blend":new i.D(i.x.sky["fog-ground-blend"]),"horizon-fog-blend":new i.D(i.x.sky["horizon-fog-blend"]),"sky-horizon-blend":new i.D(i.x.sky["sky-horizon-blend"]),"atmosphere-blend":new i.D(i.x.sky["atmosphere-blend"])});class L extends i.E{constructor(t){super(),this._transitionable=new i.y(R,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new i.J(0))}setSky(t,r={}){if(!this._validate(i.K,t,r))for(let r in t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0}),t){let a=t[r];r.endsWith(i.B)?this._transitionable.setTransition(r.slice(0,-i.B.length),a):this._transitionable.setValue(r,a)}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,r,a={}){return!1!==(null==a?void 0:a.validate)&&i.C(this,t.call(i.F,i.e({value:r,style:{glyphs:!0,sprite:!0},styleSpec:i.x})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class F{constructor(t,i){this.width=t,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,i){var r;let a=t.join(",")+String(i);return(r=this.dashEntry)[a]||(r[a]=this.addDash(t,i)),this.dashEntry[a]}getDashRanges(t,i,r){let a=[],n=t.length%2==1?-t[t.length-1]*r:0,s=t[0]*r,o=!0;a.push({left:n,right:s,isDash:o,zeroLength:0===t[0]});let l=t[0];for(let i=1;i<t.length;i++){o=!o;let h=t[i];n=l*r,l+=h,s=l*r,a.push({left:n,right:s,isDash:o,zeroLength:0===
2h})}return a}addRoundDash(t,i,r){let a=i/2;for(let i=-r;i<=r;i++){let n=this.width*(this.nextRow+r+i),s=0,o=t[0];for(let l=0;l<this.width;l++){let h;l/o.right>1&&(o=t[++s]);let u=Math.min(Math.abs(l-o.left),Math.abs(l-o.right)),c=i/r*(a+1);if(o.isDash){let t=a-Math.abs(c);h=Math.sqrt(u*u+t*t)}else h=a-Math.sqrt(u*u+c*c);this.data[n+l]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let i=t.length-1;i>=0;--i){let r=t[i],a=t[i+1];r.zeroLength?t.splice(i,1):a&&a.isDash===r.isDash&&(a.left=r.left,t.splice(i,1))}let i=t[0],r=t[t.length-1];i.isDash===r.isDash&&(i.left=r.left-this.width,r.right=i.right+this.width);let a=this.width*this.nextRow,n=0,s=t[0];for(let i=0;i<this.width;i++){i/s.right>1&&(s=t[++n]);let r=Math.min(Math.abs(i-s.left),Math.abs(i-s.right));this.data[a+i]=Math.max(0,Math.min(255,(s.isDash?r:-r)+128))}}addDash(t,r){let a=7*!!r,n=2*a+1;if(this.nextRow+n>this.height)return i.w("LineAtlas out of space"),null;let s=0;for(let i of t)s+=i;if(0!==s){let i=this.width/s,n=this.getDashRanges(t,this.width,i);r?this.addRoundDash(n,i,a):this.addRegularDash(n)}let o={y:this.nextRow+a,height:2*a,width:s};return this.nextRow+=n,this.dirty=!0,o}bind(t){let i=t.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}let B="maplibre_preloaded_worker_pool";class O{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<O.workerCount;)this.workers.push(new Worker(i.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){if(delete this.active[t],0===this.numActive()){for(let t of this.workers)t.terminate();this.workers=null}}isPreloaded(){return!!this.active[B]}numActive(){return Object.keys(this.active).length}}let V=Math.floor(x.hardwareConcurrency/2);function j(){return o||(o=new O),o}O.workerCount=i.L(globalThis)?Math.max(Math.min(V,3),1):1;class N{constructor(t,r){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=r;const a=this.workerPool.acquire(r);for(let t=0;t<a.length;t++){const n=new i.N(a[t],r);n.name=`Worker ${t}`,this.actors.push(n)}if(!this.actors.length)throw Error("No actors found")}broadcast(t,i){let r=[];for(let a of this.actors)r.push(a.sendAsync({type:t,data:i}));return Promise.all(r)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(let t of this.actors)t.remove();this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,i){for(let r of this.actors)r.registerMessageHandler(t,i)}unregisterMessageHandler(t){for(let i of this.actors)i.unregisterMessageHandler(t)}}function U(){return l||(l=new N(j(),i.M)).registerMessageHandler("GR",(t,r,a)=>i.m(r,a)),l}function G(t,i){let r=t.tileID,a=i.tileID;return r.overscaledZ-a.overscaledZ||r.canonical.y-a.canonical.y||r.wrap-a.wrap||r.canonical.x-a.canonical.x}function $(t,i){let r=t.feature,a=i.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=a}function Z(t,r,a,n){return i._(this,void 0,void 0,function*(){let s=t;if(t.url?s=(yield i.k((yield r.transformRequest(t.url,"Source")),a)).data:yield x.frameAsync(a,n),!s)return null;let o=i.V(i.e(s,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(o.vectorLayerIds=s.vector_layers.map(t=>t.id)),o})}class q{constructor(t,i){t&&(i?this.setSouthWest(t).setNorthEast(i):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof i.W?new i.W(t.lng,t.lat):i.W.convert(t),this}
2setSouthWest(t){return this._sw=t instanceof i.W?new i.W(t.lng,t.lat):i.W.convert(t),this}extend(t){let r,a,n=this._sw,s=this._ne;if(t instanceof i.W)r=t,a=t;else{if(!(t instanceof q))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(q.convert(t)):this.extend(i.W.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(i.W.convert(t)):this;if(r=t._sw,a=t._ne,!r||!a)return this}return n||s?(n.lng=Math.min(r.lng,n.lng),n.lat=Math.min(r.lat,n.lat),s.lng=Math.max(a.lng,s.lng),s.lat=Math.max(a.lat,s.lat)):(this._sw=new i.W(r.lng,r.lat),this._ne=new i.W(a.lng,a.lat)),this}getCenter(){return new i.W((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new i.W(this.getWest(),this.getNorth())}getSouthEast(){return new i.W(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:r,lat:a}=i.W.convert(t),n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&n}intersects(t){if(!((t=q.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let r=Math.abs(this.getEast()-this.getWest()),a=Math.abs(t.getEast()-t.getWest());if(r>=360||a>=360)return!0;let n=i.X(this.getWest(),-180,180),s=i.X(this.getEast(),-180,180),o=i.X(t.getWest(),-180,180),l=i.X(t.getEast(),-180,180),h=n>s,u=o>l;return!(!h||!u)||(h?l>=n||o<=s:u?s>=o||n<=l:o<=s&&l>=n)}static convert(t){return t instanceof q?t:t?new q(t):t}static fromLngLat(t,r=0){let a=360*r/0x2637f09,n=a/Math.cos(Math.PI/180*t.lat);return new q(new i.W(t.lng-n,t.lat-a),new i.W(t.lng+n,t.lat+a))}adjustAntiMeridian(){let t=new i.W(this._sw.lng,this._sw.lat),r=new i.W(this._ne.lng,this._ne.lat);return new q(t,t.lng>r.lng?new i.W(r.lng+360,r.lat):r)}}class W{constructor(t,i,r){this.bounds=q.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=r||24}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){let r=Math.pow(2,t.z),a=Math.floor(i.Z(this.bounds.getWest())*r),n=Math.floor(i.Y(this.bounds.getNorth())*r),s=Math.ceil(i.Z(this.bounds.getEast())*r),o=Math.ceil(i.Y(this.bounds.getSouth())*r);return t.x>=a&&t.x<s&&t.y>=n&&t.y<o}}class H extends i.E{constructor(t,r,a,n){if(super(),this.id=t,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.e(this,i.V(r,["url","scheme","tileSize","promoteId","encoding"])),this._options=i.e({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){return i._(this,arguments,void 0,function*(t=!1){this._loaded=!1,this.fire(new i.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let r=yield Z(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,r&&(i.e(this,r),r.bounds&&(this.tileBounds=new W(r.bounds,this.minzoom,this.maxzoom)),this.fire(new i.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,i.$(t)||this.fire(new i.l(i.d(t)))}})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return i.e({},this._options)}
2loadTile(t){return i._(this,void 0,void 0,function*(){let i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:yield this.map._requestManager.transformRequest(i,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(t),etag:t.etag};r.request.collectResourceTiming=this._collectResourceTiming;let a="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise((i,r)=>{t.reloadPromise={resolve:i,reject:r}})}else t.actor=this.dispatcher.getActor(),a="LT";t.abortController=new AbortController;try{let i=yield t.actor.sendAsync({type:a,data:r},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,i);let n={};return(null==i?void 0:i.etagUnmodified)&&(n.unmodified=!0),n}catch(i){if(delete t.abortController,t.aborted)return;if(i&&404!==i.status)throw i;this._afterTileLoadWorkerResponse(t,null)}})}_getOverzoomParameters(t){return i._(this,void 0,void 0,function*(){if(t.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let i=t.tileID.scaledTo(this.maxzoom).canonical,r=i.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:i,overzoomRequest:yield this.map._requestManager.transformRequest(r,"Tile")}})}_afterTileLoadWorkerResponse(t,i){if((null==i?void 0:i.resourceTiming)&&(t.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&t.setExpiryData(i),t.etag=null==i?void 0:i.etag,t.loadVectorData(i,this.map.painter),t.reloadPromise){let i=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(i.resolve).catch(i.reject)}}abortTile(t){return i._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.t
2ype,source:this.id}}))})}unloadTile(t){return i._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class X extends i.E{constructor(t,r,a,n){super(),this.id=t,this.dispatcher=a,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=i.e({type:"raster"},r),i.e(this,i.V(r,["url","scheme","tileSize"]))}load(){return i._(this,arguments,void 0,function*(t=!1){this._loaded=!1,this.fire(new i.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let r=yield Z(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,r&&(i.e(this,r),r.bounds&&(this.tileBounds=new W(r.bounds,this.minzoom,this.maxzoom)),this.fire(new i.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,i.$(t)||this.fire(new i.l(i.d(t)))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return i.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return i._(this,void 0,void 0,function*(){let r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{let a=yield f.getImage((yield this.map._requestManager.transformRequest(r,"Tile")),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(null==a?void 0:a.data){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});let r=this.map.painter.context,n=r.gl,s=a.data;t.texture=this.map.painter.getTileTexture(s.width),t.texture?t.texture.update(s,{useMipmap:!0}):(t.texture=new i.T(r,s,n.RGBA,{useMipmap:!0}),t.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(i){if(delete t.abortController,t.aborted)t.state="unloaded";else if(i)throw t.state="errored",i}})}abortTile(t){return i._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return i._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class Y extends X{constructor(t,r,a,n){super(t,r,a,n),this.type="raster-dem",this.maxzoom=22,this._options=i.e({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox",this.redFactor=r.redFactor,this.greenFactor=r.greenFactor,this.blueFactor=r.blueFactor,this.baseShift=r.baseShift}loadTile(t){return i._(this,void 0,void 0,function*(){let r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=yield this.map._requestManager.transformRequest(r,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{let r=yield f.getImage(a,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(null==r?void 0:r.data){let a=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&t.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let n=i.b(a)&&i.a0()?a:yield this.readImageNow(a),s={type:this.type,uid:t.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&"expired"!==t.state&&"reloading"!==t.state)return;t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor()),t.dem=yield t.actor.sendAsync({type:"LDT",data:s}
2),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}catch(i){if(delete t.abortController,t.aborted)t.state="unloaded";else if(i)throw t.state="errored",i}})}readImageNow(t){return i._(this,void 0,void 0,function*(){if("u">typeof VideoFrame&&i.a1()){let r=t.width+2,a=t.height+2;try{return new i.R({width:r,height:a},(yield i.a2(t,-1,-1,r,a)))}catch(t){}}return x.getImageData(t,1)})}_getNeighboringTiles(t){let r=t.canonical,a=Math.pow(2,r.z),n=(r.x-1+a)%a,s=0===r.x?t.wrap-1:t.wrap,o=(r.x+1+a)%a,l=r.x+1===a?t.wrap+1:t.wrap,h={};return h[new i.a3(t.overscaledZ,s,r.z,n,r.y).key]={backfilled:!1},h[new i.a3(t.overscaledZ,l,r.z,o,r.y).key]={backfilled:!1},r.y>0&&(h[new i.a3(t.overscaledZ,s,r.z,n,r.y-1).key]={backfilled:!1},h[new i.a3(t.overscaledZ,t.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},h[new i.a3(t.overscaledZ,l,r.z,o,r.y-1).key]={backfilled:!1}),r.y+1<a&&(h[new i.a3(t.overscaledZ,s,r.z,n,r.y+1).key]={backfilled:!1},h[new i.a3(t.overscaledZ,t.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},h[new i.a3(t.overscaledZ,l,r.z,o,r.y+1).key]={backfilled:!1}),h}unloadTile(t){return i._(this,void 0,void 0,function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}function K(t,i){return i?t.properties[i]:t.id}function J(t){var i,r;if(!t)return{};let a={};return a.removeAll=t.removeAll,a.remove=new Set(t.remove||[]),a.add=new Map(null==(i=t.add)?void 0:i.map(t=>[t.id,t])),a.update=new Map(null==(r=t.update)?void 0:r.map(t=>[t.id,t])),a}function Q(t){return"GeometryCollection"===t.type?t.geometries.flatMap(t=>Q(t)):function t(i){return i&&0!==i.length?"number"==typeof i[0]?[i]:i.flatMap(i=>t(i)):[]}(t.coordinates)}function ee(t){let i,r=new q;switch(t.type){case"FeatureCollection":i=t.features.flatMap(t=>Q(t.geometry));break;case"Feature":i=Q(t.geometry);break;default:i=Q(t)}if(0===i.length)return r;for(let t of i){let[i,a]=t;r.extend([i,a])}return r}class et extends i.E{constructor(t,r,a,n){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:r.data},this.actor=a.getActor(),this.setEventedParent(n),this._data="string"==typeof r.data?{url:r.data}:{geojson:r.data},this._options=i.e({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId,void 0!==r.clusterMaxZoom&&this.maxzoom<=r.clusterMaxZoom&&i.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${r.clusterMaxZoom}".`),this.workerOptions=i.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==r.buffer?r.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==r.tolerance?r.tolerance:.375),extent:i.a6,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1,promoteId:"string"==typeof r.promoteId?r.promoteId:void 0,cluster:r.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(r.clusterMaxZoom),minPoints:Math.max(2,r.clusterMinPoints||2),extent:i.a6,radius:this._pixelsToTileUnits(r.clusterRadius||50),log:!1,generateId:r.generateId||!1}},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(i.a6/this.tileSize)}_getClusterMaxZoom(t){let r=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||void 0===t||i.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${r}"`),r}load(){return i._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t,i){this._data="string"==typeof t?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};let r=this._updateWorkerData();return i?r:this}updateData(t,i){this._pendingWorkerUpdate.diff=function(t,i){let r;if(!t)return i||{};if(!i)return t||{};let a=J(t),n=J(i);for(let t of(n.removeAll&&(a.add.clear(),a.update.clear(),a.remove.clear(),n.remove.clear()),n.remove))a.add.delete(t),a.update.delete(t);for(let[t,i]of n.update){let r=a.update.get(t);r&&(n.update.set(t,function(t,i){let r={id:t.id};if(i.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete i.removeProperties),i.removeProperties)for(let r of i.removeProperties){let i=t.addOrUpdateProperties.findIndex(t=>t.key===r);i>-1&&t.addOrUpdateProperties.splice(i,1)}return(t.removeAllProperties||i.removeAllProperties)&&(r.removeAllProperties=!0),(t.removeProperties||i.removeProperties)&&(r.removeProperties=[...t.removeProperties||[],...i.removeProperties||[]]),(t.addOrUpdateProperties||i.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...i.addOrUpdateProperties||[]]),(t.newGeometry||i.newGeometry)&&(r.newGeometry=i.newGeometry||t.newGeometry),r}(r,i)),a.update.delete(t))}let s={};
2if((a.removeAll||n.removeAll)&&(s.removeAll=!0),s.remove=new Set([...a.remove,...n.remove]),s.add=new Map([...a.add,...n.add]),s.update=new Map([...a.update,...n.update]),s.remove.size&&s.add.size)for(let t of s.add.keys())s.remove.delete(t);return r={},s.removeAll&&(r.removeAll=s.removeAll),s.remove&&(r.remove=Array.from(s.remove)),s.add&&(r.add=Array.from(s.add.values())),s.update&&(r.update=Array.from(s.update.values())),r}(this._pendingWorkerUpdate.diff,t);let r=this._updateWorkerData();return i?r:this}getData(){return i._(this,void 0,void 0,function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}})}getBounds(){return i._(this,void 0,void 0,function*(){return ee((yield this.getData()))})}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,void 0!==t.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,i,r){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:i,offset:r}})}_updateWorkerData(){return i._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void i.w(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:t,diff:r,updateCluster:a}=this._pendingWorkerUpdate,n=this._getLoadGeoJSONParameters(t,r,a);void 0!==t?this._pendingWorkerUpdate.data=void 0:r?this._pendingWorkerUpdate.diff=void 0:a&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(n)})}_getLoadGeoJSONParameters(t,r,a){return i._(this,void 0,void 0,function*(){let n=i.e({type:this.type},this.workerOptions);return"string"==typeof t?(n.request=yield this.map._requestManager.transformRequest(x.resolveURL(t),"Source"),n.request.collectResourceTiming=this._collectResourceTiming,n):void 0!==t?(n.data=t,n):r?(n.dataDiff=r,n):a?(n.updateCluster=!0,n):void 0})}_dispatchWorkerUpdate(t){return i._(this,void 0,void 0,function*(){this._isUpdatingWorker=!0,this.fire(new i.n("dataloading",{dataType:"source"}));try{let r=yield t,a=yield this.actor.sendAsync({type:"LD",data:r});if(this._isUpdatingWorker=!1,this._removed||a.abandoned)return void this.fire(new i.n("dataabort",{dataType:"source"}));a.data&&(this._data={geojson:a.data});let n=this._applyDiffToSource(r.dataDiff),s=this._getShouldReloadTileOptions(n),o={dataType:"source"};this._applyResourceTiming(o,a),this.fire(new i.n("data",Object.assign(Object.assign({},o),{sourceDataType:"metadata"}))),this.fire(new i.n("data",Object.assign(Object.assign({},o),{sourceDataType:"content",shouldReloadTileOptions:s})))}catch(t){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new i.n("dataabort",{dataType:"source"}));this.fire(new i.l(i.d(t)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyResourceTiming(t,r){var a;if(!this._collectResourceTiming)return;let n=null==(a=r.resourceTiming)?void 0:a[this.id];if(!n)return;let s=n.slice(0);(null==s?void 0:s.length)&&i.e(t,{resourceTiming:s})}_applyDiffToSource(t){if(!t)return;let i="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let t=function(t,i){let r=new Map;if(null==t||null==t.type)return r;if("Feature"===t.type){let a=K(t,i);if(null==a)return;return r.set(a,t),r}if("FeatureCollection"===t.type){let a=new Set;for(let n of t.features){let t=K(n,i);if(null==t||a.has(t))return;a.add(t),r.set(t,n)}return r}}(this._data.geojson,i);if(!t)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:t}}if(!this._data.updateable)return;let r=function(t,i,r){var a,n;let s=[];if(i.removeAll)t.clear();else if(i.remove)for(let r of i.remove){let i=t.get(r);i&&(s.push(i.geometry),t.delete(r))}if(i.add)for(let a of i.add){let i=K(a,r);if(null==i)continue;let n=t.get(i);n&&s.push(n.geometry),s.push(a.geometry),t.set(i,a)}if(i.update)for(let r of i.update){let i=t.get(r.id);if(!i)continue;let o=!!r.newGeometry,l=r.removeAllProperties||(null==(a=r.removeProperties)?void 0:a.length)>0||(null==(n=r.addOrUpdateProperties)?void 0:n.length)>0;if(!o&&!l)continue;s.push(i.geometry);let h=Object.assign({},i);if(t.set(r.id,h),o&&(s.push(r.newGeometry),h.geometry=r.newGeometry),l){if(h.properties=r.removeAllProperties?{}:Object.assign({},h.properties||{}),r.removeProperties)for(let t of r.removeProperties)delete h.properties[t];
2if(r.addOrUpdateProperties)for(let{key:t,value:i}of r.addOrUpdateProperties)h.properties[t]=i}}return s}(this._data.updateable,t,i);return t.removeAll||this._options.cluster?void 0:r}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map(t=>ee(t))}}shouldReloadTile(t,{affectedBounds:r}){if("loading"===t.state)return!0;if("unloaded"===t.state)return!1;let{buffer:a,extent:n}=this.workerOptions.geojsonVtOptions,s=function({x:t,y:r,z:a},n=0){return new q([i.a4((t-n)/Math.pow(2,a)),i.a5((r+1+n)/Math.pow(2,a))],[i.a4((t+1+n)/Math.pow(2,a)),i.a5((r-n)/Math.pow(2,a))])}(t.tileID.canonical,a/n);for(let t of r)if(s.intersects(t))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return i._(this,void 0,void 0,function*(){let i=t.actor?"RT":"LT";t.actor=this.actor;let r={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;let a=yield this.actor.sendAsync({type:i,data:r},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,"RT"===i)})}abortTile(t){return i._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return i._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.t
2ype,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return i.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class ei extends i.E{constructor(t,i,r,a){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=i}load(t){return i._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new i.n("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let i=yield f.getImage((yield this.map._requestManager.transformRequest(this.url,"Image")),this._request);this._request=null,this._loaded=!0,(null==i?void 0:i.data)&&(this.image=i.data,t&&(this.coordinates=t),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,i.$(t)||this.fire(new i.l(i.d(t)))}})}loaded(){return this._loaded}updateImage(t){return t.url&&(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>this.texture=null)),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.n("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){var r;let a,n,s;this.coordinates=t;let o=t.map(i.a7.fromLngLat);return this.tileID=(s=Math.pow(2,n=Math.max(0,Math.floor(-Math.log(Math.max((a=i.a8.fromPoints(o)).width(),a.height()))/Math.LN2))),new i.aa(n,Math.floor((a.minX+a.maxX)/2*s),Math.floor((a.minY+a.maxY)/2*s))),this.terrainTileRanges=this._getOverlappingTileRanges(o),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=o.map(t=>this.tileID.getTilePoint(t)._round()),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new i.n("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let t=this.map.painter.context,r=t.gl;this.texture||(this.texture=new i.T(t,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let a=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,a=!0)}a&&this.fire(new i.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return i._(this,void 0,void 0,function*(){var i;(null==(i=this.tileID)?void 0:i.equals(t.tileID.canonical))?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:r,minY:a,maxX:n,maxY:s}=i.a8.fromPoints(t),o={};for(let t=0;t<=i.a9;t++){let i=Math.pow(2,t),l=Math.floor(r*i),h=Math.floor(a*i),u=Math.floor(n*i),c=Math.floor(s*i),d=(l%i+i)%i,p=u%i,f=Math.floor(l/i),m=Math.floor(u/i);o[t]={minWrap:f,maxWrap:m,minTileXWrapped:d,maxTileXWrapped:p,minTileY:h,maxTileY:c}}return o}}class er extends ei{constructor(t,i,r,a){super(t,i,r,a),this._onPlayingHandler=()=>{var t;null==(t=this.map)||t.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=i}load(){return i._(this,void 0,void 0,function*(){this._loaded=!1;let t=this.options;for(let i of(this.urls=[],t.urls))this.urls.push((yield this.map._requestManager.transformRequest(i,"Source")).url);try{let t=yield i.ab(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new i.l(i.d(t)))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let r=this.video.seekable;t<r.start(0)||t>r.end(0)?this.fire(new i.l(new i.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}
2onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let t=this.map.painter.context,r=t.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new i.T(t,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let a=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,a=!0)}a&&this.fire(new i.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ea extends ei{constructor(t,r,a,n){super(t,r,a,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t))||this.fire(new i.l(new i.ac(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.l(new i.ac(`sources.${t}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new i.l(new i.ac(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new i.l(new i.ac(`sources.${t}`,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.l(new i.ac(`sources.${t}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){return i._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.l(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let r=this.map.painter.context,a=r.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new i.T(r,this.canvas,a.RGBA,{premultiply:!0}),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let n=!1;for(let t in this.tiles){let i=this.tiles[t];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture,n=!0)}n&&this.fire(new i.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}let en={},es=t=>{switch(t){case"geojson":return et;case"image":return ei;case"raster":return X;case"raster-dem":return Y;case"vector":return H;case"video":return er;case"canvas":return ea}return en[t]},eo="RTLPluginLoaded";class el extends i.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=U()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return i._(this,arguments,void 0,function*(t,i=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=x.resolveURL(t),!this.url)throw Error(`requested url ${t}
2 is invalid`);if("unavailable"===this.status){if(!i)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()})}_requestImport(){return i._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new i.n(eo))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let eh=null;function eu(){return eh||(eh=new el),eh}(c=m||(m={}))[c.Base=0]="Base",c[c.Parent=1]="Parent",(d=_||(_={}))[d.Departing=0]="Departing",d[d.Incoming=1]="Incoming";class ec{constructor(t,r){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=i.ad(),this.uses=0,this.tileSize=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:i,fadingParentID:r,fadeEndTime:a}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=i,this.fadingParentID=r,this.fadeEndTime=a}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=b(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,r,a){if(!0!==(null==t?void 0:t.etagUnmodified))if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){for(let n in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,i){let r={};if(!i)return r;for(let a of t){let t=a.layerIds.map(t=>i.getLayer(t)).filter(Boolean);if(0!==t.length)for(let i of(a.layers=t,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(i=>t.filter(t=>t.id===i)[0])),t))r[i.id]=a}return r}(t.buckets,null==r?void 0:r.style),this.hasSymbolBuckets=!1,this.buckets){let t=this.buckets[n];if(t instanceof i.af){if(this.hasSymbolBuckets=!0,!a)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let t in this.buckets){let r=this.buckets[t];if(r instanceof i.af&&r.hasRTLText){this.hasRTLText=!0,eu().lazyLoad();break}}for(let t in this.queryPadding=0,this.buckets){let i=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(t).queryRadius(i))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new i.ae;else this.state="loaded"}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(t)}let r=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new i.T(t,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new i.T(t,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,i,r,a,n,s,o,l,h,u,c){var d;return(null==(d=this.latestFeatureIndex)?void 0:d.rawTileData)?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:n,scale:s,tileSize:this.tileSize,pixelPosMatrix:u,transform:l,params:o,queryPadding:this.queryPadding*h,getElevation:c},t,i,r):{}}querySourceFeatures(t,r){let a=this.latestFeatureIndex;if(!(null==a?void 0:a.rawTileData))return;let n=a.loadVTLayers(),s=(null==r?void 0:r.sourceLayer)?r.sourceLayer:"",o=n[i.ag]||n[s];if(!o)return;let l=i.ah(null==r?void 0:r.filter,null==r?void 0:r.globalState),{z:h,x:u,y:c}=this.tileID.canonical,d={z:h,x:u,y:c};for(let r=0;r<o.length;r++){let n=o.feature(r);if(l.needGeometry){let t=i.ai(n,!0);
2if(!l.filter(new i.J(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!l.filter(new i.J(this.tileID.overscaledZ),n))continue;let p=a.getId(n,s),f=new i.aj(n,h,u,c,p);f.tile=d,t.push(f)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let r=this.expirationTime;if(t.cacheControl){let r=i.ak(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let t=Date.now(),i=!1;if(this.expirationTime>t)i=!1;else if(r)if(this.expirationTime<r)i=!0;else{let a=this.expirationTime-r;a?this.expirationTime=t+Math.max(a,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),0x7fffffff)}setFeatureState(t,r){var a,n,s;if(!(null==(a=this.latestFeatureIndex)?void 0:a.rawTileData)||0===Object.keys(t).length)return;let o=this.latestFeatureIndex.loadVTLayers();for(let a in this.buckets){if(!r.style.hasLayer(a))continue;let l=this.buckets[a],h=l.layers[0].sourceLayer||i.ag,u=o[h],c=t[h];if(!u||!c||0===Object.keys(c).length)continue;l.update(c,u,(null==(n=this.imageAtlas)?void 0:n.patternPositions)||{},this.dashPositions||{});let d=null==(s=null==r?void 0:r.style)?void 0:s.getLayer(a);d&&(this.queryPadding=Math.max(this.queryPadding,d.queryRadius(l)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<b()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=b()+t}setDependencies(t,i){let r={};for(let t of i)r[t]=!0;this.dependencies[t]=r}hasDependency(t,i){for(let r of t){let t=this.dependencies[r];if(t){for(let r of i)if(t[r])return!0}}return!1}}class ed{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,r,a){var n,s,o,l,h;let u=String(r);if((l=this.stateChanges)[t]||(l[t]={}),(h=this.stateChanges[t])[u]||(h[u]={}),i.e(this.stateChanges[t][u],a),null===this.deletedStates[t])for(let i in this.deletedStates[t]={},this.state[t])i!==u&&(this.deletedStates[t][i]=null);else if(null===(null==(n=this.deletedStates[t])?void 0:n[u]))for(let i in this.deletedStates[t][u]={},this.state[t][u])a[i]||(this.deletedStates[t][u][i]=null);else for(let i in a)null===(null==(o=null==(s=this.deletedStates[t])?void 0:s[u])?void 0:o[i])&&delete this.deletedStates[t][u][i]}removeFeatureState(t,i,r){var a,n,s;if(null===this.deletedStates[t])return;let o=String(i);if((n=this.deletedStates)[t]||(n[t]={}),r&&void 0!==i)null!==this.deletedStates[t][o]&&((s=this.deletedStates[t])[o]||(s[o]={}),this.deletedStates[t][o][r]=null);else if(void 0!==i)if(null==(a=this.stateChanges[t])?void 0:a[o])for(r in this.deletedStates[t][o]={}
2,this.stateChanges[t][o])this.deletedStates[t][o][r]=null;else this.deletedStates[t][o]=null;else this.deletedStates[t]=null}getState(t,r){let a=String(r),n=i.e({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){let i=this.deletedStates[t][r];if(null===i)return{};for(let t in i)delete n[t]}return n}initializeTileState(t,i){t.setFeatureState(this.state,i)}coalesceChanges(t,r){var a,n,s;let o={};for(let t in this.stateChanges){(a=this.state)[t]||(a[t]={});let r={};for(let a in this.stateChanges[t])(n=this.state[t])[a]||(n[a]={}),i.e(this.state[t][a],this.stateChanges[t][a]),r[a]=this.state[t][a];o[t]=r}for(let t in this.deletedStates){(s=this.state)[t]||(s[t]={});let r={};if(null===this.deletedStates[t])for(let i in this.state[t])r[i]={},this.state[t][i]={};else for(let i in this.deletedStates[t]){if(null===this.deletedStates[t][i])this.state[t][i]={};else for(let r of Object.keys(this.deletedStates[t][i]))delete this.state[t][i][r];r[i]=this.state[t][i]}o[t]||(o[t]={}),i.e(o[t],r)}this.stateChanges={},this.deletedStates={},0!==Object.keys(o).length&&(this.revision++,t.setFeatureState(o,r))}}function ep(t,r){let a=i.al(r.lat,-i.am,i.am);return new i.P(i.Z(r.lng)*t,i.Y(a)*t)}function ef(t,r){return new i.a7(r.x/t,r.y/t).toLngLat()}function em(t){return t.cameraToCenterDistance*Math.min(.85*Math.tan(i.an(90-t.pitch)),Math.tan(i.an(89.25-t.pitch)))}function e_(t,r){let a=t.canonical,n=r/i.ao(a.z),s=a.x+Math.pow(2,a.z)*t.wrap,o=i.ap(new Float64Array(16));return i.Q(o,o,[s*n,a.y*n,0]),i.S(o,o,[n/i.a6,n/i.a6,1]),o}function eg(t,r,a,n,s){let o=i.a7.fromLngLat(t,r),l=s*i.aq(1,t.lat),{x:h,y:u,z:c}=ey(a,n);return new i.a7(o.x+-(l*h),o.y+-(l*u),o.z+-(l*c))}function ey(t,r){let a=i.an(t),n=i.an(r),s=Math.cos(-a),o=Math.sin(a);return{x:o*Math.sin(n),y:-o*Math.cos(n),z:s}}function ex(t,i,r){let a=0,n=(r-i)/10;for(let s=0;s<10;s++)a+=n*Math.pow(Math.cos(i+(s+.5)/10*(r-i)),t);return a}function ev(t,r){return function(a,n,s,o,l){let h=2*((t-1)/i.ar(Math.cos(i.an(89.25-l))/Math.cos(i.an(89.25)))-1),u=Math.acos(s/o),c=2*ex(h-1,0,i.an(l/2)),d=Math.min(i.an(89.25),u+i.an(l/2)),p=ex(h-1,Math.min(d,u-i.an(l/2)),d),f=Math.atan(n/s),m=Math.hypot(n,s),_=a;return _+=i.ar(o/m/Math.max(.5,Math.cos(i.an(l/2)))),_+=h*i.ar(Math.cos(f))/2,_-=i.ar(Math.max(1,p/c/r))/2}}let eb=ev(9.314,3);function ew(t,r){return Math.max(0,(r.roundZoom?Math.round:Math.floor)(t.zoom+i.ar(t.tileSize/r.tileSize)))}function eT(t,r){let a=t.getCameraFrustum(),n=t.getClippingPlane(),s=t.screenPointToMercatorCoordinate(t.getCameraPoint()),o=i.a7.fromLngLat(t.center,t.elevation);s.z=o.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;let l=t.getCoveringTilesDetailsProvider(),h=l.allowVariableZoom(t,r),u=ew(t,r),c=r.minzoom||0,d=void 0!==r.maxzoom?r.maxzoom:t.maxZoom,p=Math.min(Math.max(0,u),d),f=Math.pow(2,p),m=[f*s.x,f*s.y,0],_=[f*o.x,f*o.y,0],g=Math.hypot(o.x-s.x,o.y-s.y),y=Math.abs(o.z-s.z),x=Math.hypot(g,y),v=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),b=[],w=[];if(t.renderWorldCopies&&l.allowWorldCopies())for(let t=1;t<=3;t++)b.push(v(-t)),b.push(v(t));for(b.push(v(0));b.length>0;){let f=b.pop(),g=f.x,v=f.y,T=f.fullyVisible,S={x:g,y:v,z:f.zoom},P=l.getTileBoundingVolume(S,f.wrap,t.elevation,r);if(!T){let t=function(t,i,r){let a=i.intersectsFrustum(t);if(!r||0===a)return a;let n=i.intersectsPlane(r);return 0===n?0:2===a&&2===n?2:1}(a,P,n);if(0===t)continue;T=2===t}let M=l.distanceToTile2d(s.x,s.y,S,P),I=u;h&&(I=(r.calculateTileZoom||eb)(t.zoom+i.ar(t.tileSize/r.tileSize),M,y,x,t.fov));let E=Math.min(I=Math.max(0,I=(r.roundZoom?Math.round:Math.floor)(I)),d);if(f.wrap=l.getWrap(o,S,f.wrap),f.zoom>=E){if(f.zoom<c)continue;let t=p-f.zoom,a=m[0]-.5-(g<<t),n=m[1]-.5-(v<<t),s=r.reparseOverscaled?Math.max(f.zoom,I):f.zoom;w.push({tileID:new i.a3(f.zoom===d?s:f.zoom,f.wrap,f.zoom,g,v),distanceSq:i.as([_[0]-.5-g,_[1]-.5-v]),tileDistanceToCamera:Math.sqrt(a*a+n*n)})}else for(let t=0;t<4;t++)b.push({zoom:f.zoom+1,x:(g<<1)+t%2,y:(v<<1)+(t>>1),wrap:f.wrap,fullyVisible:T})}return w.sort((t,i)=>t.distanceSq-i.distanceSq).map(t=>t.tileID)}let eS=i.a8.fromPoints([new i.P(0,0),new i.P(i.a6,i.a6)]);function eP(t){return"raster"===t||"image"===t||"video"===t}function eM(t,i,r,a,n,s,o){if(r[0].overscaledZ>=s)return!1;let l=!1;for(let s of r){let r=t.getLoadedTile(s);if(!r)continue;let{fadingRole:h,fadingDirection:u,fadingParentID:c}=r;h===m.Base&&u===_.Departing&&c||(r.setCrossFadeLogic({fadingRole:m.Base,fadingDirection:_.Departing,fadingParentID:i.tileID,fadeEndTime:n+o}),i.setCrossFadeLogic({fadingRole:m.Parent,fadingDirection:_.Incoming,fadeEndTime:n+o})),a[s.key]=s,l=!0}return l}function eI(t,i){var r;
2t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let a=i.tileID.canonical.x-t.tileID.canonical.x,n=i.tileID.canonical.y-t.tileID.canonical.y,s=Math.pow(2,t.tileID.canonical.z),o=i.tileID.key;0===a&&0===n||Math.abs(n)>1||(Math.abs(a)>1&&(1===Math.abs(a+s)?a+=s:1===Math.abs(a-s)&&(a-=s)),i.dem&&t.dem&&(t.dem.backfillBorder(i.dem,a,n),(null==(r=t.neighboringTiles)?void 0:r[o])&&(t.neighboringTiles[o].backfilled=!0)))}class eE{constructor(){this._tiles={}}handleWrapJump(t){let i={};for(let r in this._tiles){let a=this._tiles[r];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),i[a.tileID.key]=a}this._tiles=i}setFeatureState(t,i){for(let r in this._tiles)this._tiles[r].setFeatureState(t,i)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map(t=>t.tileID).sort(i.au).map(t=>t.key):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,i){this._tiles[t]=i}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){let i=this.getTileById(t.key);return(null==i?void 0:i.hasData())?i:null}isIdRenderable(t,i=!1){var r;return null==(r=this.getTileById(t))?void 0:r.isRenderable(i)}getRenderableIds(t=0,r){let a=[];for(let t of this.getAllIds())this.isIdRenderable(t,r)&&a.push(this.getTileById(t));return r?a.sort((r,a)=>{let n=r.tileID,s=a.tileID,o=new i.P(n.canonical.x,n.canonical.y)._rotate(-t),l=new i.P(s.canonical.x,s.canonical.y)._rotate(-t);return n.overscaledZ-s.overscaledZ||l.y-o.y||l.x-o.x}).map(t=>t.tileID.key):a.map(t=>t.tileID).sort(i.au).map(t=>t.key)}}class eC extends i.E{constructor(t,r,a){super(),this.id=t,this.dispatcher=a,this.on("data",t=>{this._dataHandler(t)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((t,i,r,a)=>{let n=new(es(i.type))(t,i,r,a);if(n.id!==t)throw Error(`Expected Source id to be ${t} instead of ${n.id}`);return n})(t,r,a,this),this._inViewTiles=new eE,this._outOfViewCache=new i.av(0,t=>this._unloadTile(t)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new ed,this._didEmitContent=!1,this._updated=!1}onAdd(t){var i;this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,(null==(i=this._source)?void 0:i.onAdd)&&this._source.onAdd(t)}onRemove(t){var i;for(let t of this._inViewTiles.getAllTiles())t.unloadVectorData();this.clearTiles(),(null==(i=this._source)?void 0:i.onRemove)&&this._source.onRemove(t),this._inViewTiles=new eE}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,r,a){return i._(this,void 0,void 0,function*(){try{let i=yield this._source.loadTile(t);this._tileLoaded(t,r,a,i)}catch(r){t.state="errored",404!==r.status?this._source.fire(new i.l(i.d(r),{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new i.n("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){for(let i of(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null),this._inViewTiles.getAllTiles()))i.upload(t),i.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var i;return this._inViewTiles.getRenderableIds(null==(i=this.transform)?void 0:i.bearingInRadians,t)}hasRenderableParent(t){let i=t.overscaledZ-1;if(i>=this._source.minzoom){let r=this.getLoadedTile(t.scaledTo(i));if(r)return this._inViewTiles.isIdRenderable(r.tileID.key)}return!1}reload(t,i){if(this._paused)this._shouldReloadOnResume=!0;else for(let r of(this._outOfViewCache.reset(),this._inViewTiles.getAllIds())){let a=this._inViewTiles.getTileById(r);i&&!this._source.shouldReloadTile(a,i)||(t?this._reloadTile(r,"expired"):"errored"!==a.state&&this._reloadTile(r,"reloading"))}}_reloadTile(t,r){return i._(this,void 0,void 0,function*(){let i=this._inViewTiles.getTileById(t);i&&("loading"!==i.state&&(i.state=r),yield this._loadTile(i,t,r))})}_tileLoaded(t,r,a,n){t.timeAdded=b(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),"expired"===a&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),(null==n?void 0:n.unmodified)||("raster-dem"===this.getSource().type&&t.dem&&function(t,i){var r,a,n;
2for(let s of i.getRenderableIds()){if(!(null==(r=t.neighboringTiles)?void 0:r[s]))continue;let o=i.getTileById(s);t.neighboringTiles[s].backfilled||eI(t,o),(null==(n=null==(a=o.neighboringTiles)?void 0:a[t.tileID.key])?void 0:n.backfilled)||eI(o,t)}}(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new i.n("data",{dataType:"source",tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,i){let r=this._getLoadedDescendents(i),a=new Set;for(let n of i){let i=r[n.key];if(!(null==i?void 0:i.length)){a.add(n);continue}let s=n.overscaledZ+eC.maxOverzooming,o=i.filter(t=>t.tileID.overscaledZ<=s);if(!o.length){a.add(n);continue}let l=Math.min(...o.map(t=>t.tileID.overscaledZ)),h=o.filter(t=>t.tileID.overscaledZ===l).map(t=>t.tileID);for(let i of h)t[i.key]=i;this._areDescendentsComplete(h,l,n.overscaledZ)||a.add(n)}return a}_getLoadedDescendents(t){var i;let r={};for(let a of this._inViewTiles.getAllTiles().filter(t=>t.hasData()))for(let n of t)a.tileID.isChildOf(n)&&(r[i=n.key]||(r[i]=[]),r[n.key].push(a));return r}_areDescendentsComplete(t,i,r){return 1===t.length&&t[0].isOverscaled()?t[0].overscaledZ===i:Math.pow(4,i-r)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let r=Math.floor((Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1)*(null===this._maxTileCacheZoomLevels?i.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._outOfViewCache.setMaxSize(a)}handleWrapJump(t){let i=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);this._prevLng=t,i&&(this._inViewTiles.handleWrapJump(i),this._resetTileReloadTimers())}update(t,r){let a;if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=r,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new i.a3(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(a=eT(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(a=a.filter(t=>this._source.hasTile(t)))):a=[],this.usedForTerrain&&(a=this._addTerrainIdealTiles(a));let n=0===a.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new i.n("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let s=ew(t,this._source),o=this._updateRetainedTiles(a,s),l=eP(this._source.type);l&&this._rasterFadeDuration>0&&!r&&function(t,r,a,n,s,o,l){let h=b(),u=i.at(r);for(let i of r){let r=t.getTileById(i.key);r.fadingDirection!==_.Departing&&0!==r.fadeOpacity||r.resetFadeLogic(),function(t,i,r,a,n,s,o){if(!i.hasData())return!1;let{tileID:l,fadingRole:h,fadingDirection:u,fadingParentID:c}=i;if(h===m.Base&&u===_.Incoming&&c)return r[c.key]=c,!0;let d=Math.max(l.overscaledZ-n,s);for(let n=l.overscaledZ-1;n>=d;n--){let s=l.scaledTo(n),h=t.getLoadedTile(s);if(h)return i.setCrossFadeLogic({fadingRole:m.Base,fadingDirection:_.Incoming,fadingParentID:h.tileID,fadeEndTime:a+o}),h.setCrossFadeLogic({fadingRole:m.Parent,fadingDirection:_.Departing,fadeEndTime:a+o}),r[s.key]=s,!0}return!1}(t,r,a,h,n,s,l)||function(t,i,r,a,n,s){if(!i.hasData())return!1;let o=i.tileID.children(n),l=eM(t,i,o,r,a,n,s);if(l)return!0;for(let h of o)eM(t,i,h.children(n),r,a,n,s)&&(l=!0);return l}(t,r,a,h,o,l)||function(t,i,r,a){let n=t.tileID;return!!t.selfFading||!t.hasData()&&!!i.has(n)&&(t.setSelfFadeLogic(r+a),!0)}(r,u,h,l)||r.resetFadeLogic()}}(this._inViewTiles,a,o,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),l?this._cleanUpRasterTiles(o):this._cleanUpVectorTiles(o)}
2_cleanUpRasterTiles(t){for(let i of this._inViewTiles.getAllIds())t[i]||this._removeTile(i)}_cleanUpVectorTiles(t){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);t[i]?r.clearSymbolFadeHold():r.hasSymbolBuckets?r.holdingForSymbolFade()?r.symbolFadeFinished()&&this._removeTile(i):r.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(i)}}_addTerrainIdealTiles(t){let i=[];for(let r of t)if(r.canonical.z>this._source.minzoom){let t=r.scaledTo(r.canonical.z-1);i.push(t);let a=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));i.push(a)}return t.concat(i)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,i){var r;let a=new Set;for(let i of t)this._addTile(i).hasData()||a.add(i);let n=t.reduce((t,i)=>(t[i.key]=i,t),{}),s=this._retainLoadedChildren(n,a),o={},l=Math.max(i-eC.maxUnderzooming,this._source.minzoom);for(let t of s){let i=this._inViewTiles.getTileById(t.key),a=null==i?void 0:i.wasRequested();for(let s=t.overscaledZ-1;s>=l;--s){let l=t.scaledTo(s);if(o[l.key])break;if(o[l.key]=!0,(i=this.getTile(l))||!a||(i=this._addTile(l)),i){let t=i.hasData();if((t||!(null==(r=this.map)?void 0:r.cancelPendingTileRequestsWhileZooming)||a)&&(n[l.key]=l),a=i.wasRequested(),t)break}}}return n}_addTile(t){let r=this._inViewTiles.getTileById(t.key);if(r)return r;(r=this._outOfViewCache.getAndRemove(t))&&(r.resetFadeLogic(),this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null));let a=r;return r||(r=new ec(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(r,t.key,r.state)),r.uses++,this._inViewTiles.setTile(t.key,r),a||this._source.fire(new i.n("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(t,i){this._clearTileReloadTimer(t);let r=i.getExpiryTimeout();r&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},r))}_clearTileReloadTimer(t){let i=this._timers[t];i&&(clearTimeout(i),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,i)}}refreshTiles(t){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);(this._inViewTiles.isIdRenderable(i)||"errored"==r.state)&&t.some(t=>t.equals(r.tileID.canonical))&&this._reloadTile(i,"expired")}}_removeTile(t){let i=this._inViewTiles.getTileById(t);i&&(i.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),i.uses>0||(i.hasData()&&"reloading"!==i.state?this._outOfViewCache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t){"source"===t.dataType&&("metadata"!==t.sourceDataType?"content"===t.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){for(let t of(this._shouldReloadOnResume=!1,this._paused=!1,this._inViewTiles.getAllIds()))this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,r,a){let n=[],s=this.transform;if(!s)return n;let o=s.getCoveringTilesDetailsProvider().allowWorldCopies(),l=a?s.getCameraQueryGeometry(t):t,h=t=>s.screenPointToMercatorCoordinate(t,this.terrain),u=this.transformBbox(t,h,!o),c=this.transformBbox(l,h,!o),d=this.getIds(),p=i.a8.fromPoints(c);for(let t of d){let a=this._inViewTiles.getTileById(t);if(a.holdingForSymbolFade())continue;let l=o?[a.tileID]:[a.tileID.unwrapTo(-1),a.tileID.unwrapTo(0)],h=Math.pow(2,s.zoom-a.tileID.overscaledZ),d=r*a.queryPadding*i.a6/a.tileSize/h;for(let t of l){let r=p.map(r=>t.getTilePoint(new i.a7(r.x,r.y)));if(r.expandBy(d),r.intersects(eS)){let i=u.map(i=>t.getTilePoint(i)),r=c.map(i=>t.getTilePoint(i));n.push({tile:a,tileID:o?t:t.unwrapTo(0),queryGeometry:i,cameraQueryGeometry:r,scale:h})}}}return n}transformBbox(t,r,a){let n=t.map(r);if(a){let a=i.a8.fromPoints(t);a.shrinkBy(.001*Math.min(a.width(),a.height()));let s=a.map(r);i.a8.fromPoints(n).covers(s)||(n=n.map(t=>t.x>.5?new i.a7(t.x-1,t.y,t.z):t))}return n}getVisibleCoordinates(t){let i=this.getRenderableIds(t).map(t=>this._inViewTiles.getTileById(t).tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){return!!this._source.hasTransition()||eP(this._source.type)&&function(t,i){if(i<=0)return!1;
2let r=b();for(let i of t.getAllTiles())if(i.fadeEndTime>=r)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,r,a){t||(t=i.ag),this._state.updateState(t,r,a)}removeFeatureState(t,r,a){t||(t=i.ag),this._state.removeFeatureState(t,r,a)}getFeatureState(t,r){return t||(t=i.ag),this._state.getState(t,r)}setDependencies(t,i,r){let a=this._inViewTiles.getTileById(t);a&&a.setDependencies(i,r)}reloadTilesForDependencies(t,i){for(let r of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(r).hasDependency(t,i)&&this._reloadTile(r,"reloading");this._outOfViewCache.filter(r=>!r.hasDependency(t,i))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return!1;return!0}}eC.maxUnderzooming=10,eC.maxOverzooming=3;class eA{constructor(t,i){this.reset(t,i)}reset(t,i){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=i.al(t,0,1);let r=1,a=this._distances[r],n=t*this.paddedLength+this.padding;for(;a<n&&r<this._distances.length;)a=this._distances[++r];let s=r-1,o=this._distances[s],l=a-o,h=l>0?(n-o)/l:0;return this.points[s].mult(1-h).add(this.points[r].mult(h))}}function eD(t,i){let r=!0;return"always"===t||"never"!==t&&"never"!==i||(r=!1),r}class ez{constructor(t,i,r){const a=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(i/r);for(let t=0;t<this.xCellCount*this.yCellCount;t++)a.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=i,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,i,r,a,n){this._forEachCell(i,r,a,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)}insertCircle(t,i,r,a){this._forEachCell(i-a,r-a,i+a,r+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(i),this.circles.push(r),this.circles.push(a)}_insertBoxCell(t,i,r,a,n,s){this.boxCells[n].push(s)}_insertCircleCell(t,i,r,a,n,s){this.circleCells[n].push(s)}_query(t,i,r,a,n,s,o){if(r<0||t>this.width||a<0||i>this.height)return[];let l=[];if(t<=0&&i<=0&&this.width<=r&&this.height<=a){if(n)return[{key:null,x1:t,y1:i,x2:r,y2:a}];for(let t=0;t<this.boxKeys.length;t++)l.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){let i=this.circles[3*t],r=this.circles[3*t+1],a=this.circles[3*t+2];l.push({key:this.circleKeys[t],x1:i-a,y1:r-a,x2:i+a,y2:r+a})}}else this._forEachCell(t,i,r,a,this._queryCell,l,{hitTest:n,overlapMode:s,seenUids:{box:{},circle:{}}},o);return l}query(t,i,r,a){return this._query(t,i,r,a,!1,null)}hitTest(t,i,r,a,n,s){return this._query(t,i,r,a,!0,n,s).length>0}hitTestCircle(t,i,r,a,n){let s=t-r,o=t+r,l=i-r,h=i+r;if(o<0||s>this.width||h<0||l>this.height)return!1;let u=[];return this._forEachCell(s,l,o,h,this._queryCellCircle,u,{hitTest:!0,overlapMode:a,circle:{x:t,y:i,radius:r},seenUids:{box:{},circle:{}}},n),u.length>0}_queryCell(t,i,r,a,n,s,o,l){let{seenUids:h,hitTest:u,overlapMode:c}=o,d=this.boxCells[n];if(null!==d){let n=this.bboxes;for(let o of d)if(!h.box[o]){h.box[o]=!0;let d=4*o,p=this.boxKeys[o];if(t<=n[d+2]+1e-6&&i<=n[d+3]+1e-6&&r>=n[d+0]-1e-6&&a>=n[d+1]-1e-6&&(!l||l(p))&&(!u||!eD(c,p.overlapMode))&&(s.push({key:p,x1:n[d],y1:n[d+1],x2:n[d+2],y2:n[d+3]}),u))return!0}}let p=this.circleCells[n];if(null!==p){let n=this.circles;for(let o of p)if(!h.circle[o]){h.circle[o]=!0;let d=3*o,p=this.circleKeys[o];if(this._circleAndRectCollide(n[d],n[d+1],n[d+2],t,i,r,a)&&(!l||l(p))&&(!u||!eD(c,p.overlapMode))){let t=n[d],i=n[d+1],r
2=n[d+2];if(s.push({key:p,x1:t-r,y1:i-r,x2:t+r,y2:i+r}),u)return!0}}}return!1}_queryCellCircle(t,i,r,a,n,s,o,l){let{circle:h,seenUids:u,overlapMode:c}=o,d=this.boxCells[n];if(null!==d){let t=this.bboxes;for(let i of d)if(!u.box[i]){u.box[i]=!0;let r=4*i,a=this.boxKeys[i];if(this._circleAndRectCollide(h.x,h.y,h.radius,t[r+0],t[r+1],t[r+2],t[r+3])&&(!l||l(a))&&!eD(c,a.overlapMode))return s.push(!0),!0}}let p=this.circleCells[n];if(null!==p){let t=this.circles;for(let i of p)if(!u.circle[i]){u.circle[i]=!0;let r=3*i,a=this.circleKeys[i];if(this._circlesCollide(t[r],t[r+1],t[r+2],h.x,h.y,h.radius)&&(!l||l(a))&&!eD(c,a.overlapMode))return s.push(!0),!0}}}_forEachCell(t,i,r,a,n,s,o,l){let h=this._convertToXCellCoord(t),u=this._convertToYCellCoord(i),c=this._convertToXCellCoord(r),d=this._convertToYCellCoord(a);for(let p=h;p<=c;p++)for(let h=u;h<=d;h++)if(n.call(this,t,i,r,a,this.xCellCount*h+p,s,o,l))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,i,r,a,n,s){let o=a-t,l=n-i,h=r+s;return h*h>o*o+l*l}_circleAndRectCollide(t,i,r,a,n,s,o){let l=(s-a)/2,h=Math.abs(t-(a+l));if(h>l+r)return!1;let u=(o-n)/2,c=Math.abs(i-(n+u));if(c>u+r)return!1;if(h<=l||c<=u)return!0;let d=h-l,p=c-u;return d*d+p*p<=r*r}}let ek=i.O();function eR(t,r,a){var n,s,o,l,h;let u=i.O();if(!t){let{vecSouth:t,vecEast:i}=eL(r),a=y();a[0]=i[0],a[1]=i[1],a[2]=t[0],a[3]=t[1],(h=(n=a[0])*(l=a[3])-(o=a[2])*(s=a[1]))&&(a[0]=l*(h=1/h),a[1]=-s*h,a[2]=-o*h,a[3]=n*h),u[0]=a[0],u[1]=a[1],u[4]=a[2],u[5]=a[3]}return i.S(u,u,[1/a,1/a,1]),u}function eL(t){let r=Math.cos(t.rollInRadians),a=Math.sin(t.rollInRadians),n=Math.cos(t.pitchInRadians),s=Math.cos(t.bearingInRadians),o=Math.sin(t.bearingInRadians),l=i.az();l[0]=-s*n*a-o*r,l[1]=-o*n*a+s*r;let h=i.aA(l);h<1e-9?i.aB(l):i.aC(l,l,1/h);let u=i.az();u[0]=s*n*r-o*a,u[1]=o*n*r+s*a;let c=i.aA(u);return c<1e-9?i.aB(u):i.aC(u,u,1/c),{vecEast:u,vecSouth:l}}function eF(t,r,a,n){let s;n?(s=[t,r,n(t,r),1],i.aE(s,s,a)):eX(s=[t,r,0,1],s,a);let o=s[3];return{point:new i.P(s[0]/o,s[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function eB(t,i,r,a,n,s,o,l){let h=s.glyphStartIndex+s.numGlyphs,u=s.lineStartIndex,c=s.lineStartIndex+s.lineLength,d=i.getoffsetX(s.glyphStartIndex),p=i.getoffsetX(h-1),f=eq(t*d,r,a,n,s.segment,u,c,l,o);if(!f)return null;let m=eq(t*p,r,a,n,s.segment,u,c,l,o);return m?l.projectionCache.anyProjectionOccluded?null:{first:f,last:m}:null}function eO(t,r,a,n){return t===i.ax.horizontal&&Math.abs(a.y-r.y)>Math.abs(a.x-r.x)*n?{useVertical:!0}:(t===i.ax.vertical?r.y<a.y:r.x>a.x)?{needsFlipping:!0}:null}function eV(t){let r,{projectionContext:a,pitchedLabelPlaneMatrixInverse:n,symbol:s,fontSize:o,flip:l,keepUpright:h,glyphOffsetArray:u,dynamicLayoutVertexArray:c,aspectRatio:d,rotateToLine:p}=t,f=o/24,m=s.lineOffsetX*f,_=s.lineOffsetY*f;if(s.numGlyphs>1){let t=s.glyphStartIndex+s.numGlyphs,i=s.lineStartIndex,o=s.lineStartIndex+s.lineLength,c=eB(f,u,m,_,l,s,p,a);if(!c)return{notEnoughRoom:!0};let g=eG(c.first.point.x,c.first.point.y,a,n),y=eG(c.last.point.x,c.last.point.y,a,n);if(h&&!l){let t=eO(s.writingMode,g,y,d);if(t)return t}r=[c.first];for(let n=s.glyphStartIndex+1;n<t-1;n++){let t=eq(f*u.getoffsetX(n),m,_,l,s.segment,i,o,a,p);if(!t)return{notEnoughRoom:!0};r.push(t)}r.push(c.last)}else{if(h&&!l){let t=eU(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,r=s.lineStartIndex+s.segment+1,o=new i.P(a.lineVertexArray.getx(r),a.lineVertexArray.gety(r)),l=eU(o.x,o.y,a),h=l.signedDistanceFromCamera>0?l.point:ej(a.tileAnchorPoint,o,t,1,a),u=eG(t.x,t.y,a,n),c=eG(h.x,h.y,a,n),p=eO(s.writingMode,u,c,d);if(p)return p}let t=eq(f*u.getoffsetX(s.glyphStartIndex),m,_,l,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,a,p);if(!t||a.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};r=[t]}for(let t of r)i.aD(c,t.point,t.angle);return{}}function ej(t,i,r,a,n){let s=t.add(t.sub(i)._unit()),o=eU(s.x,s.y,n).point,l=r.sub(o);return r.add(l._mult(a/l.mag()))}function eN(t,r,a){let n=r.projectionCache;if(n.projections[t])return n.projections[t];let s=new i.P(r.lineVertexArray.getx(t),r.lineVertexArray.gety(t)),o=eU(s.x,s.y,r);if(o.signedDistanceFromCamera>0)return n.projections[t]=o.point,n.anyProjectionOccluded||(n.anyProjectionOccluded=o.isOccluded),o.point;let l=t-a.direction;return ej(0===a.distanceFromAnchor?r.tileAnchorPoint:new i.P(r.lineVertexArray.getx(l),r.lineVertexArray.gety(l)),s,a.previousVertex,a.absOffsetX-a.distanceFromAnchor+1,r)}function eU(t,i,r){let a,n=t+r.translation[0],s=i+r.translation[1];
2return r.pitchWithMap?(a=eF(n,s,r.pitchedLabelPlaneMatrix,r.getElevation)).isOccluded=!1:((a=r.transform.projectTileCoordinates(n,s,r.unwrappedTileID,r.getElevation)).point.x=(.5*a.point.x+.5)*r.width,a.point.y=(-(.5*a.point.y)+.5)*r.height),a}function eG(t,r,a,n){if(a.pitchWithMap){let s=[t,r,0,1];return i.aE(s,s,n),a.transform.projectTileCoordinates(s[0]/s[3],s[1]/s[3],a.unwrappedTileID,a.getElevation).point}return{x:t/a.width*2-1,y:1-r/a.height*2}}function e$(t,i,r){return r.transform.projectTileCoordinates(t,i,r.unwrappedTileID,r.getElevation)}function eZ(t,i,r){return t._unit()._perp()._mult(i*r)}function eq(t,r,a,n,s,o,l,h,u){let c,d=n?t-r:t+r,p=d>0?1:-1,f=0;n&&(p*=-1,f=Math.PI),p<0&&(f+=Math.PI);let m,_=p>0?o+s:o+s+1;h.projectionCache.cachedAnchorPoint?m=h.projectionCache.cachedAnchorPoint:(m=eU(h.tileAnchorPoint.x,h.tileAnchorPoint.y,h).point,h.projectionCache.cachedAnchorPoint=m);let g,y,x=m,v=m,b=0,w=0,T=Math.abs(d),S=[];for(;b+w<=T;){if((_+=p)<o||_>=l)return null;b+=w,v=x,y=g;let t={absOffsetX:T,direction:p,distanceFromAnchor:b,previousVertex:v};if(x=eN(_,h,t),0===a)S.push(v),c=x.sub(v);else{let r,n=x.sub(v);r=0===n.mag()?eZ(eN(_+p,h,t).sub(x),a,p):eZ(n,a,p),y||(y=v.add(r)),g=function(t,r,a,n,s,o,l,h,u){if(h.projectionCache.offsets[t])return h.projectionCache.offsets[t];let c=a.add(r);if(t+u.direction<n||t+u.direction>=s)return h.projectionCache.offsets[t]=c,c;let d=eN(t+u.direction,h,u),p=eZ(d.sub(a),l,u.direction),f=a.add(p),m=d.add(p);return h.projectionCache.offsets[t]=i.aF(o,c,f,m)||c,h.projectionCache.offsets[t]}(_,r,x,o,l,y,a,h,t),S.push(y),c=g.sub(y)}w=c.mag()}let P=c._mult((T-b)/w)._add(y||v),M=f+Math.atan2(x.y-v.y,x.x-v.x);return S.push(P),{point:P,angle:u?M:0,path:S}}let eW=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function eH(t,i){for(let r=0;r<t;r++){let t=i.length;i.resize(t+4),i.float32.set(eW,3*t)}}function eX(t,i,r){let a=i[0],n=i[1];return t[0]=r[0]*a+r[4]*n+r[12],t[1]=r[1]*a+r[5]*n+r[13],t[3]=r[3]*a+r[7]*n+r[15],t}class eY{constructor(t,i=new ez(t.width+200,t.height+200,25),r=new ez(t.width+200,t.height+200,25)){this.transform=t,this.grid=i,this.ignoredGrid=r,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,i,r,a,n,s,o,l,h,u,c,d){let p,f=this.projectAndGetPerspectiveRatio(t.anchorPointX+l[0],t.anchorPointY+l[1],n,u,d),m=r*f.perspectiveRatio;if(s||o)p=this._projectCollisionBox(t,m,a,n,s,o,l,f,u,c,d);else{let i=f.x+(c?c.x*m:0),r=f.y+(c?c.y*m:0);p={allPointsOccluded:!1,box:[i+t.x1*m,r+t.y1*m,i+t.x2*m,r+t.y2*m]}}let[_,g,y,x]=p.box,v=s?p.allPointsOccluded:f.isOccluded,b=v;return b||(b=f.perspectiveRatio<this.perspectiveRatioCutoff),b||(b=!this.isInsideGrid(_,g,y,x)),b||"always"!==i&&this.grid.hitTest(_,g,y,x,i,h)?{box:[_,g,y,x],placeable:!1,offscreen:!1,occluded:v}:{box:[_,g,y,x],placeable:!0,offscreen:this.isOffscreen(_,g,y,x),occluded:v}}placeCollisionCircles(t,r,a,n,s,o,l,h,u,c,d,p,f,m){let _=[],g=new i.P(r.anchorX,r.anchorY),y=this.getPerspectiveRatio(g.x,g.y,o,m),x=(u?s*this.transform.getPitchedTextCorrection(r.anchorX,r.anchorY,o)/y:s*y)/i.aJ,v={getElevation:m,pitchedLabelPlaneMatrix:l,lineVertexArray:a,pitchWithMap:u,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:o,width:this.transform.width,height:this.transform.height,translation:f},b=eB(x,n,r.lineOffsetX*x,r.lineOffsetY*x,!1,r,!1,v),w=!1,T=!1,S=!0;if(b){let r=.5*d*y+p,a=new i.P(-100,-100),n=new i.P(this.screenRightBoundary,this.screenBottomBoundary),s=new eA,o=b.first,l=b.last,f=[];for(let t=o.path.length-1;t>=1;t--)f.push(o.path[t]);for(let t=1;t<l.path.length;t++)f.push(l.path[t]);let m=2.5*r;if(u){let t=this.projectPathToScreenSpace(f,v);f=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let g=[];if(f.length>0){let t=f[0].clone(),r=f[0].clone();for(let i=1;i<f.length;i++)t.x=Math.min(t.x,f[i].x),t.y=Math.min(t.y,f[i].y),r.x=Math.max(r.x,f[i].x),r.y=Math.max(r.y,f[i].y);g=t.x>=a.x&&r.x<=n.x&&t.y>=a.y&&r.y<=n.y?[f]:r.x<a.x||t.x>n.x||r.y<a.y||t.y>n.y?[]:i.aG([f],a.x,a.y,n.x,n.y)}for(let i of g){s.reset(i,.25*r);let a=0;a=s.length<=.5*r?1:Math.ceil(s.paddedLength/m)+1;for(let i=0;i<a;i++){let n=i/Math.max(a-1,1),o=s.lerp(n),l=o.x+100,u=o.y+100;_.push(l,u,r,0);let d=l-r,p=u-r,f=l+r,m=u+r;if(S&&(S=this.isOffscreen(d,p,f,m)),T||(T=this.isInsideGrid(d,p,f,m)),"always"!==t&&this.grid.hitTestCircle(l,u,r,t,c)&&(w=!0,!h))return{circles:[],offscreen:!1,collisionDetected:w}}}}return{circles:!h&&w||!T||y<this.perspectiveRatioCutoff?[]:_,offscreen:S,collisionDetected:w}}projectPathToScreenSpace(t,i){var r;let a;return function(t){let i=0,r=0,a=0,n=0;for(let s=0;s<t.length;s++)t[s].isOccluded?(a=s+1,n=0):++n>r&&(r=n,i=a);return t.slice(i,i+r)}
2((a=1/((r=i.pitchedLabelPlaneMatrix)[0]*r[5]-r[1]*r[4]),ek[0]=r[5]*a,ek[1]=-r[1]*a,ek[2]=0,ek[3]=0,ek[4]=-r[4]*a,ek[5]=r[0]*a,ek[6]=0,ek[7]=0,ek[8]=0,ek[9]=0,ek[10]=1/r[10],ek[11]=0,ek[12]=0,ek[13]=0,ek[14]=0,ek[15]=1/r[15],t.map(t=>{let r=eF(t.x,t.y,ek,i.getElevation),a=i.transform.projectTileCoordinates(r.point.x,r.point.y,i.unwrappedTileID,i.getElevation);return a.point.x=(.5*a.point.x+.5)*i.width,a.point.y=(-(.5*a.point.y)+.5)*i.height,a})))}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let r=[],a=new i.a8;for(let n of t){let t=new i.P(n.x+100,n.y+100);a.extend(t),r.push(t)}let{minX:n,minY:s,maxX:o,maxY:l}=a,h=this.grid.query(n,s,o,l).concat(this.ignoredGrid.query(n,s,o,l)),u={},c={};for(let t of h){let a=t.key;if(void 0===u[a.bucketInstanceId]&&(u[a.bucketInstanceId]={}),u[a.bucketInstanceId][a.featureIndex])continue;let n=[new i.P(t.x1,t.y1),new i.P(t.x2,t.y1),new i.P(t.x2,t.y2),new i.P(t.x1,t.y2)];i.aH(r,n)&&(u[a.bucketInstanceId][a.featureIndex]=!0,void 0===c[a.bucketInstanceId]&&(c[a.bucketInstanceId]=[]),c[a.bucketInstanceId].push(a.featureIndex))}return c}insertCollisionBox(t,i,r,a,n,s){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:n,collisionGroupID:s,overlapMode:i},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,i,r,a,n,s){let o=r?this.ignoredGrid:this.grid,l={bucketInstanceId:a,featureIndex:n,collisionGroupID:s,overlapMode:i};for(let i=0;i<t.length;i+=4)o.insertCircle(l,t[i],t[i+1],t[i+2])}projectAndGetPerspectiveRatio(t,r,a,n,s){if(s){let a;n?(a=[t,r,n(t,r),1],i.aE(a,a,s)):eX(a=[t,r,0,1],a,s);let o=a[3];return{x:(a[0]/o+1)/2*this.transform.width+100,y:(-a[1]/o+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/o*.5,isOccluded:!1,signedDistanceFromCamera:o}}{let i=this.transform.projectTileCoordinates(t,r,a,n);return{x:(i.point.x+1)/2*this.transform.width+100,y:(1-i.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/i.signedDistanceFromCamera*.5,isOccluded:i.isOccluded,signedDistanceFromCamera:i.signedDistanceFromCamera}}}getPerspectiveRatio(t,i,r,a){let n=this.transform.projectTileCoordinates(t,i,r,a);return .5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(t,i,r,a){return r<100||t>=this.screenRightBoundary||a<100||i>this.screenBottomBoundary}isInsideGrid(t,i,r,a){return r>=0&&t<this.gridRightBoundary&&a>=0&&i<this.gridBottomBoundary}getViewportMatrix(){let t=i.ap([]);return i.Q(t,t,[-100,-100,0]),t}_projectCollisionBox(t,r,a,n,s,o,l,h,u,c,d){let p=1,f=0,m=0,_=1,g=t.anchorPointX+l[0],y=t.anchorPointY+l[1];if(o&&!s){let t=this.projectAndGetPerspectiveRatio(g+1,y,n,u,d),i=t.x-h.x,r=Math.atan((t.y-h.y)/i)+(i<0?Math.PI:0),a=Math.sin(r),s=Math.cos(r);p=s,f=a,m=-a,_=s}else if(!o&&s){let t=eL(this.transform);p=t.vecEast[0],f=t.vecEast[1],m=t.vecSouth[0],_=t.vecSouth[1]}let x=h.x,v=h.y,b=r;s&&(x=g,v=y,b=Math.pow(2,-(this.transform.zoom-a.overscaledZ))*this.transform.getPitchedTextCorrection(g,y,n),c||(b*=i.al(.5+h.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),c&&(x+=p*c.x*b+m*c.y*b,v+=f*c.x*b+_*c.y*b);let w=t.x1*b,T=t.x2*b,S=(w+T)/2,P=t.y1*b,M=t.y2*b,I=(P+M)/2,E=[];for(let{offsetX:t,offsetY:r}of[{offsetX:w,offsetY:P},{offsetX:S,offsetY:P},{offsetX:T,offsetY:P},{offsetX:T,offsetY:I},{offsetX:T,offsetY:M},{offsetX:S,offsetY:M},{offsetX:w,offsetY:M},{offsetX:w,offsetY:I}])E.push(new i.P(x+p*t+m*r,v+f*t+_*r));let C=!1;if(s){let t=E.map(t=>this.projectAndGetPerspectiveRatio(t.x,t.y,n,u,d));C=t.some(t=>!t.isOccluded),E=t.map(t=>new i.P(t.x,t.y))}else C=!0;return{box:i.aI(E),allPointsOccluded:!C}}}class eK{constructor(t,i,r,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?i:-i))):a&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class eJ{constructor(t,i,r,a,n){this.text=new eK(t?t.text:null,i,r,n),this.icon=new eK(t?t.icon:null,i,a,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class eQ{constructor(t,i,r){this.text=t,this.icon=i,this.skipFade=r}}class e0{constructor(t,i,r,a,n){this.bucketInstanceId=t,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=a,this.tileID=n}}class e1{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let i=++this.maxGroupID;this.collisionGroups[t]={ID:i,predicate:t=>t.collisionGroupID===i}}return this.collisionGroups[t]}}function e2(t,r,a,n,s){let{horizontalAlign:o,verticalAlign:l}=i.aP(t);return new i.P(-(o-.5)*r+n[0]*s,-(l-.5)*a+n[1]*s)}class e3{constructor(t,i,r,a,n){this.transform=t.clone(),this.terrain=i,this.collisionIndex=new eY(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new e1(a),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){let i=this.terrain;return i?(r,a)=>i.getElevation(t,r,a):null}getBucketParts(t,r,a,n){let s=a.getBucket(r),o=a.latestFeatureIndex;if(!s||!o||r.id!==s.layerIds[0])return;let l=a.collisionBoxArray,h=s.layers[0].layout,u=s.layers[0].paint,c=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ
2),d=a.tileSize/i.a6,p=a.tileID.toUnwrapped(),f="map"===h.get("text-rotation-alignment"),m=i.aK(a,1,this.transform.zoom),_=i.aL(this.collisionIndex.transform,a,u.get("text-translate"),u.get("text-translate-anchor")),g=i.aL(this.collisionIndex.transform,a,u.get("icon-translate"),u.get("icon-translate-anchor")),y=eR(f,this.transform,m);this.retainedQueryData[s.bucketInstanceId]=new e0(s.bucketInstanceId,o,s.sourceLayerIndex,s.index,a.tileID);let x={bucket:s,layout:h,translationText:_,translationIcon:g,unwrappedTileID:p,pitchedLabelPlaneMatrix:y,scale:c,textPixelRatio:d,holdingForFade:a.holdingForSymbolFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:i.aw(s.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(s.sourceID)};if(n)for(let i of s.sortKeyRanges){let{sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n}=i;t.push({sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n,parameters:x})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:x})}attemptAnchorPlacement(t,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x,v,b){var w,T,S;let P=i.aM[t.textAnchor],M=[t.textOffset0,t.textOffset1],I=e2(P,a,n,M,s),E=this.collisionIndex.placeCollisionBox(r,p,h,u,c,l,o,g,d.predicate,v,I,b);if((!x||this.collisionIndex.placeCollisionBox(x,p,h,u,c,l,o,y,d.predicate,v,I,b).placeable)&&E.placeable){let t;if((null==(w=this.prevPlacement)?void 0:w.variableOffsets[f.crossTileID])&&(null==(S=null==(T=this.prevPlacement)?void 0:T.placements[f.crossTileID])?void 0:S.text)&&(t=this.prevPlacement.variableOffsets[f.crossTileID].anchor),0===f.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[f.crossTileID]={textOffset:M,width:a,height:n,anchor:P,textBoxScale:s,prevAnchor:t},this.markUsedJustification(m,P,f,_),m.allowVerticalPlacement&&(this.markUsedOrientation(m,_,f),this.placedOrientations[f.crossTileID]=_),{shift:I,placedGlyphBoxes:E}}}placeLayerBucketPart(t,r,a){let{bucket:n,layout:s,translationText:o,translationIcon:l,unwrappedTileID:h,pitchedLabelPlaneMatrix:u,textPixelRatio:c,holdingForFade:d,collisionBoxArray:p,partiallyEvaluatedTextSize:f,collisionGroup:m}=t.parameters,_=s.get("text-optional"),g=s.get("icon-optional"),y=i.aN(s,"text-overlap","text-allow-overlap"),x="always"===y,v=i.aN(s,"icon-overlap","icon-allow-overlap"),b="always"===v,w="map"===s.get("text-rotation-alignment"),T="map"===s.get("text-pitch-alignment"),S="none"!==s.get("icon-text-fit"),P="viewport-y"===s.get("symbol-z-order"),M=x&&(b||!n.hasIconData()||g),I=b&&(x||!n.hasTextData()||_);!n.collisionArrays&&p&&n.deserializeCollisionBoxes(p);let E=this.retainedQueryData[n.bucketInstanceId].tileID,C=this._getTerrainElevationFunc(E),A=this.transform.getFastPathSimpleProjectionMatrix(E),D=(t,p,b)=>{var P,D;if(r[t.crossTileID])return;if(d)return void(this.placements[t.crossTileID]=new eQ(!1,!1,!1));let z=!1,k=!1,R=!0,L=null,F={box:null,placeable:!1,offscreen:null,occluded:!1},B={placeable:!1},O=null,V=null,j=null,N=0,U=0,G=0;p.textFeatureIndex?N=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(N=t.featureIndex),p.verticalTextFeatureIndex&&(U=p.verticalTextFeatureIndex);let $=p.textBox;if($){let r=r=>{let a=i.ax.horizontal;if(n.allowVerticalPlacement&&!r&&this.prevPlacement){let i=this.prevPlacement.placedOrientations[t.crossTileID];i&&(this.placedOrientations[t.crossTileID]=i,a=i,this.markUsedOrientation(n,a,t))}return a},s=(r,a)=>{if(n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&p.verticalTextBox){for(let t of n.writingModes)if(t===i.ax.vertical?B=F=a():F=r(),null==F?void 0:F.placeable)break}else F=r()},u=t.textAnchorOffsetStartIndex,d=t.textAnchorOffsetEndIndex;if(d===u){let a=(i,r)=>{let a=this.collisionIndex.placeCollisionBox(i,y,c,E,h,T,w,o,m.predicate,C,void 0,A);return(null==a?void 0:a.placeable)&&(this.markUsedOrientation(n,r,t),this.placedOrientations[t.crossTileID]=r),a};s(()=>a($,i.ax.horizontal),()=>{let r=p.verticalTextBox;return n.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&r?a(r,i.ax.vertical):{box:null,offscreen:null}}),r(null==F?void 0:F.placeable)}else{let f=i.aM[null==(D=null==(P=this.prevPlacement)?void 0:P.variableOffsets[t.crossTileID])?void 0:D.anchor],_=(i,r,s)=>{let p=i.x2-i.x1,_=i.y2-i.y1,g=t.textBoxScale,x=S&&"never"===v?r:null,b=null,P="never"===y?1:2,M="never";f&&P++;for(let r=0;r<P;r++){for(let r=u;r<d;r++){let a=n.textAnchorOffsets.get(r);if(f&&a.textAnchor!==f)continue;let u=this.attemptAnchorPlacement(a,i,p,_,g,w,T,c,E,h,m,M,t,n,s,o,l,x,C);if(u&&(null==(b=u.placedGlyphBoxes)?void 0:b.placeable))return z=!0,L=u.shift,b}f?f=null:M=y}return a&&!b&&(b={box:this.collisionIndex.placeCollisionBox($,"always",c,E,h,T,w,o,m.predicate,C,void 0,A).box,offscreen:!1,placeable:!1,occluded:!1}),b};s(()=>_($,p.iconBox,i.ax.horizontal),()=>{let r=p.verticalTextBox;return n.allowVerticalPlacement&&!(null==F?void 0:F.placeable)&&t.numVerticalGlyphVertices>0&&r?_(r,p.verticalIconBox,i.ax.vertical):{box:null,occluded:!0,offscreen:null}}),F&&(z=F.placeable,R=F.offscreen);let g=r(null==F?void 0:F.placeable);if(!z&&this.prevPlacement){let i=this.prevPlacement.variableOffsets[t.crossTileID];i&&(this.variableOffsets[t.crossTileID]=i,this.markUsedJustification(n,i.anchor,t,g))}}}if(z=null==(O=F)?void 0:O.placeable,R=null==O?void 0:O.offscreen,t.useRuntimeCollisionCircles&&t.centerJustifiedTextSymbolIndex>=0){let r=n.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),l=i.ay(n.textSizeData,f,r),c=s.get("text-padding");(V=this.collisionIndex.placeCollisionCircles(y,r,n.lineVertexArray,n.glyphOffsetArray,l,h,u,a,T,m.predicate,t.collisionCircleDiameter,c,o,C)).circles.length&&V.collisionDetected&&!a&&i.w("Collisions detected, but collision boxes are not shown"),z=x||V.circles.length>0&&!V.collisionDetected,R&&(R=V.offscreen)}if(p.iconFeatureIndex&&(G=p.iconFeatureIndex),p.iconBox){let t=t=>this.collisionIndex.placeCollisionBox(t,v,c,E,h,T,w,l,m.predicate,C,S&&L?L:void 0,A);k=B&&B.placeable&&p.verticalIconBox?(j=t(p.verticalIconBox)).placeable:(j=t(p.iconBox)).placeable,R&&(R=j.offscreen)}let Z=_||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,q=g||0===t.numIconVertices;Z||q?q?Z||k&&(k=z):z=k&&z:k=z=k&&z;let W=k&&j.placeable;if(z&&O.placeable&&this.collisionIndex.insertCollisionBox(O.box,y,s.get("text-ignore-placement"),n.bucketInstanceId,B&&B.placeable&&U?U:N,m.ID),W&&this.collisionIndex.insertCollisionBox(j.box,v,s.get("icon-ignore-placement"),n.bucketInstanceId,G,m.ID),V&&z&&this.collisionIndex.insertCollisionCircles(V.circles,y,s.get("text-ignore-placement"),n.bucketInstanceId,N,m.ID),a&&this.storeCollisionData(n.bucketInstanceId,b,p,O,j,V),0===t.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new eQ((z||M)&&!(null==O?void 0:O.occluded),(k||I)&&!(null==j?void 0:j.occluded),R||n.justReloaded),r[t.crossTileID]=!0};if(P){if(0!==t.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");
2let i=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=i.length-1;t>=0;--t){let r=i[t];D(n.symbolInstances.get(r),n.collisionArrays[r],r)}}else for(let i=t.symbolInstanceStart;i<t.symbolInstanceEnd;i++)D(n.symbolInstances.get(i),n.collisionArrays[i],i);n.justReloaded=!1}storeCollisionData(t,i,r,a,n,s){if(r.textBox||r.iconBox){let s,o;this.collisionBoxArrays.has(t)?s=this.collisionBoxArrays.get(t):(s=new Map,this.collisionBoxArrays.set(t,s)),s.has(i)?o=s.get(i):(o={text:null,icon:null},s.set(i,o)),r.textBox&&(o.text=a.box),r.iconBox&&(o.icon=n.box)}if(s){let i=this.collisionCircleArrays[t];void 0===i&&(i=this.collisionCircleArrays[t]=[]);for(let t=0;t<s.circles.length;t+=4)i.push(s.circles[t+0]-100),i.push(s.circles[t+1]-100),i.push(s.circles[t+2]),i.push(+!!s.collisionDetected)}}markUsedJustification(t,r,a,n){let s;for(let o of(s=n===i.ax.vertical?a.verticalPlacedTextSymbolIndex:({left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex})[i.aO(r)],[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex]))o>=0&&(t.text.placedSymbolArray.get(o).crossTileID=s>=0&&o!==s?0:a.crossTileID)}markUsedOrientation(t,r,a){let n=r===i.ax.horizontal||r===i.ax.horizontalOnly?r:0,s=r===i.ax.vertical?r:0;for(let i of[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex])t.text.placedSymbolArray.get(i).placedOrientation=n;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=s)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let i=this.prevPlacement,r=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;let a=i?i.symbolFadeChange(t):1,n=i?i.opacities:{},s=i?i.variableOffsets:{},o=i?i.placedOrientations:{};for(let t in this.placements){let i=this.placements[t],s=n[t];s?(this.opacities[t]=new eJ(s,a,i.text,i.icon),r||(r=i.text!==s.text.placed),r||(r=i.icon!==s.icon.placed)):(this.opacities[t]=new eJ(null,a,i.text,i.icon,i.skipFade),r||(r=i.text||i.icon))}for(let t in n){let i=n[t];if(!this.opacities[t]){let n=new eJ(i,a,!1,!1);n.isHidden()||(this.opacities[t]=n,r||(r=i.text.placed),r||(r=i.icon.placed))}}for(let t in s)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=s[t]);for(let t in o)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=o[t]);if(i&&void 0===i.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:t)}updateLayerOpacities(t,i){let r={};for(let a of i){let i=a.getBucket(t);i&&a.latestFeatureIndex&&t.id===i.layerIds[0]&&this.updateBucketOpacities(i,a.tileID,r,a.collisionBoxArray)}}updateBucketOpacities(t,r,a,n){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let s=t.layers[0],o=s.layout,l=new eJ(null,0,!1,!1,!0),h=o.get("text-allow-overlap"),u=o.get("icon-allow-overlap"),c=s._unevaluatedLayout.hasValue("text-variable-anchor")||s._unevaluatedLayout.hasValue("text-variable-anchor-offset"),d="map"===o.get("text-rotation-alignment"),p="map"===o.get("text-pitch-alignment"),f="none"!==o.get("icon-text-fit"),m=new eJ(null,0,h&&(u||!t.hasIconData()||o.get("icon-optional")),u&&(h||!t.hasTextData()||o.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);let _=(t,i,r)=>{for(let a=0;a<i/4;a++)t.opacityVertexArray.emplaceBack(r);t.hasVisibleVertices||(t.hasVisibleVertices=r!==e4)},g=this.collisionBoxArrays.get(t.bucketInstanceId);for(let r=0;r<t.symbolInstances.length;r++){let n=t.symbolInstances.get(r),{numHorizontalGlyphVertices:s,numVerticalGlyphVertices:o,crossTileID:h}=n,u=this.opacities[h];a[h]?u=l:u||(u=m,this.opacities[h]=u),a[h]=!0;let y=n.numIconVertices>
20,x=this.placedOrientations[n.crossTileID],v=x===i.ax.vertical,b=x===i.ax.horizontal||x===i.ax.horizontalOnly;if(s>0||o>0){let i=e6(u.text);_(t.text,s,v?e4:i),_(t.text,o,b?e4:i);let r=u.text.isHidden();for(let i of[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex])i>=0&&(t.text.placedSymbolArray.get(i).hidden=r||v?1:0);n.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=r||b?1:0);let a=this.variableOffsets[n.crossTileID];a&&this.markUsedJustification(t,a.anchor,n,x);let l=this.placedOrientations[n.crossTileID];l&&(this.markUsedJustification(t,"left",n,l),this.markUsedOrientation(t,l,n))}if(y){let i=e6(u.icon),r=!(f&&n.verticalPlacedIconSymbolIndex&&v);n.placedIconSymbolIndex>=0&&(_(t.icon,n.numIconVertices,r?i:e4),t.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=u.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(_(t.icon,n.numVerticalIconVertices,r?e4:i),t.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=u.icon.isHidden())}let w=(null==g?void 0:g.has(r))?g.get(r):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let a=t.collisionArrays[r];if(a){let r=new i.P(0,0);if(a.textBox||a.verticalTextBox){let i=!0;if(c){let t=this.variableOffsets[h];t?(r=e2(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),d&&r._rotate(p?-this.transform.bearingInRadians:this.transform.bearingInRadians)):i=!1}if(a.textBox||a.verticalTextBox){let n;a.textBox&&(n=v),a.verticalTextBox&&(n=b),e5(t.textCollisionBox.collisionVertexArray,u.text.placed,!i||n,w.text,r.x,r.y)}}if(a.iconBox||a.verticalIconBox){let i,n=!!(!b&&a.verticalIconBox);a.iconBox&&(i=n),a.verticalIconBox&&(i=!n),e5(t.iconCollisionBox.collisionVertexArray,u.icon.placed,i,w.icon,f?r.x:0,f?r.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,i){let r=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*r>t}setStale(){this.stale=!0}}function e5(t,i,r,a,n,s){a&&0!==a.length||(a=[0,0,0,0]);let o=a[0]-100,l=a[1]-100,h=a[2]-100,u=a[3]-100;t.emplaceBack(+!!i,+!!r,n||0,s||0,o,l),t.emplaceBack(+!!i,+!!r,n||0,s||0,h,l),t.emplaceBack(+!!i,+!!r,n||0,s||0,h,u),t.emplaceBack(+!!i,+!!r,n||0,s||0,o,u)}function e6(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 0xffffffff;let i=+!!t.placed,r=Math.floor(127*t.opacity);return 0x2000000*r+0x1000000*i+131072*r+65536*i+512*r+256*i+2*r+i}let e4=0;class e8{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,i,r,a,n){let s=this._bucketParts;for(;this._currentTileIndex<t.length;)if(i.getBucketParts(s,a,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort((t,i)=>t.sortKey-i.sortKey));this._currentPartIndex<s.length;)if(i.placeLayerBucketPart(s[this._currentPartIndex],this._seenCrossTileIDs,r),this._currentPartIndex++,n())return!0;return!1}}class e7{constructor(t,i,r,a,n,s,o,l){this.placement=new e3(t,i,s,o,l),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=a,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,r,a){let n=b(),s=()=>!this._forceFullPlacement&&b()-n>2;for(;this._currentPlacementIndex>=0;){let n=r[t[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if(i.aQ(n)&&n.layout&&(!n.minzoom||n.minzoom<=o)&&(!n.maxzoom||n.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new e8(n)),this._inProgressLayer.continuePlacement(a[n.source],this.placement,this._showCollisionBoxes,n,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}let e9=512/i.a6/2;class te{constructor(t,r,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const n=new Map;for(let t=0;t<r.length;t++){const i=r.get(t),a=i.key,s=n.get(a);s?s.push(i):n.set(a,[i])}for(const[t,r]of n){const a={positions:r.map(t=>({x:Math.floor(t.anchorX*e9),y:Math.floor(t.anchorY*e9)})),crossTileIDs:r.map(t=>t.crossTileID)};if(a.positions.length>128){const t=new i.aR(a.positions.length,16,Uint16Array);for(const{x:i,y:r}of a.positions)t.add(i,r);t.finish(),delete a.positions,a.index=t}this._symbolsByKey[t]=a}}getScaledCoordinates(t,r){let{x:a,y:n,z:s}=this.tileID.canonical,{x:o,y:l,z:h}=r.canonical,u=e9/Math.pow(2,h-s),c=(l*i.a6+t.anchorY)*u,d=n*i.a6*e9;return{x:Math.floor((o*i.a6+t.anchorX)*u-a*i.a6*e9),y:Math.floor(c-d)}}
2findMatches(t,i,r){let a=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let n=0;n<t.length;n++){let s=t.get(n);if(s.crossTileID)continue;let o=this._symbolsByKey[s.key];if(!o)continue;let l=this.getScaledCoordinates(s,i);if(o.index)for(let t of o.index.range(l.x-a,l.y-a,l.x+a,l.y+a).sort()){let i=o.crossTileIDs[t];if(!r[i]){r[i]=!0,s.crossTileID=i;break}}else if(o.positions)for(let t=0;t<o.positions.length;t++){let i=o.positions[t],n=o.crossTileIDs[t];if(Math.abs(i.x-l.x)<=a&&Math.abs(i.y-l.y)<=a&&!r[n]){r[n]=!0,s.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class tt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ti{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let i=Math.round((t-this.lng)/360);if(0!==i)for(let t in this.indexes){let r=this.indexes[t],a={};for(let t in r){let n=r[t];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+i),a[n.tileID.key]=n}this.indexes[t]=a}this.lng=t}addBucket(t,i,r){var a,n,s;if(null==(a=this.indexes[t.overscaledZ])?void 0:a[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<i.symbolInstances.length;t++)i.symbolInstances.get(t).crossTileID=0;(n=this.usedCrossTileIDs)[s=t.overscaledZ]||(n[s]={});let o=this.usedCrossTileIDs[t.overscaledZ];for(let r in this.indexes){let a=this.indexes[r];if(Number(r)>t.overscaledZ)for(let r in a){let n=a[r];n.tileID.isChildOf(t)&&n.findMatches(i.symbolInstances,t,o)}else{let n=a[t.scaledTo(Number(r)).key];n&&n.findMatches(i.symbolInstances,t,o)}}for(let t=0;t<i.symbolInstances.length;t++){let a=i.symbolInstances.get(t);a.crossTileID||(a.crossTileID=r.generate(),o[a.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new te(t,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(t,i){for(let r of i.getCrossTileIDsLists())for(let i of r)delete this.usedCrossTileIDs[t][i]}removeStaleBuckets(t){let i=!1;for(let r in this.indexes){let a=this.indexes[r];for(let n in a)t[a[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,a[n]),delete a[n],i=!0)}return i}}class tr{constructor(){this.layerIndexes={},this.crossTileIDs=new tt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,i,r){let a=this.layerIndexes[t.id];void 0===a&&(a=this.layerIndexes[t.id]=new ti);let n=!1,s={};for(let o of(a.handleWrapJump(r),i)){let i=o.getBucket(t);t.id===(null==i?void 0:i.layerIds[0])&&(i.bucketInstanceId||(this.maxBucketInstanceId+=1,i.bucketInstanceId=this.maxBucketInstanceId),a.addBucket(o.tileID,i,this.crossTileIDs)&&(n=!0),s[i.bucketInstanceId]=!0)}return a.removeStaleBuckets(s)&&(n=!0),n}pruneUnusedLayers(t){let i={};for(let r of t)i[r]=!0;for(let t in this.layerIndexes)i[t]||delete this.layerIndexes[t]}}var ta="void main() {fragColor=vec4(1.0);}";let tn={prelude:ts("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
2return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+      c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+    c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+    c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:ts("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:ts("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:ts("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:ts("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;
2uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:ts("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:ts(ta,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:ts("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:ts("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:ts("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:ts("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:ts("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:ts("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:ts(ta,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:ts("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:ts("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:ts("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:ts("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=patte
2rn_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:ts("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:ts("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:ts("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/p
2ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:ts("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:ts("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
2float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:ts("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:ts("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
2float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:ts("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
2float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:ts("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
2float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:ts("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:ts("uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_total_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}"),symbolSDF:ts("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}"),symbolTextAndIcon:ts("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;
2fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}"),terrain:ts("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
2float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:ts("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:ts("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:ts("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:ts("#ifdef GL_ES\nprecision highp float;\n#endif\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:ts("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};
2function ts(t,i){let r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=i.match(/in ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=i.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=s?s.concat(n):n,l={};return{fragmentSource:t=t.replace(r,(t,i,r,a,n)=>(l[n]=!0,"define"===i?`
3#ifndef HAS_UNIFORM_u_${n}
4in ${r} ${a} ${n};
5#else
6uniform ${r} ${a} u_${n};
7#endif
8`:`
9#ifdef HAS_UNIFORM_u_${n}
10    ${r} ${a} ${n} = u_${n};
11#endif
12`)),vertexSource:i=i.replace(r,(t,i,r,a,n)=>{let s="float"===a?"vec2":"vec4",o=n.match(/color/)?"color":s;return l[n]?"define"===i?`
13#ifndef HAS_UNIFORM_u_${n}
14uniform lowp float u_${n}_t;
15in ${r} ${s} a_${n};
16out ${r} ${a} ${n};
17#else
18uniform ${r} ${a} u_${n};
19#endif
20`:"vec4"===o?`
21#ifndef HAS_UNIFORM_u_${n}
22    ${n} = a_${n};
23#else
24    ${r} ${a} ${n} = u_${n};
25#endif
26`:`
27#ifndef HAS_UNIFORM_u_${n}
28    ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);
29#else
30    ${r} ${a} ${n} = u_${n};
31#endif
32`:"define"===i?`
33#ifndef HAS_UNIFORM_u_${n}
34uniform lowp float u_${n}_t;
35in ${r} ${s} a_${n};
36#else
37uniform ${r} ${a} u_${n};
38#endif
39`:"vec4"===o?`
40#ifndef HAS_UNIFORM_u_${n}
41    ${r} ${a} ${n} = a_${n};
42#else
43    ${r} ${a} ${n} = u_${n};
44#endif
45`:`
46#ifndef HAS_UNIFORM_u_${n}
47    ${r} ${a} ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);
48#else
49    ${r} ${a} ${n} = u_${n};
50#endif
51`}),staticAttributes:a,staticUniforms:o}}class to{constructor(t,i,r){this.vertexBuffer=t,this.indexBuffer=i,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var tl=i.aS([{name:"a_pos",type:"Int16",components:2}]);let th="#define PROJECTION_MERCATOR",tu="mercator";class tc{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return tu}get shaderDefine(){return th}get shaderPreludeCode(){return tn.projectionMercator}get vertexShaderPreludeCode(){return tn.projectionMercator.vertexSource}get subdivisionGranularity(){return i.aT.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,r,a,n,s){if(this._cachedMesh)return this._cachedMesh;let o=new i.aU;o.emplaceBack(0,0),o.emplaceBack(i.a6,0),o.emplaceBack(0,i.a6),o.emplaceBack(i.a6,i.a6);let l=t.createVertexBuffer(o,tl.members),h=i.aV.simpleSegment(0,0,4,2),u=new i.aW;u.emplaceBack(1,0,2),u.emplaceBack(1,2,3);let c=t.createIndexBuffer(u);return this._cachedMesh=new to(l,c,h),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class td{constructor(t=0,i=0,r=0,a=0){if(isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=i,this.left=r,this.right=a}interpolate(t,r,a){return null!=r.top&&null!=t.top&&(this.top=i.H.number(t.top,r.top,a)),null!=r.bottom&&null!=t.bottom&&(this.bottom=i.H.number(t.bottom,r.bottom,a)),null!=r.left&&null!=t.left&&(this.left=i.H.number(t.left,r.left,a)),null!=r.right&&null!=t.right&&(this.right=i.H.number(t.right,r.right,a)),this}getCenter(t,r){let a=i.al((this.left+t-this.right)/2,0,t),n=i.al((this.top+r-this.bottom)/2,0,r);return new i.P(a,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new td(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function tp(t,i){if(!t.renderWorldCopies||t.lngRange)return;let r=i.lng-t.center.lng;i.lng+=r>180?-360:360*(r<-180)}function tf(t){return Math.max(0,Math.floor(t))}class tm{constructor(t,r){var a;this.applyConstrain=(t,i)=>null!==this._constrainOverride?this._constrainOverride(t,i):this._callbacks.defaultConstrain(t,i),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=void 0===(null==r?void 0:r.renderWorldCopies)||!!(null==r?void 0:r.renderWorldCopies),this._minZoom=(null==r?void 0:r.minZoom)||0,this._maxZoom=(null==r?void 0:r.maxZoom)||22,this._minPitch=null==(null==r?void 0:r.minPitch)?0:null==r?void 0:r.minPitch,this._maxPitch=null==(null==r?void 0:r.maxPitch)?60:null==r?void 0:r.maxPitch,this._constrainOverride=null!=(a=null==r?void 0:r.constrainOverride)?a:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new i.W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=tf(this._zoom),this._scale=i.ao(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new td,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,r,a){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=tf(this._zoom),this._scale=i.ao(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new td(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!a&&t.autoCalculateNearFarZ,r&&this.constrainInternal(),this._calcMatrices()}
51get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){void 0===t&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){var r,a,n,s,o,l,h,u,c;let d=i.X(t,-180,180)*Math.PI/180;this._bearingInRadians!==d&&(this._unmodified=!1,this._bearingInRadians=d,this._calcMatrices(),this._rotationMatrix=y(),r=this._rotationMatrix,n=-this._bearingInRadians,s=(a=this._rotationMatrix)[0],o=a[1],l=a[2],h=a[3],u=Math.sin(n),c=Math.cos(n),r[0]=s*c+l*u,r[1]=o*c+h*u,r[2]=-(s*u)+l*c,r[3]=-(o*u)+h*c)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){let r=i.al(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==r&&(this._unmodified=!1,this._pitchInRadians=r,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){let i=t/180*Math.PI;this._rollInRadians!==i&&(this._unmodified=!1,this._rollInRadians=i,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return i.aX(this._fovInRadians)}setFov(t){t=i.al(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=i.an(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){let r=this.applyConstrain(this._center,t).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=i.ao(r),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,i){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=i,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,i,r){this._unmodified=!1,this._edgeInsets.interpolate(t,i,r),this.constrainInternal(),this._calcMatrices()}resize(t,i,r=!0){this._width=t,this._height=i,r&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var t,i;return 2!==(null==(t=this._latRange)?void 0:t.length)||2!==(null==(i=this._lngRange)?void 0:i.length)?null:new q([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-i.am,i.am])}getCameraQueryGeometry(t,r){if(1===r.length)return[r[0],t];{let{minX:a,minY:n,maxX:s,maxY:o}=i.a8.fromPoints(r).extend(t);return[new i.P(a,n),new i.P(s,n),new i.P(s,o),new i.P(a,o),new i.P(a,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:i,zoom:r}=this.applyConstrain(this.center,this.zoom);this.setCenter(i),this.setZoom(r),this._unmodified=t,this._constraining=!1}
51_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=i.ap(new Float64Array(16));i.S(t,t,[this._width/2,-this._height/2,1]),i.Q(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=i.ap(new Float64Array(16)),i.S(t,t,[1,-1,1]),i.Q(t,t,[-1,-1,0]),i.S(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,r,a,n){let s=void 0!==a?a:this.bearing,o=n=void 0!==n?n:this.pitch,{distanceToCenter:l,clampedElevation:h}=this._distanceToCenterFromAltElevationPitch(r,this.elevation,o),{x:u,y:c}=ey(o,s),d=i.a7.fromLngLat(t,r),p,f,m=i.aY(1,d.y),_=0;do{if((_+=1)>10)break;f=l/m,m=1/(p=new i.a7(d.x+u*f,d.y+c*f)).meterInMercatorCoordinateUnits()}while(Math.abs(l-f*m)>1e-12);return{center:p.toLngLat(),elevation:h,zoom:i.ar(this.height/2/Math.tan(this.fovInRadians/2)/f/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;let r=1/this.worldSize,a=i.aq(1,this.center.lat)*this.worldSize,n=i.a7.fromLngLat(this.center,this.elevation),s=n.x/r,o=n.y/r,l=n.z/r,h=this.pitch,{x:u,y:c,z:d}=ey(h,this.bearing),p=this.cameraToCenterDistance,{distanceToCenter:f,clampedElevation:m}=this._distanceToCenterFromAltElevationPitch((l+p*d)/a,t,h),_=f*a,g=new i.a7((s+-(p*u)+u*_)*r,(o+-(p*c)+c*_)*r,0).toLngLat(),y=i.aq(1,g.lat),x=i.ar(this.height/2/Math.tan(this.fovInRadians/2)/f/y/this.tileSize);this._elevation=m,this._center=g,this.setZoom(x)}_distanceToCenterFromAltElevationPitch(t,r,a){let n=-Math.cos(i.an(a)),s=t-r,o,l=r;return n*s>=0||.1>Math.abs(n)?l=t+(o=1e4)*n:o=-s/n,{distanceToCenter:o,clampedElevation:l}}getCameraPoint(){let t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let t=i.aq(1,this.center.lat)*this.worldSize;return eg(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];let r=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/r,t.canonical.y/r,1/r/i.a6,1/r/i.a6]}}class t_{constructor(t,r){this.min=t,this.max=r,this.center=i.aZ([],i.a_([],this.min,this.max),.5)}quadrant(t){let r=[t%2==0,t<2],a=i.a$(this.min),n=i.a$(this.max);for(let t=0;t<r.length;t++)a[t]=r[t]?this.min[t]:this.center[t],n[t]=r[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new t_(a,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let i=!0;for(let r of t.planes){let t=this.intersectsPlane(r);if(0===t)return 0;1===t&&(i=!1)}return i?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let i=t[3],r=t[3];for(let a=0;a<3;a++)t[a]>0?(i+=t[a]*this.min[a],r+=t[a]*this.max[a]):(r+=t[a]*this.min[a],i+=t[a]*this.max[a]);return i>=0?2:r<0?0:1}}class tg{distanceToTile2d(t,i,r,a){return Math.hypot(a.distanceX([t,i]),a.distanceY([t,i]))}getWrap(t,i,r){return r}getTileBoundingVolume(t,r,a,n){var s,o;let l=0,h=0;if(null==n?void 0:n.terrain){let u=new i.a3(t.z,r,t.z,t.x,t.y),c=n.terrain.getMinMaxElevation(u);l=null!=(s=c.minElevation)?s:Math.min(0,a),h=null!=(o=c.maxElevation)?o:Math.max(0,a)}let u=1<<t.z;return new t_([r+t.x/u,t.y/u,l],[r+(t.x+1)/u,(t.y+1)/u,h])}allowVariableZoom(t,r){let a=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,n=i.al(78.5-a/2,0,60);return!!r.terrain||t.pitch>n}allowWorldCopies(){return!0}prepareNextFrame(){}}class ty{constructor(t,i,r){this.points=t,this.planes=i,this.aabb=r}static fromInvProjectionMatrix(t,r=1,a=0,n,s){let o=s?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=Math.pow(2,a),h=[[-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(a=>{let n,s;return s=1/(n=i.aE([],a,t))[3]/r*l,i.b4(n,n,[s,s,1/n[3],s])});n&&function(t,r,a,n){let s,o,l,h=4*!!n,u=4*!n,c=0,d=[],p=[];for(let r=0;r<4;r++){let a=i.b0([],t[r+u],t[r+h]),n=i.b5(a);i.aZ(a,a,1/n),d.push(n),p.push(a)}for(let r=0;r<4;r++){let n=i.b6(t[r+h],p[r],a);c=null!==n&&n>=0?Math.max(c,n):Math.max(c,d[r])}let f=(s=i.b0([],t[r[0]],t[r[1]]),o=i.b0([],t[r[2]],t[r[1]]),l=[0,0,0,0],i.b1(l,i.b2([],s,o)),l[3]=-i.b3(l,t[r[0]]),l),m=function(t,r){let a=i.b7(t),n=i.b8([],t,1/a),s=i.b0([],r,i.aZ([],n,i.b3(r,n))),o=i.b7(s);if(o>0){let t=Math.sqrt(1-n[3]*n[3]),a=i.aZ([],n,-n[3]),l=i.a_([],a,i.aZ([],s,t/o));return i.b9(r,l)}return null}(a,f);null!==m&&(c=Math.min(c,m/i.b3(p[0],f)));for(let i=0;i<4;i++){let r=Math.min(c,d[i]);t[i+u]=[t[i+h][0]+p[i][0]*r,t[i+h][1]+p[i][1]*r,t[i+h][2]+p[i][2]*r,1]}}(h,o[0],n,s);let u=o.map(t=>{let r=i.b0([],h[t[0]],h[t[1]]),a=i.b0([],h[t[2]],h[t[1]]),n=i.b1([],i.b2([],r,a)),s=-i.b3(n,h[t[1]]);return n.concat(s)}),c=[1/0,1/0,1/0],d=[-1/0,-1/0,-1/0];for(let t of h)for(let i=0;i<3;i++)c[i]=Math.min(c[i],t[i]),d[i]=Math.max(d[i],t[i]);return new ty(h,u,new t_(c,d))}}
51class tx{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,i){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(t,r)=>{let a,n;r=i.al(+r,this.minZoom,this.maxZoom);let s={center:new i.W(t.lng,t.lat),zoom:r},o=this._helper._lngRange;this._helper._renderWorldCopies||null!==o||(o=[-(180-1e-10),180-1e-10]);let l=this.tileSize*i.ao(s.zoom),h=0,u=l,c=0,d=l,p=0,f=0,{x:m,y:_}=this.size;if(this._helper._latRange){let t=this._helper._latRange;h=i.Y(t[1])*l,(u=i.Y(t[0])*l)-h<_&&(p=_/(u-h))}o&&(c=i.X(i.Z(o[0])*l,0,l),(d=i.X(i.Z(o[1])*l,0,l))<c&&(d+=l),d-c<m&&(f=m/(d-c)));let{x:g,y:y}=ep(l,t),x=Math.max(f||0,p||0);if(x)return s.center=ef(l,new i.P(f?(d+c)/2:g,p?(u+h)/2:y)).wrap(),s.zoom+=i.ar(x),s;if(this._helper._latRange){let t=_/2;y-t<h&&(n=h+t),y+t>u&&(n=u-t)}if(o){let t=(c+d)/2,r=g;
51this._helper._renderWorldCopies&&(r=i.X(g,t-l/2,t+l/2));let n=m/2;r-n<c&&(a=c+n),r+n>d&&(a=d-n)}return(void 0!==a||void 0!==n)&&(s.center=ef(l,new i.P(null!=a?a:g,null!=n?n:y)).wrap()),s},this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new tm({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._coveringTilesDetailsProvider=new tg}clone(){let t=new tx;return t.apply(this,!1),t}apply(t,i,r){this._helper.apply(t,i,r)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let r=[new i.ba(0,t)];if(this._helper._renderWorldCopies){let a=this.screenPointToMercatorCoordinate(new i.P(0,0)),n=this.screenPointToMercatorCoordinate(new i.P(this._helper._width,0)),s=this.screenPointToMercatorCoordinate(new i.P(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new i.P(0,this._helper._height)),l=Math.floor(Math.min(a.x,n.x,s.x,o.x)),h=Math.floor(Math.max(a.x,n.x,s.x,o.x));for(let a=l-1;a<=h+1;a++)0!==a&&r.push(new i.ba(a,t))}return r}getCameraFrustum(){return ty.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let i=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,r){let a=i.aq(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(r,a),s=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,a),o=i.a7.fromLngLat(t),l=new i.a7(o.x-(n.x-s.x),o.y-(n.y-s.y));this.setCenter(null==l?void 0:l.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,r){return r?this.coordinatePoint(i.a7.fromLngLat(t),r.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(i.a7.fromLngLat(t))}screenPointToLocation(t,i){var r;return null==(r=this.screenPointToMercatorCoordinate(t,i))?void 0:r.toLngLat()}screenPointToMercatorCoordinate(t,i){if(i){let r=i.pointCoordinate(t);if(null!=r)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,r){let a=r||0,n=[t.x,t.y,0,1],s=[t.x,t.y,1,1];i.aE(n,n,this._pixelMatrixInverse),i.aE(s,s,this._pixelMatrixInverse);let o=n[3],l=s[3],h=n[1]/o,u=s[1]/l,c=n[2]/o,d=s[2]/l,p=c===d?0:(a-c)/(d-c);return new i.a7(i.H.number(n[0]/o,s[0]/l,p)/this.worldSize,i.H.number(h,u,p)/this.worldSize,a)}coordinatePoint(t,r=0,a=this._pixelMatrix){let n=[t.x*this.worldSize,t.y*this.worldSize,r,1];return i.aE(n,n,a),new i.P(n[0]/n[3],n[1]/n[3])}getBounds(){let t=Math.max(0,this._helper._height/2-em(this));return(new q).extend(this.screenPointToLocation(new i.P(0,t))).extend(this.screenPointToLocation(new i.P(this._helper._width,t))).extend(this.screenPointToLocation(new i.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new i.P(0,this._helper._height)))}isPointOnMapSurface(t,i){return i?null!=i.pointCoordinate(t):t.y>this.height/2-em(this)}calculatePosMatrix(t,r=!1,a){var n;let s=null!=(n=t.key)?n:i.bb(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),o=r?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(s)){let t=o.get(s);return a?t.f32:t.f64}let l=e_(t,this.worldSize);i.U(l,r?this._alignedProjMatrix:this._viewProjMatrix,l);let h={f64:l,f32:new Float32Array(l)};return o.set(s,h),a?h.f32:h.f64}calculateFogMatrix(t){let r=t.key,a=this._fogMatrixCacheF32;if(a.has(r))return a.get(r);let n=e_(t,this.worldSize);return i.U(n,this._fogMatrix,n),a.set(r,new Float32Array(n)),a.get(r)}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}_calculateNearFarZIfNeeded(t,r,a){if(!this._helper.autoCalculateNearFarZ)return;let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),s=t-n*this._helper._pixelPerMeter/Math.cos(r),o=n<0?s:t,l=Math.PI/2+this.pitchInRadians,h=i.an(this.fov)*(Math.abs(Math.cos(i.an(this.roll)))*this.height+Math.abs(Math.sin(i.an(this.roll)))*this.width)/this.height*(.5+a.y/this.height),u=Math.sin(h)*o/Math.sin(i.al(Math.PI-l-h,.01,Math.PI-.01)),c=em(this),d=Math.atan(c/this._helper.cameraToCenterDistance),p=i.an(.75),f=d>p?2*d*(.5+a.y/(2*c)):p,m=Math.min(u,Math.sin(f)*o/Math.sin(i.al(Math.PI-l-f,.01,Math.PI-.01)));
51this._helper._farZ=1.01*(Math.cos(Math.PI/2-r)*m+o),this._helper._nearZ=this._helper._height/50}_calcMatrices(){var t,r;let a;if(!this._helper._height)return;let n=this.centerOffset,s=ep(this.worldSize,this.center),o=s.x,l=s.y;this._helper._pixelPerMeter=i.aq(1,this.center.lat)*this.worldSize;let h=i.an(Math.min(this.pitch,89.25)),u=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(h));this._calculateNearFarZIfNeeded(u,h,n),a=new Float64Array(16),i.bc(a,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),(t=this._invProjMatrix)[0]=1/(r=a)[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1/r[5],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=1/r[14],t[12]=0,t[13]=0,t[14]=-1,t[15]=r[10]/r[14],a[8]=-(2*n.x)/this._helper._width,a[9]=2*n.y/this._helper._height,this._projectionMatrix=i.bd(a),i.S(a,a,[1,-1,1]),i.Q(a,a,[0,0,-this._helper.cameraToCenterDistance]),i.be(a,a,-this.rollInRadians),i.bf(a,a,this.pitchInRadians),i.be(a,a,-this.bearingInRadians),i.Q(a,a,[-o,-l,0]),this._mercatorMatrix=i.S([],a,[this.worldSize,this.worldSize,this.worldSize]),i.S(a,a,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=i.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,a),i.Q(a,a,[0,0,-this.elevation]),this._viewProjMatrix=a,this._invViewProjMatrix=i.bg([],a);let c=[0,0,-1,1];i.aE(c,c,this._invViewProjMatrix),this._cameraPosition=[c[0]/c[3],c[1]/c[3],c[2]/c[3]],this._fogMatrix=new Float64Array(16),i.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,u,this._helper._farZ),this._fogMatrix[8]=-(2*n.x)/this.width,this._fogMatrix[9]=2*n.y/this.height,i.S(this._fogMatrix,this._fogMatrix,[1,-1,1]),i.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),i.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),i.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),i.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),i.Q(this._fogMatrix,this._fogMatrix,[-o,-l,0]),i.S(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),i.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=i.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,a);let d=this._helper._width%2/2,p=this._helper._height%2/2,f=Math.cos(this.bearingInRadians),m=Math.sin(-this.bearingInRadians),_=o-Math.round(o)+f*d+m*p,g=l-Math.round(l)+f*p+m*d,y=new Float64Array(a);if(i.Q(y,y,[_>.5?_-1:_,g>.5?g-1:g,0]),this._alignedProjMatrix=y,!(a=i.bg(new Float64Array(16),this._pixelMatrix)))throw Error("failed to invert matrix");this._pixelMatrixInverse=a,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new i.P(0,0)),r=[t.x*this.worldSize,t.y*this.worldSize,0,1];return i.aE(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=i.aq(1,this.center.lat)*this.worldSize;return eg(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,r){let a=i.a7.fromLngLat(t),n=[a.x*this.worldSize,a.y*this.worldSize,r,1];return i.aE(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){let r,{overscaledTileID:a,aligned:n,applyTerrainMatrix:s}=t,o=this._helper.getMercatorTileCoordinates(a),l=a?this.calculatePosMatrix(a,n,!0):null;return{mainMatrix:r=(null==a?void 0:a.terrainRttPosMatrix32f)&&s?a.terrainRttPosMatrix32f:l||i.bh(),tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,i,r){return 1}transformLightDirection(t){return i.a$(t)}getRayDirectionFromPixel(t){throw Error("Not implemented.")}projectTileCoordinates(t,r,a,n){let s,o=this.calculatePosMatrix(a);n?(s=[t,r,n(t,r),1],i.aE(s,s,o)):eX(s=[t,r,0,1],s,o);let l=s[3];return{point:new i.P(s[0]/l,s[1]/l),signedDistanceFromCamera:l,isOccluded:!1}}populateCache(t){for(let i of t)this.calculatePosMatrix(i)}getMatrixForModel(t,r){let a=i.a7.fromLngLat(t,r),n=a.meterInMercatorCoordinateUnits(),s=i.bi();return i.Q(s,s,[a.x,a.y,a.z]),i.be(s,s,Math.PI),i.bf(s,s,Math.PI/2),i.S(s,s,[-n,n,n]),s}getProjectionDataForCustomLayer(t=!0){let r=new i.a3(0,0,0,0,0),a=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:t}),n=e_(r,this.worldSize);i.U(n,this._viewProjMatrix,n),a.tileMercatorCoords=[0,0,1,1];let s=[i.a6,i.a6,this.worldSize/this._helper.pixelsPerMeter],o=i.bj();return i.S(o,n,s),a.fallbackMatrix=o,a.mainMatrix=o,a}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function tv(){i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function tb(t){if(t.useSlerp)if(t.k<1){let r=i.bk(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),a=i.bk(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),n=new Float64Array(4);i.bl(n,r,a,t.k);let s=i.bm(n);t.tr.setRoll(s.roll),t.tr.setPitch(s.pitch),t.tr.setBearing(s.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(i.H.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(i.H.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(i.H.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function tw(t,r,a,n,s){let o=s.padding,l=ep(s.worldSize,a.getNorthWest()),h=ep(s.worldSize,a.getNorthEast()),u=ep(s.worldSize,a.get
51SouthEast()),c=ep(s.worldSize,a.getSouthWest()),d=i.an(-n),p=l.rotate(d),f=h.rotate(d),m=u.rotate(d),_=c.rotate(d),g=new i.P(Math.max(p.x,f.x,_.x,m.x),Math.max(p.y,f.y,_.y,m.y)),y=new i.P(Math.min(p.x,f.x,_.x,m.x),Math.min(p.y,f.y,_.y,m.y)),x=g.sub(y),v=(s.width-(o.left+o.right+r.left+r.right))/x.x,b=(s.height-(o.top+o.bottom+r.top+r.bottom))/x.y;if(b<0||v<0)return void tv();let w=Math.min(i.ar(s.scale*Math.min(v,b)),t.maxZoom),T=i.P.convert(t.offset),S=new i.P((r.left-r.right)/2,(r.top-r.bottom)/2).rotate(i.an(n)),P=T.add(S).mult(s.scale/i.ao(w));return{center:ef(s.worldSize,l.add(u).div(2).sub(P)),zoom:w,bearing:n}}class tT{get useGlobeControls(){return!1}handlePanInertia(t,i){let r=t.mag(),a=Math.abs(em(i));return{easingOffset:t.mult(Math.min(.75*a/r,1)),easingCenter:i.center}}handleMapControlsRollPitchBearingZoom(t,i){t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta),t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta)}handleMapControlsPan(t,i,r){.01>t.around.distSqr(i.centerPoint)||i.setLocationAtPoint(r,t.around)}cameraForBoxAndBearing(t,i,r,a,n){return tw(t,i,r,a,n)}handleJumpToCenterZoom(t,r){t.zoom!==(void 0!==r.zoom?+r.zoom:t.zoom)&&t.setZoom(+r.zoom),void 0!==r.center&&t.setCenter(i.W.convert(r.center))}handleEaseTo(t,r){let a=t.zoom,n=t.padding,s={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},l=void 0!==r.zoom,h=!t.isPaddingEqual(r.padding),u=!1,c=l?+r.zoom:t.zoom,d=t.centerPoint.add(r.offsetAsPoint),p=t.screenPointToLocation(d),{center:f,zoom:m}=t.applyConstrain(i.W.convert(r.center||p),null!=c?c:a);tp(t,f);let _=ep(t.worldSize,p),g=ep(t.worldSize,f).sub(_),y=i.ao(m-a);return{easeFunc:l=>{if(u&&t.setZoom(i.H.number(a,m,l)),i.bn(s,o)||tb({startEulerAngles:s,endEulerAngles:o,tr:t,k:l,useSlerp:s.roll!=o.roll}),h&&(t.interpolatePadding(n,r.padding,l),d=t.centerPoint.add(r.offsetAsPoint)),r.around)t.setLocationAtPoint(r.around,r.aroundPoint);else{let r=i.ao(t.zoom-a),n=Math.pow(m>a?Math.min(2,y):Math.max(.5,y),1-l),s=ef(t.worldSize,_.add(g.mult(l*n)).mult(r));t.setLocationAtPoint(t.renderWorldCopies?s.wrap():s,d)}},isZooming:u=m!==a,elevationCenter:f}}handleFlyTo(t,r){let a,n=void 0!==r.zoom,s=t.zoom,o=t.applyConstrain(i.W.convert(r.center||r.locationAtOffset),n?+r.zoom:s),l=o.center,h=o.zoom;tp(t,l);let u=ep(t.worldSize,r.locationAtOffset),c=ep(t.worldSize,l).sub(u),d=c.mag(),p=i.ao(h-s);if(void 0!==r.minZoom){let n=Math.min(+r.minZoom,s,h),o=t.applyConstrain(l,n).zoom;a=i.ao(o-s)}return{easeFunc:(r,a,n,o)=>{t.setZoom(1===r?h:s+i.ar(a));let d=1===r?l:ef(t.worldSize,u.add(c.mult(n)).mult(a));t.setLocationAtPoint(t.renderWorldCopies?d.wrap():d,o)},scaleOfZoom:p,targetCenter:l,scaleOfMinZoom:a,pixelPathLength:d}}}class tS{constructor(t,i,r){this.blendFunction=t,this.blendColor=i,this.mask=r}}tS.Replace=[1,0],tS.disabled=new tS(tS.Replace,i.bo.transparent,[!1,!1,!1,!1]),tS.unblended=new tS(tS.Replace,i.bo.transparent,[!0,!0,!0,!0]),tS.alphaBlended=new tS([1,771],i.bo.transparent,[!0,!0,!0,!0]);class tP{constructor(t,i,r){this.enable=t,this.mode=i,this.frontFace=r}}tP.disabled=new tP(!1,1029,2305),tP.backCCW=new tP(!0,1029,2305),tP.frontCCW=new tP(!0,1028,2305);class tM{constructor(t,i,r){this.func=t,this.mask=i,this.range=r}}tM.ReadOnly=!1,tM.ReadWrite=!0,tM.disabled=new tM(519,tM.ReadOnly,[0,1]);class tI{constructor(t,i,r,a,n,s){this.test=t,this.ref=i,this.mask=r,this.fail=a,this.depthFail=n,this.pass=s}}function tE(t){return"u">typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext}tI.disabled=new tI({func:519,mask:0},0,0,7680,7680,7680);class tC{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const r=t.context,a=r.gl;this._texFormat=a.RGBA,this._texType=a.UNSIGNED_BYTE;const n=new i.aU;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const s=new i.aW;s.emplaceBack(0,1,2),this._fullscreenTriangle=new to(r.createVertexBuffer(n,tl.members),r.createIndexBuffer(s),i.aV.simpleSegment(0,0,n.length,s.length)),this._resultBuffer=new Uint8Array(4),r.activeTexture.set(a.TEXTURE1);const o=a.createTexture();a.bindTexture(a.TEXTURE_2D,o),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=r.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(o),tE(a)&&(this._pbo=a.createBuffer(),a.bindBuffer(a.PIXEL_PACK_BUFFER,this._pbo),a.bufferData(a.PIXEL_PACK_BUFFER,4,a.STREAM_READ),a.bindBuffer(a.PIXEL_PACK_BUFFER,null))}destroy(){let t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,i){let r=this._updateCount;return this._readbackQueue?r>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():r>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,i),this._updateCount++,this._measuredError}_bindFramebuffer(){let t=this._cachedRenderContext.context,i=t.gl;t.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,r){let a=this._cachedRenderContext.context,n=a.gl;if(this._bindFramebuffer(),a.viewport.set([0,0,this._texWidth,this._texHeight]),a.clear({color:i.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(a,n.TRIANGLES,tM.disabled,tI.disabled,tS.unblended,tP.disabled,{u_input:t,u_output_expected:r},null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&tE(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);let t=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:t}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&tE(t)){let r=t.clientWaitSync(this._readbackQueue.sync,0,0);if(r===t.WAIT_FAILED)return i.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(r===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=tC._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let i;return i=0+(t[0]/256+t[1]/65536+t[2]/0x1000000),t[3]<127&&(i=-i),i/128}}let tA=i.a6/128;function tD(t,r){let a=void 0!==t.granularity?Math.max(t.granularity,1):1,n=a+2*!!t.generateBorders,s=a+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),o=n+1,l=s+1,h=t.generateBorders?-1:0,u=t.generateBorders||t.extendToNorthPole?-1:0,c=a+ +!!t.generateBorders,d=a+(t.generateBorders||t.extendToSouthPole?1:0),p=n*s*6,f=o*l>65536;if(f&&"16bit"===r)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");
51let m=f||"32bit"===r,_=new Int16Array(o*l*2),g=0;for(let r=u;r<=d;r++)for(let n=h;n<=c;n++){let s=n/a*i.a6;-1===n&&(s=-tA),n===a+1&&(s=i.a6+tA);let o=r/a*i.a6;-1===r&&(o=t.extendToNorthPole?i.bq:-tA),r===a+1&&(o=t.extendToSouthPole?i.br:i.a6+tA),_[g++]=s,_[g++]=o}let y=m?new Uint32Array(p):new Uint16Array(p),x=0;for(let t=0;t<s;t++)for(let i=0;i<n;i++){let r=i+1+t*o,a=i+(t+1)*o,n=i+1+(t+1)*o;y[x++]=i+t*o,y[x++]=a,y[x++]=r,y[x++]=r,y[x++]=a,y[x++]=n}return{vertices:_.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}let tz=new i.aT({fill:new i.bs(128,2),line:new i.bs(512,0),tile:new i.bs(128,32),stencil:new i.bs(128,1),circle:3});class tk{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return tn.projectionGlobe}get vertexShaderPreludeCode(){return tn.projectionMercator.vertexSource}get subdivisionGranularity(){return tz}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new tC(t));let r=i.Y(this._errorQueryLatitudeDegrees),a=2*Math.atan(Math.exp(Math.PI-r*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(r,a),s=b();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=s);let o=Math.min(Math.max((s-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=i.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,i.bu(o))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,i,r,a,n){let s=("stencil"===n?tz.stencil:tz.tile).getGranularityForZoomLevel(i.z);return this._getMesh(t,{granularity:s,generateBorders:r,extendToNorthPole:0===i.y&&a,extendToSouthPole:i.y===(1<<i.z)-1&&a})}_getMesh(t,r){let a,n,s,o=this._getMeshKey(r);if(o in this._tileMeshCache)return this._tileMeshCache[o];let l=(a=tD(r,"16bit"),n=i.aU.deserialize({arrayBuffer:a.vertices,length:a.vertices.byteLength/2/2}),s=i.aW.deserialize({arrayBuffer:a.indices,length:a.indices.byteLength/2/3}),new to(t.createVertexBuffer(n,tl.members),t.createIndexBuffer(s),i.aV.simpleSegment(0,0,n.length,s.length)));return this._tileMeshCache[o]=l,l}recalculate(t){}hasTransition(){var t;let i=b(),r=!1;return(r=(i-this._errorMeasurementLastChangeTime)/1e3<.7)||(r=null==(t=this._errorMeasurement)?void 0:t.awaitingQuery),r}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}let tR=new i.u({type:new i.D(i.x.projection.type)});class tL extends i.E{constructor(t){super(),this._transitionable=new i.y(tR,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new i.J(0)),this._mercatorProjection=new tc,this._verticalPerspectiveProjection=new tk}get transitionState(){let t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof i.bv){if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,i,r,a,n){return this.currentProjection.getMeshFromTileID(t,i,r,a,n)}setProjection(t){this._transitionable.setValue("type",(null==t?void 0:t.type)||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function tF(t){return 2*Math.PI*tV(t.worldSize,t.center.lat)}function tB(t,r,a,n,s){let o=1/(1<<s),l=r/i.a6*o+n*o,h=i.by((t/i.a6*o+a*o)*Math.PI*2+Math.PI,2*Math.PI),u=2*Math.atan(Math.exp(Math.PI-l*Math.PI*2))-.5*Math.PI,c=Math.cos(u),d=new Float64Array(3);return d[0]=Math.sin(h)*c,d[1]=Math.sin(u),d[2]=Math.cos(h)*c,d}function tO(t){var i,r;let a,n;return i=t.lng*Math.PI/180,a=Math.cos(r=t.lat*Math.PI/180),(n=new Float64Array(3))[0]=Math.sin(i)*a,n[1]=Math.sin(r),n[2]=Math.cos(i)*a,n}function tV(t,i){return t/(2*Math.PI)/Math.cos(i*Math.PI/180)}function tj(t){let r=Math.asin(t[1])/Math.PI*180,a=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(a>1e-6){let n=t[0]/a,s=Math.acos(t[2]/a),o=(n>0?s:-s)/Math.PI*180;return new i.W(i.X(o,-180,180),r)}return new i.W(0,r)}function tN(t){return Math.cos(t*Math.PI/180)}function tU(t,r){let a=tN(t),n=tN(r);return i.ar(n/a)}function tG(t,r){let a=t.rotate(r.bearingInRadians),n=r.zoom+tU(r.center.lat,0),s=i.bt(1/tN(r.center.lat),1/tN(Math.min(Math.abs(r.center.lat),60)),i.bw(n,7,3,0,1)),o=360/tF({worldSize:r.worldSize,center:{lat:r.center.lat}});return new i.W(r.center.lng-a.x*o*s,i.al(r.center.lat+a.y*o,-i.am,i.am))}function t$(t){let i=.5*t,r=Math.sin(i),a=Math.cos(i);return Math.log(r+a)-Math.log(a-r)}function tZ(t,r,a,n){let s=t.lat+a*n;if(Math.abs(a)>1){let o=(Math.sign(t.lat+a)!==Math.sign(t.lat)?-Math.abs(t.lat):Math.abs(t.lat))*Math.PI/180,l=Math.abs(t.lat+a)*Math.PI/180,h=t$(o+n*(l-o)),u=t$(o),c=t$(l);return new i.W(t.lng+(h-u)/(c-u)*r,s)}return new i.W(t.lng+r*n,s)}class tq{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;let t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,i,r,a){let n=`${t.z}_${t.x}_${t.y}_${(null==a?void 0:a.terrain)?"t":""}`,s=this._cache.get(n);if(s)return s;let o=this._cachePrevious.get(n);if(o)return this._cache.set(n,o),o;let l=this._boundingVolumeFactory(t,i,r,a);return this._cache.set(n,l),this._hadAnyChanges=!0,l}}class tW{constructor(t,i,r,a){this.min=r,this.max=a,this.points=t,this.planes=i}static fromAabb(t,i){let r=[];for(let a=0;a<8;a++)r.push([1&~a?t[0]:i[0],1==(a>>1&1)?i[1]:t[1],1==(a>>2&1)?i[2]:t[2]]);return new tW(r,[[-1,0,0,i[0]],[1,0,0,-t[0]],[0,-1,0,i[1]],[0,1,0,-t[1]],[0,0,-1,i[2]],[0,0,1,-t[2]]],t,i)}static fromCenterSizeAngles(t,r,a){let n=i.bA([],a[0],a[1],a[2]),s=i.bB([],[r[0],0,0],n),o=i.bB([],[0,r[1],0],n),l=i.bB([],[0,0,r[2]],n),h=[...t],u=[...t];for(let i=0;i<8;i++)for(let r=0;r<3;r++){let a=t[r]+s[r]*(1&~i?-1:1)+o[r]*(1==(i>>1&1)?1:-1)+l[r]*(1==(i>>2&1)?1:-1);h[r]=Math.min(h[r],a),u[r]=Math.max(u[r],a)}let c=[];for(let r=0;r<8;r++){let a=[...t];i.a_(a,a,i.aZ([],s,1&~r?-1:1)),i.a_(a,a,i.aZ([],o,1==(r>>1&1)?1:-1)),i.a_(a,a,i.aZ([],l,1==(r>>2&1)?1:-1)),c.push(a)}return new tW(c,[[...s,-i.b3(s,c[0])],[...o,-i.b3(o,c[0])],[...l,-i.b3(l,c[0])],[-s[0],-s[1],-s[2],-i.b3(s,c[7])],[-o[0],-o[1],-o[2],-i.b3(o,c[7])],[-l[0],-l[1],-l[2],-i.b3(l,c[7])]],h,u)}intersectsFrustum(t){let i=!0,r=this.points.length,a=this.planes.length,n=t.planes.length,s=t.points.length;for(let a=0;a<n;a++){let n=t.planes[a],s=0;for(let t=0;t<r;t++){let i=this.points[t];n[0]*i[0]+n[1]*i[1]+n[2]*i[2]+n[3]>=0&&s++}if(0===s)return 0;s<r&&(i=!1)}if(i)return 2;for(let i=0;i<a;i++){let r=this.planes[i],a=0;for(let i=0;i<s;i++){let n=t.points[i];r[0]*n[0]+r[1]*n[1]+r[2]*n[2]+r[3]>=0&&a++}if(0===a)return 0}return 1}intersectsPlane(t){let i=this.points.length,r=0;for(let a=0;a<i;a++){let i=this.points[a];t[0]*i[0]+t[1]*i[1]+t[2]*i[2]+t[3]>=0&&r++}return r===i?2:+(0!==r)}}function tH(t,i,r){let a=t-i;return a<0?-a:Math.max(0,a-r)}function tX(t,i,r,a,n){let s=t-r;return Math.max(s<0?Math.min(-s,1+s-n):s>n?Math.min(Math.max(s-n,0),1-s):0,tH(i,a,n))}class tY{constructor(){this._boundingVolumeCache=new tq(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,i,r,a){let n=1<<r.z,s=1/n,o=r.x/n,l=r.y/n;return Math.min(Math.min(Math.min(2,tX(t,i,o,l,s)),tX(t,i,o+.5,-l-s,s)),tX(t,i,o+.5,2-l-s,s))}getWrap(t,i,r){let a=1<<i.z,n=1/a,s=i.x/a,o=tH(t.x,s,n),l=tH(t.x,s-1,n),h=tH(t.x,s+1,n),u=Math.min(o,l,h);return u===h?1:u===l?-1:0}allowVariableZoom(t,i){return ew(t,i)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,i,r,a){return this._boundingVolumeCache.getTileBoundingVolume(t,i,r,a)}_computeTileBoundingVolume(t,r,a,n){var s,o;let l=0,h=0;if(null==n?void 0:n.terrain){let u=new i.a3(t.z,r,t.z,t.x,t.y),c=n.terrain.getMinMaxElevation(u);l=null!=(s=c.minElevation)?s:Math.min(0,a),h=null!=(o=c.maxElevation)?o:Math.max(0,a)}if(l/=i.bD,h/=i.bD,l+=1,h+=1,t.z<=0)return tW.fromAabb([-h,-h,-h],[h,h,h]);if(1===t.z)return tW.fromAabb([0===t.x?-h:0,0===t.y?0:-h,-h],[0===t.x?0:h,0===t.y?h:0,h]);{let r=[tB(0,0,t.x,t.y,t.z),tB(i.a6,0,t.x,t.y,t.z),tB(i.a6,i.a6,t.x,t.y,t.z),tB(0,i.a6,t.x,t.y,t.z)],a=[];for(let t of r)a.push(i.aZ([],t,h));if(h!==l)for(let t of r)a.push(i.aZ([],t,l));0===t.y&&a.push([0,1,0]),t.y===(1<<t.z)-1&&a.push([0,-1,0]);let n=[1,1,1],s=[-1,-1,-1];for(let t of a)for(let i=0;i<3;i++)n[i]=Math.min(n[i],t[i]),s[i]=Math.max(s[i],t[i]);let o=tB(i.a6/2,i.a6/2,t.x,t.y,t.z),u=i.b2([],[0,1,0],o);i.b1(u,u);let c=i.b2([],o,u);i.b1(c,c);let d=i.b2([],r[2],r[1]);i.b1(d,d);let p=i.b2([],r[0],r[3]);i.b1(p,p),a.push(i.aZ([],o,h)),t.y>=(1<<t.z)/2&&a.push(i.aZ([],tB(i.a6/2,0,t.x,t.y,t.z),h)),t.y<(1<<t.z)/2&&a.push(i.aZ([],tB(i.a6/2,i.a6,t.x,t.y,t.z),h));let f=tK(o,a),m=tK(c,a),_=[-o[0],-o[1],-o[2],f.max],g=[o[0],o[1],o[2],-f.min],y=[-c[0],-c[1],-c[2],m.max],x=[c[0],c[
511],c[2],-m.min],v=[...d,0],b=[...p,0],w=[];return 0===t.y?w.push(i.bC(b,v,_),i.bC(b,v,g)):w.push(i.bC(y,v,_),i.bC(y,v,g),i.bC(y,b,_),i.bC(y,b,g)),t.y===(1<<t.z)-1?w.push(i.bC(b,v,_),i.bC(b,v,g)):w.push(i.bC(x,v,_),i.bC(x,v,g),i.bC(x,b,_),i.bC(x,b,g)),new tW(w,[_,g,y,x,v,b],n,s)}}}function tK(t,r){let a=1/0,n=-1/0;for(let s of r){let r=i.b3(t,s);a=Math.min(a,r),n=Math.max(n,r)}return{min:a,max:n}}class tJ{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i){this._helper.resize(t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=i.bE(),this._projectionMatrix=i.bi(),this._globeViewProjMatrix32f=i.bh(),this._globeViewProjMatrixNoCorrection=i.bi(),this._globeViewProjMatrixNoCorrectionInverted=i.bi(),this._globeProjMatrixInverted=i.bi(),this._cameraPosition=i.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(t,r)=>{let a=i.al(t.lat,-i.am,i.am),n=i.al(+r,this.minZoom+tU(0,a),this.maxZoom);return{center:new i.W(t.lng,a),zoom:n}},this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new tm({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._coveringTilesDetailsProvider=new tY}clone(){let t=new tJ;return t.apply(this,!1),t}apply(t,i,r){this._globeLatitudeErrorCorrectionRadians=r||0,this._helper.apply(t,i)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=i.bz();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:i,applyGlobeMatrix:r}=t,a=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:a,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!r,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){let r=this.pitchInRadians,a=this.cameraToCenterDistance/t,n=Math.sin(r)*a,s=Math.cos(r)*a+1,o=1/Math.sqrt(n*n+s*s)*1,l=-n,h=s,u=Math.sqrt(l*l+h*h),c=[0,l/=u,h/=u];i.bF(c,c,[0,0,0],-this.bearingInRadians),i.bG(c,c,[0,0,0],-1*this.center.lat*Math.PI/180),i.bH(c,c,[0,0,0],this.center.lng*Math.PI/180);let d=1/i.b5(c);return i.aZ(c,c,d),[...c,-o*d]}isLocationOccluded(t){return!this.isSurfacePointVisible(tO(t))}transformLightDirection(t){let r=this._helper._center.lng*Math.PI/180,a=this._helper._center.lat*Math.PI/180,n=Math.cos(a),s=[Math.sin(r)*n,Math.sin(a),Math.cos(r)*n],o=[s[2],0,-s[0]],l=[0,0,0];i.b2(l,o,s),i.b1(o,o),i.b1(l,l);let h=[0,0,0];return i.b1(h,[o[0]*t[0]+l[0]*t[1]+s[0]*t[2],o[1]*t[0]+l[1]*t[1]+s[1]*t[2],o[2]*t[0]+l[2]*t[1]+s[2]*t[2]]),h}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,r,a){var n,s;let o,l=(o=1/(1<<(s=a.canonical).z),new i.a7(t/i.a6*o+s.x*o,r/i.a6*o+s.y*o)),h=(n=l.y,[i.by(l.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI]);return this.getCircleRadiusCorrection()/Math.cos(h[1])}projectTileCoordinates(t,r,a,n){let s=a.canonical,o=tB(t,r,s.x,s.y,s.z),l=1+(n?n(t,r):0)/i.bD,h=[o[0]*l,o[1]*l,o[2]*l,1];i.aE(h,h,this._globeViewProjMatrixNoCorrection);let u=this._cachedClippingPlane,c=u[0]*o[0]+u[1]*o[1]+u[2]*o[2]+u[3]<0;return{point:new i.P(h[0]/h[3],h[1]/h[3]),signedDistanceFromCamera:h[3],isOccluded:c}}
51_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=tV(this.worldSize,this.center.lat),r=i.bj(),a=i.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),i.bc(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let n=this.centerOffset;r[8]=-(2*n.x)/this._helper._width,r[9]=2*n.y/this._helper._height,this._projectionMatrix=i.bd(r),this._globeProjMatrixInverted=i.bj(),i.bg(this._globeProjMatrixInverted,r),i.Q(r,r,[0,0,-this.cameraToCenterDistance]),i.be(r,r,this.rollInRadians),i.bf(r,r,-this.pitchInRadians),i.be(r,r,this.bearingInRadians),i.Q(r,r,[0,0,-t]);let s=i.bz();s[0]=t,s[1]=t,s[2]=t,i.bf(a,r,this.center.lat*Math.PI/180),i.bI(a,a,-this.center.lng*Math.PI/180),i.S(a,a,s),this._globeViewProjMatrixNoCorrection=a,i.bf(r,r,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),i.bI(r,r,-this.center.lng*Math.PI/180),i.S(r,r,s),this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixNoCorrectionInverted=i.bj(),i.bg(this._globeViewProjMatrixNoCorrectionInverted,a);let o=i.bz();this._cameraPosition=i.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/t,i.bF(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),i.bG(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),i.bF(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),i.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),i.bG(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),i.bH(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let l=i.bd(this._globeViewProjMatrixNoCorrectionInverted);i.S(l,l,[1,1,-1]),this._cachedFrustum=ty.fromInvProjectionMatrix(l,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){i.w("calculateFogMatrix is not supported on globe projection.");let r=i.bj();return i.ap(r),r}getVisibleUnwrappedCoordinates(t){return[new i.ba(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&i.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,r){if(!this._globeViewProjMatrixNoCorrection)return 1;let a=tO(t);i.aZ(a,a,1+r/i.bD);let n=i.bE();return i.aE(n,[a[0],a[1],a[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){let t=.5*this.width,r=.5*this.height,a=[new i.P(0,0),new i.P(t,0),new i.P(this.width,0),new i.P(this.width,r),new i.P(this.width,this.height),new i.P(t,this.height),new i.P(0,this.height),new i.P(0,r)],n=[];for(let t of a)n.push(this.unprojectScreenPoint(t));let s=0,o=0,l=0,h=0,u=this.center;for(let t of n){let r=i.bJ(u.lng,t.lng),a=i.bJ(u.lat,t.lat);r<o&&(o=r),r>s&&(s=r),a<h&&(h=a),a>l&&(l=a)}let c=[u.lng+o,u.lat+h,u.lng+s,u.lat+l];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new q(c)}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}setLocationAtPoint(t,r){let a,n,s=tO(this.unprojectScreenPoint(r)),o=tO(t),l=i.bz();i.bK(l);let h=i.bz();i.bH(h,s,l,-this.center.lng*Math.PI/180),i.bG(h,h,l,this.center.lat*Math.PI/180);let u=o[0]*o[0]+o[2]*o[2],c=h[0]*h[0];if(u<c)return;let d=Math.sqrt(u-c),p=i.bL(o[0],o[2],h[0],d),f=i.bL(o[0],o[2],h[0],-d),m=i.bz();i.bH(m,o,l,-p);let _=i.bL(m[1],m[2],h[1],h[2]),g=i.bz();i.bH(g,o,l,-f);let y=i.bL(g[1],g[2],h[1],h[2]),x=.5*Math.PI,v=_>=-x&&_<=x,b=y>=-x&&y<=x;if(v&&b){let t=this.center.lng*Math.PI/180,r=this.center.lat*Math.PI/180;i.bM(p,t)+i.bM(_,r)<i.bM(f,t)+i.bM(y,r)?(a=p,n=_):(a=f,n=y)}else if(v)a=p,n=_;else{if(!b)return;a=f,n=y}let w=a/Math.PI*180,T=n/Math.PI*180,S=this.center.lat;this.setCenter(new i.W(w,i.al(T,-90,90))),this.setZoom(this.zoom+tU(S,this.center.lat))}locationToScreenPoint(t,r){let a=tO(t);if(r){let n=r.getElevationForLngLatZoom(t,this._helper._tileZoom);i.aZ(a,a,1+n/i.bD)}return this._projectSurfacePointToScreen(a)}_projectSurfacePointToScreen(t){let r=i.bE();return i.aE(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],new i.P((.5*r[0]+.5)*this.width,(-(.5*r[1])+.5)*this.height)}screenPointToMercatorCoordinate(t,r){if(r){let i=r.pointCoordinate(t);if(i)return i}return i.a7.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,i){var r;return null==(r=this.screenPointToMercatorCoordinate(t,i))?void 0:r.toLngLat()}
51isPointOnMapSurface(t,i){let r=this._cameraPosition,a=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(r,a)}getRayDirectionFromPixel(t){let r=i.bE();r[0]=t.x/this.width*2-1,r[1]=-1*(t.y/this.height*2-1),r[2]=1,r[3]=1,i.aE(r,r,this._globeViewProjMatrixNoCorrectionInverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];let a=i.bz();a[0]=r[0]-this._cameraPosition[0],a[1]=r[1]-this._cameraPosition[1],a[2]=r[2]-this._cameraPosition[2];let n=i.bz();return i.b1(n,a),n}isSurfacePointVisible(t){let i=this._cachedClippingPlane;return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let r=i.bE();return i.aE(r,[...t,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}rayPlanetIntersection(t,r){let a=i.b3(t,r),n=i.bz(),s=i.bz();i.aZ(s,r,a),i.b0(n,t,s);let o=1-i.b3(n,n);if(o<0)return null;let l=i.b3(t,t)-1,h=-a+(a<0?1:-1)*Math.sqrt(o),u=l/h;return{tMin:Math.min(u,h),tMax:Math.max(u,h)}}unprojectScreenPoint(t){var r,a;let n,s,o,l=this._cameraPosition,h=this.getRayDirectionFromPixel(t),u=this.rayPlanetIntersection(l,h);if(u){let t=i.bz();i.a_(t,l,[h[0]*u.tMin,h[1]*u.tMin,h[2]*u.tMin]);let r=i.bz();return i.b1(r,t),tj(r)}let c=this._cachedClippingPlane,d=c[0]*h[0]+c[1]*h[1]+c[2]*h[2],p=-i.b9(c,l)/d,f=i.bz();if(p>0)i.a_(f,l,[h[0]*p,h[1]*p,h[2]*p]);else{let t=i.bz();i.a_(t,l,[2*h[0],2*h[1],2*h[2]]);let r=i.b9(this._cachedClippingPlane,t);i.b0(f,t,[this._cachedClippingPlane[0]*r,this._cachedClippingPlane[1]*r,this._cachedClippingPlane[2]*r])}let m=((n=i.bz())[0]=-(c[0]*c[3]),n[1]=-(c[1]*c[3]),n[2]=-(c[2]*c[3]),{center:n,radius:Math.sqrt(1-c[3]*c[3])});return tj((r=m.center,a=m.radius,s=i.bz(),i.b0(s,f,r),o=i.bz(),i.bx(o,r,s,a/i.b7(s)),o))}getMatrixForModel(t,r){let a=i.W.convert(t),n=1/i.bD,s=i.bi();return i.bI(s,s,a.lng/180*Math.PI),i.bf(s,s,-a.lat/180*Math.PI),i.Q(s,s,[0,0,1+r/i.bD]),i.bf(s,s,.5*Math.PI),i.S(s,s,[n,n,n]),s}getProjectionDataForCustomLayer(t=!0){let r=this.getProjectionData({overscaledTileID:new i.a3(0,0,0,0,0),applyGlobeMatrix:t});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(t){}}class tQ{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,i){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=i,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(t,i)=>this.currentTransform.defaultConstrain(t,i),this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new tm({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},t),this._globeness=1,this._mercatorTransform=new tx,this._verticalPerspectiveTransform=new tJ}clone(){let t=new tQ;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,i){this._helper.apply(t,i),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let i=this._mercatorTransform.getProjectionData(t),r=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:i.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return i.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return i.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,r,a){let n=this._mercatorTransform.getPitchedTextCorrection(t,r,a),s=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,r,a);return i.bt(n,s,this._globeness)}projectTileCoordinates(t,i,r,a){return this.currentTransform.projectTileCoordinates(t,i,r,a)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){return this.currentTransform.lngLatToCameraDepth(t,i)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,a)}setLocationAtPoint(t,i){this.isGlobeRendering?(this._verticalPerspectiveTransform.setLocationAtPoint(t,i),this.apply(this._verticalPerspectiveTransform,!1)):(this._mercatorTransform.setLocationAtPoint(t,i),this.apply(this._mercatorTransform,!1))}locationToScreenPoint(t,i){return this.currentTransform.locationToScreenPoint(t,i)}screenPointToMercatorCoordinate(t,i){return this.currentTransform.screenPointToMercatorCoordinate(t,i)}screenPointToLocation(t,i){return this.currentTransform.screenPointToLocation(t,i)}
51isPointOnMapSurface(t,i){return this.currentTransform.isPointOnMapSurface(t,i)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,i){return this.currentTransform.getMatrixForModel(t,i)}getProjectionDataForCustomLayer(t=!0){let i=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return i;let r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return r.fallbackMatrix=i.mainMatrix,r}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class t0{get useGlobeControls(){return!0}handlePanInertia(t,r){let a=tG(t,r);return Math.abs(a.lng-r.center.lng)>180&&(a.lng=r.center.lng+179.5*Math.sign(a.lng-r.center.lng)),{easingCenter:a,easingOffset:new i.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,r){let a=t.around,n=r.screenPointToLocation(a);t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta);let s=r.zoom;t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta);let o=r.zoom-s;if(0===o)return;let l=i.bJ(r.center.lng,n.lng),h=l/(Math.abs(l/180)+1),u=i.bJ(r.center.lat,n.lat),c=r.getRayDirectionFromPixel(a),d=r.cameraPosition,p=-1*i.b3(d,c),f=i.bz();i.a_(f,d,[c[0]*p,c[1]*p,c[2]*p]);let m=Math.exp(-(.5*Math.max(i.b5(f)-1-.3,0))),_=tV(r.worldSize,r.center.lat)/Math.min(r.width,r.height),g=i.bw(_,.9,.5,1,.25),y=(1-i.ao(-o))*Math.min(m,g),x=r.center.lat,v=r.zoom,b=new i.W(r.center.lng+h*y,i.al(r.center.lat+u*y,-i.am,i.am));r.setLocationAtPoint(n,a);let w=r.center,T=Math.pow(Math.max(i.bw(Math.abs(l),45,85,0,1),i.bw(_,.75,.35,0,1)),.25),S=i.bJ(w.lng,b.lng),P=i.bJ(w.lat,b.lat);r.setCenter(new i.W(w.lng+S*T,w.lat+P*T).wrap()),r.setZoom(v+tU(x,r.center.lat))}handleMapControlsPan(t,i,r){if(!t.panDelta)return;let a=i.center.lat,n=i.zoom;i.setCenter(tG(t.panDelta,i).wrap()),i.setZoom(n+tU(a,i.center.lat))}cameraForBoxAndBearing(t,r,a,n,s){let o=tw(t,r,a,n,s),l=r.left/s.width*2-1,h=(s.width-r.right)/s.width*2-1,u=-(r.top/s.height*2)+1,c=-((s.height-r.bottom)/s.height*2)+1,d=0>i.bJ(a.getWest(),a.getEast()),p=d?a.getEast():a.getWest(),f=d?a.getWest():a.getEast(),m=Math.max(a.getNorth(),a.getSouth()),_=Math.min(a.getNorth(),a.getSouth()),g=p+.5*i.bJ(p,f),y=m+.5*i.bJ(m,_),x=s.clone();x.setCenter(o.center),x.setBearing(o.bearing),x.setPitch(0),x.setRoll(0),x.setZoom(o.zoom);let v=x.modelViewProjectionMatrix,b=[tO(a.getNorthWest()),tO(a.getNorthEast()),tO(a.getSouthWest
51()),tO(a.getSouthEast()),tO(new i.W(f,y)),tO(new i.W(p,y)),tO(new i.W(g,m)),tO(new i.W(g,_))],w=tO(o.center),T=1/0;for(let t of b)l<0&&(T=t0.getLesserNonNegativeNonNull(T,t0.solveVectorScale(t,w,v,"x",l))),h>0&&(T=t0.getLesserNonNegativeNonNull(T,t0.solveVectorScale(t,w,v,"x",h))),u>0&&(T=t0.getLesserNonNegativeNonNull(T,t0.solveVectorScale(t,w,v,"y",u))),c<0&&(T=t0.getLesserNonNegativeNonNull(T,t0.solveVectorScale(t,w,v,"y",c)));if(Number.isFinite(T)&&0!==T)return o.zoom=Math.min(x.zoom+i.ar(T),t.maxZoom),o;tv()}handleJumpToCenterZoom(t,r){let a=t.center.lat,n=t.applyConstrain(r.center?i.W.convert(r.center):t.center,t.zoom).center;t.setCenter(n.wrap());let s=void 0!==r.zoom?+r.zoom:t.zoom+tU(a,n.lat);t.zoom!==s&&t.setZoom(s)}handleEaseTo(t,r){let a=t.zoom,n=t.center,s=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},l={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},h=void 0!==r.zoom,u=!t.isPaddingEqual(r.padding),c=!1,d=r.center?i.W.convert(r.center):n,p=t.applyConstrain(d,a).center;tp(t,p);let f=t.clone();f.setCenter(p),f.setZoom(h?+r.zoom:a+tU(n.lat,d.lat)),f.setBearing(r.bearing);let m=new i.P(i.al(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),i.al(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));f.setLocationAtPoint(p,m);let _=(r.offset&&r.offsetAsPoint.mag())>0?f.center:p,g=h?+r.zoom:a+tU(n.lat,_.lat),y=a+tU(n.lat,0),x=g+tU(_.lat,0),v=i.bJ(n.lng,_.lng),b=i.bJ(n.lat,_.lat),w=i.ao(x-y);return{easeFunc:a=>{if(i.bn(o,l)||tb({startEulerAngles:o,endEulerAngles:l,tr:t,k:a,useSlerp:o.roll!=l.roll}),u&&t.interpolatePadding(s,r.padding,a),r.around)i.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(r.around,r.aroundPoint);else{let i=Math.pow(x>y?Math.min(2,w):Math.max(.5,w),1-a),r=tZ(n,v,b,a*i);t.setCenter(r.wrap())}if(c){let r=i.H.number(y,x,a)+tU(0,t.center.lat);t.setZoom(r)}},isZooming:c=g!==a,elevationCenter:_}}handleFlyTo(t,r){let a,n,s,o=void 0!==r.zoom,l=t.center,h=t.zoom,u=t.padding,c=!t.isPaddingEqual(r.padding),d=t.applyConstrain(i.W.convert(r.center||r.locationAtOffset),h).center,p=o?+r.zoom:t.zoom+tU(t.center.lat,d.lat),f=t.clone();f.setCenter(d),f.setZoom(p),f.setBearing(r.bearing);let m=new i.P(i.al(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),i.al(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));f.setLocationAtPoint(d,m);let _=f.center;tp(t,_);let g=(n=tO(l),s=tO(_),Math.acos(i.b3(n,s))/(2*Math.PI)*tF(t)),y=h+tU(l.lat,0),x=p+tU(_.lat,0),v=i.ao(x-y);if("number"==typeof r.minZoom){let n=Math.min(+r.minZoom+tU(_.lat,0),y,x)+tU(0,_.lat),s=t.applyConstrain(_,n).zoom+tU(_.lat,0);a=i.ao(s-y)}let b=i.bJ(l.lng,_.lng),w=i.bJ(l.lat,_.lat);return{easeFunc:(a,n,s,o)=>{let h=tZ(l,b,w,s);c&&t.interpolatePadding(u,r.padding,a);let d=1===a?_:h;t.setCenter(d.wrap());let f=y+i.ar(n);t.setZoom(1===a?p:f+tU(0,d.lat))},scaleOfZoom:v,targetCenter:_,scaleOfMinZoom:a,pixelPathLength:g}}static solveVectorScale(t,i,r,a,n){let s="x"===a?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],o=[r[3],r[7],r[11],r[15]],l=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],h=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],u=i[0]*s[0]+i[1]*s[1]+i[2]*s[2],c=i[0]*o[0]+i[1]*o[1]+i[2]*o[2];return u+n*h===l+n*c||o[3]*(l-u)+s[3]*(c-h)+l*c==u*h?null:(u+s[3]-n*c-n*o[3])/(u-l-n*c+n*h)}static getLesserNonNegativeNonNull(t,i){return null!==i&&i>=0&&i<t?i:t}}class t1{constructor(t){this._globe=t,this._mercatorCameraHelper=new tT,this._verticalPerspectiveCameraHelper=new t0}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,i){return this.currentHelper.handlePanInertia(t,i)}handleMapControlsRollPitchBearingZoom(t,i){this.currentHelper.handleMapControlsRollPitchBearingZoom(t,i)}handleMapControlsPan(t,i,r){this.currentHelper.handleMapControlsPan(t,i,r)}cameraForBoxAndBearing(t,i,r,a,n){return this.currentHelper.cameraForBoxAndBearing(t,i,r,a,n)}handleJumpToCenterZoom(t,i){this.currentHelper.handleJumpToCenterZoom(t,i)}handleEaseTo(t,i){return this.currentHelper.handleEaseTo(t,i)}handleFlyTo(t,i){return this.currentHelper.handleFlyTo(t,i)}}let t2=(t,r)=>i.C(t,null==r?void 0:r.filter(t=>"source.canvas"!==t.identifier)),t3=i.bN();class t5 extends i.E{constructor(t,r={}){var a,n;super(),this._rtlPluginLoaded=()=>{for(let t in this.tileManagers){let i=this.tileManagers[t].getSource().type;"vector"!==i&&"geojson"!==i||this.tileManagers[t].reload()}},this.map=t,this.dispatcher=new N(j(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(t,i)=>this.getGlyphs(t,i)),this.dispatcher.registerMessageHandler("GI",(t,i)=>this.getImages(t,i)),this.dispatcher.registerMessageHandler("GDA",(t,i)=>this.getDashes(t,i)),this.imageManager=new M,this.imageManager.setEventedParent(this);const s=(null==(a=t._container)?void 0:a.lang)||"u">typeof document&&(null==(n=document.documentElement)?void 0:n.lang)||void 0;this.glyphManager=new D(t._requestManager,r.localIdeographFontFamily,s),this.lineAtlas=new F(256,512),this.crossTileSymbolIndex=new tr,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",i.bO()),eu().on(eo,this._rtlPluginLoaded),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;let i=this.tileManagers[t.sourceId];if(!i)return;let r=i.getSource();if(null==r?void 0:r.vectorLayerIds)for(let t in this._layers){let i=this._layers[t];
51i.source===r.id&&this._validateLayer(i)}})}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new i.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null==(t=this.crossTileSymbolIndex)?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,r){var a,n,s;this._checkLoaded();let o=null===r?null!=(s=null==(n=null==(a=this.stylesheet.state)?void 0:a[t])?void 0:n.default)?s:null:r;if(i.bQ(o,this._globalState[t]))return this;this._globalState[t]=o,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let r=[];for(let a in t)i.bQ(this._globalState[a],t[a].default)||(r.push(a),this._globalState[a]=t[a].default);this._applyGlobalStateChanges(r)}_applyGlobalStateChanges(t){if(0===t.length)return;let i=new Set,r={};for(let a of t)for(let t in r[a]=this._globalState[a],this._layers){let r=this._layers[t],n=r.getLayoutAffectingGlobalStateRefs(),s=r.getPaintAffectingGlobalStateRefs(),o=r.getVisibilityAffectingGlobalStateRefs();if(n.has(a)&&i.add(r.source),s.has(a))for(let{name:t,value:i}of s.get(a))this._updatePaintProperty(r,t,i);(null==o?void 0:o.has(a))&&(r.recalculateVisibility(),this._updateLayer(r))}for(let t in this.dispatcher.broadcast("UGS",r),this.tileManagers)i.has(t)&&(this._reloadSource(t),this._changed=!0)}loadURL(t){return i._(this,arguments,void 0,function*(t,r={},a){this.fire(new i.n("dataloading",{dataType:"style"})),r.validate="boolean"!=typeof r.validate||r.validate,this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;try{let s=yield this.map._requestManager.transformRequest(t,"Style");i.bR(n.signal);let o=yield i.k(s,n);this._loadStyleRequest===n&&(this._loadStyleRequest=null),this._load(o.data,r,a)}catch(t){this._loadStyleRequest===n&&(this._loadStyleRequest=null),t&&!n.signal.aborted&&this.fire(new i.l(i.d(t)))}})}loadJSON(t,r={},a){this.fire(new i.n("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,x.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,r.validate=!1!==r.validate,this._load(t,r,a)}).catch(()=>{})}loadEmpty(){this.fire(new i.n("dataloading",{dataType:"style"})),this._load(t3,{validate:!1})}_load(t,r,a){var n,s;let o=r.transformStyle?r.transformStyle(a,t):t;if(!r.validate||!t2(this,i.F(o))){for(let t in o=Object.assign({},o),this._loaded=!0,this.stylesheet=o,o.sources)this.addSource(t,o.sources[t],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new k(this.stylesheet.light),this._setProjectionInternal((null==(n=this.stylesheet.projection)?void 0:n.type)||"mercator"),this.sky=new L(this.stylesheet.sky),this.map.setTerrain(null!=(s=this.stylesheet.terrain)?s:null),this.fire(new i.n("data",{dataType:"style"})),this.fire(new i.n("style.load"))}}_createLayers(){var t,r,a;let n=i.bS(this.stylesheet.layers);for(let s of(this.setGlobalState(null!=(t=this.stylesheet.state)?t:null),this.dispatcher.broadcast("SL",n),this._order=n.map(t=>t.id),this._layers={},this._serializedLayers=null,n)){let t=i.bT(s,this._globalState);if(t.setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=t,i.bU(t)&&this.tileManagers[t.source]){let i=null!=(a=null==(r=s.paint)?void 0:r["raster-fade-duration"])?a:t.paint.get("raster-fade-duration");this.tileManagers[t.source].setRasterFadeDuration(i)}}}_loadSprite(t,r=!1,a){let n;this.imageManager.setLoaded(!1);let s=new AbortController;this._spriteRequest=s,(function(t,r,a,n){return i._(this,void 0,void 0,function*(){let s=S(t),o=a>1?"@2x":"",l={},h={};for(let{id:t,url:a}of s){let s=yield r.transformRequest(P(a,o,".json"),"SpriteJSON");l[t]=i.k(s,n);let u=yield r.transformRequest(P(a,o,".png"),"SpriteImage");h[t]=f.getImage(u,n)}return yield Promise.all([...Object.values(l),...Object.values(h)]),function(t,r){return i._(this,void 0,void 0,function*(){let i={};for(let a in t){i[a]={};let n=x.getImageCanvasContext((yield r[a]).data),s=(yield t[a]).data;for(let t in s){let{width:r,height:o,x:l,y:h,sdf:u,pixelRatio:c,stretchX:d,stretchY:p,content:f,textFitWidth:m,textFitHeight:_}=s[t];i[a][t]={data:null,pixelRatio:c,sdf:u,stretchX:d,stretchY:p,content:f,textFitWidth:m,textFitHeight:_,spriteData:{width:r,height:o,x:l,y:h,context:n}}}}return i})}(l,h)})})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(t=>{if(this._spriteRequest=null,t)for(let i in t){for(let r of(this._spritesImagesIds[i]=[],this._spritesImagesIds[i]?this._spritesImagesIds[i].filter(i=>!(i in t)):[]))this.imageManager.removeImage(r),this._changedImages[r]=!0;for(let a in t[i]){let n="default"===i?a:`${i}:${a}`;this._spritesImagesIds[i].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,t[i][a],!1):this.imageManager.addImage(n,t[i][a]),r&&(this._changedImages[n]=!0)}}}).catch(t=>{this._spriteRequest=null,n=t,s.signal.aborted||this.fire(new i.l(n))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new i.n("data",{dataType:"style"})),a&&a(n)})}_unloadSprite(){for(let t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new i.n("data",{dataType:"style"}))}_validateLayer(t){let r=this.tileManagers[t.source];if(!r)return;let a=t.sourceLayer;if(!a)return;let n=r.getSource();("geojson"===n.type||n.vectorLayerIds&&!n.vectorLayerIds.includes(a))&&this.fire(new i.l(Error(`Source layer "${a}" does not exist on source "${n.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(t,r=!1){let a=this._serializedAllLayers();if(!t||0===t.length)return Object.values(r?i.bV(a):a);let n=[];for(let s of t)if(a[s]){let t=r?i.bV(a[s]):a[s];n.push(t)}return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;for(let i of(t=this._serializedLayers={},Object.keys(this._layers))){let r=this._layers[i];"custom"!==r.type&&(t[i]=r.serialize())}return t}hasTransitions(){var t,i,r;
51if((null==(t=this.light)?void 0:t.hasTransition())||(null==(i=this.sky)?void 0:i.hasTransition())||(null==(r=this.projection)?void 0:r.hasTransition()))return!0;for(let t in this.tileManagers)if(this.tileManagers[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(t){if(!this._loaded)return;let r=this._changed;if(r){let i=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);for(let t in(i.length||r.length)&&this._updateWorkerLayers(i,r),this._updatedSources){let i=this._updatedSources[t];if("reload"===i)this._reloadSource(t);else{if("clear"!==i)throw Error(`Invalid action ${i}`);this._clearSource(t)}}for(let i in this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs(),this._updatedPaintProps)this._layers[i].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}let a={};for(let t in this.tileManagers){let i=this.tileManagers[t];a[t]=i.used,i.used=!1}for(let i of this._order){let r=this._layers[i];r.recalculate(t,this._availableImages),!r.isHidden(t.zoom)&&r.source&&(this.tileManagers[r.source].used=!0)}for(let t in a){let r=this.tileManagers[t];!!a[t]!=!!r.used&&r.fire(new i.n("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,r&&this.fire(new i.n("data",{dataType:"style"}))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let i in this.tileManagers)this.tileManagers[i].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,r={}){var a;this._checkLoaded();let n=this.serialize();if(t=r.transformStyle?r.transformStyle(n,t):t,(null==(a=r.validate)||a)&&t2(this,i.F(t)))return!1;(t=i.bV(t)).layers=i.bS(t.layers);let s=i.bW(n,t),o=this._getOperationsToPerform(s);if(o.unimplemented.length>0)throw Error(`Unimplemented: ${o.unimplemented.join(", ")}.`);if(0===o.operations.length)return!1;for(let t of o.operations)t();return this.stylesheet=t,this._serializedLayers=null,this.fire(new i.n("style.load",{style:this})),!0}_getOperationsToPerform(t){let i=[],r=[];for(let a of t)switch(a.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":i.push(()=>
51this.addLayer.apply(this,a.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,a.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,a.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,a.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,a.args));break;case"addSource":i.push(()=>this.addSource.apply(this,a.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,a.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,a.args));break;case"setLight":i.push(()=>this.setLight.apply(this,a.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,a.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,a.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,a.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,a.args));break;case"setSky":i.push(()=>this.setSky.apply(this,a.args));break;case"setProjection":this.setProjection.apply(this,a.args
51);break;case"setGlobalState":i.push(()=>this.setGlobalState.apply(this,a.args));break;case"setTransition":i.push(()=>{});break;default:r.push(a.command)}return{operations:i,unimplemented:r}}addImage(t,r){if(this.getImage(t))return this.fire(new i.l(Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,r),this._afterImageUpdated(t)}updateImage(t,i){this.imageManager.updateImage(t,i)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new i.l(Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new i.n("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,r,a={}){var n;if(this._checkLoaded(),void 0!==this.tileManagers[t])throw Error(`Source "${t}" already exists.`);if(!r.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(r.type)&&this._validate(i.F.source,`sources.${t}`,r,null,a))return;(null==(n=this.map)?void 0:n._collectResourceTiming)&&(r.collectResourceTiming=!0);let s=this.tileManagers[t]=new eC(t,r,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:t})),s.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);for(let r in this._layers)if(this._layers[r].source===t)return this.fire(new i.l(Error(`Source "${t}" cannot be removed while layer "${r}" is using it.`)));let r=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],r.fire(new i.n("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,i){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);let r=this.tileManagers[t].getSource();if("geojson"!==r.type)throw Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(i),this._changed=!0}getSource(t){var i;return null==(i=this.tileManagers[t])?void 0:i.getSource()}addLayer(t,r,a={}){let n;this._checkLoaded();let s=t.id;if(this.getLayer(s))return void this.fire(new i.l(Error(`Layer "${s}" already exists on this map.`)));if("custom"===t.type){if(t2(this,i.bX(t)))return;n=i.bT(t,this._globalState)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(s,t.source),t=i.bV(t),t=i.e(t,{source:s})),this._validate(i.F.layer,`layers.${s}`,t,{arrayIndex:-1},a))return;n=i.bT(t,this._globalState),this._validateLayer(n),n.setEventedParent(this,{layer:{id:s}})}let o=r?this._order.indexOf(r):this._order.length;if(r&&-1===o)this.fire(new i.l(Error(`Cannot add layer "${s}" before non-existing layer "${r}".`)));else{if(this._order.splice(o,0,s),this._layerOrderChanged=!0,this._layers[s]=n,this._removedLayers[s]&&n.source&&"custom"!==n.type){let t=this._removedLayers[s];delete this._removedLayers[s],t.type!==n.type?this._updatedSources[n.source]="clear":(this._updatedSources[n.source]="reload",this.tileManagers[n.source].pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}}moveLayer(t,r){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new i.l(Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===r)return;let a=this._order.indexOf(t);this._order.splice(a,1);let n=r?this._order.indexOf(r):this._order.length;r&&-1===n?this.fire(new i.l(Error(`Cannot move layer "${t}" before non-existing layer "${r}".`))):(this._order.splice(n,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();let r=this._layers[t];if(!r)return void this.fire(new i.l(Error(`Cannot remove non-existing layer "${t}".`)));r.setEventedParent(null);let a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=r,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],r.onRemove&&r.onRemove(this.map)}getLayer(t){return this._layers[t]}
51getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,r,a){this._checkLoaded();let n=this.getLayer(t);n?n.minzoom===r&&n.maxzoom===a||(null!=r&&(n.minzoom=r),null!=a&&(n.maxzoom=a),this._updateLayer(n)):this.fire(new i.l(Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,r,a={}){this._checkLoaded();let n=this.getLayer(t);if(n){if(!i.bQ(n.filter,r))return null==r?(n.setFilter(void 0),void this._updateLayer(n)):void(this._validate(i.F.filter,`layers.${n.id}.filter`,r,null,a)||(n.setFilter(i.bV(r)),this._updateLayer(n)))}else this.fire(new i.l(Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return i.bV(this.getLayer(t).filter)}setLayoutProperty(t,r,a,n={}){this._checkLoaded();let s=this.getLayer(t);s?i.bQ(s.getLayoutProperty(r),a)||(s.setLayoutProperty(r,a,n),this._updateLayer(s)):this.fire(new i.l(Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,r){let a=this.getLayer(t);if(a)return a.getLayoutProperty(r);this.fire(new i.l(Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,r,a,n={}){this._checkLoaded();let s=this.getLayer(t);s?i.bQ(s.getPaintProperty(r),a)||this._updatePaintProperty(s,r,a,n):this.fire(new i.l(Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,r,a,n={}){t.setPaintProperty(r,a,n)&&this._updateLayer(t),i.bU(t)&&"raster-fade-duration"===r&&this.tileManagers[t.source].setRasterFadeDuration(a),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,i){return this.getLayer(t).getPaintProperty(i)}setFeatureState(t,r){this._checkLoaded();let a=t.source,n=t.sourceLayer,s=this.tileManagers[a];if(void 0===s)return void this.fire(new i.l(Error(`The source '${a}' does not exist in the map's style.`)));let o=s.getSource().type;"geojson"===o&&n?this.fire(new i.l(Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||n?(void 0===t.id&&this.fire(new i.l(Error("The feature id parameter must be provided."))),s.setFeatureState(n,t.id,r)):this.fire(new i.l(Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,r){this._checkLoaded();let a=t.source,n=this.tileManagers[a];if(void 0===n)return void this.fire(new i.l(Error(`The source '${a}' does not exist in the map's style.`)));let s=n.getSource().type,o="vector"===s?t.sourceLayer:void 0;"vector"!==s||o?r&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new i.l(Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(o,t.id,r):this.fire(new i.l(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();let r=t.source,a=t.sourceLayer,n=this.tileManagers[r];if(void 0!==n)return"vector"!==n.getSource().type||a?(void 0===t.id&&this.fire(new i.l(Error("The feature id parameter must be provided."))),n.getFeatureState(a,t.id)):void this.fire(new i.l(Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new i.l(Error(`The source '${r}' does not exist in the map's style.`)))}getTransition(){var t;return i.e({duration:300,delay:0},null==(t=this.stylesheet)?void 0:t.transition)}serialize(){if(!this._loaded)return;let t=i.bY(this.tileManagers,t=>t.serialize()),r=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,n=this.stylesheet;return i.bZ({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:t,layers:r,terrain:a},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.tileManagers[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let i=t=>"fill-extrusion"===this._layers[t].type,r={},a=[];for(let n=this._order.length-1;n>=0;n--){let s=this._order[n];if(i(s))for(let i of(r[s]=n,t)){let t=i[s];if(t)for(let i of t)a.push(i)}}a.sort((t,i)=>i.intersectionZ-t.intersectionZ);let n=[];for(let s=this._order.length-1;s>=0;s--){let o=this._order[s];if(i(o))for(let t=a.length-1;t>=0;t--){let i=a[t].feature;if(r[i.layer.id]<s)break;n.push(i),a.pop()}else for(let i of t){let t=i[o];if(t)for(let i of t)n.push(i.feature)}}return n}queryRenderedFeatures(t,r,a){(null==r?void 0:r.filter)&&this._val
51idate(i.F.filter,"queryRenderedFeatures.filter",r.filter,null,r);let n={};if(null==r?void 0:r.layers){if(!(Array.isArray(r.layers)||r.layers instanceof Set))return this.fire(new i.l(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let t of r.layers){let r=this._layers[t];if(!r)return this.fire(new i.l(Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];n[r.source]=!0}}let s=[];r.availableImages=this._availableImages;let o=this._serializedAllLayers(),l=r.layers instanceof Set?r.layers:Array.isArray(r.layers)?new Set(r.layers):null,h=Object.assign(Object.assign({},r),{layers:l,globalState:this._globalState});for(let l in this.tileManagers)r.layers&&!n[l]||s.push(function(t,r,a,n,s,o,l){let h=function(t,i,r){if(t)for(let a of t){let t=i[a];if((null==t?void 0:t.source)===r&&"fill-extrusion"===t.type)return!0}else for(let t in i){let a=i[t];if(a.source===r&&"fill-extrusion"===a.type)return!0}return!1}(null!=(p=null==s?void 0:s.layers)?p:null,r,t.id),u=o.maxPitchScaleFactor(),c=t.tilesIn(n,u,h);c.sort(G);let d=[];for(let n of c)d.push({wrappedTileID:n.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(r,a,t.getState(),n.queryGeometry,n.cameraQueryGeometry,n.scale,s,o,u,function(t,r){let a=i.O();return i.Q(a,a,[1,1,0]),i.S(a,a,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?i.U(a,a,t.calculatePosMatrix(r.toUnwrapped())):a}(o,n.tileID),l?(t,i)=>l(n.tileID,t,i):void 0)});var p,f=function(t){let i={},r={};for(let{queryResults:a,wrappedTileID:n}of t){r[n]||(r[n]={});let t=r[n];for(let r in a){let n=a[r];t[r]||(t[r]={});let s=t[r];for(let t of(i[r]||(i[r]=[]),n))s[t.featureIndex]||(s[t.featureIndex]=!0,i[r].push(t))}}return i}(d);for(let i in f)for(let r of f[i])$(r,t);return f}(this.tileManagers[l],this._layers,o,t,h,a,this.map.terrain?(t,i,r)=>this.map.terrain.getElevation(t,i,r):void 0));return this.placement&&s.push(function(t,i,r,a,n,s,o){let l={},h=s.queryRenderedSymbols(a),u=[];for(let t of Object.keys(h).map(Number))u.push(o[t]);for(let r of(u.sort(G),u)){let a=r.featureIndex.lookupSymbolFeatures(h[r.bucketInstanceId],i,r.bucketIndex,r.sourceLayerIndex,{filterSpec:n.filter,globalState:n.globalState},n.layers,n.availableImages,t);for(let t in a){l[t]||(l[t]=[]);let i=a[t];for(let a of(i.sort((t,i)=>{let a=r.featureSortOrder;if(a){let r=a.indexOf(t.featureIndex);return a.indexOf(i.featureIndex)-r}return i.featureIndex-t.featureIndex}),i))l[t].push(a)}}for(let i in l)for(let a of l[i])$(a,r[t[i].source]);return l}(this._layers,o,this.tileManagers,t,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(s)}querySourceFeatures(t,r){(null==r?void 0:r.filter)&&this._validate(i.F.filter,"querySourceFeatures.filter",r.filter,null,r);let a=this.tileManagers[t];return a?function(t,i){let r=t.getRenderableIds().map(i=>t.getTileByID(i)),a=[],n={};for(let t of r){let r=t.tileID.canonical.key;n[r]||(n[r]=!0,t.querySourceFeatures(a,i))}return a}(a,r?Object.assign(Object.assign({},r),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,r={}){this._checkLoaded();let a=this.light.getLight(),n=!1;for(let r in t)if(!i.bQ(t[r],a[r])){n=!0;break}if(!n)return;let s={now:b(),transition:i.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,r),this.light.updateTransitions(s)}getProjection(){var t;return null==(t=this.stylesheet)?void 0:t.projection}setProjection(t){this._checkLoaded();let i=null!=t?t:{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===i.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(i.type)}getSky(){var t;return null==(t=this.stylesheet)?void 0:t.sky}setSky(t,r={}){this._checkLoaded();let a=this.getSky(),n=!1;if(!t&&!a)return;if(t&&!a)n=!0;else if(!t&&a)n=!0;else for(let r in t)if(!i.bQ(t[r],a[r])){n=!0;break}if(!n)return;let s={now:b(),transition:i.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,r),this.sky.updateTransitions(s)}_setProjectionInternal(t){let r=function(t,r){let a={constrainOverride:r};if(Array.isArray(t)){let i=new tL({type:t});return{projection:i,transform:new tQ(a),cameraHelper:new t1(i)}}switch(t){case"mercator":return{projection:new tc,transform:new tx(a),cameraHelper:new tT};case"globe":{let t=new tL({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:t,transform:new tQ(a),cameraHelper:new t1(t)}}case"vertical-perspective":return{projection:new tk,transform:new tJ(a),cameraHelper:new t0};default:return i.w(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new tc,transform:new tx(a),cameraHelper:new tT}}}(t,this.map.transformConstrain);for(let t in this.projection=r.projection,this.map.migrateProjection(r.transform,r.cameraHelper),this.tileManagers)this.tileManagers[t].reload()}_validate(t,r,a,n,s={}){return!1!==(null==s?void 0:s.validate)&&t2(this,t.call(i.F,i.e({key:r,style:this.serialize(),value:a,styleSpec:i.x},n)))}_remove(t=!0){for(let t in this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),eu().off(eo,this._rtlPluginLoaded),this._layers)this._layers[t].setEventedParent(null);for(let t in this.tileManagers){let i=this.tileManagers[t];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(let i in this.tileManagers)this.tileManagers[i].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,i,r,a,n=!1){let s=!1,o=!1,l={};for(let i of this._order){let r=this._layers[i];if("symbol"!==r.type)continue;if(!l[r.source]){let t=this.tileManagers[r.source];l[r.source]=t.getRenderableIds(!0).map(i=>t.getTileByID(i)).sort((t,i)=>i.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(i.tileID)?-1:1))}let a=this.crossTileSymbolIndex.addLayer(r,l[r.source],t.center.lng);s||(s=a)}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n||(n=this._layerOrderChanged||0===r),(n||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(b(),t.zoom))&&(this.pauseablePlacement=new e7(t,this.map.terrain,this._order,n,i,r,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(b()),o=!0),s&&this.pauseablePlacement.placement.setStale()),o||s)for(let t of this._order){let i=this._layers[t];"symbol"===i.type&&this.placement.updateLayerOpacities(i,l[i.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(b())}_releaseSymbolFadeTiles(){for(let t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,r){return i._(this,void 0,void 0,function*(){let t=yield this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();let i=this.tileManagers[r.source];return i&&i.setDependencies(r.tileID.key,r.type,r.icons),t})}getGlyphs(t,r){return i._(this,void 0,void 0,function*(){let t=yield this.glyphManager.getGlyphs(r.stacks),i=this.tileManagers[r.source];return i&&i.setDependencies(r.tileID.key,r.type,[""]),t})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,r={}
51){this._checkLoaded(),t&&this._validate(i.F.glyphs,"glyphs",t,null,r)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,r){return i._(this,void 0,void 0,function*(){let t={};for(let[i,a]of Object.entries(r.dashes))t[i]=this.lineAtlas.getDash(a.dasharray,a.round);return t})}addSprite(t,r,a={},n){this._checkLoaded();let s=[{id:t,url:r}],o=[...S(this.stylesheet.sprite),...s];this._validate(i.F.sprite,"sprite",o,null,a)||(this.stylesheet.sprite=o,this._loadSprite(s,!0,n))}removeSprite(t){this._checkLoaded();let r=S(this.stylesheet.sprite);if(r.find(i=>i.id===t)){if(this._spritesImagesIds[t])for(let i of this._spritesImagesIds[t])this.imageManager.removeImage(i),this._changedImages[i]=!0;r.splice(r.findIndex(i=>i.id===t),1),this.stylesheet.sprite=r.length>0?r:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new i.n("data",{dataType:"style"}))}else this.fire(new i.l(Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return S(this.stylesheet.sprite)}setSprite(t,r={},a){this._checkLoaded(),t&&this._validate(i.F.sprite,"sprite",t,null,r)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}destroy(){for(let t in this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),this.tileManagers){let i=this.tileManagers[t];i.setEventedParent(null),i.onRemove(this.map)}for(let t in this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy(),this._layers){let i=this._layers[t];i.setEventedParent(null),i.onRemove&&i.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var t6=i.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class t4{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,i,r,a,n,s,o,l,h){this.context=t;let u=this.boundPaintVertexBuffers.length!==a.length;for(let t=0;!u&&t<a.length;t++)this.boundPaintVertexBuffers[t]!==a[t]&&(u=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==r||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==s||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==h?this.freshBind(i,r,a,n,s,o,l,h):(t.bindVertexArray.set(this.vao),o&&o.bind(),(null==n?void 0:n.dynamicDraw)&&n.bind(),l&&l.bind(),h&&h.bind())}freshBind(t,i,r,a,n,s,o,l){let h=t.numAttributes,u=this.context,c=u.gl;for(let h of(this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=a,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=s,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=l,i.enableAttributes(c,t),r))h.enableAttributes(c,t);for(let a of(s&&s.enableAttributes(c,t),o&&o.enableAttributes(c,t),l&&l.enableAttributes(c,t),i.bind(),i.setVertexAttribPointers(c,t,n),r))a.bind(),a.setVertexAttribPointers(c,t,n);s&&(s.bind(),s.setVertexAttribPointers(c,t,n)),a&&a.bind(),o&&(o.bind(),o.setVertexAttribPointers(c,t,n)),l&&(l.bind(),l.setVertexAttribPointers(c,t,n)),u.currentNumAttributes=h}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let t8=(t,r,a,n,s)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:r,u_fog_color:a?a.properties.get("fog-color"):i.bo.white,u_fog_ground_blend:a?a.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:s?0:a?a.calculateFogBlendOpacity(n):0,u_horizon_color:a?a.properties.get("horizon-color"):i.bo.white,u_horizon_fog_blend:a?a.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!s}),t7={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function t9(t){let i=[];for(let r of t){if(null===r)continue;let t=r.split(" ");i.push(t.pop())}return i}class ie{constructor(t,r,a,n,s,o,l,h,u=[]){const c=t.gl;this.program=c.createProgram();const d=t9(r.staticAttributes),p=a?a.getBinderAttributes():[],f=d.concat(p),m=tn.prelude.staticUniforms?t9(tn.prelude.staticUniforms):[],_=l.staticUniforms?t9(l.staticUniforms):[],g=r.staticUniforms?t9(r.staticUniforms):[],y=a?a.getBinderUniforms():[],x=m.concat(_).concat(g).concat(y),v=[];for(const t of x)v.includes(t)||v.push(t);const b=a?a.defines():[];
51tE(c)&&b.unshift("#version 300 es"),s&&b.push("#define OVERDRAW_INSPECTOR;"),o&&b.push("#define TERRAIN3D;"),h&&b.push(h),u&&b.push(...u);let w=b.concat(tn.prelude.fragmentSource,l.fragmentSource,r.fragmentSource).join("\n"),T=b.concat(tn.prelude.vertexSource,l.vertexSource,r.vertexSource).join("\n");tE(c)||(w=function(t){return t.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(w),T=function(t){return t.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(T));const S=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(S,w),c.compileShader(S),!c.getShaderParameter(S,c.COMPILE_STATUS))throw Error(`Could not compile fragment shader: ${c.getShaderInfoLog(S)}`);c.attachShader(this.program,S);const P=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(P,T),c.compileShader(P),!c.getShaderParameter(P,c.COMPILE_STATUS))throw Error(`Could not compile vertex shader: ${c.getShaderInfoLog(P)}`);c.attachShader(this.program,P),this.attributes={};const M={};this.numAttributes=f.length;for(let t=0;t<this.numAttributes;t++)f[t]&&(c.bindAttribLocation(this.program,t,f[t]),this.attributes[f[t]]=t);if(c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS))throw Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`);for(const t of(c.deleteShader(P),c.deleteShader(S),v))if(t&&!M[t]){const i=c.getUniformLocation(this.program,t);i&&(M[t]=i)}this.fixedUniforms=n(t,M),this.terrainUniforms=((t,r)=>({u_depth:new i.b_(t,r.u_depth),u_terrain:new i.b_(t,r.u_terrain),u_terrain_dim:new i.bp(t,r.u_terrain_dim),u_terrain_matrix:new i.c0(t,r.u_terrain_matrix),u_terrain_unpack:new i.c1(t,r.u_terrain_unpack),u_terrain_exaggeration:new i.bp(t,r.u_terrain_exaggeration)}))(t,M),this.projectionUniforms=((t,r)=>({u_projection_matrix:new i.c0(t,r.u_projection_matrix),u_projection_tile_mercator_coords:new i.c1(t,r.u_projection_tile_mercator_coords),u_projection_clipping_plane:new i.c1(t,r.u_projection_clipping_plane),u_projection_transition:new i.bp(t,r.u_projection_transition),u_projection_fallback_matrix:new i.c0(t,r.u_projection_fallback_matrix)}))(t,M),this.binderUniforms=a?a.getUniforms(t,M):[]}draw(t,i,r,a,n,s,o,l,h,u,c,d,p,f,m,_,g,y,x){var v;let b=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(a),t.setColorMode(n),t.setCullFace(s),l)for(let i in t.activeTexture.set(b.TEXTURE2),b.bindTexture(b.TEXTURE_2D,l.depthTexture),t.activeTexture.set(b.TEXTURE3),b.bindTexture(b.TEXTURE_2D,l.texture),this.terrainUniforms)this.terrainUniforms[i].set(l[i]);if(h)for(let t in h)this.projectionUniforms[t7[t]].set(h[t]);if(o)for(let t in this.fixedUniforms)this.fixedUniforms[t].set(o[t]);_&&_.setUniforms(t,this.binderUniforms,f,{zoom:m});let w=0;switch(i){case b.LINES:w=2;break;case b.TRIANGLES:w=3;break;case b.LINE_STRIP:w=1}for(let r of p.get())r.vaos||(r.vaos={}),(v=r.vaos)[u]||(v[u]=new t4),r.vaos[u].bind(t,this,c,_?_.getPaintVertexBuffers():[],d,r.vertexOffset,g,y,x),b.drawElements(i,r.primitiveLength*w,b.UNSIGNED_SHORT,r.primitiveOffset*w*2)}}function it(t,r,a){let n=1/i.aK(a,1,r.transform.tileZoom),s=Math.pow(2,a.tileID.overscaledZ),o=a.tileSize*Math.pow(2,r.transform.tileZoom)/s,l=o*(a.tileID.canonical.x+a.tileID.wrap*s),h=o*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[l>>16,h>>16],u_pixel_coord_lower:[65535&l,65535&h]}}let ii=(t,r,a,n)=>{let s=t.style.light,o=s.properties.get("position"),l=[o.x,o.y,o.z],h=i.c4();"viewport"===s.properties.get("anchor")&&i.c5(h,t.transform.bearingInRadians),i.c6(l,l,h);let u=t.transform.transformLightDirection(l),c=s.properties.get("color");return{u_lightpos:l,u_lightpos_globe:u,u_lightintensity:s.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+r,u_opacity:a,u_fill_translate:n}},ir=(t,r,a,n,s,o,l)=>i.e(ii(t,r,a,n),it(o,t,l),{u_height_factor:-Math.pow(2,s.overscaledZ
51)/l.tileSize/8}),ia=(t,r,a,n)=>i.e(it(r,t,a),{u_fill_translate:n}),is=(t,i)=>({u_world:t,u_fill_translate:i}),io=(t,r,a,n,s)=>i.e(ia(t,r,a,s),{u_world:n}),il=(t,r,a,n,s)=>{let o=t.transform,l,h,u=0;if("map"===a.paint.get("circle-pitch-alignment")){let t=i.aK(r,1,o.zoom);l=!0,h=[t,t],u=t/(i.a6*Math.pow(2,r.tileID.overscaledZ))*2*Math.PI*s}else l=!1,h=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+("map"===a.paint.get("circle-pitch-scale")),u_pitch_with_map:+l,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:h,u_globe_extrude_scale:u,u_translate:n}},ih=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),iu=t=>({u_viewport_size:[t.width,t.height]}),ic=(t,i=1)=>({u_color:t,u_overlay:0,u_overlay_scale:i}),id=(t,r,a,n)=>{let s=i.aK(t,1,r)/(i.a6*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:i.aK(t,1,r),u_intensity:a,u_globe_extrude_scale:s}},ip=(t,r,a,n)=>{let s=i.O();i.c7(s,0,t.width,t.height,0,0,1);let o=t.context.gl;return{u_matrix:s,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:a,u_color_ramp:n,u_opacity:r.paint.get("heatmap-opacity")}},im=(t,r,a)=>{var n;let s,o,l,h=a.paint.get("hillshade-accent-color");switch(a.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}let u=a.getIlluminationProperties();for(let i=0;i<u.directionRadians.length;i++)"viewport"===a.paint.get("hillshade-illumination-anchor")&&(u.directionRadians[i]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:(s=Math.pow(2,(n=r.tileID).canonical.z),o=n.canonical.y,[new i.a7(0,o/s).toLngLat().lat,new i.a7(0,(o+1)/s).toLngLat().lat]),u_exaggeration:a.paint.get("hillshade-exaggeration"),u_altitudes:u.altitudeRadians,u_azimuths:u.directionRadians,u_accent:h,u_method:l,u_highlights:u.highlightColor,u_shadows:u.shadowColor}},i_=(t,r)=>{let a=r.stride,n=i.O();return i.c7(n,0,i.a6,-i.a6,0,0,1),i.Q(n,n,[0,-i.a6,0]),{u_matrix:n,u_image:1,u_dimension:[a,a],u_zoom:t.overscaledZ,u_unpack:r.getUnpackVector()}},ig=(t,i,r=0)=>({u_image:0,u_unpack:i.getUnpackVector(),u_dimension:[i.stride,i.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:t.paint.get("color-relief-opacity")}),iy=(t,r,a,n)=>{let s=t.transform;return{u_translation:iS(t,r,a),u_ratio:n/i.aK(r,1,s.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},ix=(t,r,a,n,s)=>i.e(iy(t,r,a,n),{u_image:0,u_image_height:s}),iv=(t,r,a,n,s)=>{let o=t.transform,l=iT(r,o);return{u_translation:iS(t,r,a),u_texsize:r.imageAtlasTexture.size,u_ratio:n/i.aK(r,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[l,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},ib=(t,r,a,n,s)=>{let o=iT(r,t.transform);return i.e(iy(t,r,a,n),{u_tileratio:o,u_crossfade_from:s.fromScale,u_crossfade_to:s.toScale,u_image:0,u_mix:s.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},iw=(t,r,a,n,s,o)=>{let l=iT(r,t.transform);return i.e(iy(t,r,a,n),{u_image:0,u_image_height:o,u_tileratio:l,u_crossfade_from:s.fromScale,u_crossfade_to:s.toScale,u_image_dash:1,u_mix:s.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})};function iT(t,r){return 1/i.aK(t,1,r.tileZoom)}function iS(t,r,a){return i.aL(t.transform,r,a.paint.get("line-translate"),a.paint.get("line-translate-anchor"))}let iP=(t,i,r,a,n)=>{var s,o,l;let h,u;return{u_tl_parent:t,u_scale_parent:i,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(o=a.paint.get("raster-saturation"))>0?1-1/(1.001-o):-o,u_contrast_factor:(s=a.paint.get("raster-contrast"))>0?1/(1-s):1+s,u_spin_weights:(h=Math.sin(l=a.paint.get("raster-hue-rotate")*(Math.PI/180)),[(2*(u=Math.cos(l))+1)/3,(-Math.sqrt(3)*h-u+1)/3,(Math.sqrt(3)*h-u+1)/3]),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]}},iM=(t,i,r,a,n,s,o,l,h,u,c,d,p)=>{let f=o.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:f.cameraToCenterDistance,u_pitch:f.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:f.width/f.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_label_plane_matrix:l,u_coord_matrix:h,u_is_text:+c,u_pitch_with_map:+a,u_is_along_line:n,u_is_variable_anchor:s,u_texsize:d,u_texture:0,u_translation:u,u_pitched_scale:p}},iI=(t,r,a,n,s,o,l,h,u,c,d,p,f,m)=>{let _=l.transform;return i.e(iM(t,r,a,n,s,o,l,h,u,c,d,p,m),{u_gamma_scale:n?Math.cos(_.pitch
51*Math.PI/180)*_.cameraToCenterDistance:1,u_device_pixel_ratio:l.pixelRatio,u_is_halo:+!!f,u_is_plain:1})},iE=(t,r,a,n,s,o,l,h,u,c,d,p,f)=>i.e(iI(t,r,a,n,s,o,l,h,u,c,!0,d,!0,f),{u_texsize_icon:p,u_texture_icon:1}),iC=(t,i)=>({u_opacity:t,u_color:i}),iA=(t,r,a,n,s)=>i.e(function(t,r,a,n){let s=a.imageManager.getPattern(t.from.toString()),o=a.imageManager.getPattern(t.to.toString()),{width:l,height:h}=a.imageManager.getPixelSize(),u=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,a.transform.tileZoom)/u,d=c*(n.tileID.canonical.x+n.tileID.wrap*u),p=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:s.tl,u_pattern_br_a:s.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[l,h],u_mix:r.t,u_pattern_size_a:s.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/i.aK(n,1,a.transform.tileZoom),u_pixel_coord_upper:[d>>16,p>>16],u_pixel_coord_lower:[65535&d,65535&p]}}(a,s,r,n),{u_opacity:t}),iD=(t,i)=>{},iz={fillExtrusion:(t,r)=>({u_lightpos:new i.c2(t,r.u_lightpos),u_lightpos_globe:new i.c2(t,r.u_lightpos_globe),u_lightintensity:new i.bp(t,r.u_lightintensity),u_lightcolor:new i.c2(t,r.u_lightcolor),u_vertical_gradient:new i.bp(t,r.u_vertical_gradient),u_opacity:new i.bp(t,r.u_opacity),u_fill_translate:new i.c3(t,r.u_fill_translate)}),fillExtrusionPattern:(t,r)=>({u_lightpos:new i.c2(t,r.u_lightpos),u_lightpos_globe:new i.c2(t,r.u_lightpos_globe),u_lightintensity:new i.bp(t,r.u_lightintensity),u_lightcolor:new i.c2(t,r.u_lightcolor),u_vertical_gradient:new i.bp(t,r.u_vertical_gradient),u_height_factor:new i.bp(t,r.u_height_factor),u_opacity:new i.bp(t,r.u_opacity),u_fill_translate:new i.c3(t,r.u_fill_translate),u_image:new i.b_(t,r.u_image),u_texsize:new i.c3(t,r.u_texsize),u_pixel_coord_upper:new i.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new i.c3(t,r.u_pixel_coord_lower),u_scale:new i.c2(t,r.u_scale),u_fade:new i.bp(t,r.u_fade)}),fill:(t,r)=>({u_fill_translate:new i.c3(t,r.u_fill_translate)}),fillPattern:(t,r)=>({u_image:new i.b_(t,r.u_image),u_texsize:new i.c3(t,r.u_texsize),u_pixel_coord_upper:new i.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new i.c3(t,r.u_pixel_coord_lower),u_scale:new i.c2(t,r.u_scale),u_fade:new i.bp(t,r.u_fade),u_fill_translate:new i.c3(t,r.u_fill_translate)}),fillOutline:(t,r)=>({u_world:new i.c3(t,r.u_world),u_fill_translate:new i.c3(t,r.u_fill_translate)}),fillOutlinePattern:(t,r)=>({u_world:new i.c3(t,r.u_world),u_image:new i.b_(t,r.u_image),u_texsize:new i.c3(t,r.u_texsize),u_pixel_coord_upper:new i.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new i.c3(t,r.u_pixel_coord_lower),u_scale:new i.c2(t,r.u_scale),u_fade:new i.bp(t,r.u_fade),u_fill_translate:new i.c3(t,r.u_fill_translate)}),circle:(t,r)=>({u_camera_to_center_distance:new i.bp(t,r.u_camera_to_center_distance),u_scale_with_map:new i.b_(t,r.u_scale_with_map),u_pitch_with_map:new i.b_(t,r.u_pitch_with_map),u_extrude_scale:new i.c3(t,r.u_extrude_scale),u_device_pixel_ratio:new i.bp(t,r.u_device_pixel_ratio),u_globe_extrude_scale:new i.bp(t,r.u_globe_extrude_scale),u_translate:new i.c3(t,r.u_translate)}),collisionBox:(t,r)=>({u_pixel_extrude_scale:new i.c3(t,r.u_pixel_extrude_scale)}),collisionCircle:(t,r)=>({u_viewport_size:new i.c3(t,r.u_viewport_size)}),debug:(t,r)=>({u_color:new i.b$(t,r.u_color),u_overlay:new i.b_(t,r.u_overlay),u_overlay_scale:new i.bp(t,r.u_overlay_scale)}),depth:iD,clippingMask:iD,heatmap:(t,r)=>({u_extrude_scale:new i.bp(t,r.u_extrude_scale),u_intensity:new i.bp(t,r.u_intensity),u_globe_extrude_scale:new i.bp(t,r.u_globe_extrude_scale)}),heatmapTexture:(t,r)=>({u_matrix:new i.c0(t,r.u_matrix),u_world:new i.c3(t,r.u_world),u_image:new i.b_(t,r.u_image),u_color_ramp:new i.b_(t,r.u_color_ramp),u_opacity:new i.bp(t,r.u_opacity)}),hillshade:(t,r)=>({u_image:new i.b_(t,r.u_image),u_latrange:new i.c3(t,r.u_latrange),u_exaggeration:new i.bp(t,r.u_exaggeration),u_altitudes:new i.c9(t,r.u_altitudes),u_azimuths:new i.c9(t,r.u_azimuths),u_accent:new i.b$(t,r.u_accent),u_method:new i.b_(t,r.u_method),u_shadows:new i.c8(t,r.u_shadows),u_highlights:new i.c8(t,r.u_highlights)}),hillshadePrepare:(t,r)=>({u_matrix:new i.c0(t,r.u_matrix),u_image:new i.b_(t,r.u_image),u_dimension:new i.c3(t,r.u_dimension),u_zoom:new i.bp(t,r.u_zoom),u_unpack:new i.c1(t,r.u_unpack)}),colorRelief:(t,r)=>({u_image:new i.b_(t,r.u_image),u_unpack:new i.c1(t,r.u_unpack),u_dimension:new i.c3(t,r.u_dimension),u_elevation_stops:new i.b_(t,r.u_elevation_stops),u_color_stops:new i.b_(t,r.u_color_stops),u_color_ramp_size:new i.b_(t,r.u_color_ramp_size),u_opacity:new i.bp(t,r.u_opacity)}),line:(t,r)=>({u_translation:new i.c3(t,r.u_translation),u_ratio:new i.bp(t,r.u_ratio),u_device_pixel_ratio:new i.bp(t,r.u_device_pixel_ratio),u_units_to_pixels:new i.c3(t,r.u_units_to_pixels)}),lineGradient:(t,r)=>({u_translation:new i.c3(t,r.u_translation),u_ratio:new i.bp(t,r.u_ratio),u_device_pixel_ratio:new i.bp(t,r.u_device_pixel_ratio),u_units_to_pixels:new i.c3(t,r.u_units_to_pixels),u_image:new i.b_(t,r.u_image),u_image_height:new i.bp(t,r.u_image_height)}),linePattern:(t,r)=>({u_translation:new i.c3(t,r.u_translation),u_texsize:new i.c3(t,r.u_texsize),u_ratio:new i.bp(t,r.u_ratio),u_device_pixel_ratio:new i.bp(t,r.u_device_pixel_ratio),u_image:new i.b_(t,r.u_image),u_units_to_pixels:new i.c3(t,r.u_units_to_pixels),u_scale:new i.c2(t,r.u_scale),u_fade:new i.bp(t,r.u_fade)}),lineSDF:(t,r)=>({u_translation:new i.c3(t,r.u_translation),u_ratio:new i.bp(t,r.u_ratio),u_device_pixel_ratio:new i.bp(t,r.u_device_pixel_ratio),u_units_to_pixels:new i.c3(t,r.u_units_to_pixels),u_image:new i.b_(t,r.u_image),u_mix:new i.bp(t,r.u_mix),u_tileratio:new i.bp(t,r.u_tileratio),u_crossfade_from:new i.bp(t,r.u_crossfade_from),u_crossfade_to:new i.bp(t,r.u_crossfade_to),u_lineatlas_width:new i.bp(t,r.u_lineatlas_width),u_lineatlas_height:new i.bp(t,r.u_lineatlas_height)}),lineGradientSDF:(t,r)=>({u_translation:new i.c3(t,r.u_translation),u_ratio:new i.bp(t,r.u_ratio),u_device_pixel_ratio:new i.bp(t,r.u_device_pixel_ratio),u_units_to_pixels:new i.c3(t,r.u_units_to_pixels),u_image:new i.b_(t,r.u_image),u_image_height:new i.bp(t,r.u_image_height),u_tileratio:new i.bp(t,r.u_tileratio),u_crossfade_from:new i.bp(t,r.u_crossfade_from),u_crossfade_to:new i.bp(t,r.u_crossfade_to),u_image_dash:new i.b_(t,r.u_image_dash),u_mix:new i.bp(t,r.u_mix),u_lineatlas_width:new i.bp(t,r.u_lineatlas_width),u_lineatlas_height:new i.bp(t,r.u_lineatlas_height)}),raster:(t,r)=>({u_tl_parent:new i.c3(t,r.u_tl_parent),u_scale_parent:new i.bp(t,r.u_scale_parent),u_buffer_scale:new i.bp(t,r.u_buffer_scale),u_fade_t:new i.bp(t,r.u_fade_t),u_opacity:new i.bp(t,r.u_opacity),u_image0:new i.b_(t,r.u_image0),u_image1:new i.b_(t,r.u_image1),u_brightness_low:new i.bp(t,r.u_brightness_low),u_brightness_high:new i.bp(t,r.u_brightness_high),u_saturation_factor:new i.bp(t,r.u_saturation_factor),u_contrast_factor:new i.bp(t,r.u_contrast_factor),u_spin_weights:new i.c2(t,r.u_spin_weights),u_coords_top:new i.c1(t,r.u_coords_top),u_coords_bottom:new i.c1(t,r.u_coords_bottom)}),symbolIcon:(t,r)=>({u_is_size_zoom_constant:new i.b_(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new i.b_(t,r.u_is_size_feature_constant),u_size_t:new i.bp(t,r.u_size_t),u_size:new i.bp(t,r.u_size),u_camera_to_center_distance:new i.bp(t,r.u_camera_to_center_distance),u_pitch:new i.bp(t,r.u_pitch),u_rotate_symbol:new i.b_(t,r.u_rotate_symbol),u_aspect_ratio:new i.bp(t,r.u_aspect_ratio),u_fade_change:new i.bp(t,r.u_fade_change),u_label_plane_matrix:new i.c0(t,r.u_label_plane_matrix
51),u_coord_matrix:new i.c0(t,r.u_coord_matrix),u_is_text:new i.b_(t,r.u_is_text),u_pitch_with_map:new i.b_(t,r.u_pitch_with_map),u_is_along_line:new i.b_(t,r.u_is_along_line),u_is_variable_anchor:new i.b_(t,r.u_is_variable_anchor),u_texsize:new i.c3(t,r.u_texsize),u_texture:new i.b_(t,r.u_texture),u_translation:new i.c3(t,r.u_translation),u_pitched_scale:new i.bp(t,r.u_pitched_scale)}),symbolSDF:(t,r)=>({u_is_size_zoom_constant:new i.b_(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new i.b_(t,r.u_is_size_feature_constant),u_size_t:new i.bp(t,r.u_size_t),u_size:new i.bp(t,r.u_size),u_camera_to_center_distance:new i.bp(t,r.u_camera_to_center_distance),u_pitch:new i.bp(t,r.u_pitch),u_rotate_symbol:new i.b_(t,r.u_rotate_symbol),u_aspect_ratio:new i.bp(t,r.u_aspect_ratio),u_fade_change:new i.bp(t,r.u_fade_change),u_label_plane_matrix:new i.c0(t,r.u_label_plane_matrix),u_coord_matrix:new i.c0(t,r.u_coord_matrix),u_is_text:new i.b_(t,r.u_is_text),u_pitch_with_map:new i.b_(t,r.u_pitch_with_map),u_is_along_line:new i.b_(t,r.u_is_along_line),u_is_variable_anchor:new i.b_(t,r.u_is_variable_anchor),u_texsize:new i.c3(t,r.u_texsize),u_texture:new i.b_(t,r.u_texture),u_gamma_scale:new i.bp(t,r.u_gamma_scale),u_device_pixel_ratio:new i.bp(t,r.u_device_pixel_ratio),u_is_halo:new i.b_(t,r.u_is_halo),u_is_plain:new i.b_(t,r.u_is_plain),u_translation:new i.c3(t,r.u_translation),u_pitched_scale:new i.bp(t,r.u_pitched_scale)}),symbolTextAndIcon:(t,r)=>({u_is_size_zoom_constant:new i.b_(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new i.b_(t,r.u_is_size_feature_constant),u_size_t:new i.bp(t,r.u_size_t),u_size:new i.bp(t,r.u_size),u_camera_to_center_distance:new i.bp(t,r.u_camera_to_center_distance),u_pitch:new i.bp(t,r.u_pitch),u_rotate_symbol:new i.b_(t,r.u_rotate_symbol),u_aspect_ratio:new i.bp(t,r.u_aspect_ratio),u_fade_change:new i.bp(t,r.u_fade_change),u_label_plane_matrix:new i.c0(t,r.u_label_plane_matrix),u_coord_matrix:new i.c0(t,r.u_coord_matrix),u_is_text:new i.b_(t,r.u_is_text),u_pitch_with_map:new i.b_(t,r.u_pitch_with_map),u_is_along_line:new i.b_(t,r.u_is_along_line),u_is_variable_anchor:new i.b_(t,r.u_is_variable_anchor),u_texsize:new i.c3(t,r.u_texsize),u_texsize_icon:new i.c3(t,r.u_texsize_icon),u_texture:new i.b_(t,r.u_texture),u_texture_icon:new i.b_(t,r.u_texture_icon),u_gamma_scale:new i.bp(t,r.u_gamma_scale),u_device_pixel_ratio:new i.bp(t,r.u_device_pixel_ratio),u_is_halo:new i.b_(t,r.u_is_halo),u_translation:new i.c3(t,r.u_translation),u_pitched_scale:new i.bp(t,r.u_pitched_scale)}),background:(t,r)=>({u_opacity:new i.bp(t,r.u_opacity),u_color:new i.b$(t,r.u_color)}),backgroundPattern:(t,r)=>({u_opacity:new i.bp(t,r.u_opacity),u_image:new i.b_(t,r.u_image),u_pattern_tl_a:new i.c3(t,r.u_pattern_tl_a),u_pattern_br_a:new i.c3(t,r.u_pattern_br_a),u_pattern_tl_b:new i.c3(t,r.u_pattern_tl_b),u_pattern_br_b:new i.c3(t,r.u_pattern_br_b),u_texsize:new i.c3(t,r.u_texsize),u_mix:new i.bp(t,r.u_mix),u_pattern_size_a:new i.c3(t,r.u_pattern_size_a),u_pattern_size_b:new i.c3(t,r.u_pattern_size_b),u_scale_a:new i.bp(t,r.u_scale_a),u_scale_b:new i.bp(t,r.u_scale_b),u_pixel_coord_upper:new i.c3(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new i.c3(t,r.u_pixel_coord_lower),u_tile_units_to_pixels:new i.bp(t,r.u_tile_units_to_pixels)}),terrain:(t,r)=>({u_texture:new i.b_(t,r.u_texture),u_ele_delta:new i.bp(t,r.u_ele_delta),u_fog_matrix:new i.c0(t,r.u_fog_matrix),u_fog_color:new i.b$(t,r.u_fog_color),u_fog_ground_blend:new i.bp(t,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new i.bp(t,r.u_fog_ground_blend_opacity),u_horizon_color:new i.b$(t,r.u_horizon_color),u_horizon_fog_blend:new i.bp(t,r.u_horizon_fog_blend),u_is_globe_mode:new i.bp(t,r.u_is_globe_mode)}),terrainDepth:(t,r)=>({u_ele_delta:new i.bp(t,r.u_ele_delta)}),terrainCoords:(t,r)=>({u_texture:new i.b_(t,r.u_texture),u_terrain_coords_id:new i.bp(t,r.u_terrain_coords_id),u_ele_delta:new i.bp(t,r.u_ele_delta)}),projectionErrorMeasurement:(t,r)=>({u_input:new i.bp(t,r.u_input),u_output_expected:new i.bp(t,r.u_output_expected)}),atmosphere:(t,r)=>({u_sun_pos:new i.c2(t,r.u_sun_pos),u_atmosphere_blend:new i.bp(t,r.u_atmosphere_blend),u_globe_position:new i.c2(t,r.u_globe_position),u_globe_radius:new i.bp(t,r.u_globe_radius),u_inv_proj_matrix:new i.c0(t,r.u_inv_proj_matrix)}),sky:(t,r)=>({u_sky_color:new i.b$(t,r.u_sky_color),u_horizon_color:new i.b$(t,r.u_horizon_color),u_horizon:new i.c3(t,r.u_horizon),u_horizon_normal:new i.c3(t,r.u_horizon_normal),u_sky_horizon_blend:new i.bp(t,r.u_sky_horizon_blend),u_sky_blend:new i.bp(t,r.u_sky_blend)})};class ik{constructor(t,i,r){this.context=t;const a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||i.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let i=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let iR={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class iL{constructor(t,i,r,a){this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=a,this.context=t;const n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||i.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,t.arrayBuffer)}
51enableAttributes(t,i){for(let r of this.attributes){let a=i.attributes[r.name];void 0!==a&&t.enableVertexAttribArray(a)}}setVertexAttribPointers(t,i,r){for(let a of this.attributes){let n=i.attributes[a.name];void 0!==n&&t.vertexAttribPointer(n,a.components,t[iR[a.type]],!1,this.itemSize,a.offset+this.itemSize*(r||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class iF{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class iB extends iF{getDefault(){return i.bo.transparent}set(t){let i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class iO extends iF{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class iV extends iF{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class ij extends iF{getDefault(){return[!0,!0,!0,!0]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class iN extends iF{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class iU extends iF{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class iG extends iF{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let i=this.current;(t.func!==i.func||t.ref!==i.ref||t.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class i$ extends iF{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class iZ extends iF{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=t,this.dirty=!1}}class iq extends iF{getDefault(){return[0,1]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class iW extends iF{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=t,this.dirty=!1}}class iH extends iF{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class iX extends iF{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.BLEND):i.disable(i.BLEND),this.current=t,this.dirty=!1}}class iY extends iF{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class iK extends iF{getDefault(){return i.bo.transparent}set(t){let i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class iJ extends iF{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class iQ extends iF{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;t?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=t,this.dirty=!1}}class i0 extends iF{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class i1 extends iF{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class i2 extends iF{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class i3 extends iF{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class i5 extends iF{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class i6 extends iF{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class i4 extends iF{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class i8 extends iF{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindTexture(i.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class i7 extends iF{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class i9 extends iF{getDefault(){return null}set(t){let i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class re extends iF{getDefault(){return null}set(t){var i;if(t===this.current&&!this.dirty)return;let r=this.gl;tE(r)?r.bindVertexArray(t):null==(i=r.getExtension("OES_vertex_array_object"))||i.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class rt extends iF{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class ri extends iF{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class rr extends iF{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class ra extends iF{constructor(t,i){super(t),this.context=t,this.parent=i}getDefault(){return null}}class rn extends ra{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class rs extends ra{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class ro extends ra{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,t),this.current=t,this.dirty=!1}}let rl="Framebuffer is not complete";class rh{constructor(t,i,r,a,n){this.context=t,this.width=i,this.height=r;const s=t.gl,o=this.framebuffer=s.createFramebuffer();
51if(this.colorAttachment=new rn(t,o),a)this.depthAttachment=n?new ro(t,o):new rs(t,o);else if(n)throw Error("Stencil cannot be set without depth");if(s.checkFramebufferStatus(s.FRAMEBUFFER)!==s.FRAMEBUFFER_COMPLETE)throw Error(rl)}destroy(){let t=this.context.gl,i=this.colorAttachment.get();if(i&&t.deleteTexture(i),this.depthAttachment){let i=this.depthAttachment.get();i&&t.deleteRenderbuffer(i)}t.deleteFramebuffer(this.framebuffer)}}class ru{constructor(t){var i,r;if(this.gl=t,this.clearColor=new iB(this),this.clearDepth=new iO(this),this.clearStencil=new iV(this),this.colorMask=new ij(this),this.depthMask=new iN(this),this.stencilMask=new iU(this),this.stencilFunc=new iG(this),this.stencilOp=new i$(this),this.stencilTest=new iZ(this),this.depthRange=new iq(this),this.depthTest=new iW(this),this.depthFunc=new iH(this),this.blend=new iX(this),this.blendFunc=new iY(this),this.blendColor=new iK(this),this.blendEquation=new iJ(this),this.cullFace=new iQ(this),this.cullFaceSide=new i0(this),this.frontFace=new i1(this),this.program=new i2(this),this.activeTexture=new i3(this),this.viewport=new i5(this),this.bindFramebuffer=new i6(this),this.bindRenderbuffer=new i4(this),this.bindTexture=new i8(this),this.bindVertexBuffer=new i7(this),this.bindElementBuffer=new i9(this),this.bindVertexArray=new re(this),this.pixelStoreUnpack=new rt(this),this.pixelStoreUnpackPremultiplyAlpha=new ri(this),this.pixelStoreUnpackFlipY=new rr(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),tE(t)){this.HALF_FLOAT=t.HALF_FLOAT;const a=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!=(i=t.RGBA16F)?i:null==a?void 0:a.RGBA16F_EXT,this.RGB16F=null!=(r=t.RGB16F)?r:null==a?void 0:a.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const i=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==i?void 0:i.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,i){return new ik(this,t,i)}createVertexBuffer(t,i,r){return new iL(this,t,i,r)}createRenderbuffer(t,i,r){let a=this.gl,n=a.createRenderbuffer();return this.bindRenderbuffer.set(n),a.renderbufferStorage(a.RENDERBUFFER,t,i,r),this.bindRenderbuffer.set(null),n}createFramebuffer(t,i,r,a){return new rh(this,t,i,r,a)}clear({color:t,depth:i,stencil:r}){let a=this.gl,n=0;t&&(n|=a.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==i&&(n|=a.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(n|=a.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),a.clear(n)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){i.bQ(t.blendFunction,tS.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return tE(this.gl)?this.gl.createVertexArray():null==(t=this.gl.getExtension("OES_vertex_array_object"))?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var i;tE(this.gl)?this.gl.deleteVertexArray(t):null==(i=this.gl.getExtension("OES_vertex_array_object"))||i.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}function rc(t,r,a,n,s){var o,l;let u=t.context,c=t.transform,d=u.gl,p=t.useProgram("collisionBox"),f=[],m=0,_=0;for(let i of n){let n=r.getTile(i).getBucket(a);if(!n)continue;let l=s?n.textCollisionBox:n.iconCollisionBox,h=n.collisionCircleArray;h.length>0&&(f.push({circleArray:h,circleOffset:_,coord:i}),m+=h.length/4,_=m),l&&p.draw(u,d.LINES,tM.disabled,tI.disabled,t.colorModeForRenderPass(),tP.disabled,ih(t.transform),null==(o=t.style.map.terrain)?void 0:o.getTerrainData(i),c.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),a.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,null,t.transform.zoom,null,null,l.collisionVertexBuffer)}if(!s||!f.length)return;let g=t.useProgram("collisionCircle"),y=new i.ca;y.resize(4*m),y._trim();let x=0;for(let t of f)for(let i=0;i<t.circleArray.length/4;i++){let r=4*i,a=t.circleArray[r+0],n=t.circleArray[r+1],s=t.circleArray[r+2],o=t.circleArray[r+3];y.emplace(x++,a,n,s,o,0),y.emplace(x++,a,n,s,o,1),y.emplace(x++,a,n,s,o,2),y.emplace(x++,a,n,s,o,3)}(!h||h.length<2*m)&&(h=function(t){let r=2*t,a=new i.cc;a.resize(r),a._trim();for(let t=0;t<r;t++){let i=6*t;a.uint16[i+0]=4*t+0,a.uint16[i+1]=4*t+1,a.uint16[i+2]=4*t+2,a.uint16[i+3]=4*t+2,a.uint16[i+4]=4*t+3,a.uint16[i+5]=4*t+0}return a}(m));let v=u.createIndexBuffer(h,!0),b=u.createVertexBuffer(y,i.cb.members,!0);for(let r of f){let n=iu(t.transform);g.draw(u,d.TRIANGLES,tM.disabled,tI.disabled,t.colorModeForRenderPass(),tP.disabled,n,null==(l=t.style.map.terrain)?void 0:l.getTerrainData(r.coord),null,a.id,b,v,i.aV.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,t.transform.zoom,null,null,null)}b.destroy(),v.destroy()}let rd=i.ap(new Float32Array(16));function rp(t,r,a,n,s,o,l,h,u,c,d,p,f){var m,_;let g=t.context,y=g.gl,x=t.transform,v="map"===h,b="map"===u,w="viewport"!==h&&"point"!==a.layout.get("symbol-placement"),T=v&&!b&&!w,S=!a.layout.get("symbol-sort-key").isConstant(),P=!1,M=t.getDepthModeForSublayer(0,tM.ReadOnly),I=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],C=x.getCircleRadiusCorrection();for(let h of n){let n=r.getTile(h),u=n.getBucket(a);if(!u)continue;let d=s?u.text:u.icon;if(!(null==d?void 0:d.segments.get().length)||!d.hasVisibleVertices)continue;let p=d.programConfigurations.get(a.id),_=s||u.sdfIcons,g=s?u.textSizeData:u.iconSizeData,M=b||0!==x.pitch,A=t.useProgram(u.iconsInText&&s?"symbolTextAndIcon":_?"symbolSDF":"symbolIcon",p),D=i.aw(g,x.zoom),z=null==(m=t.style.map.terrain)?void 0:m.getTerrainData(h),k,R,L,F,B=[0,0],O=null;if(s)R=n.glyphAtlasTexture,L=y.LINEAR,k=n.glyphAtlasTexture.size,u.iconsInText&&(B=n.imageAtlasTexture.size,O=n.imageAtlasTexture,F=M||t.options.rotating||t.options.zooming||"composite"===g.kind||"camera"===g.kind?y.LINEAR:y.NEAREST);else{let i=1!==a.layout.get("icon-size").constantOr(0)||u.iconsNeedLinear;R=n.imageAtlasTexture,L=_||t.options.rotating||t.options.zooming||i||M?y.LINEAR:y.NEAREST,k=n.imageAtlasTexture.size}let V=i.aK(n,1,t.transform.zoom),j=eR(v,t.transform,V),N=function(t,r,a,n){if(t){let t=i.O();if(!r){let{vecSouth:i,vecEast:r}=eL(a);t[0]=r[0],t[1]=r[1],t[4]=i[0],t[5]=i[1]}return i.S(t,t,[n,n,1]),t}
51return a.pixelsToClipSpaceMatrix}(b,v,t.transform,V),U=i.aL(x,n,o,l),G=x.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!f,applyTerrainMatrix:!0}),$=I&&u.hasTextData(),Z="none"!==a.layout.get("icon-text-fit")&&$&&u.hasIconData();if(w){let r=i.O();!function(t,i){let r=1/(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]),a=1/(i[8]*i[8]+i[9]*i[9]+i[10]*i[10]),n=i[0]*r,s=i[4]*r,o=i[8]*a,l=i[1]*r,h=i[5]*r,u=i[9]*a,c=i[2]*r,d=i[6]*r,p=i[10]*a;t[0]=n,t[1]=s,t[2]=o,t[4]=l,t[5]=h,t[6]=u,t[8]=c,t[9]=d,t[10]=p;let f=i[12],m=i[13],_=i[14];t[12]=-n*f-l*m-c*_,t[13]=-s*f-h*m-d*_,t[14]=-o*f-u*m-p*_,t[3]=0,t[7]=0,t[11]=0,t[15]=1}(r,j);let n=t.style.map.terrain?(i,r)=>t.style.map.terrain.getElevation(h,i,r):null;!function(t,r,a,n,s,o,l,h,u,c,d,p,f){let m=a?t.textSizeData:t.iconSizeData,_=i.aw(m,r.transform.zoom),g=[256/r.width*2+1,256/r.height*2+1],y=a?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;y.clear();let x=t.lineVertexArray,v=a?t.text.placedSymbolArray:t.icon.placedSymbolArray,b=r.transform.width/r.transform.height,w=!1;for(let a=0;a<v.length;a++){var T;let S=v.get(a);if(S.hidden||S.writingMode===i.ax.vertical&&!w){eH(S.numGlyphs,y);continue}w=!1;let P=new i.P(S.anchorX,S.anchorY),M={getElevation:f,pitchedLabelPlaneMatrix:n,lineVertexArray:x,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:r.transform,tileAnchorPoint:P,unwrappedTileID:u,width:c,height:d,translation:p},I=e$(S.anchorX,S.anchorY,M);if(T=I.point,!(T.x>=-g[0]&&T.x<=g[0]&&T.y>=-g[1])||!(T.y<=g[1])){eH(S.numGlyphs,y);continue}let E=.5+r.transform.cameraToCenterDistance/I.signedDistanceFromCamera*.5,C=i.ay(m,_,S),A=o?C*r.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,u)/E:C*E,D=eV({projectionContext:M,pitchedLabelPlaneMatrixInverse:s,symbol:S,fontSize:A,flip:!1,keepUpright:l,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:h});w=D.useVertical,(D.notEnoughRoom||w||D.needsFlipping&&eV({projectionContext:M,pitchedLabelPlaneMatrixInverse:s,symbol:S,fontSize:A,flip:!0,keepUpright:l,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:b,rotateToLine:h}).notEnoughRoom)&&eH(S.numGlyphs,y)}a?t.text.dynamicLayoutVertexBuffer.updateData(y):t.icon.dynamicLayoutVertexBuffer.updateData(y)}(u,t,s,j,r,b,c,"map"===a.layout.get("text-rotation-alignment"),h.toUnwrapped(),x.width,x.height,U,n)}let q=s&&I||Z,W=w||q?rd:b?j:t.transform.clipSpaceToPixelsMatrix,H=_&&0!==a.paint.get(s?"text-halo-width":"icon-halo-width").constantOr(1),X={program:A,buffers:d,uniformValues:_?u.iconsInText?iE(g.kind,D,T,b,w,q,t,W,N,U,k,B,C):iI(g.kind,D,T,b,w,q,t,W,N,U,s,k,H,C):iM(g.kind,D,T,b,w,q,t,W,N,U,s,k,C),projectionData:G,atlasTexture:R,atlasTextureIcon:O,atlasInterpolation:L,atlasInterpolationIcon:F,isSDF:_,hasHalo:H};if(S&&u.canOverlap)for(let t of(P=!0,d.segments.get()))E.push({segments:new i.aV([t]),sortKey:t.sortKey,state:X,terrainData:z});else E.push({segments:d.segments,sortKey:0,state:X,terrainData:z})}P&&E.sort((t,i)=>t.sortKey-i.sortKey);let A=null!=(_=a.paint.get(s?"text-halo-width":"icon-halo-width").constantOr(null))?_:1/0,D=a.layout.get("text-letter-spacing").constantOr(0)*i.aJ<0||A>1;for(let i of E){let r=i.state;g.activeTexture.set(y.TEXTURE0),r.atlasTexture.bind(r.atlasInterpolation,y.CLAMP_TO_EDGE),r.atlasTextureIcon&&(g.activeTexture.set(y.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,y.CLAMP_TO_EDGE));let n=r.isSDF&&r.hasHalo;if(n){let n=r.uniformValues;n.u_is_halo=1,D&&(n.u_is_plain=0,rf(r.buffers,i.segments,a,t,r.program,M,d,p,n,r.projectionData,i.terrainData),n.u_is_halo=0,n.u_is_plain=1)}rf(r.buffers,i.segments,a,t,r.program,M,d,p,r.uniformValues,r.projectionData,i.terrainData),n&&!D&&(r.uniformValues.u_is_halo=0)}}function rf(t,i,r,a,n,s,o,l,h,u,c){let d=a.context;n.draw(d,d.gl.TRIANGLES,s,o,l,tP.backCCW,h,c,u,r.id,t.layoutVertexBuffer,t.indexBuffer,i,r.paint,a.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function rm(t,i,r){var a,n;let s=t.gl,o=s.createTexture();s.bindTexture(s.TEXTURE_2D,o),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR);let l=null!=(a=t.HALF_FLOAT)?a:s.UNSIGNED_BYTE,h=null!=(n=t.RGBA16F)?n:s.RGBA;s.texImage2D(s.TEXTURE_2D,0,h,i,r,0,s.RGBA,l,null);let u=t.createFramebuffer(i,r,!1,!1);return u.colorAttachment.set(o),u}function r_(t,r){return r.colorRampTexture||(r.colorRampTexture=new i.T(t,r.colorRamp,t.gl.RGBA)),r.colorRampTexture}function rg(t,r,a,n,s,o,l,h){let u=256;if(s.stepInterpolant){let n=r.getSource().maxzoom,s=l.canonical.z===n?Math.ceil(1<<t.transform.maxZoom-l.canonical.z):1;u=i.al(i.ce(o.maxLineLength/i.a6*1024*s),256,a.maxTextureSize)}return h.gradient=i.cf({expression:s.gradientExpression(),evaluationKey:"lineProgress",resolution:u,image:h.gradient||void 0,clips:o.lineClipsArray}),h.texture?h.texture.update(h.gradient):h.texture=new i.T(a,h.gradient,n.RGBA),h.version=s.gradientVersion,h.texture}function ry(t,i,r,a,n){if(!r||!(null==a?void 0:a.imageAtlas))return;let s=a.imageAtlas.patternPositions,o=s[r.to.toString()],l=s[r.from.toString()];if(!o&&l&&(o=l),!l&&o&&(l=o),!o||!l){let t=n.getPaintProperty(i);o=s[t],l=s[t]}o&&l&&t.setConstantPatternPositions(o,l)}function rx(t,r,a,n,s,o,l,h){var u;
51let c,d,p,f,m,_=t.context.gl,g="fill-pattern",y=a.paint.get(g),x=null==y?void 0:y.constantOr(1),v=a.getCrossfadeParameters(),b=t.transform,w=a.paint.get("fill-translate"),T=a.paint.get("fill-translate-anchor");l?(d=x&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",c=_.LINES):(d=x?"fillPattern":"fill",c=_.TRIANGLES);let S=y.constantOr(null);for(let y of n){let n=r.getTile(y);if(x&&!n.patternsLoaded())continue;let P=n.getBucket(a);if(!P)continue;let M=P.programConfigurations.get(a.id),I=t.useProgram(d,M),E=null==(u=t.style.map.terrain)?void 0:u.getTerrainData(y);x&&(t.context.activeTexture.set(_.TEXTURE0),n.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),M.updatePaintBuffers(v)),ry(M,g,S,n,a);let C=b.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!h,applyTerrainMatrix:!0}),A=i.aL(b,n,w,T);if(l){f=P.indexBuffer2,m=P.segments2;let i=[_.drawingBufferWidth,_.drawingBufferHeight];p="fillOutlinePattern"===d&&x?io(t,v,n,i,A):is(i,A)}else f=P.indexBuffer,m=P.segments,p=x?ia(t,v,n,A):{u_fill_translate:A};let D=t.stencilModeForClipping(y);I.draw(t.context,c,s,D,o,tP.backCCW,p,E,C,a.id,P.layoutVertexBuffer,f,m,a.paint,t.transform.zoom,M)}}function rv(t,r,a,n,s,o,l,h){var u;let c=t.context,d=c.gl,p="fill-extrusion-pattern",f=a.paint.get(p),m=f.constantOr(1),_=a.getCrossfadeParameters(),g=a.paint.get("fill-extrusion-opacity"),y=f.constantOr(null),x=t.transform;for(let f of n){let n=r.getTile(f),v=n.getBucket(a);if(!v)continue;let b=null==(u=t.style.map.terrain)?void 0:u.getTerrainData(f),w=v.programConfigurations.get(a.id),T=t.useProgram(m?"fillExtrusionPattern":"fillExtrusion",w);m&&(t.context.activeTexture.set(d.TEXTURE0),n.imageAtlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),w.updatePaintBuffers(_));let S=x.getProjectionData({overscaledTileID:f,applyGlobeMatrix:!h,applyTerrainMatrix:!0});ry(w,p,y,n,a);let P=i.aL(x,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),M=a.paint.get("fill-extrusion-vertical-gradient"),I=m?ir(t,M,g,P,f,_,n):ii(t,M,g,P);T.draw(c,c.gl.TRIANGLES,s,o,l,tP.backCCW,I,b,S,a.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,a.paint,t.transform.zoom,w,t.style.map.terrain&&v.centroidVertexBuffer)}}function rb(t,i,r,a,n,s,o,l,h){var u;let c=t.style.projection,d=t.context,p=t.transform,f=d.gl,m=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],_=t.useProgram("hillshade",null,!1,m),g=!t.options.moving;for(let m of a){let a=i.getTile(m),y=a.fbo;if(!y)continue;let x=c.getMeshFromTileID(d,m.canonical,l,!0,"raster"),v=null==(u=t.style.map.terrain)?void 0:u.getTerrainData(m);d.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,y.colorAttachment.get());let b=p.getProjectionData({overscaledTileID:m,aligned:g,applyGlobeMatrix:!h,applyTerrainMatrix:!0});_.draw(d,f.TRIANGLES,s,n[m.overscaledZ],o,tP.backCCW,im(t,a,r),v,b,r.id,x.vertexBuffer,x.indexBuffer,x.segments)}}let rw=0;function rT(t,r,a,n,s,o,l,h,u){var c;let d=t.style.projection,p=t.context,f=t.transform,m=p.gl,_=t.useProgram("colorRelief"),g=!t.options.moving,y="nearest"===a.paint.get("resampling")?m.NEAREST:m.LINEAR,x=!0,v=0;for(let b of n){let n=r.getTile(b),w=n.dem;if(x){rw||(rw=m.getParameter(m.MAX_TEXTURE_SIZE));let t=rw,{elevationTexture:i,colorTexture:r}=a.getColorRampTextures(p,t,w.getUnpackVector());p.activeTexture.set(m.TEXTURE1),i.bind(m.NEAREST,m.CLAMP_TO_EDGE),p.activeTexture.set(m.TEXTURE4),r.bind(m.LINEAR,m.CLAMP_TO_EDGE),x=!1,v=i.size[0]}if(!(null==w?void 0:w.data))continue;let T=w.stride,S=w.getPixels();if(p.activeTexture.set(m.TEXTURE0),p.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture||(n.demTexture=t.getTileTexture(T)),n.demTexture){let t=n.demTexture;t.update(S,{premultiply:!1}),t.bind(y,m.CLAMP_TO_EDGE)}else n.demTexture=new i.T(p,S,m.RGBA,{premultiply:!1}),n.demTexture.bind(y,m.CLAMP_TO_EDGE);let P=d.getMeshFromTileID(p,b.canonical,h,!0,"raster"),M=null==(c=t.style.map.terrain)?void 0:c.getTerrainData(b),I=f.getProjectionData({overscaledTileID:b,aligned:g,applyGlobeMatrix:!u,applyTerrainMatrix:!0});_.draw(p,m.TRIANGLES,o,s[b.overscaledZ],l,tP.backCCW,ig(a,n.dem,v),M,I,a.id,P.vertexBuffer,P.indexBuffer,P.segments)}}let rS=[new i.P(0,0),new i.P(i.a6,0),new i.P(i.a6,i.a6),new i.P(0,i.a6)];
51function rP(t,r,a,n,s,o,l,h,u=!1,c=!1){var d;let p=n[n.length-1].overscaledZ,f=t.context,m=f.gl,g=t.useProgram("raster"),y=t.transform,x=t.style.projection,v=t.colorModeForRenderPass(),w=!t.options.moving,T=a.paint.get("raster-opacity"),S="nearest"===a.paint.get("resampling")||"nearest"===a.paint.get("raster-resampling")?m.NEAREST:m.LINEAR,P=a.paint.get("raster-fade-duration"),M=!!t.style.map.terrain;for(let I of n){let n=t.getDepthModeForSublayer(I.overscaledZ-p,1===T?tM.ReadWrite:tM.ReadOnly,m.LESS),E=r.getTile(I);f.activeTexture.set(m.TEXTURE0),E.texture.bind(S,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),f.activeTexture.set(m.TEXTURE1);let{parentTile:C,parentScaleBy:A,parentTopLeft:D,fadeValues:z}=function(t,r,a,n){let s={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===a||n)return s;if(t.fadingParentID){let n,o,l,h,u,c,d=r.getLoadedTile(t.fadingParentID);if(!d)return s;let p=Math.pow(2,d.tileID.overscaledZ-t.tileID.overscaledZ),f=[t.tileID.canonical.x*p%1,t.tileID.canonical.y*p%1],m=(o=((n=b())-d.timeAdded)/a,l=t.fadingDirection===_.Incoming,h=i.al((n-t.timeAdded)/a,0,1),u=i.al(1-o,0,1),{tileOpacity:c=l?h:u,parentTileOpacity:l?u:h,fadeMix:{opacity:1,mix:1-c}});return{parentTile:d,parentScaleBy:p,parentTopLeft:f,fadeValues:m}}if(t.selfFading){let r,n;return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:(r=(b()-t.timeAdded)/a,{tileOpacity:n=i.al(r,0,1),fadeMix:{opacity:n,mix:0}})}}return s}(E,r,P,M);E.fadeOpacity=z.tileOpacity,C?(C.fadeOpacity=z.parentTileOpacity,C.texture.bind(S,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)):E.texture.bind(S,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST),E.texture.useMipmap&&f.extTextureFilterAnisotropic&&t.transform.pitch>t.options.anisotropicFilterPitch&&m.texParameterf(m.TEXTURE_2D,f.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,f.extTextureFilterAnisotropicMax);let k=null==(d=t.style.map.terrain)?void 0:d.getTerrainData(I),R=y.getProjectionData({overscaledTileID:I,aligned:w,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),L=iP(D,A,z.fadeMix,a,h),F=x.getMeshFromTileID(f,I.canonical,o,l,"raster");g.draw(f,m.TRIANGLES,n,s?s[I.overscaledZ]:tI.disabled,v,u?tP.frontCCW:tP.backCCW,L,k,R,a.id,F.vertexBuffer,F.indexBuffer,F.segments)}}let rM=new i.bo(1,0,0,1),rI=new i.bo(0,1,0,1),rE=new i.bo(0,0,1,1),rC=new i.bo(1,0,1,1),rA=new i.bo(0,1,1,1);function rD(t,i,r,a){rk(t,0,i+r/2,t.transform.width,r,a)}function rz(t,i,r,a){rk(t,i-r/2,0,r,t.transform.height,a)}function rk(t,i,r,a,n,s){let o=t.context,l=o.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*t.pixelRatio,r*t.pixelRatio,a*t.pixelRatio,n*t.pixelRatio),o.clear({color:s}),l.disable(l.SCISSOR_TEST)}function rR(t,i,r,a){let{isRenderingGlobe:n}=a,s=t.context,o=s.gl,l=t.transform,h=t.colorModeForRenderPass(),u=t.getDepthModeFor3D(),c=t.useProgram("terrain");for(let a of(s.bindFramebuffer.set(null),s.viewport.set([0,0,t.width,t.height]),r)){let r=i.getTerrainMesh(a.tileID),d=t.renderToTexture.getTexture(a),p=i.getTerrainData(a.tileID);s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,d.texture);let f=t8(i.getMeshFrameDelta(l.zoom),l.calculateFogMatrix(a.tileID.toUnwrapped()),t.style.sky,l.pitch,n),m=l.getProjectionData({overscaledTileID:a.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(s,o.TRIANGLES,u,tI.disabled,h,tP.backCCW,f,p,m,"terrain",r.vertexBuffer,r.indexBuffer,r.segments)}}function rL(t,r){if(!r.mesh){let a=new i.aU;a.emplaceBack(-1,-1),a.emplaceBack(1,-1),a.emplaceBack(1,1),a.emplaceBack(-1,1);let n=new i.aW;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),r.mesh=new to(t.createVertexBuffer(a,tl.members),t.createIndexBuffer(n),i.aV.simpleSegment(0,0,a.length,n.length))}return r.mesh}let rF={symbol:function(t,r,a,n,s,o){if("translucent"!==t.renderPass)return;let{isRenderingToTexture:l}=o,h=tI.disabled,u=t.colorModeForRenderPass();(a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,r,a,n,s,o,l,h,u){var c;let d=r.transform,p=r.style.map.terrain,f="map"===s,m="map"===o;for(let s of t){let t=n.getTile(s),o=t.getBucket(a);if(!(null==(c=null==o?void 0:o.text)?void 0:c.segments.get().length))continue;let _=i.aw(o.textSizeData,d.zoom),g=i.aK(t,1,r.transform.zoom),y=eR(f,r.transform,g),x="none"!==a.layout.get("icon-text-fit")&&o.hasIconData();
51if(_){let r=Math.pow(2,d.zoom-t.tileID.overscaledZ),a=p?(t,i)=>p.getElevation(s,t,i):null;!function(t,r,a,n,s,o,l,h,u,c,d,p){let f=t.text.placedSymbolArray,m=t.text.dynamicLayoutVertexArray,_=t.icon.dynamicLayoutVertexArray,g={};m.clear();for(let _=0;_<f.length;_++){let y=f.get(_),x=y.hidden||!y.crossTileID||t.allowVerticalPlacement&&!y.placedOrientation?null:n[y.crossTileID];if(x){let n=new i.P(y.anchorX,y.anchorY),f={getElevation:p,width:s.width,height:s.height,pitchedLabelPlaneMatrix:o,pitchWithMap:a,transform:s,tileAnchorPoint:n,translation:c,unwrappedTileID:d},_=a?e$(n.x,n.y,f):eU(n.x,n.y,f),v=.5+s.cameraToCenterDistance/_.signedDistanceFromCamera*.5,b=i.ay(t.textSizeData,h,y)*v/i.aJ;a&&(b*=t.tilePixelRatio/l);let{width:w,height:T,anchor:S,textOffset:P,textBoxScale:M}=x,I=function(t,r,a,n,s,o){let{horizontalAlign:l,verticalAlign:h}=i.aP(t);return new i.P((-(l-.5)*r/s+n[0])*o,(-(h-.5)*a/s+n[1])*o)}(S,w,T,P,M,b),E=s.getPitchedTextCorrection(n.x+c[0],n.y+c[1],d),C=function(t,r,a,n,s,o){let l=r.tileAnchorPoint.add(new i.P(r.translation[0],r.translation[1]));if(r.pitchWithMap){let t=n.mult(o);a||(t=t.rotate(-s));let i=l.add(t);return eF(i.x,i.y,r.pitchedLabelPlaneMatrix,r.getElevation).point}if(a){let i=eU(r.tileAnchorPoint.x+1,r.tileAnchorPoint.y,r).point.sub(t),a=Math.atan(i.y/i.x)+(i.x<0?Math.PI:0);return t.add(n.rotate(a))}return t.add(n)}(_.point,f,r,I,-s.bearingInRadians,E),A=t.allowVerticalPlacement&&y.placedOrientation===i.ax.vertical?Math.PI/2:0;for(let t=0;t<y.numGlyphs;t++)i.aD(m,C,A);u&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:C,angle:A})}else eH(y.numGlyphs,m)}if(u){_.clear();let r=t.icon.placedSymbolArray;for(let t=0;t<r.length;t++){let a=r.get(t);if(a.hidden)eH(a.numGlyphs,_);else{let r=g[t];if(r)for(let t=0;t<a.numGlyphs;t++)i.aD(_,r.shiftedAnchor,r.angle);else eH(a.numGlyphs,_)}}t.icon.dynamicLayoutVertexBuffer.updateData(_)}t.text.dynamicLayoutVertexBuffer.updateData(m)}(o,f,m,u,d,y,r,_,x,i.aL(d,t,l,h),s.toUnwrapped(),a)}}}(n,t,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),s),0!==a.paint.get("icon-opacity").constantOr(1)&&rp(t,r,a,n,!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"),h,u,l),0!==a.paint.get("text-opacity").constantOr(1)&&rp(t,r,a,n,!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"),h,u,l),r.map.showCollisionBoxes&&(rc(t,r,a,n,!0),rc(t,r,a,n,!1))},circle:function(t,r,a,n,s){var o;if("translucent"!==t.renderPass)return;let{isRenderingToTexture:l}=s,h=a.paint.get("circle-opacity"),u=a.paint.get("circle-stroke-width"),c=a.paint.get("circle-stroke-opacity"),d=!a.layout.get("circle-sort-key").isConstant();if(0===h.constantOr(1)&&(0===u.constantOr(1)||0===c.constantOr(1)))return;let p=t.context,f=p.gl,m=t.transform,_=t.getDepthModeForSublayer(0,tM.ReadOnly),g=tI.disabled,y=t.colorModeForRenderPass(),x=[],v=m.getCircleRadiusCorrection();for(let s of n){let n=r.getTile(s),h=n.getBucket(a);if(!h)continue;let u=a.paint.get("circle-translate"),c=a.paint.get("circle-translate-anchor"),p=i.aL(m,n,u,c),f=h.programConfigurations.get(a.id),_=t.useProgram("circle",f),g=h.layoutVertexBuffer,y=h.indexBuffer,b=null==(o=t.style.map.terrain)?void 0:o.getTerrainData(s),w={programConfiguration:f,program:_,layoutVertexBuffer:g,indexBuffer:y,uniformValues:il(t,n,a,p,v),terrainData:b,projectionData:m.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!l,applyTerrainMatrix:!0})};if(d)for(let t of h.segments.get())x.push({segments:new i.aV([t]),sortKey:t.sortKey,state:w});else x.push({segments:h.segments,sortKey:0,state:w})}for(let i of(d&&x.sort((t,i)=>t.sortKey-i.sortKey),x)){let{programConfiguration:r,program:n,layoutVertexBuffer:s,indexBuffer:o,uniformValues:l,terrainData:h,projectionData:u}=i.state;n.draw(p,f.TRIANGLES,_,g,y,tP.backCCW,l,h,u,a.id,s,o,i.segments,a.paint,t.transform.zoom,r)}},heatmap:function(t,r,a,n,s){if(0===a.paint.get("heatmap-opacity"))return;let o=t.context,{isRenderingToTexture:l,isRenderingGlobe:h}=s;if(t.style.map.terrain){for(let s of n){let n=r.getTile(s);r.hasRenderableParent(s)||("offscreen"===t.renderPass?function(t,r,a,n,s){let o=t.context,l=o.gl,h=tI.disabled,u=new tS([l.ONE,l.ONE],i.bo.transparent,[!0,!0,!0,!0]),c=r.getBucket(a);if(!c)return;let d=n.key,p=a.heatmapFbos.get(d);p||(p=rm(o,r.tileSize,r.tileSize),a.heatmapFbos.set(d,p)),o.bindFramebuffer.set(p.framebuffer),o.viewport.set([0,0,r.tileSize,r.tileSize]),o.clear({color:i.bo.transparent});let f=c.programConfigurations.get(a.id),m=t.useProgram("heatmap",f,!s),_=t.transform.getProjectionData({overscaledTileID:r.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=t.style.map.terrain.getTerrainData(n);m.draw(o,l.TRIANGLES,tM.disabled,h,u,tP.disabled,id(r,t.transform.zoom,a.paint.get("heatmap-intensity"),1),g,_,a.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,a.paint,t.transform.zoom,f)}(t,n,a,s,h):"translucent"===t.renderPass&&function(t,i,r,a,n){let s=t.context,o=s.gl,l=t.transform;s.setColorMode(t.colorModeForRenderPass());let h=r_(s,i),u=r.key,c=i.heatmapFbos.get(u);if(!c)return;s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,c.colorAttachment.get()),s.activeTexture.set(o.TEXTURE1),h.bind(o.LINEAR,o.CLAMP_TO_EDGE);let d=l.getProjectionData({overscaledTileID:r,applyTerrainMatrix:n,applyGlobeMatrix:!a});t.useProgram("heatmapTexture").draw(s,o.TRIANGLES,tM.disabled,tI.disabled,t.colorModeForRenderPass(),tP.disabled,ip(t,i,0,1),null,d,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,i.paint,l.zoom),c.destroy(),i.heatmapFbos.delete(u)}(t,a,s,l,h))}o.viewport.set([0,0,t.width,t.height])}else{let s,o,l;"offscreen"===t.renderPass?function(t,r,a,n){let s,o,l=t.context,h=l.gl,u=t.transform,c=tI.disabled,d=new tS([h.ONE,h.ONE],i.bo.transparent,[!0,!0,!0,!0]);for(let p of(s=l.gl,l.activeTexture.set(s.TEXTURE1),l.viewport.set([0,0,t.width/4,t.height/4]),(o=a.heatmapFbos.get(i.cd))?(s.bindTexture(s.TEXTURE_2D,o.colorAttachment.get()),l.bindFramebuffer.set(o.framebuffer)):(o=rm(l,t.width/4,t.height/4),a.heatmapFbos.set(i.cd,o)),l.clear({color:i.bo.transparent}
51),n)){if(r.hasRenderableParent(p))continue;let i=r.getTile(p),n=i.getBucket(a);if(!n)continue;let s=n.programConfigurations.get(a.id),o=t.useProgram("heatmap",s),f=u.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),m=u.getCircleRadiusCorrection();o.draw(l,h.TRIANGLES,tM.disabled,c,d,tP.backCCW,id(i,u.zoom,a.paint.get("heatmap-intensity"),m),null,f,a.id,n.layoutVertexBuffer,n.indexBuffer,n.segments,a.paint,u.zoom,s)}l.viewport.set([0,0,t.width,t.height])}(t,r,a,n):"translucent"===t.renderPass&&(o=(s=t.context).gl,s.setColorMode(t.colorModeForRenderPass()),(l=a.heatmapFbos.get(i.cd))&&(s.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,l.colorAttachment.get()),s.activeTexture.set(o.TEXTURE1),r_(s,a).bind(o.LINEAR,o.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(s,o.TRIANGLES,tM.disabled,tI.disabled,t.colorModeForRenderPass(),tP.disabled,ip(t,a,0,1),null,null,a.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,a.paint,t.transform.zoom)))}},line:function(t,i,r,a,n){var s;let o;if("translucent"!==t.renderPass)return;let{isRenderingToTexture:l}=n,h=r.paint.get("line-opacity"),u=r.paint.get("line-width");if(0===h.constantOr(1)||0===u.constantOr(1))return;let c=t.getDepthModeForSublayer(0,tM.ReadOnly),d=t.colorModeForRenderPass(),p=r.paint.get("line-dasharray"),f=p.constantOr(1),m=r.paint.get("line-pattern"),_=m.constantOr(1),g=r.paint.get("line-gradient"),y=r.getCrossfadeParameters();o=_?"linePattern":f&&g?"lineGradientSDF":f?"lineSDF":g?"lineGradient":"line";let x=t.context,v=x.gl,b=t.transform,w=!0;for(let n of a){let a,h=i.getTile(n);if(_&&!h.patternsLoaded())continue;let u=h.getBucket(r);if(!u)continue;let T=u.programConfigurations.get(r.id),S=t.context.program.get(),P=t.useProgram(o,T),M=w||P.program!==S,I=null==(s=t.style.map.terrain)?void 0:s.getTerrainData(n),E=m.constantOr(null),C=null==p?void 0:p.constantOr(null);if(E&&h.imageAtlas){let t=h.imageAtlas,i=t.patternPositions[E.to.toString()],r=t.patternPositions[E.from.toString()];i&&r&&T.setConstantPatternPositions(i,r)}else if(C){let i="round"===r.layout.get("line-cap").constantOr(null),a=t.lineAtlas.getDash(C.to,i),n=t.lineAtlas.getDash(C.from,i);T.setConstantDashPositions(a,n)}let A=b.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),D=b.getPixelScale();_?(a=iv(t,h,r,D,y),x.activeTexture.set(v.TEXTURE0),h.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),T.updatePaintBuffers(y)):f&&g?(a=iw(t,h,r,D,y,u.lineClipsArray.length),function(t,i,r,a,n,s,o,l,h){let u=s.gradients[n.id],c=u.texture;n.gradientVersion!==u.version&&(c=rg(t,i,r,a,n,s,o,u)),r.activeTexture.set(a.TEXTURE0),c.bind(n.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE),r.activeTexture.set(a.TEXTURE1),t.lineAtlas.bind(r),l.updatePaintBuffers(h)}(t,i,x,v,r,u,n,T,y)):f?(a=ib(t,h,r,D,y),(M||t.lineAtlas.dirty)&&(x.activeTexture.set(v.TEXTURE0),t.lineAtlas.bind(x)),T.updatePaintBuffers(y)):g?(a=ix(t,h,r,D,u.lineClipsArray.length),function(t,i,r,a,n,s,o){let l=s.gradients[n.id],h=l.texture;n.gradientVersion!==l.version&&(h=rg(t,i,r,a,n,s,o,l)),r.activeTexture.set(a.TEXTURE0),h.bind(n.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE)}(t,i,x,v,r,u,n)):a=iy(t,h,r,D);let z=t.stencilModeForClipping(n);P.draw(x,v.TRIANGLES,c,z,d,tP.disabled,a,I,A,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,t.transform.zoom,T,u.layoutVertexBuffer2),w=!1}},fill:function(t,r,a,n,s){let o=a.paint.get("fill-color"),l=a.paint.get("fill-opacity");if(0===l.constantOr(1))return;let{isRenderingToTexture:h}=s,u=t.colorModeForRenderPass(),c=a.paint.get("fill-pattern"),d=t.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===o.constantOr(i.bo.transparent).a&&1===l.constantOr(0)?"opaque":"translucent";if(t.renderPass===d){let i=t.getDepthModeForSublayer(1,"opaque"===t.renderPass?tM.ReadWrite:tM.ReadOnly);rx(t,r,a,n,i,u,!1,h)}if("translucent"===t.renderPass&&a.paint.get("fill-antialias")){let i=t.getDepthModeForSublayer(2*!!a.getPaintProperty("fill-outline-color"),tM.ReadOnly);rx(t,r,a,n,i,u,!0,h)}},fillExtrusion:function(t,i,r,a,n){let s=r.paint.get("fill-extrusion-opacity");if(0===s)return;let{isRenderingToTexture:o}=n;
51if("translucent"===t.renderPass){let n=new tM(t.context.gl.LEQUAL,tM.ReadWrite,t.depthRangeFor3D);if(1!==s||r.paint.get("fill-extrusion-pattern").constantOr(1))rv(t,i,r,a,n,tI.disabled,tS.disabled,o),rv(t,i,r,a,n,t.stencilModeFor3D(),t.colorModeForRenderPass(),o);else{let s=t.colorModeForRenderPass();rv(t,i,r,a,n,tI.disabled,s,o)}}},hillshade:function(t,r,a,n,s){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;let{isRenderingToTexture:o}=s,l=t.context,h=t.style.projection.useSubdivision,u=t.getDepthModeForSublayer(0,tM.ReadOnly),c=t.colorModeForRenderPass();if("offscreen"===t.renderPass)!function(t,r,a,n,s,o,l){let h=t.context,u=h.gl,c="nearest"===n.paint.get("resampling")?u.NEAREST:u.LINEAR;for(let d of a){let a=r.getTile(d),p=a.dem;if(!(null==p?void 0:p.data)||!a.needsHillshadePrepare)continue;let f=p.dim,m=p.stride,_=p.getPixels();if(h.activeTexture.set(u.TEXTURE1),h.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture||(a.demTexture=t.getTileTexture(m)),a.demTexture){let t=a.demTexture;t.update(_,{premultiply:!1}),t.bind(u.NEAREST,u.CLAMP_TO_EDGE)}else a.demTexture=new i.T(h,_,u.RGBA,{premultiply:!1}),a.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);h.activeTexture.set(u.TEXTURE0);let g=a.fbo;if(!g){let t=new i.T(h,{width:f,height:f,data:null},u.RGBA);t.bind(c,u.CLAMP_TO_EDGE),(g=a.fbo=h.createFramebuffer(f,f,!0,!1)).colorAttachment.set(t.texture)}h.bindFramebuffer.set(g.framebuffer),h.viewport.set([0,0,f,f]),t.useProgram("hillshadePrepare").draw(h,u.TRIANGLES,s,o,l,tP.disabled,i_(a.tileID,p),null,null,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),a.needsHillshadePrepare=!1}}(t,r,n,a,u,tI.disabled,c),l.viewport.set([0,0,t.width,t.height]);else if("translucent"===t.renderPass)if(h){let[i,s,l]=t.stencilConfigForOverlapTwoPass(n);rb(t,r,a,l,i,u,c,!1,o),rb(t,r,a,l,s,u,c,!0,o)}else{let[i,s]=t.getStencilConfigForOverlapAndUpdateStencilID(n);rb(t,r,a,s,i,u,c,!1,o)}},colorRelief:function(t,i,r,a,n){if("translucent"!==t.renderPass||!a.length)return;let{isRenderingToTexture:s}=n,o=t.style.projection.useSubdivision,l=t.getDepthModeForSublayer(0,tM.ReadOnly),h=t.colorModeForRenderPass();if(o){let[n,o,u]=t.stencilConfigForOverlapTwoPass(a);rT(t,i,r,u,n,l,h,!1,s),rT(t,i,r,u,o,l,h,!0,s)}else{let[n,o]=t.getStencilConfigForOverlapAndUpdateStencilID(a);rT(t,i,r,o,n,l,h,!1,s)}},raster:function(t,i,r,a,n){if("translucent"!==t.renderPass||0===r.paint.get("raster-opacity")||!a.length)return;let{isRenderingToTexture:s}=n,o=i.getSource(),l=t.style.projection.useSubdivision;if(o instanceof ei)rP(t,i,r,a,null,!1,!1,o.tileCoords,o.flippedWindingOrder,s);else if(l){let[n,o,l]=t.stencilConfigForOverlapTwoPass(a);rP(t,i,r,l,n,!1,!0,rS,!1,s),rP(t,i,r,l,o,!0,!0,rS,!1,s)}else{let[n,o]=t.getStencilConfigForOverlapAndUpdateStencilID(a);rP(t,i,r,o,n,!1,!0,rS,!1,s)}},background:function(t,i,r,a,n){var s;let o=r.paint.get("background-color"),l=r.paint.get("background-opacity");if(0===l)return;let{isRenderingToTexture:h}=n,u=t.context,c=u.gl,d=t.style.projection,p=t.transform,f=p.tileSize,m=r.paint.get("background-pattern");if(t.isPatternMissing(m))return;let _=!m&&1===o.a&&1===l&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==_)return;let g=tI.disabled,y=t.getDepthModeForSublayer(0,"opaque"===_?tM.ReadWrite:tM.ReadOnly),x=t.colorModeForRenderPass(),v=t.useProgram(m?"backgroundPattern":"background"),b=a||eT(p,{tileSize:f,terrain:t.style.map.terrain});m&&(u.activeTexture.set(c.TEXTURE0),t.imageManager.bind(t.context));let w=r.getCrossfadeParameters();for(let i of b){let a=p.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!h,applyTerrainMatrix:!0}),n=m?iA(l,t,m,{tileID:i,tileSize:f},w):iC(l,o),_=null==(s=t.style.map.terrain)?void 0:s.getTerrainData(i),b=d.getMeshFromTileID(u,i.canonical,!1,!0,"raster");v.draw(u,c.TRIANGLES,y,g,x,tP.backCCW,n,_,a,r.id,b.vertexBuffer,b.indexBuffer,b.segments)}},sky:function(t,i){var r,a;let n,s,o,l,h=t.context,u=h.gl,c=(r=t.style.map.transform,a=t.pixelRatio,n=Math.cos(r.rollInRadians),s=Math.sin(r.rollInRadians),o=em(r),l=r.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition,{u_sky_color:i.properties.get("sky-color"),u_horizon_color:i.properties.get("horizon-color"),u_horizon:[(r.width/2-o*s)*a,(r.height/2+o*n)*a],u_horizon_normal:[-s,n],u_sky_horizon_blend:i.properties.get("sky-horizon-blend")*r.height/2*a,u_sky_blend:l}),d=new tM(u.LEQUAL,tM.ReadWrite,[0,1]),p=tI.disabled,f=t.colorModeForRenderPass(),m=t.useProgram("sky"),_=rL(h,i);m.draw(h,u.TRIANGLES,d,p,f,tP.disabled,c,null,void 0,"sky",_.vertexBuffer,_.indexBuffer,_.segments)},atmosphere:function(t,r,a){var n;let s,o,l,h=t.context,u=h.gl,c=t.useProgram("atmosphere"),d=new tM(u.LEQUAL,tM.ReadOnly,[0,1]),p=t.transform,f=(n=t.transform,o=[-(s=a.properties.get("position")).x,-s.y,-s.z],l=i.ap(new Float64Array(16)),"map"===a.properties.get("anchor")&&(i.be(l,l,n.rollInRadians),i.bf(l,l,-n.pitchInRadians),i.be(l,l,n.bearingInRadians),i.bf(l,l,n.center.lat*Math.PI/180),i.bI(l,l,-n.center.lng*Math.PI/180)
51),i.cg(o,o,l),o),m=p.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),_=r.properties.get("atmosphere-blend")*m.projectionTransition;if(0===_)return;let g=tV(p.worldSize,p.center.lat),y=p.inverseProjectionMatrix,x=new Float64Array(4);x[3]=1,i.aE(x,x,p.modelViewProjectionMatrix),x[0]/=x[3],x[1]/=x[3],x[2]/=x[3],x[3]=1,i.aE(x,x,y),x[0]/=x[3],x[1]/=x[3],x[2]/=x[3],x[3]=1;let v={u_sun_pos:f,u_atmosphere_blend:_,u_globe_position:[x[0],x[1],x[2]],u_globe_radius:g,u_inv_proj_matrix:y},b=rL(h,r);c.draw(h,u.TRIANGLES,d,tI.disabled,tS.alphaBlended,tP.disabled,v,null,null,"atmosphere",b.vertexBuffer,b.indexBuffer,b.segments)},custom:function(t,i,r,a){let{isRenderingGlobe:n}=a,s=t.context,o=r.implementation,l=t.style.projection,h=t.transform,u=h.getProjectionDataForCustomLayer(n),c={farZ:h.farZ,nearZ:h.nearZ,fov:h.fov*Math.PI/180,modelViewProjectionMatrix:h.modelViewProjectionMatrix,projectionMatrix:h.projectionMatrix,shaderData:{variantName:l.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
52uniform mat4 u_projection_matrix;
53${l.shaderPreludeCode.vertexSource}`,define:l.shaderDefine},defaultProjectionData:u},d=o.renderingMode?o.renderingMode:"2d";if("offscreen"===t.renderPass){let i=o.prerender;i&&(t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),i.call(o,s.gl,c),s.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),s.setStencilMode(tI.disabled);let i="3d"===d?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,tM.ReadOnly);s.setDepthMode(i),o.render(s.gl,c),s.setDirty(),t.setBaseState(),s.bindFramebuffer.set(null)}},debug:function(t,r,a){for(let n of a)!function(t,r,a){var n,s;let o,l,h,u=t.context,c=u.gl,d=t.useProgram("debug"),p=tM.disabled,f=tI.disabled,m=t.colorModeForRenderPass(),_="$debug",g=null==(n=t.style.map.terrain)?void 0:n.getTerrainData(a);u.activeTexture.set(c.TEXTURE0);let y=r.getTileByID(a.key).latestRawTileData,x=Math.floor(((null==y?void 0:y.byteLength)||0)/1024),v=512/Math.min(r.getTile(a).tileSize,512)*(a.overscaledZ/t.transform.zoom)*.5,b=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(b+=` => ${a.overscaledZ}`),s=`${b} ${x}kB`,t.initDebugOverlayCanvas(),o=t.debugOverlayCanvas,l=t.context.gl,(h=t.debugOverlayCanvas.getContext("2d")).clearRect(0,0,o.width,o.height),h.shadowColor="white",h.shadowBlur=2,h.lineWidth=1.5,h.strokeStyle="white",h.textBaseline="top",h.font="bold 36px Open Sans, sans-serif",h.fillText(s,5,5),h.strokeText(s,5,5),t.debugOverlayTexture.update(o),t.debugOverlayTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE);let w=t.transform.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!0,applyTerrainMatrix:!0});d.draw(u,c.TRIANGLES,p,f,tS.alphaBlended,tP.disabled,ic(i.bo.transparent,v),null,w,_,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),d.draw(u,c.LINE_STRIP,p,f,m,tP.disabled,ic(i.bo.red),g,w,_,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}(t,r,n)},debugPadding:function(t){var i,r;let a=t.transform.padding;rD(t,t.transform.height-(a.top||0),3,rM),rD(t,a.bottom||0,3,rI),rz(t,a.left||0,3,rE),rz(t,t.transform.width-(a.right||0),3,rC);let n=t.transform.centerPoint;i=n.x,r=t.transform.height-n.y,rk(t,i-1,r-10,2,20,rA),rk(t,i-10,r-1,20,2,rA)},terrainDepth:function(t,r){let a=t.context,n=a.gl,s=t.transform,o=tS.unblended,l=new tM(n.LEQUAL,tM.ReadWrite,[0,1]),h=r.tileManager.getRenderableTiles(),u=t.useProgram("terrainDepth");for(let c of(a.bindFramebuffer.set(r.getFramebuffer("depth").framebuffer),a.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),a.clear({color:i.bo.transparent,depth:1}),h)){let t=r.getTerrainMesh(c.tileID),i=r.getTerrainData(c.tileID),h=s.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d={u_ele_delta:r.getMeshFrameDelta(s.zoom)};u.draw(a,n.TRIANGLES,l,tI.disabled,o,tP.backCCW,d,i,h,"terrain",t.vertexBuffer,t.indexBuffer,t.segments)}a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height])},terrainCoords:function(t,r){let a=t.context,n=a.gl,s=t.transform,o=tS.unblended,l=new tM(n.LEQUAL,tM.ReadWrite,[0,1]),h=r.getCoordsTexture(),u=r.tileManager.getRenderableTiles(),c=t.useProgram("terrainCoords");for(let d of(a.bindFramebuffer.set(r.getFramebuffer("coords").framebuffer),a.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),a.clear({color:i.bo.transparent,depth:1}),r.coordsIndex=[],u)){let t=r.getTerrainMesh(d.tileID),i=r.getTerrainData(d.tileID);a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,h.texture);let u={u_terrain_coords_id:(255-r.coordsIndex.length)/255,u_texture:0,u_ele_delta:r.getMeshFrameDelta(s.zoom)},p=s.getProjectionData({overscaledTileID:d.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(a,n.TRIANGLES,l,tI.disabled,o,tP.backCCW,u,i,p,"terrain",t.vertexBuffer,t.indexBuffer,t.segments),r.coordsIndex.push(d.tileID.key)}a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height])}};class rB{constructor(t,r){this.drawFunctions=rF,this.context=new ru(t),this.transform=r,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:i.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=eC.maxOverzooming+eC.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new tr}resize(t,i,r){if(this.width=Math.floor(t*r),this.height=Math.floor(i*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let t of this.style._order)this.style._layers[t].resize()}setup(){let t=this.context,r=new i.aU;r.emplaceBack(0,0),r.emplaceBack(i.a6,0),r.emplaceBack(0,i.a6),r.emplaceBack(i.a6,i.a6),this.tileExtentBuffer=t.createVertexBuffer(r,tl.members),this.tileExtentSegments=i.aV.simpleSegment(0,0,4,2);let a=new i.aU;a.emplaceBack(0,0),a.emplaceBack(i.a6,0),a.emplaceBack(0,i.a6),a.emplaceBack(i.a6,i.a6),this.debugBuffer=t.createVertexBuffer(a,tl.members),this.debugSegments=i.aV.simpleSegment(0,0,4,5);let n=new i.ch;n.emplaceBack(0,0,0,0),n.emplaceBack(i.a6,0,i.a6,0),n.emplaceBack(0,i.a6,0,i.a6),n.emplaceBack(i.a6,i.a6,i.a6,i.a6),this.rasterBoundsBuffer=t.createVertexBuffer(n,t6.members),this.rasterBoundsSegments=i.aV.simpleSegment(0,0,4,2);let s=new i.aU;s.emplaceBack(0,0),s.emplaceBack(i.a6,0),s.emplaceBack(0,i.a6),s.emplaceBack(i.a6,i.a6),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(s,tl.members),this.rasterBoundsSegmentsPosOnly=i.aV.simpleSegment(0,0,4,5);let o=new i.aU;
53o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,tl.members),this.viewportSegments=i.aV.simpleSegment(0,0,4,2);let l=new i.ci;l.emplaceBack(0),l.emplaceBack(1),l.emplaceBack(3),l.emplaceBack(2),l.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(l);let h=new i.aW;h.emplaceBack(1,0,2),h.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(h);let u=this.context.gl;this.stencilClearMode=new tI({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new to(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let a=i.O();i.c7(a,0,this.width,this.height,0,0,1),i.S(a,a,[r.drawingBufferWidth,r.drawingBufferHeight,0]),this.useProgram("clippingMask",null,!0).draw(t,r.TRIANGLES,tM.disabled,this.stencilClearMode,tS.disabled,tP.disabled,null,null,{mainMatrix:a,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a},"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,i,r){if(this.currentStencilSource===t.source||!t.isTileClipped()||!(null==i?void 0:i.length))return;this.currentStencilSource=t.source,this.nextStencilID+i.length>256&&this.clearStencil();let a=this.context;a.setColorMode(tS.disabled),a.setDepthMode(tM.disabled);let n={};for(let t of i)n[t.key]=this.nextStencilID++;this._renderTileMasks(n,i,r,!0),this._renderTileMasks(n,i,r,!1),this._tileClippingMaskIDs=n}_renderTileMasks(t,i,r,a){var n;let s=this.context,o=s.gl,l=this.style.projection,h=this.transform,u=this.useProgram("clippingMask");for(let c of i){let i=t[c.key],d=null==(n=this.style.map.terrain)?void 0:n.getTerrainData(c),p=l.getMeshFromTileID(this.context,c.canonical,a,!0,"stencil"),f=h.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!r,applyTerrainMatrix:!0});u.draw(s,o.TRIANGLES,tM.disabled,new tI({func:o.ALWAYS,mask:0},i,255,o.KEEP,o.KEEP,o.REPLACE),tS.disabled,r?tP.disabled:tP.backCCW,null,d,f,"$clipping",p.vertexBuffer,p.indexBuffer,p.segments)}}_renderTilesDepthBuffer(){var t;let i=this.context,r=i.gl,a=this.style.projection,n=this.transform,s=this.useProgram("depth"),o=this.getDepthModeFor3D();for(let l of eT(n,{tileSize:n.tileSize})){let h=null==(t=this.style.map.terrain)?void 0:t.getTerrainData(l),u=a.getMeshFromTileID(this.context,l.canonical,!0,!0,"raster"),c=n.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!0});s.draw(i,r.TRIANGLES,o,tI.disabled,tS.disabled,tP.backCCW,null,h,c,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,i=this.context.gl;return new tI({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){let i=this.context.gl;return new tI({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let i=this.context.gl,r=t.sort((t,i)=>i.overscaledZ-t.overscaledZ),a=r[r.length-1].overscaledZ,n=r[0].overscaledZ-a+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let t={};for(let r=0;r<n;r++)t[r+a]=new tI({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=n,[t,r]}return[{[a]:tI.disabled},r]}stencilConfigForOverlapTwoPass(t){let i=this.context.gl,r=t.sort((t,i)=>i.overscaledZ-t.overscaledZ),a=r[r.length-1].overscaledZ,n=r[0].overscaledZ-a+1;if(this.clearStencil(),n>1){let t={},s={};for(let r=0;r<n;r++)t[r+a]=new tI({func:i.GREATER,mask:255},n+1+r,255,i.KEEP,i.KEEP,i.REPLACE),s[r+a]=new tI({func:i.GREATER,mask:255},1+r,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*n+1,[t,s,r]}return this.nextStencilID=3,[{[a]:new tI({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[a]:new tI({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},r]}colorModeForRenderPass(){let t=this.context.gl;if(this._showOverdrawInspector){let r=1/8;return new tS([t.CONSTANT_COLOR,t.ONE],new i.bo(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?tS.unblended:tS.alphaBlended}getDepthModeForSublayer(t,i,r){if(!this.opaquePassEnabledForLayer())return tM.disabled;let a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new tM(r||this.context.gl.LEQUAL,i,[a,a])}getDepthModeFor3D(){return new tM(this.context.gl.LEQUAL,tM.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,r){var a,n,s;this.style=t,this.options=r,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(b()),this.imageManager.beginFrame();let o=this.style._order,l=this.style.tileManagers,h={},u={},c={},d={isRenderingToTexture:!1,isRenderingGlobe:(null==(a=t.projection)?void 0:a.transitionState)>0};for(let t in l){let i=l[t];i.used&&i.prepare(this.context),h[t]=i.getVisibleCoordinates(!1),u[t]=h[t].slice().reverse(),c[t]=i.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<o.length;t++)if(this.style._layers[o[t]].is3D()){this.opaquePassCutoff=t;break}for(let t of(this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen",o)){let i=this.style._layers[t];
53if(!i.hasOffscreenPass()||i.isHidden(this.transform.zoom))continue;let r=u[i.source];("custom"===i.type||r.length)&&this.renderLayer(this,l[i.source],i,r,d)}if(null==(n=this.style.projection)||n.updateGPUdependent({context:this.context,useProgram:t=>this.useProgram(t)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?i.bo.black:i.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){let t=this.style._layers[o[this.currentLayer]],i=l[t.source],r=h[t.source];this._renderTileClippingMasks(t,r,!1),this.renderLayer(this,i,t,r,d)}this.renderPass="translucent";let p=!1;for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){let t=this.style._layers[o[this.currentLayer]],i=l[t.source];if(null==(s=this.renderToTexture)?void 0:s.renderLayer(t,d))continue;this.opaquePassEnabledForLayer()||p||(p=!0,d.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let r=("symbol"===t.type?c:u)[t.source];this._renderTileClippingMasks(t,h[t.source],!!this.renderToTexture),this.renderLayer(this,i,t,r,d)}if(d.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let t=function(t,i){let r=null,a=Object.values(t._layers).flatMap(r=>r.source&&!r.isHidden(i)?[t.tileManagers[r.source]]:[]),n=a.filter(t=>"vector"===t.getSource().type),s=a.filter(t=>"vector"!==t.getSource().type),o=t=>{(!r||r.getSource().maxzoom<t.getSource().maxzoom)&&(r=t)};for(let t of n)o(t);if(!r)for(let t of s)o(t);return r}(this.style,this.transform.zoom);t&&this.drawFunctions.debug(this,t,t.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(t){var r,a;if(!(null==(a=null==(r=this.style)?void 0:r.map)?void 0:a.terrain))return;let n=this.terrainFacilitator.matrix,s=this.transform.modelViewProjectionMatrix,o=this.terrainFacilitator.depthDirty;o||(o=t?!i.cj(n,s):!i.ck(n,s)),o||(o=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),o&&(i.cl(n,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var t,i;(null==(i=null==(t=this.style)?void 0:t.map)?void 0:i.terrain)&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(t,r,a,n,s){if(a.isHidden(this.transform.zoom)||"background"!==a.type&&"custom"!==a.type&&!(n||[]).length)return;this.id=a.id;let o=this.drawFunctions;i.aQ(a)?o.symbol(t,r,a,n,this.style.placement.variableOffsets,s):i.cm(a)?o.circle(t,r,a,n,s):i.cn(a)?o.heatmap(t,r,a,n,s):i.co(a)?o.line(t,r,a,n,s):i.cp(a)?o.fill(t,r,a,n,s):i.cq(a)?o.fillExtrusion(t,r,a,n,s):i.cr(a)?o.hillshade(t,r,a,n,s):i.cs(a)?o.colorRelief(t,r,a,n,s):i.bU(a)?o.raster(t,r,a,n,s):i.ct(a)?o.background(t,r,a,n,s):i.cu(a)&&o.custom(t,r,a,s)}saveTileTexture(t){let i=this._tileTextures[t.size[0]];i?i.length<rB.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?i.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let i=this._tileTextures[t];return i&&i.length>0?i.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let i=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!i||!r}useProgram(t,i,r=!1,a=[]){var n;this.cache||(this.cache={});let s=!!this.style.map.terrain,o=this.style.projection,l=r?tn.projectionMercator:o.shaderPreludeCode,h=r?th:o.shaderDefine,u=t+(i?i.cacheKey:"")+`/${r?tu:o.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(s?"/terrain":"")+(a?`/${a.join("/")}`:"");return(n=this.cache)[u]||(n[u]=new ie(this.context,tn[t],i,iz[t],this._showOverdrawInspector,s,l,h,a)),this.cache[u]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,i;if(this._tileTextures){for(let t in this._tileTextures){let i=this._tileTextures[t];
53if(i)for(let t of i)t.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null==(t=this.tileExtentMesh.vertexBuffer)||t.destroy()),this.tileExtentMesh&&(null==(i=this.tileExtentMesh.indexBuffer)||i.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let t in this.cache){let i=this.cache[t];(null==i?void 0:i.program)&&this.context.gl.deleteProgram(i.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:i}=this.context.gl;return this.width!==t||this.height!==i}}function rO(t,i){let r,a=!1,n=null,s=()=>{n=null,a&&(t(...r),n=setTimeout(s,i),a=!1)};return(...t)=>(a=!0,r=t,n||s(),n)}rB.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class rV{constructor(t){this._getCurrentHash=()=>{let t=window.location.hash.replace("#","");if(this._hashName){let i;for(let r of t.split("&").map(t=>t.split("=")))r[0]===this._hashName&&(i=r);return(i&&i[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let i=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getCurrentHash();if(0===t.length)return;let i=t.join("/"),r=i;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r=`${this._hashName}=${i}`);let a=window.location.hash.replace(r,"");a.startsWith("#&")?a=a.slice(0,1)+a.slice(2):"#"===a&&(a="");let n=window.location.href.replace(/(#.+)?$/,a);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=rO(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){let i=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,a=Math.pow(10,Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10)),n=Math.round(i.lng*a)/a,s=Math.round(i.lat*a)/a,o=this._map.getBearing(),l=this._map.getPitch(),h="";if(h+=t?`/${n}/${s}/${r}`:`${r}/${s}/${n}
53`,(o||l)&&(h+="/"+Math.round(10*o)/10),l&&(h+=`/${Math.round(l)}`),this._hashName){let t=this._hashName,i=!1,r=window.location.hash.slice(1).split("&").map(r=>{let a=r.split("=")[0];return a===t?(i=!0,`${a}=${h}`):r}).filter(t=>t);return i||r.push(`${t}=${h}`),`#${r.join("&")}`}return`#${h}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new i.W(+t[2],+t[1])}catch(t){return!1}let r=+t[0],a=+(t[3]||0),n=+(t[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&a>=-180&&a<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}let rj={linearity:.3,easing:i.cv(0,0,.3,1)},rN=i.e({deceleration:2500,maxSpeed:1400},rj),rU=i.e({deceleration:20,maxSpeed:1400},rj),rG=i.e({deceleration:1e3,maxSpeed:360},rj),r$=i.e({deceleration:1e3,maxSpeed:90},rj),rZ=i.e({deceleration:1e3,maxSpeed:360},rj);class rq{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:b(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,i=b();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let r={zoom:0,bearing:0,pitch:0,roll:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:t}of this._inertiaBuffer)r.zoom+=t.zoomDelta||0,r.bearing+=t.bearingDelta||0,r.pitch+=t.pitchDelta||0,r.roll+=t.rollDelta||0,t.panDelta&&r.pan._add(t.panDelta),t.around&&(r.around=t.around),t.pinchAround&&(r.pinchAround=t.pinchAround);let a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){let s=rH(r.pan.mag(),a,i.e({},rN,t||{})),o=r.pan.mult(s.amount/r.pan.mag()),l=this._map.cameraHelper.handlePanInertia(o,this._map.transform);n.center=l.easingCenter,n.offset=l.easingOffset,rW(n,s)}if(r.zoom){let t=rH(r.zoom,a,rU);n.zoom=i.cw(this._map.transform.zoom+t.amount,this._map.getZoomSnap(),t.amount),rW(n,t)}if(r.bearing){let t=rH(r.bearing,a,rG);n.bearing=this._map.transform.bearing+i.al(t.amount,-179,179),rW(n,t)}if(r.pitch){let t=rH(r.pitch,a,r$);n.pitch=this._map.transform.pitch+t.amount,rW(n,t)}if(r.roll){let t=rH(r.roll,a,rZ);n.roll=this._map.transform.roll+i.al(t.amount,-179,179),rW(n,t)}if(n.zoom||n.bearing){let t=void 0===r.pinchAround?r.around:r.pinchAround;n.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),i.e(n,{noMoveStart:!0})}}function rW(t,i){(!t.duration||t.duration<i.duration)&&(t.duration=i.duration,t.easing=i.easing)}function rH(t,r,a){let{maxSpeed:n,linearity:s,deceleration:o}=a,l=i.al(t*s/(r/1e3),-n,n),h=Math.abs(l)/(o*s);return{easing:a.easing,duration:1e3*h,amount:h/2*l}}class rX extends i.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,a,n={}){a=a instanceof MouseEvent?a:new MouseEvent(t,a);const s=w.mousePos(r.getCanvas(),a),o=r.unproject(s);super(t,i.e({point:s,lngLat:o,originalEvent:a},n)),this._defaultPrevented=!1,this.target=r}}class rY extends i.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,r,a){const n="touchend"===t?a.changedTouches:a.touches,s=w.touchPos(r.getCanvasContainer(),n),o=s.map(t=>r.unproject(t)),l=s.reduce((t,i,r,a)=>t.add(i.div(a.length)),new i.P(0,0));super(t,{points:s,point:l,lngLats:o,lngLat:r.unproject(l),originalEvent:a}),this._defaultPrevented=!1}}class rK extends i.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){super(t,{originalEvent:r}),this._defaultPrevented=!1}}class rJ{constructor(t,i){this._map=t,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new rK(t.type,this._map,t))}mousedown(t,i){return this._mousedownPos=i,this._firePreventable(new rX(t.type,this._map,t))}mouseup(t){this._map.fire(new rX(t.type,this._map,t))}click(t,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new rX(t.type,this._map,t))}dblclick(t){return this._firePreventable(new rX(t.type,this._map,t))}mouseover(t){this._map.fire(new rX(t.type,this._map,t))}mouseout(t){this._map.fire(new rX(t.type,this._map,t))}touchstart(t){return this._firePreventable(new rY(t.type,this._map,t))}touchmove(t){this._map.fire(new rY(t.type,this._map,t))}touchend(t){this._map.fire(new rY(t.type,this._map,t))}touchcancel(t){this._map.fire(new rY(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rQ{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new rX(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new rX("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new rX(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class r0{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(i.P.convert(t),this._map.terrain)}}class r1{constructor(t,i){this._map=t,this._tr=new r0(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=i.clickTolerance||1,i.boxZoom&&"object"==typeof i.boxZoom&&(this._boxZoomEnd=i.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,i){this.isEnabled()&&t.shiftKey&&0===t.button&&(w.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(t,i){if(!this._active||this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=w.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));let a=Math.min(r.x,i.x),n=Math.max(r.x,i.x),s=Math.min(r.y,i.y),o=Math.max(r.y,i.y);this._box.style.transform=`translate(${a}px,${s}px)`,this._box.style.width=n-a+"px",this._box.style.height=o-s+"px"}mouseupWindow(t,r){if(!this._active||0!==t.button)return;let a=this._startPos;if(this.reset(),w.suppressClick(),a.x!==r.x||a.y!==r.y)return this._map.fire(new i.n("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,a,r,t):{cameraAnimation:t=>t.fitScreenCoordinates(a,r,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),w.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new i.n(t,{originalEvent:r}))}}function r2(t,i){if(t.length!==i.length)throw Error(`The number of touches and points are not equal - touches ${t.length}, points ${i.length}`);let r={};for(let a=0;a<t.length;a++)r[t[a].identifier]=i[a];return r}class r3{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,r,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(t){let r=new i.P(0,0);for(let i of t)r._add(i);return r.div(t.length)}(r),this.touches=r2(a,r)))}touchmove(t,i,r){if(this.aborted||!this.centroid)return;let a=r2(r,i);for(let t in this.touches){let i=a[t];(!i||i.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,i,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){let t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class r5{constructor(t){this.singleTap=new r3(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,i,r){this.singleTap.touchstart(t,i,r)}touchmove(t,i,r){this.singleTap.touchmove(t,i,r)}touchend(t,i,r){let a=this.singleTap.touchend(t,i,r);
53if(a){let i=t.timeStamp-this.lastTime<500,r=!this.lastTap||30>this.lastTap.dist(a);if(i&&r||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class r6{constructor(t){this._tr=new r0(t),this._zoomIn=new r5({numTouches:1,numTaps:2}),this._zoomOut=new r5({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,i,r){this._zoomIn.touchstart(t,i,r),this._zoomOut.touchstart(t,i,r)}touchmove(t,i,r){this._zoomIn.touchmove(t,i,r),this._zoomOut.touchmove(t,i,r)}touchend(t,r,a){let n=this._zoomIn.touchend(t,r,a),s=this._zoomOut.touchend(t,r,a),o=this._tr;return n?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:i.cw(o.zoom+1,r.getZoomSnap()),around:o.unproject(n)},{originalEvent:t})}):s?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:i.cw(o.zoom-1,r.getZoomSnap()),around:o.unproject(s)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class r4{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let i=this._moveFunction(...t);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(t,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,i){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let a=Array.isArray(i)?i[0]:i;return!this._moved&&a.dist(r)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=a,this._move(r,a))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&w.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let r8={0:1,2:2};class r7{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){let i;return i=r8[this._eventButton],void 0!==t.buttons&&(t.buttons&i)===i}isValidEndEvent(t){return t.button===this._eventButton}}class r9{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class ae{constructor(t=new r7({checkCorrectEvent:()=>!0}),i=new r9){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(t,i,r){return t instanceof MouseEvent?i(t):"u">typeof TouchEvent&&t instanceof TouchEvent?r(t):void 0}startMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.startMove(t)},t=>{this.oneFingerTouchMoveStateManager.startMove(t)})}endMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.endMove(t)},t=>{this.oneFingerTouchMoveStateManager.endMove(t)})}isValidStartEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(t){return this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}}let at=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}};class ai{constructor(t,i){this._clickTolerance=t.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new i.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,i,r){return this._calculateTransform(t,i,r)}touchmove(t,i,r){if(this._active){if(!this._shouldBePrevented(r.length))return t.preventDefault(),this._calculateTransform(t,i,r);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,i,r){this._calculateTransform(t,i,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,a){a.length>0&&(this._active=!0);let n=r2(a,r),s=new i.P(0,0),o=new i.P(0,0),l=0;for(let t in n){let i=n[t],r=this._touches[t];r&&(s._add(i),o._add(i.sub(r)),l++,n[t]=i)}if(this._touches=n,this._shouldBePrevented(l)||!o.mag())return;let h=o.div(l);return this._sum._add(h),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(l),panDelta:h}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ar{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,i,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([i[0],i[1]]))}touchmove(t,i,r){if(!this._firstTwoTouches)return;t.preventDefault();let[a,n]=this._firstTwoTouches,s=aa(r,i,a),o=aa(r,i,n);if(!s||!o)return;let l=this._aroundCenter?null:s.add(o).div(2);return this._move([s,o],l,t)}touchend(t,i,r){if(!this._firstTwoTouches)return;let[a,n]=this._firstTwoTouches,s=aa(r,i,a),o=aa(r,i,n);s&&o||(this._active&&w.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function aa(t,i,r){for(let a=0;a<t.length;a++)if(t[a].identifier===r)return i[a]}function an(t,i){return Math.log(t/i)/Math.LN2}class as extends ar{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(t){this._zoomRate=null!=t?t:1}setZoomThreshold(t){this._zoomThreshold=null!=t?t:.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,i){let r=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(an(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:an(this._distance,r)*this._zoomRate,pinchAround:i}}}function ao(t,i){return 180*t.angleWith(i)/Math.PI}class al extends ar{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,i,r){let a=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ao(this._vector,a),pinchAround:i}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());let i=25/(Math.PI*this._minDiameter)*360;return Math.abs(ao(t,this._startVector))<i}}function ah(t){return Math.abs(t.y)>Math.abs(t.x)}class au extends ar{constructor(t){super(),this._currentTouchCount=0,this._map=t}
53reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,i,r){super.touchstart(t,i,r),this._currentTouchCount=r.length}_start(t){this._lastPoints=t,ah(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,i,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let a=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,n,r.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:-((a.y+n.y)/2*.5)}):void 0}gestureBeginsVertically(t,i,r){if(void 0!==this._valid)return this._valid;let a=t.mag()>=2,n=i.mag()>=2;if(!a&&!n)return;if(!a||!n)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;let s=t.y>0==i.y>0;return ah(t)&&ah(i)&&s}}let ac=100,ad=15,ap=10;class af{constructor(t){this._tr=new r0(t),this._panStep=ac,this._bearingStep=ad,this._pitchStep=ap,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let r=0,a=0,n=0,s=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),s=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),s=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(a=0,n=0),{cameraAnimation:l=>{let h=this._tr;l.easeTo({duration:300,easeId:"keyboardHandler",easing:am,zoom:r?i.cw(h.zoom+r*(t.shiftKey?2:1),l.getZoomSnap()):h.zoom,bearing:h.bearing+a*this._bearingStep,pitch:h.pitch+n*this._pitchStep,offset:[-s*this._panStep,-o*this._panStep],center:h.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function am(t){return t*(2-t)}let a_=1/450;class ag{constructor(t,i){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new r0(t),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=a_}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,r=b(),a=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%4.000244140625==0?this._type="wheel":0!==i&&4>Math.abs(i)?this._type="trackpad":a>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=200>Math.abs(a*i)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let r=w.mousePos(this._map.getCanvas(),t),a=this._tr;this._aroundPoint=this._aroundCenter?a.transform.locationToScreenPoint(i.W.convert(a.center)):r,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let i=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=i),"number"==typeof this._targetZoom&&(this._targetZoom+=i)}if(0!==this._delta){let r="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==a&&(a=1/a);let n="number"!=typeof this._targetZoom?t.scale:i.ao(this._targetZoom),s=t.applyConstrain(t.getCameraLngLat(),i.ar(n*a)).zoom,o=this._map.getZoomSnap();if("wheel"===this._type&&o>0){let r=i.cw(t.zoom,o);this._targetZoom=i.cw(s,o,s-r)}
53else this._targetZoom=s;"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let r="number"!=typeof this._targetZoom?t.zoom:this._targetZoom,a=this._startZoom,n=this._easing,s,o=!1;if("wheel"===this._type&&a&&n){let t=Math.min((b()-this._lastWheelEventTime+5)/200,1),l=n(t);s=i.H.number(a,r,l),t<1?this._needsRerender=!0:o=!0}else s=r,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=s,{noInertia:!0,needsRenderFrame:!o,zoomDelta:s-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=i.cy;if(this._prevEase){let t=this._prevEase,a=(b()-t.start)/t.duration,n=t.easing(a+.01)-t.easing(a),s=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.0729-s*s);r=i.cv(s,o,.25,1)}return this._prevEase={start:b(),duration:t,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ay{constructor(t,i){this._clickZoom=t,this._tapZoom=i}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 ax{constructor(t){this._tr=new r0(t),this.reset()}reset(){this._active=!1}dblclick(t,r){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:i.cw(this._tr.zoom+(t.shiftKey?-1:1),a.getZoomSnap()),around:this._tr.unproject(r)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class av{constructor(){this._tap=new r5({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=null!=t?t:1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,i,r){if(!this._swipePoint)if(this._tapTime){let a=i[0],n=t.timeStamp-this._tapTime<500,s=30>this._tapPoint.dist(a);n&&s?r.length>0&&(this._swipePoint=a,this._swipeTouch=r[0].identifier):this.reset()}else this._tap.touchstart(t,i,r)}touchmove(t,i,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let a=i[0],n=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:n/128*this._zoomRate}}}else this._tap.touchmove(t,i,r)}touchend(t,i,r){if(this._tapTime)this._swipePoint&&0===r.length&&this.reset();else{let a=this._tap.touchend(t,i,r);a&&(this._tapTime=t.timeStamp,this._tapPoint=a)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ab{constructor(t,i,r){this._el=t,this._mousePan=i,this._touchPan=r}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class aw{constructor(t,i,r,a){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=i,this._mousePitch=r,this._mouseRoll=a}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class aT{constructor(t,i,r,a){this._el=t,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class aS{constructor(t,i){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=w.create("div","maplibregl-cooperative-gesture-screen",t);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),a=document.createElement("div");a.className="maplibregl-desktop-message",a.textContent=i,this._container.appendChild(a);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=r,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,r){this._enabled&&(this._map.fire(new i.n("cooperativegestureprevented",{gestureType:t,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let aP=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;class aM extends i.n{}function aI(t){var i;return(null==(i=t.panDelta)?void 0:i.mag())||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}class aE{get _ownerDocument(){var t;return(null==(t=this._el)?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,i;return(null==(i=null==(t=this._el)?void 0:t.ownerDocument)?void 0:i.defaultView)||window}constructor(t,r){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,r)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;let a="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},s={},o={};for(let{handlerName:l,handler:h,allowed:u}of this._handlers){let c;
53if(h.isEnabled()){if(this._blockedByActive(o,u,l))h.reset();else if(h[r||t.type]){if(i.cz(t,r||t.type)){let i=w.mousePos(this._map.getCanvas(),t);c=h[r||t.type](t,i)}else if(i.cA(t,r||t.type)){let i=this._getMapTouches(t.touches),a=w.touchPos(this._map.getCanvas(),i);c=h[r||t.type](t,a,i)}else i.cB(r||t.type)||(c=h[r||t.type](t));this.mergeHandlerResult(n,s,c,l,a),(null==c?void 0:c.needsRenderFrame)&&this._triggerRenderFrame()}(c||h.isActive())&&(o[l]=h)}}let l={};for(let t in this._previousActiveHandlers)o[t]||(l[t]=a);this._previousActiveHandlers=o,(Object.keys(l).length||aI(n))&&(this._changes.push([n,s,l]),this._triggerRenderFrame()),(Object.keys(o).length||aI(n))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:h}=n;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new rq(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);const a=this._el;for(const[t,i,r]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],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"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],[this._ownerWindow,"blur",void 0]],this._listeners))t.addEventListener(i,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(let[t,i,r]of this._listeners)t.removeEventListener(i,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(t){let r=this._map,a=r.getCanvasContainer();this._add("mapEvent",new rJ(r,t));let n=r.boxZoom=new r1(r,t);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();let s=r.cooperativeGestures=new aS(r,t.cooperativeGestures);this._add("cooperativeGestures",s),t.cooperativeGestures&&s.enable();let o=new r6(r),l=new ax(r);r.doubleClickZoom=new ay(l,o),this._add("tapZoom",o),this._add("clickZoom",l),t.interactive&&t.doubleClickZoom&&r.doubleClickZoom.enable();let h=new av;this._add("tapDragZoom",h);let u=r.touchPitch=new au(r);this._add("touchPitch",u),t.interactive&&t.touchPitch&&r.touchPitch.enable(t.touchPitch);let c=()=>r.project(r.getCenter()),d=function({enable:t,clickTolerance:r,aroundCenter:a=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:s=.8},o){return new r4({clickTolerance:r,move:(t,r)=>{let l=o();if(a&&Math.abs(l.y-t.y)>n)return{bearingDelta:i.cx(new i.P(t.x,r.y),r,l)};let h=(r.x-t.x)*s;return a&&r.y<l.y&&(h=-h),{bearingDelta:h}},moveStateManager:new r7({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button&&!t.ctrlKey}),enable:t,assignEvents:at})}(t,c),p=function({enable:t,clickTolerance:i,pitchDegreesPerPixelMoved:r=-.5}){return new r4({clickTolerance:i,move:(t,i)=>({pitchDelta:(i.y-t.y)*r}),moveStateManager:new r7({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button}),enable:t,assignEvents:at})}(t),f=function({enable:t,clickTolerance:i,rollDegreesPerPixelMoved:r=.3},a){return new r4({clickTolerance:i,move:(t,i)=>{let n=a(),s=(i.x-t.x)*r;return i.y<n.y&&(s=-s),{rollDelta:s}},moveStateManager:new r7({checkCorrectEvent:t=>2===t.button&&t.ctrlKey}),enable:t,assignEvents:at})}(t,c);r.dragRotate=new aw(t,d,p,f),this._add("mouseRotate",d,["mousePitch"]),this._add("mousePitch",p,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),t.interactive&&t.dragRotate&&r.dragRotate.enable();let m=function({enable:t,clickTolerance:i}){return new r4({clickTolerance:i,move:(t,i)=>({around:i,panDelta:i.sub(t)}),activateOnStart:!0,moveStateManager:new r7({checkCorrectEvent:t=>0===t.button&&!t.ctrlKey}),enable:t,assignEvents:at})}(t),_=new ai(t,r);r.dragPan=new ab(a,m,_),this._add("mousePan",m),this._add("touchPan",_,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&r.dragPan.enable(t.dragPan);let g=new al,y=new as;r.touchZoomRotate=new aT(a,y,g,h),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&r.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new rQ(r));let x=r.scrollZoom=new ag(r,()=>
53this._triggerRenderFrame());this._add("scrollZoom",x,["mousePan"]),t.interactive&&t.scrollZoom&&r.scrollZoom.enable(t.scrollZoom);let v=r.keyboard=new af(r);this._add("keyboard",v),t.interactive&&t.keyboard&&r.keyboard.enable()}_add(t,i,r){this._handlers.push({handlerName:t,handler:i,allowed:r}),this._handlersById[t]=i}stop(t){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!aP(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,i,r){for(let a in t)if(a!==r&&!(null==i?void 0:i.includes(a)))return!0;return!1}_getMapTouches(t){let i=[];for(let r of t)this._el.contains(r.target)&&i.push(r);return i}mergeHandlerResult(t,r,a,n,s){if(!a)return;i.e(t,a);let o={handlerName:n,originalEvent:a.originalEvent||s};void 0!==a.zoomDelta&&(r.zoom=o),void 0!==a.panDelta&&(r.drag=o),void 0!==a.rollDelta&&(r.roll=o),void 0!==a.pitchDelta&&(r.pitch=o),void 0!==a.bearingDelta&&(r.rotate=o)}_applyChanges(){let t={},r={},a={};for(let[n,s,o]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new i.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(t.rollDelta=(t.rollDelta||0)+n.rollDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),i.e(r,s),i.e(a,o);this._updateMapTransform(t,r,a),this._changes=[]}_updateMapTransform(t,i,r){let a=this._map,n=a._getTransformForUpdate(),s=a.terrain;if(!(aI(t)||s&&this._terrainMovement))return void this._fireEvents(i,r,!0);a._stop(!0);let{panDelta:o,zoomDelta:l,bearingDelta:h,pitchDelta:u,rollDelta:c,around:d,pinchAround:p}=t;void 0!==p&&(d=p),d||(d=a.transform.centerPoint),s&&!n.isPointOnMapSurface(d)&&(d=n.centerPoint);let f={panDelta:o,zoomDelta:l,rollDelta:c,pitchDelta:u,bearingDelta:h,around:d};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(d)&&(d=n.centerPoint);let m=.01>d.distSqr(n.centerPoint)?n.center:n.screenPointToLocation(o?d.sub(o):d);this._handleMapControls({terrain:s,tr:n,deltasForHelper:f,preZoomAroundLoc:m,combinedEventsInProgress:i,panDelta:o}),a._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}_handleMapControls({terrain:t,tr:i,deltasForHelper:r,preZoomAroundLoc:a,combinedEventsInProgress:n,panDelta:s}){let o=this._map.cameraHelper;(o.handleMapControlsRollPitchBearingZoom(r,i),t)?o.useGlobeControls?(!this._terrainMovement&&(n.drag||n.zoom)&&(this._terrainMovement=!0,this._map._elevationFreeze=!0),o.handleMapControlsPan(r,i,a)):!this._terrainMovement&&(n.drag||n.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,o.handleMapControlsPan(r,i,a)):n.drag&&this._terrainMovement&&s?i.setCenter(i.screenPointToLocation(i.centerPoint.sub(s))):o.handleMapControlsPan(r,i,a):o.handleMapControlsPan(r,i,a)}_fireEvents(t,r,a){let n,s=aP(this._eventsInProgress),o=aP(t),l={};for(let i in t){let{originalEvent:r}=t[i];this._eventsInProgress[i]||(l[`${i}start`]=r),this._eventsInProgress[i]=t[i]}for(let t in!s&&o&&this._fireEvent("movestart",o.originalEvent),l)this._fireEvent(t,l[t]);for(let i in o&&this._fireEvent("move",o.originalEvent),t){let{originalEvent:r}=t[i];this._fireEvent(i,r)}let h={};for(let t in this._eventsInProgress){let{handlerName:i,originalEvent:a}=this._eventsInProgress[t];this._handlersById[i].isActive()||(delete this._eventsInProgress[t],n=r[i]||a,h[`${t}end`]=n)}for(let t in h)this._fireEvent(t,h[t]);let u=aP(this._eventsInProgress),c=(s||o)&&!u;if(c&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let t=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(t)}if(a&&c){this._updatingCamera=!0;let t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;t&&(t.essential||!x.prefersReducedMotion)?(r(t.bearing||this._map.getBearing())&&
53(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:n})):(this._map.fire(new i.n("moveend",{originalEvent:n})),r(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,r){this._map.fire(new i.n(t,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new aM("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class aC extends i.E{constructor(t,i,r){super(),this._renderFrameCallback=()=>{let t=Math.min((b()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=r.bearingSnap,this._zoomSnap=r.zoomSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(t,i){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=i}getCenter(){return new i.W(this.transform.center.lng,this.transform.center.lat)}setCenter(t,i){return this.jumpTo({center:t},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,i){return this.jumpTo({elevation:t},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,r,a){return t=i.P.convert(t).mult(-1),this.panTo(this.transform.center,i.e({offset:t},r),a)}panTo(t,r,a){return this.easeTo(i.e({center:t},r),a)}getZoom(){return this.transform.zoom}setZoom(t,i){return this.jumpTo({zoom:t},i),this}zoomTo(t,r,a){return this.easeTo(i.e({zoom:t},r),a)}zoomIn(t,r){return this.zoomTo(i.cw(this.getZoom()+1,this._zoomSnap),t,r),this}zoomOut(t,r){return this.zoomTo(i.cw(this.getZoom()-1,this._zoomSnap),t,r),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,r){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new i.n("movestart",r)).fire(new i.n("move",r)).fire(new i.n("moveend",r))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,i){return this.jumpTo({bearing:t},i),this}getPadding(){return this.transform.padding}setPadding(t,i){return this.jumpTo({padding:t},i),this}rotateTo(t,r,a){return this.easeTo(i.e({bearing:t},r),a)}resetNorth(t,r){return this.rotateTo(0,i.e({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(i.e({bearing:0,pitch:0,roll:0,duration:1e3},t),r),this}snapToNorth(t,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,i):this}getPitch(){return this.transform.pitch}setPitch(t,i){return this.jumpTo({pitch:t},i),this}getRoll(){return this.transform.roll}setRoll(t,i){return this.jumpTo({roll:t},i),this}cameraForBounds(t,i){t=q.convert(t).adjustAntiMeridian();let r=(null==i?void 0:i.bearing)||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),r,i)}_cameraForBoxAndBearing(t,r,a,n){let s={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=i.e({padding:s,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){let t=n.padding;n.padding={top:t,bottom:t,right:t,left:t}}let o=i.e(s,n.padding);n.padding=o;let l=this.transform,h=new q(t,r),u=this.cameraHelper.cameraForBoxAndBearing(n,o,h,a,l);return u&&this._zoomSnap&&(u.zoom=i.cw(u.zoom,this._zoomSnap,-1)),u}fitBounds(t,i,r){return this._fitInternal(this.cameraForBounds(t,i),i,r)}fitScreenCoordinates(t,r,a,n,s){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(i.P.convert(t)),this.transform.screenPointToLocation(i.P.convert(r)),a,n),n,s)}_fitInternal(t,r,a){return t?(delete(r=i.e(t,r)).padding,r.linear?this.easeTo(r,a):this.flyTo(r,a)):this}jumpTo(t,r){this.stop(),"zoom"in t&&this._zoomSnap&&(t.zoom=i.cw(t.zoom,this._zoomSnap));let a=this._getTransformForUpdate(),n=!1,s=!1,o=!1,l=a.zoom;this.terrain&&a.setElevation(this.terrain.getElevationForLngLatZoom(t.center?i.W.convert(t.center):a.center,t.zoom||a.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(a,t);let h=a.zoom!==l;return"elevation"in t&&a.elevation!==+t.elevation&&a.setElevation(+t.elevation),"bearing"in t&&a.bearing!==+t.bearing&&(n=!0,a.setBearing(+t.bearing)),"pitch"in t&&a.pitch!==+t.pitch&&(s=!0,a.setPitch(+t.pitch)),"roll"in t&&a.roll!==+t.roll&&(o=!0,a.setRoll(+t.roll)),null==t.padding||a.isPaddingEqual(t.padding)||a.setPadding(t.padding),this._applyUpdatedTransform(a),this.fire(new i.n("movestart",r)).fire(new i.n("move",r)),h&&this.fire(new i.n("zoomstart",r)).fire(new i.n("zoom",r)).fire(new i.n("zoomend",r)),n&&this.fire(new i.n("rotatestart",r)).fire(new i.n("rotate",r)).fire(new i.n("rotateend",r)),s&&this.fire(new i.n("pitchstart",r)).fire(new i.n("pitch",r)).fire(new i.n("pitchend",r)),o&&this.fire(new i.n("rollstart",r)).fire(new i.n("roll",r)).fire(new i.n("rollend",r)),this.fire(new i.n("moveend",r))}calculateCameraOptionsFromTo(t,r,a,n=0){let s=i.a7.fromLngLat(t,r),o=i.a7.fromLngLat(a,n),l=o.x-s.x,h=o.y-s.y,u=o.z-s.z,c=Math.hypot(l,h,u);if(0===c)throw Error("Can't calculate camera options with same From and To");let d=Math.hypot(l,h),p=i.ar(this.transform.cameraToCenterDistance/c/this.transform.tileSize),f=180*Math.atan2(l,-h)/Math.PI,m=180*Math.acos(d/c)/Math.PI;return m=u<0?90-m:90+m,{center:o.toLngLat(),elevation:n,zoom:p,pitch:m,bearing:f}}calculateCameraOptionsFromCameraLngLatAltRotation(t,i,r,a,n){let s=this.transform.calculateCenterFromCameraLngLatAlt(t,i,r,a);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:r,pitch:a,roll:n}}easeTo(t,r){let a,n;this._stop(!1,t.easeId),"zoom"in(t=i.e({offset:[0,0],duration:500,easing:i.cy},t))&&this._zoomSnap&&(t.zoom=i.cw(t.zoom,this._zoomSnap)),(!1===t.animate||!t.essential&&x.prefersReducedMotion)&&(t.duration=0);let s=this._getTransformForUpdate(),o=this.getBearing(),l=s.pitch,h=s.roll,u="bearing"in t?this._normalizeBearing(t.bearing,o):o,c="pitch"in t?+t.pitch:l,d="roll"in t?this._normalizeBearing(t.roll,h):h,p="padding"in t?t.padding:s.padding,f
53=i.P.convert(t.offset);t.around&&(a=i.W.convert(t.around),n=s.locationToScreenPoint(a));let m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},_=this.cameraHelper.handleEaseTo(s,{bearing:u,pitch:c,roll:d,padding:p,around:a,aroundPoint:n,offsetAsPoint:f,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||(this._rotating=o!==u),this._pitching||(this._pitching=c!==l),this._rolling||(this._rolling=d!==h),this._padding=!s.isPaddingEqual(p),this._zooming||(this._zooming=_.isZooming),this._easeId=t.easeId,this._prepareEase(r,t.noMoveStart,m),this.terrain&&this._prepareElevation(_.elevationCenter),this._ease(i=>{_.easeFunc(i),this.terrain&&!t.freezeElevation&&this._updateElevation(i),this._applyUpdatedTransform(s),this._fireMoveEvents(r)},i=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r,i)},t),this}_prepareEase(t,r,a={}){this._moving=!0,r||a.moving||this.fire(new i.n("movestart",t)),this._zooming&&!a.zooming&&this.fire(new i.n("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new i.n("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new i.n("pitchstart",t)),this._rolling&&!a.rolling&&this.fire(new i.n("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let r=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&r!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(i-(r-(i*t+this._elevationStart))/(1-t)),this._elevationTarget=r}this.transform.setElevation(i.H.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};let i=t.getCameraLngLat(),r=t.getCameraAltitude(),a=this.terrain?this.terrain.getElevationForLngLatZoom(i,t.zoom):0;if(r<a){let r=this.calculateCameraOptionsFromTo(i,a,t.center,t.elevation);return{pitch:r.pitch,zoom:r.zoom}}return{}}_applyUpdatedTransform(t){let i=[];if(i.push(t=>this._elevateCameraIfInsideTerrain(t)),this.transformCameraUpdate&&i.push(t=>this.transformCameraUpdate(t)),!i.length)return;let r=t.clone();for(let t of i){let i=r.clone(),{center:a,zoom:n,roll:s,pitch:o,bearing:l,elevation:h}=t(i);a&&i.setCenter(a),void 0!==h&&i.setElevation(h),void 0!==n&&i.setZoom(n),void 0!==s&&i.setRoll(s),void 0!==o&&i.setPitch(o),void 0!==l&&i.setBearing(l),r.apply(i,!1)}this.transform.apply(r,!1)}_fireMoveEvents(t){this.fire(new i.n("move",t)),this._zooming&&this.fire(new i.n("zoom",t)),this._rotating&&this.fire(new i.n("rotate",t)),this._pitching&&this.fire(new i.n("pitch",t)),this._rolling&&this.fire(new i.n("roll",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;let a=this._zooming,n=this._rotating,s=this._pitching,o=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,a&&this.fire(new i.n("zoomend",t)),n&&this.fire(new i.n("rotateend",t)),s&&this.fire(new i.n("pitchend",t)),o&&this.fire(new i.n("rollend",t)),this.fire(new i.n("moveend",t))}flyTo(t,r){if(!t.essential&&x.prefersReducedMotion){let a=i.V(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(a,r)}this.stop(),"zoom"in(t=i.e({offset:[0,0],speed:1.2,curve:1.42,easing:i.cy},t))&&this._zoomSnap&&(t.zoom=i.cw(t.zoom,this._zoomSnap));let a=this._getTransformForUpdate(),n=a.bearing,s=a.pitch,o=a.roll,l=a.padding,h="bearing"in t?this._normalizeBearing(t.bearing,n):n,u="pitch"in t?+t.pitch:s,c="roll"in t?this._normalizeBearing(t.roll,o):o,d="padding"in t?t.padding:a.padding,p=i.P.convert(t.offset),f=a.centerPoint.add(p),m=a.screenPointToLocation(f),_=this.cameraHelper.handleFlyTo(a,{bearing:h,pitch:u,roll:c,padding:d,locationAtOffset:m,offsetAsPoint:p,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),g=t.curve,y=Math.max(a.width,a.height),v=y/_.scaleOfZoom,b=_.pixelPathLength;"number"==typeof _.scaleOfMinZoom&&(g=Math.sqrt(y/_.scaleOfMinZoom/b*2));let w=g*g;function T(t){let i=(v*v-y*y+(t?-1:1)*w*w*b*b)/(2*(t?v:y)*w*b);return Math.log(Math.sqrt(i*i+1)-i)}function S(t){return(Math.exp(t)-Math.exp(-t))/2}function P(t){return(Math.exp(t)+Math.exp(-t))/2}let M=T(!1),I=function(t){return P(M)/P(M+g*t)},E=function(t){var i;
53return y*((P(M)*(S(i=M+g*t)/P(i))-S(M))/w)/b},C=(T(!0)-M)/g;if(2e-6>Math.abs(b)||!isFinite(C)){if(1e-6>Math.abs(y-v))return this.easeTo(t,r);let i=v<y?-1:1;C=Math.abs(Math.log(v/y))/g,E=()=>0,I=t=>Math.exp(i*g*t)}return t.duration="duration"in t?+t.duration:1e3*C/("screenSpeed"in t?t.screenSpeed/g:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=n!==h,this._pitching=u!==s,this._rolling=c!==o,this._padding=!a.isPaddingEqual(d),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(_.targetCenter),this._ease(m=>{let g=m*C,y=1/I(g),x=E(g);this._rotating&&a.setBearing(i.H.number(n,h,m)),this._pitching&&a.setPitch(i.H.number(s,u,m)),this._rolling&&a.setRoll(i.H.number(o,c,m)),this._padding&&(a.interpolatePadding(l,d,m),f=a.centerPoint.add(p)),_.easeFunc(m,y,x,f),this.terrain&&!t.freezeElevation&&this._updateElevation(m),this._applyUpdatedTransform(a),this._fireMoveEvents(r)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,i){var r;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,i)}return t||null==(r=this.handlers)||r.stop(!1),this}_ease(t,i,r){!1===r.animate||0===r.duration?(t(1),i()):(this._easeStart=b(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,r){let a=Math.abs((t=i.X(t,-180,180))-r);return Math.abs(t-360-r)<a&&(t-=360),Math.abs(t+360-r)<a&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(i.W.convert(t),this.transform):null}}let aA={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class aD{constructor(t=aA){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&("metadata"===t.sourceDataType||"visibility"===t.sourceDataType||"style"===t.dataType||"terrain"===t.type)&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=w.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=w.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=w.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,i){let r=this._map._getUIString(`AttributionControl.${i}`);t.title=r,t.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"!=typeof t?"":t)):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}let i=this._map.style.tileManagers;for(let r in i){let a=i[r];if(a.used||a.usedForTerrain){let i=a.getSource();i.attribution&&!t.includes(i.attribution)&&t.push(i.attribution)}}(t=t.filter(t=>String(t).trim())).sort((t,i)=>t.length-i.length);let r=(t=t.filter((i,r)=>{for(let a=r+1;a<t.length;a++)if(t[a].includes(i))return!1;return!0})).join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=w.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class az{constructor(t={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let i=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&i.classList.add("maplibregl-compact"):i.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){var i;this._map=t,this._compact=null==(i=this.options)?void 0:i.compact,this._container=w.create("div","maplibregl-ctrl");let r=w.create("a","maplibregl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://maplibre.org/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ak{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let i=++this._id;return this._queue.push({callback:t,id:i,cancelled:!1}),i}remove(t){let i=this._currentlyRunning;for(let r of i?this._queue.concat(i):this._queue)if(r.id===t)return void(r.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let i=this._currentlyRunning=this._queue;
53for(let r of(this._queue=[],i))if(!r.cancelled&&(r.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var aR=i.aS([{name:"a_pos3d",type:"Int16",components:3}]);class aL extends i.E{constructor(t){super(),this._lastTilesetChange=b(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,r){this.tileManager.update(t,r),this._renderableTilesKeys=[];let a={};for(let n of eT(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r,calculateTileZoom:this.tileManager._source.calculateTileZoom}))a[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),i.c7(n.terrainRttPosMatrix32f,0,i.a6,i.a6,0,0,1),this._tiles[n.key]=new ec(n,this.tileSize),this._lastTilesetChange=b());for(let t in this._tiles)a[t]||delete this._tiles[t]}freeRtt(t){for(let i in this._tiles){let r=this._tiles[i];(!t||r.tileID.equals(t)||r.tileID.isChildOf(t)||t.isChildOf(r.tileID))&&(r.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,i){return i?this._getTerrainCoordsForTileRanges(t,i):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let r={};for(let a of this._renderableTilesKeys){let n=this._tiles[a].tileID,s=t.clone(),o=i.bj();if(n.canonical.equals(t.canonical))i.c7(o,0,i.a6,i.a6,0,0,1);else if(n.canonical.isChildOf(t.canonical)){let r=n.canonical.z-t.canonical.z,a=n.canonical.x-(n.canonical.x>>r<<r),s=n.canonical.y-(n.canonical.y>>r<<r),l=i.a6>>r;i.c7(o,0,l,l,0,0,1),i.Q(o,o,[-a*l,-s*l,0])}else{if(!t.canonical.isChildOf(n.canonical))continue;{let r=t.canonical.z-n.canonical.z,a=t.canonical.x-(t.canonical.x>>r<<r),s=t.canonical.y-(t.canonical.y>>r<<r),l=i.a6>>r;i.c7(o,0,i.a6,i.a6,0,0,1),i.Q(o,o,[a*l,s*l,0]),i.S(o,o,[1/2**r,1/2**r,0])}}s.terrainRttPosMatrix32f=new Float32Array(o),r[a]=s}return r}_getTerrainCoordsForTileRanges(t,r){let a={};for(let n of this._renderableTilesKeys){let s=this._tiles[n].tileID;if(!this._isWithinTileRanges(s,r))continue;let o=t.clone(),l=i.bj();if(s.canonical.z===t.canonical.z){let r=t.canonical.x-s.canonical.x+t.wrap*(1<<t.canonical.z),a=t.canonical.y-s.canonical.y;i.c7(l,0,i.a6,i.a6,0,0,1),i.Q(l,l,[r*i.a6,a*i.a6,0])}else if(s.canonical.z>t.canonical.z){let r=s.canonical.z-t.canonical.z,a=s.canonical.x-(s.canonical.x>>r<<r)+t.wrap*(1<<s.canonical.z),n=s.canonical.y-(s.canonical.y>>r<<r),o=t.canonical.x-(s.canonical.x>>r),h=t.canonical.y-(s.canonical.y>>r),u=i.a6>>r;i.c7(l,0,u,u,0,0,1),i.Q(l,l,[-a*u+o*i.a6,-n*u+h*i.a6,0])}else{let r=t.canonical.z-s.canonical.z,a=t.canonical.x-(t.canonical.x>>r<<r)+t.wrap*(1<<t.canonical.z),n=t.canonical.y-(t.canonical.y>>r<<r),o=(t.canonical.x>>r)-s.canonical.x,h=(t.canonical.y>>r)-s.canonical.y,u=i.a6<<r;i.c7(l,0,u,u,0,0,1),i.Q(l,l,[a*i.a6+o*u,n*i.a6+h*u,0])}o.terrainRttPosMatrix32f=new Float32Array(l),a[n]=o}return a}getSourceTile(t,i){var r,a;let n=this.tileManager._source,s=t.overscaledZ-this.deltaZoom;if(s>n.maxzoom&&(s=n.maxzoom),s<n.minzoom)return;(r=this._sourceTileCache)[a=t.key]||(r[a]=t.scaledTo(s).key);let o=this.findTileInCaches(this._sourceTileCache[t.key]);if(!(null==o?void 0:o.dem)&&i)for(;s>=n.minzoom&&!(null==o?void 0:o.dem);)o=this.findTileInCaches(t.scaledTo(s--).key);return o}findTileInCaches(t){let i=this.tileManager.getTileByID(t);return i||(i=this.tileManager._outOfViewCache.getByKey(t))}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,i){let r=i[t.canonical.z];return!!r&&(t.wrap>r.minWrap||t.wrap<r.maxWrap||t.canonical.x>=r.minTileXWrapped&&t.canonical.x<=r.maxTileXWrapped&&t.canonical.y>=r.minTileY&&t.canonical.y<=r.maxTileY)}}class aF{constructor(t,i,r){this._meshCache={},this.painter=t,this.tileManager=new aL(i),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this.qual
53ityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){for(let t in this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null),this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,r,a,n=i.a6){var s;let o=t.normalizeCoordinates(r,a,n);if(!o)return 0;let l=this.getTerrainData(o.tileID),h=null==(s=l.tile)?void 0:s.dem;if(!h)return 0;let u=i.cC([],[o.x/n*i.a6,o.y/n*i.a6],l.u_terrain_matrix),c=[u[0]*h.dim,u[1]*h.dim],d=Math.floor(c[0]),p=Math.floor(c[1]),f=c[0]-d,m=c[1]-p;return h.get(d,p)*(1-f)*(1-m)+h.get(d+1,p)*f*(1-m)+h.get(d,p+1)*(1-f)*m+h.get(d+1,p+1)*f*m}getElevationForLngLatZoom(t,r){if(!i.cD(r,t.wrap()))return 0;let{tileID:a,mercatorX:n,mercatorY:s}=this._getOverscaledTileIDFromLngLatZoom(t,r);return this.getElevation(a,n%i.a6,s%i.a6,i.a6)}getElevationForLngLat(t,i){let r=eT(i,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let t of r)t.canonical.z>a&&(a=Math.min(t.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,a)}getElevation(t,r,a,n=i.a6){return this.getDEMElevation(t,r,a,n)*this.exaggeration}getTerrainData(t){var r,a;if(!this._emptyDemTexture){let t=this.painter.context,r=new i.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new i.T(t,r,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new i.T(t,new i.R({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=i.ap([])}let n=this.tileManager.getSourceTile(t,!0);if((null==n?void 0:n.dem)&&(!n.demTexture||n.needsTerrainPrepare)){let t=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new i.T(t,n.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),n.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}let s=n&&n.toString()+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){let r=this.tileManager.getSource().maxzoom,a=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=r?a=t.canonical.z-r:i.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let o=t.canonical.x-(t.canonical.x>>a<<a),l=t.canonical.y-(t.canonical.y>>a<<a),h=i.cE(new Float64Array(16),[1/(i.a6<<a),1/(i.a6<<a),0]);i.Q(h,h,[o*i.a6,l*i.a6,0]),this._demMatrixCache[s]={matrix:h,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:(null==(r=null==n?void 0:n.dem)?void 0:r.dim)||1,u_terrain_matrix:s?this._demMatrixCache[s].matrix:this._emptyDemMatrix,u_terrain_unpack:(null==(a=null==n?void 0:n.dem)?void 0:a.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:((null==n?void 0:n.demTexture)||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){let r=this.painter,a=r.width/devicePixelRatio,n=r.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==a||this._fbo.height!==n)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new i.T(r.context,{width:a,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new i.T(r.context,{width:a,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=r.context.createFramebuffer(a,n,!0,!1),this._fbo.depthAttachment.set(r.context.createRenderbuffer(r.context.gl.DEPTH_COMPONENT16,a,n))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let r=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,i=0;t<this._coordsTextureSize;t++)for(let a=0;a<this._coordsTextureSize;a++,i+=4)r[i+0]=255&a,r[i+1]=255&t,r[i+2]=a>>8<<4|t>>8,r[i+3]=0;let a=new i.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(r.buffer)),n=new i.T(t,a,t.gl.RGBA,{premultiply:!1});return n.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(t){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();let r=new Uint8Array(4),a=this.painter.context,n=a.gl,s=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),o=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),l=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(s,l-o-1,1,1,n.RGBA,n.UNSIGNED_BYTE,r),a.bindFramebuffer.set(null);let h=r[0]+(r[2]>>4<<8),u=r[1]+((15&r[2])<<8),c=this.coordsIndex[255-r[3]],d=c&&this.tileManager.getTileByID(c);if(!d)return null;let p=this._coordsTextureSize,f=(1<<d.tileID.canonical.z)*p;return new i.a7((d.tileID.canonical.x*p+h)/f+d.tileID.wrap,(d.tileID.canonical.y*p+u)/f,this.getElevation(d.tileID,h,u,p))}depthAtPoint(t){let i=new Uint8Array(4),r=this.painter.context,a=r.gl;return r.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),a.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null),(i[0]/0x1000000+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(t){var r;let a=(null==(r=this.painter.style.projection)?void 0:r.transitionState)>0,n=a&&0===t.canonical.y,s=a&&t.canonical.y===(1<<t.canonical.z)-1,o=`m_${n?"n":""}_${s?"s":""}`;if(this._meshCache[o])return this._meshCache[o];let l=this.painter.context,h=new i.cF,u=new i.aW,c=this.meshSize,d=i.a6/c,p=c*c;for(let t=0;t<=c;t++)for(let i=0;i<=c;i++)h.emplaceBack(i*d,t*d,0);for(let t=0;t<p;t+=c+1)for(let i=0;i<c;i++)u.emplaceBack(i+t,c+i+t+1,c+i+t+2),u.emplaceBack(i+t,c+i+t+2,i+t+1);
53let f=h.length,m=f+(c+1),_=(c+1)*c,g=n?i.bq:0,y=+!n,x=s?i.br:i.a6,v=+!s;for(let t=0;t<=c;t++)h.emplaceBack(t*d,g,y);for(let t=0;t<=c;t++)h.emplaceBack(t*d,x,v);for(let t=0;t<c;t++)u.emplaceBack(_+t,m+t,m+t+1),u.emplaceBack(_+t,m+t+1,_+t+1),u.emplaceBack(0+t,f+t+1,f+t),u.emplaceBack(0+t,0+t+1,f+t+1);let b=h.length,w=b+2*(c+1);for(let t of[0,1])for(let r=0;r<=c;r++)for(let a of[0,1])h.emplaceBack(t*i.a6,r*d,a);for(let t=0;t<2*c;t+=2)u.emplaceBack(b+t,b+t+1,b+t+3),u.emplaceBack(b+t,b+t+3,b+t+2),u.emplaceBack(w+t,w+t+3,w+t+1),u.emplaceBack(w+t,w+t+2,w+t+3);let T=new to(l.createVertexBuffer(h,aR.members),l.createIndexBuffer(u),i.aV.simpleSegment(0,0,h.length,u.length));return this._meshCache[o]=T,T}getMeshFrameDelta(t){return 2*Math.PI*i.bD/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,r){var a;if(!i.cD(r,t.wrap()))return 0;let{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(t,r);return null!=(a=this.getMinMaxElevation(n).minElevation)?a:0}getMinMaxElevation(t){let i=this.getTerrainData(t).tile,r={minElevation:null,maxElevation:null};return(null==i?void 0:i.dem)&&(r.minElevation=i.dem.min*this.exaggeration,r.maxElevation=i.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(t,r){let a=i.a7.fromLngLat(t.wrap()),n=(1<<r)*i.a6,s=a.x*n,o=a.y*n,l=Math.floor(s/i.a6),h=Math.floor(o/i.a6);return{tileID:new i.a3(r,0,r,l,h),mercatorX:s,mercatorY:o}}}class aB{constructor(t,i,r){this._context=t,this._size=i,this._tileSize=r,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){let r=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),a=new i.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),r.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),r.colorAttachment.set(a.texture),{id:t,fbo:r,texture:a,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>t.id!==i),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(let t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw Error("No free RenderPool available, call freeAllObjects() required!");let t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(let t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some(t=>!t.inUse)}}let aO={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class aV{constructor(t,i){this.painter=t,this.terrain=i,this.pool=new aB(t.context,30,i.tileManager.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,i){var r,a,n;for(let r in this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter(r=>!t._layers[r].isHidden(i)),this._coordsAscending={},t.tileManagers){this._coordsAscending[r]={};let i=t.tileManagers[r].getVisibleCoordinates(),a=t.tileManagers[r].getSource(),s=a instanceof ei?a.terrainTileRanges:null;for(let t of i){let i=this.terrain.tileManager.getTerrainCoords(t,s);for(let t in i)(n=this._coordsAscending[r])[t]||(n[t]=[]),this._coordsAscending[r][t].push(i[t])}}for(let i of(this._rttFingerprints={},t._order)){let n=t._layers[i],s=n.source;if(aO[n.type]&&!this._rttFingerprints[s]){this._rttFingerprints[s]={};let i=null!=(a=null==(r=t.tileManagers[s])?void 0:r.getState().revision)?a:0;for(let t in this._coordsAscending[s])this._rttFingerprints[s][t]=`${this._coordsAscending[s][t].map(t=>t.key).sort().join()}#${i}`}}for(let t of this._renderableTiles)for(let i in this._rttFingerprints){let r=this._rttFingerprints[i][t.tileID.key];r&&r!==t.rttFingerprint[i]&&(t.rtt=[])}}renderLayer(t,r){if(t.isHidden(this.painter.transform.zoom))return!1;let a=Object.assign(Object.assign({},r),{isRenderingToTexture:!0}),n=t.type,s=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(aO[n]&&(this._prevType&&aO[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!o))return!0;
53if(aO[this._prevType]||aO[n]&&o){this._prevType=n;let t=this._stacks.length-1,r=this._stacks[t]||[];for(let n of this._renderableTiles){if(this.pool.isFull()&&(rR(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[t]){let i=this.pool.getObjectForId(n.rtt[t].id);if(i.stamp===n.rtt[t].stamp){this.pool.useObject(i);continue}}let o=this.pool.getOrCreateFreeObject();for(let l of(this.pool.useObject(o),this.pool.stampObject(o),n.rtt[t]={id:o.id,stamp:o.stamp},s.context.bindFramebuffer.set(o.fbo.framebuffer),s.context.clear({color:i.bo.transparent,stencil:0}),s.currentStencilSource=void 0,r)){let t=s.style._layers[l],i=t.source?this._coordsAscending[t.source][n.tileID.key]:[n.tileID];s.context.viewport.set([0,0,o.fbo.width,o.fbo.height]),s._renderTileClippingMasks(t,i,!0),s.renderLayer(s,s.style.tileManagers[t.source],t,i,a),t.source&&(n.rttFingerprint[t.source]=this._rttFingerprints[t.source][n.tileID.key])}}return rR(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects(),aO[n]}return!1}}let aj={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},aN={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:aA,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:i.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20},aU=class extends aC{get _ownerWindow(){var t,i;return(null==(i=null==(t=this._container)?void 0:t.ownerDocument)?void 0:i.defaultView)||window}constructor(t){var r,a,n;const s=Object.assign(Object.assign(Object.assign({},aN),t),{canvasContextAttributes:Object.assign(Object.assign({},aN.canvasContextAttributes),t.canvasContextAttributes)});if(null!=s.minZoom&&null!=s.maxZoom&&s.minZoom>s.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=s.minPitch&&null!=s.maxPitch&&s.minPitch>s.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=s.minPitch&&s.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=s.maxPitch&&s.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");const o=new tx,l=new tT;void 0!==s.minZoom&&o.setMinZoom(s.minZoom),void 0!==s.maxZoom&&o.setMaxZoom(s.maxZoom),void 0!==s.minPitch&&o.setMinPitch(s.minPitch),void 0!==s.maxPitch&&o.setMaxPitch(s.maxPitch),void 0!==s.renderWorldCopies&&o.setRenderWorldCopies(s.renderWorldCopies),null!==s.transformConstrain&&o.setConstrainOverride(s.transformConstrain),super(o,l,{bearingSnap:s.bearingSnap,zoomSnap:s.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ak,this._controls=[],this._mapId=i.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=t=>{if(t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with i
53d '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(let[i]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${i}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new i.n("webglcontextlost",{originalEvent:t}))}else this.fire(new i.n("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new i.n("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=!0===s.trackResize,this._bearingSnap=s.bearingSnap,this._zoomSnap=s.zoomSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=!0===s.refreshExpiredTiles,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=!0===s.crossSourceCollisions,this._collectResourceTiming=!0===s.collectResourceTiming,this._locale=Object.assign(Object.assign({},aj),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this._zoomLevelsToOverscale=s.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=s.transformCameraUpdate,this.transformConstrain=s.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===s.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(s.anisotropicFilterPitch),void 0!==s.reduceMotion&&(x.prefersReducedMotion=s.reduceMotion),this._imageQueueHandle=f.addThrottleControl(()=>this.isMoving()),this._requestManager=new T(s.transformRequest),this._container=this._resolveContainer(s.container),s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),"u">typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new aE(this,s),this._hash=s.hash?new rV("string"==typeof s.hash&&s.hash||void 0).addTo(this):void 0,(null==(r=this._hash)?void 0:r._onHashChange())||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,i.e({},s.fitBoundsOptions,{duration:0}))));const h="string"==typeof s.style||"globe"!==(null==(n=null==(a=s.style)?void 0:a.projection)?void 0:n.type);this.resize(null,h),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new aD("boolean"==typeof s.attributionControl?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new az,s.logoPosition),this.on("style.load",()=>{if(h||this._resizeTransform(),this.transform.unmodified){let t=i.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}}),this.on("data",t=>{this._update("style"===t.dataType),this.fire(new i.n(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new i.n(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new i.n("sourcedataabort",t))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,i){return this.style.setGlobalStateProperty(t,i),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,r){if(void 0===r&&(r=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!(null==t?void 0:t.onAdd))return this.fire(new i.l(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let a=t.onAdd(this);this._controls.push(t);let n=this._controlPositions[r];
53return r.includes("bottom")?n.insertBefore(a,n.firstChild):n.appendChild(a),this}removeControl(t){if(!(null==t?void 0:t.onRemove))return this.fire(new i.l(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(t);return r>-1&&this._controls.splice(r,1),t.onRemove(this),this}hasControl(t){return this._controls.includes(t)}coveringTiles(t){return eT(this.transform,t)}calculateCameraOptionsFromTo(t,i,r,a){return null==a&&this.terrain&&(a=this.terrain.getElevationForLngLat(r,this.transform)),super.calculateCameraOptionsFromTo(t,i,r,a)}resize(t,r=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(r);let a=!this._moving;return a&&(this.stop(),this.fire(new i.n("movestart",t)).fire(new i.n("move",t))),this.fire(new i.n("resize",t)),a&&this.fire(new i.n("moveend",t)),this}_resizeInternal(t=!0){let[i,r]=this._containerDimensions(),a=this._getClampedPixelRatio(i,r);if(this._resizeCanvas(i,r,a),this.painter.resize(i,r,a),this.painter.overLimit()){let t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];let a=this._getClampedPixelRatio(i,r);this._resizeCanvas(i,r,a),this.painter.resize(i,r,a)}this._resizeTransform(t)}_resizeTransform(t=!0){var i;let[r,a]=this._containerDimensions();this.transform.resize(r,a,t),null==(i=this._requestedCameraState)||i.resize(r,a,t)}_getClampedPixelRatio(t,i){let{0:r,1:a}=this._maxCanvasSize,n=this.getPixelRatio(),s=t*n,o=i*n;return Math.min(s>r?r/s:1,o>a?a/o:1)*n}getPixelRatio(){var t;return null!=(t=this._overridePixelRatio)?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(q.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom){let r=this.transform.zoom,a=this._getTransformForUpdate();return a.setMinZoom(t),this._applyUpdatedTransform(a),this._update(),r!==this.transform.zoom&&this.fire(new i.n("zoomstart")).fire(new i.n("zoom")).fire(new i.n("zoomend")).fire(new i.n("movestart")).fire(new i.n("move")).fire(new i.n("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom){let r=this.transform.zoom,a=this._getTransformForUpdate();return a.setMaxZoom(t),this._applyUpdatedTransform(a),this._update(),r!==this.transform.zoom&&this.fire(new i.n("zoomstart")).fire(new i.n("zoom")).fire(new i.n("zoomend")).fire(new i.n("movestart")).fire(new i.n("move")).fire(new i.n("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch){let r=this.transform.pitch,a=this._getTransformForUpdate();return a.setMinPitch(t),this._applyUpdatedTransform(a),this._update(),r!==this.transform.pitch&&this.fire(new i.n("pitchstart")).fire(new i.n("pitch")).fire(new i.n("pitchend")).fire(new i.n("movestart")).fire(new i.n("move")).fire(new i.n("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>180)throw Error("maxPitch must be less than or equal to 180");if(t>=this.transform.minPitch){let r=this.transform.pitch,a=this._getTransformForUpdate();return a.setMaxPitch(t),this._applyUpdatedTransform(a),this._update(),r!==this.transform.pitch&&this.fire(new i.n("pitchstart")).fire(new i.n("pitch")).fire(new i.n("pitchend")).fire(new i.n("movestart")).fire(new i.n("move")).fire(new i.n("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(t){if((t=null==t?20:t)>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(t<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=t,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this.transform.setConstrainOverride(t),this._update()}project(t){return this.transform.locationToScreenPoint(i.W.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(i.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null==(t=this.handlers)?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null==(t=this.handlers)?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null==(t=this.handlers)?void 0:t.isRotating())}
53_createDelegatedListener(t,i,r){if("mouseenter"===t||"mouseover"===t){let a=!1,n=n=>{let s=i.filter(t=>this.getLayer(t)),o=0!==s.length?this.queryRenderedFeatures(n.point,{layers:s}):[];o.length?a||(a=!0,r.call(this,new rX(t,this,n.originalEvent,{features:o}))):a=!1};return{layers:i,listener:r,delegates:{mousemove:n,mouseout:()=>{a=!1}}}}if("mouseleave"===t||"mouseout"===t){let a=!1,n=n=>{let s=i.filter(t=>this.getLayer(t));(0!==s.length?this.queryRenderedFeatures(n.point,{layers:s}):[]).length?a=!0:a&&(a=!1,r.call(this,new rX(t,this,n.originalEvent)))},s=i=>{a&&(a=!1,r.call(this,new rX(t,this,i.originalEvent)))};return{layers:i,listener:r,delegates:{mousemove:n,mouseout:s}}}{let a=t=>{let a=i.filter(t=>this.getLayer(t)),n=0!==a.length?this.queryRenderedFeatures(t.point,{layers:a}):[];n.length&&(t.features=n,r.call(this,t),delete t.features)};return{layers:i,listener:r,delegates:{[t]:a}}}}_saveDelegatedListener(t,i){var r;this._delegatedListeners||(this._delegatedListeners={}),(r=this._delegatedListeners)[t]||(r[t]=[]),this._delegatedListeners[t].push(i)}_removeDelegatedListener(t,i,r){var a;if(!(null==(a=this._delegatedListeners)?void 0:a[t]))return;let n=this._delegatedListeners[t];for(let t=0;t<n.length;t++){let a=n[t];if(a.listener===r&&a.layers.length===i.length&&a.layers.every(t=>i.includes(t))){for(let t in a.delegates)this.off(t,a.delegates[t]);return void n.splice(t,1)}}}on(t,i,r){if(void 0===r)return super.on(t,i);let a="string"==typeof i?[i]:i,n=this._createDelegatedListener(t,a,r);for(let i in this._saveDelegatedListener(t,n),n.delegates)this.on(i,n.delegates[i]);return{unsubscribe:()=>{this._removeDelegatedListener(t,a,r)}}}once(t,i,r){if(void 0===r)return super.once(t,i);let a="string"==typeof i?[i]:i,n=this._createDelegatedListener(t,a,r);for(let i in n.delegates){let s=n.delegates[i];n.delegates[i]=(...i)=>{this._removeDelegatedListener(t,a,r),s(...i)}}for(let i in this._saveDelegatedListener(t,n),n.delegates)this.once(i,n.delegates[i]);return this}off(t,i,r){return void 0===r?super.off(t,i):(this._removeDelegatedListener(t,"string"==typeof i?[i]:i,r),this)}queryRenderedFeatures(t,r){let a;if(!this.style)return[];let n=t instanceof i.P||Array.isArray(t),s=n?t:[[0,0],[this.transform.width,this.transform.height]];if(r||(r=(n?{}:t)||{}),s instanceof i.P||"number"==typeof s[0])a=[i.P.convert(s)];else{let t=i.P.convert(s[0]),r=i.P.convert(s[1]);a=[t,new i.P(r.x,t.y),r,new i.P(t.x,r.y),t]}return this.style.queryRenderedFeatures(a,r,this.transform)}querySourceFeatures(t,i){return this.style.querySourceFeatures(t,i)}setStyle(t,r){return!1!==(r=i.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
53idateStyle},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(t,r))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let i=this._locale[t];if(null==i)throw Error(`Missing UI string '${t}'`);return i}_updateStyle(t,i){var r,a,n;if(null==(r=this._diffStyleRequest)||r.abort(),this._diffStyleRequest=null,i.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,i));let s=this.style&&i.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new t5(this,i||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,i,s):this.style.loadJSON(t,i,s)):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),null==(n=null==(a=this.style)?void 0:a.projection)||n.destroy(),delete this.style),this}_lazyInitEmptyStyle(){this.style||(this.style=new t5(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,r){return i._(this,void 0,void 0,function*(){var a;if(null==(a=this._diffStyleRequest)||a.abort(),"string"==typeof t){this._diffStyleRequest=new AbortController;let a=this._diffStyleRequest;try{let n=yield this._requestManager.transformRequest(t,"Style");if(a.signal.aborted)return void(this._diffStyleRequest=null);let s=yield i.k(n,a);this._diffStyleRequest=null,this._updateDiff(s.data,r)}catch(t){this._diffStyleRequest=null,i.$(t)||this.fire(new i.l(i.d(t)))}}else"object"==typeof t&&(this._diffStyleRequest=null,this._updateDiff(t,r))})}_updateDiff(t,r){try{this.style.setState(t,r)&&this._update(!0)}catch(a){i.w(`Unable to perform style diff: ${i.d(a).message}.  Rebuilding the style from scratch.`),this._updateStyle(t,r)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();i.w("There is no style added to the map.")}addSource(t,i){return this._lazyInitEmptyStyle(),this.style.addSource(t,i),this._update(!0)}isSourceLoaded(t){var r;let a=null==(r=this.style)?void 0:r.tileManagers[t];if(void 0!==a)return a.loaded();this.fire(new i.l(Error(`There is no tile manager with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){let r=this.style.tileManagers[t.source];if(!r)throw Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);for(let a in null===this.terrain&&r.reload(),this.style._layers){let r=this.style._layers[a];"hillshade"===r.type&&r.source===t.source&&i.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===r.type&&r.source===t.source&&i.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new aF(this.painter,r,t),this.painter.renderToTexture=new aV(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var r;"style"===i.dataType?this.terrain.tileManager.freeRtt():"source"===i.dataType&&i.tile&&(i.sourceId!==t.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null==(r=i.source)?void 0:r.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGroun
53d&&this.transform.setElevation(0);return this.fire(new i.n("terrain",{terrain:t})),this}getTerrain(){var t,i;return null!=(i=null==(t=this.terrain)?void 0:t.options)?i:null}areTilesLoaded(){var t;for(let i of Object.values(null==(t=this.style)?void 0:t.tileManagers))if(!i.areTilesLoaded())return!1;return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}setSourceTileLodParams(t,i,r){if(r){let a=this.getSource(r);if(!a)throw Error(`There is no source with ID "${r}", cannot set LOD parameters`);a.calculateTileZoom=ev(Math.max(1,t),Math.max(1,i))}else for(let r in this.style.tileManagers)this.style.tileManagers[r].getSource().calculateTileZoom=ev(Math.max(1,t),Math.max(1,i));return this._update(!0),this}refreshTiles(t,r){let a=this.style.tileManagers[t];if(!a)throw Error(`There is no tile manager with ID "${t}", cannot refresh tile`);void 0===r?a.reload(!0):a.refreshTiles(r.map(t=>new i.aa(t.z,t.x,t.y)))}addImage(t,r,a={}){let{pixelRatio:n=1,sdf:s=!1,stretchX:o,stretchY:l,content:h,textFitWidth:u,textFitHeight:c}=a;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||i.b(r))){if(void 0===r.width||void 0===r.height)return this.fire(new i.l(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:a,height:d,data:p}=r;return this.style.addImage(t,{data:new i.R({width:a,height:d},new Uint8Array(p)),pixelRatio:n,stretchX:o,stretchY:l,content:h,textFitWidth:u,textFitHeight:c,sdf:s,version:0,userImage:r}),r.onAdd&&r.onAdd(this,t),this}}{let{width:a,height:d,data:p}=x.getImageData(r);this.style.addImage(t,{data:new i.R({width:a,height:d},p),pixelRatio:n,stretchX:o,stretchY:l,content:h,textFitWidth:u,textFitHeight:c,sdf:s,version:0})}}updateImage(t,r){let a=this.style.getImage(t);if(!a)return this.fire(new i.l(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:n,height:s,data:o}=r instanceof HTMLImageElement||i.b(r)?x.getImageData(r):r;if(void 0===n||void 0===s)return this.fire(new i.l(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(n!==a.data.width||s!==a.data.height)return this.fire(new i.l(Error("The width and height of the updated image must be that same as the previous version of the image")));let l=!(r instanceof HTMLImageElement||i.b(r));return a.data.replace(o,l),this.style.updateImage(t,a),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new i.l(Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return i._(this,void 0,void 0,function*(){return f.getImage((yield this._requestManager.transformRequest(t,"Image")),new AbortController)})}listImages(){return this.style.listImages()}addLayer(t,i){return this._lazyInitEmptyStyle(),this.style.addLayer(t,i),this._update(!0)}moveLayer(t,i){return this.style.moveLayer(t,i),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,i,r){return this.style.setLayerZoomRange(t,i,r),this._update(!0)}setFilter(t,i,r={}){return this.style.setFilter(t,i,r),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,i,r,a={}){return this.style.setPaintProperty(t,i,r,a),this._update(!0)}getPaintProperty(t,i){return this.style.getPaintProperty(t,i)}setLayoutProperty(t,i,r,a={}){return this.style.setLayoutProperty(t,i,r,a),this._update(!0)}getLayoutProperty(t,i){return this.style.getLayoutProperty(t,i)}setGlyphs(t,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,i,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,i,r,t=>{t||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,i,t=>{t||this._update(!0)}),this}setLight(t,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,i),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,i),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,i){return this.style.setFeatureState(t,i),this._update()}removeFeatureState(t,i){return this.style.removeFeatureState(t,i),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,i=0;return this._container&&(t=this._container.clientWidth||400,i=this._container.clientHeight||300),[t,i]}_setupResizeObserver(){var t;let i=!1,r=rO(t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())},50),a=null!=(t=this._ownerWindow.ResizeObserver)?t:ResizeObserver;this._resizeObserver=new a(t=>{i?r(t):i=!0}),this._resizeObserver.observe(this._container)}
53_resolveContainer(t){if("string"==typeof t){let i=document.getElementById(t);if(!i)throw Error(`Container '${t}' not found.`);return i}if(t instanceof HTMLElement||t&&"object"==typeof t&&1===t.nodeType)return t;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let i=this._canvasContainer=w.create("div","maplibregl-canvas-container",t);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=w.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let r=this._containerDimensions(),a=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],a);let n=this._controlContainer=w.create("div","maplibregl-control-container",t),s=this._controlPositions={};for(let t of["top-left","top-right","bottom-left","bottom-right"])s[t]=w.create("div",`maplibregl-ctrl-${t} `,n);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i,r){this._canvas.width=Math.floor(r*t),this._canvas.height=Math.floor(r*i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_setupPainter(){let t=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),i=null;this._canvas.addEventListener("webglcontextcreationerror",r=>{i={requestedAttributes:t},r&&(i.statusMessage=r.statusMessage,i.type=r.type)},{once:!0});let r=null;if(!(r=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,t):this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t))){let t="Failed to initialize WebGL";throw i?(i.message=t,Error(JSON.stringify(i))):Error(t)}this.painter=new rB(r,this.transform)}migrateProjection(t,r){super.migrateProjection(t,r),this.painter.transform=t,this.fire(new i.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){var i;return(null==(i=this.style)?void 0:i._loaded)&&(this._styleDirty||(this._styleDirty=t),this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var r,a,n,s,o,l;let h=this._idleTriggered?this._fadeDuration:0,u=(null==(r=this.style.projection)?void 0:r.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let c=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let t=this.transform.zoom,r=b();this.style.zoomHistory.update(t,r);let a=new i.J(t,{now:r,fadeDuration:h,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=a.crossFadingFactor();1===n&&n===this._crossFadingFactor||(c=!0,this._crossFadingFactor=n),this.style.update(a)}let d=(null==(a=this.style.projection)?void 0:a.transitionState)>0!==u;null==(n=this.style.projection)||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null==(s=this.style.projection)?void 0:s.transitionState,null==(o=this.style.projection)?void 0:o.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||d)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=null==(l=this.style)?void 0:l._updatePlacement(this.transform,this.showCollisionBoxes,h,this._crossSourceCollisions,d),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:h,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new i.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.n("load"))),this.style&&(this.style.hasTransitions()||c)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new i.n("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t,r;for(let t of(this._hash&&this._hash.remove(),this._controls))t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),null==(t=this._diffStyleRequest)||t.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"u">typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),f.removeThrottleControl(this._imageQueueHandle),null==(r=this._resizeObserver)||r.disconnect();let a=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==a?void 0:a.loseContext)&&a.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new i.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,x.frame(this._frameRequest,t=>{this._frameRequest=null;try{this._render(t)}catch(t){if(!i.$(t)&&t.message!==rl)throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return g}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}},aG={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class a${constructor(t,r,a=!1){this.mousedown=t=>{this.startMove(t,w.mousePos(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,w.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHandler.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=w.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=w.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos))},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;const n=new ae;this._rotatePitchHandler=new r4({clickTolerance:3,move:(t,n)=>{let s=r.getBoundingClientRect(),o=new i.P((s.bottom-s.top)/2,(s.right-s.left)/2);return{bearingDelta:i.cx(new i.P(t.x,n.y),n,o),pitchDelta:a?-.5*(n.y-t.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=t,r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchcancel",this.reset)}startMove(t,i){this._rotatePitchHandler.dragStart(t,i),w.disableDrag()}move(t,i){let r=this.map,{bearingDelta:a,pitchDelta:n}=this._rotatePitchHandler.dragMove(t,i)||{};a&&r.setBearing(r.getBearing()+a),n&&r.setPitch(r.getPitch()+n)}off(){let t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){w.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}function aZ(t,r,a,n=!1){if(n||!a.getCoveringTilesDetailsProvider().allowWorldCopies())return null==t?void 0:t.wrap();let s=new i.W(t.lng,t.lat);
53if(t=new i.W(t.lng,t.lat),r){let n=new i.W(t.lng-360,t.lat),s=new i.W(t.lng+360,t.lat),o=a.locationToScreenPoint(t).distSqr(r);a.locationToScreenPoint(n).distSqr(r)<o?t=n:a.locationToScreenPoint(s).distSqr(r)<o&&(t=s)}for(;Math.abs(t.lng-a.center.lng)>180;){let i=a.locationToScreenPoint(t);if(i.x>=0&&i.y>=0&&i.x<=a.width&&i.y<=a.height)break;t.lng>a.center.lng?t.lng-=360:t.lng+=360}return t.lng!==s.lng&&a.isPointOnMapSurface(a.locationToScreenPoint(t))?t:s}let aq={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function aW(t,i,r){let a=t.classList;for(let t in aq)a.remove(`maplibregl-${r}-anchor-${t}`);a.add(`maplibregl-${r}-anchor-${i}`)}class aH extends i.E{constructor(t){if(super(),this._onClick=t=>{this.fire(new i.n("click",{originalEvent:t}))},this._onKeyPress=t=>{"Space"!==t.code&&"Enter"!==t.code||this.togglePopup()},this._onMapClick=t=>{let i=t.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()},this._update=t=>{if(!this._map)return;let i=this._map.loaded()&&!this._map.isMoving();"terrain"!==(null==t?void 0:t.type)&&("render"!==(null==t?void 0:t.type)||i)||this._map.once("render",this._update),this._lngLat=aZ(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?a="rotateX(0deg)":"map"===this._pitchAlignment&&(a=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),this._element.style.transform=`${aq[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${r}`,x.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity("moveend"===(null==t?void 0:t.type))}).catch(()=>{})},this._onMove=t=>{if(!this._isDragging){let i=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new i.n("dragstart"))),this.fire(new i.n("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new i.n("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=(null==t?void 0:t.anchor)||"center",this._color=(null==t?void 0:t.color)||"#3FB1CE",this._scale=(null==t?void 0:t.scale)||1,this._draggable=(null==t?void 0:t.draggable)||!1,this._clickTolerance=(null==t?void 0:t.clickTolerance)||0,this._subpixelPositioning=(null==t?void 0:t.subpixelPositioning)||!1,this._isDragging=!1,this._state="inactive",this._rotation=(null==t?void 0:t.rotation)||0,this._rotationAlignment=(null==t?void 0:t.rotationAlignment)||"auto",this._pitchAlignment=(null==t?void 0:t.pitchAlignment)&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(null==t?void 0:t.opacity,null==t?void 0:t.opacityWhenCovered),null==t?void 0:t.element)this._element=t.element,this._offset=i.P.convert((null==t?void 0:t.offset)||[0,0]);else{this._defaultMarker=!0,this._element=w.create("div");const r=w.createNS("http://www.w3.org/2000/svg","svg");r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height","41px"),r.setAttributeNS(null,"width","27px"),r.setAttributeNS(null,"viewBox","0 0 27 41");const a=w.createNS("http://www.w3.org/2000/svg","g");
53a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");const n=w.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"fill-rule","nonzero");const s=w.createNS("http://www.w3.org/2000/svg","g");for(const t of(s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000"),[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}])){const i=w.createNS("http://www.w3.org/2000/svg","ellipse");i.setAttributeNS(null,"opacity","0.04"),i.setAttributeNS(null,"cx","10.5"),i.setAttributeNS(null,"cy","5.80029008"),i.setAttributeNS(null,"rx",t.rx),i.setAttributeNS(null,"ry",t.ry),s.appendChild(i)}const o=w.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"fill",this._color);const l=w.createNS("http://www.w3.org/2000/svg","path");l.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),o.appendChild(l);const h=w.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"opacity","0.25"),h.setAttributeNS(null,"fill","#000000");const u=w.createNS("http://www.w3.org/2000/svg","path");u.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),h.appendChild(u);const c=w.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"transform","translate(6.0, 7.0)"),c.setAttributeNS(null,"fill","#FFFFFF");const d=w.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"transform","translate(8.0, 8.0)");const p=w.createNS("http://www.w3.org/2000/svg","circle");p.setAttributeNS(null,"fill","#000000"),p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"cx","5.5"),p.setAttributeNS(null,"cy","5.5"),p.setAttributeNS(null,"r","5.4999962");const f=w.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#FFFFFF"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962"),d.appendChild(p),d.appendChild(f),n.appendChild(s),n.appendChild(o),n.appendChild(h),n.appendChild(c),n.appendChild(d),r.appendChild(n),r.setAttributeNS(null,"height",41*this._scale+"px"),r.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(r),this._offset=i.P.convert((null==t?void 0:t.offset)||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),aW(this._element,this._anchor,"marker"),null==t?void 0:t.className)for(const i of t.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=i.W.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){let i=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
530,-38.1],"bottom-left":[i,-1*(24.6+i)],"bottom-right":[-i,-1*(24.6+i)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){let t=this._popup;return this._element.style.opacity===this._opacityWhenCovered||t&&(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map))),this}_updateOpacity(t=!1){var r,a;let n=null==(r=this._map)?void 0:r.terrain,s=this._map.transform.isLocationOccluded(this._lngLat);if(!n||s){let t=s?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==t&&(this._element.style.opacity=t,this._element.classList.toggle("maplibregl-marker-covered",s)))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,l=o.terrain.depthAtPoint(this._pos),h=o.terrain.getElevationForLngLat(this._lngLat,o.transform);if(o.transform.lngLatToCameraDepth(this._lngLat,h)-l<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");let u=-this._offset.y/o.transform.pixelsPerMeter,c=Math.sin(o.getPitch()*Math.PI/180)*u,d=o.terrain.depthAtPoint(new i.P(this._pos.x,this._pos.y-this._offset.y)),p=o.transform.lngLatToCameraDepth(this._lngLat,h+c)-d>.006;(null==(a=this._popup)?void 0:a.isOpen())&&p&&this._popup.remove(),this._element.style.opacity=p?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",p)}getOffset(){return this._offset}setOffset(t){return this._offset=i.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,i){return(void 0===this._opacity||void 0===t&&void 0===i)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=String(t)),void 0!==i&&(this._opacityWhenCovered=String(i)),this._map&&this._updateOpacity(!0),this}}let aX={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},aY=0,aK=!1,aJ={maxWidth:100,unit:"metric"};function aQ(t,i,r){let a=(null==r?void 0:r.maxWidth)||100,n=t._container.clientHeight/2,s=t._container.clientWidth/2,o=t.unproject([s-a/2,n]),l=t.unproject([s+a/2,n]),h=Math.min(a,Math.round(t.project(l).x-t.project(o).x),t._container.clientWidth),u=o.distanceTo(l);if("imperial"===(null==r?void 0:r.unit)){let r=3.2808*u;r>5280?a0(i,h,r/5280,t._getUIString("ScaleControl.Miles")):a0(i,h,r,t._getUIString("ScaleControl.Feet"))}else"nautical"===(null==r?void 0:r.unit)?a0(i,h,u/1852,t._getUIString("ScaleControl.NauticalMiles")):u>=1e3?a0(i,h,u/1e3,t._getUIString("ScaleControl.Kilometers")):a0(i,h,u,t._getUIString("ScaleControl.Meters"))}function a0(t,i,r,a){var n;let s,o,l,h=(s=Math.pow(10,`${Math.floor(r)}`.length-1),o=r/s,s*(o=o>=10?10:o>=5?5:o>=3?3:o>=2?2:o>=1?1:(l=Math.pow(10,Math.ceil(-Math.log(n=o)/Math.LN10)),Math.round(n*l)/l)));t.style.width=h/r*i+"px",t.innerHTML=`${h}&nbsp;${a}`}let a1={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0};t.AJAXError=i.cG,t.EXTENT=i.a6,t.Event=i.n,t.Evented=i.E,t.LngLat=i.W,t.MercatorCoordinate=i.a7,t.Point=i.P,t.addProtocol=i.cH,t.config=i.c,t.removeProtocol=i.cI,t.AttributionControl
53=aD,t.BoxZoomHandler=r1,t.CanvasSource=ea,t.CooperativeGesturesHandler=aS,t.DoubleClickZoomHandler=ay,t.DragPanHandler=ab,t.DragRotateHandler=aw,t.EdgeInsets=td,t.FullscreenControl=class extends i.E{constructor(t={}){var r;super(),this._onFullscreenChange=()=>{var t;let i=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;null==(t=null==i?void 0:i.shadowRoot)?void 0:t.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=null!=(r=t.pseudo)&&r,(null==t?void 0:t.container)&&(t.container instanceof HTMLElement?this._container=t.container:i.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=w.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=w.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);w.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new i.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new i.n("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},t.GeoJSONSource=et,t.GeolocateControl=class extends i.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new i.n("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new i.n("geolocate",t)),this._finish()}},this._updateCamera=t=>{let r=new i.W(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,n=this._map.getBearing(),s=i.e({bearing:n},this.options.fitBoundsOptions),o=q.fromLngLat(r,a);this._map.fitBounds(o,s,{geolocateSource:!0})},this._updateMarker=t=>{if(t){let r=new i.W(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&aK)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new i.n("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;let r=(null==t?void 0:t[0])instanceof ResizeObserverEntry;t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new i.n("trackuserlocationend")),this.fire(new i.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>{t.preventDefault()}),this._geolocateButton=w.create("button","maplibregl-ctrl-geolocate",this._container),w.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(!1===t){i.w("Geolocation support is not available so the GeolocateControl will be disabled.");let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{let t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
53se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=w.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new aH({element:this._dotElement}),this._circleElement=w.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new aH({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=i.e({},aX,t)}onAdd(t){return this._map=t,this._container=w.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return i._(this,arguments,void 0,function*(t=!1){if(void 0!==u&&!t)return u;if(void 0===window.navigator.permissions)return u=!!window.navigator.geolocation;try{let t=yield window.navigator.permissions.query({name:"geolocation"});u="denied"!==t.state}catch(t){u=!!window.navigator.geolocation}return u})})().then(t=>this._finishSetupUI(t)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,aY=0,aK=!1}_isOutOfMapMaxBounds(t){let i=this._map.getMaxBounds(),r=t.coords;return i&&(r.longitude<i.getWest()||r.longitude>i.getEast()||r.latitude<i.getSouth()||r.latitude>i.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let t=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&t))return;let i=this._map.project(t),r=this._map.unproject([i.x+100,i.y]),a=t.distanceTo(r)/100,n=2*this._accuracy/a;this._circleElement.style.width=`${n.toFixed(2)}px`,this._circleElement.style.height=`${n.toFixed(2)}px`}trigger(){if(!this._setup)return i.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new i.n("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":aY--,aK=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new i.n("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.n("trackuserlocationstart")),this.fire(new i.n("userlocationfocus"));break;default:throw Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++aY>1?(t={maximumAge:6e5,timeout:0},aK=!0):(t=this.options.positionOptions,aK=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
53se"),this.options.showUserLocation&&this._updateMarker(null)}},t.GlobeControl=class{constructor(){this._toggleProjection=()=>{var t;let i=null==(t=this._map.getProjection())?void 0:t.type;this._map.setProjection("mercator"!==i&&i?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var t;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null==(t=this._map.getProjection())?void 0:t.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(t){return this._map=t,this._container=w.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=w.create("button","maplibregl-ctrl-globe",this._container),w.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},t.Hash=rV,t.ImageSource=ei,t.KeyboardHandler=af,t.LngLatBounds=q,t.LogoControl=az,t.Map=aU,t.MapLibreMap=aU,t.MapMouseEvent=rX,t.MapTouchEvent=rY,t.MapWheelEvent=rK,t.Marker=aH,t.NavigationControl=class{constructor(t){this._updateZoomButtons=()=>{let t=this._map.getZoom(),i=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,i)=>{let r=this._map._getUIString(`NavigationControl.${i}`);t.title=r,t.setAttribute("aria-label",r)},this.options=i.e({},aG,t),this._container=w.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),w.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),w.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=w.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new a$(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,i){let r=w.create("button",t,this._container);return r.type="button",r.addEventListener("click",i),r}},t.Popup=class extends i.E{constructor(t){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new i.n("close"))),this),this._update=t=>{let r;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=w.create("div","maplibregl-popup",this._map.getContainer()),this._tip=w.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let t of this.options.className.split(" "))this._container.classList.add(t);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=aZ(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),t&&"point"in t&&t.point&&(r=t.point),this._trackPointer&&!r)return;let a=this._flatPos=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&r?r:this._map.transform.locationToScreenPoint(this._lngLat));let n=this.options.anchor,s=function t(r){if(r){if("number"==typeof r){let t=Math.round(Math.abs(r)/Math.SQRT2);return{center:new i.P(0,0),top:new i.P(0,r),"top-left":new i.P(t,t),"top-right":new i.P(-t,t),bottom:new i.P(0,-r),"bottom-left":new i.P(t,-t),"bottom-right":new i.P(-t,-t),left:new i.P(r,0),right:new i.P(-r,0)}}if(r instanceof i.P||Array.isArray(r)){let t=i.P.convert(r);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:i.P.convert(r.center||[0,0]),top:i.P.convert(r.top||[0,0]),"top-left":i.P.convert(r["top-left"]||[0,0]),"top-right":i.P.convert(r["top-right"]||[0,0]),bottom:i.P.convert(r.bottom||[0,0]),"bottom-left":i.P.convert(r["bottom-left"]||[0,0]),"bottom-right":i.P.convert(r["bottom-right"]||[0,0]),left:i.P.convert(r.left||[0,0]),right:i.P.convert(r.right||[0,0])}}return t(new i.P(0,0))}(this.options.offset);if(!n){var o,l,h,u,c;let t,i=this._container.offsetWidth,r=this._container.offsetHeight,d=(o=this.options.padding)?{top:null!=(l=o.top)?l:0,right:null!=(h=o.right)?h:0,bottom:null!=(u=o.bottom)?u:0,left:null!=(c=o.left)?c:0}:{top:0,right:0,bottom:0,left:0};t=a.y+s.bottom.y<r+d.top?["top"]:a.y>this._map.transform.height-r-d.bottom?["bottom"]:[],a.x<i/2+d.left?t.pu
53sh("left"):a.x>this._map.transform.width-i/2-d.right&&t.push("right"),n=0===t.length?"bottom":t.join("-")}let d=a.add(s[n]);this.options.subpixelPositioning||(d=d.round()),this._container.style.transform=`${aq[n]} translate(${d.x}px,${d.y}px)`,aW(this._container,n,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=i.e(Object.create(a1),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new i.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=i.W.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let i,r=document.createDocumentFragment(),a=document.createElement("body");for(a.innerHTML=t;i=a.firstChild;)r.appendChild(i);return this.setDOMContent(r)}getMaxWidth(){var t;return null==(t=this._container)?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=w.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}setPadding(t){this.options.padding=t,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=w.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let t=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");t&&t.focus()}},t.RasterDEMTileSource=Y,t.RasterTileSource=X,t.ScaleControl=class{constructor(t){this._onMove=()=>{aQ(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,aQ(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},aJ),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=w.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}}
53,t.ScrollZoomHandler=ag,t.Style=t5,t.TerrainControl=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=t}onAdd(t){return this._map=t,this._container=w.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=w.create("button","maplibregl-ctrl-terrain",this._container),w.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},t.TwoFingersTouchPitchHandler=au,t.TwoFingersTouchRotateHandler=al,t.TwoFingersTouchZoomHandler=as,t.TwoFingersTouchZoomRotateHandler=aT,t.VectorTileSource=H,t.VideoSource=er,t.addSourceType=(t,r)=>i._(void 0,void 0,void 0,function*(){if(es(t))throw Error(`A source type called "${t}" already exists.`);en[t]=r}),t.clearPrewarmedResources=function(){let t=o;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(B),o=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()"))},t.createTileMesh=tD,t.getGlobalDispatcher=U,t.getMaxParallelImageRequests=function(){return i.c.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return eu().getRTLTextPluginStatus()},t.getVersion=function(){return g},t.getWorkerCount=function(){return O.workerCount},t.getWorkerUrl=function(){return i.c.WORKER_URL},t.importScriptInWorkers=function(t){return U().broadcast("IS",t)},t.isTimeFrozen=function(){return v.isFrozen()},t.now=b,t.prewarm=function(){j().acquire(B)},t.restoreNow=function(){v.restoreNow()},t.setMaxParallelImageRequests=function(t){i.c.MAX_PARALLEL_IMAGE_REQUESTS=t},t.setNow=function(t){v.setNow(t)},t.setRTLTextPlugin=function(t,i){return eu().setRTLTextPlugin(t,i)},t.setWorkerCount=function(t){O.workerCount=t},t.setWorkerUrl=function(t){i.c.WORKER_URL=t}}),t}()}}]);

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.